@kolisachint/hoocode-tui 0.5.68 → 0.5.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,4 +10,35 @@ export declare class Spacer implements Component {
10
10
  invalidate(): void;
11
11
  render(_width: number): string[];
12
12
  }
13
+ /**
14
+ * A spacer whose height the renderer decides, so the layout can fill the screen.
15
+ *
16
+ * ## Why the renderer and not the layout
17
+ *
18
+ * The app is a full-screen one: whatever is at the top of the tree belongs at
19
+ * the top of the terminal and the prompt belongs on the bottom row, with the
20
+ * conversation between them. Nothing in the component tree can work that out on
21
+ * its own — the height it has to make up is the terminal's height minus the
22
+ * height of *every other child*, which is only known once they have all
23
+ * rendered. So the root measures the frame it just built and tells this spacer
24
+ * what is left over (`TUI.setFlexSpacer`).
25
+ *
26
+ * Put one child of the root between the part that flows from the top and the
27
+ * chrome that hangs off the bottom. Once the content is taller than the screen
28
+ * the height settles at 0 and this costs nothing.
29
+ *
30
+ * `setHeight` reports whether it moved, because the root's flat cache compares
31
+ * child output by array identity: handing back a fresh array for an unchanged
32
+ * height would mark the whole tail of the buffer dirty on every single frame.
33
+ */
34
+ export declare class FlexSpacer implements Component {
35
+ private height;
36
+ private lines;
37
+ /** Rows it is currently contributing. */
38
+ get currentHeight(): number;
39
+ /** Set the fill; true when it changed and a re-flatten is owed. */
40
+ setHeight(height: number): boolean;
41
+ invalidate(): void;
42
+ render(_width: number): string[];
43
+ }
13
44
  //# sourceMappingURL=spacer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spacer.d.ts","sourceRoot":"","sources":["../../src/components/spacer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,qBAAa,MAAO,YAAW,SAAS;IACvC,OAAO,CAAC,KAAK,CAAS;IAEtB,YAAY,KAAK,GAAE,MAAU,EAE5B;IAGD,OAAO,CAAC,MAAM,CAAC,CAAW;IAE1B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAG5B;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAS/B;CACD","sourcesContent":["import type { Component } from \"../tui.js\";\n\n/**\n * Spacer component that renders empty lines\n */\nexport class Spacer implements Component {\n\tprivate lines: number;\n\n\tconstructor(lines: number = 1) {\n\t\tthis.lines = lines;\n\t}\n\n\t// Cached so repeated renders stay reference-stable (parents memoize by ref).\n\tprivate cached?: string[];\n\n\tsetLines(lines: number): void {\n\t\tthis.lines = lines;\n\t\tthis.cached = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\t// Output depends only on `lines`; keep the cache.\n\t}\n\n\trender(_width: number): string[] {\n\t\tif (!this.cached || this.cached.length !== this.lines) {\n\t\t\tconst result: string[] = [];\n\t\t\tfor (let i = 0; i < this.lines; i++) {\n\t\t\t\tresult.push(\"\");\n\t\t\t}\n\t\t\tthis.cached = result;\n\t\t}\n\t\treturn this.cached;\n\t}\n}\n"]}
