/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The tool the viewer holds on a Plan, and the link kind Connect draws (#1541, * U10): the viewer's, held in the UI store under the Plan's `id` * (`planKeys(id).tools`) as an East value, as the Schematic keeps its tools * (`schematic/tools.ts`) — so a remount keeps them, and two Plans of one `id` * hold one tool. Until the viewer picks, Select; Connect draws the first link * kind its Plan edits. * * - **Select** — the canvas's gestures as they are: an event is selected, * moved and resized. * - **Connect** — shown while a link kind is editable: a drag from an event to * another draws a link of the kind its menu chose, in place of moving it. * * Connect over no editable link kind is held as Select; a link kind no longer * editable, as the first that is. * * @packageDocumentation */ import { NullType, OptionType, StringType, StructType, VariantType, type ValueTypeOf } from "@elaraai/east"; import { type HeldTools, type LinkChoice } from "../../shared/held-tools.js"; import type { PlanLinkSource } from "../edit/event-drag.js"; import type { PlanLinkKindValue } from "./kinds.js"; /** A tool, as the UI store holds it. */ export declare const PlanToolType: VariantType<{ readonly select: NullType; readonly connect: NullType; }>; /** The tools' state, as the UI store holds it: the tool, and the link kind Connect draws, by its slot. */ export declare const PlanToolsType: StructType<{ readonly tool: VariantType<{ readonly select: NullType; readonly connect: NullType; }>; readonly link: OptionType; }>; /** A tool, by its name. */ export type PlanTool = ValueTypeOf["type"]; /** Every tool, in the toolbar's order. */ export declare const PLAN_TOOLS: readonly PlanTool[]; /** What the viewer holds: the tool, and the link kind Connect draws. */ export type PlanToolsState = HeldTools; /** No link kind Connect may draw. */ export declare const NO_LINK_CHOICES: readonly LinkChoice[]; /** What the toolbar's tools and the inspector's Connect to… show and drive (#1541, U10): there while a link kind is editable. */ export interface PlanToolsChrome { /** The tools in force: the tool held, and the link kind Connect draws. */ readonly held: PlanToolsState; /** The link kinds Connect may draw: the editable ones, in the order the Plan lists them. */ readonly links: readonly LinkChoice[]; /** Those link kinds themselves: what Connect to… reads each one's ends from. */ readonly kinds: readonly PlanLinkKindValue[]; /** Picks a tool, or the link kind Connect draws. */ readonly pick: (next: PlanToolsState) => void; /** * Why a link of a kind from one event to another isn't drawn, by the rules Connect's drag is held to: its kind's * end, or the Plan's `canConnect`. `undefined` where it may be. */ readonly refusal: (kind: PlanLinkKindValue, from: PlanLinkSource, to: string) => string | undefined; /** Draws it: a draft of its kind's session, one step of the history, selected. Whether it was recorded. */ readonly draw: (kind: PlanLinkKindValue, from: PlanLinkSource, to: string) => boolean; /** The template the library holds for each link kind, by the kind's slot: its key. A link drawn takes its values. */ readonly templates: ReadonlyMap; /** Holds a link kind's template — or, held already, lets it go. */ readonly holdTemplate: (slot: string, key: string) => void; } /** * What the viewer holds, as the Plan offers it: Connect over no editable link * kind is Select, and a link kind it does not edit is the first it does. * * @param held - What the store holds * @param links - The editable link kinds, by their slots, in the order the Plan lists them * @returns The tool and the link kind in force */ export declare function planToolsInForce(held: PlanToolsState, links: readonly string[]): PlanToolsState; /** * The tools the viewer holds under a key, and how to pick another tool or link * kind: a write every Plan under that key follows (see the module docs). * * @param key - The Plan's tools key (`planKeys(id).tools`) * @returns What the store holds — Select and no link kind until the viewer picks — and the write that picks */ export declare function usePlanTools(key: string): [PlanToolsState, (next: PlanToolsState) => void]; //# sourceMappingURL=connect.d.ts.map