Interface: SlotConstraint
Defined in: packages/core/src/block.types.ts:59
What one slot accepts: which blocks may sit in it, and how many. allow is checked twice —
its entries must name registered blocks, and every child a document puts here must be one of
them. The bounds are checked when a document compiles.
Example
import type { SlotConstraint } from "@nubbin/core";
const items: SlotConstraint = { allow: ["Card"], min: 1, max: 4 };
const anything: SlotConstraint = {};
Properties
allow?
optionalallow?: readonlystring[]
Defined in: packages/core/src/block.types.ts:66
Block names permitted here, each resolved at registration. Omitted means any registered
block. An entry naming no registered block fails createRegistry rather than silently
rejecting every child; a child a listed name does not cover is a compile fault
(slot-not-allowed).
max?
optionalmax?:number
Defined in: packages/core/src/block.types.ts:76
Most children the slot may hold, checked at compile (slot-max). defineBlock refuses a
min above it.
min?
optionalmin?:number
Defined in: packages/core/src/block.types.ts:71
Fewest children the slot must hold, checked at compile (slot-min). A declared slot the
document never mentions counts as holding zero, so a min is enforced there too.