1
+ {"version":3,"file":"spacer.d.ts","sourceRoot":"","sources":["../../src/components/spacer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,qBAAa,MAAO,YAAW,SAAS;IACvC,OAAO,CAAC,KAAK,CAAS;IAEtB,YAAY,KAAK,GAAE,MAAU,EAE5B;IAGD,OAAO,CAAC,MAAM,CAAC,CAAW;IAE1B,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAG5B;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAS/B;CACD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,UAAW,YAAW,SAAS;IAC3C,OAAO,CAAC,MAAM,CAAK;IACnB,OAAO,CAAC,KAAK,CAAgB;IAE7B,yCAAyC;IACzC,IAAI,aAAa,IAAI,MAAM,CAE1B;IAED,mEAAmE;IACnE,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAMjC;IAED,UAAU,IAAI,IAAI,CAEjB;IAED,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAE/B;CACD","sourcesContent":["import type { Component } from \"../tui.js\";\n\n/**\n * Spacer component that renders empty lines\n */\nexport class Spacer implements Component {\n\tprivate lines: number;\n\n\tconstructor(lines: number = 1) {\n\t\tthis.lines = lines;\n\t}\n\n\t// Cached so repeated renders stay reference-stable (parents memoize by ref).\n\tprivate cached?: string[];\n\n\tsetLines(lines: number): void {\n\t\tthis.lines = lines;\n\t\tthis.cached = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\t// Output depends only on `lines`; keep the cache.\n\t}\n\n\trender(_width: number): string[] {\n\t\tif (!this.cached || this.cached.length !== this.lines) {\n\t\t\tconst result: string[] = [];\n\t\t\tfor (let i = 0; i < this.lines; i++) {\n\t\t\t\tresult.push(\"\");\n\t\t\t}\n\t\t\tthis.cached = result;\n\t\t}\n\t\treturn this.cached;\n\t}\n}\n\n/**\n * A spacer whose height the renderer decides, so the layout can fill the screen.\n *\n * ## Why the renderer and not the layout\n *\n * The app is a full-screen one: whatever is at the top of the tree belongs at\n * the top of the terminal and the prompt belongs on the bottom row, with the\n * conversation between them. Nothing in the component tree can work that out on\n * its own — the height it has to make up is the terminal's height minus the\n * height of *every other child*, which is only known once they have all\n * rendered. So the root measures the frame it just built and tells this spacer\n * what is left over (`TUI.setFlexSpacer`).\n *\n * Put one child of the root between the part that flows from the top and the\n * chrome that hangs off the bottom. Once the content is taller than the screen\n * the height settles at 0 and this costs nothing.\n *\n * `setHeight` reports whether it moved, because the root's flat cache compares\n * child output by array identity: handing back a fresh array for an unchanged\n * height would mark the whole tail of the buffer dirty on every single frame.\n */\nexport class FlexSpacer implements Component {\n\tprivate height = 0;\n\tprivate lines: string[] = [];\n\n\t/** Rows it is currently contributing. */\n\tget currentHeight(): number {\n\t\treturn this.height;\n\t}\n\n\t/** Set the fill; true when it changed and a re-flatten is owed. */\n\tsetHeight(height: number): boolean {\n\t\tconst next = Math.max(0, Math.floor(height));\n\t\tif (next === this.height) return false;\n\t\tthis.height = next;\n\t\tthis.lines = new Array<string>(next).fill(\"\");\n\t\treturn true;\n\t}\n\n\tinvalidate(): void {\n\t\t// Output depends only on `height`; the blank rows never restyle.\n\t}\n\n\trender(_width: number): string[] {\n\t\treturn this.lines;\n\t}\n}\n"]}
@@ -26,4 +26,48 @@ export class Spacer {
26
26
  return this.cached;
27
27
  }
28
28
  }
29
+ /**
30
+ * A spacer whose height the renderer decides, so the layout can fill the screen.
31
+ *
32
+ * ## Why the renderer and not the layout
33
+ *
34
+ * The app is a full-screen one: whatever is at the top of the tree belongs at
35
+ * the top of the terminal and the prompt belongs on the bottom row, with the
36
+ * conversation between them. Nothing in the component tree can work that out on
37
+ * its own — the height it has to make up is the terminal's height minus the
38
+ * height of *every other child*, which is only known once they have all
39
+ * rendered. So the root measures the frame it just built and tells this spacer
40
+ * what is left over (`TUI.setFlexSpacer`).
41
+ *
42
+ * Put one child of the root between the part that flows from the top and the
43
+ * chrome that hangs off the bottom. Once the content is taller than the screen
44
+ * the height settles at 0 and this costs nothing.
45
+ *
46
+ * `setHeight` reports whether it moved, because the root's flat cache compares
47
+ * child output by array identity: handing back a fresh array for an unchanged
48
+ * height would mark the whole tail of the buffer dirty on every single frame.
49
+ */
50
+ export class FlexSpacer {
51
+ height = 0;
52
+ lines = [];
53
+ /** Rows it is currently contributing. */
54
+ get currentHeight() {
55
+ return this.height;
56
+ }
57
+ /** Set the fill; true when it changed and a re-flatten is owed. */
58
+ setHeight(height) {
59
+ const next = Math.max(0, Math.floor(height));
60
+ if (next === this.height)
61
+ return false;
62
+ this.height = next;
63
+ this.lines = new Array(next).fill("");
64
+ return true;
65
+ }
66
+ invalidate() {
67
+ // Output depends only on `height`; the blank rows never restyle.
68
+ }
69
+ render(_width) {
70
+ return this.lines;
71
+ }
72
+ }
29
73
  //# sourceMappingURL=spacer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"spacer.js","sourceRoot":"","sources":["../../src/components/spacer.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,MAAM;IACV,KAAK,CAAS;IAEtB,YAAY,KAAK,GAAW,CAAC,EAAE;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAAA,CACnB;IAED,6EAA6E;IACrE,MAAM,CAAY;IAE1B,QAAQ,CAAC,KAAa,EAAQ;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAAA,CACxB;IAED,UAAU,GAAS;QAClB,kDAAkD;IAD/B,CAEnB;IAED,MAAM,CAAC,MAAc,EAAY;QAChC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;YACvD,MAAM,MAAM,GAAa,EAAE,CAAC;YAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,CAAC;YACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACtB,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IAAA,CACnB;CACD","sourcesContent":["import type { Component } from \"../tui.js\";\n\n/**\n * Spacer component that renders empty lines\n */\nexport class Spacer implements Component {\n\tprivate lines: number;\n\n\tconstructor(lines: number = 1) {\n\t\tthis.lines = lines;\n\t}\n\n\t// Cached so repeated renders stay reference-stable (parents memoize by ref).\n\tprivate cached?: string[];\n\n\tsetLines(lines: number): void {\n\t\tthis.lines = lines;\n\t\tthis.cached = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\t// Output depends only on `lines`; keep the cache.\n\t}\n\n\trender(_width: number): string[] {\n\t\tif (!this.cached || this.cached.length !== this.lines) {\n\t\t\tconst result: string[] = [];\n\t\t\tfor (let i = 0; i < this.lines; i++) {\n\t\t\t\tresult.push(\"\");\n\t\t\t}\n\t\t\tthis.cached = result;\n\t\t}\n\t\treturn this.cached;\n\t}\n}\n"]}
