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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
//! Dampen Core - Parser, IR, and Traits
//!
//! This crate contains the core types and traits for the Dampen UI framework.
//!
//! # Overview
//!
//! Dampen Core provides:
//! - **XML Parser**: Parse `.gravity` files into an Intermediate Representation (IR)
//! - **IR Types**: Structured representation of UI widgets and bindings
//! - **Expression Engine**: Evaluate binding expressions like `{counter}` or `{if x > 0}`
//! - **Handler Registry**: Manage event handlers for UI interactions
//! - **Code Generation**: Generate static Rust code for production builds
//! - **Backend Traits**: Abstract interface for rendering backends
//!
//! # Quick Start
//!
//! ```rust
//! use dampen_core::parse;
//!
//! let xml = r#"<column><text value="Hello!" /></column>"#;
//! let doc = parse(xml).unwrap();
//! println!("Parsed {} widgets", doc.root.children.len());
//! ```
//!
//! # Core Concepts
//!
//! ## Intermediate Representation (IR)
//!
//! The IR bridges XML parsing and backend rendering:
//! - [`DampenDocument`] - Root document structure
//! - [`WidgetNode`] - Individual UI widgets
//! - [`WidgetKind`] - Types of widgets (button, text, etc.)
//! - [`AttributeValue`] - Static or bound attribute values
//!
//! ## Binding Expressions
//!
//! Expressions in `{braces}` are parsed into [`Expr`] AST nodes:
//! - Field access: `{user.name}`
//! - Method calls: `{items.len()}`
//! - Conditionals: `{if active then 'yes' else 'no'}`
//! - Binary operations: `{count > 0}`
//!
//! ## Event Handlers
//!
//! Handlers connect UI events to Rust functions:
//! - [`HandlerRegistry`] - Runtime handler storage
//! - [`HandlerSignature`] - Compile-time handler metadata
//! - [`HandlerEntry`] - Different handler types (simple, with value, with command)
//!
//! # Architecture
//!
//! This crate is **backend-agnostic**. It defines traits and types but doesn't
//! implement any specific UI framework. See `dampen-iced` for the Iced backend.
//!
//! # Features
//!
//! - **Zero-copy parsing** with `roxmltree`
//! - **Type-safe** expression evaluation
//! - **Error recovery** with span information
//! - **Code generation** for production builds
//!
//! # Re-exports
//!
//! This crate re-exports all public types from its submodules for convenience.
//! See individual modules for detailed documentation.
// Module declarations
// Public exports
/// Binding value types and the `UiBindable` trait for data models.
///
/// This module provides the core abstraction for data binding in Dampen.
/// Types implementing `UiBindable` can have their fields accessed from
/// binding expressions in XML.
pub use ;
/// Expression evaluation and AST types.
///
/// This module handles parsing and evaluating binding expressions like
/// `{counter}`, `{items.len()}`, and `{if x > 0 then 'yes' else 'no'}`.
pub use ;
/// Event handler management and signatures.
///
/// This module provides the registry for event handlers and signature
/// validation for compile-time checking.
pub use ;
/// Intermediate Representation (IR) types.
///
/// This module contains all types representing the parsed structure of
/// a Dampen UI document, suitable for rendering or code generation.
pub use ;
/// XML parsing and error types.
///
/// This module provides the parser that converts XML markup into the IR.
pub use ;
pub use ;
/// Widget schema definitions and constants.
///
/// This module provides the validation schema for all widget types,
/// ensuring a single source of truth for attribute validation.
pub use *;
/// Backend abstraction traits.
///
/// This module defines the `Backend` trait that rendering implementations
/// must provide.
pub use Backend;
/// Code generation for production builds.
///
/// This module generates static Rust code from Dampen documents,
/// eliminating runtime parsing overhead.
pub use ;
/// Application state container for UI views.
///
/// This module provides the [`AppState`] struct that combines
/// a parsed UI document with application state and event handlers.
pub use AppState;
/// Runtime theme context for managing active themes.
///
/// This module provides the [`ThemeContext`] struct for
/// managing theme state including active theme, switching, and hot-reload.
pub use ThemeContext;
/// Shared state container for inter-window communication.
///
/// This module provides the [`SharedContext`] struct for
/// sharing state across multiple views in a Dampen application.
pub use SharedContext;
/// Tokenize a binding expression for debugging or custom processing.
pub use tokenize_binding_expr;
/// Version of the Dampen framework
pub const VERSION: &str = env!;