@lupinum/board-core types
The public state, node, and JSON Canvas document types.
Persisted documents
Persisted board data uses JsonCanvasDocument.
interface JsonCanvasDocument {
readonly nodes: readonly JsonCanvasNode[]
readonly edges?: readonly JsonCanvasEdge[]
readonly 'x-vue-board'?: VueBoardDocumentMetadata
}Core owns node persistence and board metadata. The connections package owns edge
persistence. Runtime snapshot fields such as camera, grid, and selection
are not accepted as top-level persisted document fields.
Runtime state
BoardState is the immutable runtime view used by renderers and UI reads.
interface BoardState {
readonly camera: Camera
readonly grid: GridSettings
readonly nodes: ReadonlyMap<NodeId, BoardNode>
readonly selection: ReadonlySet<NodeId>
readonly interaction: InteractionState
readonly snapGuides: readonly SnapGuide[]
}Read it with engine.getState(). Use engine.exportDocument() and
engine.loadDocument() for persistence; runtime state is not a persistence
payload.
BoardNode
interface BoardNodeBase {
readonly id: NodeId
readonly x: number
readonly y: number
readonly width: number
readonly height: number
readonly color?: CanvasColor
readonly zIndex: number
readonly locked: boolean
readonly visible: boolean
readonly parentId?: NodeId
}
type BoardNode =
| (BoardNodeBase & { type: 'text'; text: string })
| (BoardNodeBase & { type: 'file'; file: string; subpath?: string })
| (BoardNodeBase & { type: 'link'; url: string })
| (BoardNodeBase & {
type: 'group'
label?: string
background?: string
backgroundStyle?: 'cover' | 'ratio' | 'repeat'
})There is no data property on public nodes. BoardNode is discriminated by
type, so narrowing guarantees the corresponding JSON Canvas content field.
NodeInput defaults to a text node; file and link inputs require file and
url respectively.