/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import { type KindKeys } from "./kind-keys.js"; /** A new row's key as the viewer types it: see the module docs. */ export interface KeyDraft { /** The key as the form shows it, under `key`: the draft typed so far, else the row's — `undefined` for a placeholder. */ readonly value: unknown; /** Whether the key has several parts: typed into the draft, and set whole. */ readonly parts: boolean; /** Whether the draft holds a key other than the row's: what Set takes. */ readonly typed: boolean; /** * A part of the key edited in the form: the key taken at once, for a key of one part; else the draft. * * @param path - The edited spec's path, from `key` down * @param next - Its new value * @returns Why a key of one part was refused, where the inspector says: what the form says under its field */ readonly onChange: (path: readonly string[], next: unknown) => string | void; /** Takes the draft whole: refused, the draft stays to be changed. */ readonly set: () => void; } /** * A new row's key as the viewer types it (see the module docs). * * @param keys - The row's kind's keys * @param at - The row's key's text: a placeholder's until its key is set * @param take - Takes a key, by its text: the row under it, or refused, saying why — the words handed back where it does * @returns The key as the form shows it, and how it is typed and set */ export declare function useKeyDraft(keys: KindKeys, at: string, take: (key: string) => string | void): KeyDraft; /** * A key of several parts' Set: takes the draft whole — off while it holds the row's key. * * @param props - The draft, and the button's words * @returns The button */ export declare function KeySetButton({ draft, label }: { readonly draft: KeyDraft; readonly label: string; }): import("react/jsx-runtime").JSX.Element; //# sourceMappingURL=key-draft.d.ts.map