← All packages

@searsuite/sear-plugin-alignment

Sheet horizontal and vertical alignment state, commands, rendering projections, and persistence.

Horizontal alignment

classAlignmentMatrix
class AlignmentMatrix extends CSRMatrix<string>

Sparse horizontal-alignment matrix whose absent cells resolve to left alignment.

Only non-left values are persisted. This keeps alignment state proportional to user overrides, while retaining a stable left-aligned default for every cell in the declared sheet shape. Explicit default values in serialized input are compacted while materializing the sparse matrix.

constructorAlignmentMatrix(data?: AlignmentMatrixData, shape?: [number, number]): AlignmentMatrix

Creates an alignment matrix and compacts explicit left-alignment entries.

data

Optional serialized CSR entries from persisted state.

shape

Declared row and column count; empty cells resolve to left alignment.

propertyreadonly defaultAlignment: Leftstatic

Default horizontal alignment returned for cells without an explicit override.

methodaddItem(row: number, col: number, value: string): this

Stores an explicit non-default override, or removes the entry when left alignment is requested.

ReturnsThis matrix after the sparse update.

row

Zero-based row receiving the override.

col

Zero-based column receiving the override.

value

Requested horizontal alignment.

Inherited members 34

Inherited from CSRMatrix.

classSheetAlignmentPlugin
class SheetAlignmentPlugin extends Plugin<unknown, CellProperties, SheetAlignmentPluginState>

Plugin that owns cell alignment data.

Alignment state accepts direct alignment transactions owned by this plugin and also tracks sheet-data cell type changes to maintain built-in default alignment projections.

constructorSheetAlignmentPlugin(state: SheetAlignmentPluginState, readCellData?: (): SheetMatrix): SheetAlignmentPlugin

Constructs the alignment plugin.

state

Shared alignment state.

propertyreadonly documentState: PluginDocumentStateContribution<SheetAlignmentPluginState, SheetAlignmentPluginState>

SheetAlignmentPlugin owns the persisted alignment export module.

propertyinterestedIn: string[]

Alignment reacts to direct cell updates and sheet-structure changes.

propertyreadonly transactionOT: { collaborative: boolean; definition: TransactionOTDefinition<MatrixOTOperation<unknown>>; ownerId: string; relations: OTTransformRelation<MatrixOTOperation<unknown>, MatrixOTOperation<unknown>>[] }

Alignment transactions share the registered MatrixOT algebra.

propertyreadonly warnOnDuplicateDepth: false

Alignment data is state-only; duplicate render/event depth diagnostics do not apply.

propertyreadonly documentState: PluginDocumentStateContribution<SheetAlignmentPluginState, SheetAlignmentPluginState>static

Document-state export contribution for persisted cell alignments.

propertyreadonly pluginKey: PluginKeystatic

Stable plugin key shared by all alignment plugin instances.

propertyreadonly symbol: symbolstatic

DI token for resolving the alignment plugin.

methodapply(pluginState: SheetAlignmentPluginState, transaction: Transaction): SheetAlignmentPluginState | null

Applies alignment operations to the alignment matrix.

ReturnsUpdated plugin state, or null when the transaction has no relevant operations.

pluginState

Current alignment state.

transaction

Transaction containing direct or derived MatrixOT-compatible operations.

methodgetPluginConfig(): null

Alignment data has no render-time configuration.

methodregisterCellVisualReaders(registry: SheetCellVisualReaderRegistry, context: SheetCellVisualReaderRegistrationContext): void

Contributes horizontal alignment to the shared Sheet cell visual pipeline.

methodregisterCommands(commands: SheetCommandBus): void

Registers the horizontal alignment command owned by this plugin.

methodregisterFormatTransfers(registry: SheetFormatTransferRegistry): void

Transfers only this owner's persisted formats.

methodregisterRangeMoves(registry: SheetRangeMoveRegistry): void
methodregisterRangeReorders(registry: SheetRangeReorderRegistry): void
methodregisterState(): { dataEngine: { dataView: { fieldKey: string; select: (state: unknown): AlignmentMatrix; viewKey: string }[] }; key: PluginKey; state: SheetAlignmentPluginState }

Registers alignment state for commands, projections, and collaboration.

methodrender(): Node<CellProperties>[]

Alignment data does not render scene nodes directly.

ReturnsAn empty node list.

Inherited members 25

Inherited from Plugin.

interfaceAlignmentMatrixData

Serialized sparse entries accepted by AlignmentMatrix.

propertydata: string[]

Explicit non-default alignment values.

