← All packages

API reference

@searsuite/sear-plugin-sheet-demo

A complete, optional Sheet state-owner plugin example.

17 exportsderived from source

classSheetDemoMatrixsource ↗
class SheetDemoMatrix extends CSRMatrix<SheetDemoMarker | null>

One marker per cell; absence and null both mean no marker.

constructorconstructor
SheetDemoMatrix(data?: SheetDemoMatrixData, shape?: [number, number]): SheetDemoMatrix
data: SheetDemoMatrixData
shape: [number, number]
methodaddItem
addItem(row: number, column: number, marker: SheetDemoMarker | null): this

Adds an item to the matrix at the specified row and column.

ReturnsThe current instance for chaining.

row: number

The row index.

column: number
marker: SheetDemoMarker | null
methodsetItem
setItem(row: number, column: number, marker: SheetDemoMarker | null): this
row: number
column: number
marker: SheetDemoMarker | null
Inherited members 34

Inherited from CSRMatrix.

classSheetDemoPluginsource ↗
class SheetDemoPlugin extends SheetPlugin<SheetDemoPluginState>

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

constructorconstructor
SheetDemoPlugin(state: SheetDemoPluginState): SheetDemoPlugin
state: SheetDemoPluginState
propertydocumentState
readonly documentState: PluginDocumentStateContribution<SheetDemoPluginState, SheetDemoPluginState>

Document-state export modules owned by this plugin state.

propertyinterestedIn
interestedIn: 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
propertytransactionOT
readonly transactionOT: { collaborative: boolean; definition: TransactionOTDefinition<MatrixOTOperation<unknown>>; ownerId: string; relations: OTTransformRelation<MatrixOTOperation<unknown>, MatrixOTOperation<unknown>>[] }

Shared transaction algebra used by history and collaboration.

propertywarnOnDuplicateDepth
readonly warnOnDuplicateDepth: false

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

propertydocumentStatestatic
readonly documentState: PluginDocumentStateContribution<SheetDemoPluginState, SheetDemoPluginState>
propertypluginKeystatic
readonly pluginKey: PluginKey
propertysymbolstatic
readonly symbol: typeof symbol
methodapply
apply(state: SheetDemoPluginState, transaction: Transaction): SheetDemoPluginState | null

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

state: SheetDemoPluginState
transaction: Transaction
methodgetPluginConfig
getPluginConfig(): null

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

methodregisterCellVisualReaders
registerCellVisualReaders(registry: SheetCellVisualReaderRegistry): void

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

registry: SheetCellVisualReaderRegistry
methodregisterCommands
registerCommands(commands: SheetCommandBus): void

Registers every stable command id owned by this plugin.

commands: SheetCommandBus
methodregisterQueries
registerQueries(queries: SheetQueryRegistry): void
queries: SheetQueryRegistry
methodregisterRangeMoves
registerRangeMoves(registry: SheetRangeMoveRegistry): void

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

registry: SheetRangeMoveRegistry
methodregisterRangeReorders
registerRangeReorders(registry: SheetRangeReorderRegistry): void
registry: SheetRangeReorderRegistry
methodregisterState
registerState(): { 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
render(): Node<CellProperties>[]

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

Inherited members 36

Inherited from SheetPlugin.

interfaceSetSheetDemoMarkerInputsource ↗
interface SetSheetDemoMarkerInput extends SheetDemoCellInput
propertymarker
readonly marker: SheetDemoMarker | null
Inherited members 2

Inherited from SheetDemoCellInput.

interfaceSheetDemoCellInputsource ↗
interface SheetDemoCellInput
propertycolumn
readonly column: number
propertyrow
readonly row: number
interfaceSheetDemoCommandSourcesource ↗
interface SheetDemoCommandSource
propertytarget
readonly target: PluginKey
methodreadMatrix
readMatrix(): SheetDemoMatrix
interfaceSheetDemoMatrixDatasource ↗
interface SheetDemoMatrixData
propertydata
readonly data: SheetDemoMarker | null[]
propertyindices
readonly indices: number[]
propertyindptr
readonly indptr: number[]
interfaceSheetDemoPluginStatesource ↗
interface SheetDemoPluginState
propertymarkers
readonly markers: SheetDemoMatrix
typeSheetDemoMarkersource ↗
type SheetDemoMarker = typeof SheetDemoMarker[keyof typeof SheetDemoMarker]

Canonical persisted values owned by the demo feature.

variableReadSheetDemoMarkerQuerysource ↗
ReadSheetDemoMarkerQuery: SheetQueryDefinition<SheetDemoCellInput, SheetDemoMarker | null>
variableSetSheetDemoMarkerCommandsource ↗
SetSheetDemoMarkerCommand: SheetCommandDefinition<SetSheetDemoMarkerInput, SheetCommandResult>
variableSheetDemoFieldKeysource ↗
SheetDemoFieldKey: "sheet.demo.markers"
variableSheetDemoMarkersource ↗
SheetDemoMarker: { Approved: "approved"; Review: "review" }

Canonical persisted values owned by the demo feature.

variableSheetDemoStateTokensource ↗
SheetDemoStateToken: typeof SheetDemoStateToken

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

functionassertSheetDemoMarkersource ↗
assertSheetDemoMarker(value: unknown): value
value: unknown
functionreadSheetDemoMarkerssource ↗
readSheetDemoMarkers(dataEngine: DataEngine): SheetDemoMatrix | null
dataEngine: DataEngine
functionregisterSheetDemoCommandssource ↗
registerSheetDemoCommands(commands: SheetCommandBus, source: SheetDemoCommandSource): void
commands: SheetCommandBus
source: SheetDemoCommandSource
functionregisterSheetDemoQueriessource ↗
registerSheetDemoQueries(queries: SheetQueryRegistry, readMatrix: (): SheetDemoMatrix): void
queries: SheetQueryRegistry
readMatrix: (): SheetDemoMatrix