← All packages

API reference

@searsuite/sear-sheet-editor-contract

Sheet-facing embedded rich-text editor contracts and test fakes without Doc-runtime dependencies.

31 exportsderived from source

namespaceSheetEmbeddedEditorsource ↗
SheetEmbeddedEditor: unknown

Static DI token for the Sheet-facing editor abstraction.

variablesymbol
symbol: symbol
classFakeSheetEmbeddedEditorsource ↗
class FakeSheetEmbeddedEditor extends SheetEmbeddedEditor

Small deterministic editor used by Sheet tests. It intentionally models only the contract boundary, making no assumptions about a concrete Doc runtime.

constructorconstructor
FakeSheetEmbeddedEditor(): FakeSheetEmbeddedEditor
propertycancelCount
cancelCount: number
propertycommittedDocuments
readonly committedDocuments: Schema[][]
propertydisposeCount
disposeCount: number
propertyeditContexts
readonly editContexts: SheetEmbeddedEditorContext[]
propertyinitializeCount
initializeCount: number
propertyinputs
readonly inputs: SheetEditInput[]
propertyobservations
readonly observations: ObservationRegistry

Typed editor-local state and event observations exposed to the host.

propertyrenderContexts
readonly renderContexts: SheetEmbeddedEditorContext[]
propertyrenderSessions
readonly renderSessions: FakeRenderSession[]
methodbindTeardownToken
bindTeardownToken(token: object): void

Restricts runtime teardown to the owning Sheet editor when supported.

token: object
methodcreateEditSession
createEditSession(context: SheetEmbeddedEditorContext): SheetEditSession
context: SheetEmbeddedEditorContext
methodcreateRenderSession
createRenderSession(context: SheetEmbeddedEditorContext): SheetRenderSession
context: SheetEmbeddedEditorContext
methoddispose
dispose(ownerToken?: object): void
ownerToken: object
methodinitialize
initialize(context: SheetEmbeddedEditorContext): void
context: SheetEmbeddedEditorContext
interfaceSheetCompositionInputsource ↗
interface SheetCompositionInput

IME composition lifecycle input delivered by the Sheet input adapter.

propertytext
readonly text?: string
propertytype
readonly type: "compositionStart" | "compositionUpdate" | "compositionEnd"
interfaceSheetCompositionStatesource ↗
interface SheetCompositionState

Current IME composition state in editor-local coordinates.

propertyactive
readonly active: boolean
propertyrect
readonly rect?: SheetEditorRect
propertytext
readonly text: string
interfaceSheetCursorStatesource ↗
interface SheetCursorState

A cursor rectangle in editor-local coordinates.

propertyrect
readonly rect: SheetEditorRect
propertyvisible
readonly visible?: boolean
interfaceSheetDeleteInputsource ↗
interface SheetDeleteInput

Text deletion delivered by the Sheet input adapter.

propertycount
readonly count?: number
propertydirection
readonly direction: "backward" | "forward"
propertytype
readonly type: "deleteContent"
interfaceSheetDocumentAccessorsource ↗
interface SheetDocumentAccessor

Reads a cell document and commits a new document through the Sheet boundary.

methodcommit
commit(document: SheetDocument): void
document: SheetDocument
methodread
read(): SheetDocument
interfaceSheetEditorGeometrysource ↗
interface SheetEditorGeometry

Cell geometry supplied by Sheet. The editor uses these functions for hit testing and drawing without knowing how the Sheet viewport is implemented.

propertycellRect
readonly cellRect: SheetEditorRect
propertyclipRect
readonly clipRect?: SheetEditorRect
propertycontainsPoint
readonly containsPoint?: (point: SheetEditorPoint): boolean
propertytoLocalPoint
readonly toLocalPoint: (point: SheetEditorPoint): SheetEditorPoint
propertytoSheetPoint
readonly toSheetPoint: (point: SheetEditorPoint): SheetEditorPoint
interfaceSheetEditorInvalidationsource ↗
interface SheetEditorInvalidation

A rectangle or semantic reason that should be redrawn by Sheet.

propertykind
readonly kind: "selection" | "composition" | "content" | "cursor" | "geometry" | "all"
propertyreason
readonly reason?: string
propertyrects
readonly rects?: readonly SheetEditorRect[]
interfaceSheetEditorPointsource ↗
interface SheetEditorPoint