propertyindices: number[]

CSR row pointers.

propertyindptr: number[]

CSR column indices.

interfaceSheetAlignmentPluginState

State owned by SheetAlignmentPlugin.

propertycellAlignments: AlignmentMatrix

Sparse matrix containing non-left or cell-type-derived horizontal alignment overrides.

interfaceSheetHorizontalAlignmentCommandDataSource
interface SheetHorizontalAlignmentCommandDataSource extends AlignmentCommandRangeDataSource

State access required by the horizontal alignment command.

Inherited members 2
  • getColumnCount
  • getRowCount
typeSheetSetRangeAlignmentInput
type SheetSetRangeAlignmentInput = SheetRangeInput & { alignment: SheetHorizontalAlignment } | { alignment: SheetHorizontalAlignment; ranges: readonly SheetRangeInput[] }

Public input for setting horizontal alignment in one or more ranges.

variableSetRangeAlignmentCommand
SetRangeAlignmentCommand: SheetCommandDefinition<SheetSetRangeAlignmentInput, SheetCommandResult>

Public command for setting horizontal alignment in a range.

variableSheetHorizontalAlignmentFieldKey
SheetHorizontalAlignmentFieldKey: "sheet.alignment.horizontal"

DataEngine field owned by SheetAlignmentPlugin.

functioncreateSetRangeAlignmentOperations
createSetRangeAlignmentOperations(input: SheetSetRangeAlignmentInput, dataSource: SheetHorizontalAlignmentReader): UpdateCellOTOperation<SheetHorizontalAlignment>[]

Creates sparse UpdateCell operations for horizontal alignment.

functionreadSheetCellAlignments
readSheetCellAlignments(dataEngine: DataEngine): AlignmentMatrix | null

Reads horizontal cell alignment published by SheetAlignmentPlugin.

functionregisterSheetHorizontalAlignmentCommand
registerSheetHorizontalAlignmentCommand(commands: SheetCommandBus, dataSource: SheetHorizontalAlignmentCommandDataSource): void

Registers the horizontal alignment command owned by SheetAlignmentPlugin.

functionassertSheetHorizontalAlignment
assertSheetHorizontalAlignment(value: unknown): value

Asserts that a value is one of the supported Sheet horizontal alignments.

functionisSheetHorizontalAlignment
isSheetHorizontalAlignment(value: unknown): value

Returns whether an unknown value is a supported Sheet horizontal alignment.

enumSheetHorizontalAlignment

Horizontal alignment values supported by the built-in Sheet alignment feature.

enum memberCenter: "center"
enum memberLeft: "left"
enum memberRight: "right"

Vertical alignment

classSheetVerticalAlignmentPlugin
class SheetVerticalAlignmentPlugin extends Plugin<unknown, CellProperties, SheetVerticalAlignmentPluginState>

Plugin that owns vertical cell alignment data, commands, and structural projections.

constructorSheetVerticalAlignmentPlugin(state: SheetVerticalAlignmentPluginState): SheetVerticalAlignmentPlugin

Constructs the vertical alignment plugin around a shared sparse matrix.

propertyreadonly documentState: PluginDocumentStateContribution<SheetVerticalAlignmentPluginState, SheetVerticalAlignmentPluginState>

SheetVerticalAlignmentPlugin owns its persisted export module.

propertyinterestedIn: string[]

Vertical alignment follows direct updates and all sheet structure changes.

propertyreadonly transactionOT: { collaborative: boolean; definition: TransactionOTDefinition<MatrixOTOperation<unknown>>; ownerId: string; relations: OTTransformRelation<MatrixOTOperation<unknown>, MatrixOTOperation<unknown>>[] }

Vertical alignment transactions share the registered MatrixOT algebra.

propertyreadonly warnOnDuplicateDepth: false

Alignment state is data-only and does not use render-depth diagnostics.

propertyreadonly documentState: PluginDocumentStateContribution<SheetVerticalAlignmentPluginState, SheetVerticalAlignmentPluginState>static

Document-state export contribution for persisted vertical alignments.

propertyreadonly pluginKey: PluginKeystatic

Stable plugin key shared by all vertical alignment plugin instances.

propertyreadonly symbol: symbolstatic

DI token for resolving the vertical alignment plugin.

methodapply(pluginState: SheetVerticalAlignmentPluginState, transaction: Transaction): SheetVerticalAlignmentPluginState | null

Applies direct vertical alignment and structural matrix operations.

methodgetPluginConfig(): null

Vertical alignment data has no render-time configuration.

