@searsuite/sear-assembly-plugin
Plugin lifecycle
Plugin and PluginSpec describe an optional feature. During assembly, a plugin can register services, state,
commands, queries, observations, capabilities, and codecs. Registration establishes who owns a value and which
operation may change it. A feature that owns Sheet fill, for example, keeps its fill matrix and commands in its own
package while the assembly only connects it to an editor.
Use when: adding optional built-in or third-party behavior. Choose the lowest layer that owns the behavior: portable values in a domain package, feature state and commands in a plugin, platform conversion in a host adapter. A plugin should not reach into another feature's state or duplicate its finite values.
The composition root runs explicit lifecycle phases. A state contribution is available before commands and consumers that need it; successful commands publish committed changes to observers and renderers. Resources acquired during registration must be released in reverse order when setup fails or the editor is destroyed.
PluginManager coordinates registration. Runtime capabilities expose editor-owned services to the host without
exposing its dependency-injection container. Session adapters capture transient values across a Workbook Sheet
remount; document codecs and versioned OT contributions handle durable export and collaboration separately.
- classEditorLifecycleError
-
class EditorLifecycleError extends SearErrorPublic error raised when lifecycle stack ownership is violated.
constructor EditorLifecycleError(code: EditorLifecycleErrorCode, message: string, details?: SearErrorDetails): EditorLifecycleErrorproperty readonly code: EditorLifecycleErrorCodeStable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classEditorLifecycleStack
-
Idempotent reverse-order disposer stack used by editor composition roots.
constructor EditorLifecycleStack(): EditorLifecycleStackmethod add(disposer: (): void): voidAdds one owned resource disposer in acquisition order.
method dispose(): voidRuns every disposer in reverse order and continues cleanup after individual failures.
- classPlugin
-
class Plugin<SearCoreType, NodeTypeProperties, PluginStateType>Base contract implemented by sheet and document plugins.
Plugins own their state, declare lifecycle hooks, transform transactions into state, and render scene nodes for their host core. Runtime packages should extend this contract rather than reaching into Core internals.
constructor Plugin<SearCoreType, NodeTypeProperties, PluginStateType>(__namedParameters: PluginSpec<PluginStateType>): Plugin<SearCoreType, NodeTypeProperties, PluginStateType>Creates a plugin with its stable identity and initial state.
property readonly depth: numberDraw and event ordering hint; lower values run earlier.
property readonly documentState?: PluginDocumentStateContribution<PluginStateType, object> | readonly PluginDocumentStateContribution<PluginStateType, object>[]Document-state export modules owned by this plugin state.
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 pluginKey: PluginKeyStable plugin key used by PluginManager and SceneGraph ownership maps.
property readonly transactionHistory?: PluginTransactionHistoryAdapterOptional history behavior for transactions owned by this plugin.
property readonly transactionOT?: PluginTransactionOTContribution<OTOperation>Shared transaction algebra used by history and collaboration.
property readonly warnOnDuplicateDepth: booleanWhether PluginManager should warn when another ordered plugin shares this depth.
memberkey key: unknownmethod apply(pluginState: PluginStateType, transaction: Transaction): PluginStateType | nullApplies a transaction to plugin-owned state and returns the next state.
method dirtyRect(searCore: SearCoreType, transaction: Transaction): PositionRect<unknown> | null | undefinedOptional. Return the pixel-space dirty rectangle that needs to be redrawn after this plugin processes
transaction.When implemented,
SearCoreSheet.dispatchwill callmarkDirtywith the returned rect and skip a full-canvas re-render for this plugin. When omitted (or whennull/undefinedis returned), dispatch falls back to a full render pass.method enforceRuntimeWriteBoundary(assertWrite: (): void): voidInstalls the editor's command check for plugin-owned runtime sessions.
method enforceStateWriteBoundary(commitToken: object): voidRestricts state replacement to the owning editor's commit phase.
method getPluginConfig(searCore: SearCoreType): unknownReturns this plugin's runtime configuration view for the current core.
method getState(): PluginStateTypeReturns the plugin-owned state currently registered with the manager.
method hasStateWriteBoundary(): booleanReports whether the owning runtime has taken control of state replacement.
method lockCommittedState(state: PluginStateType): voidOptionally locks a committed plugin-owned local state value against retained handles.
method onClick(earCore: SearCoreType, event: EventWithOffsetAndTarget<NodeTypeProperties>): boolean | voidPlugin pointer event handlers.
Return value contract:
- Return
falseto stop subsequent plugins from handling the same event. - Return
true/undefined/voidto continue dispatching.
This mechanism allows a plugin to explicitly suppress downstream handlers after it has consumed an event, replacing the old coupled approach where one plugin directly modified another plugin's state.
method onDblClick(earCore: SearCoreType, event: EventWithOffsetAndTarget<NodeTypeProperties>): boolean | voidHandles a double-click pointer event.
method onInitialDataCell(searCore: SearCoreType, cell: unknown, row: number, col: number): voidReceives one non-empty cell during SearCoreSheet's shared startup scan. The scan runs once after every plugin state has been registered, so plugins can build derived indexes without independently traversing the whole sheet.
method onInitialDataComplete(searCore: SearCoreType): voidCalled after the final cell of the shared startup scan is delivered.
method onMouseDown(searCore: SearCoreType, event: EventWithOffsetAndTarget<NodeTypeProperties>): boolean | voidHandles the start of a pointer press sequence.
method onMouseMove(searCore: SearCoreType, event: EventWithOffsetAndTarget<NodeTypeProperties>): boolean | voidHandles pointer movement over the host surface.
method onMouseUp(searCore: SearCoreType, event: EventWithOffsetAndTarget<NodeTypeProperties>): boolean | voidHandles the end of a pointer press sequence.
method onResize(): voidOptional hook invoked when the host viewport or sheet dimensions change.
method onScroll(scrollManagerState: ScrollManagerState): voidReceives scroll state changes from the active scroll manager.
method onTransactionCommitted(transaction: Transaction): voidRuns only after every step in the enclosing pipeline has succeeded and all staged plugin state has been committed. Use it for derived caches, notifications, persistence, and transport; never perform those effects in apply, because a later pipeline step may still fail.
transactionA committed transaction from the completed pipeline.
method projectTransaction(state: PluginStateType, transaction: Transaction): readonly Transaction<Operation>[]Purely plans owner-targeted prerequisites before another owner's explicit transaction. Sheet runtimes stage these once, atomically with the original transaction, and retain them in the command pipeline for history and collaboration. Never mutate input state.
method registerConfig(): PluginConfigRegistration<Record<string, unknown>>[]Registers default configuration values owned by this plugin.
method registerState(): PluginStateRegistration<PluginStateType> | PluginStateRegistration<unknown>[]Registers one or more plugin-owned state records with the host manager.
method render(searCore: SearCoreType, offset?: { x: number; y: number }): Node<NodeTypeProperties> | Node<NodeTypeProperties>[] | nullProduces scene nodes owned by this plugin for the current core state.
method sealRuntimeMetadata(): voidFixes transaction and export metadata after the editor takes ownership.
method sealRuntimeMethods(): voidPins transaction and render hooks after plugin startup.
method sealRuntimeWrites(): voidCloses runtime-owned extension writes after every plugin has initialized and started.
method setState(state: PluginStateType, commitToken?: object): voidReplaces the plugin-owned state after an apply or runtime transition.
- classPluginKey
-
Stable unique key assigned to one plugin instance.
Plugin managers use this key to store state, render nodes, and diagnostics without requiring plugin classes to be singleton values.
constructor PluginKey(key?: string): PluginKeyConstructs a key using the provided base name.
keyHuman-readable plugin key prefix.
property readonly key: stringUnique plugin key string.
- classPluginManager
-
class PluginManager<SearCoreType, NodeTypeProperties>Ordered registry that owns plugin instances for one core/editor runtime.
constructor PluginManager<SearCoreType, NodeTypeProperties>(platform?: Platform): PluginManager<SearCoreType, NodeTypeProperties>Creates a PluginManager bound to the host diagnostics channel when available.
property readonly symbol: symbolstaticDI token for resolving the runtime plugin manager.
method clearPlugins(token?: object): voidRemoves all registered plugins during host teardown.
method enforceWriteBoundary(token: object): voidGives the owning runtime exclusive registry write access after assembly.
method forEach(callbackfn: (plugin: Plugin<SearCoreType, NodeTypeProperties, any>): void): voidVisits plugins in depth order so event, apply and render flows stay deterministic.
method getAllPlugins(): Plugin<SearCoreType, NodeTypeProperties, any>[]Returns all registered plugins in insertion order.
method getCollaborativeTransactionPlugin(ownerId: string): Plugin<SearCoreType, NodeTypeProperties, any> | undefinedResolves a stable collaboration owner to its editor-local plugin instance.
method getCollaborativeTransactionPlugins(): readonly Plugin<SearCoreType, NodeTypeProperties, any>[]Lists collaborative transaction owners registered in this runtime.
method getDocumentStateContributions(): readonly RegisteredPluginDocumentStateContribution[]Lists document-state export contributions registered by plugin state owners.
method getPluginState<T>(key: PluginKey): T | undefinedReturns the state owned by a registered plugin key, if present.
method getTransactionHistoryAdapter(transaction: Transaction): PluginTransactionHistoryAdapter | undefinedReturns the history adapter contributed by a transaction's state owner.
method getTransactionOTContribution(transaction: Transaction): PluginTransactionOTContribution<OTOperation> | undefinedReturns the shared transaction OT contribution for one local transaction owner.
method invertTransaction(transaction: Transaction): Transaction<Operation> | nullInverts a transaction through its owner's registered OT definition.
method registerPlugin<T>(plugin: Plugin<SearCoreType, NodeTypeProperties, T>, token?: object): voidRegisters a plugin under its key and rejects duplicate ownership.
method transformTransaction(transaction: Transaction, other: Transaction): Transaction<Operation> | nullRebases a retained transaction over another committed transaction through the shared registry.
method unregisterPlugin(pluginOrKey: string | PluginKey | Plugin<SearCoreType, NodeTypeProperties, any>, token?: object): voidUnregisters a plugin and clears the manager-owned state reference.
- interfacePluginSpec
-
interface PluginSpec<T>Immutable identity and initial state used to construct a plugin instance.
property key: PluginKeyStable key under which the plugin registers state, config and scene nodes.
property state: TInitial state owned by the plugin.
- typeEditorLifecycleErrorCode
-
type EditorLifecycleErrorCode = typeof EditorLifecycleErrorCode[keyof typeof EditorLifecycleErrorCode]EditorLifecycleErrorCode: { MultipleDisposalFailures: "SEAR_EDITOR_LIFECYCLE_MULTIPLE_DISPOSAL_FAILURES"; StackDisposed: "SEAR_EDITOR_LIFECYCLE_STACK_DISPOSED" }Stable machine-readable errors raised by editor lifecycle stacks.
- typePluginExtension
-
type PluginExtension = PluginCommandExtension<CommandBus> & conditional & conditional & conditional & conditionalMinimal host-extension contract shared by Sheet, Doc, and Workbook plugin types.
Host controls
- classHeadlessToolbar
-
class HeadlessToolbar extends SearToolbarToolbar implementation for hosts without a UI surface.
constructor HeadlessToolbar(): HeadlessToolbarproperty readonly symbol: symbolstaticDI token for resolving HeadlessToolbar.
method destroy(): voidReleases resources owned by SearToolbar.
method mount(_target: unknown): voidAttaches this adapter to its host surface.
- classSearFormulaBar
-
Platform-neutral lifecycle for a Sheet formula input surface.
constructor SearFormulaBar(): SearFormulaBarproperty readonly symbol: symbolstaticmethod destroy(): voidmethod mount(target: unknown): void - classSearToolbar
-
Platform-neutral toolbar lifecycle contract.
constructor SearToolbar(): SearToolbarproperty readonly symbol: symbolstaticDI token for resolving SearToolbar.
method destroy(): voidReleases resources owned by SearToolbar.
method mount(target: unknown): voidAttaches this adapter to its host surface.
Commands, queries, and observations
- interfacePluginCommandExtension
-
interface PluginCommandExtension<CommandBus>Plugin capability for registering typed commands against one host command bus.
method registerCommands(commands: CommandBus): voidRegisters every stable command id owned by this plugin.
- interfacePluginCommandRegistrar
-
interface PluginCommandRegistrar<CommandBus>Required-method view used by host assemblies when invoking command registration.
method registerCommands(commands: CommandBus): voidRegisters every stable command id owned by this plugin.
- interfacePluginObservationExtension
-
interface PluginObservationExtension<ObservationRegistry>Plugin capability for registering typed observations against one host observation registry.
method registerObservations(observations: ObservationRegistry): voidRegisters every typed state and event observation source owned by this plugin.
- interfacePluginObservationRegistrar
-
interface PluginObservationRegistrar<ObservationRegistry>Required-method view used by host assemblies when invoking observation registration.
method registerObservations(observations: ObservationRegistry): voidRegisters every typed state and event observation source owned by this plugin.
- interfacePluginQueryRegistrar
-
interface PluginQueryRegistrar<QueryRegistry> - functionhasPluginCommandRegistrar
-
hasPluginCommandRegistrar<CommandBus>(plugin: unknown): pluginReturns whether a plugin contributes command registration for the current host.
- functionhasPluginObservationRegistrar
-
hasPluginObservationRegistrar<ObservationRegistry>(plugin: unknown): pluginReturns whether a plugin contributes observation registration for the current host.
- functionhasPluginQueryRegistrar
-
hasPluginQueryRegistrar<QueryRegistry>(plugin: unknown): plugin
Plugin state and transactions
- interfacePluginConfigRegistration
-
interface PluginConfigRegistration<ConfigType>Default configuration contributed by one plugin during editor setup.
property readonly config: ConfigTypePlain configuration values consumed and wrapped by ConfigEngine.
property readonly key: PluginKeyPlugin key that owns this configuration unit.
- interfacePluginDataEngineRegistrationOptions
-
interface PluginDataEngineRegistrationOptions<PluginStateType>Controls whether a plugin state registration is exposed through DataEngine and data views.
property readonly dataView?: readonly PluginDataViewFieldRegistration<PluginStateType>[]Field selectors contributed by this state to named read-only data views.
property readonly enabled?: booleanWhen false, Core keeps the plugin private to PluginManager and skips DataEngine registration.
- interfacePluginDataViewFieldRegistration
-
interface PluginDataViewFieldRegistration<PluginStateType>Describes one plugin-owned field exposed to a named DataEngine read-only view.
property readonly fieldKey: stringField name written into the named view. Duplicate names in one view are rejected by DataEngine.
property readonly required?: booleanWhen false, a missing state or void field does not make the containing view unavailable.
property readonly select: (state: PluginStateType): unknownReads the field value from the current plugin-owned state whenever the view is requested.
property readonly viewKey: stringNamed data view that receives this field, such as a sheet-level read model.
- interfacePluginDocumentStateCodec
-
interface PluginDocumentStateCodec<TDocumentState>JSON-export codec shape supplied by a plugin-owned document-state module.
- interfacePluginDocumentStateContribution
-
interface PluginDocumentStateContribution<TOwnerState, TDocumentState>Document-state export contribution owned by one plugin state owner.
- interfacePluginStateRegistration
-
interface PluginStateRegistration<PluginStateType>State registration returned by plugins during editor initialization.
property readonly dataEngine?: PluginDataEngineRegistrationOptions<PluginStateType>DataEngine exposure metadata for this state registration.
property readonly key: PluginKeyPlugin key that owns the registered state.
property readonly state: PluginStateTypeState value to register for that plugin key.
- interfacePluginTransactionHistoryAdapter
-
Converts one plugin-owned transaction into history operations and rebases retained history over transactions that committed later.
method invert(transaction: Transaction): Transaction<Operation> | nullCreates the transaction that reverses the supplied committed transaction.
method transform(transaction: Transaction, other: Transaction): Transaction<Operation> | nullRebases a retained transaction over a transaction that committed later.
- interfacePluginTransactionHistoryOperations
-
Operation-level functions used to build one plugin-owned history adapter.
method invert(operations: Operation[]): Operation[]Reverses an operation list in rollback order.
method transform(operations: Operation[], other: Operation[]): Operation[]Rebases an operation list over operations that committed later.
- interfacePluginTransactionOTContribution
-
interface PluginTransactionOTContribution<OperationType>Transaction algebra and collaboration metadata contributed by one state owner.
property readonly collaborative?: booleanWhether committed transactions owned by this plugin may cross a collaboration transport.
property readonly definition: TransactionOTDefinition<OperationType>Versioned operation family used by history and collaboration.
property readonly ownerId: stringStable wire identity independent from process-local PluginKey suffixes.
property readonly relations?: readonly OTTransformRelation<OTOperation, OTOperation>[]Explicit relations needed by third-party operation families.
- interfaceRegisteredPluginDocumentStateContribution
-
Document-state export contribution bound to the plugin instance that owns the source state.
- typePluginDataViewFieldSelector
-
type PluginDataViewFieldSelector = { select: unknown }["select"]Controls whether a plugin state registration is exposed through DataEngine and collaboration.
- functionassertSheetContributionWrite
-
assertSheetContributionWrite(owner: object): voidChecks registration changes without adding work to query or planning paths.
- functioncreatePluginTransactionHistoryAdapter
-
createPluginTransactionHistoryAdapter(operations: PluginTransactionHistoryOperations): PluginTransactionHistoryAdapterCreates a transaction history adapter while preserving owner identity and metadata.
- functionsealSheetContributionWrites
-
sealSheetContributionWrites(owner: object, assertWrite: (): void): voidSeals setup-time Sheet contribution registries after editor startup.
Capabilities and session state
Capabilities expose editor-local services to plugins. Session state captures local UI state for restore without making it document content.
- classRuntimeCapabilityError
-
class RuntimeCapabilityError extends SearErrorPublic error raised when a runtime capability contract is violated.
constructor RuntimeCapabilityError(code: RuntimeCapabilityErrorCode, message: string, details?: SearErrorDetails): RuntimeCapabilityErrorproperty readonly code: RuntimeCapabilityErrorCodeStable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classRuntimeCapabilityRegistry
-
class RuntimeCapabilityRegistry extends RuntimeCapabilityReaderEditor-local registry shared by Sheet, Doc and Workbook assemblies.
constructor RuntimeCapabilityRegistry(owner?: string): RuntimeCapabilityRegistrymethod destroy(): voidPermanently closes the registry and releases all published values.
method enforceWriteBoundary(assertWrite: (): void): voidRequires editor command dispatch for capability changes after assembly.
method get<T>(capability: RuntimeCapability<T>): T | undefinedmethod getRegisteredCapabilityIds(): readonly string[]method has(capability: RuntimeCapability<unknown>): booleanmethod register<T>(capability: RuntimeCapability<T>, value: T): (): voidRegisters one value and returns an idempotent disposer for that registration.
method require<T>(capability: RuntimeCapability<T>): T - classSessionStateError
-
class SessionStateError extends SearErrorError raised when a session-state contributor violates its registry contract.
constructor SessionStateError(code: SessionStateErrorCode, message: string, details?: SearErrorDetails): SessionStateErrorCreates a session-state contract error.
property readonly code: SessionStateErrorCodeStable machine-readable error code.
Inherited members 9
Inherited from SearError.
- classSessionStateRegistry
-
Editor-local coordinator for all built-in and plugin-contributed session state.
constructor SessionStateRegistry(): SessionStateRegistryproperty readonly symbol: typeof symbolstaticDI token for resolving the editor-local registry.
method assertRestorationOpen(): voidRejects a retained contributor restore callback after editor initialization.
method capture(): SessionStateSnapshotCaptures every registered contributor while preserving state whose owner is not loaded.
method clear(lifecycleToken?: object): voidClears contributors and retained state owned by this registry instance.
method getCompletedRestorePhases(): readonly SessionStateRestorePhase[]Returns restore phases already completed by this editor lifecycle.
method getRegisteredStateIds(): readonly string[]Returns sorted ids for currently registered contributors.
method loadSnapshot(snapshot: SessionStateSnapshot): voidLoads a complete snapshot before lifecycle restoration begins.
method register<State>(definition: SessionStateDefinition<State>, adapter: SessionStateAdapter<State>): (): voidRegisters one state owner and returns an idempotent disposer.
method restorePhase(phase: SessionStateRestorePhase): voidRestores every registered contributor assigned to one ordered lifecycle phase.
method sealRestoration(lifecycleToken: object): voidCloses initialization-only restore operations for an assembled editor.
- interfacePluginRuntimeCapabilityExtension
-
interface PluginRuntimeCapabilityExtension<RuntimeCapabilityRegistry>Plugin capability for publishing typed editor-owned services to plugins and hosts.
method registerCapabilities(registry: RuntimeCapabilityRegistry): voidRegisters every runtime capability owned by this plugin.
- interfacePluginRuntimeCapabilityRegistrar
-
interface PluginRuntimeCapabilityRegistrar<RuntimeCapabilityRegistry>Required-method view used by host assemblies when invoking capability registration.
- interfacePluginSessionStateExtension
-
interface PluginSessionStateExtension<SessionStateRegistry>Plugin capability for registering editor-local session capture and restore behavior.
method registerSessionState(registry: SessionStateRegistry): voidRegisters every local session value owned by this plugin.
- interfacePluginSessionStateRegistrar
-
interface PluginSessionStateRegistrar<SessionStateRegistry>Required-method view used by host assemblies when invoking session-state registration.
method registerSessionState(registry: SessionStateRegistry): voidRegisters every local session value owned by this plugin.
- interfaceRuntimeCapability
-
interface RuntimeCapability<T>Typed token used to publish an editor-owned runtime service to plugins and hosts.
property readonly id: stringproperty readonly symbol: symbolproperty readonly type?: TPhantom member preserving the capability value type.
- interfaceRuntimeCapabilityReader
-
Read-only capability view exposed by an editor facade.
- interfaceSessionStateAdapter
-
interface SessionStateAdapter<State>Captures and restores one detached local session value.
property readonly restoreAfter?: readonly SessionStateDefinition<unknown>[]Contributors in the same phase that must restore before this one when they are registered.
property readonly restorePhase: SessionStateRestorePhaseLifecycle phase in which restore() may safely update the owning feature.
method capture(): State | undefinedReturns plain data or a supported built-in value; custom class instances are not session snapshots.
method restore(state: State): voidRestores local state during the declared lifecycle phase.
- interfaceSessionStateDefinition
-
interface SessionStateDefinition<State>Typed identity owned and exported by one local-state contributor.
property readonly id: stringStable, globally unique id used in the in-memory session snapshot.
property readonly stateType?: StateCompile-time state carrier; never populated at runtime.
- typeRuntimeCapabilityErrorCode
-
type RuntimeCapabilityErrorCode = typeof RuntimeCapabilityErrorCode[keyof typeof RuntimeCapabilityErrorCode]RuntimeCapabilityErrorCode: { InvalidDefinition: "SEAR_RUNTIME_CAPABILITY_INVALID_DEFINITION"; NotRegistered: "SEAR_RUNTIME_CAPABILITY_NOT_REGISTERED"; RegistrationConflict: "SEAR_RUNTIME_CAPABILITY_REGISTRATION_CONFLICT"; RegistryDestroyed: "SEAR_RUNTIME_CAPABILITY_REGISTRY_DESTROYED" }Supported runtime capability error codes.
- typeSessionStateErrorCode
-
type SessionStateErrorCode = typeof SessionStateErrorCode[keyof typeof SessionStateErrorCode]SessionStateErrorCode: { invalidDefinition: "SEAR_SESSION_STATE_INVALID_DEFINITION"; invalidRestoreDependency: "SEAR_SESSION_STATE_INVALID_RESTORE_DEPENDENCY"; invalidRestoreOrder: "SEAR_SESSION_STATE_INVALID_RESTORE_ORDER"; invalidRestorePhase: "SEAR_SESSION_STATE_INVALID_RESTORE_PHASE"; registrationConflict: "SEAR_SESSION_STATE_REGISTRATION_CONFLICT"; restoreDependencyCycle: "SEAR_SESSION_STATE_RESTORE_DEPENDENCY_CYCLE"; restoreInProgress: "SEAR_SESSION_STATE_RESTORE_IN_PROGRESS"; restorePhaseClosed: "SEAR_SESSION_STATE_RESTORE_PHASE_CLOSED"; … }Supported session-state error codes.
- typeSessionStateRestorePhase
-
type SessionStateRestorePhase = typeof SessionStateRestorePhase[keyof typeof SessionStateRestorePhase]SessionStateRestorePhase: { AfterInitialize: "afterInitialize"; BeforeInitialize: "beforeInitialize" }A supported local-state restoration phase.
- typeSessionStateSnapshot
-
type SessionStateSnapshot = Readonly<Record<string, unknown>>Opaque in-memory snapshot keyed by contributor-owned definition ids.
- functioncloneSessionStateValue
-
cloneSessionStateValue<T>(value: T): TCopies a session snapshot without trusting extension-provided clone hooks.
- functioncreateRuntimeCapabilityReader
-
createRuntimeCapabilityReader(registry: RuntimeCapabilityRegistry, hidden?: readonly RuntimeCapability<unknown>[]): RuntimeCapabilityReaderExposes selected capabilities without handing hosts the mutable registry itself.
- functiondefineRuntimeCapability
-
defineRuntimeCapability<T>(id: string): RuntimeCapability<T>Creates an immutable runtime capability definition with a stable process-wide identity.
- functiondefineSessionState
-
defineSessionState<State>(id: string): SessionStateDefinition<State>Creates an immutable typed identity for one local session value.
- functionhasPluginRuntimeCapabilityRegistrar
-
hasPluginRuntimeCapabilityRegistrar<RuntimeCapabilityRegistry>(plugin: unknown): pluginReturns whether a plugin publishes runtime capabilities for the current editor.
- functionhasPluginSessionStateRegistrar
-
hasPluginSessionStateRegistrar<SessionStateRegistry>(plugin: unknown): pluginReturns whether a plugin contributes local session-state registration for the current host.
- functionreadSessionState
-
readSessionState<State>(snapshot: SessionStateSnapshot, definition: SessionStateDefinition<State>): State | undefinedReads one contributor value from an opaque snapshot through its typed definition.
Move and reorder ranges
Feature contributions supply the analysis and operation needed to move state with a Sheet range.
- classSheetRangeMoveRegistry
-
Editor-local range-move planning extension point shared by state owners.
constructor SheetRangeMoveRegistry(): SheetRangeMoveRegistryproperty readonly symbol: typeof symbolstaticmethod analyze(context: SheetRangeMoveContext): SheetRangeMoveAnalysisAssesses all owner constraints without planning or publishing any mutation.
method destroy(): voidReleases all editor-owned registrations.
method hasConflict(context: SheetRangeMoveContext): booleanValidates all owners before testing destination conflicts.
method plan(context: SheetRangeMoveContext): readonly SheetRangeMovePlan[]Plans all owners against the same pre-move state.
method register(contribution: SheetRangeMoveContribution): (): voidRegisters one owner and returns an idempotent disposer.
- classSheetRangeMoveRejectedError
-
class SheetRangeMoveRejectedError extends SearErrorA rejected assessment retains the state owner's stable diagnostic code.
constructor SheetRangeMoveRejectedError(analysis: { context: SheetRangeMoveContext; issue: { code: string; details: SearErrorDetails; message: string; ownerId: string }; status: "blocked" }): SheetRangeMoveRejectedErrorCreates the command failure from the same assessment consumed by preview.
property readonly code: stringStable machine-readable identifier for this error category.
Inherited members 9
Inherited from SearError.
- classSheetStructureMoveRegistry
-
Editor-local preflight and operation planning for complete-axis moves.
constructor SheetStructureMoveRegistry(): SheetStructureMoveRegistryproperty readonly symbol: typeof symbolstaticmethod destroy(): voidReleases editor-owned contributions.
method plan(context: SheetStructureMoveContext): readonly Operation[]Validates the original intent before compiling dependent operation updates.
method register(contribution: SheetStructureMoveContribution): (): voidRegisters one contribution with order-independent, idempotent disposal.
- interfaceSheetMoveRange
-
Zero-based inclusive bounds of a cell range.
- interfaceSheetRangeMoveContext
-
Normalized source and destination of a same-sheet cell move.
property readonly destination: SheetMoveRangeproperty readonly source: SheetMoveRange - interfaceSheetRangeMoveContribution
-
A state owner's participation in range moves, independent of storage representation.
property readonly id: stringUnique registration identity, conventionally
<owner>.rangeMove; not a document field or operation target.method hasConflict(context: SheetRangeMoveContext): booleanReports whether destination data outside the source would be replaced.
method plan(context: SheetRangeMoveContext): readonly SheetRangeMovePlan[]Reads current state and produces an isolated operation plan.
method transformPlans(context: SheetRangeMoveContext, plans: readonly SheetRangeMovePlan[]): readonly SheetRangeMovePlan[]Rewrites plans after every state owner has contributed, for derived references.
method validate(context: SheetRangeMoveContext): voidReads owner-specific invariants without mutation; rejected constraints throw a SearError.
- interfaceSheetRangeMovePlan
-
Operations produced by one state owner without mutating its live state.
property readonly operations: readonly Operation[]property readonly target: PluginKey - interfaceSheetRangeReorderContext
-
One stable row permutation within an inclusive cell range.
property readonly destinationOf: (row: number): numberMaps a source row to its final row; columns never change.
property readonly range: SheetMoveRange - interfaceSheetRangeReorderContribution
-
State owners contribute atomic updates without exposing their matrices to the sorter.
- interfaceSheetRangeReorderPlan
-
property readonly operations: readonly Operation[]property readonly target: PluginKey - interfaceSheetRangeRuleEntry
-
interface SheetRangeRuleEntry<Rule>A feature-owned rule and the rectangle it covers.
property readonly range: SheetMoveRangeproperty readonly rule: Rule - interfaceSheetRangeRuleFragment
-
interface SheetRangeRuleFragment<Rule>One retained or relocated piece of an original rule.
- interfaceSheetRangeRuleMoveAdapter
-
interface SheetRangeRuleMoveAdapter<Rule>Feature-specific storage and operation mapping for splittable range rules.
property readonly id: stringmethod plan(context: SheetRangeMoveContext, affected: readonly SheetRangeRuleEntry<Rule>[], fragments: readonly SheetRangeRuleFragment<Rule>[]): readonly SheetRangeMovePlan[]method readRules(): readonly SheetRangeRuleEntry<Rule>[]method validate(context: SheetRangeMoveContext): void - interfaceSheetStructureMoveContext
-
One original-state structure permutation owned by a matrix plugin.
property readonly operations: readonly Operation[]property readonly target: PluginKey - interfaceSheetStructureMoveContribution
-
Owner-local validation and dependent edits compiled before a structure move is staged.
- typeSheetRangeMoveAnalysis
-
type SheetRangeMoveAnalysis = { context: SheetRangeMoveContext; status: typeof SheetRangeMoveStatus.Allowed | typeof SheetRangeMoveStatus.RequiresConfirmation } | { context: SheetRangeMoveContext; issue: { code: string; details: SearErrorDetails; message: string; ownerId: string }; status: typeof SheetRangeMoveStatus.Blocked }A move assessment contains no operations and never mutates document state.
- variableSheetRangeMoveStatus
-
SheetRangeMoveStatus: { Allowed: "allowed"; Blocked: "blocked"; RequiresConfirmation: "requiresConfirmation" }Canonical outcomes shared by move preview and execution.
- functioncreateSheetRangeRuleMoveContribution
-
createSheetRangeRuleMoveContribution<Rule>(adapter: SheetRangeRuleMoveAdapter<Rule>): SheetRangeMoveContributionCreates a range-move contribution for rules that can be split at cell boundaries.
- functionintersectSheetMoveRanges
-
intersectSheetMoveRanges(left: SheetMoveRange, right: SheetMoveRange): SheetMoveRange | nullReturns the shared inclusive area of two ranges, if any.
- functionisPointInSheetMoveRange
-
isPointInSheetMoveRange(range: SheetMoveRange, row: number, column: number): booleanTests inclusive range membership.
- functionsubtractSheetMoveRange
-
subtractSheetMoveRange(original: SheetMoveRange, cut: SheetMoveRange): SheetMoveRange[]Removes one inclusive rectangle, retaining at most four disjoint pieces.
- functiontranslateSheetMoveRange
-
translateSheetMoveRange(range: SheetMoveRange, source: SheetMoveRange, destination: SheetMoveRange): SheetMoveRangeTranslates a rule fragment by the source-to-destination displacement.
Transfer formats
Format transfer contributions copy feature-owned formatting alongside cell values.
- classSheetFormatTransferRegistry
-
Editor-local composition of state-owner format transfers.
constructor SheetFormatTransferRegistry(): SheetFormatTransferRegistryproperty readonly symbol: typeof symbolstaticmethod capture(source: SheetMoveRange): SheetFormatTransferSnapshotmethod capturePortable(source: SheetMoveRange): readonly SheetPortableFormatTransfer[]method clear(range: SheetMoveRange): readonly SheetFormatTransferPlan[]Plans all format owners against the same unchanged pre-clear state.
method destroy(): voidmethod planPortable(captured: readonly SheetPortableFormatTransfer[], destination: SheetMoveRange): readonly SheetFormatTransferPlan[]method register(owner: SheetFormatTransferContribution): (): void - interfaceSheetFormatMatrix
-
interface SheetFormatMatrix<Value>Sparse read contract implemented by feature-owned matrices.
- interfaceSheetFormatTransferContribution
-
Optional state-owner contribution to format painting.
property readonly id: stringmethod capture(source: SheetMoveRange): SheetFormatTransferSnapshotmethod clear(range: SheetMoveRange): readonly SheetFormatTransferPlan[]Plans removal of this owner's explicit formats without changing cell content.
method planCaptured(portable: unknown, destination: SheetMoveRange): readonly SheetFormatTransferPlan[]Plans a captured source pattern using this owner's current target state.
- interfaceSheetFormatTransferPlan
-
One owner's isolated plan; only the owner interprets its operations.
property readonly operations: readonly Operation[]property readonly target: PluginKey - interfaceSheetFormatTransferRegistrar
-
Optional plugin lifecycle extension for format-transfer registration.
- interfaceSheetFormatTransferSnapshot
-
Captured format data, independent of subsequent source changes.
property readonly portable?: unknownCaptured owner data that can be planned against another Sheet instance.
method plan(destination: SheetMoveRange, targetRegistry?: SheetFormatTransferRegistry): readonly SheetFormatTransferPlan[] - interfaceSheetPortableFormatTransfer
-
Serializable owner snapshot for a transient clipboard payload.
property readonly id: stringproperty readonly portable: unknown - typeSheetFormatRange
-
type SheetFormatRange = SheetMoveRangeInclusive range shared by format-transfer owners and hosts.
- functioncreateMatrixFormatTransfer
-
createMatrixFormatTransfer<Value>(id: string, target: PluginKey, readMatrix: (): SheetFormatMatrix<Value>): Required<SheetFormatTransferContribution>Captures sparse persisted formats and tiles them over an inclusive target.
No matching API entries.