1
+ {"version":3,"file":"spacer.js","sourceRoot":"","sources":["../../src/components/spacer.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,OAAO,MAAM;IACV,KAAK,CAAS;IAEtB,YAAY,KAAK,GAAW,CAAC,EAAE;QAC9B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAAA,CACnB;IAED,6EAA6E;IACrE,MAAM,CAAY;IAE1B,QAAQ,CAAC,KAAa,EAAQ;QAC7B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC;IAAA,CACxB;IAED,UAAU,GAAS;QAClB,kDAAkD;IAD/B,CAEnB;IAED,MAAM,CAAC,MAAc,EAAY;QAChC,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,EAAE,CAAC;YACvD,MAAM,MAAM,GAAa,EAAE,CAAC;YAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;gBACrC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjB,CAAC;YACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACtB,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IAAA,CACnB;CACD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,UAAU;IACd,MAAM,GAAG,CAAC,CAAC;IACX,KAAK,GAAa,EAAE,CAAC;IAE7B,yCAAyC;IACzC,IAAI,aAAa,GAAW;QAC3B,OAAO,IAAI,CAAC,MAAM,CAAC;IAAA,CACnB;IAED,mEAAmE;IACnE,SAAS,CAAC,MAAc,EAAW;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7C,IAAI,IAAI,KAAK,IAAI,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC;QACvC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,IAAI,KAAK,CAAS,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC9C,OAAO,IAAI,CAAC;IAAA,CACZ;IAED,UAAU,GAAS;QAClB,iEAAiE;IAD9C,CAEnB;IAED,MAAM,CAAC,MAAc,EAAY;QAChC,OAAO,IAAI,CAAC,KAAK,CAAC;IAAA,CAClB;CACD","sourcesContent":["import type { Component } from \"../tui.js\";\n\n/**\n * Spacer component that renders empty lines\n */\nexport class Spacer implements Component {\n\tprivate lines: number;\n\n\tconstructor(lines: number = 1) {\n\t\tthis.lines = lines;\n\t}\n\n\t// Cached so repeated renders stay reference-stable (parents memoize by ref).\n\tprivate cached?: string[];\n\n\tsetLines(lines: number): void {\n\t\tthis.lines = lines;\n\t\tthis.cached = undefined;\n\t}\n\n\tinvalidate(): void {\n\t\t// Output depends only on `lines`; keep the cache.\n\t}\n\n\trender(_width: number): string[] {\n\t\tif (!this.cached || this.cached.length !== this.lines) {\n\t\t\tconst result: string[] = [];\n\t\t\tfor (let i = 0; i < this.lines; i++) {\n\t\t\t\tresult.push(\"\");\n\t\t\t}\n\t\t\tthis.cached = result;\n\t\t}\n\t\treturn this.cached;\n\t}\n}\n\n/**\n * A spacer whose height the renderer decides, so the layout can fill the screen.\n *\n * ## Why the renderer and not the layout\n *\n * The app is a full-screen one: whatever is at the top of the tree belongs at\n * the top of the terminal and the prompt belongs on the bottom row, with the\n * conversation between them. Nothing in the component tree can work that out on\n * its own — the height it has to make up is the terminal's height minus the\n * height of *every other child*, which is only known once they have all\n * rendered. So the root measures the frame it just built and tells this spacer\n * what is left over (`TUI.setFlexSpacer`).\n *\n * Put one child of the root between the part that flows from the top and the\n * chrome that hangs off the bottom. Once the content is taller than the screen\n * the height settles at 0 and this costs nothing.\n *\n * `setHeight` reports whether it moved, because the root's flat cache compares\n * child output by array identity: handing back a fresh array for an unchanged\n * height would mark the whole tail of the buffer dirty on every single frame.\n */\nexport class FlexSpacer implements Component {\n\tprivate height = 0;\n\tprivate lines: string[] = [];\n\n\t/** Rows it is currently contributing. */\n\tget currentHeight(): number {\n\t\treturn this.height;\n\t}\n\n\t/** Set the fill; true when it changed and a re-flatten is owed. */\n\tsetHeight(height: number): boolean {\n\t\tconst next = Math.max(0, Math.floor(height));\n\t\tif (next === this.height) return false;\n\t\tthis.height = next;\n\t\tthis.lines = new Array<string>(next).fill(\"\");\n\t\treturn true;\n\t}\n\n\tinvalidate(): void {\n\t\t// Output depends only on `height`; the blank rows never restyle.\n\t}\n\n\trender(_width: number): string[] {\n\t\treturn this.lines;\n\t}\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -9,7 +9,7 @@ export { Loader, type LoaderIndicatorOptions } from "./components/loader.js";
9
9
  export { type DefaultTextStyle, Markdown, type MarkdownTheme } from "./components/markdown.js";
10
10
  export { type SelectItem, SelectList, type SelectListLayoutOptions, type SelectListTheme, type SelectListTruncatePrimaryContext, } from "./components/select-list.js";
11
11
  export { type SettingItem, SettingsList, type SettingsListTheme } from "./components/settings-list.js";
12
- export { Spacer } from "./components/spacer.js";
12
+ export { FlexSpacer, Spacer } from "./components/spacer.js";
13
13
  export { Text } from "./components/text.js";
14
14
  export { TruncatedText } from "./components/truncated-text.js";
15
15
  export type { EditorComponent } from "./editor-component.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"A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B,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,aAAa,EACb,KAAK,SAAS,EACd,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,IAAI,EACJ,GAAG,GACH,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.js\";\n// Components\nexport { Box, type PaperSheet } from \"./components/box.js\";\nexport { CancellableLoader } from \"./components/cancellable-loader.js\";\nexport {\n\tDEFAULT_EDITOR_BORDER_CHARS,\n\tEditor,\n\ttype EditorBorderChars,\n\ttype EditorBorderStyle,\n\ttype EditorOptions,\n\ttype EditorTheme,\n\ttype EditorTopBorderLabel,\n} from \"./components/editor.js\";\nexport {\n\tDEFAULT_FRAME_BORDER_CHARS,\n\tFrame,\n\ttype FrameBorderChars,\n\ttype FrameBorderStyle,\n\ttype FrameEdgeOptions,\n\ttype FrameLabel,\n\ttype FrameOptions,\n\trenderFrameEdge,\n} from \"./components/frame.js\";\nexport { Image, type ImageOptions, type ImageTheme } from \"./components/image.js\";\nexport { Input } from \"./components/input.js\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.js\";\nexport { type DefaultTextStyle, Markdown, type MarkdownTheme } from \"./components/markdown.js\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.js\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.js\";\nexport { Spacer } from \"./components/spacer.js\";\nexport { Text } from \"./components/text.js\";\nexport { TruncatedText } from \"./components/truncated-text.js\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent } from \"./editor-component.js\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from \"./fuzzy.js\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\ttype Keybinding,\n\ttype KeybindingConflict,\n\ttype KeybindingDefinition,\n\ttype KeybindingDefinitions,\n\ttype Keybindings,\n\ttype KeybindingsConfig,\n\tKeybindingsManager,\n\tsetKeybindings,\n\tTUI_KEYBINDINGS,\n} from \"./keybindings.js\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.js\";\n// Input buffering for batch splitting\n// Mouse reporting\nexport {\n\tisMouseSequence,\n\tMOUSE_DISABLE,\n\tMOUSE_ENABLE,\n\ttype MouseEvent,\n\ttype MouseEventKind,\n\tmouseSequenceLength,\n\tparseMouseEvent,\n} from \"./mouse.js\";\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.js\";\n// Terminal interface and implementations\nexport { ProcessTerminal, type Terminal } from \"./terminal.js\";\n// Terminal image support\nexport {\n\tallocateImageId,\n\ttype CellDimensions,\n\tcalculateImageRows,\n\tdeleteAllKittyImages,\n\tdeleteKittyImage,\n\tdetectCapabilities,\n\tencodeITerm2,\n\tencodeKitty,\n\tgetCapabilities,\n\tgetCellDimensions,\n\tgetGifDimensions,\n\tgetImageDimensions,\n\tgetJpegDimensions,\n\tgetPngDimensions,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\tisImageLine,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n} from \"./terminal-image.js\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\ttype Focusable,\n\tisFocusable,\n\ttype OverlayAnchor,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype ScrollSearchStatus,\n\ttype ScrollStatus,\n\ttype ScrollStatusFormatter,\n\ttype SizeValue,\n\tSlot,\n\tTUI,\n} from \"./tui.js\";\n// Utilities\nexport { applyBackgroundToLine, truncateToWidth, visibleWidth, wrapTextWithAnsi } from \"./utils.js\";\n"]}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACN,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,4BAA4B,EAC5B,KAAK,YAAY,GACjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,GAAG,EAAE,KAAK,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EACN,2BAA2B,EAC3B,MAAM,EACN,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,oBAAoB,GACzB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,0BAA0B,EAC1B,KAAK,EACL,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,eAAe,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAClF,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,M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AAM,mBAAmB,CAAC;AAEnG,OAAO,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE/D,OAAO,EACN,eAAe,EACf,KAAK,cAAc,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,aAAa,EACb,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,KAAK,oBAAoB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACN,KAAK,SAAS,EACd,SAAS,EACT,aAAa,EACb,KAAK,SAAS,EACd,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,qBAAqB,EAC1B,KAAK,SAAS,EACd,IAAI,EACJ,GAAG,GACH,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.js\";\n// Components\nexport { Box, type PaperSheet } from \"./components/box.js\";\nexport { CancellableLoader } from \"./components/cancellable-loader.js\";\nexport {\n\tDEFAULT_EDITOR_BORDER_CHARS,\n\tEditor,\n\ttype EditorBorderChars,\n\ttype EditorBorderStyle,\n\ttype EditorOptions,\n\ttype EditorTheme,\n\ttype EditorTopBorderLabel,\n} from \"./components/editor.js\";\nexport {\n\tDEFAULT_FRAME_BORDER_CHARS,\n\tFrame,\n\ttype FrameBorderChars,\n\ttype FrameBorderStyle,\n\ttype FrameEdgeOptions,\n\ttype FrameLabel,\n\ttype FrameOptions,\n\trenderFrameEdge,\n} from \"./components/frame.js\";\nexport { Image, type ImageOptions, type ImageTheme } from \"./components/image.js\";\nexport { Input } from \"./components/input.js\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.js\";\nexport { type DefaultTextStyle, Markdown, type MarkdownTheme } from \"./components/markdown.js\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.js\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.js\";\nexport { FlexSpacer, Spacer } from \"./components/spacer.js\";\nexport { Text } from \"./components/text.js\";\nexport { TruncatedText } from \"./components/truncated-text.js\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent } from \"./editor-component.js\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from \"./fuzzy.js\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\ttype Keybinding,\n\ttype KeybindingConflict,\n\ttype KeybindingDefinition,\n\ttype KeybindingDefinitions,\n\ttype Keybindings,\n\ttype KeybindingsConfig,\n\tKeybindingsManager,\n\tsetKeybindings,\n\tTUI_KEYBINDINGS,\n} from \"./keybindings.js\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.js\";\n// Input buffering for batch splitting\n// Mouse reporting\nexport {\n\tisMouseSequence,\n\tMOUSE_DISABLE,\n\tMOUSE_ENABLE,\n\ttype MouseEvent,\n\ttype MouseEventKind,\n\tmouseSequenceLength,\n\tparseMouseEvent,\n} from \"./mouse.js\";\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.js\";\n// Terminal interface and implementations\nexport { ProcessTerminal, type Terminal } from \"./terminal.js\";\n// Terminal image support\nexport {\n\tallocateImageId,\n\ttype CellDimensions,\n\tcalculateImageRows,\n\tdeleteAllKittyImages,\n\tdeleteKittyImage,\n\tdetectCapabilities,\n\tencodeITerm2,\n\tencodeKitty,\n\tgetCapabilities,\n\tgetCellDimensions,\n\tgetGifDimensions,\n\tgetImageDimensions,\n\tgetJpegDimensions,\n\tgetPngDimensions,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\tisImageLine,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n} from \"./terminal-image.js\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\ttype Focusable,\n\tisFocusable,\n\ttype OverlayAnchor,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype ScrollSearchStatus,\n\ttype ScrollStatus,\n\ttype ScrollStatusFormatter,\n\ttype SizeValue,\n\tSlot,\n\tTUI,\n} from \"./tui.js\";\n// Utilities\nexport { applyBackgroundToLine, truncateToWidth, visibleWidth, wrapTextWithAnsi } from \"./utils.js\";\n"]}
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ export { Loader } from "./components/loader.js";
12
12
  export { Markdown } from "./components/markdown.js";
