Skip to main content

Module layout_ir

Module layout_ir 

Source
Expand description

LayoutIR - Lumen markup as a tree of styled elements, decoupled from ECS spawning so multiple backends can consume it (runtime spawn, AOT codegen, typed Rust struct emission, FFI bytecode).

Modules§

layout_direction_serde
serde adapter for Attributes::dir. lumen-core carries no serde dependency, so LayoutDirection cannot derive Serialize/Deserialize itself; this module maps Option<LayoutDirection> to a stable, compact Option<u8> (0 = Auto, 1 = Ltr, 2 = Rtl) for the AOT artifact. Keeping the mapping here (rather than adding serde to lumen-core) keeps the parser-independent runtime free of an extra core dependency.

Structs§

Attributes
Resolved attribute bag; one struct so the parser fills it in a single pass and the spawner / codegen don’t have to re-parse strings.
BindSpec
Parsed bind="<kind>:<name>".
BorderPaintSpec
Resolved border paint for a state override (:hover { border: ... }, hover-border: / focus-border:). Unlike the base border - which accumulates from the border-width / border-color / border-style longhands - a state border is authored via the shorthand only, so it resolves to concrete widths + color at parse time.
DeferredAttr
One attribute of a fragment body element, kept as authored.
DropdownButtonSpec
Synthesised <dropdown> header payload: the open signal plus the full option list mirrored from the <option> children (markup order), so the runtime header component can run keyboard interaction while the popup body is unmounted.
Edges
Four edge values (in CSS order: left, right, top, bottom).
Element
One node in the IR tree.
FragmentUse
A fragment instantiation, recorded on the element that stands in for the fragment’s body until the tree is expanded.
GridTemplateSpec
Parsed grid-template-rows + grid-template-columns lists (W5.9).
LayoutIR
Top of the IR. Single root element; multi-rooted markup is illegal.
LintFinding
One parse-time finding. Carries a 1-based (line, col) anchor in the source so downstream tools can surface a diagnostic at the exact byte where the legacy shape lives.
MenuBarSpec
Parsed <menubar> content. Top-level submenus + their items.
MenuSpec
One <menu label="File">...</menu> submenu.
OutlineSpec
Parsed focus-outline="<width> <#color>" (plus the CSS outline-offset folded in at spawn).
Rgba
RGBA color in [0,1]^4.
ScriptRefs
The <script> elements one markup source carries, read without building its tree.
ShadowSpec
Parsed shadow= / box-shadow= value. Authors may stack multiple shadows via comma separation in CSS; markup accepts a single entry. inner flips drop -> inset.
TooltipSpec
Parsed <tooltip text="..." delay="..."> payload, propagated from the wrapper to its single child as Attributes::tooltip.
TransitionIr
IR-side parsed transition shorthand entry. From<&TransitionIr> for lumen_primitives::TransitionSpec converts to the runtime form at spawn time.

Enums§

AlignContentSpec
CSS align-content values (IR-side mirror of lumen_core::components::AlignContent).
BgSpec
Parsed bg= value. Solid colors, gradients, and images share one attribute surface so authors don’t pick between bg= and bg-gradient=.
BindKind
What bind= targets.
BorderStyleSpec
CSS border-style subset. v1 recognises none and solid; other keywords are rejected at parse time with a per-declaration warning.
BoxSizingSpec
CSS box-sizing values (IR-side mirror of lumen_core::components::BoxSizing).
DisplaySpec
CSS display value (W5.9). Mirrors lumen-core’s Display.
EasingIr
IR-side mirror of lumen_primitives::Easing. Cubic-bezier carries its four control points; named curves are zero-sized.
FlexAlign
Cross-axis alignment (CSS align-items).
FlexAxis
Flex direction.
FlexJustify
Main-axis distribution (CSS justify-content).
FlexWrapSpec
CSS flex-wrap values (IR-side mirror of lumen_core::components::FlexWrap).
IfModeSpec
<if mode="render|hide"> policy.
ImageFitSpec
CSS object-fit analogue.
InterpolationSlot
Round-8 wave-C: classification of a {...} placeholder inside markup. Carries the resolution scope the spawner consults when materializing the slot into a concrete string.
LengthSpec
Length specifier as it appears in markup.
LineHeightSpec
CSS line-height value. Unlike LengthSpec, the two forms carry different meanings rather than different units of the same quantity: a bare number (line-height: 1.2) scales with the element’s own font size, while a px value (line-height: 19px) is a fixed line box height that does not track font-size changes. Kept as two variants instead of collapsing to a single px number so a consumer can tell which behavior the author asked for.
LintKind
Category bucket for a parse-time LintFinding. New variants land here as the parser learns more rules.
LintSeverity
Severity tier for a parse-time LintFinding.
MenuEntrySpec
One entry inside a submenu - either a clickable item or a separator line.
OverflowSpec
CSS-style overflow control.
ParseError
Markup parse errors.
PositionSpec
CSS-style position mode.
ScrollAxisSpec
Scroll axis declared in markup.
ScrollbarWidthSpec
CSS scrollbar-width keyword (Scrollbars Styling Level 1).
TextAlignSpec
Horizontal text alignment.
TextOverflowSpec
CSS text-overflow - what to do with text that overflows its box.
TextWrapSpec
Text wrap policy attribute.
TrackSizeSpec
One CSS Grid track-size term (W5.9). IR-side mirror of lumen_core::components::TrackSize.
TransitionPropertyIr
IR-side mirror of lumen_primitives::TransitionProperty. Kept local to layout_ir so the parser doesn’t need to depend on primitives.
WidgetPart
Synthetic widget-part roles attached by the parser desugars - see Attributes::part.
WidgetRole
A widget tag that the parser replaces with plain boxes - see Attributes::widget.

Functions§

relativize_asset_paths
Rewrite every <image src> under el that points inside root to a path relative to it, recording in outside the ones that point elsewhere.