Skip to main content

Interface: Node

Defined in: packages/core/src/document.types.ts:33

One element of a document: which block renders it, the props an author has typed, and the ids of what sits in each of its slots.

Example

const section: Node = {
id: crypto.randomUUID(),
block: "Hero",
props: { title: "Summer promotion", price: 10 },
slots: { items: ["card-1", "card-2"] },
};

Properties

block

block: string

Defined in: packages/core/src/document.types.ts:41

The name of a registered block. compile refuses a name neither the registry nor the catalog holds.


id

id: string

Defined in: packages/core/src/document.types.ts:39

Unique within the document, and the handle every operation takes. The caller mints it — core reaches no crypto builtin, and a generator inside these functions would make one composition produce a different document each time, which content addressing cannot tolerate.


props

props: UnknownProps

Defined in: packages/core/src/document.types.ts:47

What the author typed, unvalidated. compile runs it through the block's schema and keeps what validate() returned — a coercion, a transform or a .default() reaches the artifact in its parsed form, and a key the schema did not keep is reported as unknown-prop.


slots?

optional slots?: Record<string, readonly string[]>

Defined in: packages/core/src/document.types.ts:52

Slot name → ordered child ids. Order is the render order. An absent slot holds zero children, which a min of 1 or more refuses.