13
13
  export { SelectList, } from "./components/select-list.js";
14
14
  export { SettingsList } from "./components/settings-list.js";
15
- export { Spacer } from "./components/spacer.js";
15
+ export { FlexSpacer, Spacer } from "./components/spacer.js";
16
16
  export { Text } from "./components/text.js";
17
17
  export { TruncatedText } from "./components/truncated-text.js";
18
18
  // Fuzzy matching
package/dist/index.js.map CHANGED
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BAAkB;AAClB,OAAO,EACN,eAAe,EACf,aAAa,EACb,YAAY,EAGZ,mBAAmB,EACnB,eAAe,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAqD,MAAM,mBAAmB,CAAC;AACnG,yCAAyC;AACzC,OAAO,EAAE,eAAe,EAAiB,MAAM,eAAe,CAAC;AAC/D,yBAAyB;AACzB,OAAO,EACN,eAAe,EAEf,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EAIT,aAAa,EACb,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,iBAAiB,GAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,SAAS,EACT,aAAa,EAEb,WAAW,EASX,IAAI,EACJ,GAAG,GACH,MAAM,UAAU,CAAC;AAClB,YAAY;AACZ,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.js\";\n// Components\nexport { Box, type PaperSheet } from \"./components/box.js\";\nexport { CancellableLoader } from \"./components/cancellable-loader.js\";\nexport {\n\tDEFAULT_EDITOR_BORDER_CHARS,\n\tEditor,\n\ttype EditorBorderChars,\n\ttype EditorBorderStyle,\n\ttype EditorOptions,\n\ttype EditorTheme,\n\ttype EditorTopBorderLabel,\n} from \"./components/editor.js\";\nexport {\n\tDEFAULT_FRAME_BORDER_CHARS,\n\tFrame,\n\ttype FrameBorderChars,\n\ttype FrameBorderStyle,\n\ttype FrameEdgeOptions,\n\ttype FrameLabel,\n\ttype FrameOptions,\n\trenderFrameEdge,\n} from \"./components/frame.js\";\nexport { Image, type ImageOptions, type ImageTheme } from \"./components/image.js\";\nexport { Input } from \"./components/input.js\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.js\";\nexport { type DefaultTextStyle, Markdown, type MarkdownTheme } from \"./components/markdown.js\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.js\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.js\";\nexport { Spacer } from \"./components/spacer.js\";\nexport { Text } from \"./components/text.js\";\nexport { TruncatedText } from \"./components/truncated-text.js\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent } from \"./editor-component.js\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from \"./fuzzy.js\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\ttype Keybinding,\n\ttype KeybindingConflict,\n\ttype KeybindingDefinition,\n\ttype KeybindingDefinitions,\n\ttype Keybindings,\n\ttype KeybindingsConfig,\n\tKeybindingsManager,\n\tsetKeybindings,\n\tTUI_KEYBINDINGS,\n} from \"./keybindings.js\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.js\";\n// Input buffering for batch splitting\n// Mouse reporting\nexport {\n\tisMouseSequence,\n\tMOUSE_DISABLE,\n\tMOUSE_ENABLE,\n\ttype MouseEvent,\n\ttype MouseEventKind,\n\tmouseSequenceLength,\n\tparseMouseEvent,\n} from \"./mouse.js\";\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.js\";\n// Terminal interface and implementations\nexport { ProcessTerminal, type Terminal } from \"./terminal.js\";\n// Terminal image support\nexport {\n\tallocateImageId,\n\ttype CellDimensions,\n\tcalculateImageRows,\n\tdeleteAllKittyImages,\n\tdeleteKittyImage,\n\tdetectCapabilities,\n\tencodeITerm2,\n\tencodeKitty,\n\tgetCapabilities,\n\tgetCellDimensions,\n\tgetGifDimensions,\n\tgetImageDimensions,\n\tgetJpegDimensions,\n\tgetPngDimensions,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\tisImageLine,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n} from \"./terminal-image.js\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\ttype Focusable,\n\tisFocusable,\n\ttype OverlayAnchor,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype ScrollSearchStatus,\n\ttype ScrollStatus,\n\ttype ScrollStatusFormatter,\n\ttype SizeValue,\n\tSlot,\n\tTUI,\n} from \"./tui.js\";\n// Utilities\nexport { applyBackgroundToLine, truncateToWidth, visibleWidth, wrapTextWithAnsi } from \"./utils.js\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC,uBAAuB;AACvB,OAAO,EAIN,4BAA4B,GAE5B,MAAM,mBAAmB,CAAC;AAC3B,aAAa;AACb,OAAO,EAAE,GAAG,EAAmB,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EACN,2BAA2B,EAC3B,MAAM,GAMN,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACN,0BAA0B,EAC1B,KAAK,EAML,eAAe,GACf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAA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iB,EACjB,SAAS,EAIT,aAAa,EACb,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,iBAAiB,GAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,SAAS,EACT,aAAa,EAEb,WAAW,EASX,IAAI,EACJ,GAAG,GACH,MAAM,UAAU,CAAC;AAClB,YAAY;AACZ,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.js\";\n// Components\nexport { Box, type PaperSheet } from \"./components/box.js\";\nexport { CancellableLoader } from \"./components/cancellable-loader.js\";\nexport {\n\tDEFAULT_EDITOR_BORDER_CHARS,\n\tEditor,\n\ttype EditorBorderChars,\n\ttype EditorBorderStyle,\n\ttype EditorOptions,\n\ttype EditorTheme,\n\ttype EditorTopBorderLabel,\n} from \"./components/editor.js\";\nexport {\n\tDEFAULT_FRAME_BORDER_CHARS,\n\tFrame,\n\ttype FrameBorderChars,\n\ttype FrameBorderStyle,\n\ttype FrameEdgeOptions,\n\ttype FrameLabel,\n\ttype FrameOptions,\n\trenderFrameEdge,\n} from \"./components/frame.js\";\nexport { Image, type ImageOptions, type ImageTheme } from \"./components/image.js\";\nexport { Input } from \"./components/input.js\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.js\";\nexport { type DefaultTextStyle, Markdown, type MarkdownTheme } from \"./components/markdown.js\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.js\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.js\";\nexport { FlexSpacer, Spacer } from \"./components/spacer.js\";\nexport { Text } from \"./components/text.js\";\nexport { TruncatedText } from \"./components/truncated-text.js\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent } from \"./editor-component.js\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from \"./fuzzy.js\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\ttype Keybinding,\n\ttype KeybindingConflict,\n\ttype KeybindingDefinition,\n\ttype KeybindingDefinitions,\n\ttype Keybindings,\n\ttype KeybindingsConfig,\n\tKeybindingsManager,\n\tsetKeybindings,\n\tTUI_KEYBINDINGS,\n} from \"./keybindings.js\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.js\";\n// Input buffering for batch splitting\n// Mouse reporting\nexport {\n\tisMouseSequence,\n\tMOUSE_DISABLE,\n\tMOUSE_ENABLE,\n\ttype MouseEvent,\n\ttype MouseEventKind,\n\tmouseSequenceLength,\n\tparseMouseEvent,\n} from \"./mouse.js\";\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.js\";\n// Terminal interface and implementations\nexport { ProcessTerminal, type Terminal } from \"./terminal.js\";\n// Terminal image support\nexport {\n\tallocateImageId,\n\ttype CellDimensions,\n\tcalculateImageRows,\n\tdeleteAllKittyImages,\n\tdeleteKittyImage,\n\tdetectCapabilities,\n\tencodeITerm2,\n\tencodeKitty,\n\tgetCapabilities,\n\tgetCellDimensions,\n\tgetGifDimensions,\n\tgetImageDimensions,\n\tgetJpegDimensions,\n\tgetPngDimensions,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\tisImageLine,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n} from \"./terminal-image.js\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\ttype Focusable,\n\tisFocusable,\n\ttype OverlayAnchor,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype ScrollSearchStatus,\n\ttype ScrollStatus,\n\ttype ScrollStatusFormatter,\n\ttype SizeValue,\n\tSlot,\n\tTUI,\n} from \"./tui.js\";\n// Utilities\nexport { applyBackgroundToLine, truncateToWidth, visibleWidth, wrapTextWithAnsi } from \"./utils.js\";\n"]}
package/dist/tui.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Minimal TUI implementation with differential rendering
3
3
  */
