/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. * * What the canvas hands the frame it renders in (#1193): the canvas itself, * for main, and the facts the frame's chrome is drawn from — the toolbar's * controls, the session the banners follow, the footer's items — so the * canvas draws no toolbar or foot of its own, and the frame places them (`Plan * Builder Spec.md` §7). The parts stay inside this package, as the Sheet's do. * * @packageDocumentation */ import type { ReactNode, RefObject } from "react"; import type { SystemStyleObject } from "@chakra-ui/react"; import type { ValueTypeOf } from "@elaraai/east"; import type { Plan } from "@elaraai/e3-ui/internal"; import type { EditIssue, EditSession, HistoryAction, HistoryBarProps, KeySearchSource, LandingAttributes, ToolbarItem } from "@elaraai/east-ui-components"; import type { LoadingLineValue } from "@elaraai/east-ui-components/internal"; import type { PlanScale } from "../scale.js"; import type { PlanGrain, RowKey } from "../plan-state.js"; import type { PlanEventEditing } from "../edit/events.js"; import type { PlanWords } from "../words.js"; import type { PlanEntryRef } from "../use-plan-editing.js"; import type { PlanDiagnostics } from "../shell/Diagnostics.js"; import type { PlanTransport } from "../shell/transport.js"; import type { ScheduleCellsRead } from "../../shared/schedule/cells.js"; import type { PlanCanvasInspect } from "./inspect.js"; import type { PlanEventPart, PlanSlicesChrome, PlanSourcePart } from "./sources.js"; import type { PlanWindowPart } from "./window.js"; type Styles = Record>; /** One decoded footer item of the author's. */ export type PlanFooterItemValue = ValueTypeOf; /** One session of the Plan's one history, as its banners show it (#1194). */ export interface PlanSessionBanner { /** Its key in the history. */ readonly key: string; /** The session. */ readonly session: EditSession; /** The source its banners name — an event kind's name; `undefined` for `data`'s, which names none. */ readonly name: string | undefined; /** Where one of its issues is, in the reader's words: `data`'s row, an event's title. */ readonly where: (issue: EditIssue) => string; /** Its banners' actions, on this session alone: Retry sends its request or reads its result again, Discard drops its drafts. */ readonly onAction: (action: HistoryAction) => void; } /** * What the frame draws of a run of the app's optimiser (#1409, #1419): the * eye's toolbar item before the history item, the banner for the banners * slot, the footer's line and legend, what flashes as a run lands, and the * landing — the frame's own element takes its ref, attributes and styles, * under which the cascade is measured and from which the bars' flares, the * glow and the counts' flash are drawn. */ export interface PlanOptimiseChrome { /** The eye's toolbar item; `undefined` with no optimiser. */ toolbarItem: ToolbarItem | undefined; /** The banner the result lands with. */ banner: ReactNode; /** The footer line while the call is out or just stopped. */ line: LoadingLineValue | undefined; /** Whether the legend's `Elara change` shows. */ legend: boolean; /** Whether a run has just landed: the footer's backlog count flashes. */ flash: boolean; /** Whether the latest run moved an event into or out of the backlog: the Backlog tab's count flashes. */ backlogFlash: boolean; /** The landing: the frame's ref, attributes and styles. */ landing: { ref: RefObject; attributes: LandingAttributes; css: SystemStyleObject; }; } /** The facts the frame's chrome is drawn from, in the canvas's words. */ export interface PlanChrome { /** The canvas's words: its locale and message table (#820). */ words: PlanWords; /** The canvas's resolved `plan` recipe styles. */ styles: Styles; /** The canvas's storage key. */ storageKey: string; /** The scale every row positions against: the window the counts are read over, and the active resolution. */ scale: PlanScale; /** The rail's chrome — the Plan's one `Slice.bindRecords` (#1344); `undefined` with no slice. */ slices: PlanSlicesChrome | undefined; /** The sources of the slice holding the window, in the slice's order — none of the canvas's rows' (#1344). */ windowParts: readonly PlanWindowPart[]; /** The leading one: its range editor is the time navigator's Range panel. */ lead: PlanWindowPart | undefined; /** * Moves the window `[min, max)`, on the axis's domain — a date the time * navigator picks: into every source holding it, else the canvas's own * (#1344), as the brush and the keys move it. */ moveWindow: (min: number, max: number) => void; /** The `rows` source's part, when the slice gives the canvas its rows. */ rowsPart: PlanSourcePart | undefined; /** Each event kind narrowed through its source: what its Save notice counts in. */ eventParts: readonly PlanEventPart[]; /** What the rail counts each source in, and heads it with folded, where the source has no label of its own. */ nouns: Readonly>; /** What the rail counts the rows in — `work orders`, `rows`: what the loading line and a failed run name them by (#1398). */ rowsNoun: string; /** Why the window could not be written into a source. */ windowError: string | undefined; /** The rail's affordance kinds. */ affordances: readonly string[]; /** The resolutions the resolution segment offers — `[]`, no segment. */ resolutions: readonly string[]; /** The active grain, when the canvas has a root group for it to fold: the GROUP · RESOURCE segment (#632). */ grain: PlanGrain | undefined; /** What the canvas says of its reads — a paged source's, or its event kinds' rows' (#1398); `undefined` on a canvas that reads neither. */ transport: PlanTransport | undefined; /** * Cold load (#1398, CL5): a paged source with nothing landed yet, and no * failure to say — the frame's skeleton covers the Plan at its rows' * pitch, its footer live; `undefined` on an inline canvas, which has none. */ cold: boolean | undefined; /** After cold load, a read the view needs in flight — a window, a narrowing's rows, a resource kind's narrowing: main, the canvas, is busy. */ busy: boolean; /** The rows' pitch, in px: the cold-load skeleton's rows draw at it. */ pitch: number; /** Key search over the source, when a paged source declares `seek` (#574), or over the record of the source the canvas pages: its `rows` source's, or a paged resource kind's (#1513). */ search: KeySearchSource | undefined; /** What the canvas carried on past (#811). */ diagnostics: PlanDiagnostics; /** * The history item's props, when the Plan edits — its root declares * editing (#880), or it has event kinds (#1194): its session the Plan's * one history across `data`'s session and each kind's, its words and its * actions. */ history: HistoryBarProps | undefined; /** The sessions the history holds, in order — `data`'s, then each event kind's — each as its banners show it (#1194). */ sessions: readonly PlanSessionBanner[]; /** The event kinds' editing (#1194): their drafts, and their gestures; `undefined` for a Plan without event kinds. */ events: PlanEventEditing | undefined; /** * Whether the canvas takes a write now: no run of the app's optimiser out (#1409, R2), and nothing on it standing in, * retained (#1398, CL8, CL10) — a resource kind's narrowing resolving, a new narrowing's first window or Home or * End's window read. Every command that writes asks it beside its kind's own `available` — the frame's Delete, the * inspector's edits — as the Sheet's `canEdit` does; its drags are refused by the run's lock and the retained region. */ writable: boolean; /** A run of the app's optimiser (#1409): what the frame draws of it; `undefined` for a Plan without event kinds. */ optimise?: PlanOptimiseChrome | undefined; /** * The kinds' cells and counts (#1039): what a kind given cells draws from — a kind read by them, or past the cap, * none — which the footer counts over the rows drawn and the inspector's row reads, every kind's drafts as the * seams take them, and the kinds drawing the notice; `undefined` for a Plan whose kinds the reader neither reads by * their cells nor counts. */ cells: ScheduleCellsRead | undefined; /** Where one of the session's issues is: its entry's first row on the canvas, by name. */ where: (issue: EditIssue) => string; /** The author's footer items, in order. */ footer: readonly PlanFooterItemValue[]; /** The root's `id`: what the Plan's viewer state is kept under (`planKeys`). */ id: string | undefined; /** Whether the canvas draws its narrow layout (§10). */ narrow: boolean; /** What the inspector reads of the rows (#1197): a row by its key, and what a measure draws at a bucket. */ inspect: PlanCanvasInspect; /** * Selects events from outside the canvas (#1198) — the overlaps chip's * first pair, a peer the inspector's banner names, a duplicate the * inspector made (#1194) — by their elements' keys: the selection replaced * by them, on the row given, else the row that draws the first, which is * brought into view. */ selectEvents: (keys: readonly string[], row?: RowKey) => void; /** * Whether a card from the library panel's own tabs has a row to land on * (#1259): a row on the canvas whose series makes an item of a dropped * card, the canvas taking cards, outside the narrow layout. The panel's * author tabs let their cards drag by it. */ takesCards: boolean; /** * Whether the event kinds' cards have a row to land on (#1196): an event * kind's row on the canvas, outside the narrow layout. The Events and * Backlog tabs' cards drag by it. */ takesEvents: boolean; /** * The event kinds with an event drawn on the canvas (#1196), outside the * narrow layout: an author's tab whose `drop` patch lands on one of them * lets its cards drag, to set it on an event (PB63). */ patchKinds: ReadonlySet; } /** What the canvas hands the frame it renders in. */ export interface PlanCanvasParts { /** * Wraps what the frame draws in the canvas's contexts — its words, * controller, geometry, scale, cursor, resolvers, grid and moves — and its * declared density, so the toolbar's items, the banners and the footer * speak as the canvas does. */ provide(children: ReactNode): ReactNode; /** * Main: the canvas — its header (the horizon brush, the ruler, the pinned * rows and the focus bar), its rows, or the narrow layout's tabs and * cards below 480px, and its overlays — or, with no window, why. */ main: ReactNode; /** * The canvas's geometry (#817), as the CSS variables its recipe reads: * written once, around the whole frame, so the canvas, the toolbar's * items and the footer read one table. */ vars: Readonly>; /** * The bound the canvas declares (`style.height` / `maxHeight`): the whole * Plan's — the frame's — as CSS sizes; `undefined` while it grows with its * rows. */ bound: { readonly height: string | undefined; readonly maxHeight: string | undefined; } | undefined; /** What the frame's chrome is drawn from; `undefined` with no window, which leaves the frame main alone. */ chrome: PlanChrome | undefined; } export {}; //# sourceMappingURL=chrome.d.ts.map