API reference
@searsuite/sear-plugin-selection
Sheet selection state, navigation, observations, highlights, and commands.
47 exportsderived from source
Concept 1
Select a range, then read the committed selection
SheetSelectionPlugin owns Sheet selection state. SelectRangeCommand requests a new anchor and focus; the
plugin expands a range when it intersects a merged cell, stages selection operations, and publishes a selection
change after commit. GetSelection and GetSelections read the resulting state, while observations notify a host
that needs to update its interface.
import { GetSelection, SelectRangeCommand } from '@searsuite/sear-plugin-selection';
editor.commands.run(SelectRangeCommand, { anchor: [2, 3], focus: [2, 3] });
const selection = editor.queries.run(GetSelection, undefined);
Use when: responding to pointer, keyboard, or application navigation. Coordinates are zero-based. A host should run the command rather than writing the selection matrix or highlight state directly.
Concept 2
Distinguish selection state from its visual highlight
Selection has document-facing operations, local navigation state, and a render projection. SheetHighlightPlugin
draws the current range and can combine additional highlight providers; it does not become the owner of the
selected range. EnsureSelectionVisibleCommand asks the viewport to reveal the selection after navigation.
Workbook remounting captures the local selection session through SheetSelectionSessionStateDefinition. The
feature's command and query contracts remain the same when the active Sheet is recreated.
- enumSheetAdditionalSelectionModesource ↗
-
enum SheetAdditionalSelectionModeHow a selection command updates disjoint local selections.
enum memberAppendCurrent AppendCurrent: "append-current"enum memberClear Clear: "clear"enum memberPreserve Preserve: "preserve" - enumSheetHighlightPipelineStepNamesource ↗
-
enum SheetHighlightPipelineStepNameObservable pipeline steps owned by the generic range-highlight host.
enum memberRefresh Refresh: "sheet-highlight.refresh" - enumSheetSelectionInteractionNamesource ↗
-
enum SheetSelectionInteractionNameEnumerates SheetSelectionInteractionName values.
enum memberChanged Changed: "selection-changed" - enumSheetSelectionPipelineNamesource ↗
-
enum SheetSelectionPipelineNameObservable pipeline and step names owned by the Selection module.
enum memberSelectionChange SelectionChange: "selection-change" - enumSheetSelectionPipelineStepNamesource ↗
-
enum SheetSelectionPipelineStepNameEnumerates SheetSelectionPipelineStepName values.
enum memberEnsureSelectionVisible EnsureSelectionVisible: "selection.ensure-selection-visible"enum memberRecordSelectionChange RecordSelectionChange: "selection.record-selection-change"enum memberUpdateSelection UpdateSelection: "selection.update-selection" - enumSheetSelectionPointerActionsource ↗
-
enum SheetSelectionPointerActionPointer-session transitions owned by the Sheet selection plugin.
- enumSheetSelectionSourcesource ↗
-
enum SheetSelectionSourceEnumerates SheetSelectionSource values.
- classSheetHighlightPluginsource ↗
-
class SheetHighlightPlugin extends Plugin<SearCoreSheet, CellProperties, Record<string, never>>Renders registered range-highlighter output as a single managed scene layer.
constructorconstructor SheetHighlightPlugin(registry: SheetHighlightRegistry): SheetHighlightPluginCreates a SheetHighlightPlugin instance.
registry: SheetHighlightRegistry
propertypluginKeystatic readonly pluginKey: PluginKeyStable plugin key for SheetHighlightPlugin.
propertysymbolstatic readonly symbol: typeof symbolDI token for resolving SheetHighlightPlugin.
methodapply apply(_state: Record<string, never>, _transaction: Transaction): Record<string, never> | nullApplies a transaction to SheetHighlightPlugin state.
_state: Record<string, never>_transaction: Transaction
methodgetPluginConfig getPluginConfig(): unknownReturns the plugin config.
methodregisterState registerState(): { key: PluginKey; state: Record<string, never> }Registers the state.
methodrender render(searCore: SearCoreSheet): Node<CellProperties>[]Renders SheetHighlightPlugin scene output.
searCore: SearCoreSheet
Inherited members 30
Inherited from Plugin.
- depth
- documentState
- interestedIn
- pluginKey
- transactionHistory
- transactionOT
- warnOnDuplicateDepth
- key
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- lockCommittedState
- onClick
- onDblClick
- onInitialDataCell
- onInitialDataComplete
- onMouseDown
- onMouseMove
- onMouseUp
- onResize
- onScroll
- onTransactionCommitted
- projectTransaction
- registerConfig
- sealRuntimeMetadata
- sealRuntimeMethods
- sealRuntimeWrites
- setState
- classSheetHighlightRegistrysource ↗
-
class SheetHighlightRegistryRegistry for independently replaceable sheet-range highlighters.
The registry owns provider activation and change notification; the paired SheetHighlightPlugin owns scene-node creation and teardown.
constructorconstructor SheetHighlightRegistry(platform?: Platform): SheetHighlightRegistryplatform: Platform
propertysymbolstatic readonly symbol: typeof symbolDI token for resolving SheetHighlightRegistry.
methodgetHighlights getHighlights(context: SheetHighlightContext): SheetRangeHighlight[]Returns the highlights.
context: SheetHighlightContext
methodinvalidate invalidate(): voidRequests a new provider evaluation when state read by a provider (for example selection, search terms, or remote cursors) changes externally.
methodregister register(provider: SheetHighlightProvider): (): voidRegisters the value.
provider: SheetHighlightProvider
methodsetEnabled setEnabled(providerKey: string, enabled: boolean): voidUpdates the enabled.
providerKey: stringenabled: boolean
methodsubscribe subscribe(listener: (): void): (): voidSubscribes to state changes and returns an idempotent disposer.
listener: (): void
- classSheetRangeDragsource ↗
-
class SheetRangeDragOwns one local range-border gesture; document changes enter through the move command.
constructorconstructor SheetRangeDrag(commands: SheetCommandBus, queries: SheetQueryRegistry, coordinates: CoordinateEngine, pointer: PointerCapture, keyboard: KeyboardRouter, cursorRules: CursorRegistry, cursor: CursorEngine, highlights: SheetHighlightRegistry, platform: Platform, interactions: SheetInteractionStore): SheetRangeDragcommands: SheetCommandBusqueries: SheetQueryRegistrycoordinates: CoordinateEnginepointer: PointerCapturekeyboard: KeyboardRoutercursorRules: CursorRegistrycursor: CursorEnginehighlights: SheetHighlightRegistryplatform: Platforminteractions: SheetInteractionStore
propertysymbolstatic readonly symbol: typeof symbolmethodbind bind(core: SearCoreSheet, readSelection: (): Rect, ownerToken: object): voidInstalls editor-local cursor and preview contributions once Core is available.
core: SearCoreSheetreadSelection: (): RectownerToken: object
methoddestroy destroy(ownerToken?: object): voidIdempotently releases preview, cursor, pointer capture and animation resources.
ownerToken: object
methodisActive isActive(): booleanmethodonMouseDown onMouseDown(event: EventWithOffsetAndTarget<CellProperties>): booleanStarts on selection borders or already selected axis headers.
event: EventWithOffsetAndTarget<CellProperties>
methodregisterCommands registerCommands(commands: SheetCommandBus): voidRoutes local pointer and animation inputs through the editor command boundary.
commands: SheetCommandBus
methodsetUserInteraction setUserInteraction(service: UserInteractionService | undefined): voidBinds the optional host-owned confirmation service during assembly.
service: UserInteractionService | undefined
- classSheetRangeMoveErrorsource ↗
-
class SheetRangeMoveError extends SearErrorA range move rejected before any document state was staged.
constructorconstructor SheetRangeMoveError(code: "SHEET_MOVE_INVALID_RANGE" | "SHEET_MOVE_DESTINATION_OCCUPIED", message: string, details: SearErrorDetails): SheetRangeMoveErrorcode: "SHEET_MOVE_INVALID_RANGE" | "SHEET_MOVE_DESTINATION_OCCUPIED"message: stringdetails: SearErrorDetails
Inherited members 10
Inherited from SearError.
- classSheetSelectionPluginsource ↗
-
class SheetSelectionPlugin extends Plugin<SearCoreSheet, CellProperties, [RectRange, RectRange]>Owns Sheet selections, navigation, commands, and observations.
constructorconstructor SheetSelectionPlugin(sheetCellMergePlugin: SheetCellMergePlugin, keyboardRouter: KeyboardRouter, platform?: Platform, interactionReducers?: SheetInteractionReducerRegistry, commands?: SheetCommandBus, rangeMoves?: SheetRangeMoveRegistry, rangeDrag?: SheetRangeDrag, highlights?: SheetHighlightRegistry): SheetSelectionPluginCreates a SheetSelectionPlugin instance.
sheetCellMergePlugin: SheetCellMergePluginkeyboardRouter: KeyboardRouterplatform: PlatforminteractionReducers: SheetInteractionReducerRegistrycommands: SheetCommandBusrangeMoves: SheetRangeMoveRegistryrangeDrag: SheetRangeDraghighlights: SheetHighlightRegistry
propertydepth depth: numberDraw and event ordering hint; lower values run earlier.
propertyinterestedIn 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
propertypluginKeystatic readonly pluginKey: PluginKeyStable plugin key for SheetSelectionPlugin.
propertysymbolstatic readonly symbol: symbolDI token for resolving SheetSelectionPlugin.
methodapply apply(pluginState: [Rect, Rect], transaction: Transaction): [Rect, Rect] | nullApplies a transaction to SheetSelectionPlugin state.
pluginState: [Rect, Rect]transaction: Transaction
methodbindCore bindCore(core: SearCoreSheet): voidBinds this plugin to the core owned by its editor-local container.
core: SearCoreSheet
methodextendForDownwardEntry extendForDownwardEntry(): voidAdds a destination row only when Enter would otherwise keep the active cell in place.
methodgetPluginConfig getPluginConfig(searCore: SearCoreSheet): nullReturns the plugin config.
searCore: SearCoreSheet
methodisInMergedCell isInMergedCell(rangeRect: Rect): Rect | nullReturns whether in merged cell.
rangeRect: Rect
methodlockCommittedState lockCommittedState(state: [Rect, Rect]): voidLocks committed selection rectangles while transaction clones remain writable.
state: [Rect, Rect]
methodonDblClick onDblClick(searCore: SearCoreSheet, event: EventWithOffsetAndTarget<CellProperties>): boolean | voidHandles the dbl click lifecycle event.
searCore: SearCoreSheetevent: EventWithOffsetAndTarget<CellProperties>
methodonEditorDestroy onEditorDestroy(): voidCancels transient pointer work before this editor is released.
methodonMouseDown onMouseDown(searCore: SearCoreSheet, event: EventWithOffsetAndTarget<CellProperties>): boolean | voidHandles the mouse down lifecycle event.
searCore: SearCoreSheetevent: EventWithOffsetAndTarget<CellProperties>
methodonMouseMove onMouseMove(searCore: SearCoreSheet, event: EventWithOffsetAndTarget<CellProperties>): boolean | voidHandles the mouse move lifecycle event.
searCore: SearCoreSheetevent: EventWithOffsetAndTarget<CellProperties>
methodonMouseUp onMouseUp(_searCore: SearCoreSheet, _event: EventWithOffsetAndTarget<CellProperties>): boolean | voidHandles the mouse up lifecycle event.
_searCore: SearCoreSheet_event: EventWithOffsetAndTarget<CellProperties>
methodonTransactionCommitted onTransactionCommitted(transaction: Transaction): voidRebases local keyboard anchors only after structural transactions commit.
transaction: Transaction
methodregisterCommands registerCommands(commands: SheetCommandBus): voidRegisters the commands.
commands: SheetCommandBus
methodregisterConfig registerConfig(): { config: ConfigUnit<{ defaultBorderColor: string }>; key: PluginKey }[]Registers default configuration values owned by this plugin.
methodregisterQueries registerQueries(queries: SheetQueryRegistry): voidRegisters the active selection as a typed query rather than a DataEngine field.
queries: SheetQueryRegistry
methodregisterSessionState registerSessionState(registry: SessionStateRegistry): voidRegisters selection-owned local remount state.
registry: SessionStateRegistry
methodregisterState registerState(): { key: PluginKey; state: [Rect, Rect] }Registers one or more plugin-owned state records with the host manager.
methodrender render(searCore: SearCoreSheet, offset?: { x: number; y: number }): Node<CellProperties>[]Renders SheetSelectionPlugin scene output.
searCore: SearCoreSheetoffset: { x: number; y: number }
Inherited members 21
Inherited from Plugin.
- documentState
- pluginKey
- transactionHistory
- transactionOT
- warnOnDuplicateDepth
- key
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- onClick
- onInitialDataCell
- onInitialDataComplete
- onResize
- onScroll
- projectTransaction
- sealRuntimeMetadata
- sealRuntimeMethods
- sealRuntimeWrites
- setState
- interfaceMoveSheetRangeInputsource ↗
-
interface MoveSheetRangeInputMoves a single rectangle to a new top-left coordinate on the same sheet.
- interfaceSelectionChangedInteractionSignalsource ↗
-
interface SelectionChangedInteractionSignal extends SheetInteractionSignalPublic contract for SelectionChangedInteractionSignal.
- interfaceSheetEnsureSelectionVisibleInputsource ↗
-
interface SheetEnsureSelectionVisibleInput extends SheetSelectRangeInputPublic contract for SheetEnsureSelectionVisibleInput.
Inherited members 8
Inherited from SheetSelectRangeInput.
- interfaceSheetFillRangeInputsource ↗
-
interface SheetFillRangeInput - interfaceSheetHighlightContextsource ↗
-
interface SheetHighlightContextRead-only sheet state made available to every range-highlight provider.
propertysearCore searCore: SearCoreSheet - interfaceSheetHighlightProvidersource ↗
-
interface SheetHighlightProviderExtension point for range decorations such as formula precedents, search results, validation errors, collaboration selections, and audit trails.
propertykey key: stringmethodgetHighlights getHighlights(context: SheetHighlightContext): SheetRangeHighlight[]context: SheetHighlightContext
- interfaceSheetRangeHighlightsource ↗
-
interface SheetRangeHighlightA visual-only cell range supplied by an independently registered provider.
propertydepth depth?: numberpropertyedge edge?: SheetHighlightEdgepropertyend end: Pointpropertyfill fill?: stringpropertyinset inset?: numberInsets the visual box from the resolved cell-range boundary.
propertyskipHit skipHit?: booleanpropertystart start: Pointpropertystroke stroke?: stringpropertystrokeWidth strokeWidth?: numberpropertytype type?: string - interfaceSheetSelectionPointerInputsource ↗
-
interface SheetSelectionPointerInputDetached input coordinates for a selection pointer transition.
propertyaction readonly action: SheetSelectionPointerActionpropertyctrlKey readonly ctrlKey?: booleanpropertymetaKey readonly metaKey?: booleanpropertyshiftKey readonly shiftKey?: booleanpropertytarget readonly target?: { endColIndex: number | undefined; endRowIndex: number | undefined; region: CellRegion | undefined; startColIndex: number | undefined; startRowIndex: number | undefined } | nullpropertyview readonly view?: { x: number; y: number } - interfaceSheetSelectRangeInputsource ↗
-
interface SheetSelectRangeInputPublic programmatic input for selecting a rectangular sheet range.
propertyactiveAnchor readonly activeAnchor?: PointOptional active anchor stored for in-progress pointer or keyboard interactions.
propertyactiveFocus readonly activeFocus?: PointOptional active focus stored for in-progress pointer or keyboard interactions.
propertyadditionalSelectionMode readonly additionalSelectionMode?: SheetAdditionalSelectionModeTransition applied to disjoint local selections at commit.
propertyanchor readonly anchor: PointFinal selected range anchor.
propertyensureVisible readonly ensureVisible?: booleanWhether the command should also scroll the selection into view.
propertyfocus readonly focus: PointFinal selected range focus.
propertysource readonly source?: SheetSelectionSourceOrigin of this selection change.
- typeSheetDragAxissource ↗
-
type SheetDragAxis = typeof SheetDragAxis[keyof typeof SheetDragAxis]Canonical axes for complete row/column selection gestures.
- typeSheetHighlightEdgesource ↗
-
type SheetHighlightEdge = typeof SheetHighlightEdge[keyof typeof SheetHighlightEdge]Viewport-spanning overlay guide anchored to a cell-range edge.
- typeSheetRangeDragInputsource ↗
-
type SheetRangeDragInput = { action: typeof SheetRangeDragAction.Begin | typeof SheetRangeDragAction.FillBegin | typeof SheetRangeDragAction.Update | typeof SheetRangeDragAction.Release; point: PointerCapturePoint } | { action: typeof SheetRangeDragAction.Cancel | typeof SheetRangeDragAction.Tick }Portable inputs for one local gesture, never persisted as document state.
- typeSheetSelectionSessionStatesource ↗
-
type SheetSelectionSessionState = readonly [RectRange, RectRange]Local selection state retained while remounting one workbook sheet.
- variableAnalyzeSheetRangeMovesource ↗
-
AnalyzeSheetRangeMove: SheetQueryDefinition<MoveSheetRangeInput, SheetRangeMoveAnalysis>Reads the latest legal destination and owner constraints for a range move.
- variableClearSelectedContentsCommandsource ↗
-
ClearSelectedContentsCommand: SheetCommandDefinition<void, SheetCommandResult>Clears every rectangle of a disjoint selection in one data transaction.
- variableEnsureSelectionVisibleCommandsource ↗
-
EnsureSelectionVisibleCommand: SheetCommandDefinition<SheetEnsureSelectionVisibleInput, SheetCommandResult> - variableFillSheetRangeCommandsource ↗
-
FillSheetRangeCommand: SheetCommandDefinition<SheetFillRangeInput, SheetCommandResult>Fills cells from a selected source rectangle through the pointer destination.
- variableGetActiveCellsource ↗
-
GetActiveCell: SheetQueryDefinition<void, readonly [number, number] | null>Reads the cell where the current selection began, including reversed ranges.
- variableGetSelectionsource ↗
-
GetSelection: SheetQueryDefinition<void, SheetRangeBounds | null>Typed query for the active rectangular selection, independent of selection storage.
- variableGetSelectionssource ↗
-
GetSelections: SheetQueryDefinition<void, readonly SheetRangeBounds[]>All disjoint selections, with the current active rectangle last.
- variableGetSheetRangeMoveConflictsource ↗
-
GetSheetRangeMoveConflict: SheetQueryDefinition<MoveSheetRangeInput, boolean>Validates a move and reports whether replacement requires user authorization.
- variableHandleSheetRangeDragCommandsource ↗
-
HandleSheetRangeDragCommand: SheetCommandDefinition<SheetRangeDragInput, SheetCommandResult> - variableHandleSheetSelectionPointerCommandsource ↗
-
HandleSheetSelectionPointerCommand: SheetCommandDefinition<SheetSelectionPointerInput, SheetCommandResult>Routes selection pointer-session changes through the editor command bus.
- variableMoveSheetRangeCommandsource ↗
-
MoveSheetRangeCommand: SheetCommandDefinition<MoveSheetRangeInput, SheetCommandResult> - variableSelectRangeCommandsource ↗
-
SelectRangeCommand: SheetCommandDefinition<SheetSelectRangeInput, SheetCommandResult> - variableSheetDragAxissource ↗
-
SheetDragAxis: { Column: 1; Row: 0 }Canonical axes for complete row/column selection gestures.
- variableSheetHighlightEdgesource ↗
-
SheetHighlightEdge: { Bottom: "bottom"; Left: "left"; Right: "right"; Top: "top" }Viewport-spanning overlay guide anchored to a cell-range edge.
- variableSheetRangeDragActionsource ↗
-
SheetRangeDragAction: { Begin: "begin"; Cancel: "cancel"; FillBegin: "fill-begin"; Release: "release"; Tick: "tick"; Update: "update" }Canonical phases of a local range-border gesture.
- variableSheetRangeMoveErrorCodesource ↗
-
SheetRangeMoveErrorCode: { DestinationOccupied: "SHEET_MOVE_DESTINATION_OCCUPIED"; InvalidRange: "SHEET_MOVE_INVALID_RANGE" }Stable range-move validation failures exposed to hosts.
- variableSheetSelectionRenderSemanticssource ↗
-
SheetSelectionRenderSemantics: { outlineRole: "selection-outline"; owner: "sheet-selection" }Stable semantic attributes emitted by retained render targets for Selection.
- variableSheetSelectionSessionStateDefinitionsource ↗
-
SheetSelectionSessionStateDefinition: SessionStateDefinition<SheetSelectionSessionState>Stable session-state identity owned by SheetSelectionPlugin.
- functionregisterSelectionQueriessource ↗
-
registerSelectionQueries(queries: SheetQueryRegistry, readSelection: (): SheetRangeBounds | null): voidRegisters the selection query against an editor-local query registry.
queries: SheetQueryRegistryreadSelection: (): SheetRangeBounds | null
- functionregisterSheetSelectionInteractionReducerssource ↗
-
registerSheetSelectionInteractionReducers(registry: SheetInteractionReducerRegistry): voidRegisters Selection's local interaction projection once per DI container.
registry: SheetInteractionReducerRegistry
No public exports match that search.