4
+ import type { FlexSpacer } from "./components/spacer.js";
4
5
  import type { Terminal } from "./terminal.js";
5
6
  /**
6
7
  * Component interface - all components must implement this
@@ -251,6 +252,35 @@ export declare class TUI extends Container {
251
252
  private previousViewportTop;
252
253
  private fullRedrawCount;
253
254
  private stopped;
255
+ /**
256
+ * The filler that keeps the app the size of the screen.
257
+ *
258
+ * ## Why the app is full-screen at all
259
+ *
260
+ * This renderer appends: a frame is the whole component tree flattened into
261
+ * a line buffer, written from wherever the cursor happens to be. On a fresh
262
+ * session that buffer is a dozen rows, so the banner sat halfway up a
263
+ * terminal with the prompt under it and forty rows of the user's shell
264
+ * history above — and the prompt walked down the screen as the conversation
265
+ * grew, only reaching the bottom row once the session was long enough to
266
+ * scroll. Two different layouts for the same app, and the one you meet first
267
+ * is the one that does not look like an app.
268
+ *
269
+ * ## What this does
270
+ *
271
+ * Before the frame is diffed, the root measures it and gives the leftover
272
+ * rows to one designated child. The buffer is therefore never shorter than
273
+ * the terminal, so the terminal's last row is always the buffer's last row:
274
+ * the header stays at the top, the prompt and the footer stay on the bottom,
275
+ * and everything between them is conversation. Nothing else changes — this
276
+ * is still the normal screen, so scrollback, selection and search all still
277
+ * work, and the session is still on screen after you quit.
278
+ *
279
+ * Set to `undefined` (no flex child) and the old append-only behaviour is
280
+ * exactly what you get back, which is what the tests that predate this and
281
+ * any embedder outside the app rely on.
282
+ */
283
+ private flexSpacer?;
254
284
  /**
255
285
  * The pinned viewport.
256
286
  *
@@ -315,6 +345,23 @@ export declare class TUI extends Container {
315
345
  } | null;
316
346
  /** Let the app paint the indicator in its own theme. */
