Expand description
UI-6: the engine — the host interface engine/1 of UI-4’s contract.
The engine owns what lives across swaps: the socket, the cache, the signals, the registry. A component owns only its tree and its folds; it never touches the DOM, the socket or another component.
| module | what it holds |
|---|---|
signals | a signal runtime: signals::Signal, bindings re-run only when a signal they read changes |
tree | the compiled view tree (UI-4’s schema), its interpreter over a tree::Renderer; the recording renderer (native tests) and, with dom, the DOM one |
live | live(): a collection { rows, status } folded from a snapshot and a changes stream, shared by method and params, kept 5 s past its last reader |
folds | a component’s handlers in Rhai — (state, event) → state, only call and navigate registered, call held to the component’s uses |
swap | the bundle’s manifest, the module registry (name → hashes), mounting, hot-swap, and the sections (slots and their assignments) |
html | UI-10: {@html} and markdown() — an allow-list sanitizer to a tree the renderer draws |
router | manifest.routes: a hash route to a component, its :name segments the props |
transport | the wire seam (transport::Wire): the one socket on wasm32, a fake for the tests |
bus | FRAME-12: what every mounted component is handed — call and live held to its uses, emit / on, navigate, slots_set |
keys | FRAME-36: every mounted component’s shortcuts — chords and sequences, matched on the window’s capture phase, the ? overlay |
marks | FRAME-17: the host’s steps on the page’s clock, performance.mark plexus-ui:* |
module | FRAME-12: the module contract every profile implements, mount(target, { props, bus }) → { update, destroy } |
FRAME-12 cuts it in two: the host — transport, live,
swap (versions, hot-swap, sections), router, bus,
module and the signals they publish on — and the rhx runtime,
the first profile (rhx/1): tree, folds, html. A module of
any other profile is an ES module the page imports; js/host.js is the
host’s JS face, beside engine.js in every bundle.
The wasm entry (boot) is [entry], behind the dom feature.
Modules§
- bus
- FRAME-12: the bus — what the host hands every mounted component,
whatever drew it (the rhx runtime, a module written by hand, FRAME-13’s
Svelte): one
Busper page, oneMemberper mounted component. - folds
- UI-6: the folds — a component’s handlers,
components/<name>.rhai, run in Rhai: everyfn name(state, ev)returns the new state. - html
- UI-10: HTML the page may hold —
{@html expr}draws the expression’s text as HTML, andmarkdown(text)makes HTML of markdown; both go throughsanitizefirst. - keys
- FRAME-36: keys — a component’s shortcuts, the host’s to handle.
- live
- UI-6:
live()— a component’s collection bound to Plexus streams:{ rows, status }. - marks
- FRAME-17: the host’s marks — its steps on the page’s clock, each a
performance.marknamedplexus-ui:<step>(CONTRACT.md’s host chapter), read by a probe withperformance.getEntriesByType("mark"): - module
- FRAME-12: the module contract — what every profile implements and
the host mounts:
mount(target, { props, bus }) → { update(props), destroy() }. In the page a module is an ES module (esm/1written by hand,svelte/1from FRAME-13) the host imports from its version’scomponents/<name>.jsand wraps ([crate::entry]’sJsModule); the rhx runtime (rhx/1, the tree and the folds) is the host’s own arm of the same lifecycle incrate::swap— mounted, updated, swapped, fallen back and destroyed by the same rules. - router
- UI-6: the router —
manifest.routes: a hash route (#/ticket/T-1) to the component drawn (a layout too) and its props, each:namesegment of the pattern a prop. The most specific pattern wins: one with fewer:segments over one with more (#/ticket/newover#/ticket/:id). - signals
- UI-6: the signal runtime — no framework. A
Signal<T>holds a value; a binding (Runtime::bind) is a closure that is run once, its reads of signals tracked, and run again exactly when one of the signals it read last time is set to a different value. Nothing else re-runs. - swap
- UI-6: the module registry, hot-swap and the sections.
- transport
- UI-6: the wire seam — every Plexus call the engine makes goes
through one
Wire: on wasm32 the page’s one WebSocket ([ws], v1’sWsTransportover plexus-client’sws-web, with its 1 s reconnect loop); in the native testsFakeWire, which records what was opened and lets the test feed each stream. - tree
- UI-6: the view tree — UI-4’s compiled
components/<name>.json, and its interpreter over aRenderer.
Constants§
- ABI
- The host interface this engine implements; a manifest’s
abi.