← All packages

API reference

@searsuite/sear-render

Public rendering facade that composes contexts, nodes, strategies, and registries.

11 exportsderived from source

classSheetCellMergeRendersource ↗
class SheetCellMergeRender extends Plugin<SearCoreSheet, CellProperties, Record<string, never>>

Renders merged ranges owned by SheetCellMergePlugin.

constructorconstructor
SheetCellMergeRender(cellVisualReaders: SheetCellVisualReaderRegistry): SheetCellMergeRender
cellVisualReaders: SheetCellVisualReaderRegistry
propertydepth
readonly depth: 1

Draw and event ordering hint; lower values run earlier.

propertyinterestedIn
readonly 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
propertypluginKeystatic
readonly pluginKey: PluginKey
propertysymbolstatic
readonly symbol: typeof symbol
methodapply
apply(): Record<string, never>

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

methodgetPluginConfig
getPluginConfig(searCore: SearCoreSheet): { defaultBorderColor: string }

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

searCore: SearCoreSheet
methodonMouseDown
onMouseDown(_searCore: SearCoreSheet, _event: EventWithOffsetAndTarget<CellProperties>): void

Handles the start of a pointer press sequence.

_searCore: SearCoreSheet
_event: EventWithOffsetAndTarget<CellProperties>
methodonMouseMove
onMouseMove(_searCore: SearCoreSheet, _event: EventWithOffsetAndTarget<CellProperties>): void

Handles pointer movement over the host surface.

_searCore: SearCoreSheet
_event: EventWithOffsetAndTarget<CellProperties>
methodonMouseUp
onMouseUp(_searCore: SearCoreSheet, _event: EventWithOffsetAndTarget<CellProperties>): void

Handles the end of a pointer press sequence.

_searCore: SearCoreSheet
_event: EventWithOffsetAndTarget<CellProperties>
methodregisterConfig
registerConfig(): { config: ConfigUnit<{ defaultBorderColor: string }>; key: PluginKey }[]

Registers default configuration values owned by this plugin.

methodregisterState
registerState(): { key: PluginKey; state: Record<string, never> }

Registers one or more plugin-owned state records with the host manager.

methodrender
render(searCore: SearCoreSheet, offset?: { x: number; y: number }): Node<CellProperties>[]

Produces scene nodes owned by this plugin for the current core state.

searCore: SearCoreSheet
offset: { x: number; y: number }
Inherited members 24

Inherited from Plugin.

classSheetColumnLabelPluginsource ↗
class SheetColumnLabelPlugin extends Plugin<SearCoreSheet, CellProperties, ISheetColumnLabel>

Renders sticky column header cells for the visible viewport range.

constructorconstructor
SheetColumnLabelPlugin(): SheetColumnLabelPlugin

Constructs the column header plugin.

propertydefaultConfigstatic
readonly defaultConfig: { defaultBackgroundColor: string; defaultBorderColor: string; defaultHeight: number }

Default visual configuration for column headers.

propertysymbolstatic
readonly symbol: symbol

DI token for resolving the column header plugin.

methodapply
apply(operations: Operation[]): ISheetColumnLabel

Returns unchanged plugin state for every transaction.

operations: Operation[]
methodgetPluginConfig
getPluginConfig(searCore: SearCoreSheet): { defaultBackgroundColor: string; defaultBorderColor: string; defaultHeight: number }

Reads the column header render configuration from ConfigEngine.

searCore: SearCoreSheet
methodinitialize
initialize(): void

Initializes column header runtime state.

methodonResize
onResize(): void

Column header dimensions are recomputed during render after resize.

methodonScroll
onScroll(_scrollManagerState: ScrollManagerState): void

Column header positions are recomputed during render from scroll state.

_scrollManagerState: ScrollManagerState
methodregisterConfig
registerConfig(): { config: ConfigUnit<{ defaultBackgroundColor: string; defaultBorderColor: string; defaultHeight: number }>; key: PluginKey }[]

Registers default column header configuration.

methodregisterState
registerState(): { key: PluginKey; state: ISheetColumnLabel }

Registers the stateless column header plugin with PluginManager.

methodrender
render(searCore: SearCoreSheet, offset?: { x: number; y: number }): Node<CellProperties>[]

Renders visible column header cells.

ReturnsRender nodes for visible column headers.

searCore: SearCoreSheet

Sheet core containing data and render services.

offset: { x: number; y: number }

World offset applied by sticky rendering.

Inherited members 27

Inherited from Plugin.

classSheetCornerPluginsource ↗
class SheetCornerPlugin extends Plugin<SearCoreSheet, CellProperties, ISheetCorner>

Renders the sticky sheet corner cell where row and column headers meet.

constructorconstructor
SheetCornerPlugin(): SheetCornerPlugin

Constructs the sheet corner plugin.

propertysymbolstatic
readonly symbol: symbol

DI token for resolving the sheet corner plugin.

methodapply
apply(operations: Operation[]): ISheetCorner

Returns unchanged plugin state for every transaction.

