Skip to main content

Module spawn

Module spawn 

Source
Expand description

LayoutIR::spawn_into walks the IR tree and spawns entities into the main world.

Maps:

Structs§

AutoFocus
autofocus="true" marker: when the containing <dialog> opens, manage_dialog_lifecycle moves focus here first.
DefaultButton
<button default="true"> marker: the dialog’s DEFAULT button (Qt QPushButton::setDefault). Enter anywhere in the dialog activates it (activate_dialog_default_on_enter), and a close that went through it fires the accepted hook instead of rejected.
DialogMarker
Empty marker added alongside IfMarker for entities spawned from a <dialog> tag. Drives Esc-to-close + the focus trap (lumen_core::components::FocusBoundary is inserted alongside). The IfMarker carries the bound open signal name; this marker just distinguishes dialogs from generic <if> blocks.
DialogSession
Per-dialog open/close bookkeeping maintained by manage_dialog_lifecycle - mirrors lumen_primitives::PopupNavSession for popups.
DocumentRoot
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 referenced ArraySignals entry each tick, expands body once 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_field names 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 - when Self::eq is Some- on value equality.
LumenStylesheet
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.
ScenePolicy
What the presentation layer under this scene already does for itself, so reconcile_for_blocks can stop doing it.
TypographyRole
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.
VirtualRow
Marker on a virtualized <for> row. The slot it sits in is held in StyleOverrides over the row’s own styles.

Enums§

IfMode
<if mode="..."> policy. Render despawn/respawns the subtree on each transition (default; cheap state-wise but loses focus / scroll / per-row signals across show/hide). Hide mounts once and toggles Visible(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§

SpawnIntoWorld
Spawn an IR tree into a main world. Defined as a local extension trait because LayoutIR now lives in lumen-ir and an inherent impl on a foreign type isn’t allowed; the spawn logic (which drives lumenc’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 bg names, or takes a background image away when bg names a colour or a gradient instead.
apply_ua_style_defaults
The UA-origin per-tag sizing defaults (D3 / task #29) live in skins/ua.css now - an always-on stylesheet folded into the cascade beneath any skin and beneath app CSS (see crate::skins::UA and run::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 root as the DocumentRoot.
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 DefaultButton inside an open dialog resolves that dialog’s eventual close as accepted. Text-child hit-shadowing is handled with the same ancestor walk the control dispatchers use.
reconcile_for_blocks
Reconcile every <for> block against the current ArraySignals state.
reconcile_if_blocks
Reconcile every <if> block against the current PropertyStore truthiness. Truthy: property exists AND value is not empty AND is not literal "false" / "0".
renumber_document_order
Restate lumen_core::components::DocumentOrder from 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 Element subtree under parent (or as a new root when None) WITHOUT touching the global LumenStylesheet resource.
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 resting bg while 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 None for unknown names so the caller can fall back to the default 16 px.