/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import type { SheetBodyItem } from "./model.js"; import type { Placement } from "./transactions.js"; import type { SheetEditValue, SheetRowValue } from "./values.js"; export interface InsertionAnchor { /** Top-level identity, independent of source/viewport position. */ entry: string | undefined; /** A child's internal key; undefined means the summary or a flat entry. */ child?: string | undefined; /** A group's trailing blank row. */ tail?: boolean | undefined; side: "before" | "after"; } export interface InsertRequest { kind: "row" | "group"; anchor: InsertionAnchor; } /** * Where an insertion at a row's seam goes — the one anchor the seam's chips, * the keys and a drop (#1187) insert at: beside a line, in its group; at a * group's end, on its blank line; beside a row or a band; at the sheet's * end, on blank padding. * * @param item - The row-space item at the seam * @param side - Which side of it * @returns The anchor */ export declare function anchorAt(item: SheetBodyItem | undefined, side: "before" | "after"): InsertionAnchor; /** * Whether a row inserted at an anchor is a LOOSE row between the groups * (#846) rather than a line: beside a loose row, at the seam above a group's * band, or on a sheet with no rows yet. Below a band is the group's first * line; a line's seam and a group's blank line insert lines. * * @param anchor - Where the row goes * @param rows - The rows on screen, in order * @returns `true` when the new row stands on its own between the groups */ export declare function insertsLoose(anchor: InsertionAnchor, rows: readonly SheetRowValue[]): boolean; /** Group insertions snap around whole groups, never split a child array. */ export declare function groupInsertionSide(row: SheetRowValue, anchor: InsertionAnchor): "before" | "after"; /** * Build one wire gesture; constructors and draft decoding still run at the * common transaction boundary. * * @param request - What to insert, and where * @param rows - The rows on screen, in order * @param positionOf - A row's position by its index — a failed window before it counts (#853) * @param grouped - Whether the rows are groups * @param keyed - Whether the source is keyed * @param makeEntry - Mints a new entry's id * @param makeChild - Mints a new line's key in a group * @param loose - Whether rows may stand between the groups (#846): a row inserted where {@link insertsLoose} says is a loose row, not a line * @returns The gesture, or `undefined` when its anchor is gone */ export declare function insertionGesture(request: InsertRequest, rows: readonly SheetRowValue[], positionOf: (index: number) => number, grouped: boolean, keyed: boolean, makeEntry: () => string, makeChild: (group: SheetRowValue) => string, loose?: boolean): { event: SheetEditValue; placement?: Placement; id: string; child?: string; } | undefined; //# sourceMappingURL=insertion-gesture.d.ts.map