/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The state machine's vocabulary (`Sheet Spec.md` §6.1): the UI state, the * events the surface reports, the effects a transition returns as data, and * the context a transition may ask about the sheet. The transitions live in * `sheet-state.ts` (the core), `sheet-link-state.ts` (the link editor), * `sheet-suggest-state.ts` (the copilot) and `sheet-tabs-state.ts` (the view * tabs); every module imports its types from here so none imports another's * functions. * * @packageDocumentation */ import type { EditIssue } from "@elaraai/east-ui-components"; import type { SheetCandidate } from "./candidates.js"; import type { SheetKind } from "./model.js"; import type { SheetCellRefusalWord, SheetDropRefusalWord } from "./messages.js"; import type { ParseOutcome } from "./parse/index.js"; import type { LinkCandidate } from "./link/predict.js"; import type { LinkHalves } from "./link/sides.js"; import type { SheetCellValue, SheetMemberValue, SheetNounValue, SheetSavedView } from "./values.js"; /** What a row-space index holds: a row, a blank padding row, or a group summary. */ export type SheetRowKind = "row" | "blank" | "group"; /** The view tabs' own state (B§8); whether the active tab is dirty is derived by the component from the slice. */ export interface TabsState { /** The active view's id; `null` = the pinned whole-sheet tab. */ active: string | null; /** The next `view n` name's number. */ seq: number; /** The tab being renamed, if any. */ renaming: string | null; /** The rename buffer. */ renameVal: string; } /** The two halves' members. */ export type LinkGroups = [SheetMemberValue[], SheetMemberValue[]]; /** The link editor's own state — the two halves, the caret's half, the chip selection. */ export interface LinkEdit { /** Which half the caret is in: 0 = From, 1 = To. */ side: 0 | 1; /** The resolved members of each half. */ groups: LinkGroups; /** Whole-chip selection over the flat member list (From then To). */ chipSel: { anchor: number; focus: number; } | null; /** Bumps when the caret hops halves — the editor refocuses the active half. */ hop: number; } /** A cell position in the sheet's ROW space (bands and proposal rows are not rows). */ export interface CellRef { r: number; c: number; } /** The open editor. */ export interface EditBuffer { r: number; c: number; /** The typed text. */ val: string; /** The neg ring — the last commit attempt was unrecognised. */ err: boolean; /** The armed candidate (`-1` = nothing armed — an empty buffer offers a menu, arms nothing). */ hi: number; /** Opened by a printable key — caret at the end, nothing selected. */ seeded: boolean; /** The text the editor opened with, when it opened on the cell's own value (not a key, not a link) — a commit of that same text writes nothing (#852). */ opened?: string | undefined; /** * The register member a gesture chose, by its key (#1536): the cell's own as the editor opens on it, an option of * the menu, a strip chip, a candidate ⇥ or ⌘→ took. It commits as itself, so two members who show one label are * told apart; typing, or ⌥ stepping the candidates, lets it go. */ pick?: string | undefined; /** The link editor's state — present on a link / set column. */ link?: LinkEdit; } /** One pending fill — the cell the copilot proposes for a blank cell, with its provenance (B§5.1). */ export interface PendingFill { cell: SheetCellValue; /** The provenance line the strip prints. */ meta: string; /** The provider's position in the column's list — an earlier async provider that lands replaces a later one's fill. */ index: number; } /** One proposed row — the cells a patch set, with its provenance (B§5.2). */ export interface PendingRow { cells: ReadonlyMap; meta: string; } /** The copilot's pending suggestions for one anchor row (B§5). */ export interface Suggestions { /** The anchor row — a real row's id, or a blank row's synthetic id ({@link blankRowId}). */ anchorId: string; /** Pending fills by column key. */ fill: ReadonlyMap; /** Proposed rows below the anchor, at most `ahead`. */ rows: readonly PendingRow[]; /** Providers still in flight — a column key, or `"rows"` for a proposer. */ pending: readonly string[]; } /** What the planner rejected — remembered for the session so it is not offered again (B§5.2). */ export interface Rejections { /** `${anchorId}|${key}` — a fill dismissed on a row. */ fills: ReadonlySet; /** `${driverKey}>${driverKey}` — a proposed follower rejected after a driver value. */ follows: ReadonlySet; } /** * A row as a message names it (#861): a row by its number, or on a grouped * sheet a line by its number in its group (`title` its group's, `noun` the * host's word for a group) — worded at render. */ export type SheetRowRef = { line: false; number: number; } | { line: true; number: number; title: string | undefined; noun: string | undefined; }; /** * What a gesture leaves in the footer's `aria-live` line (#861): a message of * the Sheet's table by its id, with its parameters as data — counts raw, a * row as a {@link SheetRowRef}, a noun `undefined` where the host declares * none — so the reducer knows no locale; the footer words it (`noticeText`). * `issue` names the issue the history bar went to; `text` carries words that * are not the Sheet's own (an error a host's callback threw). */ export type SheetNotice = { id: "groupOpened" | "groupFolded"; noun: string | undefined; } | { id: "groupsOpened" | "groupsFolded"; n: number; noun: string | undefined; nouns: string | undefined; } | { id: "subRowsShownAll"; n: number; noun: string | undefined; } | { id: "subRowsHidAll"; noun: string | undefined; } | { id: "subRowsShown"; n: number; } | { id: "subRowsHid" | "rowLeft" | "columnLeft" | "tabReverted" | "proposalDeselected" | "rowFillDismissed" | "discarded" | "newRow"; } | { id: "membersAdded" | "membersRemoved" | "predictedTaken"; n: number; } | { id: "lockedHalf"; driver: string | undefined; } | { id: "tabSaved"; name: string; query: boolean; } | { id: "tabClosed"; name: string; active: boolean; } | { id: "tabUpdated"; name: string; } | { id: "fillTaken"; column: string; meta: string | undefined; } | { id: "rowFilled"; n: number; row: SheetRowRef; } | { id: "proposalTaken"; label: string | undefined; more: boolean; } | { id: "proposalRejected"; to: string | undefined; from: string | undefined; } | { id: "fillDismissed"; column: string; } | { id: "deleted"; n: number; what: "rows" | "lines" | "groups"; noun: string | undefined; nouns: string | undefined; again: boolean; } /** * A paste: `actions` the action cells it passed by, which take no paste (T7), `wrote` false when no cell took it, and * `refused` why the first cell it skipped was left as it was, where that is known. */ | { id: "pasted"; rows: number; cols: number; skipped: number; actions?: number | undefined; wrote?: boolean | undefined; refused?: SheetCellRefusalWord | undefined; } /** A clear that left `n` cells as they were beside the `cleared` ones it cleared, and why the first was left. */ | { id: "clearRefused"; n: number; cleared: number; word: SheetCellRefusalWord; } /** An edit its cell would not take — a lock come since it opened, a blank where the value is never empty, text a column from data can't hold — and why. */ | { id: "editRefused"; word: SheetCellRefusalWord; } | { id: "copied"; rows: number; cols: number; } | { id: "newGroup"; noun: string | undefined; } /** An issue gone to: where it is, as the sheet names it, and the issue — the note goes once the session no longer holds it. */ | { id: "issue"; where: string; issue: EditIssue; } /** A card's ⏎ refused below the ring's row (#1187, SB45): why. */ | { id: "dropRefused"; word: SheetDropRefusalWord; } /** A new entry's key the app's `newKey` gave is taken already (#1536): its text — the gesture drafted nothing. */ | { id: "keyTaken"; key: string; } /** The app's `newKey` threw (#1536): why — the gesture drafted nothing. */ | { id: "keyFailed"; reason: string; } /** * New rows given new keys, another write having added rows under the keys the sheet minted them (#1583): the first's * key and its new one, and how many. */ | { id: "renumbered"; from: string; to: string; n: number; } /** * A new entry the app's `newRow` or `newGroup` left a required field of empty, one no person can set (#1536): what * it would have been, the host's word for a group, and the field as the sheet labels it — the gesture drafted nothing. */ | { id: "cantAdd"; what: "row" | "line" | "group"; noun: string | undefined; label: string; } | { id: "text"; text: string; }; /** All ephemeral UI state — one object, one reducer. */ export interface SheetUiState { /** The ring. */ sel: CellRef; /** The range's far corner, when a range is active. */ selEnd: CellRef | null; /** The open editor. */ edit: EditBuffer | null; /** The hovered cell (the ✓ take button's home). */ hover: CellRef | null; /** The footer's `aria-live` line — the message the last gesture left (#861). */ msg: SheetNotice | null; /** Rows appended past the padding with ↓ on the last row. */ appended: number; /** The copilot's pending suggestions. */ sugg: Suggestions | null; /** The fill the planner armed with Tab — the next target while it is pending. */ armed: CellRef | null; /** The selected proposal row (its index under the anchor). */ gsel: number | null; /** The session's rejection memory. */ rejected: Rejections; /** A grouped sheet's fold overrides (#740): a group's or a line's id → folded (a line's `false`: its sub rows open). The open view keeps them; the narrowing itself is slice state, never held here. */ folds: ReadonlyMap; /** The view tabs. */ tabs: TabsState; /** * No ring is placed yet (#1531): a grid a host draws — the Record's — opens with none, and selects nothing. A press * places it, and so does the first move key, on the first row's first cell that edits in place; no other key acts. */ ringless: boolean; } /** A commit direction — where the ring goes after a commit. */ export type CommitDir = "right" | "left" | "down" | "stay" | "blur" | "cancel"; /** Every interaction the surface can report. */ export type SheetEvent = { t: "cell.down"; r: number; c: number; shift: boolean; } | { t: "cell.dbl"; r: number; c: number; } | { t: "cell.enter"; r: number; c: number; dragging: boolean; } /** The pointer left the grid: no cell is hovered, and a strip that previews the hovered cell returns to the ring's (#1531). */ | { t: "cell.leave"; } | { t: "row.pick"; r: number; shift: boolean; } | { t: "key"; key: string; shift: boolean; meta: boolean; alt: boolean; } | { t: "editor.change"; val: string; } | { t: "editor.key"; key: string; shift: boolean; meta: boolean; alt: boolean; atEnd: boolean; } | { t: "editor.blur"; } /** A strip chip: a candidate — its label, and its member's key — or a link chip's members. */ | { t: "strip.pick"; label: string; key?: string | undefined; i: number; members?: SheetMemberValue[]; } /** The combobox chose an option (#1536) — stepped to while browsing, or pressed: its member, in the words it shows. */ | { t: "editor.pick"; label: string; key: string; } /** A click in a link editor's half moves the caret there (the buffer resolves first). */ | { t: "half.down"; side: 0 | 1; } /** The controlled `selection` prop moved the ring — no `emit.select` echo. */ | { t: "select.set"; r: number; c: number; } /** A key's move the component finishes (#860): the ring lands where a `seek.step` or `seek.edge` was headed once its window arrives — reported and scrolled to, as a key's move is. */ | { t: "select.move"; r: number; c: number; } /** * The rows changed underneath (a new value, a landed window): clamp. * `moved` says where each row-space index from before now sits — a row * by its identity, a padding row by its place among the padding — so the * ring, a range, the editor, the hover and the armed fill follow their * rows when rows move under them: a window landing above, a new * revision, a host's write-back (#854). `null` for a row that LEFT the * row space: an editor on it closes, since it would sit over another row * and its text would land there (#877); every other place keeps its * index, clamped. `undefined` where nothing is known of the row. */ | { t: "rows.changed"; moved?: ((r: number) => number | null | undefined) | undefined; } /** * The columns the grid draws changed underneath: a phone's frame putting * the column it pins first, or back in its place; a column hidden or * shown. `moved` says where each column index from before now sits, by * the column's key, so the ring, a range, the editor, the hover and the * armed fill follow their columns: an editor left at its index would * write what was typed into the column now there. `null` for a column no * longer drawn: an editor on it closes, and every other place keeps its * index, clamped. */ | { t: "columns.changed"; moved: (c: number) => number | null; } | { t: "msg"; msg: SheetNotice; } | { t: "clipboard.copy"; } | { t: "clipboard.paste"; text: string; } /** The copilot runner's result for an anchor (`null` = nothing to suggest). */ | { t: "suggest.ready"; anchorId: string; sugg: Suggestions | null; } /** An async provider settled: a fill for a column (`null` = it yielded nothing), or a proposer's rows. */ | { t: "suggest.landed"; anchorId: string; key: string; fill?: PendingFill | null; rows?: PendingRow[]; } /** The anchor became a real row (a blank row's first write): the suggestions follow its new id. */ | { t: "suggest.rekey"; from: string; to: string; } /** Every suggestion dropped (a new source). */ | { t: "suggest.clear"; } /** ✓ on a fill, or its strip chip. */ | { t: "fill.take"; key: string; } /** The gutter's → button: fill the whole row. */ | { t: "fill.row"; } /** A click on a proposal row selects it. */ | { t: "proposal.pick"; i: number; } /** ✓ on a proposal row — takes the row fill and the proposals up to it. */ | { t: "proposal.take"; i: number; } /** × on a proposal row — rejects it and remembers the pairing. */ | { t: "proposal.reject"; i: number; } /** The slice's narrowing changed underneath the sheet: the ring returns to the top. */ | { t: "narrowing.changed"; } /** A tab is picked (`null` = the whole sheet): the leaving tab keeps its folds, an unsaved query is discarded. */ | { t: "tab.switch"; id: string | null; } /** A tab opens WITHOUT persisting the one it leaves — the initial `activeView`; `folds`, the ones the last session left on it, when newer than the view's (#857). */ | { t: "tab.open"; id: string; folds?: ReadonlyMap | undefined; } /** `+ TAB` — snapshot the current narrowing and folds as a view. */ | { t: "tab.create"; } /** × or a middle click — the active tab falls back to the sheet. */ | { t: "tab.close"; id: string; } /** ⏎ with a dirty tab: the tab now saves the current narrowing. */ | { t: "tab.update"; } /** esc with a dirty tab: the slice returns to the tab's saved narrowing. */ | { t: "tab.revert"; } | { t: "tab.rename.start"; id: string; } | { t: "tab.rename.change"; val: string; } | { t: "tab.rename.commit"; } | { t: "tab.rename.cancel"; } /** A tab dropped before the tab at `to` (`to` = the count appends). */ | { t: "tab.reorder"; id: string; to: number; } /** A key in the rail's search box the tabs claim: ⏎ updates a dirty tab; esc reverts a dirty tab, returns a clean one to the sheet, or clears the search. */ | { t: "search.key"; key: string; } /** The chevron, or Space with the ring on a band: the group folds or opens; `all` (⌥ on the chevron) applies the band's new state to every group. */ | { t: "fold.toggle"; r: number; all?: boolean; } /** The header corner's fold-all, or ⇧Space on a band: every group folds (`true`) or opens. */ | { t: "fold.all"; folded: boolean; } /** A line's chevron, or Space with the ring on a line that has sub rows (#844): they show or hide; `all` (⌥ on the chevron, ⇧Space) takes every line of its group the same way. */ | { t: "subRows.toggle"; r: number; all?: boolean; }; /** Where an edit came from (the wire `SheetSourceType` tags). */ export type EditSource = "typed" | "pasted" | "fill" | "row" | "pattern"; /** Side effects, returned as data — never performed in the reducer. */ export type SheetEffect = /** Write one cell (`null` = blank) — the component turns it into a commit or an insert. */ { t: "write"; r: number; c: number; cell: SheetCellValue | null; text: string; } /** Write several cells of one row — a fill taken (`fill`) or the whole row filled (`row`). */ | { t: "write.many"; r: number; writes: readonly { c: number; cell: SheetCellValue; }[]; source: EditSource; } /** The writes before it are one gesture and the writes after it another (#1531): a press that commits an open editor, then steps the cell it lands on, is two undo steps. */ | { t: "gesture.end"; } /** A press, ⏎ or F2 on a cell that edits out of place (#1531) — a Record's title: the host opens it where it edits it. */ | { t: "open"; r: number; c: number; } /** Insert proposed rows after the anchor, in order; `rest` re-anchors on the last one inserted. */ | { t: "insert.rows"; anchorR: number; rows: readonly PendingRow[]; rest: readonly PendingRow[]; } /** Clear a block of cells (stamped columns skipped by the component). */ | { t: "clear"; r0: number; r1: number; c0: number; c1: number; } /** Delete whole rows. */ | { t: "delete.rows"; r0: number; r1: number; } /** Copy a block. */ | { t: "copy"; r0: number; r1: number; c0: number; c1: number; } /** Paste text at a cell. */ | { t: "paste"; r: number; c: number; text: string; } | { t: "focus.sheet"; } | { t: "focus.editor"; selectAll: boolean; } /** The ring moved — `onSelect`. */ | { t: "emit.select"; r: number; c: number; } /** Bring a row into view. */ | { t: "scroll.to"; r: number; } /** * ↓ past the last resident row, or ↑ above the first, on a paged sheet * whose source goes on (#860): the component asks for the window beyond, * and the ring moves `dir` onto its row, at column `c`, once it lands. A * page (#1398, CL10) — PageDown past the last resident row, PageUp above * the first — says the row it pages from and how many rows a page moves: * the window a page on is asked for, and the ring lands there — fetch, * then move. */ | { t: "seek.step"; dir: 1 | -1; c: number; page?: { from: number; rows: number; } | undefined; } /** ⌘Home / ⌘End on a paged sheet not at that end (#860): the component jumps the source there, and the ring lands on its first or last row, at column `c`. */ | { t: "seek.edge"; edge: "first" | "last"; c: number; } /** Move the ring to a row by ID once the body has re-formed (a fold-all keeps the ring on its group's band). */ | { t: "select.id"; id: string; c: number; } /** Re-ask the copilot for the edited row after the kind's latency (`instant` = 150 ms). */ | { t: "schedule.suggest"; latency: "instant" | "idle"; } /** The views changed — `onViewsChange`. */ | { t: "emit.views"; views: readonly SheetSavedView[]; } /** Write the slice's narrowing — a tab switch, a revert, the whole sheet. */ | { t: "slice.write"; state: SheetSavedView["narrowing"]; } /** Focus the rail's search box (⌘/ · ⌘F). */ | { t: "focus.search"; }; /** What a transition may ask about the sheet — supplied with each event. */ export interface SheetMachineCtx { /** Rows in row space (real + blank). */ rowCount: number; /** Declared columns. */ colCount: number; /** A grouped sheet: its rows are groups — the records a lens narrows — with fold controls. */ grouped?: boolean; /** A lens narrows the sheet — ↓ on the last row must not append. */ lensActive: boolean; /** The inline arm, or an exhausted paged source — ↓ on the last row may append. */ canAppend: boolean; /** * Whether the row space holds the source's first and last rows (#860): on * a paged sheet an unloaded run lies past an end that is not, and a move * across it asks the component for its window (`seek.step`, `seek.edge`). * Absent ⇒ both ends are here (the inline arm). */ edges?: { atStart: boolean; atEnd: boolean; } | undefined; /** How many rows a page moves — the rows the frame shows (#860); absent ⇒ ten. */ pageRows?: (() => number) | undefined; /** Whether the cell may be edited (column editable, not stamped, sheet not read-only, row not owned where that matters). */ editableAt: (r: number, c: number) => boolean; /** The kind of the cell at a row and column — a band's cell under the column, else the column's. */ kindAt: (r: number, c: number) => SheetKind; /** * A cell that steps in place rather than open an editor (#1531) — a cycle, a toggle, a boolean: its state after a * step, the next (`1`), the one before (`-1`) or a cycle's first. `undefined` for any other cell, and absent on a * sheet whose cells all edit. */ stepAt?: ((r: number, c: number, step: 1 | -1 | "first") => SheetCellValue | undefined) | undefined; /** * Whether a cell steps in place, whether or not a step is there to take — given wherever {@link stepAt} is. A cycle * over a register with no members steps nowhere, and is no text to type into either: no editor opens on it. */ stepsAt?: ((r: number, c: number) => boolean) | undefined; /** The cell a key sets on a cell that steps in place (#1531): a cycle's member whose label, key or alias it is. */ keyAt?: ((r: number, c: number, key: string) => SheetCellValue | undefined) | undefined; /** * Whether a cell edits out of place (#1531) — a Record's title: a press, ⏎ or F2 opens it through the host * (`open`), and no editor opens on it. Absent on a sheet whose cells all edit in place. */ opensAt?: ((r: number, c: number) => boolean) | undefined; /** The strip previews the cell under the pointer (#1531): a key's move drops the hover, and the strip returns to the ring. */ previewsHover?: boolean | undefined; /** Parse a buffer for a cell. */ parse: (r: number, c: number, text: string) => ParseOutcome; /** The candidates for a buffer (the entry menu when empty). */ candidates: (r: number, c: number, text: string) => SheetCandidate[]; /** The armed candidate for a buffer, if any. */ candidateAt: (r: number, c: number, text: string, hi: number) => SheetCandidate | undefined; /** The cell's edit form. */ editTextAt: (r: number, c: number) => string; /** The key of the register member a cell holds (#1536): what its editor opens on, by the words the cell shows. */ memberAt?: ((r: number, c: number) => string | undefined) | undefined; /** The link editor's context for a link / set column (`undefined` on every other kind). */ linkAt?: (r: number, c: number) => LinkEditCtx | undefined; /** The row-space index of a row id — a real row's, or a blank row's synthetic id (`undefined` when not resident). */ rowOf?: (id: string) => number | undefined; /** The id at a row-space index — a real row's, or a blank row's synthetic id. */ idAt?: (r: number) => string | undefined; /** The column index of a key. */ columnOf?: (key: string) => number | undefined; /** The driver member key a row resolves to. */ driverKeyAt?: (r: number) => string | undefined; /** The driver column's key — a proposal's driver value sits under it. */ driverColumn?: string | undefined; /** The 1-based row number at a row-space index (the footer's messages). */ numberAt?: (r: number) => number; /** How the footer's messages name a row — a row, or on a grouped sheet a line of its group (#740, G3); worded at render (#861). */ rowRefAt?: (r: number) => SheetRowRef; /** A new view's name when there is no query to name it from (#861) — the sheet's words, stored with the view. */ viewName?: ((seq: number) => string) | undefined; /** The saved views, in order — the component's local layer over `views`. */ views?: readonly SheetSavedView[]; /** The slice's current narrowing (`undefined` without a bound slice). */ narrowing?: SheetSavedView["narrowing"] | undefined; /** The narrowing with nothing active — what the whole-sheet tab writes. */ emptyNarrowing?: SheetSavedView["narrowing"] | undefined; /** Whether the active tab's saved narrowing differs from the slice's — derived by the component. */ dirty?: boolean; /** What the row-space index holds (#740); absent ⇒ every index is a row or a blank. */ rowKindAt?: (r: number) => SheetRowKind | undefined; /** A group's band at a row-space index (#740): its id, its fold, and the row-space range of its lines (`undefined` when it has none or is folded). */ groupAt?: (r: number) => { id: string; folded: boolean; lines: { r0: number; r1: number; } | undefined; } | undefined; /** The columns one cell spans (#740): a band's title spans its first columns; `undefined` ⇒ one column. */ spanAt?: (r: number, c: number) => { c0: number; c1: number; } | undefined; /** Every group's id in sheet order, the ones a lens hides included: what fold-all folds. */ groupIds?: readonly string[] | undefined; /** Whether a row-space row is a LOOSE row between the groups (#846) — a grouped sheet's row that belongs to no group. */ looseAt?: ((r: number) => boolean) | undefined; /** The word the messages use for a group (#844) — the host's. */ groupNoun?: SheetNounValue | undefined; /** A line's SUB ROWS at a row-space index (#844): the line's id (the key they open under), how many, whether they show, and every line of its group that has sub rows. `undefined` = not a line, or a line with none. */ lineSubRowsAt?: ((r: number) => { id: string; count: number; open: boolean; group: readonly string[]; } | undefined) | undefined; } /** What the link editor asks about its cell — built by the component per render. */ export interface LinkEditCtx { /** The halves the row's driver makes live, and their lock tags. */ halves: LinkHalves; /** The cell's current members. */ initial: LinkGroups; /** The candidates for a buffer, members already in the cell excluded. */ candidates: (text: string, groups: LinkGroups) => LinkCandidate[]; /** The armed candidate. */ candidateAt: (text: string, hi: number, groups: LinkGroups) => LinkCandidate | undefined; /** What a buffer resolves to — the armed candidate when it completes the text, else the grammar. */ resolve: (text: string, cand: LinkCandidate | undefined) => SheetMemberValue[]; /** The predicted members for a half — the column's pending fill minus what the cell holds. */ predicted: (side: 0 | 1, groups: LinkGroups, typed: string) => SheetMemberValue[]; /** The cell for the halves — `null` when both are empty. */ cell: (groups: LinkGroups) => SheetCellValue | null; /** The driver member's name, for the hop-into-a-locked-half message — `undefined` when the row names none (#861: the words say "this row"). */ driverName: string | undefined; } /** One transition's result. */ export interface Transition { state: SheetUiState; effects: SheetEffect[]; } /** The empty rejection memory. */ export declare const NO_REJECTIONS: Rejections; /** No fold overridden. */ export declare const NO_FOLDS: ReadonlyMap; /** * The initial UI state — `active` is the initial view tab, if the sheet opens on one; `folds`, the fold overrides it * opens with (#857); `ringless`, whether it opens with no ring placed (#1531). */ export declare function initialSheetState(sel?: CellRef, active?: string | null, folds?: ReadonlyMap, ringless?: boolean): SheetUiState; /** Whether two cell refs name the same cell. */ export declare function same(a: CellRef, b: CellRef | null): boolean; /** Clamp a cell to the sheet. */ export declare function clamp(ref: CellRef, ctx: SheetMachineCtx): CellRef; /** The selection rectangle. */ export declare function selectionRect(s: Pick): { r0: number; r1: number; c0: number; c1: number; }; /** A range spanning every column is a row selection. */ export declare function wholeRows(s: Pick, colCount: number): { r0: number; r1: number; } | null; /** The synthetic id of a blank padding row at a sheet position — the copilot's anchor before the row is real. */ export declare function blankRowId(position: number): string; /** Whether an id names a blank padding row. */ export declare function isBlankRowId(id: string): boolean; //# sourceMappingURL=sheet-types.d.ts.map