/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * Saving edits: a gesture's cell writes into the local layer as wire events — a row's commits, a new row, a group's lines — * its rows removed, and a proposed row inserted. The session records the events as one step once the gesture ends. * * @packageDocumentation */ import { type RefObject } from "react"; import type { EditSource } from "./sheet-state.js"; import type { SheetCellValue, SheetEditValue } from "./values.js"; import type { SheetDecode } from "./use-decode.js"; import type { SheetSession } from "./use-session.js"; import type { SheetBody } from "./use-body.js"; /** * One cell write the component turns into a wire event; `extra` names the k-th * NEW row a write lands on past a group's blank line (a paste, #740 G9), or * past a loose row (#846 — a paste, a proposal). `key` names the write's * column in place of `c`, the grid's: a proposed row's cell under a column * the grid hides lands too (#1186). */ export interface CellWrite { r: number; c: number; key?: string | undefined; cell: SheetCellValue; extra?: number | undefined; /** Written though its column is not the viewer's to edit: a band cell an action's `updates` sets (#1477). */ force?: boolean | undefined; } /** * Writes a gesture's edits into the local layer, as the session's events (see the module docs). * * @param sheetDecode - The decoded columns, layout, callbacks, narrowing and row source * @param sheetSession - The store, the lens, the paging, the session and the rows * @param sheetBody - The body, the row space and the cells at each place * @returns The writes, the removal and the proposals' inserts */ export declare function useSheetWrites(sheetDecode: SheetDecode, sheetSession: SheetSession, sheetBody: SheetBody): { gestureEvents: RefObject; deleteRows: (r0: number, r1: number) => { n: number; what: "rows" | "lines" | "groups"; emptiedBandR: number | undefined; }; emitEdit: (edit: SheetEditValue) => void; failed: (error: unknown) => void; insertLooseProposals: (afterR: number, proposals: readonly { cells: ReadonlyMap; }[]) => string[]; insertProposal: (afterR: number, cells: ReadonlyMap, extra?: number) => { id: string; r: number; } | undefined; writeCells: (writes: readonly CellWrite[], source: EditSource) => { firstInserted: number | undefined; ids: string[]; refused?: boolean; }; }; /** What {@link useSheetWrites} gives the parts after it. */ export type SheetWrites = ReturnType; //# sourceMappingURL=use-writes.d.ts.map