← All packages

API reference

@searsuite/sear-domain-cell-types

Built-in cell identities and commit strategies for text, numbers, formulas, and rich text.

50 exportsderived from source

namespaceICellFormatLocaleProvidersource ↗
ICellFormatLocaleProvider: unknown

DI token for resolving the current sheet's cell-format locale provider.

variablesymbol
symbol: typeof symbol
enumSheetHorizontalAlignmentsource ↗
enum SheetHorizontalAlignment

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

enum memberCenter
Center: "center"
enum memberLeft
Left: "left"
enum memberRight
Right: "right"
enumSheetVerticalAlignmentsource ↗
enum SheetVerticalAlignment

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

enum memberBottom
Bottom: "bottom"
enum memberCenter
Center: "center"
enum memberTop
Top: "top"
classBooleanCellCommitStrategysource ↗
class BooleanCellCommitStrategy extends CellCommitStrategy

Recognizes directly entered spreadsheet logical literals.

constructorconstructor
BooleanCellCommitStrategy(): BooleanCellCommitStrategy
propertykey
readonly key: "boolean"

Stable identifier for this commit strategy.

propertypriority
readonly priority: 20

Ordering priority used when more than one strategy matches.

methodcommit
commit(context: CellCommitContext): CellMatrixElement

Converts matching edit input into a persisted cell value.

context: CellCommitContext
methodmatches
matches(context: CellCommitContext): boolean

Reports whether this strategy can commit the supplied input.

context: CellCommitContext
classCellClipboardCodecRegistrysource ↗
class CellClipboardCodecRegistry

Editor-local registry for cell-type-owned clipboard behavior.

constructorconstructor
CellClipboardCodecRegistry(): CellClipboardCodecRegistry
propertysymbolstatic
readonly symbol: typeof symbol
methoddecode
decode(payload: CellClipboardCellPayload, context: CellClipboardDecodeContext): CellMatrixElement | null
payload: CellClipboardCellPayload
context: CellClipboardDecodeContext
methoddecodePlainText
decodePlainText(text: string): CellMatrixElement | null
text: string
methodencode
encode(cell: CellMatrixElement): CellClipboardCellPayload
cell: CellMatrixElement
methodget
get(cellType: string): CellClipboardCodecDefinition | undefined
cellType: string
methodregister
register(codec: CellClipboardCodecDefinition): (): void
codec: CellClipboardCodecDefinition
methodtoPlainText
toPlainText(cell: CellMatrixElement): string
cell: CellMatrixElement
classCellCommitStrategysource ↗
class CellCommitStrategy extends CellCommitStrategyDefinition

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

constructorconstructor
CellCommitStrategy(): CellCommitStrategy
propertykey
readonly key: string

Stable identifier for this commit strategy.

propertypriority
readonly priority: number

Ordering priority used when more than one strategy matches.

methodcommit
commit(context: CellCommitContext): CellMatrixElement | null

Converts matching edit input into a persisted cell value.

context: CellCommitContext
methodmatches
matches(context: CellCommitContext): boolean

Reports whether this strategy can commit the supplied input.

context: CellCommitContext
classCellCommitStrategyRegistrysource ↗
class CellCommitStrategyRegistry

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

constructorconstructor
CellCommitStrategyRegistry(): CellCommitStrategyRegistry
propertysymbolstatic
readonly symbol: typeof symbol

DI token for resolving CellCommitStrategyRegistry.

methodcommit
commit(context: CellCommitContext): CellMatrixElement | null

Selects a matching strategy and commits the supplied edit input.

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

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

context: CellCommitContext
methodget
get(key: string): CellCommitStrategyDefinition | undefined

Returns the value.

key: string
methodgetAll
getAll(): readonly CellCommitStrategyDefinition[]

Returns the all.

methodregister
register(strategy: CellCommitStrategyDefinition): (): void

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

strategy: CellCommitStrategyDefinition
methodunregister
unregister(key: string): boolean

Unregisters the value.

key: string
classCellFormatTransferRegistrysource ↗
class CellFormatTransferRegistry

Editor-local cell-format codecs; unregistered types preserve their payload verbatim.

constructorconstructor
CellFormatTransferRegistry(): CellFormatTransferRegistry
propertysymbolstatic
readonly symbol: typeof symbol
methodapply
apply(cell: CellMatrixElement | null, format: Readonly<Record<string, unknown>>): CellMatrixElement | null
cell: CellMatrixElement | null
format: Readonly<Record<string, unknown>>
methodcapture
capture(cell: CellMatrixElement | null): Readonly<Record<string, unknown>>
cell: CellMatrixElement | null
methoddestroy
destroy(): void
methodregister
register(codec: CellFormatTransferCodec): (): void
codec: CellFormatTransferCodec
classDefaultStringCellCommitStrategysource ↗
class DefaultStringCellCommitStrategy extends CellCommitStrategy

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

