1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! [`DioxusCtx`] — OxiUI [`UiCtx`] implementation that collects widget calls
//! for Dioxus reactive rendering.
//!
//! Dioxus 0.7 is a reactive, component-based framework (not immediate-mode).
//! [`DioxusCtx`] bridges the gap by operating in two phases:
//!
//! 1. **Collection pass** — the user's content closure is called with a
//! `DioxusCtx`, accumulating widget descriptions in `items`.
//! 2. **Render pass** (M6) — the collected items are converted into a Dioxus
//! `VNode` tree via `rsx!` / `Element` constructors and returned to the
//! Dioxus runtime.
//!
//! For M5, only the collection pass is active, enabling headless tests and a
//! build-passing example without requiring a display server.
use ;
/// A [`UiCtx`] adapter for Dioxus that collects widget descriptions.
///
/// Widget calls are recorded in `items` in the order they are invoked.
/// Each entry uses the format `"<kind>:<text>"` (e.g. `"label:Hello"`).
///
/// # Example
/// ```
/// use oxiui_dioxus::DioxusCtx;
/// use oxiui_core::UiCtx;
///
/// let mut ctx = DioxusCtx::default();
/// ctx.heading("App Title");
/// ctx.label("Hello, Dioxus!");
/// let _resp = ctx.button("Click me");
/// assert_eq!(ctx.items.len(), 3);
/// ```