← All packages

@searsuite/sear-domain-cell-types

Cell values

CellType identifies the kind of stored value. The built-in commit strategies handle text, numbers, booleans, formulas, and rich text.

typeCellType
type CellType = typeof CellType[keyof typeof CellType] CellType: { Boolean: "boolean"; Empty: "empty"; Formula: "formula"; Number: "number"; RichText: "richtext"; String: "string" }
interfaceCellMatrixElement

Persisted cell payload stored in the sheet matrix.

propertyformula?: string

Formula source text for formula cells; calculated results live in formula plugin state.

propertyformulaEvaluationMode?: "dynamic" | "legacy"

Array evaluation mode used when the formula was entered.

propertytype: string

Cell type identifier owned by the cell type catalog.

propertyvalue?: unknown

Raw value whose shape is owned by the cell type.

Formatting and displayed values

Formatting turns a stored value into display text. CellFormat and the alignment values describe presentation without changing the underlying value.

interfaceICellFormatLocaleProvider
interface ICellFormatLocaleProvider ICellFormatLocaleProvider: unknown

Provides sheet-local defaults for number and date/time display formatting.

methodgetCellFormatLocale(): CellFormatLocale
variablesymbol
symbol: typeof symbol
enumSheetHorizontalAlignment

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

enum memberCenter: "center"
enum memberLeft: "left"
enum memberRight: "right"
enumSheetVerticalAlignment

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

enum memberBottom: "bottom"
enum memberCenter: "center"
enum memberTop: "top"
interfaceCellFormatLocale

Locale defaults used when a cell format does not declare explicit display settings.

interfaceSheetDisplayedValueCoordinate

A cell whose displayed value changed after a derived value update.

typeCellFormat
type CellFormat = { kind: "general" } | { kind: "text" } | { code: string; kind: "excelCode" } | { kind: "number"; locale?: string; maximumFractionDigits?: number; minimumFractionDigits?: number; useGrouping?: boolean } | { kind: "percent"; locale?: string; maximumFractionDigits?: number; minimumFractionDigits?: number } | { currency: string; kind: "currency"; locale?: string; maximumFractionDigits?: number; minimumFractionDigits?: number } | { kind: "date"; pattern?: string } | { kind: "time"; pattern?: string } | { kind: "dateTime"; pattern?: string }

Cell formatting changes input interpretation and display only, never the raw value for display purposes.

typeSheetDisplayedValueChangeListener
type SheetDisplayedValueChangeListener = (cells: readonly SheetDisplayedValueCoordinate[]): void
variableCellFormats
CellFormats: { date: { kind: "date" }; dateTime: { kind: "dateTime" }; general: { kind: "general" }; number: { kind: "number" }; percent: { kind: "percent" }; text: { kind: "text" }; time: { kind: "time" }; currency: unknown; … }
variableDefaultCellFormatLocale
DefaultCellFormatLocale: CellFormatLocale

Excel-compatible formatting defaults used when no i18n plugin is installed.

functionadjustCellFormatDecimalPlaces
adjustCellFormatDecimalPlaces(format: unknown, delta: number): CellFormat

Adjusts the visible decimal-place count of numeric built-in formats.

functionassertSheetHorizontalAlignment
assertSheetHorizontalAlignment(value: unknown): value

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

functionassertSheetVerticalAlignment
assertSheetVerticalAlignment(value: unknown): value

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

functioncellFormatToExcelCode
cellFormatToExcelCode(format: unknown): string | undefined

Converts an explicit cell format into the Excel-style code exposed to formula metadata readers.

functioncreateDefaultCellFormatLocaleProvider
createDefaultCellFormatLocaleProvider(): ICellFormatLocaleProvider

Creates the default cell-format locale provider.

functioncreateGeneralNumberDisplayCandidates
createGeneralNumberDisplayCandidates(value: number): readonly string[]

Returns General-format candidates from most informative to most compact.

functionformatCellNumber
formatCellNumber(value: number, format: unknown, locale?: CellFormatLocale): string
functionformatCellNumberDisplay
formatCellNumberDisplay(value: number, format: unknown, locale?: CellFormatLocale): SpreadsheetFormatDisplay