constructorconstructor
DefaultStringCellCommitStrategy(): DefaultStringCellCommitStrategy
propertykey
readonly key: "fallback-string"

Stable identifier for the default string strategy.

propertypriority
readonly priority: 0

Ordering priority for the default string fallback.

methodcommit
commit(context: CellCommitContext): CellMatrixElement

Persists unmatched input as a string cell.

context: CellCommitContext
methodmatches
matches(): boolean

Matches input not claimed by a more specific strategy.

classEmptyCellCommitStrategysource ↗
class EmptyCellCommitStrategy extends CellCommitStrategy

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

constructorconstructor
EmptyCellCommitStrategy(): EmptyCellCommitStrategy
propertykey
readonly key: "empty"

Stable identifier for the empty-cell strategy.

propertypriority
readonly priority: 100

Ordering priority for empty input.

methodcommit
commit(): null

Converts empty input into an absent cell value.

methodmatches
matches(context: CellCommitContext): boolean

Reports whether the input should clear the cell.

context: CellCommitContext
classFormulaCellCommitStrategysource ↗
class FormulaCellCommitStrategy extends CellCommitStrategy

Recognizes formula source and normalizes it before persistence.

constructorconstructor
FormulaCellCommitStrategy(): FormulaCellCommitStrategy
propertykey
readonly key: "formula"

Stable identifier for the formula strategy.

propertypriority
readonly priority: 90

Ordering priority for formula input.

methodcommit
commit(context: CellCommitContext): CellMatrixElement

Persists formula source without evaluating it.

context: CellCommitContext
methodmatches
matches(context: CellCommitContext): boolean

Reports whether the input is formula source.

context: CellCommitContext
classNumberCellCommitStrategysource ↗
class NumberCellCommitStrategy extends CellCommitStrategy

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

constructorconstructor
NumberCellCommitStrategy(): NumberCellCommitStrategy
propertykey
readonly key: "number"

Stable identifier for the number strategy.

propertypriority
readonly priority: 10

Ordering priority for numeric input.

methodcommit
commit(context: CellCommitContext): CellMatrixElement

Persists input as a numeric cell.

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

Reports whether the input is a valid numeric value.

context: CellCommitContext
classRichTextCellCommitStrategysource ↗
class RichTextCellCommitStrategy extends CellCommitStrategy

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

constructorconstructor
RichTextCellCommitStrategy(): RichTextCellCommitStrategy
propertykey
readonly key: "richtext"

Stable identifier for the rich-text strategy.

propertypriority
readonly priority: 110

Ordering priority for rich-text input.

methodcommit
commit(context: CellCommitContext): CellMatrixElement

Persists a cloned rich-document snapshot.

context: CellCommitContext
methodmatches
matches(context: CellCommitContext): boolean

Reports whether the input is a rich-document snapshot.

context: CellCommitContext
classSheetCellInputValidationRegistrysource ↗
class SheetCellInputValidationRegistry

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

constructorconstructor
SheetCellInputValidationRegistry(): SheetCellInputValidationRegistry
propertysymbolstatic
readonly symbol: typeof symbol
methodbeginTeardown
beginTeardown(token: object): void

Allows owner-controlled cleanup after command dispatch has ended.

token: object
methodenforceCommandBoundary
enforceCommandBoundary(isExecuting: (): boolean, dispatchRemoval: (id: number): void, teardownToken: object): void

Closes direct writes once the editor finishes starting.

isExecuting: (): boolean
dispatchRemoval: (id: number): void
teardownToken: object
methodregister
register(id: string, validator: SheetCellInputValidator): (): void
id: string
validator: SheetCellInputValidator
methodunregister
unregister(registrationId: number): void

Removes one registration, dispatching through its command after assembly.

registrationId: number
methodvalidate
validate(row: number, column: number, text: string): SheetCellInputValidationResult
row: number
column: number
text: string
classSheetDisplayedValueChangessource ↗
class SheetDisplayedValueChanges

Editor-local fanout for changes to displayed cell values.

constructorconstructor
SheetDisplayedValueChanges(warn: (error: unknown): void): SheetDisplayedValueChanges
warn: (error: unknown): void
propertysymbolstatic
readonly symbol: typeof symbol
methoddispose
dispose(): void
methodenforceCommandBoundary
enforceCommandBoundary(isExecuting: (): boolean, runWithoutMutationAuthority: <Value>(callback: (): Value): Value): void

