← All packages

API reference

@searsuite/sear-plugin-cell-merge

Merged-range state, structural transforms, commands, rendering, and persistence.

24 exportsderived from source

classCellMergeMatrixsource ↗
class CellMergeMatrix extends CSRMatrix<SheetCellMerge | null>

Sparse matrix containing one end coordinate at every merged-range anchor.

constructorconstructor
CellMergeMatrix(data?: CellMergeMatrixData, shape?: [number, number]): CellMergeMatrix
data: CellMergeMatrixData
shape: [number, number]
methodaddItem
addItem(row: number, column: number, value: SheetCellMerge | 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
value: SheetCellMerge | null

The value to add.

methodclone
clone(): this

Deep-clones stored merge values.

methodfindRange
findRange(row: number, column: number): Rect | null

Finds the merged range containing one sheet cell.

row: number
column: number
methodforEachStored
forEachStored(callback: (value: SheetCellMerge | null, row: number, col: number): void): void

Visits actual anchors only, locating their rows through CSR pointer binary search.

callback: (value: SheetCellMerge | null, row: number, col: number): void
methodgetItem
getItem(row: number, column: number): SheetCellMerge | null

Returns an isolated value so callers cannot mutate persisted matrix state.

row: number
column: number
methodgetRanges
getRanges(): Rect[]

Returns all merged ranges in matrix traversal order.

methodreplaceRanges
replaceRanges(ranges: readonly Rect[]): this

Rebuilds sparse entries from normalized ranges while preserving matrix shape.

ranges: readonly Rect[]
methodsetItem
setItem(row: number, column: number, value: SheetCellMerge | null): this

Stores or clears a merged range anchored at the supplied cell.

row: number
column: number
value: SheetCellMerge | null
Inherited members 31

Inherited from CSRMatrix.

classSheetCellMergeConfirmationErrorsource ↗
class SheetCellMergeConfirmationError extends SearError

Base class for errors intentionally exposed by SearSuite packages.

Packages may throw this generic form while they do not need a more specific public error type. Domain-specific subclasses override code.

constructorconstructor
SheetCellMergeConfirmationError(reason: "required" | "changed"): SheetCellMergeConfirmationError
reason: "required" | "changed"
propertycode
readonly code: "SHEET_MERGE_CONFIRMATION_REQUIRED"

Stable machine-readable identifier for this error category.

Inherited members 9

Inherited from SearError.

classSheetCellMergePluginsource ↗
class SheetCellMergePlugin extends Plugin<unknown, CellProperties, SheetCellMergePluginState>

Owns sparse merged-cell state, commands, structure projection, collaboration, and export.

constructorconstructor
SheetCellMergePlugin(state: SheetCellMergePluginState, cellContent?: SheetCellMergeContentSource): SheetCellMergePlugin
state: SheetCellMergePluginState
cellContent: SheetCellMergeContentSource
propertydocumentState
readonly documentState: PluginDocumentStateContribution<SheetCellMergePluginState, SheetCellMergePluginState>

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<SheetCellMergePluginState, SheetCellMergePluginState>
propertypluginKeystatic
readonly pluginKey: PluginKey
propertysymbolstatic
readonly symbol: typeof symbol
methodapply
apply(pluginState: SheetCellMergePluginState, transaction: Transaction): SheetCellMergePluginState | null

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

pluginState: SheetCellMergePluginState
transaction: Transaction
methodgetPluginConfig
getPluginConfig(): null

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

methodisMergedCell
isMergedCell(row: number, column: number): Rect | null
row: number
column: number
methodregisterCommands
registerCommands(commands: SheetCommandBus): void
commands: SheetCommandBus
methodregisterQueries
registerQueries(queries: SheetQueryRegistry): void
queries: SheetQueryRegistry
methodregisterRangeMoves
registerRangeMoves(registry: SheetRangeMoveRegistry): void

Moves complete merged ranges and rejects moves that split a merge.

registry: SheetRangeMoveRegistry
methodregisterRangeReorders
registerRangeReorders(registry: SheetRangeReorderRegistry): void
registry: SheetRangeReorderRegistry
methodregisterState
registerState(): { dataEngine: { dataView: { fieldKey: string; select: (state: unknown): CellMergeMatrix; viewKey: string }[] }; key: PluginKey; state: SheetCellMergePluginState }

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 26

Inherited from Plugin.

classSheetMergeRangeMoveErrorsource ↗
class SheetMergeRangeMoveError extends SearError

A cell move that would split an existing merged range.

constructorconstructor
SheetMergeRangeMoveError(context: SheetRangeMoveContext): SheetMergeRangeMoveError
context: SheetRangeMoveContext
propertycode
readonly code: "SHEET_MOVE_SPLIT_MERGE"

Stable machine-readable identifier for this error category.

Inherited members 9

Inherited from SearError.

classSheetMergeStructureMoveErrorsource ↗
class SheetMergeStructureMoveError extends SearError

A structure permutation would leave a merged range noncontiguous.

constructorconstructor
SheetMergeStructureMoveError(range: readonly readonly number[][]): SheetMergeStructureMoveError
range: readonly readonly number[][]
propertycode
readonly code: "SHEET_STRUCTURE_MOVE_SPLIT_MERGE"

Stable machine-readable identifier for this error category.

Inherited members 9

Inherited from SearError.

interfaceCellMergeMatrixDatasource ↗
interface CellMergeMatrixData

Serialized CSR entries accepted by CellMergeMatrix.

propertydata
readonly data: SheetCellMerge | null[]
propertyindices
readonly indices: number[]
propertyindptr
readonly indptr: number[]
interfaceSheetCellMergesource ↗
interface SheetCellMerge

Sparse value stored only at the top-left cell of a merged range.

propertyendColumn
readonly endColumn: number
propertyendRow
readonly endRow: number
interfaceSheetCellMergeActionDataSourcesource ↗
interface SheetCellMergeActionDataSource extends SheetCellMergeCommandDataSource
propertycellContent
readonly cellContent: SheetCellMergeContentSource
Inherited members 2

Inherited from SheetCellMergeCommandDataSource.

interfaceSheetCellMergeCommandDataSourcesource ↗
interface SheetCellMergeCommandDataSource
propertytarget
readonly target: PluginKey
methodreadMatrix
readMatrix(): CellMergeMatrix
interfaceSheetCellMergeContentSourcesource ↗
interface SheetCellMergeContentSource
propertytarget
readonly target: PluginKey
methodreadCell
readCell(row: number, column: number): unknown
row: number
column: number
interfaceSheetCellMergePluginStatesource ↗
interface SheetCellMergePluginState
propertycellMerges
cellMerges: CellMergeMatrix
interfaceSheetMergeAnalysissource ↗
interface SheetMergeAnalysis
propertydiscardedCells
readonly discardedCells: readonly SheetMergeDiscardedCell[]
propertyend
readonly end: readonly [number, number]
propertyretainedCell
readonly retainedCell: SheetMergeDiscardedCell | null
propertystart
readonly start: readonly [number, number]
interfaceSheetMergeInputsource ↗
interface SheetMergeInput extends SheetRangeInput

Common range input accepted by explicit range commands.

propertyconfirmation
readonly confirmation?: SheetMergeAnalysis
Inherited members 2

Inherited from SheetRangeInput.

variableAnalyzeMergeCellsQuerysource ↗
AnalyzeMergeCellsQuery: SheetQueryDefinition<SheetRangeInput, SheetMergeAnalysis | null>
variableMergeCellsCommandsource ↗
MergeCellsCommand: SheetCommandDefinition<SheetMergeInput, SheetCommandResult>
variableSheetCellMergeFieldKeysource ↗
SheetCellMergeFieldKey: "sheet.cellMerge"

DataEngine field owned by SheetCellMergePlugin.

variableToggleMergeCellsCommandsource ↗
ToggleMergeCellsCommand: SheetCommandDefinition<SheetMergeInput, SheetCommandResult>
variableUnmergeCellsCommandsource ↗
UnmergeCellsCommand: SheetCommandDefinition<SheetRangeInput, SheetCommandResult>
functionanalyzeMergeCellssource ↗
analyzeMergeCells(input: SheetRangeInput, dataSource: SheetCellMergeActionDataSource): SheetMergeAnalysis | null
input: SheetRangeInput
dataSource: SheetCellMergeActionDataSource
functioncreateMergeCellsOperationssource ↗
createMergeCellsOperations(input: SheetRangeInput, dataSource: SheetCellMergeCommandDataSource): UpdateCellOTOperation<SheetCellMerge>[]
input: SheetRangeInput
dataSource: SheetCellMergeCommandDataSource
functioncreateUnmergeCellsOperationssource ↗
createUnmergeCellsOperations(input: SheetRangeInput, dataSource: SheetCellMergeCommandDataSource): UpdateCellOTOperation<SheetCellMerge>[]
input: SheetRangeInput
dataSource: SheetCellMergeCommandDataSource
functionreadSheetCellMergessource ↗
readSheetCellMerges(dataEngine: DataEngine): CellMergeMatrix | null

Reads merged-cell state published by SheetCellMergePlugin.

dataEngine: DataEngine
functionregisterSheetCellMergeCommandssource ↗
registerSheetCellMergeCommands(commands: SheetCommandBus, dataSource: SheetCellMergeActionDataSource): void

Registers every command owned by SheetCellMergePlugin.

commands: SheetCommandBus
dataSource: SheetCellMergeActionDataSource
functionregisterSheetCellMergeQueriessource ↗
registerSheetCellMergeQueries(queries: SheetQueryRegistry, dataSource: SheetCellMergeActionDataSource): void
queries: SheetQueryRegistry
dataSource: SheetCellMergeActionDataSource