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
61
62
63
64
65
66
67
68
69
70
//! Declarative JSON window engine — **PC/Desktop path**.
//!
//! This module provides runtime construction of widget trees from JSON
//! layout declarations. It is the **PC/desktop path** in the dual-path
//! declarative UI strategy:
//!
//! - **PC path (this module)**: JSON runtime loading via `serde_json`,
//! supports hot-reload, dynamic UI, and design tool integration.
//! - **Embedded path (future)**: Procedural macros at compile time,
//! zero runtime overhead for MCU/RTOS targets.
//!
//! # Architecture
//!
//! ```text
//! ┌──────────────────────┐
//! │ JSON source / string │
//! └──────────┬───────────┘
//! ▼
//! ┌──────────────────────┐
//! │ 1. Parsing │ serde_json::Value → DeclarativeNode
//! └──────────┬───────────┘
//! ▼
//! ┌──────────────────────┐
//! │ 2. Layout layer │ Parse "layout" objects → LayoutKind
//! └──────────┬───────────┘ → create Layout trait object
//! ▼
//! ┌──────────────────────┐
//! │ 3. Instantiation │ DeclarativeNode → Box<dyn Widget>
//! └──────────┬───────────┘
//! ▼
//! ┌──────────────────────┐
//! │ 4. Binding layer │ "on_click" → EventHandlerMap
//! └──────────────────────┘
//! ```
//!
//! # JSON Layout Format
//!
//! ```json
//! {
//! "window": {
//! "id": "main",
//! "title": "Hello",
//! "width": 400,
//! "height": 300,
//! "layout": {
//! "type": "vbox",
//! "children": [
//! { "label": { "id": "greeting", "text": "Hello, World!" } },
//! { "button": { "id": "btn_ok", "text": "OK" } }
//! ]
//! }
//! }
//! }
//! ```
pub use BoundJsonLayout;
pub use ;
pub use ;
pub use ;