Seals publishing after startup while keeping host listeners outside command authority.

isExecuting: (): boolean
runWithoutMutationAuthority: <Value>(callback: (): Value): Value
methodpublish
publish(cells: readonly SheetDisplayedValueCoordinate[]): void
cells: readonly SheetDisplayedValueCoordinate[]
methodsubscribe
subscribe(listener: SheetDisplayedValueChangeListener): (): void
listener: SheetDisplayedValueChangeListener
classTextCellCommitStrategysource ↗
class TextCellCommitStrategy extends CellCommitStrategy

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

constructorconstructor
TextCellCommitStrategy(): TextCellCommitStrategy
propertykey
readonly key: "string"

Stable identifier for the explicit text strategy.

propertypriority
readonly priority: 80

Ordering priority for explicit text input.

methodcommit
commit(context: CellCommitContext): CellMatrixElement

Persists input as an explicit text cell.

context: CellCommitContext
methodmatches
matches(context: CellCommitContext): boolean

Reports whether the input is explicitly typed as text.

context: CellCommitContext
interfaceCellClipboardCellPayloadsource ↗
interface CellClipboardCellPayload

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

propertydata
readonly data: unknown
propertytype
readonly type: string
interfaceCellClipboardCodecDefinitionsource ↗
interface CellClipboardCodecDefinition

Clipboard behavior contributed by one persisted cell type.

propertycellType
readonly cellType: string
methoddecode
decode(data: unknown, context: CellClipboardDecodeContext): CellMatrixElement | null
data: unknown
context: CellClipboardDecodeContext
methoddecodePlainText
decodePlainText(text: string): CellMatrixElement | null
text: string
methodencode
encode(cell: CellMatrixElement): unknown
cell: CellMatrixElement
methodrebase
rebase(cell: CellMatrixElement, context: CellClipboardDecodeContext): CellMatrixElement
cell: CellMatrixElement
context: CellClipboardDecodeContext
methodtoPlainText
toPlainText(cell: CellMatrixElement): string
cell: CellMatrixElement
interfaceCellClipboardDecodeContextsource ↗
interface CellClipboardDecodeContext

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

propertycolumnDelta
readonly columnDelta: number
propertyrowDelta
readonly rowDelta: number
interfaceCellCommitContextsource ↗
interface CellCommitContext

Input available when the cell editor commits one edited cell.

propertycol
col: number
propertyformat
format?: CellFormat | null

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

propertyformatLocale
formatLocale?: CellFormatLocale

Locale used to interpret the formatted editor text.

propertyplainText
plainText: string
propertyprevious
previous: CellMatrixElement | null
propertyrichText
richText: RichDocNode[]
propertyrow
row: number
interfaceCellCommitStrategyDefinitionsource ↗
interface CellCommitStrategyDefinition

Contract for deciding how editor input becomes persisted cell data.

propertykey
readonly key: string
propertypriority
readonly priority: number
methodcommit
commit(context: CellCommitContext): CellMatrixElement | null
context: CellCommitContext
methodinferFormat
inferFormat(context: CellCommitContext): CellFormat | null
context: CellCommitContext
methodmatches
matches(context: CellCommitContext): boolean
context: CellCommitContext
interfaceCellFormatLocalesource ↗
interface CellFormatLocale

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

propertydatePattern
readonly datePattern: string
propertydateTimePattern
readonly dateTimePattern: string
propertydecimalSeparator
readonly decimalSeparator?: string
propertygroupSeparator
readonly groupSeparator?: string
propertylocale
readonly locale: string
propertytimePattern
readonly timePattern: string
interfaceCellFormatTransferCodecsource ↗
interface CellFormatTransferCodec

Type-owned format projection that never substitutes source values for target values.

propertycellType
readonly cellType: string
methodapply
apply(cell: CellMatrixElement, format: Readonly<Record<string, unknown>>): CellMatrixElement
cell: CellMatrixElement
format: Readonly<Record<string, unknown>>
methodcapture
capture(cell: CellMatrixElement): Readonly<Record<string, unknown>>
cell: CellMatrixElement
interfaceICellFormatLocaleProvidersource ↗
interface ICellFormatLocaleProvider

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

methodgetCellFormatLocale
getCellFormatLocale(): CellFormatLocale
interfaceSheetCellInputValidationResultsource ↗
interface SheetCellInputValidationResult