Formats one numeric cell and preserves format-section visual metadata.

functionformatCellText
formatCellText(value: string, format: unknown, locale?: CellFormatLocale): string

Applies the fourth custom-format section to a text cell.

functioninterpretNumberInput
interpretNumberInput(source: string, currentFormat: CellFormat | null | undefined, locale?: CellFormatLocale): { format?: CellFormat; value: number } | null

Parses direct numeric/date input and suggests a display format for General cells.

functionisSheetHorizontalAlignment
isSheetHorizontalAlignment(value: unknown): value

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

functionisSheetVerticalAlignment
isSheetVerticalAlignment(value: unknown): value

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

functionnormalizeCellFormat
normalizeCellFormat(value: unknown): CellFormat

Normalizes a public CellFormat object, falling back to General for invalid input.

functionparseFormattedNumber
parseFormattedNumber(text: string, format: unknown, locale?: CellFormatLocale): number | undefined

Input and commit

A commit strategy interprets an edit before it enters Sheet state. Input validators can reject values that do not meet a feature’s rule.

classBooleanCellCommitStrategy
class BooleanCellCommitStrategy extends CellCommitStrategy

Recognizes directly entered spreadsheet logical literals.

constructorBooleanCellCommitStrategy(): BooleanCellCommitStrategy
propertyreadonly key: "boolean"

Stable identifier for this commit strategy.

propertyreadonly priority: 20

Ordering priority used when more than one strategy matches.

methodcommit(context: CellCommitContext): CellMatrixElement

Converts matching edit input into a persisted cell value.

methodmatches(context: CellCommitContext): boolean

Reports whether this strategy can commit the supplied input.

classCellCommitStrategy
class CellCommitStrategy extends CellCommitStrategyDefinition

Base class for reusable strategies; plain definitions can also be registered.

constructorCellCommitStrategy(): CellCommitStrategy
propertyreadonly key: string

Stable identifier for this commit strategy.

propertyreadonly priority: number

Ordering priority used when more than one strategy matches.

methodcommit(context: CellCommitContext): CellMatrixElement | null

Converts matching edit input into a persisted cell value.

methodmatches(context: CellCommitContext): boolean

Reports whether this strategy can commit the supplied input.

classCellCommitStrategyRegistry

Extensible value-type registry. Hosts and plugins can add or replace input classifiers without coupling their domain types to the cell editor.

constructorCellCommitStrategyRegistry(): CellCommitStrategyRegistry
propertyreadonly symbol: typeof symbolstatic

DI token for resolving CellCommitStrategyRegistry.

methodcommit(context: CellCommitContext): CellMatrixElement | null

Selects a matching strategy and commits the supplied edit input.

methodcommitWithFormat(context: CellCommitContext): { cell: CellMatrixElement | null; format: CellFormat | null }

Commits a value and returns any format inferred by its owning strategy.

methodget(key: string): CellCommitStrategyDefinition | undefined
methodgetAll(): readonly CellCommitStrategyDefinition[]

Returns the all.

methodregister(strategy: CellCommitStrategyDefinition): (): void

Registers or replaces a strategy. The returned disposer restores the replaced strategy when this registration remains active.

methodunregister(key: string): boolean

Unregisters the value.

classDefaultStringCellCommitStrategy
class DefaultStringCellCommitStrategy extends CellCommitStrategy

Final fallback: persist otherwise-unclassified input as plain text.

constructorDefaultStringCellCommitStrategy(): DefaultStringCellCommitStrategy
propertyreadonly key: "fallback-string"

Stable identifier for the default string strategy.

propertyreadonly priority: 0

Ordering priority for the default string fallback.

methodcommit(context: CellCommitContext): CellMatrixElement

Persists unmatched input as a string cell.

methodmatches(): boolean

Matches input not claimed by a more specific strategy.

classEmptyCellCommitStrategy
class EmptyCellCommitStrategy extends CellCommitStrategy

Removes a cell when its editor document has no semantic text.

