← All packages

@searsuite/sear-plugin-sheet-demo

A complete, optional Sheet state-owner plugin example.

Marker state

classSheetDemoPlugin
class SheetDemoPlugin extends SheetPlugin<SheetDemoPluginState>

Reference implementation of a collaborative, matrix-backed Sheet feature.

constructorSheetDemoPlugin(state: SheetDemoPluginState): SheetDemoPlugin
propertyreadonly documentState: PluginDocumentStateContribution<SheetDemoPluginState, SheetDemoPluginState>

Document-state export modules owned by this plugin state.

propertyinterestedIn: MatrixOTActionName[]

Declares which Sheet OT action names this plugin is interested in. The engine will only call apply when a transaction contains at least one operation matching these action names, unless the transaction is owned by this plugin.

  • [&#39;uc&#39;, &#39;rr&#39;, &#39;rc&#39;] — only called for UpdateCell, ResizeRow, ResizeCol
  • [&#39;*&#39;] — called for any transaction (wildcard)
  • [] — only called for this plugin's own transactions
propertyreadonly transactionOT: { collaborative: boolean; definition: TransactionOTDefinition<MatrixOTOperation<unknown>>; ownerId: string; relations: OTTransformRelation<MatrixOTOperation<unknown>, MatrixOTOperation<unknown>>[] }

Shared transaction algebra used by history and collaboration.

propertyreadonly warnOnDuplicateDepth: false

Whether PluginManager should warn when another ordered plugin shares this depth.

propertyreadonly documentState: PluginDocumentStateContribution<SheetDemoPluginState, SheetDemoPluginState>static
propertyreadonly pluginKey: PluginKeystatic
propertyreadonly symbol: typeof symbolstatic
methodapply(state: SheetDemoPluginState, transaction: Transaction): SheetDemoPluginState | null

Applies a transaction to plugin-owned state and returns the next state.

methodgetPluginConfig(): null

Returns this plugin's runtime configuration view for the current core.

methodregisterCellVisualReaders(registry: SheetCellVisualReaderRegistry): void

This is an override because cell fill already has a separate owner.

methodregisterCommands(commands: SheetCommandBus): void

Registers every stable command id owned by this plugin.

methodregisterQueries(queries: SheetQueryRegistry): void
methodregisterRangeMoves(registry: SheetRangeMoveRegistry): void

Contributes state-owner planning for same-sheet cell moves.

methodregisterRangeReorders(registry: SheetRangeReorderRegistry): void
methodregisterState(): { dataEngine: { dataView: { fieldKey: string; select: (state: unknown): SheetDemoMatrix; viewKey: string }[] }; key: PluginKey; state: SheetDemoPluginState }

Registers one or more plugin-owned state records with the host manager.

methodrender(): Node<CellProperties>[]

Produces scene nodes owned by this plugin for the current core state.

Inherited members 35

Inherited from SheetPlugin.

typeSheetDemoMarker
type SheetDemoMarker = typeof SheetDemoMarker[keyof typeof SheetDemoMarker] SheetDemoMarker: { Approved: "approved"; Review: "review" }

Canonical persisted values owned by the demo feature.

variableSheetDemoFieldKey
SheetDemoFieldKey: "sheet.demo.markers"
variableSheetDemoStateToken
SheetDemoStateToken: typeof SheetDemoStateToken

The host binds one state object per Sheet editor before plugin construction.

functionassertSheetDemoMarker
assertSheetDemoMarker(value: unknown): value

Set and read markers

interfaceSetSheetDemoMarkerInput
interface SetSheetDemoMarkerInput extends SheetDemoCellInput
Inherited members 2

Inherited from SheetDemoCellInput.

variableReadSheetDemoMarkerQuery
ReadSheetDemoMarkerQuery: SheetQueryDefinition<SheetDemoCellInput, SheetDemoMarker | null>
variableSetSheetDemoMarkerCommand
SetSheetDemoMarkerCommand: SheetCommandDefinition<SetSheetDemoMarkerInput, SheetCommandResult>
functionreadSheetDemoMarkers
readSheetDemoMarkers(dataEngine: DataEngine): SheetDemoMatrix | null
functionregisterSheetDemoCommands
registerSheetDemoCommands(commands: SheetCommandBus, source: SheetDemoCommandSource): void
functionregisterSheetDemoQueries
registerSheetDemoQueries(queries: SheetQueryRegistry, readMatrix: (): SheetDemoMatrix): void