Result of validating a proposed cell edit.

propertymessage
readonly message?: string
propertyreject
readonly reject: boolean
propertyruleId
readonly ruleId?: string
propertyvalid
readonly valid: boolean
interfaceSheetDisplayedValueCoordinatesource ↗
interface SheetDisplayedValueCoordinate

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

propertycolumn
readonly column: number
propertyrow
readonly row: number
typeCellFormatsource ↗
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.

typeCellTypesource ↗
type CellType = typeof CellType[keyof typeof CellType]

Type contract for CellType.

typeSheetCellInputValidatorsource ↗
type SheetCellInputValidator = (row: number, column: number, text: string): SheetCellInputValidationResult
typeSheetDisplayedValueChangeListenersource ↗
type SheetDisplayedValueChangeListener = (cells: readonly SheetDisplayedValueCoordinate[]): void
variableCellFormatssource ↗
CellFormats: { date: { kind: "date" }; dateTime: { kind: "dateTime" }; general: { kind: "general" }; number: { kind: "number" }; percent: { kind: "percent" }; text: { kind: "text" }; time: { kind: "time" }; currency: unknown; … }
variableCellTypesource ↗
CellType: { Boolean: "boolean"; Empty: "empty"; Formula: "formula"; Number: "number"; RichText: "richtext"; String: "string" }

Built-in persisted cell type identifiers.

Consumers may use arbitrary strings for their own types; these constants keep the built-in values consistent across editing, rendering and formulas.

variableDefaultCellFormatLocalesource ↗
DefaultCellFormatLocale: CellFormatLocale

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

functionadjustCellFormatDecimalPlacessource ↗
adjustCellFormatDecimalPlaces(format: unknown, delta: number): CellFormat

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

format: unknown
delta: number
functionassertCellExtensionWritesource ↗
assertCellExtensionWrite(owner: object): void

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

owner: object
functionassertSheetHorizontalAlignmentsource ↗
assertSheetHorizontalAlignment(value: unknown): value

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

value: unknown
functionassertSheetVerticalAlignmentsource ↗
assertSheetVerticalAlignment(value: unknown): value

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

value: unknown
functioncellFormatToExcelCodesource ↗
cellFormatToExcelCode(format: unknown): string | undefined

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

format: unknown
functioncreateDefaultCellFormatLocaleProvidersource ↗
createDefaultCellFormatLocaleProvider(): ICellFormatLocaleProvider

Creates the default cell-format locale provider.

functioncreateGeneralNumberDisplayCandidatessource ↗
createGeneralNumberDisplayCandidates(value: number): readonly string[]

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

value: number
functionformatCellNumbersource ↗
formatCellNumber(value: number, format: unknown, locale?: CellFormatLocale): string

Runs the format cell number helper.

value: number
format: unknown
locale: CellFormatLocale
functionformatCellNumberDisplaysource ↗
formatCellNumberDisplay(value: number, format: unknown, locale?: CellFormatLocale): SpreadsheetFormatDisplay

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

value: number
format: unknown
locale: CellFormatLocale
functionformatCellTextsource ↗
formatCellText(value: string, format: unknown, locale?: CellFormatLocale): string

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

value: string
format: unknown
locale: CellFormatLocale
functioninterpretNumberInputsource ↗
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.

source: string
currentFormat: CellFormat | null | undefined
locale: CellFormatLocale
functionisSheetHorizontalAlignmentsource ↗
isSheetHorizontalAlignment(value: unknown): value

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

value: unknown
functionisSheetVerticalAlignmentsource ↗
isSheetVerticalAlignment(value: unknown): value

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

value: unknown
functionnormalizeCellFormatsource ↗
normalizeCellFormat(value: unknown): CellFormat

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

value: unknown
functionparseFormattedNumbersource ↗
parseFormattedNumber(text: string, format: unknown, locale?: CellFormatLocale): number | undefined

Runs the parse formatted number helper.

text: string
format: unknown
locale: CellFormatLocale
functionsealCellExtensionWritessource ↗
sealCellExtensionWrites(owner: object, assertWrite: (): void): void

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

owner: object
assertWrite: (): void
interfaceCellMatrixElementsource ↗
interface CellMatrixElement

Persisted cell payload stored in the sheet matrix.

propertyformula
formula?: string

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

propertyformulaEvaluationMode
formulaEvaluationMode?: "dynamic" | "legacy"

Array evaluation mode used when the formula was entered.

propertytype
type: string

Cell type identifier owned by the cell type catalog.

propertyvalue
value?: unknown

Raw value whose shape is owned by the cell type.