Expand description
LayoutIR::spawn_into walks the IR tree and spawns entities into the main world.
Maps:
width/height/flex/padding/margin->Style.bg+radius+shadow->Visuals.text->TextContent; color/size/align/wrap/max-lines ->TextStyle.scroll->Scroll(with inline velocity) +ScrollOffset.tab-index->TabIndex.- Every spawned entity carries
DirtyLayoutso taffy runs on first tick. - Children link to parents via [
ChildOf].
Structs§
- Auto
Focus autofocus="true"marker: when the containing<dialog>opens,manage_dialog_lifecyclemoves focus here first.- Default
Button <button default="true">marker: the dialog’s DEFAULT button (QtQPushButton::setDefault). Enter anywhere in the dialog activates it (activate_dialog_default_on_enter), and a close that went through it fires theacceptedhook instead ofrejected.- Dialog
Marker - Empty marker added alongside
IfMarkerfor entities spawned from a<dialog>tag. Drives Esc-to-close + the focus trap (lumen_core::components::FocusBoundaryis inserted alongside). TheIfMarkercarries the boundopensignal name; this marker just distinguishes dialogs from generic<if>blocks. - Dialog
Session - Per-dialog open/close bookkeeping maintained by
manage_dialog_lifecycle- mirrorslumen_primitives::PopupNavSessionfor popups. - Document
Root - The entity the app’s markup tree was spawned onto. Whoever writes the
root -
set_root_class, the OS theme follow, the class-change watcher - asks here rather than guessing from the hierarchy, so there is one answer and it does not depend on the root happening to carry a class or on hot reload being on. A respawn (hot reload) overwrites it. - ForMarker
- Marker for a
<for each="...">block. The reconciler reads the referencedArraySignalsentry each tick, expandsbodyonce per item (substituting{field}placeholders against the item record), and spawns/despawns child entities to match. The reconciler compares the key sequence it built last tick with the new one: an unchanged sequence mounts nothing, an appended prefix spawns only the new rows, a truncated prefix despawns only the trailing rows, and anything else (reorder, mid-insert, mid-remove) is a full despawn-and-respawn. A row whose key is kept but whose record changed is updated in place, on the entities it already has.key_fieldnames the record field the keys come from; without it the item index is the key. - IfMarker
- Marker for an
<if signal="...">block. The reconciler mounts / dismounts the subtree based on the named signal’s truthiness, or - whenSelf::eqisSome- on value equality. - Lumen
Stylesheet - World-resource wrapper for the combined skin + user CSS so the for-block reconciler can re-apply matching rules to runtime- substituted template clones.
- RowLookup
- The queries a kept row’s walk reads to line its entities up with its template.
- Scene
Policy - What the presentation layer under this scene already does for itself, so
reconcile_for_blockscan stop doing it. - Typography
Role - The typography role an element was written with (
style="title-lg"). Its text size is computed from it, and a restyle recomputes that from here; the attribute is the element’s own, not a style a rule can set. - Virtual
Row - Marker on a virtualized
<for>row. The slot it sits in is held inStyleOverridesover the row’s own styles.
Enums§
- IfMode
<if mode="...">policy.Renderdespawn/respawns the subtree on each transition (default; cheap state-wise but loses focus / scroll / per-row signals across show/hide).Hidemounts once and togglesVisible(bool)on every descendant, preserving state.- Placeholders
- Whether a subtree still carries
{...}placeholders for the spawner to resolve. - RowStyle
- Who resolves the styles of a
<for>row. - Virtualization
- Who mounts the rows of a virtualized
<for>.
Traits§
- Spawn
Into World - Spawn an IR tree into a main world. Defined as a local extension trait
because
LayoutIRnow lives inlumen-irand an inherentimplon a foreign type isn’t allowed; the spawn logic (which driveslumenc’s ECS walker) stays here.
Functions§
- activate_
dialog_ default_ on_ enter - Enter anywhere in an open
<dialog>activates its DEFAULT button (Qt QDialog default-button contract) - unless focus sits on a button (its own Enter->click path wins) or on a multiline text input (Enter inserts a newline). Single-line inputs DO trigger the default (Qt/web: Enter in a line edit fires the default button) alongside their own commit event. - apply_
background_ image - Points an element’s background at the image its
bgnames, or takes a background image away whenbgnames a colour or a gradient instead. - apply_
ua_ style_ defaults - The UA-origin per-tag sizing defaults (D3 / task #29) live in
skins/ua.cssnow - an always-on stylesheet folded into the cascade beneath any skin and beneath app CSS (seecrate::skins::UAandrun::loading::load_ir), so a skinless app still gets a sizing floor without a Rust-side table to keep in sync. - close_
dialogs_ on_ escape - On Escape, close the top-most open popup layer - one press peels off exactly one layer.
- install_
document_ root - Record
rootas theDocumentRoot. - manage_
dialog_ lifecycle - Qt QDialog lifecycle (W5): initial focus on open, focus restore on close, and the exactly-once accepted/rejected close event.
- mark_
dialog_ accept_ on_ default_ click - A direct click on an explicitly-marked
DefaultButtoninside an open dialog resolves that dialog’s eventual close asaccepted. Text-child hit-shadowing is handled with the same ancestor walk the control dispatchers use. - reconcile_
for_ blocks - Reconcile every
<for>block against the currentArraySignalsstate. - reconcile_
if_ blocks - Reconcile every
<if>block against the currentPropertyStoretruthiness. Truthy: property exists AND value is not empty AND is not literal"false"/"0". - renumber_
document_ order - Restate
lumen_core::components::DocumentOrderfrom the live hierarchy, so it means “where this element sits in the document” rather than “when it was spawned”. - resolve_
strings - The strings an element shows in the app’s locale.
- settle_
tree - Bring a just-spawned tree in line with the state the app starts in, before its first tick.
- spawn_
subtree - Spawn an
Elementsubtree underparent(or as a new root whenNone) WITHOUT touching the globalLumenStylesheetresource. - substitute_
in_ element_ with_ css - Substitute the placeholders in a template subtree against
scope, then re-run the cascade over the result when a stylesheet is given. - track_
style_ over - Read a
<toggle>/<switch>track palette out of the cascaded attributes: the restingbgwhile unchecked,:checked { bg }while checked,:disabled { bg }while disabled. - typography_
role_ to_ px - Resolve a Material 3-flavored typography role name to a pixel
font size. Returns
Nonefor unknown names so the caller can fall back to the default 16 px.