@searsuite/sear-plugin-formula
Run evaluation
SheetFormulaPlugin owns formula source in the Sheet and reacts to committed cell and structure operations.
It parses changed formulas, updates dependencies, and asks RecalcScheduler to evaluate affected cells.
Calculated values live in FormulaResultStore and are exposed through result providers; they are derived data,
separate from the formula text stored in the document.
The parser, evaluator, graph, and built-in functions are described in the formula-engine packages. Start here when integrating formula behavior into a Sheet editor; start with the engine contracts when implementing a new evaluator or function.
- classSheetFormulaPlugin
-
class SheetFormulaPlugin extends Plugin<SearCoreSheet, CellProperties, FormulaPluginState>, IFormulaResultProvider, IFormulaSourceProvider, IFormulaStatusProviderOwns formula source, dependency tracking, recalculation, and result projection.
constructor SheetFormulaPlugin(parser: IFormulaParser, graph: IDependencyGraph, aggCache: IAggregationCache, resultStore: FormulaResultStore, scheduler: RecalcScheduler, refShifter: FormulaRefShifter, trace: FormulaCalculationTraceBus, dataEngine?: DataEngine, platform?: Platform, results?: IFormulaResultProvider, resultProviders?: FormulaResultProviderRegistry, richResultProviders?: FormulaRichResultProviderRegistry, sourceProviders?: FormulaSourceProviderRegistry, functions?: IFunctionRegistry, externalServices?: IFormulaExternalServiceProvider, textServices?: IFormulaTextServiceProvider): SheetFormulaPluginproperty interestedIn: MatrixOTActionName[]Operation types listened to by this plugin:
- uc: UpdateCell
- ri: RowInsert
- rd: RowDelete
- ci: ColInsert
- cd: ColDelete
property readonly pluginKey: PluginKeystaticStable plugin key for SheetFormulaPlugin.
property readonly symbol: typeof symbolstaticDI token for resolving SheetFormulaPlugin.
method apply(_pluginState: null, transaction: Transaction): nullRejects unsupported structure operations before the owning transaction commits. Derived ASTs are not staged as plugin state.
method enforceProviderCommandBoundary(commands: SheetCommandBus, workbookOwnership?: FormulaRegistryOwnership): voidSeals provider registration once every configured Sheet plugin has started.
method forEachFormulaResultInRange(startRow: number, startColumn: number, endRow: number, endColumn: number, visit: (row: number, column: number): void): voidExposes derived spill coordinates to sparse range consumers.
method getFormulaCellStatus(row: number, col: number): FormulaCellStatusIFormulaStatusProvider implementation used by hosts and plugins to inspect formula source, result, dirty state, and dependency edges without touching plugin-owned caches directly.
method getFormulaResult(row: number, col: number): FormulaValue | undefinedIFormulaResultProvider implementation used by rendering to read formula results.
Returns FormulaValue from resultStore, or undefined when it has not been calculated yet. The rendering layer (FormulaCell) converts it to display text.
method getFormulaSource(row: number, col: number): string | undefinedIFormulaSourceProvider implementation used by editors to read persisted formula text.
method getPluginConfig(): unknownReturns the plugin config.
method onInitialDataCell(_searCore: SearCoreSheet, value: unknown, row: number, col: number): voidReceives cells from shared startup scanning and builds AST/dependency indexes for existing formula cells.
Initial data such as content.json is injected directly into SheetDataPlugin and does not pass through the command pipeline -> apply, so formula-derived indexes must be built here.
method onInitialDataComplete(_searCore: SearCoreSheet): voidStarts one recalculation after dependencies for all initial formulas have been registered.
method onTransactionCommitted(transaction: Transaction): voidRebuilds derived indexes after the owning document transaction commits.
transactionSuccessfully committed transaction.
method registerCommands(commands: SheetCommandBus): voidRegisters formula host commands.
commandsCommand bus owned by one editor instance.
method registerConfig(): { config: ConfigUnit<FormulaReferenceHighlightConfig>; key: PluginKey }[]Registers default configuration values owned by this plugin.
method registerObservations(observations: ObservationRegistry): voidRegisters formula calculation trace as an editor-local host observation.
method registerRangeMoves(registry: SheetRangeMoveRegistry): voidContributes formula identity updates to the same atomic cell-move plan.
method registerRangeReorders(registry: SheetRangeReorderRegistry): voidmethod registerState(): { dataEngine: { enabled: boolean }; key: PluginKey; state: null }Formula indexes are editor-local and do not enter Sheet document views.
method registerStructureMoves(registry: SheetStructureMoveRegistry): voidPlans persisted reference rewrites for complete row and column reordering.
method render(): Node<CellProperties>[]Render method; the formula plugin does not render nodes directly.
Formula cells are rendered by FormulaCell through render-registry registration. This plugin owns data updates, not visual presentation.
Inherited members 24
Inherited from Plugin.
- depth
- documentState
- transactionHistory
- transactionOT
- warnOnDuplicateDepth
- key
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- lockCommittedState
- onClick
- onDblClick
- onMouseDown
- onMouseMove
- onMouseUp
- onResize
- onScroll
- projectTransaction
- sealRuntimeMetadata
- sealRuntimeMethods
- sealRuntimeWrites
- setState
- classRecalcScheduler
-
Schedules dependency-aware formula recalculation with visible-cell priority.
constructor RecalcScheduler(graph: IDependencyGraph, evaluator: IFormulaEvaluator, resultStore: FormulaResultStore, aggCache: IAggregationCache, dataSource: FormulaSchedulerDataSource, platform: Platform, renderInvalidator: FormulaRenderInvalidator, trace: FormulaCalculationTraceBus, functionRegistry?: IFunctionRegistry, iterationSettings?: IFormulaIterationSettingsProvider): RecalcSchedulerproperty readonly symbol: typeof symbolstaticDI token for resolving RecalcScheduler.
method bindAstCache(cache: ReadonlyMap<number, FormulaAST>): voidBinds the formula owner's cache during plugin setup.
method bindCommandBus(commands: SheetCommandBus): voidBinds asynchronous formula work to the owning editor's command bus.
method bindTeardownToken(token: object): voidGives the owning editor lifecycle exclusive authority to dispose the mounted scheduler.
method discardPendingWork(): voidDiscards pending formula batches when committed formula inputs are replaced.
method dispose(token?: object): voidReleases scheduler-owned subscriptions.
method getFormulaKeys(): IterableIterator<number>Iterates formula coordinates without exposing the cache for mutation.
method markDirty(changedKeys: number[]): voidTriggers recalculation.
Performs only two actions:
- Mark dirty formulas, propagated by BFS without sorting.
- Start the async scheduling loop without blocking the current frame.
method markFunctionsDirty(functionNames: readonly string[]): voidRecalculates formulas that contain any of the supplied function names.
method processScheduledBatch(): voidRuns one budgeted batch inside the formula owner's command.
method recalculateVolatile(): voidStarts an explicit recalculation epoch for every formula containing a volatile call.
method resumePendingWork(): voidResumes pending work inside a viewport or external-service command.
method waitForIdle(): Promise<void>Resolves when the scheduler has no running or pending formula work.
- classFormulaResultStore
-
Stores calculated formula results independently from persisted formula source.
constructor FormulaResultStore(valueConverters: CellFormulaValueConverterRegistry): FormulaResultStoreproperty readonly symbol: typeof symbolstaticDI token for resolving FormulaResultStore.
method cellToFormulaValue(row: number, col: number, cell: CellMatrixElement | null | undefined): FormulaValueConverts a CellMatrixElement to a FormulaValue.
Used when evaluators read cell data:
- formula cells: read the local calculated result from this store; derived and unsynced.
- richtext/string cells: return text values, converting numeric strings to numbers.
- null/undefined: return 0 for empty cells.
Called by both SheetFormulaPlugin.apply for aggCache delta calculation and RecalcScheduler.createEvalContext, so it lives on the store to avoid duplicated logic or callback plumbing.
method clear(): voidClears state owned by FormulaResultStore.
method delete(key: number): voidRemoves the calculated result for one formula cell.
method enforceCommandBoundary(isCommandExecuting: (): boolean): voidCloses direct result writes after the owning Sheet has started.
method forEachSpillInRange(startRow: number, startColumn: number, endRow: number, endColumn: number, visit: (row: number, column: number): void): voidVisits projected spill coordinates in a range; formula anchors live in the Sheet data matrix.
method get(key: number): FormulaValue | undefinedmethod getAt(row: number, col: number): FormulaValue | undefinedReads an anchor or projected spill value at any sheet coordinate.
method has(key: number): booleanReturns whether value exists.
method set(key: number, value: FormulaValue): voidUpdates the value.
method setFormulaResult(key: number, value: FormulaValue, context: { isCellInBounds: unknown; isCellOccupied?: unknown }): number[]Stores a formula result and projects a rectangular array into derived spill cells.
- interfaceFormulaRegistryOwnership
-
interface FormulaRegistryOwnershipFormulaRegistryOwnership: unknownMarks formula registries borrowed from a Workbook owner by a mounted Sheet.
property readonly externalServices: booleanproperty readonly functions: booleanproperty readonly textServices: booleanvariablesymbol symbol: typeof symbol - interfaceFormulaSchedulerDataSource
-
interface FormulaSchedulerDataSourceFormulaSchedulerDataSource: unknownNarrow data-source contract used by RecalcScheduler.
Implementations adapt host-owned sheet data, viewport state, and dimension services into formula-engine concepts. The scheduler depends only on this contract, not on render, scroll, or DataEngine packages.
method createEvalContext(resultStore: FormulaResultStore): EvalContextBuilds the latest evaluation context for a recalculation batch.
ReturnsEvalContext for the current committed sheet snapshot.
resultStorePer-client derived formula result store used when formula cells reference formula cells.
method getViewportFormulaKeys(formulaKeys: Iterable<number>): Set<number>Selects formula keys that are currently visible and should be evaluated first.
ReturnsFormula keys inside the current visible viewport.
formulaKeysFormula AST keys known to the scheduler.
method onExternalServiceInvalidated(handler: FormulaExternalServiceInvalidationHandler): (): voidSubscribes to host-service cache changes that require selected functions to be evaluated again.
method onViewportChanged(handler: FormulaViewportChangeHandler): (): voidSubscribes to viewport changes that should wake pending formula recalculation.
ReturnsDisposer for the subscription.
handlerCallback invoked after viewport-priority inputs change.
variablesymbol symbol: typeof symbolDI token for resolving FormulaSchedulerDataSource.
- typeFormulaPluginState
-
type FormulaPluginState = nullFormula owns no document state; its ASTs and results are derived caches.
- variablesheetFormulaPluginKey
-
sheetFormulaPluginKey: PluginKeyShared identity for formula plugin state and configuration.
Results and status
- interfaceFormulaCellStatusCommandInput
-
Input for querying one cell's formula status through the host command bus.
property readonly col: numberColumn index (0-based).
property readonly row: numberRow index (0-based).
- interfaceFormulaCellStatusCommandResult
-
interface FormulaCellStatusCommandResult extends SheetCommandResultCommand result for a formula status query.
The pipeline is intentionally empty: formula status reads must not mutate OT state, request rendering, or produce local effects.
property readonly status: FormulaCellStatusFormula status snapshot returned by the formula status provider.
- interfaceFormulaDependencyCellRef
-
Product-facing cell coordinate plus A1 reference label.
property readonly col: numberColumn index (0-based).
property readonly ref: stringA1 notation for display in product UI.
property readonly row: numberRow index (0-based).
- interfaceFormulaDependencyStatus
-
Product-facing formula dependency status for one queried cell.
property readonly cell: FormulaDependencyCellRefQueried cell with display label.
property readonly dependents: readonly FormulaDependencyCellRef[]Direct formula cells that depend on the queried cell.
property readonly precedents: readonly FormulaDependencyReference[]Direct precedent references used by the formula in the queried cell.
property readonly status: FormulaCellStatusUnderlying formula status snapshot for consumers that need result/error/dirty details.
property readonly transitiveDependents: readonly FormulaDependencyCellRef[]Transitive dependent formula cells, only populated when requested.
property readonly transitivePrecedents: readonly FormulaDependencyCellRef[]Transitive precedent cells, only populated when requested.
- interfaceFormulaDependencyStatusCommandInput
-
Input for querying product-facing formula dependency status.
property readonly col: numberColumn index (0-based).
property readonly includeTransitive?: booleanWhether to include transitive dependency/dependent cells beyond direct edges.
property readonly maxDepth?: numberMaximum traversal depth used when includeTransitive is true. Defaults to 8.
property readonly row: numberRow index (0-based).
- interfaceFormulaDependencyStatusCommandResult
-
interface FormulaDependencyStatusCommandResult extends SheetCommandResultCommand result for a product-facing formula dependency query.
The pipeline is intentionally empty: dependency reads must not mutate OT state, request rendering, or produce local effects.
property readonly dependencyStatus: FormulaDependencyStatusProduct-facing dependency snapshot for the queried cell.
- interfaceFormulaIdleCommandResult
-
interface FormulaIdleCommandResult extends SheetCommandResultResult returned when waiting for one editor instance's formula scheduler.
property readonly idle: Promise<void>Promise resolved when the formula scheduler becomes idle.
- interfaceFormulaIdleProvider
-
Provider contract used by the deterministic formula-idle command.
method waitForIdle(): Promise<void>Resolves after all currently scheduled formula work has completed.
- variableFormulaCalculationTraceObservation
-
FormulaCalculationTraceObservation: EventObservationDefinition<FormulaCalculationTraceEvent>Editor-local formula calculation trace events exposed to diagnostic hosts.
- variableGetFormulaCellStatusCommand
-
GetFormulaCellStatusCommand: SheetCommandDefinition<FormulaCellStatusCommandInput, FormulaCellStatusCommandResult>Host command that reads one cell's formula status.
- variableGetFormulaDependencyStatusCommand
-
GetFormulaDependencyStatusCommand: SheetCommandDefinition<FormulaDependencyStatusCommandInput, FormulaDependencyStatusCommandResult>Host command that reads product-facing formula dependency status.
- variableWaitForFormulaIdleCommand
-
WaitForFormulaIdleCommand: SheetCommandDefinition<void, FormulaIdleCommandResult>Host command that exposes deterministic formula-idle synchronization.
- functionlockFormulaResultValue
-
lockFormulaResultValue(value: FormulaValue): voidLocks a calculated value once when it enters the editor-local result cache.
- functionregisterFormulaStatusCommands
-
registerFormulaStatusCommands(commands: SheetCommandBus, provider: IFormulaStatusProvider, idleProvider?: FormulaIdleProvider): voidRegisters formula status query commands.
commandsCommand bus for one editor instance.
providerFormula status provider bound to the same editor instance.
- functionwaitForFormulaIdle
-
waitForFormulaIdle(commands: SheetCommandBus): Promise<void>Waits deterministically for one editor's formula scheduler to become idle.
Providers and registries
- classCellFormulaValueConverterRegistry
-
Cell type → formula semantic value registry.
Rendering and formula coercion intentionally use separate registries: a custom cell type can define its calculation semantics without coupling to a Canvas renderer.
constructor CellFormulaValueConverterRegistry(platform: Platform): CellFormulaValueConverterRegistryCreates a registry with the built-in cell-to-formula semantics.
platformPlatform adapter used for diagnostics when unknown cell types fall back to text.
property readonly symbol: typeof symbolstaticDI token for resolving CellFormulaValueConverterRegistry.
method register(converter: CellFormulaValueConverter): (): voidRegisters or overrides formula semantics for one cell type.
ReturnsDisposer that restores the previous converter only if this registration is still active.
converterConverter owned by a built-in package or third-party plugin.
method toFormulaValue(cell: CellMatrixElement): FormulaValueConverts a persisted sheet cell into the formula value contract.
ReturnsFormula value, including canonical propagated formula errors or
#VALUE!for malformed error payloads.cellMatrix cell to convert; the method never writes back to the sheet matrix.
- classFormulaResultProviderRegistry
-
class FormulaResultProviderRegistry extends IFormulaResultProviderInstance-local result provider registry exposed as the renderer's formula result reader.
constructor FormulaResultProviderRegistry(): FormulaResultProviderRegistryproperty readonly symbol: typeof symbolstaticDI token for resolving the registry owned by one SheetEditor instance.
method enforceCommandBoundary(isExecuting: (): boolean, remove: (id: number): void): voidBinds post-assembly registration and disposal to the owning command bus.
method forEachFormulaResultInRange(startRow: number, startColumn: number, endRow: number, endColumn: number, visit: (row: number, column: number): void): voidVisits derived result coordinates published by registered providers, once per position.
method getFormulaResult(row: number, col: number): FormulaValue | undefinedReads the first defined result supplied by registered providers.
method register(registration: FormulaResultProviderRegistration): (): voidRegisters one formula result provider and returns an idempotent disposer.
method unregister(id: number): voidRemoves one provider inside the formula owner's unregister command.
- classFormulaRichResultProviderRegistry
-
class FormulaRichResultProviderRegistry extends IFormulaRichResultProviderInstance-local provider registry for formula hyperlinks, images, and future rich results.
constructor FormulaRichResultProviderRegistry(): FormulaRichResultProviderRegistryproperty readonly symbol: typeof symbolstaticmethod enforceCommandBoundary(isExecuting: (): boolean, remove: (id: number): void): voidmethod getFormulaRichResult(row: number, col: number): FormulaRichResult | undefinedmethod register(registration: FormulaRichResultProviderRegistration): (): voidmethod unregister(id: number): void - classFormulaSourceProviderRegistry
-
class FormulaSourceProviderRegistry extends IFormulaSourceProviderEditor-local ordered registry for formula source providers.
constructor FormulaSourceProviderRegistry(): FormulaSourceProviderRegistryproperty readonly symbol: typeof symbolstaticDI token for resolving IFormulaSourceProvider.
method enforceCommandBoundary(isExecuting: (): boolean, remove: (id: number): void): voidmethod getFormulaSource(row: number, col: number): string | undefinedGets the formula source that should be presented to the user for one cell.
Providers may return undefined when they do not own the queried cell. The default sheet formula provider returns the persisted formula text, while workbook-aware providers can return display text formatted from stable workbook bindings and the current sheet names.
method register(registration: FormulaSourceProviderRegistration): (): voidmethod unregister(id: number): void - interfaceCellFormulaValueConverter
-
Defines how one persisted cell type enters the formula domain.
property readonly cellType: stringPersisted cell type identifier handled by this converter.
method toFormulaValue(cell: CellMatrixElement): FormulaValueConverts one sheet matrix element into a formula-engine value.
ReturnsFormula value used by formula evaluation and dependency recalculation.
cellPersisted sheet cell to read without mutating sheet state.
- interfaceFormulaResultProviderRegistration
-
Ordered formula result provider registered for one SheetEditor instance.
property readonly priority?: numberHigher priority providers are queried first.
property readonly provider: IFormulaResultProviderProvider queried for formula results.
- interfaceFormulaRichResultProviderRegistration
-
Ordered rich-result provider registered for one SheetEditor instance.
- interfaceFormulaSourceProviderRegistration
-
property readonly priority?: numberproperty readonly provider: IFormulaSourceProvider - interfaceUnregisterFormulaProviderInput
-
property readonly kind: FormulaProviderKindproperty readonly registrationId: number - typeFormulaProviderKind
-
type FormulaProviderKind = typeof FormulaProviderKind[keyof typeof FormulaProviderKind]FormulaProviderKind: { Result: "result"; RichResult: "richResult"; Source: "source" }Formula-owned provider families sharing one editor-local unregister command.
- variableUnregisterFormulaProviderCommand
-
UnregisterFormulaProviderCommand: SheetCommandDefinition<UnregisterFormulaProviderInput, SheetCommandResult>Removes an editor-local formula provider registration.
- variableUnregisterSheetFormulaExternalServiceCommand
-
UnregisterSheetFormulaExternalServiceCommand: SheetCommandDefinition<number, SheetCommandResult>Removes one Sheet-owned external formula service contribution.
- variableUnregisterSheetFormulaFunctionCommand
-
UnregisterSheetFormulaFunctionCommand: SheetCommandDefinition<number, SheetCommandResult>Removes one function contribution through its Sheet owner.
- variableUnregisterSheetFormulaTextServiceCommand
-
UnregisterSheetFormulaTextServiceCommand: SheetCommandDefinition<number, SheetCommandResult>Removes one Sheet-owned formula text service contribution.
Schedule and invalidate
MarkFormulaDirtyCommand and RunFormulaBatchCommand are the command path for scheduled work.
GetFormulaCellStatusCommand reads one cell's status, while WaitForFormulaIdleCommand waits for pending work
to finish. FormulaCalculationTraceObservation reports calculation traces for diagnostics.
Host code should read formula results through a provider or status query. It should not write directly into
FormulaResultStore, because the scheduler owns recalculation order and invalidation.
- classFormulaCalculationTraceBus
-
class FormulaCalculationTraceBus extends IFormulaCalculationTraceProviderEditor-local formula trace event hub.
The hub fans out local runtime trace to host/plugin subscribers. It is intentionally independent from OT, rendering, and persistence; publishing an event must not mutate sheet state or request a render pipeline.
constructor FormulaCalculationTraceBus(platform: Platform): FormulaCalculationTraceBusproperty readonly symbol: typeof symbolstaticDI token for resolving FormulaCalculationTraceBus.
method emit(event: Omit<FormulaBatchFlushedEvent, "sequence"> | Omit<FormulaDependenciesChangedEvent, "sequence"> | Omit<FormulaErrorChangedEvent, "sequence"> | Omit<FormulaRecalculationCompletedEvent, "sequence">): voidEmits one calculation trace event to current subscribers.
Listener failures are reported through Platform.warn and do not interrupt formula recalculation, dependency maintenance, rendering invalidation, or other subscribers.
eventEvent payload without provider-owned sequence metadata.
method enforceCommandBoundary(isCommandExecuting: (): boolean): voidSeals event publication after initial formula data has been scanned.
method subscribeFormulaCalculationTrace(listener: FormulaCalculationTraceListener): (): voidSubscribes to formula calculation trace events for one editor instance.
ReturnsFunction that removes the listener; calling it more than once is safe.
listenerCallback invoked for future calculation trace events.
- classFormulaRenderInvalidator
-
Formula-result publisher for the shared displayed-value change bus.
The formula scheduler reports changes after updating derived results. Other features subscribe to the shared bus without depending on formula internals.
constructor FormulaRenderInvalidator(displayedValueChanges: SheetDisplayedValueChanges): FormulaRenderInvalidatorproperty readonly symbol: typeof symbolstaticDI token for resolving FormulaRenderInvalidator.
method bind(handler: FormulaRenderInvalidationHandler): (): voidRegisters the legacy formula-result callback for one editor instance.
ReturnsDisposer that removes this handler if it is still active.
handlerCallback that maps changed formula keys to render work.
method invalidateFormulaResults(keys: readonly number[]): voidReports formula result changes to displayed-value subscribers.
keysFormula cell keys whose derived display values changed.
- typeFormulaRenderInvalidationHandler
-
type FormulaRenderInvalidationHandler = (keys: readonly CellKey[]): voidCompatibility callback for formula-result change notifications.
- typeFormulaViewportChangeHandler
-
type FormulaViewportChangeHandler = (): voidCallback invoked when viewport-priority scheduling inputs may have changed.
- variableDiscardFormulaWorkCommand
-
DiscardFormulaWorkCommand: SheetCommandDefinition<void, SheetCommandResult>Invalidates an obsolete formula calculation generation.
- variableMarkFormulaDirtyCommand
-
MarkFormulaDirtyCommand: SheetCommandDefinition<readonly number[], SheetCommandResult>Marks formula dependencies dirty after an external result or function changes.
- variableResumeFormulaWorkCommand
-
ResumeFormulaWorkCommand: SheetCommandDefinition<void, SheetCommandResult>Resumes pending formula work when the visible viewport changes.
- variableRunFormulaBatchCommand
-
RunFormulaBatchCommand: SheetCommandDefinition<void, SheetCommandResult>Executes one scheduled, time-bounded formula calculation batch.
Formula references
Reference highlighting follows the draft formula and colors referenced ranges while the user edits it.
- classFormulaCrossSheetHighlightSource
-
Optional workbook-owned source for cross-sheet formula reference overlays.
- classFormulaRefShifter
-
Rewrites formula references after Sheet structure changes.
constructor FormulaRefShifter(parser: IFormulaParser): FormulaRefShifterproperty readonly symbol: typeof symbolstaticDI token for resolving FormulaRefShifter.
method shiftAll(formulas: Map<number, FormulaAST>, changes: StructureChange[]): { key: number; newAst: FormulaAST }[]Handles structural changes by traversing all formula ASTs and shifting references.
ReturnsFormula list that needs updates (key -> new AST).
formulasCurrent AST cache for all formulas (CellKey -> AST).
changesStructural change list for row/column insertion and deletion.
- classSheetFormulaReferenceHighlightPlugin
-
class SheetFormulaReferenceHighlightPlugin extends Plugin<SearCoreSheet, CellProperties, Record<string, never>>Highlights formula precedents and dependents for the active cell.
This intentionally remains separate from Selection: formula dependency status is optional, while Selection itself must stay independent of formula support.
constructor SheetFormulaReferenceHighlightPlugin(statusProvider: IFormulaStatusProvider, configEngine: ConfigEngine, highlightRegistry: SheetHighlightRegistry, interactionStore: SheetInteractionStore): SheetFormulaReferenceHighlightPluginproperty depth: numberDraw above regular cells and below Selection's edit overlay.
property interestedIn: string[]Declares which Sheet OT action names this plugin is interested in. The engine will only call
applywhen a transaction contains at least one operation matching these action names, unless the transaction is owned by this plugin.['uc', 'rr', 'rc']— only called for UpdateCell, ResizeRow, ResizeCol['*']— called for any transaction (wildcard)[]— only called for this plugin's own transactions
property readonly highlightProviderKey: "formula-selection-references"staticStable key for the formula-reference highlight contribution.
property readonly pluginKey: PluginKeystaticStable plugin key for SheetFormulaReferenceHighlightPlugin.
property readonly symbol: typeof symbolstaticDI token for resolving SheetFormulaReferenceHighlightPlugin.
method apply(_state: Record<string, never>, _transaction: Transaction): Record<string, never> | nullApplies a transaction to SheetFormulaReferenceHighlightPlugin state.
method bindCrossSheetSource(source: FormulaCrossSheetHighlightSource): voidBinds an optional workbook-owned reference source for this Sheet instance.
method getHighlights(context: SheetHighlightContext): SheetRangeHighlight[]The provider contract consumed by SheetHighlightPlugin.
method getPluginConfig(): unknownReturns the plugin config.
method registerState(): { key: PluginKey; state: Record<string, never> }Registers the state.
method render(_searCore: SearCoreSheet): Node<CellProperties>[]Renders SheetFormulaReferenceHighlightPlugin scene output.
Inherited members 27
Inherited from Plugin.
- documentState
- transactionHistory
- transactionOT
- warnOnDuplicateDepth
- key
- dirtyRect
- enforceRuntimeWriteBoundary
- enforceStateWriteBoundary
- getState
- hasStateWriteBoundary
- lockCommittedState
- onClick
- onDblClick
- onInitialDataCell
- onInitialDataComplete
- onMouseDown
- onMouseMove
- onMouseUp
- onResize
- onScroll
- onTransactionCommitted
- projectTransaction
- registerConfig
- sealRuntimeMetadata
- sealRuntimeMethods
- sealRuntimeWrites
- setState
- interfaceFormulaCrossSheetReference
-
One workbook-qualified reference projected onto the currently mounted sheet.
property readonly end: [number, number]property readonly index: numberproperty readonly start: [number, number] - interfaceFormulaReferenceColorPalette
-
Named palette entries stay compatible with the reactive configuration engine.
property azure: stringproperty blue: stringproperty brown: stringproperty cyan: stringproperty emerald: stringproperty green: stringproperty indigo: stringproperty orange: stringproperty rose: stringproperty slate: stringproperty teal: stringproperty violet: string - interfaceFormulaReferenceHighlightConfig
-
Formula-reference overlay settings used while editing a formula.
property activeReferenceFillOpacity: numberOpacity of the referenced-cell overlay under the formula cursor.
property referenceColors: FormulaReferenceColorPaletteStable, high-contrast colors assigned to formula references.
property referenceFillOpacity: numberOpacity of referenced-cell overlays when the cursor is elsewhere.
- typeFormulaDependencyReference
-
type FormulaDependencyReference = FormulaDependencyCellRef & { kind: typeof FormulaNodeKind.Cell } | { end: FormulaDependencyCellRef; kind: typeof FormulaNodeKind.Range; ref: string; start: FormulaDependencyCellRef } | FormulaDependencyCellRef & { kind: typeof FormulaNodeKind.WorkbookCell; sheetName: string } | { end: FormulaDependencyCellRef; kind: typeof FormulaNodeKind.WorkbookRange; ref: string; sheetName: string; start: FormulaDependencyCellRef } | { endCol: number; kind: typeof FormulaNodeKind.ColumnRange; ref: string; startCol: number } | { endRow: number; kind: typeof FormulaNodeKind.RowRange; ref: string; startRow: number }Product-facing dependency edge that preserves range-level formula semantics.
- variableformulaReferenceHighlightConfig
-
formulaReferenceHighlightConfig: FormulaReferenceHighlightConfig - functiongetFormulaReferenceColor
-
getFormulaReferenceColor(referenceIndex: number, colors?: FormulaReferenceColorPalette): stringAssigns a formula reference its Excel-style, position-based palette color.
No matching API entries.