These docs cover 0.2.0-beta.26. Each guide distinguishes supported beta behavior, explicit deployment boundaries, and retained 0.1 compatibility material.

Browse documentationAll guides

Build · ownership and projection

Slots and Context

Composition places content without surrendering ownership. The compiler knows which component declared a slot, which caller supplied its content, where it is projected, and how the resulting structure resumes and tears down.

Declare default and named slots

Use a slot() field with the SlotContent type. The field named children owns the default outlet; any other field names a corresponding outlet.

import { slot, Component, type SlotContent } from "presolve";export class Card extends Component {children: SlotContent = slot();actions: SlotContent = slot();render() {return <article><slot /><footer><slot name="actions" /></footer></article>;}}

Project content from the caller

Default children are direct children of the component invocation. Wrap named content in a direct <template slot="name"> child.

<Card><h2>Profile</h2><p>Edit the details owned by this page.</p><template slot="actions"><button onClick={this.save}>Save</button></template></Card>
Caller-owned content

The button is placed in Card, but its action binding and captured state still belong to the caller. The runtime never reinterprets the projection as callee-owned source.

Slots inside structural hosts

Projected content can participate in admitted conditional, keyed, and nested component lifecycles. The artifact records the exact host occurrence, projected invocation membership, caller bindings, events, and cleanup so cold execution and resume use the same ownership.

RevealMaterialize the component host and its projected content transactionally.
ReorderRetain keyed component and slot content identities while moving the host.
HideDetach caller bindings and events, clean children, then remove the host.

Context

Context supplies a compiler-resolved value to descendants without runtime tree lookup. Provider/default selection is fixed by the compilation; resume restores the exact selected slot rather than selecting again.

Current authoring boundary

Context projection and resume exist in compiler products, but the current beta does not expose a new-project Context declaration. The compiler fails closed rather than inferring one. Historical Context source is confined to the migration reference.

Consumers treat provider-owned values as read-only. When a descendant must request a change, pass an explicit action through normal composition. An unresolved required consumer fails closed; Presolve does not search the DOM for a provider.

Composition rules

  • Declare each slot as a direct instance field initialized with slot().
  • Keep named content in a direct template child with a static slot name.
  • Do not fabricate outlet markers or manipulate generated slot anchors.
  • Keep projected state and actions with the caller that authored them.
  • Use compiler-resolved Context for shared read access, not as a mutable global store.