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
//! Static template storage for Dioxus views.
//!
//! The `rsx!` macro lowers each view into two pieces:
//!
//! - a static [`Template`] describing the stable element, text, and static
//! attribute structure
//! - runtime dynamic node and dynamic attribute arrays for one render
//!
//! The template uses compact paths and anchors to connect those runtime values
//! back to stable locations in the static tree.
//!
//! ## Annotated RSX lowering
//!
//! Consider this `rsx!` block:
//!
//! ```rust,ignore
//! rsx! {
//! {before}
//! div { class: "{class_name}",
//! "Hello "
//! strong { "{name}" }
//! {badge}
//! "{count}"
//! span { "!" }
//! }
//! {after}
//! }
//! ```
//!
//! Dynamic nodes do not receive their own paths. Paths are only stored when an
//! emitted anchor needs to point to a static node. The path
//! notation below is a tree walk: `0` means "next child", and `1` means "next
//! sibling". The empty path is the vnode render-parent site; it is not a real
//! static node.
//!
//! This table includes only paths that are actually emitted in anchor slot
//! targets for the example above:
//!
//! ```text
//! Path walk Last static node? Why it is emitted
//! 0 false root anchor for div / node before div
//! 0 false dynamic class attrs on div
//! 001 true dynamic text inside strong
//! 0011 false badge and count before span
//! 0 true trailing root dynamic node after div
//! ```
//!
//! There is no emitted path for `"Hello "` because no dynamic slot is anchored
//! to that static text node. The same path can appear with different parent
//! ownership: a root-level anchor at `0` can insert before `div`, while an
//! element-owned anchor at `0` applies dynamic attributes to `div`.
//!
//! The low tag bit on an anchor path records whether the path is the last
//! static node before the dynamic slot. When it is false, dynamic nodes insert
//! before the static node at `path`. When it is true, dynamic nodes insert
//! after that static node, or append to it when the path is also the anchor's
//! owning element.
//!
//! Anchors are created for dynamic node or attribute groups and for every root static node. A
//! non-root static element appears as an anchor parent only when it owns dynamic attributes or a
//! direct dynamic child insertion position. Root-level anchors use `None` as their parent.
//!
//! Dynamic nodes and dynamic attributes are pushed into separate runtime arrays
//! as the typed view renders. An element's dynamic attributes are pushed before
//! its dynamic children, so the example above produces values like this:
//!
//! ```text
//! Node index Runtime node
//! 0 before
//! 1 text from "{name}"
//! 2 badge
//! 3 text from "{count}"
//! 4 after
//!
//! Attr index Runtime attrs
//! 0 class from "{class_name}"
//! ```
//!
//! Anchors map ranges from those arrays to static paths plus the last-static
//! flag. A root static node always has an anchor, even when it owns no dynamic
//! values, so renderers can use the same anchor list for hydration and template
//! cloning.
//!
//! ```text
//! Nodes Attrs Parent element op Path Last? Meaning
//! 0..1 0..0 None 0 false root node before div
//! 1..1 0..1 div 0 false dynamic class attrs for div
//! 1..2 1..1 strong 001 true "{name}" inside strong
//! 2..4 1..1 div 0011 false badge and count before span
//! 4..5 1..1 None 0 true trailing root node
//! ```
//!
//! Adjacent dynamic nodes at the same insertion position share one anchor. In
//! the example, `{badge}` and `"{count}"` are both before `span`, so they are
//! represented by the single `2..4` node range.
//!
//! The stored anchor slice is in source/template order.
//!
pub use TemplateAnchor;
pub use ;
pub use DecodedTemplateOp;
pub use ;
pub use TemplateRawTree;
pub use ;
pub use build_runtime_template;
pub use ;