A point in Sheet or editor-local coordinates.

propertyx
readonly x: number
propertyy
readonly y: number
interfaceSheetEditorRectsource ↗
interface SheetEditorRect

A rectangle in Sheet or editor-local coordinates.

propertyheight
readonly height: number
propertywidth
readonly width: number
propertyx
readonly x: number
propertyy
readonly y: number
interfaceSheetEditRenderOptionssource ↗
interface SheetEditRenderOptions

Per-frame options for painting an active Sheet edit session.

propertycursorVisible
readonly cursorVisible?: boolean

Whether the caret should be painted during this frame.

interfaceSheetEditSessionsource ↗
interface SheetEditSession

An active editing session for one Sheet cell document.

methodcancel
cancel(): void
methodcommit
commit(): readonly Schema[]
methoddispose
dispose(): void
methodgetComposition
getComposition(): SheetCompositionState | null
methodgetCursor
getCursor(): SheetCursorState | null
methodgetDocument
getDocument(): readonly Schema[]
methodgetSelection
getSelection(): SheetTextSelection | null
methodhandleInput
handleInput(input: SheetEditInput): SheetRenderUpdate
input: SheetEditInput
methodhandlePointer
handlePointer(input: SheetPointerInput): SheetRenderUpdate
input: SheetPointerInput
methodrender
render(renderContext?: RenderContext, options?: SheetEditRenderOptions): SheetRenderUpdate

Paints the current edited document, selection, cursor and composition.

renderContext: RenderContext
options: SheetEditRenderOptions
methodsetInlineStyle
setInlineStyle(update: SheetInlineStyleUpdate): SheetRenderUpdate
update: SheetInlineStyleUpdate
methodsetSelection
setSelection(selection: SheetTextSelection): SheetRenderUpdate
selection: SheetTextSelection
interfaceSheetEmbeddedEditorsource ↗
interface SheetEmbeddedEditor

Stable Sheet-facing embedded editor contract. Implementations own rich-text layout, painting, selection, cursor and IME behavior behind this boundary.

propertyformatting
readonly formatting?: { apply: unknown; capture: unknown }

Pure formatting projection; applying it returns a new snapshot without changing editor state.

propertyobservations
readonly observations: ObservationRegistry

Typed editor-local state and event observations exposed to the host.

methodbindTeardownToken
bindTeardownToken(token: object): void

Restricts runtime teardown to the owning Sheet editor when supported.

token: object
methodcreateEditSession
createEditSession(context: SheetEmbeddedEditorContext): SheetEditSession
context: SheetEmbeddedEditorContext
methodcreateRenderSession
createRenderSession(context: SheetEmbeddedEditorContext): SheetRenderSession
context: SheetEmbeddedEditorContext
methoddispose
dispose(ownerToken?: object): void
ownerToken: object
methodinitialize
initialize(context: SheetEmbeddedEditorContext): void
context: SheetEmbeddedEditorContext
interfaceSheetEmbeddedEditorContextsource ↗
interface SheetEmbeddedEditorContext

Context in which a Sheet cell editor renders and edits one cell document.

propertydefaultFontFamily
readonly defaultFontFamily?: string

Host-selected default font family for read-only Sheet cell rendering.

propertydefaultFontSize
readonly defaultFontSize?: number

Host-selected default font size for read-only Sheet cell rendering.

propertydocumentAccessor
readonly documentAccessor: SheetDocumentAccessor
propertygeometry
readonly geometry: SheetEditorGeometry
propertyinvalidate
readonly invalidate?: (invalidation: SheetEditorInvalidation): void
propertyisCommandExecuting
readonly isCommandExecuting?: (): boolean

Present in assembled Sheets to require command dispatch for edit-session mutations.

propertyrenderContext
readonly renderContext: RenderContext
interfaceSheetEmbeddedInlineStyleStatussource ↗
interface SheetEmbeddedInlineStyleStatus

Whether one inline style can be applied, is active, and has a common value.

propertyactive
readonly active: boolean
propertyenabled
readonly enabled: boolean
propertyvalue
readonly value: unknown

The common selected value, or null when unset or mixed.

interfaceSheetInlineStyleUpdatesource ↗
interface SheetInlineStyleUpdate

