package reference
Registry keys
An element declaration begins as JSON Schema. Its x-* keys tell
Leaf how the element reads, renders, changes, and joins the collaboration
loop. Choose a key below to jump to its summary. Longer contracts open in
place.
This reference is generated from the registry's $keys, the same
entry an agent can query in a page's merged registry.json.
Start with the extension guide, or read the
complete package contract.
Find a declaration
The index jumps to a summary. Longer entries keep their full contract one click away.
x-awaits
The widget asks the user for input while its authored attributes match when, which puts an obligation on their list, On me.
Full contract
The obligation's id is widget:<source-id> and never changes. value names the x-state verb whose state is the typed answer, and answered says when the obligation is complete ($awaits); they are separate because a partial value can exist while the obligation is open, and an empty value can be a complete answer. all names the outcome one control can give every obligation of this kind at once. Once created, an obligation stays answered or withdrawn after when stops matching; an element that never matched creates none, and neither does a widget inside an exhibit (x-exhibit). A restated event asks again. While the agent owes a reply in a thread about the obligation, anchored inside the widget, or inside the widget enclosing it but no other obligation, the agent is its next actor and the obligation stays unanswered. A widget in a thread message keeps its obligation after the thread closes. A question the user answers in words is an agent message's obligation, not a widget's (--obligation). Any widget may declare it, whether bundled, from a package or a page's own; the actions it names are how the user answers, and Leaf adds no answer of its own, such as a generic Done, to a widget or anything else On me.
x-bound
The element has its own height and scrolls inside it, so a long log or feed never grows the page.
Full contract
start opens at the first line; end follows the newest entry while the user is at the end, and stays where the user scrolled back to otherwise. An authored element may set or override it with data-bound=start|end; delivery writes it as data-lf-bound.
x-content
The required content: markup (the author's markup), members (only this element's declared member elements), data (one <pre> holding text in the notation the description names, with & < > escaped as & < >, which an element whose x-data input the markup binds leaves out), or empty.
x-data
The widget's named typed data inputs.
Full contract
Each names a $data.contracts contract and an optional source attribute for a page source id. Optional reference and output name an x-refers attribute and the producer's declared output. Markup binds the source or the relation, never both; an unbound input reads null, except that an x-content: data element's one input reads the text of its <pre>. A document binds each source to one contract; later documents may rebind it and read the value against their own contract. Optional property names the element property Leaf sets to the delivered value, or null while there is none; a module reads the input only there, never through a package-owned source name, and dispatches drawn naming that property and the value it drew once its marked records stand. Widget outputs are ephemeral browser derivations, without source revisions or run receipts.
x-encloses
true: the widget frames the obligations of the widgets inside it and asks nothing itself.
Full contract
Its leading heading gives their prompt, and going to one of them lands on it. Each obligation it frames keeps its own id, answer and completion, and where frames nest, an obligation uses the nearest. It requires an id and markup content. lf-ask declares it; a widget that asks on its own needs no frame.
x-example
Authored markup exhibiting the widget, valid against the merged registry: an agent reads it with the element declaration, writes from it, and the lint refuses one that does not validate.
x-example-data
Sample JSON values keyed by source id bound in x-example, validated against those sources’ contracts and supplied to package check --render.
x-exhibit
The element shows content rather than asking: widgets inside it never put an obligation on the user's On me list, whatever the declaration.
Full contract
A boolean also quotes them unconditionally: they take no input. {when: {attribute: [values]}} quotes them only while those authored attributes match, using the same presence and value rules as x-awaits.when; elsewhere they take input but still ask nothing. Modules check quoted(el) before enabling input.
x-flow
true: the element draws no box of its own around its authored blocks, so in a column or sidebar Layout they stand in the page's flow, as a layout-flow wrapper's do: words keep the prose's start edge, a block declaring more room takes it, and the element's box grows round that block. The element has no width of its own, so a data-width written on it has no effect; it belongs on the block that needs the room.
x-height
The height in CSS pixels the page reserves for the element before its module draws: the declared number, or an authored data-height, which overrides it; true reserves only where data-height is given.
Full contract
The theme holds the box to it from first paint until the module marks the element drawn (lf-rendered). Declare it on a widget whose drawing can't be sized from its markup. A module that can draw at any height, such as a chart's, draws at this one, so nothing moves; for content with its own height, the reserved height is the author's estimate of it.
x-history
true: the module renders the page's history, so a page that contains one is served the history reading with its state.
Full contract
The reading is the newest 50 logged events, newest first, each with who acted, what they did, the id of the thread it was in, whether a later undo took it back, and, for a widget gesture, the words its ids had when it was made. The module reads it with readHistory.
x-inline
The element sits inline among the surrounding words. The render check therefore requires neither a width of its own nor a place where a block may stand.
x-instructions
Instructions for an author using this widget, read after choosing it and before writing markup. One non-empty string, separate from the short description and the schema.
x-language
The attribute that names a code language. Composing the vocabulary gives it $languages.names as its enum, so a new tag that takes a language needs only this declaration.
x-measured
A value in authored content tied to the data run that produced it.
Full contract
input names the widget's x-data input, and run its required receipt attribute. When the source holds a different run, page check warns that the measurement is stale, and page state reports it. Rewriting the source counts as a new run even with the same value; age alone never makes a measurement stale.
x-name
The attribute that holds the element's title, which the page uses to name the element elsewhere, as the activity feed does.
Full contract
Declare it only where an attribute is the title, as a column's or a tab's label is; a section is already titled by its heading, a disclosure by its summary, and a titled member by its leading <strong>. An attribute the element merely shows first, such as a metric's value, is not its title.
x-output
The widget's named typed derived outputs.
Full contract
Each output names one $data.contracts contract. publishOutput publishes its complete value, or null while unavailable, for other widgets' x-data inputs. Outputs follow the publishing element's lifetime and remain browser-derived values without a server source revision or run receipt.
x-owners
The element declarations that may directly own this element. An owner's direct children of these kinds are its members, and a gesture on the owner's whole box stops at them.
x-patch
How a revision reaches an upgraded widget the user has open.
Full contract
By default any change to the widget's markup replaces the whole widget, rebuilding whatever the user had open in it. members says the module builds beside its direct authored children, leaves them where the author wrote them or moves them all into the authored body its initial drawing builds, and reads only their attributes; those children may be native markup or declared member widgets. While a revision keeps the element's attributes and each child's tag and attributes in order, Leaf edits inside those children in place. A module that moved them into an authored body reads none of them, so there only the element's own attributes need to stay the same. Requires x-content: members or markup, and x-upgrade.
x-prepaint
The attribute that names the notation of the element's written <pre>.
Full contract
Where it names markdown, Leaf draws that text as a Markdown file, its soft line breaks read as spaces, in a .lf-markdown-body beside the <pre> before the element's module draws: the server in the first document, the browser in a revision or a message. So the element first paints at the size its module will draw that rendering, and the module replaces it when it draws.
x-reading-role
The structural role the element plays.
Full contract
The only role is pane: a reading region, named by its required label, whose body scrolls on its own while the workspace is full-height. A pane holds exactly one body element, optionally between a direct header and footer; a visible heading goes in the header. Validation reads this declaration, not tag names, so a package can contribute panes under its own tags.
x-refers
A map from each attribute whose value names another element to the contract its target must meet.
Full contract
An empty contract accepts any element id, as an option's for does. A typed contract names a shared registry map with via and an equality test with where, and page check requires a target whose tag's entry in that map passes the test, so a package can tell a goal reference from a worker reference without Leaf knowing either. With owns: true the referrer fills its target: page check requires the target in the referrer's own document, and requires each element there that the test selects to be named by exactly one referrer. A keyed contract {tag, key} names a member by an attribute instead of an id: the tag element whose key holds the value, inside the referrer's nearest owner in which key is unique (x-unique), as a playground preset's setting names a control by name. In the browser a module passes the attribute to navigateToDatum to reach the named widget; it looks in the referrer's own document (its message, for a widget in a reply) before the page.
x-retired-when
On a member: the outcome of its owner's decision that removes it from the page, as accept removes a suggestion's lf-old.
Full contract
Requires x-owners. The outcome is a value of the outcome field on the owner's one deciding verb. Leaf renders the decision itself, including its undo: it writes data-lf-state="<outcome>" on the owner and data-lf-retired on the removed members, which one theme rule hides. A widget reads the decision from its state, not these attributes. Once the log decides, page check lets a revision drop the member's ids, and page check --render reports a removed member that still shows words.
x-says
Attributes whose values show as selectable text: after inside the element after its content, before at its start, in declaration order. The runtime writes real text nodes, unlike CSS content: attr(), so the user can select, quote and comment on the words.
x-shadow
The module renders the page's words into an open shadow root, and Leaf's passage reading, selection capture and id lookups reach into it.
Full contract
A shadow root attached without this key, as a page script's own custom element attaches one, is opaque: its own words can't be quoted, and the passage reading reads its host by its light children.
x-shows
The element is a view of another widget's answer, which stays that widget's: attr names the widget, in the element's own page or message (x-refers), and value the attribute of the element's compound owner that names the answer the owner holds.
Full contract
The element stands in the owner whose value its widget's answer names, or in one without value while the answer names none, or one no owner beside it holds: none is an empty pick, a member without the widget's x-awaits key (one the user added), or members naming different values. The answer names a value when the widget's x-awaits value verb records one string, or picks members whose key all name the same one. Moving the element sends that widget's own command through shownAnswer (module-reading.md), so the view keeps no fact of its own: the append door refuses a position move of the element, and page check refuses markup that places it apart from its widget's authored answer, owners without one that holds an answer naming no value, and an owner value the widget cannot answer. It keeps its authored order among its owner's members.
x-space
The width past the reading measure the element takes in a column or sidebar Layout: wide takes the shared, capped width for a block slightly wider than the column, from the prose's start edge; available takes all the width the page shell can give, into both margins.
Full contract
Without it the element fills its container, as every element does in other Layouts; an element read as lines of text keeps to the measure in its own stylesheet (max-inline-size: var(--lf-measure)). An authored element may override it with data-width=wide|available, which the theme applies without moving the prose.
x-state
Declares each verb of a widget that has state: the unit of state it changes, who writes it, and either its record (how the state reads in markup, $state.record) or the schema of its detail.
Full contract
A verb is the user's, sent from the page as action events, unless it declares writer: "agent"; the agent writes it with leaf page report, as report events. A user verb may create a child element (creates). An agent verb with text: true requires each report to carry a non-empty detail.text, a short note the report feed shows as written. The page marks a reported widget data-lf-reported until a version answers the report ($report). For each [widget, unit, verb] key, the latest action not taken back wins, and different verbs on one unit coexist. Leaf combines those actions with the authored values and hands the widget its complete state, keyed by verb, as this.state, which its render() reads. A past action keeps its key after the widget leaves the page. When an action makes the widget's x-awaits answered condition hold, Leaf records meaning.answer on it: the thread named by the widget's resolves attribute in the document the action came from, which the answer closes, or null. A decision whose outcome is the widget's x-withdrawn-as value also records null, and the page reads as if nothing had been proposed. A verb with decides: true selects which members leave the page (x-retired-when); its required outcome field names the choice. An outcome field on any other verb is ordinary domain data.
x-text-format
How the element's text is formatted.
Full contract
inline-markdown formats its direct text nodes; markdown renders its data body as safe block Markdown, read as a file, whose soft line breaks are spaces. A body record keeps the Markdown source, while passages read the visible words. Child elements stay HTML. In a generated child, the user's line breaks are hard breaks.
x-thread-seat
The module puts a thread box (threadBox) in each element that matches when on authored attributes, not on attributes an x-state record writes.
Full contract
The box shows, as text, the threads anchored exactly to that element; Threads keeps the full view. An element inside thread markup or quoted content gets no box. On a widget that also asks (x-awaits), the box is where the user answers in words: while a thread there waits on the agent, the obligation leaves the user's On me list, but it is still unanswered and the widget's controls still work. hold labels a second send button whose comment carries holds, naming the widget. The widget is held while that thread is open; resolving the thread releases it. Removing the widget removes only the box, not its threads.
x-thread-surface
The upgraded widget can show Leaf's comment box and threads inside itself, beside the data items they are about.
Full contract
On each pass, Leaf calls the element's threadOutlets(targets, {signal, collection, onCommit}) with the targets anchored exactly to its items, in order, and the method returns for each an element to place it in (an outlet), or null. The widget reads its registration with threadSurface(element): update() says its outlets changed, and open(datum) opens Comment on one item. Leaf still owns anchors, drafts, sending, thread rendering, replies, reactions and focus, and decides placement inside each outlet. An item that isn't shown (not loaded, filtered out, collapsed or outdated) gets no outlet, and its threads stay in Threads and the margin.
x-tone
The attribute that names one of the layer's semantic tints. Composing the vocabulary gives it $tones.names, which the theme has a rule for, as its enum.
x-unique
A map from each attribute whose value must differ between members of one owner to that owner's tag.
Full contract
page check and message markup refuse a repeat inside the same nearest owner, such as two controls of one playground sharing a name. A keyed x-refers contract names members by such an attribute.
x-upgrade
A module at widgets/<tag>.js enhances the element in the browser, loaded only where a page's markup uses the tag. page init refuses a layer that declares it without the module, and the render check refuses a module that defines no element for a widget on the page. Required.
x-verbatim
The upgraded element keeps its authored words, and its nested upgraded widgets in authored order, so the passage reader can quote those words; each nested widget's own declarations cover the words it generates.
Full contract
Without this key the passage reader treats the widget as opaque, since its module may insert or replace words. The render check refuses a page where the wrapper's own words changed or a nested widget was removed or reordered.
x-views
An object with members, a CSS selector matching direct authored children shown one at a time, and optional parts: true for a page's parts.
Full contract
Delivery carries the selector; the browser owns their membership and hidden attribute from first paint onward; authored hidden does not select a view. openingView returns the fragment's member, else the tab's saved member, else its supplied fallback (first member by default); reload prefers the saved member. keepView both shows a member and remembers it, or shows none when passed null without forgetting the last member. Its optional third argument keeps an outgoing member visible for an animation without selecting or saving it. A parts holder stands directly in a main with no Layout, each member holding its own Layout. module-authoring.md owns view-state behavior.
x-visual
How a rendered picture offers Comment targets.
Full contract
Declaring it also tells the theme the widget is a picture (painted data-lf-visual), so an lf-ask lays out options that hold one as it does options holding images. whole makes the picture one target. With {parts: ATTR} or {prefixes: [PREFIX, …]}, the module calls registerVisualParts(source, read) once, and read returns the current list of {id, element, label, surface?}; a comment on a part stores its id as anchor.visual. Under parts, ATTR names an attribute of the widget, as in <lf-diagram parts="all">: the registered parts become targets where the widget carries it, and without it the picture stays one target. Under prefixes, Leaf accepts any longer id starting with one of them, such as commit:3f2a under commit:. surface may name a descendant whose own paint, without decoration, gives the outline Leaf marks; element stays the target for hits and travel. A comment whose part is gone detaches on replay instead of widening to the whole picture. A visual that draws its parts over time also passes {reveal}: reveal(id) must synchronously show a state that holds that part, cancelling any pending change that would remove it, and Leaf calls it before going to the part from a thread or navigateToDatum. While a declared part is missing from the current state, its threads sit on the whole picture. Call the registration's update() after any change to rendering or geometry, including an attribute or style change in place. The render check validates each registered record.
x-withdrawn-as
The deciding outcome that declines the proposal.
Full contract
It answers the obligation without closing the widget's resolves thread. A revision may also remove an unanswered proposal outright, whether or not it has retirable members; ids from earlier versions don't prevent it.
x-within
The regions (element declarations) inside which a member may sit at any depth instead of as its owner's direct child.
Full contract
It belongs to the nearest owner x-owners names around that region, and page check refuses it anywhere else. A playground control written inside lf-playground-preview stays where it is written, beside the item it changes, instead of in the rail.
x-word
The widget's word for its kind, which Leaf uses when naming the widget in a panel row, a walk or a comment anchor: a fixed word, as lf-ask says "question", or module, where the module gives one through lfWord(), as lf-suggestion returns "insertion", "deletion" or "rewrite" depending on its children.
Full contract
Without one, Leaf calls the widget by its tag name without the prefix. With module, the module may also describe the widget through lfSays(), where its text alone doesn't convey its structure, such as a rewrite's old and new text; otherwise Leaf reads the element's text.
x-work
true: the agent may open its own to-do on this widget with leaf task create even when no update on it is open, and the to-do shows beside the widget.
Full contract
Only a block widget whose x-content is markup may declare it, and markup content does not imply it: markup can itself be a control, or sit in a hidden panel.