/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The pointer and the keyboard: the ring following a host's controlled selection, a press, a drag and a hover on a cell, * the grid's keys — the history's, ⏎ on an action cell, a phone's paging of the columns, the machine's — and the clipboard. * * @packageDocumentation */ import { type MouseEvent, type KeyboardEvent, type ClipboardEvent } from "react"; import type { ActionCase } from "./actions/model.js"; import type { SheetActionHost } from "./actions/host.js"; import type { StripModel } from "./Strip.js"; import type { SheetDecode } from "./use-decode.js"; import type { SheetSession } from "./use-session.js"; import type { SheetBody } from "./use-body.js"; import type { SheetMachine } from "./use-machine.js"; import type { SheetEffects } from "./use-effects.js"; import type { SheetGestures } from "./use-gestures.js"; /** The action cells' calls as the sheet stands (#1475): made afresh each render, read through a ref by the one host. */ export interface SheetActionApi extends Omit { /** ⏎ on an action cell (K2). */ enter: (r: number, key: string) => void; /** Take a case with its value at a cell — on a range down its column, every row of it (T8) — as one transaction (T1); `false` where a row may not take it. */ take: (r: number, key: string, c: ActionCase, value: unknown) => boolean; /** Take a case with its value on rows, as one transaction. */ takeOn: (rs: readonly number[], key: string, c: ActionCase, value: unknown) => boolean; /** The strip over an action (R2, R3), where it shows one. */ strip: () => StripModel | undefined; /** What taking a case with a value would write, worded (F8). */ consequence: (c: ActionCase, value: unknown) => string; /** Close the overlay (K6). */ close: () => void; /** What taking a case with a value at a row would write, worded. */ consequenceAt: (r: number, key: string, c: ActionCase, value: unknown) => string; /** What a case's form opens with at a row (F10). */ initial: (r: number, key: string, c: ActionCase) => unknown; } /** * Turns the pointer, the keys and the clipboard into the machine'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 * @param sheetMachine - The machine's context and dispatch * @param sheetEffects - The effect runner and what its effects reach * @param sheetGestures - The history's runner, the discard and the insertion * @returns The cells' and the grid's handlers */ export declare function useSheetInput(sheetDecode: SheetDecode, sheetSession: SheetSession, sheetBody: SheetBody, sheetMachine: SheetMachine, sheetEffects: SheetEffects, sheetGestures: SheetGestures): { actionApi: import("react").RefObject; onCellDouble: (r: number, c: number) => void; onCellDown: (r: number, c: number, e: MouseEvent) => void; onCellEnter: (r: number, c: number) => void; onCopy: (e: ClipboardEvent) => void; onFillRow: () => void; onGridLeave: () => void; onKeyDown: (e: KeyboardEvent) => void; onPaste: (e: ClipboardEvent) => void; onProposalAccept: (i: number) => void; onProposalPick: (i: number) => void; onProposalReject: (i: number) => void; onRowPick: (r: number, e: MouseEvent) => void; onTake: (key: string) => void; ringGesture: (seeks?: boolean) => void; }; /** What {@link useSheetInput} gives the parts after it. */ export type SheetInput = ReturnType; //# sourceMappingURL=use-input.d.ts.map