constructorEmptyCellCommitStrategy(): EmptyCellCommitStrategy
propertyreadonly key: "empty"

Stable identifier for the empty-cell strategy.

propertyreadonly priority: 100

Ordering priority for empty input.

methodcommit(): null

Converts empty input into an absent cell value.

methodmatches(context: CellCommitContext): boolean

Reports whether the input should clear the cell.

classFormulaCellCommitStrategy
class FormulaCellCommitStrategy extends CellCommitStrategy

Recognizes formula source and normalizes it before persistence.

constructorFormulaCellCommitStrategy(): FormulaCellCommitStrategy
propertyreadonly key: "formula"

Stable identifier for the formula strategy.

propertyreadonly priority: 90

Ordering priority for formula input.

methodcommit(context: CellCommitContext): CellMatrixElement

Persists formula source without evaluating it.

methodmatches(context: CellCommitContext): boolean

Reports whether the input is formula source.

classNumberCellCommitStrategy
class NumberCellCommitStrategy extends CellCommitStrategy

Infers numeric values after more-specific domain types have had a chance to match.

constructorNumberCellCommitStrategy(): NumberCellCommitStrategy
propertyreadonly key: "number"

Stable identifier for the number strategy.

propertyreadonly priority: 10

Ordering priority for numeric input.

methodcommit(context: CellCommitContext): CellMatrixElement

Persists input as a numeric cell.

methodinferFormat(context: CellCommitContext): CellFormat | null
methodmatches(context: CellCommitContext): boolean

Reports whether the input is a valid numeric value.

classRichTextCellCommitStrategy
class RichTextCellCommitStrategy extends CellCommitStrategy

Persists the document tree only when it contains durable inline/block semantics.

constructorRichTextCellCommitStrategy(): RichTextCellCommitStrategy
propertyreadonly key: "richtext"

Stable identifier for the rich-text strategy.

propertyreadonly priority: 110

Ordering priority for rich-text input.

methodcommit(context: CellCommitContext): CellMatrixElement

Persists a cloned rich-document snapshot.

methodmatches(context: CellCommitContext): boolean

Reports whether the input is a rich-document snapshot.

classSheetCellInputValidationRegistry

Editor-local validation contributions, evaluated before a cell edit commits.

classTextCellCommitStrategy
class TextCellCommitStrategy extends CellCommitStrategy

Handles explicit text input: Text-format cells and apostrophe-prefixed values.

constructorTextCellCommitStrategy(): TextCellCommitStrategy
propertyreadonly key: "string"

Stable identifier for the explicit text strategy.

propertyreadonly priority: 80

Ordering priority for explicit text input.

methodcommit(context: CellCommitContext): CellMatrixElement

Persists input as an explicit text cell.

methodmatches(context: CellCommitContext): boolean

Reports whether the input is explicitly typed as text.

interfaceCellCommitContext

Input available when the cell editor commits one edited cell.

propertycol: number
propertyformat?: CellFormat | null

Explicit format read from the Sheet cell-format state owner.

propertyformatLocale?: CellFormatLocale

Locale used to interpret the formatted editor text.

propertyplainText: string
propertyprevious: CellMatrixElement | null
propertyrichText: RichDocNode[]
propertyrow: number
interfaceSheetCellInputValidationResult

Result of validating a proposed cell edit.

typeSheetCellInputValidator
type SheetCellInputValidator = (row: number, column: number, text: string): SheetCellInputValidationResult
functionassertCellExtensionWrite
assertCellExtensionWrite(owner: object): void

Checks registration changes only; cell reads and rendering stay on their existing hot paths.

functionsealCellExtensionWrites
sealCellExtensionWrites(owner: object, assertWrite: (): void): void

Seals an editor-local cell extension owner after setup contributions are registered.

Clipboard transfer

Clipboard codecs preserve type-specific values when cells are copied and pasted.

interfaceCellClipboardCellPayload

JSON-safe representation owned by the cell type that produced it.

interfaceCellClipboardDecodeContext

Context used by a cell type when a native clipboard cell is pasted elsewhere.