operations: Operation[]
methodgetPluginConfig
getPluginConfig(searCore: SearCoreSheet): { backgroundColor: string; borderColor: string; height: number; width: number }

Reads the sheet corner render configuration from ConfigEngine.

searCore: SearCoreSheet
methodinitialize
initialize(): void

Initializes sheet corner runtime state.

methodonResize
onResize(): void

Sheet corner dimensions are recomputed during render after resize.

methodonScroll
onScroll(_scrollManagerState: ScrollManagerState): void

Sheet corner position is recomputed during render from scroll state.

_scrollManagerState: ScrollManagerState
methodregisterConfig
registerConfig(): { config: ConfigUnit<{ backgroundColor: string; borderColor: string; height: number; width: number }>; key: PluginKey }[]

Registers default sheet corner configuration.

methodregisterState
registerState(): { key: PluginKey; state: ISheetCorner }

Registers the stateless sheet corner plugin with PluginManager.

methodrender
render(searCore: SearCoreSheet, offset?: { x: number; y: number }): Node<CellProperties>[]

Renders the sheet corner cell.

ReturnsRender nodes for the sheet corner.

searCore: SearCoreSheet

Sheet core containing render services.

offset: { x: number; y: number }

World offset applied by sticky rendering.

Inherited members 27

Inherited from Plugin.

classSheetGridPluginsource ↗
class SheetGridPlugin extends Plugin<SearCoreSheet, CellProperties, SheetGridState>

Composite plugin that assembles sheet chrome, body grid, and merged-cell nodes.

constructorconstructor
SheetGridPlugin(sheetCornerPlugin: SheetCornerPlugin, sheetColumnLabelPlugin: SheetColumnLabelPlugin, sheetRowNumberPlugin: SheetRowNumberPlugin, sheetGridRender: SheetGridRender): SheetGridPlugin

Constructs the grid plugin from its child sheet render plugins.

sheetCornerPlugin: SheetCornerPlugin
sheetColumnLabelPlugin: SheetColumnLabelPlugin
sheetRowNumberPlugin: SheetRowNumberPlugin
sheetGridRender: SheetGridRender
propertyinterestedIn
interestedIn: string[]

Rebuilds grid geometry when sheet data or dimensions change.

propertysymbolstatic
readonly symbol: symbol

DI token for resolving the composite sheet grid plugin.

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

Keeps composite state unchanged when data transactions cause a re-render.

pluginState: SheetGridState
transaction: Transaction
methodgetPluginConfig
getPluginConfig(searCore: SearCoreSheet): null

Composite grid configuration is delegated to child render plugins.

searCore: SearCoreSheet
methodonDblClick
onDblClick(earCore: SearCoreSheet, event: EventWithOffsetAndTarget<CellProperties>): void

Forwards double-click handling to the body grid renderer.

earCore: SearCoreSheet
event: EventWithOffsetAndTarget<CellProperties>
methodregisterConfig
registerConfig(): { config: ConfigUnit<{ backgroundColor: string; borderColor: string; height: number; width: number }>; key: PluginKey }[]

Registers configuration contributed by every child sheet render plugin.

methodregisterState
registerState(): { key: PluginKey; state: SheetGridState }

Registers only the composite grid state; merged ranges have their own plugin owner.

methodrender
render(searCore: SearCoreSheet): Node<CellProperties>[]

Renders sheet chrome and body layers in the order expected by the scene graph.

ReturnsRender nodes for corner, headers, merged cells, and grid cells.

searCore: SearCoreSheet

Sheet core containing data and render services.

Inherited members 27

Inherited from Plugin.

classSheetGridRendersource ↗
class SheetGridRender extends Plugin<SearCoreSheet, CellProperties, ISheetGridRender>

Renders visible sheet body cells.

constructorconstructor
SheetGridRender(cellVisualReaders: SheetCellVisualReaderRegistry): SheetGridRender

Constructs the body grid renderer.

cellVisualReaders: SheetCellVisualReaderRegistry
propertysymbolstatic
readonly symbol: symbol

DI token for resolving the body grid renderer.

methodapply
apply(operations: Operation[]): ISheetGridRender

Returns unchanged renderer state for every operation list.

operations: Operation[]
methodgetPluginConfig
getPluginConfig(searCore: SearCoreSheet): { defaultBorderColor: string }

Reads the body grid render configuration from ConfigEngine.

searCore: SearCoreSheet
methodonDblClick
onDblClick(searCore: SearCoreSheet, event: EventWithOffsetAndTarget<CellProperties>): void

Handles double-click interactions on grid cells.

searCore: SearCoreSheet
event: EventWithOffsetAndTarget<CellProperties>
methodregisterConfig
registerConfig(): { config: ConfigUnit<{ defaultBorderColor: string }>; key: PluginKey }[]

Registers default body grid configuration.

methodregisterState
registerState(): { key: PluginKey; state: ISheetGridRender }

Registers the stateless body grid renderer with PluginManager.

