Skip to main content

Crate lumen_ir

Crate lumen_ir 

Source
Expand description

lumen-ir - the runtime-shared intermediate representation for Lumen.

This crate owns the data model that both the compiler (lumenc) and the parser-free runtime consume:

  • layout_ir - LayoutIR, the tree of styled elements decoupled from ECS spawning, plus the From impls that convert each IR spec into its lumen_core / lumen_primitives runtime type.
  • css - the CSS AST (Stylesheet) and the Cascade-5 application / re-application logic. The hand-rolled front-end that parses CSS text into a Stylesheet still lives in lumenc::parse::css; this crate owns the data + the cascade.
  • interpolate - the {...} placeholder resolver a <for> row and a fragment instance are built with, shared by the runtime and the web emitter so both write the same text.
  • fragment - Fragment, the named reusable markup subtree, and the FragmentTable an app declares.
  • translate - the translatable="key" resolver, shared by the spawner and the web emitter so an app run in a locale and a page built for it show the same strings.
  • values - shared attribute/property value parsers.
  • css_vars - the var(--name [, fallback]) resolver.
  • artifact - the AOT compiled-app container (lumenc build output).

lumenc re-exports every module here so existing lumenc::... paths stay valid.

Modules§

addon
A browser add-on, as a compiled app carries it.
artifact
AOT compiled-app artifact - the on-disk product of lumenc build.
css
CSS data model (AST) + Cascade-5 application, extracted from lumenc’s parse::css front-end so the parser-free runtime and every other IR consumer share the same cascade without pulling in the markup parser.
css_vars
CSS var(--name [, fallback]) resolver shared by the cascade in crate::css and the runtime’s IR loader.
fragment
Fragments - the reusable markup subtree.
interpolate
Resolving the {...} placeholders a template carries.
layout_ir
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).
source_map
Where each line of a concatenated script came from.
translate
Resolving the strings an element shows into one language.
values
Shared value parsers used by both the HTML and CSS parsers.

Functions§

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.