@searsuite/sear-plugin-sheet-demo
A complete, optional Sheet state-owner plugin example.
Marker state
- classSheetDemoMatrix
-
class SheetDemoMatrix extends CSRMatrix<SheetDemoMarker | null>One marker per cell; absence and null both mean no marker.
constructor SheetDemoMatrix(data?: SheetDemoMatrixData, shape?: [number, number]): SheetDemoMatrixmethod addItem(row: number, column: number, marker: SheetDemoMarker | null): thisAdds an item to the matrix at the specified row and column.
ReturnsThe current instance for chaining.
rowThe row index.
method setItem(row: number, column: number, marker: SheetDemoMarker | null): thisInherited members 34
Inherited from CSRMatrix.
- name
- ndim
- nnz
- shape
- addColumn
- addListener
- addRow
- clone
- cloneCommittedView
- cloneDetached
- cloneForStaging
- deleteColumns
- deleteRows
- dispatch
- dot
- forEach
- forEachStored
- forEachStoredInRange
- forEachStoredInRow
- fromDense
- getCol
- getDefaultValue
- getItem
- getRow
- lockMutations
- multiply
- removeItem
- removeListener
- setDefaultValue
- sum
- swapColumn
- swapRow
- toArray
- transpose
- classSheetDemoPlugin
-
class SheetDemoPlugin extends SheetPlugin<SheetDemoPluginState>Reference implementation of a collaborative, matrix-backed Sheet feature.
constructor SheetDemoPlugin(state: SheetDemoPluginState): SheetDemoPluginproperty readonly documentState: PluginDocumentStateContribution<SheetDemoPluginState, SheetDemoPluginState>Document-state export modules owned by this plugin state.
property interestedIn: MatrixOTActionName[]Declares which Sheet OT action names this plugin is interested in. The engine will only call
applywhen a transaction contains at least one operation matching these action names, unless the transaction is owned by this plugin.['uc', 'rr', 'rc']— only called for UpdateCell, ResizeRow, ResizeCol['*']— called for any transaction (wildcard)[]— only called for this plugin's own transactions
property readonly transactionOT: { collaborative: boolean; definition: TransactionOTDefinition<MatrixOTOperation<unknown>>; ownerId: string; relations: OTTransformRelation<MatrixOTOperation<unknown>, MatrixOTOperation<unknown>>[] }Shared transaction algebra used by history and collaboration.
property readonly warnOnDuplicateDepth: falseWhether PluginManager should warn when another ordered plugin shares this depth.
property readonly documentState: PluginDocumentStateContribution<SheetDemoPluginState, SheetDemoPluginState>staticproperty readonly pluginKey: PluginKeystaticproperty readonly symbol: typeof symbolstaticmethod apply(state: SheetDemoPluginState, transaction: Transaction): SheetDemoPluginState | nullApplies a transaction to plugin-owned state and returns the next state.
method getPluginConfig(): nullReturns this plugin's runtime configuration view for the current core.
method registerCellVisualReaders(registry: SheetCellVisualReaderRegistry): voidThis is an override because cell fill already has a separate owner.
method registerCommands(commands: SheetCommandBus): voidRegisters every stable command id owned by this plugin.
method registerQueries(queries: SheetQueryRegistry): voidmethod registerRangeMoves(registry: SheetRangeMoveRegistry): voidContributes state-owner planning for same-sheet cell moves.
method registerRangeReorders(registry: SheetRangeReorderRegistry): voidmethod 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.
method render(): Node<CellProperties>[]Produces scene nodes owned by this plugin for the current core state.
Inherited members 35
Inherited from SheetPlugin.
- depth
- transactionHistory
- key
- configure
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- initialize
- lockCommittedState
- onClick
- onDblClick
- onEditorDestroy
- onInitialDataCell
- onInitialDataComplete
- onMouseDown
- onMouseMove
- onMouseUp
- onResize
- onScroll
- onTransactionCommitted
- projectTransaction
- registerCapabilities
- registerConfig
- registerFormatTransfers
- registerObservations
- registerSessionState
- registerStructureMoves
- sealRuntimeMetadata
- sealRuntimeMethods
- sealRuntimeWrites
- setState
- start
- registerServices
- interfaceSheetDemoMatrixData
-
property readonly data: SheetDemoMarker | null[]property readonly indices: number[]property readonly indptr: number[] - interfaceSheetDemoPluginState
- 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 SheetDemoStateTokenThe 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 - interfaceSheetDemoCellInput
-
property readonly column: numberproperty readonly row: number - interfaceSheetDemoCommandSource
-
property readonly target: PluginKeymethod readMatrix(): SheetDemoMatrix - 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
No matching API entries.