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
//! # `WaterUI` Core
//!
//! `waterui_core` provides the essential building blocks for developing cross-platform reactive UIs.
//! This foundation layer establishes a unified architecture that works consistently across desktop,
//! mobile, web, and embedded environments.
//!
//! ## Architecture Overview
//!
//! The system is structured around these key concepts:
//!
//! ### Declarative View System
//!
//! The [`View`] trait forms the foundation of the UI component model:
//! ```text
//! pub trait View: 'static {
//! fn body(self, env: &Environment) -> impl View;
//! }
//! ```
//!
//! This recursive definition enables composition of complex interfaces from simple
//! building blocks. Each view receives contextual information and transforms into
//! its visual representation.
//!
//! ### Context Propagation
//!
//! The [`Environment`] provides a type-based dependency injection system:
//!
//! ```rust
//! use waterui_core::Environment;
//!
//! let env = Environment::new();
//! // .with() and .install() methods would be used with actual theme and plugin types
//! ```
//!
//! This propagates configuration and resources through the view hierarchy without
//! explicit parameter passing.
//!
//! ### Type Erasure
//!
//! [`AnyView`] enables heterogeneous collections by preserving behavior while
//! erasing concrete types, facilitating dynamic composition patterns.
//!
//! ## Component Architecture
//!
//! The framework provides several component categories:
//!
//! - **Platform Components**: Native UI elements with platform-optimized rendering
//! - **Reactive Components**: Views that automatically update when data changes
//! - **Metadata Components**: Elements that carry additional rendering instructions
//! - **Composite Components**: Higher-order components built from primitive elements
//!
//! ## Reactive Data Flow
//!
//! State management integrates seamlessly with the view system:
//!
//! ```rust
//! use waterui_core::{Binding, Signal, SignalExt};
//!
//! // Create a reactive state container
//! let counter = Binding::container(0);
//!
//! // Derive the exact value consumed by a signal-aware component.
//! let label = counter.map(|count| format!("Current value: {count}"));
//! assert_eq!(label.get(), "Current value: 0");
//! ```
//!
//! Signal-aware component inputs subscribe to derived values and update only the
//! affected native property. Structural subtree replacement is reserved for cases
//! where the view identity itself changes.
//!
//! ## Extensibility
//!
//! The plugin interface enables framework extensions without modifying core code:
//!
//! ```rust
//! use waterui_core::{plugin::Plugin, Environment};
//!
//! struct MyPlugin;
//! impl Plugin for MyPlugin {}
//!
//! let mut env = Environment::new();
//! MyPlugin.install(&mut env);
//! ```
//!
//! This enables modular functionality like theming, localization, and platform-specific features.
extern crate alloc;
pub use ;
pub use ;
pub use Error;
pub use AnyView;
pub use *;
pub use ;
pub use Environment;
pub use State;
pub use MainThreadBound;
pub use flatten_signal;
pub use ;
pub use nami as reactive;
pub use IntoSignal;
pub use ;
pub use IntoSignalF32;
pub use ;
pub use View;
pub use ;
pub use Str;