CanvasDocumentHost
Mounts a compiled document on a headless host and draws one of its scenes.
@internote/canvas-sdk/hostOn this page
import { CanvasDocumentHost } from '@internote/canvas-sdk/host';Builds the host with createHeadlessCanvasHost — rebuilt when the document, files or assets change, since each manifest arrives after the first render — and disposes it on unmount. It renders a CanvasSceneView for sceneIndex, clamped to the last scene, and nothing when the document has no scenes. The reading view mounts CanvasSceneView directly, with its own host.
#Props
Also takes className. Any other prop is passed to the rendered element.
assetsUploaded image assets, file name → public URL — what an environment drawing an uploaded picture resolves against.
null while the manifest is still arriving.Record<string, string> | nulldbDatabase-tier backend for
session+db environments; a no-op store when absent.KeyValueStoragedocumentThe compiled and refined document.
{ body?: unknown; data?: Record<string, ChalkDataset> }environmentsTypes to register before mounting (idempotent).
EnvironmentDefinition[]filesThe internote's uploaded text files by name, where attached dataset CSVs and geometry are read from.
null while still loading; the host is rebuilt when it arrives.Record<string, string> | nullinternoteIdThe internote's id, the first part of every environment's session key.
stringonStepChangeCalled after the shown scene's step changes, with the new step and the scene's index.
(step: number, sceneIndex: number) => voidrenderBlankElementDraws blank-canvas content: the elements of a scene's detail outside its environments. Nothing is drawn for them when absent.
BlankElementRendererrenderToolbarDraws the host toolbar with the embedder's own buttons, in place of the minimal built-in one.
(toolbar: HostToolbarState) => ReactNoderesolveAssetUrlResolves a relative image source to a URL for blank-canvas content;
null when it cannot.(fileName: string) => string | nullsceneIndexWhich scene to show (index into the document's scenes).
numberDefault
0Declared in packages/canvas-sdk/src/host/CanvasDocumentHost.tsx:600.