Documentation IndexFetch the complete documentation index at: /llms.txtUse this file to discover all available pages before exploring further.
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
API reference for the DocumentStore class
DocumentStore
import { DocumentStore } from '@tsdraw/core'
createShape(shape)
void
updateShape(id, partial)
deleteShape(id)
getShape(id)
Shape | undefined
getCurrentPageShapes()
Shape[]
getCurrentPageShapesSorted()
getCurrentPageRenderingShapesSorted()
getShapeIdsInBounds(bounds)
ShapeId[]
const unsubscribe = store.addListener(() => { console.log('Shapes changed:', store.getCurrentPageShapes().length) }) // later unsubscribe()
interface TsdrawDocumentSnapshot { records: TsdrawPersistedRecord[] } interface TsdrawPersistedRecord { typeName: 'page' | 'shape' // ... record data }
import { documentSnapshotToRecords, recordsToDocumentSnapshot } from '@tsdraw/core' const records = documentSnapshotToRecords(snapshot) const snapshot = recordsToDocumentSnapshot(records)