/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type NullType, type OptionType, type StringType, type StructType, type VariantType } from "@elaraai/east"; import { type StoredCodec } from "./stored-value.js"; /** * A builder's tools, as the UI store holds them: the tool, a case of its * variant, and the link kind Connect draws, by its slot. * * @typeParam T - The tools' names */ export type HeldToolsType = StructType<{ tool: VariantType<{ [K in T]: NullType; }>; link: OptionType; }>; /** * What the viewer holds: the tool, and the link kind Connect draws. * * @typeParam T - The tools' names */ export interface HeldTools { /** The tool held. */ readonly tool: T; /** The link kind Connect draws, by its slot. */ readonly link: string | undefined; } /** One link kind a builder's Connect may draw. */ export interface LinkChoice { /** Its slot. */ readonly key: string; /** Its name (`Fibre run`). */ readonly name: string; } /** * The tools the viewer holds under a key, and how to pick another tool or link * kind: a write every builder under that key follows. * * @typeParam T - The tools' names * @param codec - The codec of the builder's tools type (`storedCodec`) * @param key - The builder's tools key * @param first - The tool held until the viewer picks one * @returns What the store holds — `first` and no link kind until the viewer picks — and the write that picks */ export declare function useHeldTools(codec: StoredCodec>, key: string, first: T): [HeldTools, (next: HeldTools) => void]; //# sourceMappingURL=held-tools.d.ts.map