/** * The live scene — what the live region shows, and the space it is given. * * The region shows one scene: the operation's ledger with at most one * interaction — a prompt or a wait — beneath it. Each part is a pure function * of the space it is given to a typed document, painted by the one painter. * This module owns the two mechanical guarantees the design rests on: no live * line wraps, and the whole scene fits the terminal height. Neither depends on * a part laying itself out well, so a part that asks for more than it was * given is cut at what it was given. */ import type { Doc } from "./doc.js"; import { type PaintStyle } from "./paint-text.js"; /** The terminal a live scene is laid out against. */ export interface TerminalSize { readonly columns: number; readonly rows: number; } /** The ledger window's minimum: its header and its fold line. */ export declare const LEDGER_MIN_ROWS = 6; /** * Columns one live line may use. A repainting line that reaches the last * column wraps, and a wrapped line breaks the row count the region erases by, * so the region stops one column short of the terminal. */ export declare const liveColumns: (columns: number) => number; /** Rows the whole live region may use: the terminal height less the rows it leaves free. */ export declare const liveRows: (rows: number) => number; /** The space a scene part lays itself out in, and the animation it paints against. */ export interface SceneFacts { /** Columns the part may use — already one short of the terminal width. */ readonly columns: number; /** Rows the part may use. */ readonly rows: number; /** The region's current spinner frame, so a running row animates with it. */ readonly spinner: string; /** Wall clock for elapsed and remaining times. */ readonly nowMs: number; } /** One part of the scene: a pure function of the space it is given to a document. */ export type ScenePart = (facts: SceneFacts) => Doc; /** The live region's content. Either part may be absent; both absent clears the region. */ export interface Scene { readonly ledger?: ScenePart | undefined; readonly interaction?: ScenePart | undefined; } export interface SceneStyle extends Omit { readonly spinner: string; readonly nowMs: number; } /** Paint a document into the space a live part was given, cutting what does not fit. */ export declare const paintLivePart: (doc: Doc, space: { readonly columns: number; readonly rows: number; }, style: Omit) => ReadonlyArray; /** * Paint the whole scene for one terminal: the ledger, then the interaction * beneath it. When the two compete for height the interaction keeps its * minimum and the ledger window shrinks to its header and fold line; the * ledger takes whatever the interaction leaves. */ export declare const paintScene: (scene: Scene, terminal: TerminalSize, style: SceneStyle) => ReadonlyArray; //# sourceMappingURL=scene.d.ts.map