/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type CardRoles, type DetailsRoles, type ItemRoles, type LinkRoles, type NetRoles, type SchematicDrawn, type SchematicRef, type ZoneRoles } from "./canvas/drawn.js"; import { DraftedStanding, type DraftedRow } from "../shared/schedule/drafted-rows.js"; import type { SchematicHeldRows, SchematicWindowRows } from "./data.js"; /** * One sort's drafts: by each kind's slot, then by key — the drafted row, or `undefined` for one its draft deletes. A * drafted row's `began` — the roles of the row its session began from — is where a kind read by area's paged Backlog * lists it, by its stored place (`backlog.ts`, #1393). */ export type SortDrafts = ReadonlyMap | undefined>>; /** Every kind's drafts, by sort. */ export interface SchematicDrafts { /** The item kinds'. */ readonly items: SortDrafts; /** The zone kinds'. */ readonly zones: SortDrafts; /** The link kinds'. */ readonly links: SortDrafts; /** The net kinds'. */ readonly nets: SortDrafts; } /** No drafts. */ export declare const NO_DRAFTS: SchematicDrafts; /** * What a confirmed Save landed of a row of a kind read by area (`EditSession.landed`): the row as the Save left it, drawn * so until the reads of its kind are from after the commit (see the module docs). */ export interface LandedRow { /** The row as the Save left it, as the drawing takes a drafted row; `undefined` for one it deleted. */ readonly drawn: DraftedRow | undefined; /** Its bytes as the Save left it, as a window holds a row; `undefined` for one it deleted. */ readonly row: Uint8Array | undefined; /** * The revision the Save's request was drafted at: a record still read there holds the row as it stood before. * `undefined` for a row held from none (`LandedEntry.from`). */ readonly from: string | undefined; } /** One sort's landed rows: by each kind's slot, then by key. */ export type SortLanded = ReadonlyMap>>; /** What Saves landed of the kinds read by area, by sort: the sorts a kind is read by area of. */ export interface SchematicLanded { /** The item kinds'. */ readonly items: SortLanded; /** The zone kinds'. */ readonly zones: SortLanded; } /** Nothing landed. */ export declare const NO_LANDED: SchematicLanded; /** What a drafted row was drawn as, by the roles it was drawn from: kept while they are, and its details' and what of them is unread. */ export type DraftedCache = WeakMap; /** * The drawing with the drafts in place (see the module docs). * * @param stored - What the reader drew of the stored rows * @param held - Each kind's rows the read holds, and their details' roles * @param drafts - Every kind's drafts * @param cache - What each drafted row was drawn as, kept across calls * @param windowed - The kinds read by area, by slot (#1393): a drafted row of one its window doesn't hold draws * @param leftOut - Whether the hidden narrowing leaves out a drafted row of a kind read by area its window doesn't hold, as * the row its session began from answers (`drafts-narrowing.ts`): it waits in its session; none while nothing does * @param standing - Which drafted rows draw, and what the canvas last drew, which this drawing replaces: the canvas's * own, kept while it is mounted; one that remembers nothing unless given * @returns The drawing; the stored one itself while nothing is drafted */ export declare function draftedDrawing(stored: SchematicDrawn, held: SchematicHeldRows, drafts: SchematicDrafts, cache: DraftedCache, windowed?: ReadonlySet, leftOut?: (ref: SchematicRef) => boolean, standing?: DraftedStanding): SchematicDrawn; /** * The drafted rows the drawing leaves out, each waiting in its session — a * narrowing leaves out the row it drafts (see the module docs) — made as * their kinds draw them: what Issues checks beside the drawing, so an unsaved * change carries no issue unseen, wherever it is drawn or not (ruled 27 Oct * 2026, "Checked in view, said so"). Never the canvas's: what the narrowing * hides is drawn nowhere. An item with no position draws nothing here, as on * the canvas; a row its draft deletes is no row. * * @param held - Each kind's rows the read holds * @param drafts - Every kind's drafts * @param windowed - The kinds read by area, by slot, as {@link draftedDrawing} takes them * @param leftOut - Whether the hidden narrowing leaves out a drafted row of a kind read by area its window doesn't hold, as * {@link draftedDrawing} takes it * @param standing - Which drafted rows draw, as the drawing of these drafts told it ({@link draftedDrawing}); one that * remembers nothing unless given * @returns The rows, each kind's in its drafts' order — no row while every draft draws */ export declare function waitingDrafts(held: SchematicHeldRows, drafts: SchematicDrafts, windowed?: ReadonlySet, leftOut?: (ref: SchematicRef) => boolean, standing?: DraftedStanding): SchematicDrawn; /** * The drawing with the drafted rows it leaves out beside it ({@link waitingDrafts}): what Issues checks and names. * * @param drawn - The drawing, the drafts drawn in place * @param waiting - The drafted rows it leaves out * @returns Both, each sort's drawn entities first; the drawing itself while none waits */ export declare function withWaiting(drawn: SchematicDrawn, waiting: SchematicDrawn): SchematicDrawn; /** * Where a drafted row waiting in its session stands, as its draft places it: what the camera looks at as Go to issue * goes to it (#1391) — an item's centre; a zone's box's centre, its anchor; a link's or a net's members' box's centre, * each member where the drawing or a waiting row places it. * * @param id - The row's id * @param waiting - The drafted rows waiting in their sessions ({@link waitingDrafts}) * @param drawn - The drawing, the drafts drawn in place * @returns Its point; `undefined` for an id no waiting row has, and for a link or a net none of whose members is placed */ export declare function waitingPoint(id: string, waiting: SchematicDrawn, drawn: SchematicDrawn): { readonly x: number; readonly y: number; } | undefined; /** * The drafts with what confirmed Saves landed of the kinds read by area laid under them (see the module docs): over a * window read before the revision its record reads at now — or none, its read failed and what was drawn of it standing * — every row the Saves landed, as they left it, one they deleted drawing nowhere; over a window read at it, only a row * it holds none of, which the Index, its read perhaps older, lists where the Save left it. A draft of a row made since * draws in its place. * * @param drafts - Every kind's drafts * @param landed - What Saves landed of the kinds read by area * @param windows - Each kind read by area's window, at the revision it was read at * @param now - The revision each kind read by area's record reads at now, by its slot (`data.ts`' `revisions`) * @returns The drafts, each kind's landed rows after its own; the drafts themselves while nothing is laid */ export declare function landedDrafts(drafts: SchematicDrafts, landed: SchematicLanded, windows: SchematicWindowRows, now: ReadonlyMap): SchematicDrafts; /** * Each kind read by area's window with what Saves landed of it in place while the window is from before them: each row * as the Save left it, and none of one it deleted. Details reads a row of a kind read by area from its window * (`inspector-rows.ts`), so its fields never show the row as it stood before the Save; a window read since holds the * rows itself. * * @param windows - Each kind read by area's window * @param landed - What Saves landed of the kinds read by area * @param now - The revision each kind read by area's record reads at now, by its slot * @returns The windows; themselves while none is from before a Save */ export declare function landedWindows(windows: SchematicWindowRows, landed: SchematicLanded, now: ReadonlyMap): SchematicWindowRows; /** * What Saves landed that the reads draw now, which their sessions let go (`EditSession.shown`): every landed row of a * kind whose window is read at the revision its record reads at now — and the Index's read of it too, where the Index * reads the kind. Over a window from before them, or none, its read failed, they draw as landed still. * * @param landed - What Saves landed of the kinds read by area * @param windows - Each kind read by area's window * @param index - The revision the Index read each kind it lists at (`index-area.ts`); none for a kind it reads none of * @param now - The revision each kind read by area's record reads at now, by its slot * @returns Each such kind's landed keys, by slot */ export declare function landedRead(landed: SchematicLanded, windows: SchematicWindowRows, index: ReadonlyMap, now: ReadonlyMap): ReadonlyMap; //# sourceMappingURL=drafted.d.ts.map