/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type ValueTypeOf } from "@elaraai/east"; import { type PlanEventDraftsType, type planKeys } from "@elaraai/e3-ui/internal"; import { type BuilderFrameDock } from "@elaraai/east-ui-components"; import { type PlanEventEditing } from "../edit/events.js"; import { type PlanLinkKindValue, type PlanLinkRolesValue } from "../links/kinds.js"; import type { PlanInstantValue } from "../instant.js"; import type { RowKey } from "../plan-state.js"; import { type ScheduleCellsRead } from "../../shared/schedule/cells.js"; import type { PlanChrome } from "../root/chrome.js"; import type { PlanWords } from "../words.js"; import type { PlanEventCounts } from "./counts.js"; import type { PlanValue } from "./index.js"; /** The names a Plan keeps its viewer's state under. */ type PlanKeys = ReturnType; /** One event kind, as the payload carries it. */ type PlanEventKindValue = PlanValue["events"][number]; /** One event read by its key: as Plan draws it, and its row. */ type PlanEventReadValue = Extract, { type: "some"; }>["value"]; /** One event as Plan draws it. */ type PlanEventItemValue = PlanEventReadValue["item"]; /** Every kind's drafts, by kind then by entry id (#1194). */ type EventDrafts = ValueTypeOf; /** One selected event, read: its element's key, its kind, and the event as Plan draws it, with its row. */ export interface PlanInspectedEvent { /** Its element's key: its event, as East prints a `Schedule.Types.EventRef`. */ readonly key: string; /** Its kind. */ readonly kind: PlanEventKindValue; /** The event as Plan draws it. */ readonly item: PlanEventItemValue; /** Its row, as bytes at its record's entry type. */ readonly row: Uint8Array; } /** No event selected: what the pane holds before the selection's first read. */ export declare const NO_INSPECTED: readonly PlanInspectedEvent[]; /** One selected link of a link kind (#1541, U10), read: its kind, its row with its drafts in place, and what it joins. */ export interface PlanInspectedLink { /** Its key on the canvas: its kind's slot and its row's key, as East prints a reference. */ readonly key: string; /** Its link kind. */ readonly kind: PlanLinkKindValue; /** Its row's key's text. */ readonly id: string; /** Its row, as bytes at its record's row type, its drafts in place. */ readonly row: Uint8Array; /** The event it runs from, by its title — by its key's text where the page holds no such event. */ readonly from: string; /** The event it runs to, named likewise. */ readonly to: string; /** What it moves; none for a link with no quantity. */ readonly quantity: PlanLinkRolesValue["quantity"]; } /** No link selected: what the pane holds before the selection's first read, and on a Plan with no link kind. */ export declare const NO_INSPECTED_LINKS: readonly PlanInspectedLink[]; /** What is selected on the canvas: the row, the bucket a click on it named, and the events. */ export interface PlanInspectorSelection { readonly row: RowKey | null; readonly at: PlanInstantValue | null; readonly elements: readonly string[]; } /** * What is selected on the canvas, as the inspector shows it: the controller's * selection while the Plan has its pane, nothing otherwise. * * @param shown - Whether the Plan is given its inspector pane * @returns The selection — the same object while it holds */ export declare function usePlanInspectorSelection(shown: boolean): PlanInspectorSelection; /** Props of {@link usePlanInspector}. */ export interface PlanInspectorProps { /** Whether the Plan is given its inspector pane (`inspector`). */ shown: boolean; /** The event kinds: each selected event is read through its kind. */ kinds: PlanValue["events"]; /** The series the event kinds land on (#1541): what a row stands for, and its name. */ landings: PlanValue["landings"]; /** The canvas's chrome facts: its scale, its words, and what it reads of its rows; `undefined` with no window. */ chrome: PlanChrome | undefined; /** The event kinds' counts over the window: what the pane shows when nothing is selected. */ counts: PlanEventCounts | undefined; /** The names the Plan keeps its viewer's state under. */ keys: PlanKeys; /** The Plan's words. */ words: PlanWords; /** What is selected on the canvas ({@link usePlanInspectorSelection}). */ selection: PlanInspectorSelection; /** The selected events, read ({@link PlanSelectionReader}). */ events: readonly PlanInspectedEvent[]; /** The selected links of the link kinds, read beside them (#1541, U10). */ links: readonly PlanInspectedLink[]; /** The ids the viewer hides in the Series tab: a kind hidden there is in no figure of a row's. */ hidden: readonly string[]; } /** Props of {@link PlanSelectionReader}. */ export interface PlanSelectionReaderProps { /** The event kinds: each selected event is read through its kind. */ kinds: PlanValue["events"]; /** The selected events, by their elements' keys. */ elements: readonly string[]; /** Every kind's drafts; none for a Plan whose kinds hold none. */ drafts: EventDrafts | undefined; /** The kinds' editing, which reads an event where the canvas reads its rows; none without a window. */ editing: PlanEventEditing | undefined; /** The rows the cells' reader holds of each kind it gives cells (#1039): an event of such a kind is read again as they move. */ held: ScheduleCellsRead["held"] | undefined; /** Where the events go: called only when they move. */ onRead: (events: readonly PlanInspectedEvent[]) => void; /** The link kinds (#1541, U10): each selected link is read through its kind. */ linkKinds: readonly PlanLinkKindValue[]; /** Where the selected links go: called only when they move. */ onLinks: (links: readonly PlanInspectedLink[]) => void; } /** * The selected events, read in a component of its own (see the module docs): * a read that lands re-runs it alone, and it hands the frame the events only * when what it read moves. * * @param props - What is read, and where it goes * @returns Nothing: it reads */ export declare function PlanSelectionReader({ kinds, elements, drafts, editing, held, onRead, linkKinds, onLinks }: PlanSelectionReaderProps): null; /** * The inspector pane, as `BuilderFrame` draws it — see the module docs. * * @param props - Whether it is given, the kinds, the series they land on, the canvas's facts, the counts, the keys, the words, what is selected, the selected events and the ids the viewer hides * @returns The pane — 320px wide, its collapsed state kept per viewer, its rail saying what is selected — or `undefined`, no pane, when the Plan is given no inspector */ export declare function usePlanInspector({ shown, kinds, landings, chrome, counts, keys, words, selection, events, links, hidden, }: PlanInspectorProps): BuilderFrameDock | undefined; export {}; //# sourceMappingURL=inspector.d.ts.map