An inline style patch applied to the active text selection.

propertyattrs
readonly attrs: Readonly<Record<string, unknown>>
interfaceSheetInputModifierssource ↗
interface SheetInputModifiers

Modifier keys normalized by the Sheet host.

propertyaltKey
readonly altKey?: boolean
propertyctrlKey
readonly ctrlKey?: boolean
propertymetaKey
readonly metaKey?: boolean
propertyshiftKey
readonly shiftKey?: boolean
interfaceSheetKeyInputsource ↗
interface SheetKeyInput extends SheetInputModifiers

Keyboard input that the embedded editor may consume for navigation or editing.

propertycode
readonly code?: string
propertykey
readonly key: string
propertytype
readonly type: "keyDown"
Inherited members 4

Inherited from SheetInputModifiers.

interfaceSheetPointerHitsource ↗
interface SheetPointerHit

Result of pointer hit testing against the embedded document.

propertyposition
readonly position?: SheetTextPosition
propertyselection
readonly selection?: SheetTextSelection
propertytarget
readonly target: "text" | "empty" | "outside"
interfaceSheetPointerInputsource ↗
interface SheetPointerInput extends SheetInputModifiers

Pointer input normalized by the Sheet host.

propertybuttons
readonly buttons?: number
propertyclickCount
readonly clickCount?: number
propertypoint
readonly point: SheetEditorPoint
propertytype
readonly type: "pointerDown" | "pointerMove" | "pointerUp"
Inherited members 4

Inherited from SheetInputModifiers.

interfaceSheetRenderSessionsource ↗
interface SheetRenderSession

A retained render session for one Sheet cell document.

methoddispose
dispose(): void
methodhitTest
hitTest(input: SheetPointerInput): SheetPointerHit | null
input: SheetPointerInput
methodrender
render(renderContext?: RenderContext): SheetRenderUpdate

Paints the current document into the supplied render target.

renderContext: RenderContext
interfaceSheetRenderUpdatesource ↗
interface SheetRenderUpdate

State returned after a render or edit operation.

propertycomposition
readonly composition?: SheetCompositionState
propertycontentSize
readonly contentSize?: { height: number; width: number }
propertycursor
readonly cursor?: SheetCursorState
propertyinvalidation
readonly invalidation?: SheetEditorInvalidation
propertyneedsRedraw
readonly needsRedraw: boolean
propertyselection
readonly selection?: SheetTextSelection
interfaceSheetTextInputsource ↗
interface SheetTextInput

Text insertion delivered by the Sheet input adapter.

propertytext
readonly text: string
propertytype
readonly type: "insertText"
interfaceSheetTextPositionsource ↗
interface SheetTextPosition

A position in the rich document represented by a node path and text offset.

propertyoffset
readonly offset: number
propertypath
readonly path: readonly string | number[]
interfaceSheetTextSelectionsource ↗
interface SheetTextSelection

A text selection represented by anchor and head positions.

propertyanchor
readonly anchor: SheetTextPosition
propertyhead
readonly head: SheetTextPosition
typeSheetDocumentsource ↗
type SheetDocument = readonly SheetDocumentNode[]

A rich-document snapshot owned by the Sheet cell boundary.

typeSheetDocumentNodesource ↗
type SheetDocumentNode = Schema

A document node exchanged between a Sheet cell and an embedded editor.

typeSheetEditInputsource ↗
type SheetEditInput = SheetTextInput | SheetDeleteInput | SheetCompositionInput | SheetKeyInput

Input accepted by an active Sheet edit session.

typeSheetEmbeddedInlineStyleStatesource ↗
type SheetEmbeddedInlineStyleState = Readonly<Record<string, SheetEmbeddedInlineStyleStatus>>

Inline-style state exposed by a Sheet embedded editor while editing a cell.

Keys are plugin-owned persisted style keys (for example, bold or fontSize). Keeping the state keyed by the stable style key lets third-party inline-style extensions participate without changing this contract.

variableSheetEmbeddedInlineStyleObservationsource ↗
SheetEmbeddedInlineStyleObservation: StateObservationDefinition<Readonly<Record<string, SheetEmbeddedInlineStyleStatus>>>

Current inline-style availability and activation for the embedded selection.