Core Types
Core Types
Section titled “Core Types”All types are exported from @witqq/spreadsheet.
import type { CellValue, CellData, CellStyle, ColumnDef, CellRange } from '@witqq/spreadsheet';Cell Types
Section titled “Cell Types”CellValue
Section titled “CellValue”type CellValue = string | number | boolean | Date | null;CellData
Section titled “CellData”interface CellData { readonly value: CellValue; readonly displayValue?: string; // Override default formatting readonly formula?: string; // Formula expression (e.g. "=SUM(A1:A10)") readonly style?: CellStyleRef; // Reference to shared style readonly type?: CellType; // Cell type for rendering readonly metadata?: CellMetadata; // Status, links, comments readonly custom?: Record<string, unknown>; // Extensible user data}CellMetadata
Section titled “CellMetadata”interface CellMetadata { readonly status?: 'changed' | 'error' | 'saving' | 'saved'; readonly errorMessage?: string; readonly link?: { url: string; label?: string }; readonly comment?: string;}CellType
Section titled “CellType”type CellType = | 'string' | 'number' | 'boolean' | 'date' | 'datetime' | 'select' | 'dynamicSelect' | 'formula' | 'link' | 'image' | 'progressBar' | 'rating' | 'badge' | 'custom';Style Types
Section titled “Style Types”CellStyle
Section titled “CellStyle”interface CellStyle { readonly bgColor?: string; readonly textColor?: string; readonly fontFamily?: string; readonly fontSize?: number; readonly fontWeight?: 'normal' | 'bold'; readonly fontStyle?: 'normal' | 'italic'; readonly textAlign?: 'left' | 'center' | 'right'; readonly verticalAlign?: 'top' | 'middle' | 'bottom'; readonly borderTop?: BorderStyle; readonly borderRight?: BorderStyle; readonly borderBottom?: BorderStyle; readonly borderLeft?: BorderStyle; readonly numberFormat?: string; readonly textWrap?: boolean; readonly indent?: number;}BorderStyle
Section titled “BorderStyle”interface BorderStyle { readonly width: number; readonly color: string; readonly style: 'solid' | 'dashed' | 'dotted';}CellStyleRef
Section titled “CellStyleRef”interface CellStyleRef { readonly ref: string; // Unique key in StylePool readonly style: CellStyle; // Resolved style object}Geometry Types
Section titled “Geometry Types”CellAddress
Section titled “CellAddress”interface CellAddress { readonly row: number; readonly col: number;}CellRange
Section titled “CellRange”interface CellRange { readonly startRow: number; readonly startCol: number; readonly endRow: number; readonly endCol: number;}CellRect
Section titled “CellRect”Pixel-space rectangle for a cell on canvas:
interface CellRect { readonly x: number; readonly y: number; readonly width: number; readonly height: number;}Column Types
Section titled “Column Types”ColumnDef
Section titled “ColumnDef”interface ColumnDef { readonly key: string; // Data binding key readonly title: string; // Header display text readonly width: number; // Width in pixels readonly minWidth?: number; // Minimum resize width readonly maxWidth?: number; // Maximum resize width readonly type?: CellType; // Cell type for rendering readonly frozen?: boolean; // Pin to frozen pane readonly sortable?: boolean; // Enable header click sorting readonly filterable?: boolean; // Enable filter panel readonly editable?: boolean; // Allow inline editing readonly resizable?: boolean; // Allow drag-to-resize readonly hidden?: boolean; // Hide from display and print readonly wrapText?: boolean; // Enable text wrapping readonly validation?: SpreadsheetValidationRule[]; // Cell validation rules}Selection Types
Section titled “Selection Types”Selection
Section titled “Selection”interface Selection { readonly type: SelectionType; readonly ranges: readonly CellRange[]; readonly activeCell: CellAddress; readonly anchorCell: CellAddress;}
type SelectionType = 'cell' | 'range' | 'row' | 'column' | 'all';Merge Types
Section titled “Merge Types”MergedRegion
Section titled “MergedRegion”interface MergedRegion { readonly startRow: number; readonly startCol: number; readonly endRow: number; // inclusive readonly endCol: number; // inclusive}Validation Types
Section titled “Validation Types”ValidationRule
Section titled “ValidationRule”interface ValidationRule { readonly type: string; readonly message?: string; readonly severity?: 'error' | 'warning' | 'info';}ValidationResult
Section titled “ValidationResult”interface ValidationResult { readonly valid: boolean; readonly message?: string; readonly severity?: 'error' | 'warning' | 'info';}SpreadsheetValidationRule
Section titled “SpreadsheetValidationRule”type SpreadsheetValidationRule = RequiredRule | RangeRule | RegexRule | CustomRule;Union of all built-in validation rule types. Used in ColumnDef.validation and the validation engine API.
Theme Types
Section titled “Theme Types”SpreadsheetTheme
Section titled “SpreadsheetTheme”Theme controls all visual dimensions and colors. See Themes & Styling for details.
interface SpreadsheetTheme { name: string; colors: { background: string; cellText: string; cellBorder: string; headerBackground: string; headerText: string; selectionFill: string; selectionBorder: string; // ... additional color tokens }; fonts: { cell: string; header: string; cellSize: number; headerSize: number; }; dimensions: { rowHeight: number; headerHeight: number; cellPadding: number; rowNumberWidth: number; minColumnWidth: number; scrollbarWidth: number; borderWidth: number; }; borders: { gridLineWidth: number; selectionWidth: number; activeCellWidth: number; frozenPaneWidth: number; };}Built-in themes: lightTheme, darkTheme.
Configuration Types
Section titled “Configuration Types”Options objects passed when constructing core subsystems.
CommandManagerConfig
Section titled “CommandManagerConfig”interface CommandManagerConfig { historyLimit?: number; onAfterExecute?: CommandCallback; onAfterUndo?: CommandCallback; onAfterRedo?: CommandCallback;}Undo/redo stack options and lifecycle callbacks.
ClipboardManagerConfig
Section titled “ClipboardManagerConfig”interface ClipboardManagerConfig { cellStore: CellStore; dataView: DataView; selectionManager: SelectionManager; commandManager: CommandManager; eventBus: EventBus; isEditing: () => boolean; onDataChange: () => void;}Dependencies for copy/cut/paste with TSV and HTML table format support.
FilterEngineConfig
Section titled “FilterEngineConfig”interface FilterEngineConfig { cellStore: CellStore; totalRowCount: number;}Cell store and row count for evaluating filter conditions.
SortEngineConfig
Section titled “SortEngineConfig”interface SortEngineConfig { cellStore: CellStore; totalRowCount: number;}Cell store and row count for multi-column stable sorting.
SelectionManagerConfig
Section titled “SelectionManagerConfig”interface SelectionManagerConfig { rowCount: number; colCount: number; onChange?: (selection: Selection, previousSelection: Selection) => void;}Grid dimensions and optional selection change callback.
InlineEditorConfig
Section titled “InlineEditorConfig”interface InlineEditorConfig { container: HTMLElement; scrollContainer: HTMLElement; layoutEngine: LayoutEngine; scrollManager: ScrollManager; cellStore: CellStore; dataView: DataView; theme: SpreadsheetTheme; onCommit: (row: number, col: number, oldValue: CellValue, newValue: CellValue) => void; onClose: (reason: EditorCloseReason) => void; frozenRows?: number; frozenColumns?: number;}Textarea overlay editor positioning, commit/close callbacks, and frozen pane offsets.
KeyboardNavigatorConfig
Section titled “KeyboardNavigatorConfig”interface KeyboardNavigatorConfig { selectionManager: SelectionManager; getVisibleRowCount: () => number;}Selection manager and viewport row count for PageUp/PageDown navigation.
LayoutEngineConfig
Section titled “LayoutEngineConfig”interface LayoutEngineConfig { columns: ColumnDef[]; rowCount: number; rowHeight: number; headerHeight: number; rowNumberWidth: number; rowStore?: RowStore;}Column definitions and dimension constants for cumulative position arrays.
ViewportConfig
Section titled “ViewportConfig”interface ViewportConfig { rowBuffer?: number; // Default: 10 colBuffer?: number; // Default: 5}Extra rows/columns to pre-render outside the visible area.
ScrollManagerConfig
Section titled “ScrollManagerConfig”interface ScrollManagerConfig { container: HTMLElement; totalWidth: number; totalHeight: number; onScroll: (scrollX: number, scrollY: number) => void;}Scroll container setup and scroll position change callback.
ValidationEngineConfig
Section titled “ValidationEngineConfig”interface ValidationEngineConfig { cellStore: CellStore; eventBus: EventBus;}Cell store and event bus for validation rule evaluation and error events.
AutofillManagerConfig
Section titled “AutofillManagerConfig”interface AutofillManagerConfig { cellStore: CellStore; dataView: DataView; selectionManager: SelectionManager; layoutEngine: LayoutEngine; scrollManager: ScrollManager; commandManager: CommandManager; eventBus: EventBus; dirtyTracker: DirtyTracker; renderScheduler: RenderScheduler; container: HTMLElement; rowCount: number; colCount: number; mergeManager?: MergeManager;}Dependencies for drag-to-fill handle, pattern detection, and merge-aware autofill.
ColumnResizeManagerConfig
Section titled “ColumnResizeManagerConfig”interface ColumnResizeManagerConfig { layoutEngine: LayoutEngine; gridGeometry: GridGeometry; scrollManager: ScrollManager; commandManager: CommandManager; eventBus: EventBus; columns: ColumnDef[]; container: HTMLElement; onResize: () => void;}Dependencies for header border drag-to-resize with undo support.
RowResizeManagerConfig
Section titled “RowResizeManagerConfig”interface RowResizeManagerConfig { layoutEngine: LayoutEngine; scrollManager: ScrollManager; commandManager: CommandManager; eventBus: EventBus; container: HTMLElement; onResize: () => void;}Dependencies for row-number border drag-to-resize with undo support.
ContextMenuManagerConfig
Section titled “ContextMenuManagerConfig”interface ContextMenuManagerConfig { container: HTMLElement; engine: SpreadsheetEngine; eventBus: EventBus; theme: SpreadsheetTheme;}Container, engine reference, and theme for the right-click context menu overlay.
AriaManagerConfig
Section titled “AriaManagerConfig”interface AriaManagerConfig { container: HTMLElement; scrollContainer: HTMLElement; eventBus: EventBus; cellStore: CellStore; dataView: DataView; columns: ColumnDef[]; rowCount: number;}DOM elements and data sources for WCAG 2.1 AA role=grid and aria-live announcements.
PrintManagerConfig
Section titled “PrintManagerConfig”interface PrintManagerConfig { container: HTMLElement; cellStore: CellStore; dataView: DataView; columns: ColumnDef[]; rowStore: RowStore; theme: SpreadsheetTheme; maxPrintRows?: number; // Default: 10000}Data sources and row cap for @media print DOM table generation.
CanvasManagerConfig
Section titled “CanvasManagerConfig”interface CanvasManagerConfig { container: HTMLElement; dpr?: number; // Defaults to window.devicePixelRatio}Container element and optional device pixel ratio override for canvas setup.
GridGeometryConfig
Section titled “GridGeometryConfig”interface GridGeometryConfig { columns: ColumnDef[]; theme: SpreadsheetTheme; showRowNumbers: boolean; rowPositions?: Float64Array; rowHeights?: Float64Array;}Column definitions, theme, and shared layout arrays for coordinate computation.
EventTranslatorConfig
Section titled “EventTranslatorConfig”interface EventTranslatorConfig { scrollContainer: HTMLElement; layoutEngine: LayoutEngine; scrollManager: ScrollManager; eventBus: EventBus; cellStore: CellStore; dataView: DataView; columns: ColumnDef[]; rowGroupManager?: RowGroupManager;}DOM-to-cell hit-testing pipeline dependencies and optional row group toggle detection.
Rendering & Layout Types
Section titled “Rendering & Layout Types”Types used by the render pipeline, viewport management, and dirty tracking.
GridRenderConfig
Section titled “GridRenderConfig”interface GridRenderConfig { columns: ColumnDef[]; cellStore: CellStore; dataView: DataView; rowCount: number; theme: SpreadsheetTheme; showRowNumbers: boolean; showGridLines: boolean; selectionManager?: SelectionManager; cellTypeRegistry?: CellTypeRegistry; rowPositions?: Float64Array; rowHeights?: Float64Array;}Top-level configuration for creating the GridRenderer render pipeline.
RenderMode
Section titled “RenderMode”type RenderMode = 'full' | 'light' | 'placeholder';Rendering fidelity level. Currently always 'full'. The union type exists for future optimization.
PaneRegion
Section titled “PaneRegion”type PaneRegion = 'corner' | 'frozenRow' | 'frozenCol' | 'main' | 'full';Identifies which frozen pane region a render pass targets.
ViewportRange
Section titled “ViewportRange”interface ViewportRange { readonly startRow: number; readonly endRow: number; readonly startCol: number; readonly endCol: number; readonly visibleRowCount: number; readonly visibleColCount: number;}Inclusive row/column range of visible cells including buffer zone.
FrozenViewportRanges
Section titled “FrozenViewportRanges”interface FrozenViewportRanges { corner: ViewportRange; frozenRow: ViewportRange; frozenCol: ViewportRange; main: ViewportRange;}Viewport ranges for all four frozen pane regions.
DirtyRegion
Section titled “DirtyRegion”type DirtyRegion = 'full' | 'viewport-change' | 'cell-update';Invalidation scope — full redraws everything, cell-update redraws only changed cells.
DirtyCell
Section titled “DirtyCell”interface DirtyCell { row: number; col: number;}Logical row/column address of a cell that needs re-rendering.
DirtyRect
Section titled “DirtyRect”interface DirtyRect { x: number; y: number; width: number; height: number;}Pixel-space rectangle for partial canvas invalidation.
General Types
Section titled “General Types”Utility types, enums, and interfaces used across multiple subsystems.
CellAlignment
Section titled “CellAlignment”type CellAlignment = 'left' | 'center' | 'right';Horizontal text alignment within a cell, used by CellTypeRenderer.
ComparisonOperator
Section titled “ComparisonOperator”type ComparisonOperator = | 'greaterThan' | 'lessThan' | 'greaterThanOrEqual' | 'lessThanOrEqual' | 'equal' | 'notEqual' | 'between' | 'notBetween';Comparison operators for conditional formatting value conditions.
EditorCloseReason
Section titled “EditorCloseReason”type EditorCloseReason = | 'enter' | 'shift-enter' | 'tab' | 'shift-tab' | 'escape' | 'blur' | 'scroll' | 'programmatic';Reason the inline editor was closed, determines next-cell navigation direction.
FillDirection
Section titled “FillDirection”type FillDirection = 'down' | 'up' | 'right' | 'left';Direction of an autofill drag operation.
PatternType
Section titled “PatternType”type PatternType = 'number-sequence' | 'number-increment' | 'date-sequence' | 'text-repeat';Type of pattern detected by the autofill PatternDetector.
DetectedPattern
Section titled “DetectedPattern”interface DetectedPattern { readonly type: PatternType; readonly step: number; readonly sourceValues: readonly CellValue[];}Result of autofill pattern detection with step increment and source values.
HitRegion
Section titled “HitRegion”type HitRegion = | 'cell' | 'header' | 'header-sort-icon' | 'header-filter-icon' | 'row-number' | 'row-group-toggle' | 'corner' | 'outside';Region of the grid where a mouse event occurred.
HitZone
Section titled “HitZone”interface HitZone { readonly id: string; readonly x: number; readonly y: number; readonly width: number; readonly height: number; readonly cursor?: string;}Declares a rectangular interactive zone within a cell for sub-cell hit testing. Coordinates are relative to the cell content area. Returned by CellTypeRenderer.getHitZones().
CellDecoratorPosition
Section titled “CellDecoratorPosition”type CellDecoratorPosition = 'left' | 'right' | 'overlay' | 'underlay';Where a cell decorator renders relative to cell content. left/right reserve horizontal space, shifting text inward. overlay renders on top of text, underlay renders behind.
CellDecorator
Section titled “CellDecorator”interface CellDecorator { readonly id: string; readonly position: CellDecoratorPosition; getWidth?(cellData: CellData, cellHeight: number, ctx?: CanvasRenderingContext2D, theme?: SpreadsheetTheme, row?: number, col?: number): number; render(ctx: CanvasRenderingContext2D, cellData: CellData, x: number, y: number, width: number, height: number, theme: SpreadsheetTheme, row?: number, col?: number): void; getHitZones?(width: number, height: number, cellData: CellData, row?: number, col?: number): HitZone[];}Composable rendering addon for cells. Decorators augment the default text rendering pipeline without replacing it. Register via CellTypeRegistry.addDecorator().
getWidth— compute reserved width for left/right decorators. Ignored for overlay/underlay. Optionalrow/colidentify the cell being rendered.render— draw the decorator in its allocated area. Optionalrow/colidentify the cell being rendered.getHitZones— optional interactive zones within the decorator’s area. Optionalrow/colidentify the cell being hit-tested.
CellDecoratorRegistration
Section titled “CellDecoratorRegistration”interface CellDecoratorRegistration { decorator: CellDecorator; appliesTo: (row: number, col: number, cellData: CellData) => boolean;}Links a decorator to a predicate that controls which cells it applies to. The appliesTo function receives the cell’s row, column, and full CellData.
Decorator Usage Example
Section titled “Decorator Usage Example”import type { CellDecoratorRegistration } from '@witqq/spreadsheet';
// Status indicator: colored dot on the left side of cellsconst statusDecorator: CellDecoratorRegistration = { decorator: { id: 'status-indicator', position: 'left', getWidth: () => 16, render: (ctx, cellData, x, y, width, height) => { const val = String(cellData.value ?? ''); const color = val === 'Active' ? '#63be7b' : val === 'Remote' ? '#5b9bd5' : '#f8696b'; ctx.fillStyle = color; ctx.beginPath(); ctx.arc(x + width / 2, y + height / 2, 4, 0, Math.PI * 2); ctx.fill(); }, }, appliesTo: (_row, col) => col === 15, // Status column};
engine.getCellTypeRegistry().addDecorator(statusDecorator);
// Remove decorator later:engine.getCellTypeRegistry().removeDecorator('status-indicator');Render order: underlay → left → right → text/custom → overlay. Left/right decorators shift text inward by their reserved width.
HitTestResult
Section titled “HitTestResult”interface HitTestResult { readonly region: HitRegion; readonly row: number; // -1 if not applicable readonly col: number; // -1 if not applicable readonly hitZone?: string; // Hit zone ID if point is inside a declared zone readonly hitZoneCursor?: string; // Cursor style from the matched hit zone}Result of coordinate-to-cell hit testing. When a cell type renderer declares hit zones via getHitZones(), hitZone contains the matched zone ID and hitZoneCursor the zone’s cursor style.
Command
Section titled “Command”interface Command { execute(): void; undo(): void; readonly description: string;}Interface for undoable operations in the command stack.
CommandCallback
Section titled “CommandCallback”type CommandCallback = (command: Command) => void;Callback invoked after command execution, undo, or redo.
CellEdit
Section titled “CellEdit”interface CellEdit { readonly row: number; readonly col: number; readonly oldValue: CellValue; readonly newValue: CellValue;}Single cell value change, used by BatchCellEditCommand for bulk operations.
RowCommandDeps
Section titled “RowCommandDeps”interface RowCommandDeps { cellStore: CellStore; mergeManager: MergeManager | null; setRowCount: (count: number) => void; getRowCount: () => number;}Dependencies for insert/delete row commands.
ColumnAggregate
Section titled “ColumnAggregate”interface ColumnAggregate { col: number; fn: AggregateFunction;}Column index and aggregate function for row group summary calculations.
MenuContext
Section titled “MenuContext”type MenuContext = 'cell' | 'header' | 'row-number' | 'corner';Grid region where the context menu was triggered.
MenuActionContext
Section titled “MenuActionContext”interface MenuActionContext { readonly row: number; readonly col: number; readonly region: string; readonly engine: SpreadsheetEngine;}Context passed to context menu item action and visibility callbacks.
RequiredRule
Section titled “RequiredRule”interface RequiredRule { readonly type: 'required'; readonly message?: string; readonly severity?: 'error' | 'warning' | 'info';}Validation rule that rejects empty, null, or undefined values.
RangeRule
Section titled “RangeRule”interface RangeRule { readonly type: 'range'; readonly min?: number; readonly max?: number; readonly message?: string; readonly severity?: 'error' | 'warning' | 'info';}Validation rule that enforces numeric min/max bounds.
RegexRule
Section titled “RegexRule”interface RegexRule { readonly type: 'regex'; readonly pattern: string; readonly flags?: string; readonly message?: string; readonly severity?: 'error' | 'warning' | 'info';}Validation rule that tests cell value against a regular expression.
CustomRule
Section titled “CustomRule”interface CustomRule { readonly type: 'custom'; readonly validate: (value: CellValue) => ValidationResult; readonly message?: string; readonly severity?: 'error' | 'warning' | 'info';}Validation rule with a user-supplied validation function.
Editor Types
Section titled “Editor Types”CellEditorClose
Section titled “CellEditorClose”type CellEditorClose = (reason: EditorCloseReason) => void;Callback to close an active cell editor with a specified reason.
CellEditorMatcher
Section titled “CellEditorMatcher”type CellEditorMatcher = (column: ColumnDef, value: CellValue) => boolean;Predicate that determines whether a custom cell editor applies to a given column and value.
CellEditorRegistration
Section titled “CellEditorRegistration”interface CellEditorRegistration { editor: CellEditor; matcher: CellEditorMatcher; priority: number;}Links a CellEditor to a matcher predicate. Higher priority values take precedence when multiple editors match.
DatePickerConfig
Section titled “DatePickerConfig”interface DatePickerConfig { container: HTMLElement; scrollContainer: HTMLElement; layoutEngine: LayoutEngine; scrollManager: ScrollManager; theme: SpreadsheetTheme; onCommit: (row: number, col: number, oldValue: CellValue, newValue: CellValue) => void; onClose: (reason: EditorCloseReason) => void; frozenRows?: number; frozenColumns?: number;}Configuration for DatePickerOverlay. Requires DOM containers, layout references, and commit/close callbacks.
Conditional Format Types
Section titled “Conditional Format Types”ConditionalFormatCondition
Section titled “ConditionalFormatCondition”type ConditionalFormatCondition = | ValueCondition | GradientScaleCondition | DataBarCondition | IconSetCondition;Union of all supported conditional format condition types.
ConditionalFormatRule
Section titled “ConditionalFormatRule”interface ConditionalFormatRule { readonly id: string; readonly priority: number; readonly range: CellRange; readonly condition: ConditionalFormatCondition; readonly style?: Partial<CellStyle>; readonly stopIfTrue?: boolean;}A conditional formatting rule applied to a cell range. Rules are evaluated in priority order. When stopIfTrue is set, lower-priority rules are skipped if this rule matches.
Sort & Stretch Types
Section titled “Sort & Stretch Types”SortDirection
Section titled “SortDirection”type SortDirection = 'asc' | 'desc';Sort order for column sorting.
StretchMode
Section titled “StretchMode”type StretchMode = 'all' | 'last';Column stretch strategy: all distributes extra width across all columns; last assigns it to the last column.
Additional Config Types
Section titled “Additional Config Types”ChangeTrackerConfig
Section titled “ChangeTrackerConfig”interface ChangeTrackerConfig { cellStore: CellStore; eventBus: EventBus;}Configuration for ChangeTracker. Requires access to cell store and event bus.
CellChange
Section titled “CellChange”interface CellChange { readonly row: number; readonly col: number; readonly oldValue: CellValue; readonly newValue: CellValue; readonly timestamp: number; readonly userId?: string; readonly source: string;}Record of a single cell value change. Used by ChangeTracker for audit trails and collaboration conflict resolution.
ColumnStretchConfig
Section titled “ColumnStretchConfig”interface ColumnStretchConfig { mode: StretchMode;}Configuration for column stretch behavior.
FilterPanelConfig
Section titled “FilterPanelConfig”interface FilterPanelConfig { container: HTMLElement; scrollContainer: HTMLElement; layoutEngine: LayoutEngine; scrollManager: ScrollManager; theme: SpreadsheetTheme; onApply: (col: number, operator: FilterOperator, value: string, valueTo?: string) => void; onClear: (col: number) => void;}Configuration for the filter panel overlay.
FrozenPaneConfig
Section titled “FrozenPaneConfig”interface FrozenPaneConfig { frozenRows: number; frozenColumns: number; layoutEngine: LayoutEngine; frozenRanges: FrozenViewportRanges;}Configuration for frozen pane rendering regions.
TooltipManagerConfig
Section titled “TooltipManagerConfig”interface TooltipManagerConfig { container: HTMLElement; eventBus: EventBus; cellStore: CellStore; dataView: DataView; layoutEngine: LayoutEngine; scrollManager: ScrollManager; theme: SpreadsheetTheme;}Configuration for the tooltip manager.
Rendering & Layer Classes
Section titled “Rendering & Layer Classes”AutoRowSizeManager
Section titled “AutoRowSizeManager”class AutoRowSizeManager { constructor(config: AutoRowSizeConfig, applyHeights: ApplyHeightsCallback); setLayers(layers: RenderLayer[]): void; markDirtyRows(rows: Iterable<number>): void; markAllDirty(): void; clearDirty(): void;}Measures cell content height and applies automatic row sizing. Operates on dirty rows and delegates height updates through ApplyHeightsCallback.
ApplyHeightsCallback
Section titled “ApplyHeightsCallback”type ApplyHeightsCallback = (updates: Map<number, number>) => void;Callback receiving a map of row index → computed height for automatic row sizing.
FillHandleLayer
Section titled “FillHandleLayer”class FillHandleLayer implements RenderLayer { render(rc: RenderContext): void;}Render layer that draws the autofill drag handle at the bottom-right corner of the selection.
RowGroupToggleLayer
Section titled “RowGroupToggleLayer”class RowGroupToggleLayer implements RenderLayer { render(rc: RenderContext): void;}Render layer that draws expand/collapse toggle icons in the row number area for grouped rows.
DatePickerOverlay
Section titled “DatePickerOverlay”class DatePickerOverlay { constructor(config: DatePickerConfig); get isOpen(): boolean; get editingRow(): number; get editingCol(): number;}Calendar overlay for date cell editing. Positioned over the active cell and commits values through the configured callback.
LINE_HEIGHT_MULTIPLIER
Section titled “LINE_HEIGHT_MULTIPLIER”const LINE_HEIGHT_MULTIPLIER = 1.2;Default multiplier applied to font size when computing line height for text rendering.
Events
Section titled “Events”SpreadsheetEvents
Section titled “SpreadsheetEvents”interface SpreadsheetEvents { cellClick: (event: CellEvent) => void; cellDoubleClick: (event: CellEvent) => void; cellHover: (event: CellEvent) => void; cellChange: (event: CellChangeEvent) => void; selectionChange: (event: SelectionChangeEvent) => void; scroll: (event: ScrollEvent) => void; ready: () => void; destroy: () => void; commandExecute: (event: CommandEvent) => void; commandUndo: (event: CommandEvent) => void; commandRedo: (event: CommandEvent) => void; clipboardCopy: (event: ClipboardDataEvent) => void; clipboardCut: (event: ClipboardDataEvent) => void; clipboardPaste: (event: ClipboardDataEvent) => void; columnResize: (event: ColumnResizeEvent) => void; columnResizeStart: (event: { colIndex: number }) => void; columnResizeEnd: (event: ColumnResizeEvent) => void; rowResize: (event: RowResizeEvent) => void; rowResizeStart: (event: { rowIndex: number }) => void; rowResizeEnd: (event: RowResizeEvent) => void; cellStatusChange: (event: CellStatusChangeEvent) => void; cellValidation: (event: CellValidationEvent) => void; autofillStart: (event: AutofillStartEvent) => void; autofillPreview: (event: AutofillPreviewEvent) => void; autofillComplete: (event: AutofillCompleteEvent) => void; sortChange: (event: SortChangeEvent) => void; sortRejected: (event: SortRejectedEvent) => void; filterChange: (event: FilterChangeEvent) => void; rowGroupToggle: (event: RowGroupToggleEvent) => void; rowGroupChange: (event: RowGroupChangeEvent) => void; themeChange: (event: { theme: SpreadsheetTheme }) => void;}Map of all public events emitted by SpreadsheetEngine. Use engine.on(eventName, handler) to subscribe.
Benchmark Types
Section titled “Benchmark Types”BenchmarkRunner
Section titled “BenchmarkRunner”class BenchmarkRunner { record(name: string, dataset: string, stats: RunStats, unit?: string): void; toJSON(): BenchmarkSuiteResult; reset(): void;}Collects benchmark metrics and serializes results.
BenchmarkMetric
Section titled “BenchmarkMetric”interface BenchmarkMetric { name: string; dataset: string; stats: RunStats; unit: string;}A single benchmark measurement with statistical summary.
BenchmarkResult
Section titled “BenchmarkResult”interface BenchmarkResult { initTimeMs: number; memoryMB?: number; rowCount: number; columnCount: number;}Initialization benchmark result capturing startup time and optional memory usage.
BenchmarkSuiteResult
Section titled “BenchmarkSuiteResult”interface BenchmarkSuiteResult { timestamp: string; metrics: BenchmarkMetric[];}Complete benchmark suite output with timestamp and all collected metrics.
RunStats
Section titled “RunStats”interface RunStats { medianMs: number; meanMs: number; minMs: number; maxMs: number; cv: number; runs: number[];}Statistical summary of multiple benchmark runs. cv is the coefficient of variation.
TimingResult
Section titled “TimingResult”interface TimingResult { timeMs: number;}Single timing measurement result.
computeStats
Section titled “computeStats”function computeStats(times: number[]): RunStats;Computes statistical summary from an array of timing measurements.
measureMultiRun
Section titled “measureMultiRun”function measureMultiRun(fn: () => void, runs?: number): RunStats;Executes a function multiple times and returns aggregated statistics. Defaults to 3 runs.
measureThroughput
Section titled “measureThroughput”function measureThroughput( fn: () => void, iterations: number,): { opsPerSec: number; totalMs: number };Measures operations per second by running a function for the specified number of iterations.
measureInitTime
Section titled “measureInitTime”function measureInitTime(factory: () => void): TimingResult;Measures the time to execute a factory function once and returns a TimingResult.
FPSCounter
Section titled “FPSCounter”class FPSCounter { start(): void; tick(): void; stop(): FPSResult;}Measures rendering frame rate. Call start() before the loop, tick() on each frame, and stop() to get the result.
FPSResult
Section titled “FPSResult”interface FPSResult { avgFPS: number; minFPS: number; maxFPS: number; frameCount: number; durationMs: number;}Frame rate measurement result from FPSCounter.stop().