@m4ike1/ion-tui 0.1.0
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.
- package/README.md +114 -0
- package/dist/alt-screen-search.d.ts +46 -0
- package/dist/alt-screen-search.d.ts.map +1 -0
- package/dist/alt-screen-search.js +282 -0
- package/dist/alt-screen-search.js.map +1 -0
- package/dist/autocomplete.d.ts +75 -0
- package/dist/autocomplete.d.ts.map +1 -0
- package/dist/autocomplete.js +749 -0
- package/dist/autocomplete.js.map +1 -0
- package/dist/components/alt-screen-flash.d.ts +13 -0
- package/dist/components/alt-screen-flash.d.ts.map +1 -0
- package/dist/components/alt-screen-flash.js +37 -0
- package/dist/components/alt-screen-flash.js.map +1 -0
- package/dist/components/box.d.ts +24 -0
- package/dist/components/box.d.ts.map +1 -0
- package/dist/components/box.js +133 -0
- package/dist/components/box.js.map +1 -0
- package/dist/components/cancellable-loader.d.ts +22 -0
- package/dist/components/cancellable-loader.d.ts.map +1 -0
- package/dist/components/cancellable-loader.js +35 -0
- package/dist/components/cancellable-loader.js.map +1 -0
- package/dist/components/editor.d.ts +266 -0
- package/dist/components/editor.d.ts.map +1 -0
- package/dist/components/editor.js +2087 -0
- package/dist/components/editor.js.map +1 -0
- package/dist/components/h-stack.d.ts +7 -0
- package/dist/components/h-stack.d.ts.map +1 -0
- package/dist/components/h-stack.js +43 -0
- package/dist/components/h-stack.js.map +1 -0
- package/dist/components/image.d.ts +28 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/image.js +90 -0
- package/dist/components/image.js.map +1 -0
- package/dist/components/input.d.ts +48 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +417 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/loader.d.ts +33 -0
- package/dist/components/loader.d.ts.map +1 -0
- package/dist/components/loader.js +76 -0
- package/dist/components/loader.js.map +1 -0
- package/dist/components/markdown.d.ts +103 -0
- package/dist/components/markdown.d.ts.map +1 -0
- package/dist/components/markdown.js +858 -0
- package/dist/components/markdown.js.map +1 -0
- package/dist/components/mouse-region.d.ts +12 -0
- package/dist/components/mouse-region.d.ts.map +1 -0
- package/dist/components/mouse-region.js +21 -0
- package/dist/components/mouse-region.js.map +1 -0
- package/dist/components/scroll-view.d.ts +68 -0
- package/dist/components/scroll-view.d.ts.map +1 -0
- package/dist/components/scroll-view.js +199 -0
- package/dist/components/scroll-view.js.map +1 -0
- package/dist/components/select-list.d.ts +53 -0
- package/dist/components/select-list.d.ts.map +1 -0
- package/dist/components/select-list.js +206 -0
- package/dist/components/select-list.js.map +1 -0
- package/dist/components/settings-list.d.ts +60 -0
- package/dist/components/settings-list.d.ts.map +1 -0
- package/dist/components/settings-list.js +252 -0
- package/dist/components/settings-list.js.map +1 -0
- package/dist/components/spacer.d.ts +12 -0
- package/dist/components/spacer.d.ts.map +1 -0
- package/dist/components/spacer.js +23 -0
- package/dist/components/spacer.js.map +1 -0
- package/dist/components/stack.d.ts +32 -0
- package/dist/components/stack.d.ts.map +1 -0
- package/dist/components/stack.js +111 -0
- package/dist/components/stack.js.map +1 -0
- package/dist/components/text.d.ts +19 -0
- package/dist/components/text.d.ts.map +1 -0
- package/dist/components/text.js +90 -0
- package/dist/components/text.js.map +1 -0
- package/dist/components/truncated-text.d.ts +13 -0
- package/dist/components/truncated-text.d.ts.map +1 -0
- package/dist/components/truncated-text.js +51 -0
- package/dist/components/truncated-text.js.map +1 -0
- package/dist/components/v-stack.d.ts +8 -0
- package/dist/components/v-stack.d.ts.map +1 -0
- package/dist/components/v-stack.js +26 -0
- package/dist/components/v-stack.js.map +1 -0
- package/dist/components/virtual-list.d.ts +51 -0
- package/dist/components/virtual-list.d.ts.map +1 -0
- package/dist/components/virtual-list.js +170 -0
- package/dist/components/virtual-list.js.map +1 -0
- package/dist/editor-component.d.ts +39 -0
- package/dist/editor-component.d.ts.map +1 -0
- package/dist/editor-component.js +2 -0
- package/dist/editor-component.js.map +1 -0
- package/dist/fuzzy.d.ts +16 -0
- package/dist/fuzzy.d.ts.map +1 -0
- package/dist/fuzzy.js +110 -0
- package/dist/fuzzy.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +46 -0
- package/dist/index.js.map +1 -0
- package/dist/keybindings.d.ts +366 -0
- package/dist/keybindings.d.ts.map +1 -0
- package/dist/keybindings.js +331 -0
- package/dist/keybindings.js.map +1 -0
- package/dist/keys.d.ts +184 -0
- package/dist/keys.d.ts.map +1 -0
- package/dist/keys.js +1174 -0
- package/dist/keys.js.map +1 -0
- package/dist/kill-ring.d.ts +28 -0
- package/dist/kill-ring.d.ts.map +1 -0
- package/dist/kill-ring.js +44 -0
- package/dist/kill-ring.js.map +1 -0
- package/dist/latex.d.ts +10 -0
- package/dist/latex.d.ts.map +1 -0
- package/dist/latex.js +1285 -0
- package/dist/latex.js.map +1 -0
- package/dist/layout-node.d.ts +59 -0
- package/dist/layout-node.d.ts.map +1 -0
- package/dist/layout-node.js +12 -0
- package/dist/layout-node.js.map +1 -0
- package/dist/layout.d.ts +42 -0
- package/dist/layout.d.ts.map +1 -0
- package/dist/layout.js +404 -0
- package/dist/layout.js.map +1 -0
- package/dist/native-modifiers.d.ts +4 -0
- package/dist/native-modifiers.d.ts.map +1 -0
- package/dist/native-modifiers.js +13 -0
- package/dist/native-modifiers.js.map +1 -0
- package/dist/native-module-path.d.ts +7 -0
- package/dist/native-module-path.d.ts.map +1 -0
- package/dist/native-module-path.js +19 -0
- package/dist/native-module-path.js.map +1 -0
- package/dist/native-platform.d.ts +18 -0
- package/dist/native-platform.d.ts.map +1 -0
- package/dist/native-platform.js +42 -0
- package/dist/native-platform.js.map +1 -0
- package/dist/pty-host.d.ts +224 -0
- package/dist/pty-host.d.ts.map +1 -0
- package/dist/pty-host.js +347 -0
- package/dist/pty-host.js.map +1 -0
- package/dist/stdin-buffer.d.ts +56 -0
- package/dist/stdin-buffer.d.ts.map +1 -0
- package/dist/stdin-buffer.js +366 -0
- package/dist/stdin-buffer.js.map +1 -0
- package/dist/terminal-colors.d.ts +10 -0
- package/dist/terminal-colors.d.ts.map +1 -0
- package/dist/terminal-colors.js +59 -0
- package/dist/terminal-colors.js.map +1 -0
- package/dist/terminal-image.d.ts +118 -0
- package/dist/terminal-image.d.ts.map +1 -0
- package/dist/terminal-image.js +550 -0
- package/dist/terminal-image.js.map +1 -0
- package/dist/terminal.d.ts +123 -0
- package/dist/terminal.d.ts.map +1 -0
- package/dist/terminal.js +442 -0
- package/dist/terminal.js.map +1 -0
- package/dist/tui-alt-screen.d.ts +165 -0
- package/dist/tui-alt-screen.d.ts.map +1 -0
- package/dist/tui-alt-screen.js +1515 -0
- package/dist/tui-alt-screen.js.map +1 -0
- package/dist/tui-main-screen.d.ts +39 -0
- package/dist/tui-main-screen.d.ts.map +1 -0
- package/dist/tui-main-screen.js +594 -0
- package/dist/tui-main-screen.js.map +1 -0
- package/dist/tui.d.ts +431 -0
- package/dist/tui.d.ts.map +1 -0
- package/dist/tui.js +1142 -0
- package/dist/tui.js.map +1 -0
- package/dist/undo-stack.d.ts +17 -0
- package/dist/undo-stack.d.ts.map +1 -0
- package/dist/undo-stack.js +25 -0
- package/dist/undo-stack.js.map +1 -0
- package/dist/utils.d.ts +98 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +1200 -0
- package/dist/utils.js.map +1 -0
- package/dist/word-navigation.d.ts +25 -0
- package/dist/word-navigation.d.ts.map +1 -0
- package/dist/word-navigation.js +96 -0
- package/dist/word-navigation.js.map +1 -0
- package/native/clipboard.h +170 -0
- package/native/darwin/README.md +22 -0
- package/native/darwin/build.sh +69 -0
- package/native/darwin/prebuilds/darwin-arm64/darwin-platform.node +0 -0
- package/native/darwin/prebuilds/darwin-x64/darwin-platform.node +0 -0
- package/native/darwin/src/darwin-platform.m +93 -0
- package/native/linux/README.md +23 -0
- package/native/linux/build.sh +65 -0
- package/native/linux/prebuilds/linux-arm64/linux-platform-x11.node +0 -0
- package/native/linux/prebuilds/linux-x64/linux-platform-x11.node +0 -0
- package/native/linux/src/clipboard-worker.h +70 -0
- package/native/linux/src/linux-platform-x11.c +274 -0
- package/native/napi.h +89 -0
- package/native/win32/README.md +31 -0
- package/native/win32/build.mjs +232 -0
- package/native/win32/prebuilds/win32-arm64/win32-platform.node +0 -0
- package/native/win32/prebuilds/win32-x64/win32-platform.node +0 -0
- package/native/win32/src/win32-platform.c +241 -0
- package/package.json +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui-main-screen.js","sourceRoot":"","sources":["../src/tui-main-screen.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAY,OAAO,EAAuB,MAAM,UAAU,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AACvC,MAAM,sBAAsB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,qBAAqB;IAClB,MAAM,GAAG,EAAE,CAAC;IACZ,YAAY,GAAG,CAAC,CAAC;IACR,KAAK,CAAyB;IAE/C,YAAY,KAA6B,EAAE;QAC1C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAAA,CACnB;IAED;;;OAGG;IACH,MAAM,CAAC,KAAa,EAAQ;QAC3B,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,OAAO,MAAM,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;YAC9B,MAAM,QAAQ,GAAG,sBAAsB,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;YAC7D,IAAI,QAAQ,KAAK,CAAC,EAAE,CAAC;gBACpB,IA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Q,CAAC,UAAU,EAAE,CAAC;QAC5B,CAAC;IAAA,CACD;CACD","sourcesContent":["import * as fs from \"node:fs\";\nimport * as os from \"node:os\";\nimport * as path from \"node:path\";\nimport { deleteKittyImage, isImageLine } from \"./terminal-image.ts\";\nimport { type TUI, TuiBase, type TuiStopOptions } from \"./tui.ts\";\nimport { visibleWidth } from \"./utils.ts\";\n\nconst KITTY_SEQUENCE_PREFIX = \"\\x1b_G\";\nconst MAX_RENDER_WRITE_CHARS = 1024 * 1024;\n\n/**\n * Streams terminal output in 1 MiB chunks so a full render never forms one string large enough to exceed V8's limit.\n *\n * `append()` fills the current chunk and flushes it when full. Oversized input is split at chunk boundaries, preserving\n * surrogate pairs so each write remains valid UTF-16. Callers append synchronized-output begin/end sequences themselves;\n * the final `flush()` writes any remainder, including the end sequence.\n */\nclass BoundedTerminalWriter {\n\tprivate buffer = \"\";\n\tprivate writtenChars = 0;\n\tprivate readonly write: (data: string) => void;\n\n\tconstructor(write: (data: string) => void) {\n\t\tthis.write = write;\n\t}\n\n\t/**\n\t * Append terminal data, flushing full chunks as needed. Callers must call `flush()` after the final append.\n\t * @param value Terminal data to write in order; oversized values are split without splitting surrogate pairs.\n\t */\n\tappend(value: string): void {\n\t\tlet offset = 0;\n\t\twhile (offset < value.length) {\n\t\t\tconst capacity = MAX_RENDER_WRITE_CHARS - this.buffer.length;\n\t\t\tif (capacity === 0) {\n\t\t\t\tthis.flush();\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tlet end = Math.min(value.length, offset + capacity);\n\t\t\tif (\n\t\t\t\tend < value.length &&\n\t\t\t\tvalue.charCodeAt(end - 1) >= 0xd800 &&\n\t\t\t\tvalue.charCodeAt(end - 1) <= 0xdbff &&\n\t\t\t\tvalue.charCodeAt(end) >= 0xdc00 &&\n\t\t\t\tvalue.charCodeAt(end) <= 0xdfff\n\t\t\t) {\n\t\t\t\tend--;\n\t\t\t}\n\t\t\tif (end === offset) {\n\t\t\t\tthis.flush();\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tthis.buffer += value.slice(offset, end);\n\t\t\toffset = end;\n\t\t\tif (this.buffer.length === MAX_RENDER_WRITE_CHARS) {\n\t\t\t\tthis.flush();\n\t\t\t}\n\t\t}\n\t}\n\n\t/** Write the current chunk, if any, and retain only its character count for debug output. */\n\tflush(): void {\n\t\tif (!this.buffer) return;\n\t\tthis.write(this.buffer);\n\t\tthis.writtenChars += this.buffer.length;\n\t\tthis.buffer = \"\";\n\t}\n\n\tget length(): number {\n\t\treturn this.writtenChars + this.buffer.length;\n\t}\n}\n\ninterface KittyImageHeader {\n\tids: number[];\n\trows: number;\n}\n\nfunction parseKittyImageHeader(line: string): KittyImageHeader | undefined {\n\tconst sequenceStart = line.indexOf(KITTY_SEQUENCE_PREFIX);\n\tif (sequenceStart === -1) return undefined;\n\tconst paramsStart = sequenceStart + KITTY_SEQUENCE_PREFIX.length;\n\tconst paramsEnd = line.indexOf(\";\", paramsStart);\n\tif (paramsEnd === -1) return undefined;\n\n\tconst ids: number[] = [];\n\tlet rows = 1;\n\tfor (const param of line.slice(paramsStart, paramsEnd).split(\",\")) {\n\t\tconst [key, value] = param.split(\"=\", 2);\n\t\tif (value === undefined) continue;\n\t\tconst numberValue = Number(value);\n\t\tif (!Number.isInteger(numberValue) || numberValue <= 0 || numberValue > 0xffffffff) continue;\n\t\tif (key === \"i\") ids.push(numberValue);\n\t\telse if (key === \"r\") rows = numberValue;\n\t}\n\treturn { ids, rows };\n}\n\nfunction extractKittyImageIds(line: string): number[] {\n\treturn parseKittyImageHeader(line)?.ids ?? [];\n}\n\nfunction extractKittyImageRows(line: string): number {\n\treturn parseKittyImageHeader(line)?.rows ?? 1;\n}\n\nfunction isTermuxSession(): boolean {\n\treturn Boolean(process.env.TERMUX_VERSION);\n}\n\nexport interface TuiMainScreenRenderState {\n\tpreviousLines: string[];\n\tpreviousWidth: number;\n\tpreviousHeight: number;\n\tcursorRow: number;\n\thardwareCursorRow: number;\n\tmaxLinesRendered: number;\n\tpreviousViewportTop: number;\n}\n\n/** TUI implementation that renders into the terminal's main screen and scrollback. */\nexport class TuiMainScreen extends TuiBase implements TUI {\n\treadonly mode = \"regular\" as const;\n\tprivate previousLines: string[] = [];\n\tprivate previousKittyImageIds = new Set<number>();\n\tprivate previousWidth = 0;\n\tprivate previousHeight = 0;\n\tprivate cursorRow = 0;\n\tprivate hardwareCursorRow = 0;\n\tprivate maxLinesRendered = 0;\n\tprivate previousViewportTop = 0;\n\n\tcaptureRenderState(): TuiMainScreenRenderState {\n\t\treturn {\n\t\t\tpreviousLines: [...this.previousLines],\n\t\t\tpreviousWidth: this.previousWidth,\n\t\t\tpreviousHeight: this.previousHeight,\n\t\t\tcursorRow: this.cursorRow,\n\t\t\thardwareCursorRow: this.hardwareCursorRow,\n\t\t\tmaxLinesRendered: this.maxLinesRendered,\n\t\t\tpreviousViewportTop: this.previousViewportTop,\n\t\t};\n\t}\n\n\trestoreRenderState(state: TuiMainScreenRenderState): void {\n\t\tthis.previousLines = state.previousLines.map((line) => (isImageLine(line) ? \"\" : line));\n\t\tthis.previousKittyImageIds = new Set();\n\t\tthis.previousWidth = state.previousWidth;\n\t\tthis.previousHeight = state.previousHeight;\n\t\tthis.cursorRow = state.cursorRow;\n\t\tthis.hardwareCursorRow = state.hardwareCursorRow;\n\t\tthis.maxLinesRendered = state.maxLinesRendered;\n\t\tthis.previousViewportTop = state.previousViewportTop;\n\t}\n\n\tprotected override resetRenderState(): void {\n\t\tthis.previousLines = [];\n\t\tthis.previousWidth = -1;\n\t\tthis.previousHeight = -1;\n\t\tthis.cursorRow = 0;\n\t\tthis.hardwareCursorRow = 0;\n\t\tthis.maxLinesRendered = 0;\n\t\tthis.previousViewportTop = 0;\n\t}\n\n\tprotected override beforeTerminalStop(options: TuiStopOptions): void {\n\t\tif (options.preserveScreen || this.previousLines.length === 0) return;\n\t\tthis.terminal.write(\" \");\n\t\tconst targetRow = this.previousLines.length;\n\t\tconst lineDiff = targetRow - this.hardwareCursorRow;\n\t\tif (lineDiff > 0) this.terminal.write(`\\x1b[${lineDiff}B`);\n\t\telse if (lineDiff < 0) this.terminal.write(`\\x1b[${-lineDiff}A`);\n\t\tthis.terminal.write(\"\\r\\n\");\n\t}\n\n\tprivate collectKittyImageIds(lines: string[]): Set<number> {\n\t\tconst ids = new Set<number>();\n\t\tfor (const line of lines) {\n\t\t\tfor (const id of extractKittyImageIds(line)) {\n\t\t\t\tids.add(id);\n\t\t\t}\n\t\t}\n\t\treturn ids;\n\t}\n\n\tprivate deleteKittyImages(ids: Iterable<number>): string {\n\t\tlet buffer = \"\";\n\t\tfor (const id of ids) {\n\t\t\tbuffer += deleteKittyImage(id);\n\t\t}\n\t\treturn buffer;\n\t}\n\n\tprivate getKittyImageReservedRows(lines: string[], index: number, maxIndex = lines.length - 1): number {\n\t\tconst rows = extractKittyImageRows(lines[index] ?? \"\");\n\t\tif (rows <= 1) return 1;\n\n\t\tconst maxRows = Math.min(rows, maxIndex - index + 1, lines.length - index);\n\t\tlet reservedRows = 1;\n\t\twhile (reservedRows < maxRows) {\n\t\t\tconst line = lines[index + reservedRows] ?? \"\";\n\t\t\tif (isImageLine(line) || visibleWidth(line) > 0) break;\n\t\t\treservedRows++;\n\t\t}\n\t\treturn reservedRows;\n\t}\n\n\tprivate expandChangedRangeForKittyImages(\n\t\tfirstChanged: number,\n\t\tlastChanged: number,\n\t\tnewLines: string[],\n\t): { firstChanged: number; lastChanged: number } {\n\t\tlet expandedFirstChanged = firstChanged;\n\t\tlet expandedLastChanged = lastChanged;\n\t\tconst expandForLines = (lines: string[]): void => {\n\t\t\tfor (let i = 0; i < lines.length; i++) {\n\t\t\t\tif (extractKittyImageIds(lines[i]).length === 0) continue;\n\t\t\t\tconst blockEnd = i + this.getKittyImageReservedRows(lines, i) - 1;\n\t\t\t\tif (i >= firstChanged || (i <= lastChanged && blockEnd >= firstChanged)) {\n\t\t\t\t\texpandedFirstChanged = Math.min(expandedFirstChanged, i);\n\t\t\t\t\texpandedLastChanged = Math.max(expandedLastChanged, blockEnd);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\texpandForLines(this.previousLines);\n\t\texpandForLines(newLines);\n\t\treturn { firstChanged: expandedFirstChanged, lastChanged: expandedLastChanged };\n\t}\n\n\tprivate deleteChangedKittyImages(firstChanged: number, lastChanged: number): string {\n\t\tif (firstChanged < 0 || lastChanged < firstChanged) return \"\";\n\n\t\tconst ids = new Set<number>();\n\t\tconst maxLine = Math.min(lastChanged, this.previousLines.length - 1);\n\t\tfor (let i = firstChanged; i <= maxLine; i++) {\n\t\t\tfor (const id of extractKittyImageIds(this.previousLines[i] ?? \"\")) {\n\t\t\t\tids.add(id);\n\t\t\t}\n\t\t}\n\n\t\treturn this.deleteKittyImages(ids);\n\t}\n\n\tprotected doRender(): void {\n\t\tif (this.stopped) return;\n\t\tconst width = this.terminal.columns;\n\t\tconst height = this.terminal.rows;\n\t\tconst widthChanged = this.previousWidth !== 0 && this.previousWidth !== width;\n\t\tconst heightChanged = this.previousHeight !== 0 && this.previousHeight !== height;\n\t\tconst previousBufferLength = this.previousHeight > 0 ? this.previousViewportTop + this.previousHeight : height;\n\t\tlet prevViewportTop = heightChanged ? Math.max(0, previousBufferLength - height) : this.previousViewportTop;\n\t\tlet viewportTop = prevViewportTop;\n\t\tlet hardwareCursorRow = this.hardwareCursorRow;\n\t\tconst computeLineDiff = (targetRow: number): number => {\n\t\t\tconst currentScreenRow = hardwareCursorRow - prevViewportTop;\n\t\t\tconst targetScreenRow = targetRow - viewportTop;\n\t\t\treturn targetScreenRow - currentScreenRow;\n\t\t};\n\n\t\t// Render all components to get new lines\n\t\tlet newLines = this.render(width);\n\n\t\t// Composite overlays into the rendered lines (before differential compare)\n\t\tif (this.hasOverlayEntries) {\n\t\t\tnewLines = this.compositeOverlays(newLines, width, height);\n\t\t}\n\n\t\t// Extract cursor position before applying line resets (marker must be found first)\n\t\tconst cursorPos = this.extractCursorPosition(newLines, height);\n\n\t\tnewLines = this.applyLineResets(newLines);\n\n\t\t// Helper to clear scrollback and viewport and render all new lines\n\t\tconst fullRender = (clear: boolean): void => {\n\t\t\tthis.fullRedrawCount += 1;\n\t\t\tconst output = new BoundedTerminalWriter((data) => this.terminal.write(data));\n\t\t\toutput.append(\"\\x1b[?2026h\"); // Begin synchronized output\n\t\t\tif (clear) {\n\t\t\t\toutput.append(this.deleteKittyImages(this.previousKittyImageIds));\n\t\t\t\toutput.append(\"\\x1b[2J\\x1b[H\\x1b[3J\"); // Clear screen, home, then clear scrollback\n\t\t\t}\n\t\t\tfor (let i = 0; i < newLines.length; i++) {\n\t\t\t\tif (i > 0) output.append(\"\\r\\n\");\n\t\t\t\tconst line = newLines[i];\n\t\t\t\tconst isImage = isImageLine(line);\n\t\t\t\tconst imageReservedRows = isImage ? this.getKittyImageReservedRows(newLines, i) : 1;\n\t\t\t\tif (imageReservedRows > 1 && imageReservedRows <= height) {\n\t\t\t\t\tfor (let row = 1; row < imageReservedRows; row++) {\n\t\t\t\t\t\toutput.append(\"\\r\\n\");\n\t\t\t\t\t}\n\t\t\t\t\toutput.append(`\\x1b[${imageReservedRows - 1}A`);\n\t\t\t\t\toutput.append(line);\n\t\t\t\t\toutput.append(`\\x1b[${imageReservedRows - 1}B`);\n\t\t\t\t\ti += imageReservedRows - 1;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\toutput.append(line);\n\t\t\t}\n\t\t\toutput.append(\"\\x1b[?2026l\"); // End synchronized output\n\t\t\toutput.flush();\n\t\t\tthis.cursorRow = Math.max(0, newLines.length - 1);\n\t\t\tthis.hardwareCursorRow = this.cursorRow;\n\t\t\t// Reset max lines when clearing, otherwise track growth\n\t\t\tif (clear) {\n\t\t\t\tthis.maxLinesRendered = newLines.length;\n\t\t\t} else {\n\t\t\t\tthis.maxLinesRendered = Math.max(this.maxLinesRendered, newLines.length);\n\t\t\t}\n\t\t\tconst bufferLength = Math.max(height, newLines.length);\n\t\t\tthis.previousViewportTop = Math.max(0, bufferLength - height);\n\t\t\tthis.positionHardwareCursor(cursorPos, newLines.length);\n\t\t\tthis.previousLines = newLines;\n\t\t\tthis.previousKittyImageIds = this.collectKittyImageIds(newLines);\n\t\t\tthis.previousWidth = width;\n\t\t\tthis.previousHeight = height;\n\t\t};\n\n\t\tconst redrawLogDirectory = process.env.ION_TUI_DEBUG_REDRAW === \"1\" ? this.logDirectory : undefined;\n\t\tconst logRedraw = (reason: string): void => {\n\t\t\tif (redrawLogDirectory === undefined) return;\n\t\t\tconst logPath = path.join(redrawLogDirectory, \"ion-tui-debug.log\");\n\t\t\tconst msg = `[${new Date().toISOString()}] fullRender: ${reason} (prev=${this.previousLines.length}, new=${newLines.length}, height=${height})\\n`;\n\t\t\tfs.mkdirSync(path.dirname(logPath), { recursive: true });\n\t\t\tfs.appendFileSync(logPath, msg);\n\t\t};\n\n\t\t// First render - just output everything without clearing (assumes clean screen)\n\t\tif (this.previousLines.length === 0 && !widthChanged && !heightChanged) {\n\t\t\tlogRedraw(\"first render\");\n\t\t\tfullRender(false);\n\t\t\treturn;\n\t\t}\n\n\t\t// Width changes always need a full re-render because wrapping changes.\n\t\tif (widthChanged) {\n\t\t\tlogRedraw(`terminal width changed (${this.previousWidth} -> ${width})`);\n\t\t\tfullRender(true);\n\t\t\treturn;\n\t\t}\n\n\t\t// Height changes normally need a full re-render to keep the visible viewport aligned,\n\t\t// but Termux changes height when the software keyboard shows or hides.\n\t\t// In that environment, a full redraw causes the entire history to replay on every toggle.\n\t\tif (heightChanged && !isTermuxSession()) {\n\t\t\tlogRedraw(`terminal height changed (${this.previousHeight} -> ${height})`);\n\t\t\tfullRender(true);\n\t\t\treturn;\n\t\t}\n\n\t\t// Content shrunk below the working area and no overlays - re-render to clear empty rows\n\t\t// (overlays need the padding, so only do this when no overlays are active)\n\t\t// Configurable via setClearOnShrink()\n\t\tif (this.getClearOnShrink() && newLines.length < this.maxLinesRendered && !this.hasOverlayEntries) {\n\t\t\tlogRedraw(`clearOnShrink (maxLinesRendered=${this.maxLinesRendered})`);\n\t\t\tfullRender(true);\n\t\t\treturn;\n\t\t}\n\n\t\t// Find first and last changed lines\n\t\tlet firstChanged = -1;\n\t\tlet lastChanged = -1;\n\t\tconst maxLines = Math.max(newLines.length, this.previousLines.length);\n\t\tfor (let i = 0; i < maxLines; i++) {\n\t\t\tconst oldLine = i < this.previousLines.length ? this.previousLines[i] : \"\";\n\t\t\tconst newLine = i < newLines.length ? newLines[i] : \"\";\n\n\t\t\tif (oldLine !== newLine) {\n\t\t\t\tif (firstChanged === -1) {\n\t\t\t\t\tfirstChanged = i;\n\t\t\t\t}\n\t\t\t\tlastChanged = i;\n\t\t\t}\n\t\t}\n\t\tconst appendedLines = newLines.length > this.previousLines.length;\n\t\tif (appendedLines) {\n\t\t\tif (firstChanged === -1) {\n\t\t\t\tfirstChanged = this.previousLines.length;\n\t\t\t}\n\t\t\tlastChanged = newLines.length - 1;\n\t\t}\n\t\tif (firstChanged !== -1) {\n\t\t\tconst expandedRange = this.expandChangedRangeForKittyImages(firstChanged, lastChanged, newLines);\n\t\t\tfirstChanged = expandedRange.firstChanged;\n\t\t\tlastChanged = expandedRange.lastChanged;\n\t\t}\n\t\tconst appendStart = appendedLines && firstChanged === this.previousLines.length && firstChanged > 0;\n\n\t\t// No changes - but still need to update hardware cursor position if it moved\n\t\tif (firstChanged === -1) {\n\t\t\tthis.positionHardwareCursor(cursorPos, newLines.length);\n\t\t\tthis.previousViewportTop = prevViewportTop;\n\t\t\tthis.previousHeight = height;\n\t\t\treturn;\n\t\t}\n\n\t\t// All changes are in deleted lines (nothing to render, just clear)\n\t\tif (firstChanged >= newLines.length) {\n\t\t\tif (this.previousLines.length > newLines.length) {\n\t\t\t\tconst output = new BoundedTerminalWriter((data) => this.terminal.write(data));\n\t\t\t\toutput.append(\"\\x1b[?2026h\");\n\t\t\t\toutput.append(this.deleteChangedKittyImages(firstChanged, lastChanged));\n\t\t\t\t// Move to end of new content (clamp to 0 for empty content)\n\t\t\t\tconst targetRow = Math.max(0, newLines.length - 1);\n\t\t\t\tif (targetRow < prevViewportTop) {\n\t\t\t\t\tlogRedraw(`deleted lines moved viewport up (${targetRow} < ${prevViewportTop})`);\n\t\t\t\t\tfullRender(true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst lineDiff = computeLineDiff(targetRow);\n\t\t\t\tif (lineDiff > 0) output.append(`\\x1b[${lineDiff}B`);\n\t\t\t\telse if (lineDiff < 0) output.append(`\\x1b[${-lineDiff}A`);\n\t\t\t\toutput.append(\"\\r\");\n\t\t\t\t// Clear extra lines without scrolling\n\t\t\t\tconst extraLines = this.previousLines.length - newLines.length;\n\t\t\t\tif (extraLines > height) {\n\t\t\t\t\tlogRedraw(`extraLines > height (${extraLines} > ${height})`);\n\t\t\t\t\tfullRender(true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tconst clearStartOffset = newLines.length === 0 ? 0 : 1;\n\t\t\t\tif (extraLines > 0 && clearStartOffset > 0) {\n\t\t\t\t\toutput.append(`\\x1b[${clearStartOffset}B`);\n\t\t\t\t}\n\t\t\t\tfor (let i = 0; i < extraLines; i++) {\n\t\t\t\t\toutput.append(\"\\r\\x1b[2K\");\n\t\t\t\t\tif (i < extraLines - 1) output.append(\"\\x1b[1B\");\n\t\t\t\t}\n\t\t\t\tconst moveBack = Math.max(0, extraLines - 1 + clearStartOffset);\n\t\t\t\tif (moveBack > 0) {\n\t\t\t\t\toutput.append(`\\x1b[${moveBack}A`);\n\t\t\t\t}\n\t\t\t\toutput.append(\"\\x1b[?2026l\");\n\t\t\t\toutput.flush();\n\t\t\t\tthis.cursorRow = targetRow;\n\t\t\t\tthis.hardwareCursorRow = targetRow;\n\t\t\t}\n\t\t\tthis.positionHardwareCursor(cursorPos, newLines.length);\n\t\t\tthis.previousLines = newLines;\n\t\t\tthis.previousKittyImageIds = this.collectKittyImageIds(newLines);\n\t\t\tthis.previousWidth = width;\n\t\t\tthis.previousHeight = height;\n\t\t\tthis.previousViewportTop = prevViewportTop;\n\t\t\treturn;\n\t\t}\n\n\t\t// Differential rendering can only touch what was actually visible.\n\t\t// If the first changed line is above the previous viewport, we need a full redraw.\n\t\tif (firstChanged < prevViewportTop) {\n\t\t\tlogRedraw(`firstChanged < viewportTop (${firstChanged} < ${prevViewportTop})`);\n\t\t\tfullRender(true);\n\t\t\treturn;\n\t\t}\n\n\t\t// Render from first changed line to end\n\t\t// Keep updates wrapped in synchronized output while writing bounded chunks.\n\t\tconst output = new BoundedTerminalWriter((data) => this.terminal.write(data));\n\t\toutput.append(\"\\x1b[?2026h\"); // Begin synchronized output\n\t\toutput.append(this.deleteChangedKittyImages(firstChanged, lastChanged));\n\t\tconst prevViewportBottom = prevViewportTop + height - 1;\n\t\tconst moveTargetRow = appendStart ? firstChanged - 1 : firstChanged;\n\t\tif (moveTargetRow > prevViewportBottom) {\n\t\t\tconst currentScreenRow = Math.max(0, Math.min(height - 1, hardwareCursorRow - prevViewportTop));\n\t\t\tconst moveToBottom = height - 1 - currentScreenRow;\n\t\t\tif (moveToBottom > 0) {\n\t\t\t\toutput.append(`\\x1b[${moveToBottom}B`);\n\t\t\t}\n\t\t\tconst scroll = moveTargetRow - prevViewportBottom;\n\t\t\toutput.append(\"\\r\\n\".repeat(scroll));\n\t\t\tprevViewportTop += scroll;\n\t\t\tviewportTop += scroll;\n\t\t\thardwareCursorRow = moveTargetRow;\n\t\t}\n\n\t\t// Move cursor to first changed line (use hardwareCursorRow for actual position)\n\t\tconst lineDiff = computeLineDiff(moveTargetRow);\n\t\tif (lineDiff > 0) {\n\t\t\toutput.append(`\\x1b[${lineDiff}B`); // Move down\n\t\t} else if (lineDiff < 0) {\n\t\t\toutput.append(`\\x1b[${-lineDiff}A`); // Move up\n\t\t}\n\n\t\toutput.append(appendStart ? \"\\r\\n\" : \"\\r\"); // Move to column 0\n\n\t\t// Only render changed lines (firstChanged to lastChanged), not all lines to end\n\t\t// This reduces flicker when only a single line changes (e.g., spinner animation)\n\t\tconst renderEnd = Math.min(lastChanged, newLines.length - 1);\n\t\tfor (let i = firstChanged; i <= renderEnd; i++) {\n\t\t\tif (i > firstChanged) output.append(\"\\r\\n\");\n\t\t\tconst line = newLines[i];\n\t\t\tconst isImage = isImageLine(line);\n\t\t\tconst imageReservedRows = isImage ? this.getKittyImageReservedRows(newLines, i, renderEnd) : 1;\n\t\t\tif (imageReservedRows > 1) {\n\t\t\t\tconst imageStartScreenRow = i - viewportTop;\n\t\t\t\tif (imageStartScreenRow < 0 || imageStartScreenRow + imageReservedRows > height) {\n\t\t\t\t\tlogRedraw(\n\t\t\t\t\t\t`kitty image pre-clear would scroll (${imageStartScreenRow} + ${imageReservedRows} > ${height})`,\n\t\t\t\t\t);\n\t\t\t\t\tfullRender(true);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\toutput.append(\"\\x1b[2K\");\n\t\t\t\tfor (let row = 1; row < imageReservedRows; row++) {\n\t\t\t\t\toutput.append(\"\\r\\n\\x1b[2K\");\n\t\t\t\t}\n\t\t\t\toutput.append(`\\x1b[${imageReservedRows - 1}A`);\n\t\t\t\toutput.append(line);\n\t\t\t\toutput.append(`\\x1b[${imageReservedRows - 1}B`);\n\t\t\t\ti += imageReservedRows - 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\toutput.append(\"\\x1b[2K\"); // Clear current line\n\t\t\tif (!isImage && visibleWidth(line) > width) {\n\t\t\t\t// Log all lines to crash file for debugging\n\t\t\t\tconst crashLogPath = path.join(this.logDirectory ?? os.tmpdir(), \"ion-tui-crash.log\");\n\t\t\t\tconst crashData = [\n\t\t\t\t\t`Crash at ${new Date().toISOString()}`,\n\t\t\t\t\t`Terminal width: ${width}`,\n\t\t\t\t\t`Line ${i} visible width: ${visibleWidth(line)}`,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"=== All rendered lines ===\",\n\t\t\t\t\t...newLines.map((l, idx) => `[${idx}] (w=${visibleWidth(l)}) ${l}`),\n\t\t\t\t\t\"\",\n\t\t\t\t].join(\"\\n\");\n\t\t\t\tfs.mkdirSync(path.dirname(crashLogPath), { recursive: true });\n\t\t\t\tfs.writeFileSync(crashLogPath, crashData);\n\n\t\t\t\t// Clean up terminal state before throwing\n\t\t\t\tthis.stop();\n\n\t\t\t\tconst errorMsg = [\n\t\t\t\t\t`Rendered line ${i} exceeds terminal width (${visibleWidth(line)} > ${width}).`,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"This is likely caused by a custom TUI component not truncating its output.\",\n\t\t\t\t\t\"Use visibleWidth() to measure and truncateToWidth() to truncate lines.\",\n\t\t\t\t\t\"\",\n\t\t\t\t\t`Debug log written to: ${crashLogPath}`,\n\t\t\t\t].join(\"\\n\");\n\t\t\t\tthrow new Error(errorMsg);\n\t\t\t}\n\t\t\toutput.append(line);\n\t\t}\n\n\t\t// Track where cursor ended up after rendering\n\t\tlet finalCursorRow = renderEnd;\n\n\t\t// If we had more lines before, clear them and move cursor back\n\t\tif (this.previousLines.length > newLines.length) {\n\t\t\t// Move to end of new content first if we stopped before it\n\t\t\tif (renderEnd < newLines.length - 1) {\n\t\t\t\tconst moveDown = newLines.length - 1 - renderEnd;\n\t\t\t\toutput.append(`\\x1b[${moveDown}B`);\n\t\t\t\tfinalCursorRow = newLines.length - 1;\n\t\t\t}\n\t\t\tconst extraLines = this.previousLines.length - newLines.length;\n\t\t\tfor (let i = newLines.length; i < this.previousLines.length; i++) {\n\t\t\t\toutput.append(\"\\r\\n\\x1b[2K\");\n\t\t\t}\n\t\t\t// Move cursor back to end of new content\n\t\t\toutput.append(`\\x1b[${extraLines}A`);\n\t\t}\n\n\t\toutput.append(\"\\x1b[?2026l\"); // End synchronized output\n\n\t\tif (process.env.ION_TUI_DEBUG === \"1\") {\n\t\t\tconst debugDir = \"/tmp/tui\";\n\t\t\tfs.mkdirSync(debugDir, { recursive: true });\n\t\t\tconst debugPath = path.join(debugDir, `render-${Date.now()}-${Math.random().toString(36).slice(2)}.log`);\n\t\t\tconst debugData = [\n\t\t\t\t`firstChanged: ${firstChanged}`,\n\t\t\t\t`viewportTop: ${viewportTop}`,\n\t\t\t\t`cursorRow: ${this.cursorRow}`,\n\t\t\t\t`height: ${height}`,\n\t\t\t\t`lineDiff: ${lineDiff}`,\n\t\t\t\t`hardwareCursorRow: ${hardwareCursorRow}`,\n\t\t\t\t`renderEnd: ${renderEnd}`,\n\t\t\t\t`finalCursorRow: ${finalCursorRow}`,\n\t\t\t\t`cursorPos: ${JSON.stringify(cursorPos)}`,\n\t\t\t\t`newLines.length: ${newLines.length}`,\n\t\t\t\t`previousLines.length: ${this.previousLines.length}`,\n\t\t\t\t\"\",\n\t\t\t\t\"=== newLines ===\",\n\t\t\t\tJSON.stringify(newLines, null, 2),\n\t\t\t\t\"\",\n\t\t\t\t\"=== previousLines ===\",\n\t\t\t\tJSON.stringify(this.previousLines, null, 2),\n\t\t\t\t\"\",\n\t\t\t\t\"=== buffer ===\",\n\t\t\t\t`[${output.length} chars written in bounded chunks]`,\n\t\t\t].join(\"\\n\");\n\t\t\tfs.writeFileSync(debugPath, debugData);\n\t\t}\n\n\t\toutput.flush();\n\n\t\t// Track cursor position for next render\n\t\t// cursorRow tracks end of content (for viewport calculation)\n\t\t// hardwareCursorRow tracks actual terminal cursor position (for movement)\n\t\tthis.cursorRow = Math.max(0, newLines.length - 1);\n\t\tthis.hardwareCursorRow = finalCursorRow;\n\t\t// Track terminal's working area (grows but doesn't shrink unless cleared)\n\t\tthis.maxLinesRendered = Math.max(this.maxLinesRendered, newLines.length);\n\t\tthis.previousViewportTop = Math.max(prevViewportTop, finalCursorRow - height + 1);\n\n\t\t// Position hardware cursor for IME\n\t\tthis.positionHardwareCursor(cursorPos, newLines.length);\n\n\t\tthis.previousLines = newLines;\n\t\tthis.previousKittyImageIds = this.collectKittyImageIds(newLines);\n\t\tthis.previousWidth = width;\n\t\tthis.previousHeight = height;\n\t}\n\n\t/**\n\t * Position the hardware cursor for IME candidate window.\n\t * @param cursorPos The cursor position extracted from rendered output, or null\n\t * @param totalLines Total number of rendered lines\n\t */\n\tprivate positionHardwareCursor(cursorPos: { row: number; col: number } | null, totalLines: number): void {\n\t\tif (!cursorPos || totalLines <= 0) {\n\t\t\tthis.terminal.hideCursor();\n\t\t\treturn;\n\t\t}\n\n\t\t// Clamp cursor position to valid range\n\t\tconst targetRow = Math.max(0, Math.min(cursorPos.row, totalLines - 1));\n\t\tconst targetCol = Math.max(0, cursorPos.col);\n\n\t\t// Move cursor from current position to target\n\t\tconst rowDelta = targetRow - this.hardwareCursorRow;\n\t\tlet buffer = \"\";\n\t\tif (rowDelta > 0) {\n\t\t\tbuffer += `\\x1b[${rowDelta}B`; // Move down\n\t\t} else if (rowDelta < 0) {\n\t\t\tbuffer += `\\x1b[${-rowDelta}A`; // Move up\n\t\t}\n\t\t// Move to absolute column (1-indexed)\n\t\tbuffer += `\\x1b[${targetCol + 1}G`;\n\n\t\tif (buffer) {\n\t\t\tthis.terminal.write(buffer);\n\t\t}\n\n\t\tthis.hardwareCursorRow = targetRow;\n\t\tif (this.getShowHardwareCursor()) {\n\t\t\tthis.terminal.showCursor();\n\t\t} else {\n\t\t\tthis.terminal.hideCursor();\n\t\t}\n\t}\n}\n"]}
|
package/dist/tui.d.ts
ADDED
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal TUI implementation with differential rendering
|
|
3
|
+
*/
|
|
4
|
+
import type { Terminal } from "./terminal.ts";
|
|
5
|
+
import { type RgbColor, type TerminalColorScheme } from "./terminal-colors.ts";
|
|
6
|
+
import { visibleWidth } from "./utils.ts";
|
|
7
|
+
/**
|
|
8
|
+
* Component interface - all components must implement this
|
|
9
|
+
*/
|
|
10
|
+
export type TuiMouseEventType = "press" | "release" | "move" | "drag" | "click" | "wheel";
|
|
11
|
+
export type TuiMouseButton = "left" | "middle" | "right" | "none";
|
|
12
|
+
/** Normalized cell-based mouse event. Coordinates are zero-based. */
|
|
13
|
+
export interface TuiMouseEvent {
|
|
14
|
+
type: TuiMouseEventType;
|
|
15
|
+
button: TuiMouseButton;
|
|
16
|
+
/** Coordinates local to the receiving component. */
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
/** Absolute terminal coordinates. */
|
|
20
|
+
screenX: number;
|
|
21
|
+
screenY: number;
|
|
22
|
+
/** Current component bounds. */
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
shift: boolean;
|
|
26
|
+
alt: boolean;
|
|
27
|
+
ctrl: boolean;
|
|
28
|
+
/** Logical lines. Negative values scroll up. */
|
|
29
|
+
wheelDelta?: number;
|
|
30
|
+
/** Consecutive click count when type is click. */
|
|
31
|
+
clickCount?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface TuiMouseEventResult {
|
|
34
|
+
/** Stop propagation and suppress renderer-level fallback behavior. */
|
|
35
|
+
handled?: boolean;
|
|
36
|
+
/** Route subsequent drag/release events to this component. Implies handled. */
|
|
37
|
+
capture?: boolean;
|
|
38
|
+
/** Give keyboard focus to this component. Implies handled. */
|
|
39
|
+
focus?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Explicitly request or suppress a render. Move and release default to false;
|
|
42
|
+
* press, click, drag, and wheel default to true.
|
|
43
|
+
*/
|
|
44
|
+
render?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Internal target metadata used by containers and alternate-screen dispatch. */
|
|
47
|
+
export interface TuiMouseDispatchTarget {
|
|
48
|
+
component: Component;
|
|
49
|
+
originX: number;
|
|
50
|
+
originY: number;
|
|
51
|
+
width: number;
|
|
52
|
+
height: number;
|
|
53
|
+
}
|
|
54
|
+
/** Result of dispatching to a concrete component. */
|
|
55
|
+
export interface TuiMouseDispatchResult extends TuiMouseEventResult {
|
|
56
|
+
handled: true;
|
|
57
|
+
target: TuiMouseDispatchTarget;
|
|
58
|
+
/** Keyboard focus target, which may be a delegating parent container. */
|
|
59
|
+
focusTarget?: Component;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Dispatch an event to a component and retain the exact target and coordinate
|
|
63
|
+
* transform. Containers use this when forwarding events to nested children.
|
|
64
|
+
*/
|
|
65
|
+
export declare function dispatchMouseEvent(component: Component, event: TuiMouseEvent): TuiMouseDispatchResult | undefined;
|
|
66
|
+
/** Recreate local coordinates for a previously dispatched mouse target. */
|
|
67
|
+
export declare function retargetMouseEvent(event: TuiMouseEvent, target: TuiMouseDispatchTarget): TuiMouseEvent;
|
|
68
|
+
export interface Component {
|
|
69
|
+
/**
|
|
70
|
+
* Render the component to lines for the given viewport width
|
|
71
|
+
* @param width - Current viewport width
|
|
72
|
+
* @returns Array of strings, each representing a line
|
|
73
|
+
*/
|
|
74
|
+
render(width: number): string[];
|
|
75
|
+
/** Optional handler for keyboard input when component has focus. */
|
|
76
|
+
handleInput?(data: string): void;
|
|
77
|
+
/** Optional normalized mouse handler. */
|
|
78
|
+
handleMouse?(event: TuiMouseEvent): TuiMouseEventResult | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* If true, component receives key release events (Kitty protocol).
|
|
81
|
+
* Default is false - release events are filtered out.
|
|
82
|
+
*/
|
|
83
|
+
wantsKeyRelease?: boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Invalidate any cached rendering state.
|
|
86
|
+
* Called when theme changes or when component needs to re-render from scratch.
|
|
87
|
+
*/
|
|
88
|
+
invalidate(): void;
|
|
89
|
+
}
|
|
90
|
+
export type TuiInputListenerResult = {
|
|
91
|
+
consume?: boolean;
|
|
92
|
+
data?: string;
|
|
93
|
+
} | undefined;
|
|
94
|
+
export type TuiInputListener = (data: string) => TuiInputListenerResult;
|
|
95
|
+
/**
|
|
96
|
+
* Interface for components that can receive focus and display a hardware cursor.
|
|
97
|
+
* When focused, the component should emit CURSOR_MARKER at the cursor position
|
|
98
|
+
* in its render output. TUI will find this marker and position the hardware
|
|
99
|
+
* cursor there for proper IME candidate window positioning.
|
|
100
|
+
*/
|
|
101
|
+
export interface Focusable {
|
|
102
|
+
/** Set by TUI when focus changes. Component should emit CURSOR_MARKER when true. */
|
|
103
|
+
focused: boolean;
|
|
104
|
+
}
|
|
105
|
+
/** Type guard to check if a component implements Focusable */
|
|
106
|
+
export declare function isFocusable(component: Component | null): component is Component & Focusable;
|
|
107
|
+
/**
|
|
108
|
+
* Structural interface for components hosting a dismissable inline layer (e.g.
|
|
109
|
+
* the editor autocomplete dropdown). Escape unwinding consults the focused
|
|
110
|
+
* component through this interface before touching overlay layers, so one press
|
|
111
|
+
* dismisses the inline layer without leaking to the layer below.
|
|
112
|
+
*/
|
|
113
|
+
export interface AutocompleteHost extends Component {
|
|
114
|
+
/** Whether the inline layer (e.g. autocomplete dropdown) is currently open. */
|
|
115
|
+
isShowingAutocomplete(): boolean;
|
|
116
|
+
/** Dismiss the inline layer. Returns true when a layer was open. */
|
|
117
|
+
dismissAutocomplete(): boolean;
|
|
118
|
+
}
|
|
119
|
+
/** Type guard to check if a component implements AutocompleteHost */
|
|
120
|
+
export declare function isAutocompleteHost(component: Component | null): component is Component & AutocompleteHost;
|
|
121
|
+
/** Options for an explicit keyboard-focus transition. */
|
|
122
|
+
export interface FocusTransitionOptions {
|
|
123
|
+
/** Machine-readable reason recorded for the transition (e.g. `overlay-show`). */
|
|
124
|
+
reason?: string;
|
|
125
|
+
}
|
|
126
|
+
/** Last explicit keyboard-focus transition. Exactly one component owns focus. */
|
|
127
|
+
export interface FocusTransition {
|
|
128
|
+
from: Component | null;
|
|
129
|
+
to: Component | null;
|
|
130
|
+
reason: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Cursor position marker - APC (Application Program Command) sequence.
|
|
134
|
+
* This is a zero-width escape sequence that terminals ignore.
|
|
135
|
+
* Components emit this at the cursor position when focused.
|
|
136
|
+
* TUI finds and strips this marker, then positions the hardware cursor there.
|
|
137
|
+
*/
|
|
138
|
+
export declare const CURSOR_MARKER = "\u001B_pi:c\u0007";
|
|
139
|
+
export { visibleWidth };
|
|
140
|
+
/**
|
|
141
|
+
* Anchor position for overlays
|
|
142
|
+
*/
|
|
143
|
+
export type OverlayAnchor = "center" | "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-center" | "bottom-center" | "left-center" | "right-center";
|
|
144
|
+
/**
|
|
145
|
+
* Margin configuration for overlays
|
|
146
|
+
*/
|
|
147
|
+
export interface OverlayMargin {
|
|
148
|
+
top?: number;
|
|
149
|
+
right?: number;
|
|
150
|
+
bottom?: number;
|
|
151
|
+
left?: number;
|
|
152
|
+
}
|
|
153
|
+
/** Value that can be absolute (number) or percentage (string like "50%") */
|
|
154
|
+
export type SizeValue = number | `${number}%`;
|
|
155
|
+
/**
|
|
156
|
+
* Options for overlay positioning and sizing.
|
|
157
|
+
* Values can be absolute numbers or percentage strings (e.g., "50%").
|
|
158
|
+
*/
|
|
159
|
+
export interface OverlayOptions {
|
|
160
|
+
/** Width in columns, or percentage of terminal width (e.g., "50%") */
|
|
161
|
+
width?: SizeValue;
|
|
162
|
+
/** Minimum width in columns */
|
|
163
|
+
minWidth?: number;
|
|
164
|
+
/** Maximum height in rows, or percentage of terminal height (e.g., "50%") */
|
|
165
|
+
maxHeight?: SizeValue;
|
|
166
|
+
/** Anchor point for positioning (default: 'center') */
|
|
167
|
+
anchor?: OverlayAnchor;
|
|
168
|
+
/** Horizontal offset from anchor position (positive = right) */
|
|
169
|
+
offsetX?: number;
|
|
170
|
+
/** Vertical offset from anchor position (positive = down) */
|
|
171
|
+
offsetY?: number;
|
|
172
|
+
/** Row position: absolute number, or percentage (e.g., "25%" = 25% from top) */
|
|
173
|
+
row?: SizeValue;
|
|
174
|
+
/** Column position: absolute number, or percentage (e.g., "50%" = centered horizontally) */
|
|
175
|
+
col?: SizeValue;
|
|
176
|
+
/** Margin from terminal edges. Number applies to all sides. */
|
|
177
|
+
margin?: OverlayMargin | number;
|
|
178
|
+
/**
|
|
179
|
+
* Control overlay visibility based on terminal dimensions.
|
|
180
|
+
* If provided, overlay is only rendered when this returns true.
|
|
181
|
+
* Called each render cycle with current terminal dimensions.
|
|
182
|
+
*/
|
|
183
|
+
visible?: (termWidth: number, termHeight: number) => boolean;
|
|
184
|
+
/** If true, don't capture keyboard focus when shown */
|
|
185
|
+
nonCapturing?: boolean;
|
|
186
|
+
}
|
|
187
|
+
/** Options for {@link OverlayHandle.unfocus}. */
|
|
188
|
+
export interface OverlayUnfocusOptions {
|
|
189
|
+
/** Explicit target to focus after releasing this overlay. */
|
|
190
|
+
target: Component | null;
|
|
191
|
+
}
|
|
192
|
+
/** Last rendered terminal-relative overlay rectangle. */
|
|
193
|
+
export interface OverlayBounds {
|
|
194
|
+
row: number;
|
|
195
|
+
col: number;
|
|
196
|
+
width: number;
|
|
197
|
+
height: number;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Handle returned by showOverlay for controlling the overlay
|
|
201
|
+
*/
|
|
202
|
+
export interface OverlayHandle {
|
|
203
|
+
/** Permanently remove the overlay (cannot be shown again) */
|
|
204
|
+
hide(): void;
|
|
205
|
+
/** Temporarily hide or show the overlay */
|
|
206
|
+
setHidden(hidden: boolean): void;
|
|
207
|
+
/** Check if overlay is temporarily hidden */
|
|
208
|
+
isHidden(): boolean;
|
|
209
|
+
/** Focus this overlay and bring it to the visual front */
|
|
210
|
+
focus(): void;
|
|
211
|
+
/** Release focus to the next visible capturing overlay or previous target, or to an explicit target when provided */
|
|
212
|
+
unfocus(options?: OverlayUnfocusOptions): void;
|
|
213
|
+
/** Check if this overlay currently has focus */
|
|
214
|
+
isFocused(): boolean;
|
|
215
|
+
/** Get the most recent rendered bounds for a visible overlay. */
|
|
216
|
+
getBounds(): OverlayBounds | undefined;
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Container - a component that contains other components
|
|
220
|
+
*/
|
|
221
|
+
export declare class Container implements Component {
|
|
222
|
+
children: Component[];
|
|
223
|
+
private mouseLayout?;
|
|
224
|
+
addChild(component: Component): void;
|
|
225
|
+
removeChild(component: Component): void;
|
|
226
|
+
clear(): void;
|
|
227
|
+
invalidate(): void;
|
|
228
|
+
handleMouse(event: TuiMouseEvent): TuiMouseDispatchResult | undefined;
|
|
229
|
+
render(width: number): string[];
|
|
230
|
+
}
|
|
231
|
+
/** Composite overlay content into a terminal line at a fixed column. */
|
|
232
|
+
export declare function compositeTuiLine(baseLine: string, overlayLine: string, startCol: number, overlayWidth: number, totalWidth: number): string;
|
|
233
|
+
export type TuiMode = "regular" | "fullscreen";
|
|
234
|
+
export interface TuiStopOptions {
|
|
235
|
+
/** Leave renderer output in place for another TUI taking over the same terminal. */
|
|
236
|
+
preserveScreen?: boolean;
|
|
237
|
+
}
|
|
238
|
+
export interface TUI extends Component {
|
|
239
|
+
readonly mode: TuiMode;
|
|
240
|
+
children: Component[];
|
|
241
|
+
terminal: Terminal;
|
|
242
|
+
onDebug?: () => void;
|
|
243
|
+
readonly fullRedraws: number;
|
|
244
|
+
addChild(component: Component): void;
|
|
245
|
+
removeChild(component: Component): void;
|
|
246
|
+
clear(): void;
|
|
247
|
+
getShowHardwareCursor(): boolean;
|
|
248
|
+
setShowHardwareCursor(enabled: boolean): void;
|
|
249
|
+
getClearOnShrink(): boolean;
|
|
250
|
+
setClearOnShrink(enabled: boolean): void;
|
|
251
|
+
setFocus(component: Component | null): void;
|
|
252
|
+
showOverlay(component: Component, options?: OverlayOptions): OverlayHandle;
|
|
253
|
+
hideOverlay(): void;
|
|
254
|
+
hasOverlay(): boolean;
|
|
255
|
+
start(): void;
|
|
256
|
+
stop(options?: TuiStopOptions): void;
|
|
257
|
+
renderNow(force?: boolean): void;
|
|
258
|
+
requestRender(force?: boolean): void;
|
|
259
|
+
addInputListener(listener: TuiInputListener): () => void;
|
|
260
|
+
removeInputListener(listener: TuiInputListener): void;
|
|
261
|
+
onTerminalColorSchemeChange(listener: (scheme: TerminalColorScheme) => void): () => void;
|
|
262
|
+
setTerminalColorSchemeNotifications(enabled: boolean): void;
|
|
263
|
+
queryTerminalBackgroundColor(options: {
|
|
264
|
+
timeoutMs: number;
|
|
265
|
+
}): Promise<RgbColor | undefined>;
|
|
266
|
+
queryTerminalColorScheme(options: {
|
|
267
|
+
timeoutMs: number;
|
|
268
|
+
}): Promise<TerminalColorScheme | undefined>;
|
|
269
|
+
}
|
|
270
|
+
export declare const VIEWPORT_TUI: unique symbol;
|
|
271
|
+
export interface ViewportTUI extends TUI {
|
|
272
|
+
readonly [VIEWPORT_TUI]: true;
|
|
273
|
+
setLayoutRoot(component: Component | undefined): void;
|
|
274
|
+
}
|
|
275
|
+
export declare function isViewportTUI(tui: TUI): tui is ViewportTUI;
|
|
276
|
+
export declare abstract class TuiBase extends Container implements TUI {
|
|
277
|
+
abstract readonly mode: TuiMode;
|
|
278
|
+
terminal: Terminal;
|
|
279
|
+
private focusedComponent;
|
|
280
|
+
private inputListeners;
|
|
281
|
+
/** Global callback for debug key (Shift+Ctrl+D). Called before input is forwarded to focused component. */
|
|
282
|
+
onDebug?: () => void;
|
|
283
|
+
private renderRequested;
|
|
284
|
+
private immediateRenderScheduled;
|
|
285
|
+
private renderTimer;
|
|
286
|
+
private lastRenderAt;
|
|
287
|
+
private static readonly MIN_RENDER_INTERVAL_MS;
|
|
288
|
+
private showHardwareCursor;
|
|
289
|
+
private clearOnShrink;
|
|
290
|
+
protected fullRedrawCount: number;
|
|
291
|
+
protected stopped: boolean;
|
|
292
|
+
private pendingOsc11BackgroundReplies;
|
|
293
|
+
private pendingOsc11BackgroundQueries;
|
|
294
|
+
private terminalColorSchemeListeners;
|
|
295
|
+
private terminalColorSchemeNotificationsEnabled;
|
|
296
|
+
/** Directory for debug/crash logs. When undefined, debug logging is disabled and crash dumps fall back to the OS temp directory. */
|
|
297
|
+
protected readonly logDirectory: string | undefined;
|
|
298
|
+
private focusOrderCounter;
|
|
299
|
+
private overlayStack;
|
|
300
|
+
private renderedOverlayLayouts;
|
|
301
|
+
private lastFocusTransition;
|
|
302
|
+
get hasOverlayEntries(): boolean;
|
|
303
|
+
private overlayFocusRestore;
|
|
304
|
+
constructor(terminal: Terminal, showHardwareCursor?: boolean, logDirectory?: string);
|
|
305
|
+
protected abstract doRender(): void;
|
|
306
|
+
protected resetRenderState(): void;
|
|
307
|
+
protected beforeTerminalStart(): void;
|
|
308
|
+
protected afterTerminalStart(): void;
|
|
309
|
+
protected beforeTerminalStop(_options: TuiStopOptions): void;
|
|
310
|
+
protected afterTerminalStop(_options: TuiStopOptions): void;
|
|
311
|
+
get fullRedraws(): number;
|
|
312
|
+
getShowHardwareCursor(): boolean;
|
|
313
|
+
setShowHardwareCursor(enabled: boolean): void;
|
|
314
|
+
getClearOnShrink(): boolean;
|
|
315
|
+
/**
|
|
316
|
+
* Set whether to trigger full re-render when content shrinks.
|
|
317
|
+
* When true, empty rows are cleared when content shrinks.
|
|
318
|
+
* When false (default), empty rows remain (reduces redraws on slower terminals).
|
|
319
|
+
*/
|
|
320
|
+
setClearOnShrink(enabled: boolean): void;
|
|
321
|
+
getFocusedComponent(): Component | null;
|
|
322
|
+
/** Last explicit focus transition, for debugging focus-stealing reports. */
|
|
323
|
+
getLastFocusTransition(): FocusTransition | undefined;
|
|
324
|
+
setFocus(component: Component | null, options?: FocusTransitionOptions): void;
|
|
325
|
+
private setFocusInternal;
|
|
326
|
+
private clearOverlayFocusRestore;
|
|
327
|
+
private clearOverlayFocusRestoreFor;
|
|
328
|
+
private resolveBlockedOverlayFocusResume;
|
|
329
|
+
private getVisibleOverlayFocusRestore;
|
|
330
|
+
private isOverlayFocusAncestor;
|
|
331
|
+
private retargetOverlayPreFocus;
|
|
332
|
+
protected getMountedRoots(): readonly Component[];
|
|
333
|
+
private isComponentMounted;
|
|
334
|
+
private containsComponent;
|
|
335
|
+
/**
|
|
336
|
+
* Show an overlay component with configurable positioning and sizing.
|
|
337
|
+
* Returns a handle to control the overlay's visibility.
|
|
338
|
+
*/
|
|
339
|
+
showOverlay(component: Component, options?: OverlayOptions): OverlayHandle;
|
|
340
|
+
/** Hide the topmost overlay and restore previous focus. */
|
|
341
|
+
hideOverlay(): void;
|
|
342
|
+
/** Check if there are any visible overlays */
|
|
343
|
+
hasOverlay(): boolean;
|
|
344
|
+
/** Check if the focused component is a visible overlay */
|
|
345
|
+
protected isOverlayFocused(): boolean;
|
|
346
|
+
/**
|
|
347
|
+
* Dismiss the innermost Escape-dismissable layer. Order: open autocomplete
|
|
348
|
+
* on the focused component first, then (in subclasses) viewport layers such
|
|
349
|
+
* as transcript search, then forward to the topmost capturing overlay when
|
|
350
|
+
* focus drifted outside the overlay stack. Returns true when exactly one
|
|
351
|
+
* layer consumed the press; callers must not forward it further.
|
|
352
|
+
*/
|
|
353
|
+
dismissInnermostLayer(data: string): boolean;
|
|
354
|
+
/** Topmost visible capturing overlay component, if any. */
|
|
355
|
+
protected getTopmostVisibleCapturingOverlay(): Component | undefined;
|
|
356
|
+
/**
|
|
357
|
+
* Whether a component lives inside a visible overlay. With `capturingOnly`,
|
|
358
|
+
* non-capturing overlays do not count.
|
|
359
|
+
*/
|
|
360
|
+
protected isComponentInVisibleOverlay(component: Component, capturingOnly?: boolean): boolean;
|
|
361
|
+
/** Whether keyboard focus currently sits inside a visible overlay. */
|
|
362
|
+
protected isFocusInVisibleOverlay(capturingOnly?: boolean): boolean;
|
|
363
|
+
/** Keep overlay containers as keyboard focus owners when a nested control is clicked. */
|
|
364
|
+
protected resolveMouseFocusTarget(component: Component): Component;
|
|
365
|
+
/** Dispatch to the visually topmost overlay under the pointer. */
|
|
366
|
+
protected dispatchMouseToOverlay(event: TuiMouseEvent): {
|
|
367
|
+
hit: boolean;
|
|
368
|
+
result?: TuiMouseDispatchResult;
|
|
369
|
+
};
|
|
370
|
+
/** Check if an overlay entry is currently visible */
|
|
371
|
+
private isOverlayVisible;
|
|
372
|
+
/** Find the visual-frontmost visible capturing overlay, if any */
|
|
373
|
+
private getTopmostVisibleOverlay;
|
|
374
|
+
invalidate(): void;
|
|
375
|
+
start(): void;
|
|
376
|
+
addInputListener(listener: TuiInputListener): () => void;
|
|
377
|
+
removeInputListener(listener: TuiInputListener): void;
|
|
378
|
+
onTerminalColorSchemeChange(listener: (scheme: TerminalColorScheme) => void): () => void;
|
|
379
|
+
setTerminalColorSchemeNotifications(enabled: boolean): void;
|
|
380
|
+
private queryCellSize;
|
|
381
|
+
stop(options?: TuiStopOptions): void;
|
|
382
|
+
renderNow(force?: boolean): void;
|
|
383
|
+
requestRender(force?: boolean): void;
|
|
384
|
+
private requestImmediateRender;
|
|
385
|
+
private cancelRenderTimer;
|
|
386
|
+
private scheduleRender;
|
|
387
|
+
private handleTerminalInput;
|
|
388
|
+
private consumeOsc11BackgroundResponse;
|
|
389
|
+
private consumeTerminalColorSchemeReport;
|
|
390
|
+
private consumeCellSizeResponse;
|
|
391
|
+
/**
|
|
392
|
+
* Resolve overlay layout from options.
|
|
393
|
+
* Returns { width, row, col, maxHeight } for rendering.
|
|
394
|
+
*/
|
|
395
|
+
private resolveOverlayLayout;
|
|
396
|
+
private resolveAnchorRow;
|
|
397
|
+
private resolveAnchorCol;
|
|
398
|
+
/** Composite all overlays into content lines (sorted by focusOrder, higher = on top). */
|
|
399
|
+
protected compositeOverlays(lines: string[], termWidth: number, termHeight: number): string[];
|
|
400
|
+
protected applyLineResets(lines: string[]): string[];
|
|
401
|
+
private compositeLineAt;
|
|
402
|
+
/**
|
|
403
|
+
* Find and extract cursor position from rendered lines.
|
|
404
|
+
* Searches for CURSOR_MARKER, calculates its position, and strips it from the output.
|
|
405
|
+
* Only scans the bottom terminal height lines (visible viewport).
|
|
406
|
+
* @param lines - Rendered lines to search
|
|
407
|
+
* @param height - Terminal height (visible viewport size)
|
|
408
|
+
* @returns Cursor position { row, col } or null if no marker found
|
|
409
|
+
*/
|
|
410
|
+
protected extractCursorPosition(lines: string[], height: number): {
|
|
411
|
+
row: number;
|
|
412
|
+
col: number;
|
|
413
|
+
} | null;
|
|
414
|
+
/**
|
|
415
|
+
* Query the terminal's default background color with OSC 11 (`ESC ] 11 ; ? BEL`).
|
|
416
|
+
* @param timeoutMs Query timeout in milliseconds.
|
|
417
|
+
* @returns Promise containing the parsed RGB color, or undefined if it times out or fails to parse.
|
|
418
|
+
*/
|
|
419
|
+
queryTerminalBackgroundColor({ timeoutMs }: {
|
|
420
|
+
timeoutMs: number;
|
|
421
|
+
}): Promise<RgbColor | undefined>;
|
|
422
|
+
/**
|
|
423
|
+
* Query the terminal's color-scheme preference with DSR (`CSI ? 996 n`).
|
|
424
|
+
* Terminals that support the color palette notification protocol reply with
|
|
425
|
+
* `CSI ? 997 ; 1 n` for dark or `CSI ? 997 ; 2 n` for light.
|
|
426
|
+
*/
|
|
427
|
+
queryTerminalColorScheme({ timeoutMs }: {
|
|
428
|
+
timeoutMs: number;
|
|
429
|
+
}): Promise<TerminalColorScheme | undefined>;
|
|
430
|
+
}
|
|
431
|
+
//# sourceMappingURL=tui.d.ts.map
|