/** * 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 { 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 PlanEventShownValue } from "../root/events.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[]; /** 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 resource kinds: what an event and a row name their resource by. */ resources: PlanValue["resources"]; /** 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 resources the rail shows, by resource kind (#1344): what the bulk edit offers of a kind its source narrows. */ shownResources: PlanEventShownValue; /** 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 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 }: PlanSelectionReaderProps): null; /** * The inspector pane, as `BuilderFrame` draws it — see the module docs. * * @param props - Whether it is given, the kinds, the resources, the canvas's facts, the counts, the keys, the words, what is selected, the selected events, the resources the rail shows 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, resources, chrome, counts, keys, words, selection, events, shownResources, hidden, }: PlanInspectorProps): BuilderFrameDock | undefined; export {}; //# sourceMappingURL=inspector.d.ts.map