@mocanvas/editor · interface

CreateStoreOptions

interface CreateStoreOptions

This one ships without a description. The signature above is read from the package, and the guides cover the area it belongs to.


Properties · 10

assets?: AssetStore

The asset store to bind to the document. Kept by identity, so a caller can compare store.props.assets against what it passed. Defaults to an in-memory store.

bindingUtils?: readonly SchemaUtilSource[]

Binding utils, for the same reason as shapeUtils.

defaultName?: string
id?: string
initialData?: SerializedStore<EditorRecord>
migrations?: MigrationSequence[]
records?: Readonly<Record<string, CustomRecordInfo<string>>>

Custom record types this document may contain, beyond shapes and bindings — an app's own top-level entities. Each contributes a record type and its migration sequence to the schema, so the records validate on load and survive a .tldr round trip.

seed?: boolean

Give a brand new store its document and first page. Defaults to true.

The seeded page uses DEFAULT_PAGE_ID at FIRST_PAGE_INDEX, so two replicas that each built their own store meet on one page. Turn it OFF when the caller owns the document structure and will put its own page in afterwards — a headless pipeline, a fold that replays records, a test that builds a fixture by hand. Leaving it on there gives the store *two* pages at the same index, and equal indices have no defined order.

Already off, without asking, whenever initialData or snapshot is supplied: those bring their own pages.

shapeUtils?: readonly SchemaUtilSource[]

The shape utils the document will be read with. Their static migrations are collected into the schema, so a board persisted before a prop existed is backfilled on load. Pass the same list you give the editor.

snapshot?: EditorStoreSnapshot

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.