317
347
  setScrollStatusFormatter(formatter: ScrollStatusFormatter): void;
348
+ /**
349
+ * Nominate the child that absorbs the leftover rows (see `flexSpacer`).
350
+ *
351
+ * It must already be a child of the root, and it should sit between the part
352
+ * of the tree that flows from the top and the chrome that hangs off the
353
+ * bottom — everything after it is what gets pinned to the foot of the screen.
354
+ */
355
+ setFlexSpacer(spacer: FlexSpacer | undefined): void;
356
+ /**
357
+ * Give the flex child whatever the frame did not use, at `height` rows.
358
+ *
359
+ * Returns true when the height moved, meaning the caller has to flatten
360
+ * again — the measurement can only be made from a finished frame, so the
361
+ * frame that answers it is always the second one. Both passes are cheap
362
+ * after the first: every other child returns its memoized array untouched.
363
+ */
364
+ private fitFlexSpacer;
318
365
  /**
319
366
  * The screen rows a pinned window shows, the last one being the indicator.
320
367
  *
@@ -324,7 +371,9 @@ export declare class TUI extends Container {
324
371
  */
325
372
  private scrollViewHeight;
326
373
  /** Rows available to scroll through — the live buffer while live, the
327
- * measured one while pinned. */
374
+ * measured one while pinned. The filler is not transcript: counting it would
375
+ * let a session with nothing above the fold pin itself one row off the
376
+ * bottom and paint a screen of blanks. */
328
377
  private transcriptLength;
329
378
  /**
330
379
  * Move the view by `delta` rows; negative is towards the start.