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
//! Fine-grained reactivity: `Signal`, `Memo`, `Effect`, ownership scopes
//! and the frame scheduler. This is the engine's "React" — but SolidJS
//! style: dependencies tracked at read time, updates propagate to exactly
//! the affected computations, which mark exactly the affected UI regions
//! damaged. No virtual-DOM diffing, no full-frame immediate mode.
//!
//! Owner: REACT. Design rationale + literature survey:
//! `docs/design/reactive-ui.md`.
//!
//! ## Model in five sentences
//!
//! Nodes (signals, memos, effects, scopes) live in a hand-rolled
//! generational arena; user handles are `Copy` ids. Reads record edges
//! from the value to the *currently running* computation. A write marks
//! direct observers `Dirty` and transitive observers `Check` (two-phase
//! marking), queueing any effects it reaches. Effects flush in creation
//! order — outside `batch` immediately after the write, inside `batch`
//! once at the end — and each effect PULLS its sources up to date first,
//! so it observes a single consistent world (diamond-safe, glitch-free).
//! Memos recompute lazily on observation and stop propagation when the
//! new value compares equal.
//!
//! ## Quick start
//!
//! ```
//! use abstracttui::reactive::{batch, create_root};
//! use std::{cell::RefCell, rc::Rc};
//!
//! let log = Rc::new(RefCell::new(Vec::new()));
//! let (root, ()) = create_root(|cx| {
//! let count = cx.signal(0);
//! let doubled = cx.memo(move || count.get() * 2);
//! let log2 = log.clone();
//! cx.effect(move || log2.borrow_mut().push(doubled.get()));
//! count.set(3);
//! batch(|| {
//! count.set(4);
//! count.set(5); // coalesced: the effect sees only 10
//! });
//! });
//! assert_eq!(*log.borrow(), vec![0, 6, 10]);
//! root.dispose();
//! ```
pub use ;
pub use ;
pub use Effect;
pub use Memo;
pub use ;
pub use ;
pub use ;
pub use Signal;
pub use ;