methodrender
render(searCore: SearCoreSheet, offset?: { x: number; y: number }): Node<CellProperties>[]

Renders visible grid cells, skipping cells covered by merged ranges.

ReturnsRender nodes for visible body cells.

searCore: SearCoreSheet

Sheet core containing data and render services.

offset: { x: number; y: number }

Offset after accounting for row/column headers.

Inherited members 28

Inherited from Plugin.

classSheetRowNumberPluginsource ↗
class SheetRowNumberPlugin extends Plugin<SearCoreSheet, CellProperties, ISheetRowNumber>

Renders sticky row header cells for the visible viewport range.

constructorconstructor
SheetRowNumberPlugin(): SheetRowNumberPlugin

Constructs the row header plugin.

propertydefaultConfigstatic
readonly defaultConfig: { defaultBackgroundColor: string; defaultBorderColor: string; defaultWidth: number }

Default visual configuration for row headers.

propertysymbolstatic
readonly symbol: symbol

DI token for resolving the row header plugin.

methodapply
apply(operations: Operation[]): ISheetRowNumber

Returns unchanged plugin state for every transaction.

operations: Operation[]
methodgetPluginConfig
getPluginConfig(searCore: SearCoreSheet): { defaultBackgroundColor: string; defaultBorderColor: string; defaultWidth: number }

Reads the row header render configuration from ConfigEngine.

searCore: SearCoreSheet
methodinitialize
initialize(): void

Initializes row header runtime state.

methodonResize
onResize(): void

Row header dimensions are recomputed during render after resize.

methodonScroll
onScroll(_scrollManagerState: ScrollManagerState): void

Row header positions are recomputed during render from scroll state.

_scrollManagerState: ScrollManagerState
methodregisterConfig
registerConfig(): { config: ConfigUnit<{ defaultBackgroundColor: string; defaultBorderColor: string; defaultWidth: number }>; key: PluginKey }[]

Registers default row header configuration.

methodregisterState
registerState(): { key: PluginKey; state: ISheetRowNumber }

Registers the stateless row header plugin with PluginManager.

methodrender
render(searCore: SearCoreSheet, offset?: { x: number; y: number }): Node<CellProperties>[]

Renders visible row header cells.

ReturnsRender nodes for visible row headers.

searCore: SearCoreSheet

Sheet core containing data and render services.

offset: { x: number; y: number }

World offset applied by sticky rendering.

Inherited members 27

Inherited from Plugin.

interfaceSheetRangePositionContextsource ↗
interface SheetRangePositionContext

Explicit layout inputs required to convert a sheet range to canvas coordinates.

propertycolumnSizes
columnSizes: DimensionsCSRMatrix
propertyoffsetX
offsetX: number
propertyoffsetY
offsetY: number
propertyrowSizes
rowSizes: DimensionsCSRMatrix
interfaceViewportRangesource ↗
interface ViewportRange

Computed visible row/column range within the current viewport. Used as a cross-cutting concern by render plugins to avoid iterating the entire sheet when only a small portion is visible.

Example: 10,000 rows × 100 cols → only ~40 rows × ~20 cols are visible at once. Computing the range costs O(log n) via binary search in DimensionsCSRMatrix, then the render loop iterates only the visible slice — O(visible) instead of O(total).

propertyendCol
endCol: number
propertyendRow
endRow: number
propertystartCol
startCol: number
propertystartRow
startRow: number
functionactiveFixedRowOffsetssource ↗
activeFixedRowOffsets(fixedRows: FixedRowMatrix | null, rowSizes: DimensionsCSRMatrix, scrollY: number, frozenRows: number, offsetY: number): Map<number, number>

Fixed rows join the top stack only after the scrolling viewport passes their original position.

fixedRows: FixedRowMatrix | null
rowSizes: DimensionsCSRMatrix
scrollY: number
frozenRows: number
offsetY: number
functioncomputeViewportRangesource ↗
computeViewportRange(scrollManager: ScrollManager, rowSizes: DimensionsCSRMatrix, columnSizes: DimensionsCSRMatrix, offset?: { x: number; y: number }): ViewportRange

Compute the visible row/column range from the current scroll state and the dimension matrices (row heights / column widths).

Includes a 1-cell buffer on each side to avoid pop-in artifacts at the edges when scrolling quickly.

scrollManager: ScrollManager

The scroll manager that holds viewport + scroll position

rowSizes: DimensionsCSRMatrix

Row dimension matrix (heights with cumulative boundary lookups)

columnSizes: DimensionsCSRMatrix

Column dimension matrix (widths with cumulative boundary lookups)

offset: { x: number; y: number }

Render offset (e.g. frozen header offsets), added to viewport origin

functiongetSheetRangePositionRectsource ↗
getSheetRangePositionRect(start: Point, end: Point, context: SheetRangePositionContext): PositionRect<undefined> | null

Converts an inclusive sheet cell range into a world-space canvas rectangle. Returns null when the range is invalid or outside the current sheet bounds.

start: Point
end: Point
context: SheetRangePositionContext