/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** Seed new entries and children at the single gesture boundary. @packageDocumentation */ import { type EastType, type ValueTypeOf } from "@elaraai/east"; import { type SheetEditingType } from "@elaraai/e3-ui/internal"; import type { SheetNotice } from "./sheet-types.js"; import type { EntryVersion, Placement } from "./transactions.js"; import type { SheetRowValue } from "./values.js"; /** * A gesture the sheet refuses, and why, in the footer's words (#1536): a new entry whose key the app's `newKey` gives * taken already, a `newKey` that throws, or a new entry the app left a field of empty that no person can set. Thrown * where the gesture is built, before anything is drafted, so the gesture drafts nothing; the sheet says the notice, * and logs nothing. */ export declare class SheetRefused extends Error { /** What the footer says. */ readonly notice: SheetNotice; constructor(notice: SheetNotice); } type Editing = ValueTypeOf; type Prepared = { row: SheetRowValue; draft: unknown; previous: SheetRowValue | undefined; }; /** * Invoke constructors only for newly materialized values. The returned base * maps child drafts by internal key before the typed decoder consumes cells. * Undo/redo replay the saved value and never run a constructor again. * * On a source with LOOSE rows between its groups (#846) the draft is the * entry's — a variant: a wire row with no band is a loose row, seeded by * `newRow` at its entry placement; one with a band is a group. A new line * there gets its id field minted by `mint` unless `newRow` supplied one: it is * the same domain field a loose row is identified by, never the line's * identity. * * @param input - The gesture's wire row * @param current - The entry's version before this event * @param previousInput - The wire row an earlier event of the gesture left * @param place - The entry's placement * @param editing - The decoded editing declaration * @param draftType - The entry's draft type * @param mint - Mints a new line's id on a source with loose rows * @returns The wire row, its draft and the wire row the decoder reads child drafts by */ export declare function prepareCreation(input: SheetRowValue, current: EntryVersion, previousInput: SheetRowValue | undefined, place: Placement, editing: Editing, draftType: EastType, mint?: () => string): Prepared; /** * What a gesture's new entry — a row, a group, or a line of one — lacks that no person can set in the sheet (#1536): * the first of the declaration's `unsettable` fields its draft leaves missing, read as the gesture leaves it, so a * duplicate has its source's values. A new entry is one the gesture made, its lines new with it; a new line, one its * group did not hold before the gesture — a line moved in from another group brings its own draft. * * @param before - The entry's version before the gesture * @param after - Its version after it * @param editing - The decoded editing declaration * @param draftType - The entry's draft type * @returns What the new entry would have been, and the field's label — `undefined` when it lacks none */ export declare function unsetField(before: EntryVersion, after: EntryVersion, editing: Editing, draftType: EastType): { what: "row" | "line" | "group"; label: string; } | undefined; export {}; //# sourceMappingURL=creation.d.ts.map