methodregisterCellVisualReaders(registry: SheetCellVisualReaderRegistry, context: SheetCellVisualReaderRegistrationContext): void

Contributes vertical alignment to the shared Sheet cell visual pipeline.

methodregisterCommands(commands: SheetCommandBus): void

Registers the vertical alignment command owned by this plugin.

methodregisterFormatTransfers(registry: SheetFormatTransferRegistry): void

Transfers only this owner's persisted formats.

methodregisterRangeMoves(registry: SheetRangeMoveRegistry): void
methodregisterRangeReorders(registry: SheetRangeReorderRegistry): void
methodregisterState(): { dataEngine: { dataView: { fieldKey: string; select: (state: unknown): VerticalAlignmentMatrix; viewKey: string }[] }; key: PluginKey; state: SheetVerticalAlignmentPluginState }

Registers vertical alignment state for commands, projections, and collaboration.

methodrender(): Node<CellProperties>[]

Vertical alignment data does not render scene nodes directly.

Inherited members 25

Inherited from Plugin.

classVerticalAlignmentMatrix
class VerticalAlignmentMatrix extends CSRMatrix<string>

Sparse vertical-alignment matrix whose absent cells resolve to centered alignment.

constructorVerticalAlignmentMatrix(data?: VerticalAlignmentMatrixData, shape?: [number, number]): VerticalAlignmentMatrix

Creates a matrix and compacts explicit default-alignment entries.

propertyreadonly defaultAlignment: Centerstatic

Default vertical alignment returned for cells without an explicit override.

methodaddItem(row: number, col: number, value: string): this

Stores an explicit non-default override, or removes it for centered alignment.

Inherited members 34

Inherited from CSRMatrix.

interfaceSheetSetRangeVerticalAlignmentInput
interface SheetSetRangeVerticalAlignmentInput extends SheetRangeInput

Public input for setting vertical alignment in a range.

Inherited members 2

Inherited from SheetRangeInput.

interfaceSheetVerticalAlignmentCommandDataSource
interface SheetVerticalAlignmentCommandDataSource extends AlignmentCommandRangeDataSource

State access required by the vertical alignment command.

Inherited members 2
  • getColumnCount
  • getRowCount
interfaceSheetVerticalAlignmentPluginState

State owned by SheetVerticalAlignmentPlugin.

propertycellVerticalAlignments: VerticalAlignmentMatrix

Sparse matrix containing non-centered vertical alignment overrides.

interfaceVerticalAlignmentMatrixData

Serialized sparse entries accepted by VerticalAlignmentMatrix.

propertydata: string[]

Explicit non-default alignment values.

propertyindices: number[]

CSR row pointers.

propertyindptr: number[]

CSR column indices.

variableSetRangeVerticalAlignmentCommand
SetRangeVerticalAlignmentCommand: SheetCommandDefinition<SheetSetRangeVerticalAlignmentInput, SheetCommandResult>

Public command for setting vertical alignment in a range.

variableSheetVerticalAlignmentFieldKey
SheetVerticalAlignmentFieldKey: "sheet.alignment.vertical"

DataEngine field owned by SheetVerticalAlignmentPlugin.

functioncreateSetRangeVerticalAlignmentOperations
createSetRangeVerticalAlignmentOperations(input: SheetSetRangeVerticalAlignmentInput, dataSource: SheetVerticalAlignmentReader): UpdateCellOTOperation<SheetVerticalAlignment>[]

Creates sparse UpdateCell operations for vertical alignment.

functionreadSheetCellVerticalAlignments
readSheetCellVerticalAlignments(dataEngine: DataEngine): VerticalAlignmentMatrix | null

Reads vertical cell alignment published by SheetVerticalAlignmentPlugin.

functionregisterSheetVerticalAlignmentCommand
registerSheetVerticalAlignmentCommand(commands: SheetCommandBus, dataSource: SheetVerticalAlignmentCommandDataSource): void

Registers the vertical alignment command owned by SheetVerticalAlignmentPlugin.

functionassertSheetVerticalAlignment
assertSheetVerticalAlignment(value: unknown): value

Asserts that a value is one of the supported Sheet vertical alignments.

functionisSheetVerticalAlignment
isSheetVerticalAlignment(value: unknown): value

Returns whether an unknown value is a supported Sheet vertical alignment.

enumSheetVerticalAlignment

Vertical alignment values supported by the built-in Sheet alignment feature.

enum memberBottom: "bottom"
enum memberCenter: "center"
enum memberTop: "top"