/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * Presentation and local discard of a sheet's schema-checked drafts — an * entry's, or one line of a group's — over the shared draft presentation * (`src/editing/draft.ts`, #879). * * @packageDocumentation */ import { type EastType } from "@elaraai/east"; import { type DraftPresentation as EntryPresentation } from "@elaraai/east-ui-components/internal"; import { type BatchReadiness } from "@elaraai/east-ui-components"; import type { SheetTransactions } from "./transactions.js"; import { type SheetWords } from "./words.js"; /** How a row presents: its draft's presentation — none for a row nobody drafted — and its numbers outside their bounds. */ export interface DraftPresentation extends EntryPresentation { /** * Each number the row holds outside its field's bounds (#1585), by the cell it is drawn in, and what it says there: * the cells that wear the warn wash a field still missing wears — any row's, a stored one nobody changed among them. * None for none. */ readonly bounds?: ReadonlyMap | undefined; } /** * Derive row affordances from the exact draft schema and acknowledged * baseline. The issues are the sheet's words (#861): the renderer's own read * back from their canonical English, an author's as written. * * @param session - The editing session * @param type - The entry's draft type — on a sheet with loose rows (#846), the variant of a group and a row * @param field - A group's children field * @param id - The entry * @param child - A line's key * @param readiness - The session's readiness, for the author's issues * @param words - The sheet's words * @returns The presentation */ export declare function draftPresentation(session: SheetTransactions, type: EastType, field: string | undefined, id: string, child?: string, readiness?: BatchReadiness, words?: SheetWords): DraftPresentation; /** * How many fields a draft changes against the one its entry began from: a * struct's fields counted one by one, any other draft as one field. * * @param type - The entry's draft type * @returns The count, from the draft the entry began from and the draft as it stands */ export declare function draftChanges(type: EastType): (before: unknown, current: unknown) => number; /** * Discard only a never-applied row/group or child, as one ordinary undoable gesture — and only while no request for * its source is unresolved: a row the session has sent may have landed, and put back to nothing it would be a removal * to save, never a draft dropped. * * @param session - The editing session * @param type - The entry's draft type — on a sheet with loose rows (#846), the variant of a group and a row * @param field - A group's children field * @param id - The entry * @param child - A line's key * @returns Whether the draft was discarded */ export declare function discardDraft(session: SheetTransactions, type: EastType, field: string | undefined, id: string, child?: string): boolean; //# sourceMappingURL=draft-state.d.ts.map