a2ui_slint/lib.rs
1//! Slint backend for A2UI.
2//!
3//! Translates an A2UI component tree (the flat `id → ComponentModel` map owned
4//! by [`a2ui_base::model`]) into a Slint reactive tree and bridges Slint UI
5//! events back to the framework-agnostic interaction layer in `a2ui_base`.
6//!
7//! Unlike the ratatui backend (immediate-mode painting on a character grid),
8//! Slint is retained-mode + declarative: layout is handled by Slint's engine,
9//! so this backend does **not** reproduce the tui's measure pass or
10//! `layout_engine`. Instead it walks the component tree into a [`live_tree`]
11//! model that `.slint` components bind to reactively.
12//!
13//! Everything here lives behind the `backend` cargo feature, which pulls in the
14//! Slint runtime. Without it this crate is an empty shell (it compiles with no
15//! dependencies beyond `a2ui-base`), keeping the workspace's default build light.
16
17#![cfg_attr(not(feature = "backend"), allow(unused_imports))]
18
19#[cfg(feature = "backend")]
20pub mod host;
21#[cfg(feature = "backend")]
22pub mod live_tree;
23#[cfg(feature = "backend")]
24pub mod ui;
25
26/// The reactive-tree node type generated from `.slint` (see `build.rs`).
27#[cfg(feature = "backend")]
28pub use ui::LiveNode;
29
30/// Re-export the core interaction pieces backends compose against, so consumers
31/// can `use a2ui_slint::{dispatch_event, apply_event_result, ...}` in one place.
32#[cfg(feature = "backend")]
33pub use a2ui_base::components::dispatch_event;
34#[cfg(feature = "backend")]
35pub use a2ui_base::focus::FocusManager;
36#[cfg(feature = "backend")]
37pub use a2ui_base::interaction::apply_event_result;