Expand description
Fragments - the reusable markup subtree.
A fragment is a named piece of markup with parameters, declared once and
instantiated anywhere. Lumen has one such entity, and both authoring forms
compile to it: a <template> in a .lmn file, and an lmn! block in a
script. The two forms differ in where the text came from, which
FragmentKind records; everything downstream of the compiler sees the
same Fragment.
The declaration side lives here. The use site lives on the element that
instantiates a fragment, as crate::layout_ir::FragmentUse, so a tree
carries its own instantiation points and the table stays a flat lookup.
FragmentTable is the whole set an app declares, and it travels in the
compiled artifact next to the layout tree. It is ordered by key so the
artifact bytes depend only on what the app declares, not on the order the
compiler happened to visit files in: the same sources build the same
bytes.
Structs§
- Fragment
- A named, parameterized markup subtree.
- Fragment
Component - A candela function name that reaches a fragment.
- Fragment
Origin - Where a fragment was declared, for diagnostics.
- Fragment
Param - One declared parameter of a fragment.
- Fragment
Table - Every fragment an app declares, keyed by
Fragment::key.
Enums§
- Fragment
Error - Failures from building a
FragmentTable. - Fragment
Kind - Which authoring form declared a fragment.
Constants§
- DEFAULT_
SLOT - Slot name a
<slot>with nonameattribute occupies, and the name a use site’s unnamed children are passed under. - FRAGMENT_
TAG - Tag standing for a use site the build could not finish, which the runtime fills by calling the function it names.
- SLOT_
TAG - Tag of the element that marks where a use site’s children land inside a fragment body.