/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { DraftedStanding, type DraftedRow, type DraftedRows } from "../shared/schedule/drafted-rows.js"; import type { FlowchartDecisionRoles, FlowchartKindKeys, FlowchartLaneRoles, FlowchartRow, FlowchartRows, FlowchartStateRoles, FlowchartTransitionRoles } from "./model.js"; import { type FlowchartHeld, type FlowchartSort } from "./read.js"; /** One kind's drafts, by key: the drafted row, or `undefined` for one its draft deletes. */ export type KindDrafts = DraftedRows; /** Every kind's drafts. */ export interface FlowchartDrafts { /** The states'. */ readonly states: KindDrafts; /** The transitions'. */ readonly transitions: KindDrafts; /** The lanes'. */ readonly lanes: KindDrafts; /** The decisions'. */ readonly decisions: KindDrafts; } /** No drafts. */ export declare const NO_DRAFTS: FlowchartDrafts; /** * What a confirmed Save landed of a row of a kind read through its source (`EditSession.landed`): the row as the Save * left it, standing so until the stored rows are read since (see the module docs). */ export interface LandedRow { /** The row as the Save left it, as the model takes a drafted row; `undefined` for one it deleted. */ readonly drawn: DraftedRow | undefined; /** The revision the Save's request was drafted at; `undefined` for a row held from none (`LandedEntry.from`). */ readonly from: string | undefined; } /** One kind's landed rows, by key. */ export type KindLanded = ReadonlyMap>; /** What Saves landed of each kind: none of a kind read whole, whose session is over its record's snapshot. */ export interface FlowchartLanded { /** The states'. */ readonly states: KindLanded; /** The transitions'. */ readonly transitions: KindLanded; /** The lanes'. */ readonly lanes: KindLanded; /** The decisions'. */ readonly decisions: KindLanded; } /** Nothing landed of a kind. */ export declare const NONE_LANDED: KindLanded; /** Nothing landed. */ export declare const NO_LANDED: FlowchartLanded; /** A drafted row of one kind waiting in its session, drawn nowhere: its kind, its key and its roles. */ interface Waiting { /** Its kind. */ readonly sort: S; /** Its key. */ readonly key: string; /** Its drafted roles. */ readonly roles: R; } /** A drafted row waiting in its session, drawn nowhere: its kind, its key and its roles, as its kind reads them. */ export type FlowchartWaiting = Waiting<"states", FlowchartStateRoles> | Waiting<"transitions", FlowchartTransitionRoles> | Waiting<"lanes", FlowchartLaneRoles> | Waiting<"decisions", FlowchartDecisionRoles>; /** Which stored rows the narrowing's shown keys leave out, under `"dim"`: by kind, whether a key draws as context. */ export interface FlowchartDimmed { /** A state drawn as context. */ readonly states?: ((key: string) => boolean) | undefined; /** A transition drawn as context. */ readonly transitions?: ((key: string) => boolean) | undefined; } /** The records with the drafts in place, and the drafts drawn nowhere. */ export interface FlowchartDraftedRows { /** What the model is made from. */ readonly rows: FlowchartRows; /** The transitions held but hidden with their far end, their drafts in place: what a state's Del deletes beside those drawn. */ readonly hidden: readonly FlowchartRow[]; /** The drafted rows waiting in their sessions, each kind's in its drafts' order: what Issues checks beside the drawing. */ readonly waiting: readonly FlowchartWaiting[]; } /** * The records with the drafts in place (see the module docs). * * @param held - Each kind's stored rows the read holds * @param hiddenWith - The transitions hidden with their far end * @param drafts - Every kind's drafts * @param keys - Each kind's keys (#1549), which the model orders each kind's rows by * @param dimmed - Which stored rows the narrowing leaves out, under `"dim"` * @param standing - Which drafted rows stand, and what the canvas last drew, which these rows replace: the canvas's own, * kept while it is mounted; one that remembers nothing unless given * @returns The rows, and the drafts drawn nowhere */ export declare function draftedRows(held: FlowchartHeld, hiddenWith: ReadonlySet, drafts: FlowchartDrafts, keys: FlowchartKindKeys, dimmed?: FlowchartDimmed, standing?: DraftedStanding): FlowchartDraftedRows; /** * The drafts with what confirmed Saves landed laid under them (see the module docs): over a kind's stored rows read * before the revision its record reads at now, each row the Saves landed as they left it — one they deleted standing * nowhere, one they made standing though no stored row holds it. A draft of a row made since stands in its place, and * over stored rows read at that revision nothing is laid: they hold the Saves. * * @param drafts - Every kind's drafts * @param landed - What Saves landed of each kind * @param held - Each kind's stored rows the read holds * @param hiddenWith - The transitions hidden with their far end * @param revisions - The revision each kind's stored rows were read at (`read.ts`' `revisions`) * @param now - The revision each kind's record reads at now (`read.ts`' `now`) * @returns The drafts, each kind's landed rows after its own; the drafts themselves while nothing is laid */ export declare function landedDrafts(drafts: FlowchartDrafts, landed: FlowchartLanded, held: FlowchartHeld, hiddenWith: ReadonlySet, revisions: ReadonlyMap, now: ReadonlyMap): FlowchartDrafts; /** * What Saves landed that the stored rows hold now, which their sessions let go (`EditSession.shown`): every landed row * of a kind whose stored rows are read at the revision its record reads at now. Over stored rows from before them, they * stand as landed still. * * @param landed - What Saves landed of each kind * @param revisions - The revision each kind's stored rows were read at * @param now - The revision each kind's record reads at now * @returns Each such kind's landed keys */ export declare function landedRead(landed: FlowchartLanded, revisions: ReadonlyMap, now: ReadonlyMap): ReadonlyMap; export {}; //# sourceMappingURL=drafted.d.ts.map