/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type CellRef, type EditBuffer, type SheetEffect, type SheetEvent, type SheetMachineCtx, type SheetUiState, type Transition } from "./sheet-types.js"; import type { SheetCellValue } from "./values.js"; export * from "./sheet-types.js"; export { nextTargetOf, fillOrder, anchorRow } from "./sheet-suggest-state.js"; export { withBuffer } from "./sheet-link-state.js"; /** * The text a register-kind commit takes: the member a gesture chose, by its * key; else the armed candidate's key when a ghost or a stepped candidate * applies; else the words typed, which the parse resolves (#1536). */ export declare function commitText(edit: EditBuffer, ctx: SheetMachineCtx): string; /** * The cell the open editor would commit — what the copilot runs against * (`null` = a blank, `undefined` = unrecognised, nothing to run against). */ export declare function provisionalCell(edit: EditBuffer, ctx: SheetMachineCtx): SheetCellValue | null | undefined; /** * The pure transition function: `(state, event, ctx) → { state, effects }`. * * @param s - The current UI state * @param e - The interaction event * @param ctx - What the transition may ask about the sheet * @returns The next state plus the effects the component must run */ export declare function sheetReducer(s: SheetUiState, e: SheetEvent, ctx: SheetMachineCtx): Transition; /** The one `useReducer` store: UI state + the effect batch. */ export interface SheetStore { ui: SheetUiState; /** The latest effectful event's batch — replaced per such event. */ fx: readonly SheetEffect[]; /** Bumps when an event yields effects; the component's drain gates on it. */ fxSeq: number; } /** Everything the store reducer handles. */ export type SheetAction = { t: "event"; e: SheetEvent; ctx: SheetMachineCtx; } /** A direct UI patch from the component (the range after a paste, a message). */ | { t: "patch"; patch: Partial; }; /** * The initial store — `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 initialSheetStore(sel?: CellRef, active?: string | null, folds?: ReadonlyMap, ringless?: boolean): SheetStore; /** * The store transition — pure: StrictMode double-invokes reducers, so the * effect batch rides the returned store and is run by the component's * seq-gated drain, never from inside a reducer. */ export declare function sheetStoreReducer(store: SheetStore, a: SheetAction): SheetStore; //# sourceMappingURL=sheet-state.d.ts.map