← All packages

API reference

@searsuite/sear-plugin-alignment

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

28 exportsderived from source

classAlignmentMatrixsource ↗
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.

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

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

data: AlignmentMatrixData

Optional serialized CSR entries from persisted state.

shape: [number, number]

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

propertydefaultAlignmentstatic
readonly defaultAlignment: Left

Default horizontal alignment returned for cells without an explicit override.

methodaddItem
addItem(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: number

Zero-based row receiving the override.

col: number

Zero-based column receiving the override.

value: string

Requested horizontal alignment.

Inherited members 34

Inherited from CSRMatrix.

classSheetAlignmentPluginsource ↗
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.

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

Constructs the alignment plugin.

state: SheetAlignmentPluginState

Shared alignment state.

readCellData: (): SheetMatrix
propertydocumentState
readonly documentState: PluginDocumentStateContribution<SheetAlignmentPluginState, SheetAlignmentPluginState>

SheetAlignmentPlugin owns the persisted alignment export module.

propertyinterestedIn
interestedIn: string[]

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

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

Alignment transactions share the registered MatrixOT algebra.

propertywarnOnDuplicateDepth
readonly warnOnDuplicateDepth: false

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

propertydocumentStatestatic
readonly documentState: PluginDocumentStateContribution<SheetAlignmentPluginState, SheetAlignmentPluginState>

Document-state export contribution for persisted cell alignments.

propertypluginKeystatic
readonly pluginKey: PluginKey

Stable plugin key shared by all alignment plugin instances.

propertysymbolstatic
readonly symbol: symbol

DI token for resolving the alignment plugin.

methodapply
apply(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: SheetAlignmentPluginState

Current alignment state.

transaction: Transaction

Transaction containing direct or derived MatrixOT-compatible operations.

methodgetPluginConfig
getPluginConfig(): null

Alignment data has no render-time configuration.

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

Contributes horizontal alignment to the shared Sheet cell visual pipeline.

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

Registers the horizontal alignment command owned by this plugin.

commands: SheetCommandBus
methodregisterFormatTransfers
registerFormatTransfers(registry: SheetFormatTransferRegistry): void

Transfers only this owner's persisted formats.

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

Registers alignment state for commands, projections, and collaboration.

methodrender
render(): Node<CellProperties>[]

Alignment data does not render scene nodes directly.

ReturnsAn empty node list.

Inherited members 26

Inherited from Plugin.

classSheetVerticalAlignmentPluginsource ↗
class SheetVerticalAlignmentPlugin extends Plugin<unknown, CellProperties, SheetVerticalAlignmentPluginState>

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

constructorconstructor
SheetVerticalAlignmentPlugin(state: SheetVerticalAlignmentPluginState): SheetVerticalAlignmentPlugin

Constructs the vertical alignment plugin around a shared sparse matrix.

state: SheetVerticalAlignmentPluginState
propertydocumentState
readonly documentState: PluginDocumentStateContribution<SheetVerticalAlignmentPluginState, SheetVerticalAlignmentPluginState>

SheetVerticalAlignmentPlugin owns its persisted export module.

propertyinterestedIn
interestedIn: string[]

Vertical alignment follows direct updates and all sheet structure changes.

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

Vertical alignment transactions share the registered MatrixOT algebra.

propertywarnOnDuplicateDepth
readonly warnOnDuplicateDepth: false

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

propertydocumentStatestatic
readonly documentState: PluginDocumentStateContribution<SheetVerticalAlignmentPluginState, SheetVerticalAlignmentPluginState>

Document-state export contribution for persisted vertical alignments.

propertypluginKeystatic
readonly pluginKey: PluginKey

Stable plugin key shared by all vertical alignment plugin instances.

propertysymbolstatic
readonly symbol: symbol

DI token for resolving the vertical alignment plugin.

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

Applies direct vertical alignment and structural matrix operations.

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

Vertical alignment data has no render-time configuration.

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

Contributes vertical alignment to the shared Sheet cell visual pipeline.

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

Registers the vertical alignment command owned by this plugin.

commands: SheetCommandBus
methodregisterFormatTransfers
registerFormatTransfers(registry: SheetFormatTransferRegistry): void

Transfers only this owner's persisted formats.

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

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

methodrender
render(): Node<CellProperties>[]

Vertical alignment data does not render scene nodes directly.

Inherited members 26

Inherited from Plugin.

classVerticalAlignmentMatrixsource ↗
class VerticalAlignmentMatrix extends CSRMatrix<string>

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

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

Creates a matrix and compacts explicit default-alignment entries.

data: VerticalAlignmentMatrixData
shape: [number, number]
propertydefaultAlignmentstatic
readonly defaultAlignment: Center

Default vertical alignment returned for cells without an explicit override.

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

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

row: number
col: number
value: string
Inherited members 34

Inherited from CSRMatrix.

interfaceAlignmentMatrixDatasource ↗
interface AlignmentMatrixData

Serialized sparse entries accepted by AlignmentMatrix.

propertydata
data: string[]

Explicit non-default alignment values.

propertyindices
indices: number[]

CSR row pointers.

propertyindptr
indptr: number[]

CSR column indices.

interfaceSheetAlignmentPluginStatesource ↗
interface SheetAlignmentPluginState

State owned by SheetAlignmentPlugin.

propertycellAlignments
cellAlignments: AlignmentMatrix

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

interfaceSheetHorizontalAlignmentCommandDataSourcesource ↗
interface SheetHorizontalAlignmentCommandDataSource extends AlignmentCommandRangeDataSource

State access required by the horizontal alignment command.

propertytarget
readonly target: PluginKey
methodreadCellAlignment
readCellAlignment(row: number, column: number): SheetHorizontalAlignment | null
row: number
column: number
Inherited members 2
  • getColumnCount
  • getRowCount
interfaceSheetSetRangeVerticalAlignmentInputsource ↗
interface SheetSetRangeVerticalAlignmentInput extends SheetRangeInput

Public input for setting vertical alignment in a range.

propertyverticalAlignment
readonly verticalAlignment: SheetVerticalAlignment
Inherited members 2

Inherited from SheetRangeInput.

interfaceSheetVerticalAlignmentCommandDataSourcesource ↗
interface SheetVerticalAlignmentCommandDataSource extends AlignmentCommandRangeDataSource

State access required by the vertical alignment command.

propertytarget
readonly target: PluginKey
methodreadCellVerticalAlignment
readCellVerticalAlignment(row: number, column: number): SheetVerticalAlignment | null
row: number
column: number
Inherited members 2
  • getColumnCount
  • getRowCount
interfaceSheetVerticalAlignmentPluginStatesource ↗
interface SheetVerticalAlignmentPluginState

State owned by SheetVerticalAlignmentPlugin.

propertycellVerticalAlignments
cellVerticalAlignments: VerticalAlignmentMatrix

Sparse matrix containing non-centered vertical alignment overrides.

interfaceVerticalAlignmentMatrixDatasource ↗
interface VerticalAlignmentMatrixData

Serialized sparse entries accepted by VerticalAlignmentMatrix.

propertydata
data: string[]

Explicit non-default alignment values.

propertyindices
indices: number[]

CSR row pointers.

propertyindptr
indptr: number[]

CSR column indices.

typeSheetSetRangeAlignmentInputsource ↗
type SheetSetRangeAlignmentInput = SheetRangeInput & { alignment: SheetHorizontalAlignment } | { alignment: SheetHorizontalAlignment; ranges: readonly SheetRangeInput[] }

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

variableSetRangeAlignmentCommandsource ↗
SetRangeAlignmentCommand: SheetCommandDefinition<SheetSetRangeAlignmentInput, SheetCommandResult>

Public command for setting horizontal alignment in a range.

variableSetRangeVerticalAlignmentCommandsource ↗
SetRangeVerticalAlignmentCommand: SheetCommandDefinition<SheetSetRangeVerticalAlignmentInput, SheetCommandResult>

Public command for setting vertical alignment in a range.

variableSheetHorizontalAlignmentFieldKeysource ↗
SheetHorizontalAlignmentFieldKey: "sheet.alignment.horizontal"

DataEngine field owned by SheetAlignmentPlugin.

variableSheetVerticalAlignmentFieldKeysource ↗
SheetVerticalAlignmentFieldKey: "sheet.alignment.vertical"

DataEngine field owned by SheetVerticalAlignmentPlugin.

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

Creates sparse UpdateCell operations for horizontal alignment.

input: SheetSetRangeAlignmentInput
dataSource: SheetHorizontalAlignmentReader
functioncreateSetRangeVerticalAlignmentOperationssource ↗
createSetRangeVerticalAlignmentOperations(input: SheetSetRangeVerticalAlignmentInput, dataSource: SheetVerticalAlignmentReader): UpdateCellOTOperation<SheetVerticalAlignment>[]

Creates sparse UpdateCell operations for vertical alignment.

input: SheetSetRangeVerticalAlignmentInput
dataSource: SheetVerticalAlignmentReader
functionreadSheetCellAlignmentssource ↗
readSheetCellAlignments(dataEngine: DataEngine): AlignmentMatrix | null

Reads horizontal cell alignment published by SheetAlignmentPlugin.

dataEngine: DataEngine
functionreadSheetCellVerticalAlignmentssource ↗
readSheetCellVerticalAlignments(dataEngine: DataEngine): VerticalAlignmentMatrix | null

Reads vertical cell alignment published by SheetVerticalAlignmentPlugin.

dataEngine: DataEngine
functionregisterSheetHorizontalAlignmentCommandsource ↗
registerSheetHorizontalAlignmentCommand(commands: SheetCommandBus, dataSource: SheetHorizontalAlignmentCommandDataSource): void

Registers the horizontal alignment command owned by SheetAlignmentPlugin.

commands: SheetCommandBus
dataSource: SheetHorizontalAlignmentCommandDataSource
functionregisterSheetVerticalAlignmentCommandsource ↗
registerSheetVerticalAlignmentCommand(commands: SheetCommandBus, dataSource: SheetVerticalAlignmentCommandDataSource): void

Registers the vertical alignment command owned by SheetVerticalAlignmentPlugin.

commands: SheetCommandBus
dataSource: SheetVerticalAlignmentCommandDataSource
functionassertSheetHorizontalAlignmentsource ↗
assertSheetHorizontalAlignment(value: unknown): value

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

value: unknown
functionassertSheetVerticalAlignmentsource ↗
assertSheetVerticalAlignment(value: unknown): value

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

value: unknown
functionisSheetHorizontalAlignmentsource ↗
isSheetHorizontalAlignment(value: unknown): value

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

value: unknown
functionisSheetVerticalAlignmentsource ↗
isSheetVerticalAlignment(value: unknown): value

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

value: unknown
enumSheetHorizontalAlignmentsource ↗
enum SheetHorizontalAlignment

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

enum memberCenter
Center: "center"
enum memberLeft
Left: "left"
enum memberRight
Right: "right"
enumSheetVerticalAlignmentsource ↗
enum SheetVerticalAlignment

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

enum memberBottom
Bottom: "bottom"
enum memberCenter
Center: "center"
enum memberTop
Top: "top"