Expand description
UI-6: the view tree — UI-4’s compiled components/<name>.json, and
its interpreter over a Renderer.
Node kinds (the contract’s): el (attrs each a string or { "expr" },
on event → handler, children), text (a string or { "expr" }),
if / then / else, each (as, key, body), component (props),
and slot (a section: its name and the props of what fills it).
Mounting draws the tree once and makes one binding per dynamic place
(an attribute, a text, an if, an each): a fold that changes a state
key re-runs only the bindings that read it. An if and an each hold
their place with an empty text node (their anchor) and insert before
it; an each is keyed — a row whose key stays keeps its nodes.
A component node draws as an element named for the component
(<ticket-row>), filled by the engine through Children; a slot
as a div carrying data-slot (and data-layout), filled the same way.
FRAME-29: a component node naming a component the rhx runtime does not
draw (another profile: Children::binds) draws as a bound mark — a
div carrying data-slot and data-component (both the component’s
name) and data-layout — filled as a section bound to it
(Children::mount_bound), its props the node’s, as values.
Re-exports§
Modules§
- expr
- UI-6: the template’s expressions — Rhai, over the scope: the props by
name,
state, eachlivecollection by name ({ rows, status }), and each{#each}’s variable. An expression is compiled once; what it reads is found by scanning its text (Reads), so a binding reads (and so tracks) only the state keys and names it names. - recording
- UI-6: the recording renderer — the native tests’
Renderer: every call kept in order (Call), and the tree it built kept too, so a test asserts both what was called and what is drawn (Recording::html). A node is a number;0is the root, there from the start.
Structs§
- Component
Tree - A component’s compiled tree —
components/<name>.json. - Live
Decl - A
livedeclaration: the snapshot method and its params, the changes method and its own params (changes_params), the key, and the folds by event type (upsert:ticket, …). A param is a JSON value or{ "expr" }. - Mounted
- A mounted tree: its nodes under the parent and its bindings.
- Scope
- What a tree is mounted with: the props by name, the state, the
livecollections by name (each{ rows, status }), and where its events go. - State
- A component’s state as signals, one per top-level key: replacing it sets only the keys whose value changed.
Enums§
- Attr
- A value in the tree: a literal string, or a Rhai expression over the scope.
- Node
- One node of a compiled tree.
- Tree
Error - Why a tree did not parse or mount.
Traits§
- Children
- The engine’s side of a mount: fills a
componentorslotnode’s element, and empties it when the node goes. - Renderer
- What draws: the DOM in the browser,
Recordingin the tests. Every method takes&self(a handle), asweb_sys’s do.
Functions§
- eval_
params - eval_
when - UI-10: a
live’s params evaluated over the scope — a{ "expr" }value a Rhai expression over the props andstate(its reads of state tracked, so a binding around this re-runs when they change), any other value as written. FRAME-16: whether alive’swhenlets it ask — none, or a value (read from the scope when it is{ "expr" }) that is not false, null, empty or 0. - mount
- Draws
treeintoparent(appended) withscope, throughrenderer;childrenfills its components and slots.
Type Aliases§
- Unlisten
- What
Renderer::listenanswers: called once, it removes the listener.