/** * One question card on screen: what is shown around the answer, and how it * comes down. * * What takes the answer - a list, a text box - is the caller's; the card draws * the rest the same way for every form: the header and the visit asking, the * reads above the question, the question, and a help line saying what the keys * do. A card also comes down when its question no longer stands, so a timeout * or a stop never leaves one on screen with nobody reading its answer. */ import { type Component } from "@earendil-works/pi-tui"; import type { Asking, Question } from "../../src/index.ts"; import type { AskUi } from "../pi.ts"; /** What a card is about, beside what takes the answer. */ export type Face = { readonly question: Question; readonly asking?: Asking; /** The help line, one key and what it does per entry. */ readonly help: readonly string[]; }; /** What takes the answer: drawn in the card, handed every key, and settling with `close`. */ export type Body = Component & { handleInput(data: string): void; focused?: boolean; }; /** * Shows `face` around the body `answer` builds, until the body settles or * `face.asking.signal` aborts, which settles it `undefined`. */ export declare function showCard(ui: AskUi, face: Face, answer: (close: (value: T | undefined) => void) => Body): Promise; /** A one-line text box, settling with what was typed on `enter` and `undefined` on `esc`. */ export declare function textBox(close: (value: string | undefined) => void): Body; //# sourceMappingURL=card.d.ts.map