Skip to main content

Interface: ArtifactNode

Defined in: packages/core/src/artifact.types.ts:37

One node of a compiled tree. Children are the nodes themselves, so a renderer walks the tree without resolving an id against anything.

Example

function render(node: ArtifactNode) {
const Block = components[node.block];
const children = Object.values(node.slots ?? {}).flat().map(render);
return <Block {...node.props}>{children}</Block>;
}

Properties

block

block: string

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

The block's registered name. Look it up in the registry to find the component.


holes?

optional holes?: Holes

Defined in: packages/core/src/artifact.types.ts:49

The fields left for the renderer to resolve. Absent when the node has none.


id

id: string

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

The id of the document element this was compiled from — stable across recompiles.


props

props: UnknownProps

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

The props as compiled: literal values only, already validated against the block's schema. A field listed in holes is absent here.


slots?

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

Defined in: packages/core/src/artifact.types.ts:54

Slot name → the nodes filling it, in order. Absent when the document element declared no slots; a declared slot with nothing in it is an empty array.