Skip to main content

Module fragment

Module fragment 

Source
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.
FragmentComponent
A candela function name that reaches a fragment.
FragmentOrigin
Where a fragment was declared, for diagnostics.
FragmentParam
One declared parameter of a fragment.
FragmentTable
Every fragment an app declares, keyed by Fragment::key.

Enums§

FragmentError
Failures from building a FragmentTable.
FragmentKind
Which authoring form declared a fragment.

Constants§

DEFAULT_SLOT
Slot name a <slot> with no name attribute 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.