@bastani/atomic-tui 0.9.89 → 0.9.90

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.
Files changed (44) hide show
  1. package/dist/builtin-command-names.d.ts +4 -0
  2. package/dist/builtin-command-names.d.ts.map +1 -0
  3. package/dist/builtin-command-names.js +42 -0
  4. package/dist/builtin-command-names.js.map +1 -0
  5. package/dist/clickable-hints.d.ts +84 -0
  6. package/dist/clickable-hints.d.ts.map +1 -0
  7. package/dist/clickable-hints.js +267 -0
  8. package/dist/clickable-hints.js.map +1 -0
  9. package/dist/components/editor.d.ts +7 -1
  10. package/dist/components/editor.d.ts.map +1 -1
  11. package/dist/components/editor.js +63 -25
  12. package/dist/components/editor.js.map +1 -1
  13. package/dist/components/settings-list.d.ts.map +1 -1
  14. package/dist/components/settings-list.js +3 -2
  15. package/dist/components/settings-list.js.map +1 -1
  16. package/dist/components/windowed-container.d.ts +2 -0
  17. package/dist/components/windowed-container.d.ts.map +1 -1
  18. package/dist/components/windowed-container.js +4 -0
  19. package/dist/components/windowed-container.js.map +1 -1
  20. package/dist/index.d.ts +3 -2
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +4 -2
  23. package/dist/index.js.map +1 -1
  24. package/dist/keys.d.ts +5 -0
  25. package/dist/keys.d.ts.map +1 -1
  26. package/dist/keys.js +115 -0
  27. package/dist/keys.js.map +1 -1
  28. package/dist/terminal.d.ts +3 -0
  29. package/dist/terminal.d.ts.map +1 -1
  30. package/dist/terminal.js +16 -0
  31. package/dist/terminal.js.map +1 -1
  32. package/dist/tui-alt-screen.d.ts +24 -3
  33. package/dist/tui-alt-screen.d.ts.map +1 -1
  34. package/dist/tui-alt-screen.js +205 -58
  35. package/dist/tui-alt-screen.js.map +1 -1
  36. package/dist/tui.d.ts +23 -0
  37. package/dist/tui.d.ts.map +1 -1
  38. package/dist/tui.js +48 -5
  39. package/dist/tui.js.map +1 -1
  40. package/dist/utils.d.ts +4 -0
  41. package/dist/utils.d.ts.map +1 -1
  42. package/dist/utils.js +79 -11
  43. package/dist/utils.js.map +1 -1
  44. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"settings-list.d.ts","sourceRoot":"","sources":["../../src/components/settings-list.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAI/E,MAAM,WAAW,WAAW;IAC3B,yCAAyC;IACzC,EAAE,EAAE,MAAM,CAAC;IACX,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4CAA4C;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB;iHAC6G;IAC7G,OAAO,CAAC,EAAE,CACT,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,CAAC,aAAa,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,KACrE,SAAS,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC;IACnD,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,KAAK,MAAM,CAAC;IACnD,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,mBAAmB;IACnC,YAAY,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,qBAAa,YAAa,YAAW,SAAS;IAC7C,QAAQ,CAAC,qBAAqB,EAAE,OAAO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ings, getSelectPageIndex } from "../keybindings.js";
3
4
  import { truncateToWidth, visibleWidth, wrapTextWithAnsi } from "../utils.js";
@@ -251,9 +252,9 @@ export class SettingsList {
251
252
  }
252
253
  addHintLine(lines, width) {
253
254
  lines.push("");
254
- lines.push(truncateToWidth(this.theme.hint(this.searchEnabled
255
+ lines.push(truncateToWidth(this.theme.hint(clickableHintText(this.searchEnabled
255
256
  ? " Type to search · Enter/Space to change · Esc to cancel"
256
- : " Enter/Space to change · Esc to cancel"), width));
257
+ : " Enter/Space to change · Esc to cancel")), width));
257
258
  }
258
259
  }
259
260
  //# sourceMappingURL=settings-list.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"settings-list.js","sourceRoot":"","sources":["../../src/components/settings-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAiCnC,MAAM,OAAO,YAAY;IACf,qBAAqB,GAAY,IAAI,CAAC;IACvC,KAAK,CAAgB;IACrB,aAAa,CAAgB;IAC7B,KAAK,CAAoB;IACzB,aAAa,GAAG,CAAC,CAAC;IAClB,iBAAiB,CAAqB;IACtC,UAAU,CAAS;IACnB,QAAQ,CAAyC;IACjD,QAAQ,CAAa;IACrB,WAAW,CAAS;IACpB,aAAa,CAAU;IAE/B,gBAAgB;IACR,gBAAgB,GAAqB,IAAI,CAAC;IAC1C,gBAAgB,GAAkB,IAAI,CAAC;IACvC,kBAAkB,GAAkB,IAAI,CAAC;IAEjD,YACC,KAAoB,EACpB,UAAkB,EAClB,KAAwB,EACxB,QAAgD,EAChD,QAAoB,EACpB,OAAO,GAAwB,EAAE;QAEjC,IAAI,CAAC,KAAK,GAAG,KAAK,CA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IAAI,EAAE,CAAC;YAC3C,wDAAwD;YACxD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC;YAC3C,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC9B,CAAC;IACF,CAAC;IAEO,WAAW,CAAC,KAAa;QAChC,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1E,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;IACxB,CAAC;IAEO,WAAW,CAAC,KAAe,EAAE,KAAa;QACjD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CACT,eAAe,CACd,IAAI,CAAC,KAAK,CAAC,IAAI,CACd,IAAI,CAAC,aAAa;YACjB,CAAC,CAAC,0DAA0D;YAC5D,CAAC,CAAC,yCAAyC,CAC5C,EACD,KAAK,CACL,CACD,CAAC;IACH,CAAC;CACD","sourcesContent":["import { fuzzyFilter } from \"../fuzzy.ts\";\nimport { getKeybindings, getSelectPageIndex } from \"../keybindings.ts\";\nimport type { Component, TuiMouseEvent, TuiMouseEventResult } from \"../tui.ts\";\nimport { truncateToWidth, visibleWidth, wrapTextWithAnsi } from \"../utils.ts\";\nimport { Input } from \"./input.ts\";\n\nexport interface SettingItem {\n\t/** Unique identifier for this setting */\n\tid: string;\n\t/** Display label (left side) */\n\tlabel: string;\n\t/** Optional description shown when selected */\n\tdescription?: string;\n\t/** Current value to display (right side) */\n\tcurrentValue: string;\n\t/** If provided, Enter/Space cycles through these values */\n\tvalues?: string[];\n\t/** If provided, Enter opens this submenu. Receives current value and done callback.\n\t * done() accepts an optional selectedValue and an optional navigateTo id to move the cursor after close. */\n\tsubmenu?: (\n\t\tcurrentValue: string,\n\t\tdone: (selectedValue?: string, options?: { navigateTo?: string }) => void,\n\t) => Component;\n}\n\nexport interface SettingsListTheme {\n\tlabel: (text: string, selected: boolean) => string;\n\tvalue: (text: string, selected: boolean) => string;\n\tdescription: (text: string) => string;\n\tcursor: string;\n\thint: (text: string) => string;\n}\n\nexport interface SettingsListOptions {\n\tenableSearch?: boolean;\n}\n\nexport class SettingsList implements Component {\n\treadonly capturesViewportInput: boolean = true;\n\tprivate items: SettingItem[];\n\tprivate filteredItems: SettingItem[];\n\tprivate theme: SettingsListTheme;\n\tprivate selectedIndex = 0;\n\tprivate mousePressedIndex: number | undefined;\n\tprivate maxVisible: number;\n\tprivate onChange: (id: string, newValue: string) => void;\n\tprivate onCancel: () => void;\n\tprivate searchInput?: Input;\n\tprivate searchEnabled: boolean;\n\n\t// Submenu state\n\tprivate submenuComponent: Component | null = null;\n\tprivate submenuItemIndex: number | null = null;\n\tprivate navigateAfterClose: string | null = null;\n\n\tconstructor(\n\t\titems: SettingItem[],\n\t\tmaxVisible: number,\n\t\ttheme: SettingsListTheme,\n\t\tonChange: (id: string, newValue: string) => void,\n\t\tonCancel: () => void,\n\t\toptions: SettingsListOptions = {},\n\t) {\n\t\tthis.items = items;\n\t\tthis.filteredItems = items;\n\t\tthis.maxVisible = maxVisible;\n\t\tthis.theme = theme;\n\t\tthis.onChange = onChange;\n\t\tthis.onCancel = onCancel;\n\t\tthis.searchEnabled = options.enableSearch ?? false;\n\t\tif (this.searchEnabled) {\n\t\t\tthis.searchInput = new Input();\n\t\t}\n\t}\n\n\t/** Update an item's currentValue */\n\tupdateValue(id: string, newValue: string): void {\n\t\tconst item = this.items.find((i) => i.id === id);\n\t\tif (item) {\n\t\t\titem.currentValue = newValue;\n\t\t}\n\t}\n\n\t/** Move selection to the item with the given id (no-op if not found). */\n\tselectItem(id: string): void {\n\t\tconst items = this.searchEnabled ? this.filteredItems : this.items;\n\t\tconst index = items.findIndex((i) => i.id === id);\n\t\tif (index !== -1) {\n\t\t\tthis.selectedIndex = index;\n\t\t}\n\t}\n\n\tinvalidate(): void {\n\t\tthis.submenuComponent?.invalidate?.();\n\t}\n\n\trender(width: number): string[] {\n\t\t// If submenu is active, render it instead\n\t\tif (this.submenuComponent) {\n\t\t\treturn this.submenuComponent.render(width);\n\t\t}\n\n\t\treturn this.renderMainList(width);\n\t}\n\n\tprivate renderMainList(width: number): string[] {\n\t\tconst lines: string[] = [];\n\n\t\tif (this.searchEnabled && this.searchInput) {\n\t\t\tlines.push(...this.searchInput.render(width));\n\t\t\tlines.push(\"\");\n\t\t}\n\n\t\tif (this.items.length === 0) {\n\t\t\tlines.push(this.theme.hint(\" No settings available\"));\n\t\t\tif (this.searchEnabled) {\n\t\t\t\tthis.addHintLine(lines, width);\n\t\t\t}\n\t\t\treturn lines;\n\t\t}\n\n\t\tconst displayItems = this.getDisplayItems();\n\t\tif (displayItems.length === 0) {\n\t\t\tlines.push(truncateToWidth(this.theme.hint(\" No matching settings\"), width));\n\t\t\tthis.addHintLine(lines, width);\n\t\t\treturn lines;\n\t\t}\n\n\t\t// Calculate visible range with scrolling\n\t\tconst { startIndex, endIndex } = this.getVisibleRange(displayItems);\n\n\t\t// Calculate max label width for alignment\n\t\tconst maxLabelWidth = Math.min(36, Math.max(...this.items.map((item) => visibleWidth(item.label))));\n\n\t\t// Render visible items\n\t\tfor (let i = startIndex; i < endIndex; i++) {\n\t\t\tconst item = displayItems[i];\n\t\t\tif (!item) continue;\n\n\t\t\tconst isSelected = i === this.selectedIndex;\n\t\t\tconst prefix = isSelected ? this.theme.cursor : \" \";\n\t\t\tconst prefixWidth = visibleWidth(prefix);\n\n\t\t\t// Pad label to align values\n\t\t\tconst labelPadded = item.label + \" \".repeat(Math.max(0, maxLabelWidth - visibleWidth(item.label)));\n\t\t\tconst labelText = this.theme.label(labelPadded, isSelected);\n\n\t\t\t// Calculate space for value\n\t\t\tconst separator = \" \";\n\t\t\tconst usedWidth = prefixWidth + maxLabelWidth + visibleWidth(separator);\n\t\t\tconst valueMaxWidth = width - usedWidth - 2;\n\n\t\t\tconst valueText = this.theme.value(truncateToWidth(item.currentValue, valueMaxWidth, \"\"), isSelected);\n\n\t\t\tlines.push(truncateToWidth(prefix + labelText + separator + valueText, width));\n\t\t}\n\n\t\t// Add scroll indicator if needed\n\t\tif (startIndex > 0 || endIndex < displayItems.length) {\n\t\t\tconst scrollText = ` (${this.selectedIndex + 1}/${displayItems.length})`;\n\t\t\tlines.push(this.theme.hint(truncateToWidth(scrollText, width - 2, \"\")));\n\t\t}\n\n\t\t// Add description for selected item\n\t\tconst selectedItem = displayItems[this.selectedIndex];\n\t\tif (selectedItem?.description) {\n\t\t\tlines.push(\"\");\n\t\t\tconst wrappedDesc = wrapTextWithAnsi(selectedItem.description, width - 4);\n\t\t\tfor (const line of wrappedDesc) {\n\t\t\t\tlines.push(this.theme.description(` ${line}`));\n\t\t\t}\n\t\t}\n\n\t\t// Add hint\n\t\tthis.addHintLine(lines, width);\n\n\t\treturn lines;\n\t}\n\n\thandleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined {\n\t\tif (this.submenuComponent) {\n\t\t\tconst result = this.submenuComponent.handleMouse?.(event);\n\t\t\treturn result ? { ...result, focus: true } : undefined;\n\t\t}\n\n\t\tif (this.searchEnabled && this.searchInput) {\n\t\t\tif (event.y === 0) {\n\t\t\t\tconst result = this.searchInput.handleMouse?.(event);\n\t\t\t\treturn result ? { ...result, focus: true } : undefined;\n\t\t\t}\n\t\t\tif (event.y === 1) return undefined;\n\t\t}\n\n\t\tconst displayItems = this.getDisplayItems();\n\t\tif (displayItems.length === 0) return undefined;\n\t\tif (event.type === \"wheel\" && event.wheelDelta) {\n\t\t\tconst delta = event.wheelDelta < 0 ? -1 : 1;\n\t\t\tconst previousIndex = this.selectedIndex;\n\t\t\tthis.selectedIndex = Math.max(0, Math.min(displayItems.length - 1, this.selectedIndex + delta));\n\t\t\treturn { handled: true, render: this.selectedIndex !== previousIndex };\n\t\t}\n\t\t// Hover must not change selection: the visible range is centered on it.\n\t\tif (event.button !== \"left\" || (event.type !== \"press\" && event.type !== \"click\")) return undefined;\n\n\t\tconst rowOffset = this.searchEnabled ? 2 : 0;\n\t\tconst { startIndex, endIndex } = this.getVisibleRange(displayItems);\n\t\tconst itemIndex = startIndex + event.y - rowOffset;\n\t\tif (itemIndex < startIndex || itemIndex >= endIndex) return undefined;\n\t\tif (event.type === \"press\") {\n\t\t\tthis.mousePressedIndex = itemIndex;\n\t\t\tthis.selectedIndex = itemIndex;\n\t\t\treturn { handled: true, focus: true };\n\t\t}\n\t\tif (event.type === \"click\") {\n\t\t\tthis.selectedIndex = this.mousePressedIndex ?? itemIndex;\n\t\t\tthis.mousePressedIndex = undefined;\n\t\t\tthis.activateItem();\n\t\t\treturn { handled: true };\n\t\t}\n\t\treturn undefined;\n\t}\n\n\thandleInput(data: string): void {\n\t\t// If submenu is active, delegate all input to it\n\t\t// The submenu's onCancel (triggered by escape) will call done() which closes it\n\t\tif (this.submenuComponent) {\n\t\t\tthis.submenuComponent.handleInput?.(data);\n\t\t\treturn;\n\t\t}\n\n\t\t// Main list input handling\n\t\tconst kb = getKeybindings();\n\t\tconst displayItems = this.getDisplayItems();\n\t\tconst pageIndex = getSelectPageIndex(kb, data, this.selectedIndex, displayItems.length, this.maxVisible);\n\t\tif (kb.matches(data, \"tui.select.up\")) {\n\t\t\tif (displayItems.length === 0) return;\n\t\t\tthis.selectedIndex = this.selectedIndex === 0 ? displayItems.length - 1 : this.selectedIndex - 1;\n\t\t} else if (kb.matches(data, \"tui.select.down\")) {\n\t\t\tif (displayItems.length === 0) return;\n\t\t\tthis.selectedIndex = this.selectedIndex === displayItems.length - 1 ? 0 : this.selectedIndex + 1;\n\t\t} else if (pageIndex !== undefined) {\n\t\t\tif (displayItems.length === 0) return;\n\t\t\tthis.selectedIndex = pageIndex;\n\t\t} else if (\n\t\t\tkb.matches(data, \"tui.select.confirm\") ||\n\t\t\t(data === \" \" && (!this.searchEnabled || this.searchInput?.getValue().length === 0))\n\t\t) {\n\t\t\tthis.activateItem();\n\t\t} else if (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.onCancel();\n\t\t} else if (this.searchEnabled && this.searchInput) {\n\t\t\tthis.searchInput.handleInput(data);\n\t\t\tthis.applyFilter(this.searchInput.getValue());\n\t\t}\n\t}\n\n\tprivate getDisplayItems(): SettingItem[] {\n\t\treturn this.searchEnabled ? this.filteredItems : this.items;\n\t}\n\n\tprivate getVisibleRange(displayItems: readonly SettingItem[]): { startIndex: number; endIndex: number } {\n\t\tconst startIndex = Math.max(\n\t\t\t0,\n\t\t\tMath.min(this.selectedIndex - Math.floor(this.maxVisible / 2), displayItems.length - this.maxVisible),\n\t\t);\n\t\treturn { startIndex, endIndex: Math.min(startIndex + this.maxVisible, displayItems.length) };\n\t}\n\n\tprivate activateItem(): void {\n\t\tconst item = this.getDisplayItems()[this.selectedIndex];\n\t\tif (!item) return;\n\n\t\tif (item.submenu) {\n\t\t\t// Open submenu, passing current value so it can pre-select correctly\n\t\t\tthis.submenuItemIndex = this.selectedIndex;\n\t\t\tthis.submenuComponent = item.submenu(\n\t\t\t\titem.currentValue,\n\t\t\t\t(selectedValue?: string, options?: { navigateTo?: string }) => {\n\t\t\t\t\tif (selectedValue !== undefined) {\n\t\t\t\t\t\titem.currentValue = selectedValue;\n\t\t\t\t\t\tthis.onChange(item.id, selectedValue);\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.navigateTo) {\n\t\t\t\t\t\tthis.navigateAfterClose = options.navigateTo;\n\t\t\t\t\t}\n\t\t\t\t\tthis.closeSubmenu();\n\t\t\t\t},\n\t\t\t);\n\t\t} else if (item.values && item.values.length > 0) {\n\t\t\t// Cycle through values\n\t\t\tconst currentIndex = item.values.indexOf(item.currentValue);\n\t\t\tconst nextIndex = (currentIndex + 1) % item.values.length;\n\t\t\tconst newValue = item.values[nextIndex];\n\t\t\titem.currentValue = newValue;\n\t\t\tthis.onChange(item.id, newValue);\n\t\t}\n\t}\n\n\tprivate closeSubmenu(): void {\n\t\tthis.submenuComponent = null;\n\t\tif (this.navigateAfterClose !== null) {\n\t\t\tconst id = this.navigateAfterClose;\n\t\t\tthis.navigateAfterClose = null;\n\t\t\tthis.submenuItemIndex = null;\n\t\t\tthis.selectItem(id);\n\t\t\t// Open the target item's submenu automatically\n\t\t\tthis.activateItem();\n\t\t} else if (this.submenuItemIndex !== null) {\n\t\t\t// Restore selection to the item that opened the submenu\n\t\t\tthis.selectedIndex = this.submenuItemIndex;\n\t\t\tthis.submenuItemIndex = null;\n\t\t}\n\t}\n\n\tprivate applyFilter(query: string): void {\n\t\tthis.filteredItems = fuzzyFilter(this.items, query, (item) => item.label);\n\t\tthis.selectedIndex = 0;\n\t}\n\n\tprivate addHintLine(lines: string[], width: number): void {\n\t\tlines.push(\"\");\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\tthis.theme.hint(\n\t\t\t\t\tthis.searchEnabled\n\t\t\t\t\t\t? \" Type to search · Enter/Space to change · Esc to cancel\"\n\t\t\t\t\t\t: \" Enter/Space to change · Esc to cancel\",\n\t\t\t\t),\n\t\t\t\twidth,\n\t\t\t),\n\t\t);\n\t}\n}\n"]}
1
+ {"version":3,"file":"settings-list.js","sourceRoot":"","sources":["../../src/components/settings-list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC9E,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAiCnC,MAAM,OAAO,YAAY;IACf,qBAAqB,GAAY,IAAI,CAAC;IACvC,KAAK,CAAgB;IACrB,aAAa,CAAgB;IAC7B,KAAK,CAAoB;IACzB,aAAa,GAAG,CAAC,CAAC;IAClB,iBAAiB,CAAqB;IACtC,UAAU,CAAS;IACnB,QAAQ,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KAAK,IAAI,EAAE,CAAC;YACtC,MAAM,EAAE,GAAG,IAAI,CAAC,kBAAkB,CAAC;YACnC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;YAC/B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YAC7B,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;YACpB,+CAA+C;YAC/C,IAAI,CAAC,YAAY,EAAE,CAAC;QACrB,CAAC;aAAM,IAAI,IAAI,CAAC,gBAAgB,KAAK,IAAI,EAAE,CAAC;YAC3C,wDAAwD;YACxD,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,gBAAgB,CAAC;YAC3C,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC9B,CAAC;IACF,CAAC;IAEO,WAAW,CAAC,KAAa;QAChC,IAAI,CAAC,aAAa,GAAG,WAAW,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1E,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;IACxB,CAAC;IAEO,WAAW,CAAC,KAAe,EAAE,KAAa;QACjD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CACT,eAAe,CACd,IAAI,CAAC,KAAK,CAAC,IAAI,CACd,iBAAiB,CAChB,IAAI,CAAC,aAAa;YACjB,CAAC,CAAC,0DAA0D;YAC5D,CAAC,CAAC,yCAAyC,CAC5C,CACD,EACD,KAAK,CACL,CACD,CAAC;IACH,CAAC;CACD","sourcesContent":["import { clickableHintText } from \"../clickable-hints.ts\";\nimport { fuzzyFilter } from \"../fuzzy.ts\";\nimport { getKeybindings, getSelectPageIndex } from \"../keybindings.ts\";\nimport type { Component, TuiMouseEvent, TuiMouseEventResult } from \"../tui.ts\";\nimport { truncateToWidth, visibleWidth, wrapTextWithAnsi } from \"../utils.ts\";\nimport { Input } from \"./input.ts\";\n\nexport interface SettingItem {\n\t/** Unique identifier for this setting */\n\tid: string;\n\t/** Display label (left side) */\n\tlabel: string;\n\t/** Optional description shown when selected */\n\tdescription?: string;\n\t/** Current value to display (right side) */\n\tcurrentValue: string;\n\t/** If provided, Enter/Space cycles through these values */\n\tvalues?: string[];\n\t/** If provided, Enter opens this submenu. Receives current value and done callback.\n\t * done() accepts an optional selectedValue and an optional navigateTo id to move the cursor after close. */\n\tsubmenu?: (\n\t\tcurrentValue: string,\n\t\tdone: (selectedValue?: string, options?: { navigateTo?: string }) => void,\n\t) => Component;\n}\n\nexport interface SettingsListTheme {\n\tlabel: (text: string, selected: boolean) => string;\n\tvalue: (text: string, selected: boolean) => string;\n\tdescription: (text: string) => string;\n\tcursor: string;\n\thint: (text: string) => string;\n}\n\nexport interface SettingsListOptions {\n\tenableSearch?: boolean;\n}\n\nexport class SettingsList implements Component {\n\treadonly capturesViewportInput: boolean = true;\n\tprivate items: SettingItem[];\n\tprivate filteredItems: SettingItem[];\n\tprivate theme: SettingsListTheme;\n\tprivate selectedIndex = 0;\n\tprivate mousePressedIndex: number | undefined;\n\tprivate maxVisible: number;\n\tprivate onChange: (id: string, newValue: string) => void;\n\tprivate onCancel: () => void;\n\tprivate searchInput?: Input;\n\tprivate searchEnabled: boolean;\n\n\t// Submenu state\n\tprivate submenuComponent: Component | null = null;\n\tprivate submenuItemIndex: number | null = null;\n\tprivate navigateAfterClose: string | null = null;\n\n\tconstructor(\n\t\titems: SettingItem[],\n\t\tmaxVisible: number,\n\t\ttheme: SettingsListTheme,\n\t\tonChange: (id: string, newValue: string) => void,\n\t\tonCancel: () => void,\n\t\toptions: SettingsListOptions = {},\n\t) {\n\t\tthis.items = items;\n\t\tthis.filteredItems = items;\n\t\tthis.maxVisible = maxVisible;\n\t\tthis.theme = theme;\n\t\tthis.onChange = onChange;\n\t\tthis.onCancel = onCancel;\n\t\tthis.searchEnabled = options.enableSearch ?? false;\n\t\tif (this.searchEnabled) {\n\t\t\tthis.searchInput = new Input();\n\t\t}\n\t}\n\n\t/** Update an item's currentValue */\n\tupdateValue(id: string, newValue: string): void {\n\t\tconst item = this.items.find((i) => i.id === id);\n\t\tif (item) {\n\t\t\titem.currentValue = newValue;\n\t\t}\n\t}\n\n\t/** Move selection to the item with the given id (no-op if not found). */\n\tselectItem(id: string): void {\n\t\tconst items = this.searchEnabled ? this.filteredItems : this.items;\n\t\tconst index = items.findIndex((i) => i.id === id);\n\t\tif (index !== -1) {\n\t\t\tthis.selectedIndex = index;\n\t\t}\n\t}\n\n\tinvalidate(): void {\n\t\tthis.submenuComponent?.invalidate?.();\n\t}\n\n\trender(width: number): string[] {\n\t\t// If submenu is active, render it instead\n\t\tif (this.submenuComponent) {\n\t\t\treturn this.submenuComponent.render(width);\n\t\t}\n\n\t\treturn this.renderMainList(width);\n\t}\n\n\tprivate renderMainList(width: number): string[] {\n\t\tconst lines: string[] = [];\n\n\t\tif (this.searchEnabled && this.searchInput) {\n\t\t\tlines.push(...this.searchInput.render(width));\n\t\t\tlines.push(\"\");\n\t\t}\n\n\t\tif (this.items.length === 0) {\n\t\t\tlines.push(this.theme.hint(\" No settings available\"));\n\t\t\tif (this.searchEnabled) {\n\t\t\t\tthis.addHintLine(lines, width);\n\t\t\t}\n\t\t\treturn lines;\n\t\t}\n\n\t\tconst displayItems = this.getDisplayItems();\n\t\tif (displayItems.length === 0) {\n\t\t\tlines.push(truncateToWidth(this.theme.hint(\" No matching settings\"), width));\n\t\t\tthis.addHintLine(lines, width);\n\t\t\treturn lines;\n\t\t}\n\n\t\t// Calculate visible range with scrolling\n\t\tconst { startIndex, endIndex } = this.getVisibleRange(displayItems);\n\n\t\t// Calculate max label width for alignment\n\t\tconst maxLabelWidth = Math.min(36, Math.max(...this.items.map((item) => visibleWidth(item.label))));\n\n\t\t// Render visible items\n\t\tfor (let i = startIndex; i < endIndex; i++) {\n\t\t\tconst item = displayItems[i];\n\t\t\tif (!item) continue;\n\n\t\t\tconst isSelected = i === this.selectedIndex;\n\t\t\tconst prefix = isSelected ? this.theme.cursor : \" \";\n\t\t\tconst prefixWidth = visibleWidth(prefix);\n\n\t\t\t// Pad label to align values\n\t\t\tconst labelPadded = item.label + \" \".repeat(Math.max(0, maxLabelWidth - visibleWidth(item.label)));\n\t\t\tconst labelText = this.theme.label(labelPadded, isSelected);\n\n\t\t\t// Calculate space for value\n\t\t\tconst separator = \" \";\n\t\t\tconst usedWidth = prefixWidth + maxLabelWidth + visibleWidth(separator);\n\t\t\tconst valueMaxWidth = width - usedWidth - 2;\n\n\t\t\tconst valueText = this.theme.value(truncateToWidth(item.currentValue, valueMaxWidth, \"\"), isSelected);\n\n\t\t\tlines.push(truncateToWidth(prefix + labelText + separator + valueText, width));\n\t\t}\n\n\t\t// Add scroll indicator if needed\n\t\tif (startIndex > 0 || endIndex < displayItems.length) {\n\t\t\tconst scrollText = ` (${this.selectedIndex + 1}/${displayItems.length})`;\n\t\t\tlines.push(this.theme.hint(truncateToWidth(scrollText, width - 2, \"\")));\n\t\t}\n\n\t\t// Add description for selected item\n\t\tconst selectedItem = displayItems[this.selectedIndex];\n\t\tif (selectedItem?.description) {\n\t\t\tlines.push(\"\");\n\t\t\tconst wrappedDesc = wrapTextWithAnsi(selectedItem.description, width - 4);\n\t\t\tfor (const line of wrappedDesc) {\n\t\t\t\tlines.push(this.theme.description(` ${line}`));\n\t\t\t}\n\t\t}\n\n\t\t// Add hint\n\t\tthis.addHintLine(lines, width);\n\n\t\treturn lines;\n\t}\n\n\thandleMouse(event: TuiMouseEvent): TuiMouseEventResult | undefined {\n\t\tif (this.submenuComponent) {\n\t\t\tconst result = this.submenuComponent.handleMouse?.(event);\n\t\t\treturn result ? { ...result, focus: true } : undefined;\n\t\t}\n\n\t\tif (this.searchEnabled && this.searchInput) {\n\t\t\tif (event.y === 0) {\n\t\t\t\tconst result = this.searchInput.handleMouse?.(event);\n\t\t\t\treturn result ? { ...result, focus: true } : undefined;\n\t\t\t}\n\t\t\tif (event.y === 1) return undefined;\n\t\t}\n\n\t\tconst displayItems = this.getDisplayItems();\n\t\tif (displayItems.length === 0) return undefined;\n\t\tif (event.type === \"wheel\" && event.wheelDelta) {\n\t\t\tconst delta = event.wheelDelta < 0 ? -1 : 1;\n\t\t\tconst previousIndex = this.selectedIndex;\n\t\t\tthis.selectedIndex = Math.max(0, Math.min(displayItems.length - 1, this.selectedIndex + delta));\n\t\t\treturn { handled: true, render: this.selectedIndex !== previousIndex };\n\t\t}\n\t\t// Hover must not change selection: the visible range is centered on it.\n\t\tif (event.button !== \"left\" || (event.type !== \"press\" && event.type !== \"click\")) return undefined;\n\n\t\tconst rowOffset = this.searchEnabled ? 2 : 0;\n\t\tconst { startIndex, endIndex } = this.getVisibleRange(displayItems);\n\t\tconst itemIndex = startIndex + event.y - rowOffset;\n\t\tif (itemIndex < startIndex || itemIndex >= endIndex) return undefined;\n\t\tif (event.type === \"press\") {\n\t\t\tthis.mousePressedIndex = itemIndex;\n\t\t\tthis.selectedIndex = itemIndex;\n\t\t\treturn { handled: true, focus: true };\n\t\t}\n\t\tif (event.type === \"click\") {\n\t\t\tthis.selectedIndex = this.mousePressedIndex ?? itemIndex;\n\t\t\tthis.mousePressedIndex = undefined;\n\t\t\tthis.activateItem();\n\t\t\treturn { handled: true };\n\t\t}\n\t\treturn undefined;\n\t}\n\n\thandleInput(data: string): void {\n\t\t// If submenu is active, delegate all input to it\n\t\t// The submenu's onCancel (triggered by escape) will call done() which closes it\n\t\tif (this.submenuComponent) {\n\t\t\tthis.submenuComponent.handleInput?.(data);\n\t\t\treturn;\n\t\t}\n\n\t\t// Main list input handling\n\t\tconst kb = getKeybindings();\n\t\tconst displayItems = this.getDisplayItems();\n\t\tconst pageIndex = getSelectPageIndex(kb, data, this.selectedIndex, displayItems.length, this.maxVisible);\n\t\tif (kb.matches(data, \"tui.select.up\")) {\n\t\t\tif (displayItems.length === 0) return;\n\t\t\tthis.selectedIndex = this.selectedIndex === 0 ? displayItems.length - 1 : this.selectedIndex - 1;\n\t\t} else if (kb.matches(data, \"tui.select.down\")) {\n\t\t\tif (displayItems.length === 0) return;\n\t\t\tthis.selectedIndex = this.selectedIndex === displayItems.length - 1 ? 0 : this.selectedIndex + 1;\n\t\t} else if (pageIndex !== undefined) {\n\t\t\tif (displayItems.length === 0) return;\n\t\t\tthis.selectedIndex = pageIndex;\n\t\t} else if (\n\t\t\tkb.matches(data, \"tui.select.confirm\") ||\n\t\t\t(data === \" \" && (!this.searchEnabled || this.searchInput?.getValue().length === 0))\n\t\t) {\n\t\t\tthis.activateItem();\n\t\t} else if (kb.matches(data, \"tui.select.cancel\")) {\n\t\t\tthis.onCancel();\n\t\t} else if (this.searchEnabled && this.searchInput) {\n\t\t\tthis.searchInput.handleInput(data);\n\t\t\tthis.applyFilter(this.searchInput.getValue());\n\t\t}\n\t}\n\n\tprivate getDisplayItems(): SettingItem[] {\n\t\treturn this.searchEnabled ? this.filteredItems : this.items;\n\t}\n\n\tprivate getVisibleRange(displayItems: readonly SettingItem[]): { startIndex: number; endIndex: number } {\n\t\tconst startIndex = Math.max(\n\t\t\t0,\n\t\t\tMath.min(this.selectedIndex - Math.floor(this.maxVisible / 2), displayItems.length - this.maxVisible),\n\t\t);\n\t\treturn { startIndex, endIndex: Math.min(startIndex + this.maxVisible, displayItems.length) };\n\t}\n\n\tprivate activateItem(): void {\n\t\tconst item = this.getDisplayItems()[this.selectedIndex];\n\t\tif (!item) return;\n\n\t\tif (item.submenu) {\n\t\t\t// Open submenu, passing current value so it can pre-select correctly\n\t\t\tthis.submenuItemIndex = this.selectedIndex;\n\t\t\tthis.submenuComponent = item.submenu(\n\t\t\t\titem.currentValue,\n\t\t\t\t(selectedValue?: string, options?: { navigateTo?: string }) => {\n\t\t\t\t\tif (selectedValue !== undefined) {\n\t\t\t\t\t\titem.currentValue = selectedValue;\n\t\t\t\t\t\tthis.onChange(item.id, selectedValue);\n\t\t\t\t\t}\n\t\t\t\t\tif (options?.navigateTo) {\n\t\t\t\t\t\tthis.navigateAfterClose = options.navigateTo;\n\t\t\t\t\t}\n\t\t\t\t\tthis.closeSubmenu();\n\t\t\t\t},\n\t\t\t);\n\t\t} else if (item.values && item.values.length > 0) {\n\t\t\t// Cycle through values\n\t\t\tconst currentIndex = item.values.indexOf(item.currentValue);\n\t\t\tconst nextIndex = (currentIndex + 1) % item.values.length;\n\t\t\tconst newValue = item.values[nextIndex];\n\t\t\titem.currentValue = newValue;\n\t\t\tthis.onChange(item.id, newValue);\n\t\t}\n\t}\n\n\tprivate closeSubmenu(): void {\n\t\tthis.submenuComponent = null;\n\t\tif (this.navigateAfterClose !== null) {\n\t\t\tconst id = this.navigateAfterClose;\n\t\t\tthis.navigateAfterClose = null;\n\t\t\tthis.submenuItemIndex = null;\n\t\t\tthis.selectItem(id);\n\t\t\t// Open the target item's submenu automatically\n\t\t\tthis.activateItem();\n\t\t} else if (this.submenuItemIndex !== null) {\n\t\t\t// Restore selection to the item that opened the submenu\n\t\t\tthis.selectedIndex = this.submenuItemIndex;\n\t\t\tthis.submenuItemIndex = null;\n\t\t}\n\t}\n\n\tprivate applyFilter(query: string): void {\n\t\tthis.filteredItems = fuzzyFilter(this.items, query, (item) => item.label);\n\t\tthis.selectedIndex = 0;\n\t}\n\n\tprivate addHintLine(lines: string[], width: number): void {\n\t\tlines.push(\"\");\n\t\tlines.push(\n\t\t\ttruncateToWidth(\n\t\t\t\tthis.theme.hint(\n\t\t\t\t\tclickableHintText(\n\t\t\t\t\t\tthis.searchEnabled\n\t\t\t\t\t\t\t? \" Type to search · Enter/Space to change · Esc to cancel\"\n\t\t\t\t\t\t\t: \" Enter/Space to change · Esc to cancel\",\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\twidth,\n\t\t\t),\n\t\t);\n\t}\n}\n"]}
@@ -36,6 +36,8 @@ export declare class WindowedContainer extends Container {
36
36
  private sweepScheduled;
37
37
  private lastFullSweepAt;
38
38
  private sweptStale;
39
+ /** Content width of the window that laid out these children, including a containing window's layout. */
40
+ protected get windowLayoutWidth(): number | undefined;
39
41
  protected windowChildren(): readonly Component[];
40
42
  invalidate(): void;
41
43
  layoutWindow(request: WindowRequest): WindowLayout;
@@ -1 +1 @@
1
- {"version":3,"file":"windowed-container.d.ts","sourceRoot":"","sources":["../../src/components/windowed-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtD,MAAM,WAAW,UAAU;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACtC;AAED,MAAM,WAAW,aAAa;IAC7B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,aAAa,EAAE,MAAM,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC/C,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACrB;AA0BD,qBAAa,iBAAkB,SAAQ,SAAS;IAC/C,mGAAmG;IACnG,OAAO,CAAC,UAAU,CAAgC;IAClD,qEAAqE;IACrE,OAAO,CAAC,YAAY,CAAgC;IACpD,sFAAsF;IACtF,OAAO,CAAC,UAAU,CAAwB;IAC1C,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,OAAO,CAAiB;IAChC,OAAO,CAAC,gBAAgB,CAA4B;IACpD,OAAO,CAAC,KAAK,CAAK;IAClB,OAAO,CAAC,OAAO,CAAK;IACpB,OAAO,CAAC,WAAW,CAAK;IACxB,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,YAAY,CAAK;IACzB,OAAO,CAAC,O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D;IAED,UAAU,IAAI,IAAI,CAGjB;IAEK,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAoBrD;IAED;;;;OAIG;IACM,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,SAAS,CAAC;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,CAqBjH;IAED,OAAO,CAAC,QAAQ;IAQhB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,KAAK;IAUb,OAAO,CAAC,OAAO;IAWf,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,MAAM;IAcd,OAAO,CAAC,WAAW;IA2CnB,OAAO,CAAC,QAAQ;IAuBhB,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,UAAU;IAiBlB,OAAO,CAAC,WAAW;IAenB,OAAO,CAAC,aAAa;IAQrB,OAAO,CAAC,UAAU;CAkClB"}
@@ -31,6 +31,10 @@ export class WindowedContainer extends Container {
31
31
  sweepScheduled = false;
32
32
  lastFullSweepAt = Number.NEGATIVE_INFINITY;
33
33
  sweptStale = -1;
34
+ /** Content width of the window that laid out these children, including a containing window's layout. */
35
+ get windowLayoutWidth() {
36
+ return this.windowHost?.width || this.width || undefined;
37
+ }
34
38
  windowChildren() {
35
39
  return this.children;
36
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"windowed-container.js","sourceRoot":"","sources":["../../src/components/windowed-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,WAAW,CAAC;AAmBtD,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAChC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAc5B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAoB,CAAC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AW,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC;gBAAE,KAAK,GAAG,IAAI,CAAC;QACvD,CAAC;QACD,IAAI,KAAK;YAAE,IAAI,CAAC,aAAa,EAAE,EAAE,CAAC;QAClC,IAAI,KAAK,CAAC,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;YACvD,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;YACnC,OAAO;QACR,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;QACvB,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC;QAC5B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC;QAC9B,IAAI,KAAK,CAAC,IAAI;YAAE,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAC1D,CAAC;CACD","sourcesContent":["import { type Component, Container } from \"../tui.ts\";\n\nexport interface WindowRows {\n\treadonly length: number;\n\tat(index: number): string | undefined;\n}\n\nexport interface WindowRequest {\n\treadonly width: number;\n\treadonly top: number;\n\treadonly height: number;\n\treadonly followEnd: boolean;\n\treadonly requestRender: () => void;\n}\n\nexport interface WindowLayout extends WindowRows {\n\treadonly top: number;\n}\n\nconst SLICE_BUDGET_MS = 8;\nconst SLICE_CHILDREN = 48;\nconst SWEEP_INTERVAL_MS = 1_000;\nconst MAX_WINDOW_PASSES = 4;\n\ninterface Entry {\n\treadonly component: Component;\n\t/** The windowed container whose children include `component`. */\n\towner: WindowedContainer | undefined;\n\tlines: readonly string[];\n\twidth: number;\n\tcurrent: boolean;\n\theight: number;\n\tindex: number;\n\trenderedIn: number;\n}\n\nconst entries = new WeakMap<Component, Entry>();\nlet staleChanges = 0;\n\nfunction yieldThen(run: () => void): void {\n\tsetImmediate(run).unref();\n}\n\nexport class WindowedContainer extends Container {\n\t/** The container that last laid this one out among its own rows, when this one is nested in it. */\n\tprivate windowHost: WindowedContainer | undefined;\n\t/** The windowed container this one is a child of, in that layout. */\n\tprivate windowParent: WindowedContainer | undefined;\n\t/** The host's laid-out entries this container's children occupied, `[first, end)`. */\n\tprivate windowSpan = { first: 0, end: 0 };\n\tprivate laidOut: Entry[] = [];\n\tprivate offsets: number[] = [0];\n\tprivate staleOffsetsFrom = Number.POSITIVE_INFINITY;\n\tprivate width = 0;\n\tprivate layouts = 0;\n\tprivate windowStart = 0;\n\tprivate windowEnd = 0;\n\tprivate measuredRows = 0;\n\tprivate measuredChildren = 0;\n\tprivate lastRowIndex = 0;\n\tprivate lastTop = 0;\n\tprivate requestRender: (() => void) | undefined;\n\tprivate sweep: { stale: number; up: number; down: number; full: boolean } | undefined;\n\tprivate sweepScheduled = false;\n\tprivate lastFullSweepAt = Number.NEGATIVE_INFINITY;\n\tprivate sweptStale = -1;\n\n\tprotected windowChildren(): readonly Component[] {\n\t\treturn this.children;\n\t}\n\n\toverride invalidate(): void {\n\t\tfor (const child of this.windowChildren()) {\n\t\t\tconst entry = entries.get(child);\n\t\t\tif (entry?.current) {\n\t\t\t\tentry.current = false;\n\t\t\t\tstaleChanges++;\n\t\t\t}\n\t\t}\n\t\tsuper.invalidate();\n\t}\n\n\tlayoutWindow(request: WindowRequest): WindowLayout {\n\t\tconst width = Math.max(1, Math.floor(request.width));\n\t\tconst height = Math.max(0, Math.floor(request.height));\n\t\tthis.requestRender = request.requestRender;\n\t\tconst anchor = request.top === this.lastTop ? this.locateAnchor(request.top) : undefined;\n\t\tif (width !== this.width) {\n\t\t\tthis.width = width;\n\t\t\tfor (const entry of this.laidOut) entry.current = false;\n\t\t\tstaleChanges++;\n\t\t}\n\t\tthis.syncEntries();\n\t\tthis.updateOffsets();\n\t\tconst layout = ++this.layouts;\n\t\tlet top = this.topFor(request, anchor, height);\n\t\tfor (let pass = 0; pass < MAX_WINDOW_PASSES; pass++) {\n\t\t\tif (!this.renderRows(top - height, top + 2 * height, width, layout)) break;\n\t\t\tthis.updateOffsets();\n\t\t\ttop = this.topFor(request, anchor, height);\n\t\t}\n\t\tthis.scheduleSweep();\n\t\tthis.lastTop = top;\n\t\tconst length = this.rowCount();\n\t\treturn { top, length, at: (index) => this.rowAt(index) };\n\t}\n\n\tsettleRows(): void {\n\t\tif (this.width === 0) return;\n\t\tfor (const entry of this.laidOut) this.renderEntry(entry, this.width);\n\t}\n\n\tasync renderInSlices(width: number): Promise<string[]> {\n\t\tconst safeWidth = Math.max(1, Math.floor(width));\n\t\tif (safeWidth !== this.width) {\n\t\t\tthis.width = safeWidth;\n\t\t\tfor (const entry of this.laidOut) entry.current = false;\n\t\t}\n\t\tthis.syncEntries();\n\t\tthis.updateOffsets();\n\t\tlet deadline = performance.now() + SLICE_BUDGET_MS;\n\t\tfor (let index = 0; index < this.laidOut.length; index++) {\n\t\t\tif (performance.now() >= deadline) {\n\t\t\t\tawait new Promise<void>((resolve) => setImmediate(resolve));\n\t\t\t\tdeadline = performance.now() + SLICE_BUDGET_MS;\n\t\t\t}\n\t\t\tconst entry = this.laidOut[index];\n\t\t\tif (entry) this.renderEntry(entry, safeWidth);\n\t\t}\n\t\tconst lines: string[] = [];\n\t\tfor (const entry of this.laidOut) for (const line of entry.lines) lines.push(line);\n\t\treturn lines;\n\t}\n\n\t/**\n\t * The child drawn at `row` as the last layout drew it: an entry, or a nested windowed container with the rows its\n\t * children took. A nested container answers from the layout of the container that laid it out, so its own mouse\n\t * handler sees the rows that were painted. Without a layout at `width`, the children are rendered to measure them.\n\t */\n\toverride childAtRow(width: number, row: number): { component: Component; row: number; height: number } | undefined {\n\t\tconst window = this.windowAt(width);\n\t\tif (!window) return super.childAtRow(width, row);\n\t\tconst { host, first, end } = window;\n\t\tconst base = host.offsets[first] ?? 0;\n\t\tconst absolute = base + row;\n\t\tif (row < 0 || absolute >= (host.offsets[end] ?? base)) return undefined;\n\t\tconst index = host.indexAt(absolute);\n\t\tconst entry = host.laidOut[index];\n\t\tif (!entry || index < first || index >= end) return undefined;\n\t\tlet child: Component = entry.component;\n\t\tlet span = { first: index, end: index + 1 };\n\t\tfor (let owner = entry.owner; owner !== this; owner = owner.windowParent) {\n\t\t\tif (!owner) return undefined;\n\t\t\tchild = owner;\n\t\t\tspan = owner.windowSpan;\n\t\t}\n\t\tconst start = host.offsets[span.first] ?? 0;\n\t\tconst stop = host.offsets[span.end] ?? start;\n\t\tif (absolute < start || absolute >= stop) return undefined;\n\t\treturn { component: child, row: absolute - start, height: stop - start };\n\t}\n\n\tprivate windowAt(width: number): { host: WindowedContainer; first: number; end: number } | undefined {\n\t\tif (this.width === width && this.laidOut.length > 0) return { host: this, first: 0, end: this.laidOut.length };\n\t\tconst host = this.windowHost;\n\t\tif (!host || host.width !== width || host.laidOut.length === 0) return undefined;\n\t\tconst { first, end } = this.windowSpan;\n\t\treturn end > first && end <= host.laidOut.length ? { host, first, end } : undefined;\n\t}\n\n\tprivate rowCount(): number {\n\t\treturn this.offsets[this.laidOut.length] ?? 0;\n\t}\n\n\tprivate rowAt(row: number): string | undefined {\n\t\tif (row < 0 || row >= this.rowCount()) return undefined;\n\t\tlet index = this.lastRowIndex;\n\t\tif (!((this.offsets[index] ?? 0) <= row && row < (this.offsets[index + 1] ?? 0))) index = this.indexAt(row);\n\t\tthis.lastRowIndex = index;\n\t\tconst entry = this.laidOut[index];\n\t\tif (!entry?.current) return \"\";\n\t\treturn entry.lines[row - (this.offsets[index] ?? 0)] ?? \"\";\n\t}\n\n\tprivate indexAt(row: number): number {\n\t\tlet low = 0;\n\t\tlet high = this.laidOut.length - 1;\n\t\twhile (low < high) {\n\t\t\tconst middle = (low + high + 1) >> 1;\n\t\t\tif ((this.offsets[middle] ?? 0) <= row) low = middle;\n\t\t\telse high = middle - 1;\n\t\t}\n\t\treturn Math.max(0, low);\n\t}\n\n\tprivate locateAnchor(top: number): { entry: Entry; within: number } | undefined {\n\t\tif (this.laidOut.length === 0) return undefined;\n\t\tconst index = this.indexAt(Math.max(0, top));\n\t\tconst entry = this.laidOut[index];\n\t\treturn entry ? { entry, within: Math.max(0, top - (this.offsets[index] ?? 0)) } : undefined;\n\t}\n\n\tprivate topFor(\n\t\trequest: WindowRequest,\n\t\tanchor: { entry: Entry; within: number } | undefined,\n\t\theight: number,\n\t): number {\n\t\tconst maxTop = Math.max(0, this.rowCount() - height);\n\t\tif (request.followEnd) return maxTop;\n\t\tlet top = Math.floor(request.top);\n\t\tif (anchor && this.laidOut[anchor.entry.index] === anchor.entry) {\n\t\t\ttop = (this.offsets[anchor.entry.index] ?? 0) + Math.min(anchor.within, Math.max(0, anchor.entry.height - 1));\n\t\t}\n\t\treturn Math.max(0, Math.min(maxTop, top));\n\t}\n\n\tprivate syncEntries(): void {\n\t\tconst laidOut = this.laidOut;\n\t\tlet index = 0;\n\t\tlet rebuilt: Entry[] | undefined;\n\t\tconst position = (): number => rebuilt?.length ?? index;\n\t\tconst visit = (container: WindowedContainer): void => {\n\t\t\tfor (const child of container.windowChildren()) {\n\t\t\t\tif (child instanceof WindowedContainer) {\n\t\t\t\t\tchild.windowHost = this;\n\t\t\t\t\tchild.windowParent = container;\n\t\t\t\t\tconst first = position();\n\t\t\t\t\tvisit(child);\n\t\t\t\t\tchild.windowSpan = { first, end: position() };\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (rebuilt === undefined) {\n\t\t\t\t\tconst kept = laidOut[index];\n\t\t\t\t\tif (kept?.component === child) {\n\t\t\t\t\t\tkept.owner = container;\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\trebuilt = laidOut.slice(0, index);\n\t\t\t\t}\n\t\t\t\tconst entry = this.entryFor(child);\n\t\t\t\tentry.owner = container;\n\t\t\t\trebuilt.push(entry);\n\t\t\t}\n\t\t};\n\t\tvisit(this);\n\t\tif (rebuilt === undefined) {\n\t\t\tif (index === laidOut.length) return;\n\t\t\trebuilt = laidOut.slice(0, index);\n\t\t}\n\t\tfor (let position = index; position < rebuilt.length; position++) {\n\t\t\tconst entry = rebuilt[position];\n\t\t\tif (entry) entry.index = position;\n\t\t}\n\t\tthis.laidOut = rebuilt;\n\t\tthis.staleOffsetsFrom = Math.min(this.staleOffsetsFrom, index);\n\t\tthis.lastRowIndex = 0;\n\t}\n\n\tprivate entryFor(component: Component): Entry {\n\t\tlet entry = entries.get(component);\n\t\tif (!entry) {\n\t\t\tconst estimate =\n\t\t\t\tthis.measuredChildren > 0 ? Math.max(1, Math.round(this.measuredRows / this.measuredChildren)) : 1;\n\t\t\tentry = {\n\t\t\t\tcomponent,\n\t\t\t\towner: undefined,\n\t\t\t\tlines: [],\n\t\t\t\twidth: 0,\n\t\t\t\tcurrent: false,\n\t\t\t\theight: estimate,\n\t\t\t\tindex: 0,\n\t\t\t\trenderedIn: 0,\n\t\t\t};\n\t\t\tentries.set(component, entry);\n\t\t\tstaleChanges++;\n\t\t} else if (entry.width !== this.width) {\n\t\t\tentry.current = false;\n\t\t}\n\t\treturn entry;\n\t}\n\n\tprivate updateOffsets(): void {\n\t\tconst from = this.staleOffsetsFrom;\n\t\tif (from === Number.POSITIVE_INFINITY) return;\n\t\tconst { laidOut, offsets } = this;\n\t\toffsets.length = laidOut.length + 1;\n\t\tlet row = from === 0 ? 0 : (offsets[from] ?? 0);\n\t\tfor (let index = from; index < laidOut.length; index++) {\n\t\t\toffsets[index] = row;\n\t\t\trow += laidOut[index]?.height ?? 0;\n\t\t}\n\t\toffsets[laidOut.length] = row;\n\t\tthis.staleOffsetsFrom = Number.POSITIVE_INFINITY;\n\t}\n\n\tprivate renderRows(start: number, end: number, width: number, layout: number): boolean {\n\t\tif (this.laidOut.length === 0) return false;\n\t\tlet changed = false;\n\t\tlet first = this.indexAt(Math.max(0, start));\n\t\twhile (first > 0 && this.offsets[first - 1] === this.offsets[first]) first--;\n\t\tlet index = first;\n\t\tfor (; index < this.laidOut.length && (this.offsets[index] ?? 0) < Math.max(end, 1); index++) {\n\t\t\tconst entry = this.laidOut[index];\n\t\t\tif (!entry || entry.renderedIn === layout) continue;\n\t\t\tentry.renderedIn = layout;\n\t\t\tif (this.renderEntry(entry, width)) changed = true;\n\t\t}\n\t\tthis.windowStart = first;\n\t\tthis.windowEnd = index;\n\t\treturn changed;\n\t}\n\n\tprivate renderEntry(entry: Entry, width: number): boolean {\n\t\tconst lines = entry.component.render(width);\n\t\tif (entry.width === 0) {\n\t\t\tthis.measuredRows += lines.length;\n\t\t\tthis.measuredChildren++;\n\t\t}\n\t\tentry.lines = lines;\n\t\tentry.width = width;\n\t\tentry.current = true;\n\t\tif (entry.height === lines.length) return false;\n\t\tentry.height = lines.length;\n\t\tif (this.laidOut[entry.index] === entry) this.staleOffsetsFrom = Math.min(this.staleOffsetsFrom, entry.index);\n\t\treturn true;\n\t}\n\n\tprivate scheduleSweep(): void {\n\t\tif (this.sweepScheduled) return;\n\t\tthis.sweepScheduled = true;\n\t\tconst run = () => this.sweepSlice();\n\t\tif (this.sweptStale !== staleChanges) yieldThen(run);\n\t\telse setTimeout(run, Math.max(0, this.lastFullSweepAt + SWEEP_INTERVAL_MS - performance.now())).unref();\n\t}\n\n\tprivate sweepSlice(): void {\n\t\tif (this.width === 0) {\n\t\t\tthis.sweepScheduled = false;\n\t\t\treturn;\n\t\t}\n\t\tlet sweep = this.sweep;\n\t\tif (!sweep || sweep.stale !== staleChanges) {\n\t\t\tconst full = sweep?.full ?? this.sweptStale === staleChanges;\n\t\t\tsweep = { stale: staleChanges, up: this.windowStart - 1, down: this.windowEnd, full };\n\t\t\tthis.sweep = sweep;\n\t\t}\n\t\tconst deadline = performance.now() + SLICE_BUDGET_MS;\n\t\tlet rendered = 0;\n\t\tlet moved = false;\n\t\twhile (rendered < SLICE_CHILDREN && performance.now() < deadline) {\n\t\t\tlet index: number;\n\t\t\tif (sweep.up >= 0) index = sweep.up--;\n\t\t\telse if (sweep.down < this.laidOut.length) index = sweep.down++;\n\t\t\telse break;\n\t\t\tconst entry = this.laidOut[index];\n\t\t\tif (!entry || (entry.current && !sweep.full)) continue;\n\t\t\trendered++;\n\t\t\tif (this.renderEntry(entry, this.width)) moved = true;\n\t\t}\n\t\tif (moved) this.requestRender?.();\n\t\tif (sweep.up >= 0 || sweep.down < this.laidOut.length) {\n\t\t\tyieldThen(() => this.sweepSlice());\n\t\t\treturn;\n\t\t}\n\t\tthis.sweep = undefined;\n\t\tthis.sweepScheduled = false;\n\t\tthis.sweptStale = sweep.stale;\n\t\tif (sweep.full) this.lastFullSweepAt = performance.now();\n\t}\n}\n"]}
1
+ {"version":3,"file":"windowed-container.js","sourceRoot":"","sources":["../../src/components/windowed-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,WAAW,CAAC;AAmBtD,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,iBAAiB,GAAG,KAAK,CAAC;AAChC,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAc5B,MAAM,OAAO,GAAG,IAAI,OAAO,EAAoB,CAAC;AAChD,IAAI,YAAY,GAAG,CAAC,CAAC;AAErB,SAAS,SAAS,CAAC,GAAe;IACjC,YAAY,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,OAAO,iBAAkB,SAAQ,SAAS;IAC/C,mGAAmG;IAC3F,UAAU,CAAgC;IAClD,qEAAqE;IAC7D,YAAY,CAAgC;IACpD,sFAAsF;IAC9E,UAAU,GAAG,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;IAClC,OAAO,GAAY,EAAE,CAAC;IACtB,OAAO,GAAa,CAAC,CAAC,CAAC,CAAC;IACxB,gBAAgB,GAAG,MAAM,CAAC,iBAAiB,CAAC;IAC5C,KAAK,GAAG,CAAC,CAAC;IACV,OAAO,GAAG,CAAC,CAAC;IACZ,WAAW,GAAG,CAAC,CAAC;IAChB,SAAS,GAAG,CAAC,CAA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C5B,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC;QAC9B,IAAI,KAAK,CAAC,IAAI;YAAE,IAAI,CAAC,eAAe,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IAC1D,CAAC;CACD","sourcesContent":["import { type Component, Container } from \"../tui.ts\";\n\nexport interface WindowRows {\n\treadonly length: number;\n\tat(index: number): string | undefined;\n}\n\nexport interface WindowRequest {\n\treadonly width: number;\n\treadonly top: number;\n\treadonly height: number;\n\treadonly followEnd: boolean;\n\treadonly requestRender: () => void;\n}\n\nexport interface WindowLayout extends WindowRows {\n\treadonly top: number;\n}\n\nconst SLICE_BUDGET_MS = 8;\nconst SLICE_CHILDREN = 48;\nconst SWEEP_INTERVAL_MS = 1_000;\nconst MAX_WINDOW_PASSES = 4;\n\ninterface Entry {\n\treadonly component: Component;\n\t/** The windowed container whose children include `component`. */\n\towner: WindowedContainer | undefined;\n\tlines: readonly string[];\n\twidth: number;\n\tcurrent: boolean;\n\theight: number;\n\tindex: number;\n\trenderedIn: number;\n}\n\nconst entries = new WeakMap<Component, Entry>();\nlet staleChanges = 0;\n\nfunction yieldThen(run: () => void): void {\n\tsetImmediate(run).unref();\n}\n\nexport class WindowedContainer extends Container {\n\t/** The container that last laid this one out among its own rows, when this one is nested in it. */\n\tprivate windowHost: WindowedContainer | undefined;\n\t/** The windowed container this one is a child of, in that layout. */\n\tprivate windowParent: WindowedContainer | undefined;\n\t/** The host's laid-out entries this container's children occupied, `[first, end)`. */\n\tprivate windowSpan = { first: 0, end: 0 };\n\tprivate laidOut: Entry[] = [];\n\tprivate offsets: number[] = [0];\n\tprivate staleOffsetsFrom = Number.POSITIVE_INFINITY;\n\tprivate width = 0;\n\tprivate layouts = 0;\n\tprivate windowStart = 0;\n\tprivate windowEnd = 0;\n\tprivate measuredRows = 0;\n\tprivate measuredChildren = 0;\n\tprivate lastRowIndex = 0;\n\tprivate lastTop = 0;\n\tprivate requestRender: (() => void) | undefined;\n\tprivate sweep: { stale: number; up: number; down: number; full: boolean } | undefined;\n\tprivate sweepScheduled = false;\n\tprivate lastFullSweepAt = Number.NEGATIVE_INFINITY;\n\tprivate sweptStale = -1;\n\n\t/** Content width of the window that laid out these children, including a containing window's layout. */\n\tprotected get windowLayoutWidth(): number | undefined {\n\t\treturn this.windowHost?.width || this.width || undefined;\n\t}\n\n\tprotected windowChildren(): readonly Component[] {\n\t\treturn this.children;\n\t}\n\n\toverride invalidate(): void {\n\t\tfor (const child of this.windowChildren()) {\n\t\t\tconst entry = entries.get(child);\n\t\t\tif (entry?.current) {\n\t\t\t\tentry.current = false;\n\t\t\t\tstaleChanges++;\n\t\t\t}\n\t\t}\n\t\tsuper.invalidate();\n\t}\n\n\tlayoutWindow(request: WindowRequest): WindowLayout {\n\t\tconst width = Math.max(1, Math.floor(request.width));\n\t\tconst height = Math.max(0, Math.floor(request.height));\n\t\tthis.requestRender = request.requestRender;\n\t\tconst anchor = request.top === this.lastTop ? this.locateAnchor(request.top) : undefined;\n\t\tif (width !== this.width) {\n\t\t\tthis.width = width;\n\t\t\tfor (const entry of this.laidOut) entry.current = false;\n\t\t\tstaleChanges++;\n\t\t}\n\t\tthis.syncEntries();\n\t\tthis.updateOffsets();\n\t\tconst layout = ++this.layouts;\n\t\tlet top = this.topFor(request, anchor, height);\n\t\tfor (let pass = 0; pass < MAX_WINDOW_PASSES; pass++) {\n\t\t\tif (!this.renderRows(top - height, top + 2 * height, width, layout)) break;\n\t\t\tthis.updateOffsets();\n\t\t\ttop = this.topFor(request, anchor, height);\n\t\t}\n\t\tthis.scheduleSweep();\n\t\tthis.lastTop = top;\n\t\tconst length = this.rowCount();\n\t\treturn { top, length, at: (index) => this.rowAt(index) };\n\t}\n\n\tsettleRows(): void {\n\t\tif (this.width === 0) return;\n\t\tfor (const entry of this.laidOut) this.renderEntry(entry, this.width);\n\t}\n\n\tasync renderInSlices(width: number): Promise<string[]> {\n\t\tconst safeWidth = Math.max(1, Math.floor(width));\n\t\tif (safeWidth !== this.width) {\n\t\t\tthis.width = safeWidth;\n\t\t\tfor (const entry of this.laidOut) entry.current = false;\n\t\t}\n\t\tthis.syncEntries();\n\t\tthis.updateOffsets();\n\t\tlet deadline = performance.now() + SLICE_BUDGET_MS;\n\t\tfor (let index = 0; index < this.laidOut.length; index++) {\n\t\t\tif (performance.now() >= deadline) {\n\t\t\t\tawait new Promise<void>((resolve) => setImmediate(resolve));\n\t\t\t\tdeadline = performance.now() + SLICE_BUDGET_MS;\n\t\t\t}\n\t\t\tconst entry = this.laidOut[index];\n\t\t\tif (entry) this.renderEntry(entry, safeWidth);\n\t\t}\n\t\tconst lines: string[] = [];\n\t\tfor (const entry of this.laidOut) for (const line of entry.lines) lines.push(line);\n\t\treturn lines;\n\t}\n\n\t/**\n\t * The child drawn at `row` as the last layout drew it: an entry, or a nested windowed container with the rows its\n\t * children took. A nested container answers from the layout of the container that laid it out, so its own mouse\n\t * handler sees the rows that were painted. Without a layout at `width`, the children are rendered to measure them.\n\t */\n\toverride childAtRow(width: number, row: number): { component: Component; row: number; height: number } | undefined {\n\t\tconst window = this.windowAt(width);\n\t\tif (!window) return super.childAtRow(width, row);\n\t\tconst { host, first, end } = window;\n\t\tconst base = host.offsets[first] ?? 0;\n\t\tconst absolute = base + row;\n\t\tif (row < 0 || absolute >= (host.offsets[end] ?? base)) return undefined;\n\t\tconst index = host.indexAt(absolute);\n\t\tconst entry = host.laidOut[index];\n\t\tif (!entry || index < first || index >= end) return undefined;\n\t\tlet child: Component = entry.component;\n\t\tlet span = { first: index, end: index + 1 };\n\t\tfor (let owner = entry.owner; owner !== this; owner = owner.windowParent) {\n\t\t\tif (!owner) return undefined;\n\t\t\tchild = owner;\n\t\t\tspan = owner.windowSpan;\n\t\t}\n\t\tconst start = host.offsets[span.first] ?? 0;\n\t\tconst stop = host.offsets[span.end] ?? start;\n\t\tif (absolute < start || absolute >= stop) return undefined;\n\t\treturn { component: child, row: absolute - start, height: stop - start };\n\t}\n\n\tprivate windowAt(width: number): { host: WindowedContainer; first: number; end: number } | undefined {\n\t\tif (this.width === width && this.laidOut.length > 0) return { host: this, first: 0, end: this.laidOut.length };\n\t\tconst host = this.windowHost;\n\t\tif (!host || host.width !== width || host.laidOut.length === 0) return undefined;\n\t\tconst { first, end } = this.windowSpan;\n\t\treturn end > first && end <= host.laidOut.length ? { host, first, end } : undefined;\n\t}\n\n\tprivate rowCount(): number {\n\t\treturn this.offsets[this.laidOut.length] ?? 0;\n\t}\n\n\tprivate rowAt(row: number): string | undefined {\n\t\tif (row < 0 || row >= this.rowCount()) return undefined;\n\t\tlet index = this.lastRowIndex;\n\t\tif (!((this.offsets[index] ?? 0) <= row && row < (this.offsets[index + 1] ?? 0))) index = this.indexAt(row);\n\t\tthis.lastRowIndex = index;\n\t\tconst entry = this.laidOut[index];\n\t\tif (!entry?.current) return \"\";\n\t\treturn entry.lines[row - (this.offsets[index] ?? 0)] ?? \"\";\n\t}\n\n\tprivate indexAt(row: number): number {\n\t\tlet low = 0;\n\t\tlet high = this.laidOut.length - 1;\n\t\twhile (low < high) {\n\t\t\tconst middle = (low + high + 1) >> 1;\n\t\t\tif ((this.offsets[middle] ?? 0) <= row) low = middle;\n\t\t\telse high = middle - 1;\n\t\t}\n\t\treturn Math.max(0, low);\n\t}\n\n\tprivate locateAnchor(top: number): { entry: Entry; within: number } | undefined {\n\t\tif (this.laidOut.length === 0) return undefined;\n\t\tconst index = this.indexAt(Math.max(0, top));\n\t\tconst entry = this.laidOut[index];\n\t\treturn entry ? { entry, within: Math.max(0, top - (this.offsets[index] ?? 0)) } : undefined;\n\t}\n\n\tprivate topFor(\n\t\trequest: WindowRequest,\n\t\tanchor: { entry: Entry; within: number } | undefined,\n\t\theight: number,\n\t): number {\n\t\tconst maxTop = Math.max(0, this.rowCount() - height);\n\t\tif (request.followEnd) return maxTop;\n\t\tlet top = Math.floor(request.top);\n\t\tif (anchor && this.laidOut[anchor.entry.index] === anchor.entry) {\n\t\t\ttop = (this.offsets[anchor.entry.index] ?? 0) + Math.min(anchor.within, Math.max(0, anchor.entry.height - 1));\n\t\t}\n\t\treturn Math.max(0, Math.min(maxTop, top));\n\t}\n\n\tprivate syncEntries(): void {\n\t\tconst laidOut = this.laidOut;\n\t\tlet index = 0;\n\t\tlet rebuilt: Entry[] | undefined;\n\t\tconst position = (): number => rebuilt?.length ?? index;\n\t\tconst visit = (container: WindowedContainer): void => {\n\t\t\tfor (const child of container.windowChildren()) {\n\t\t\t\tif (child instanceof WindowedContainer) {\n\t\t\t\t\tchild.windowHost = this;\n\t\t\t\t\tchild.windowParent = container;\n\t\t\t\t\tconst first = position();\n\t\t\t\t\tvisit(child);\n\t\t\t\t\tchild.windowSpan = { first, end: position() };\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (rebuilt === undefined) {\n\t\t\t\t\tconst kept = laidOut[index];\n\t\t\t\t\tif (kept?.component === child) {\n\t\t\t\t\t\tkept.owner = container;\n\t\t\t\t\t\tindex++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\trebuilt = laidOut.slice(0, index);\n\t\t\t\t}\n\t\t\t\tconst entry = this.entryFor(child);\n\t\t\t\tentry.owner = container;\n\t\t\t\trebuilt.push(entry);\n\t\t\t}\n\t\t};\n\t\tvisit(this);\n\t\tif (rebuilt === undefined) {\n\t\t\tif (index === laidOut.length) return;\n\t\t\trebuilt = laidOut.slice(0, index);\n\t\t}\n\t\tfor (let position = index; position < rebuilt.length; position++) {\n\t\t\tconst entry = rebuilt[position];\n\t\t\tif (entry) entry.index = position;\n\t\t}\n\t\tthis.laidOut = rebuilt;\n\t\tthis.staleOffsetsFrom = Math.min(this.staleOffsetsFrom, index);\n\t\tthis.lastRowIndex = 0;\n\t}\n\n\tprivate entryFor(component: Component): Entry {\n\t\tlet entry = entries.get(component);\n\t\tif (!entry) {\n\t\t\tconst estimate =\n\t\t\t\tthis.measuredChildren > 0 ? Math.max(1, Math.round(this.measuredRows / this.measuredChildren)) : 1;\n\t\t\tentry = {\n\t\t\t\tcomponent,\n\t\t\t\towner: undefined,\n\t\t\t\tlines: [],\n\t\t\t\twidth: 0,\n\t\t\t\tcurrent: false,\n\t\t\t\theight: estimate,\n\t\t\t\tindex: 0,\n\t\t\t\trenderedIn: 0,\n\t\t\t};\n\t\t\tentries.set(component, entry);\n\t\t\tstaleChanges++;\n\t\t} else if (entry.width !== this.width) {\n\t\t\tentry.current = false;\n\t\t}\n\t\treturn entry;\n\t}\n\n\tprivate updateOffsets(): void {\n\t\tconst from = this.staleOffsetsFrom;\n\t\tif (from === Number.POSITIVE_INFINITY) return;\n\t\tconst { laidOut, offsets } = this;\n\t\toffsets.length = laidOut.length + 1;\n\t\tlet row = from === 0 ? 0 : (offsets[from] ?? 0);\n\t\tfor (let index = from; index < laidOut.length; index++) {\n\t\t\toffsets[index] = row;\n\t\t\trow += laidOut[index]?.height ?? 0;\n\t\t}\n\t\toffsets[laidOut.length] = row;\n\t\tthis.staleOffsetsFrom = Number.POSITIVE_INFINITY;\n\t}\n\n\tprivate renderRows(start: number, end: number, width: number, layout: number): boolean {\n\t\tif (this.laidOut.length === 0) return false;\n\t\tlet changed = false;\n\t\tlet first = this.indexAt(Math.max(0, start));\n\t\twhile (first > 0 && this.offsets[first - 1] === this.offsets[first]) first--;\n\t\tlet index = first;\n\t\tfor (; index < this.laidOut.length && (this.offsets[index] ?? 0) < Math.max(end, 1); index++) {\n\t\t\tconst entry = this.laidOut[index];\n\t\t\tif (!entry || entry.renderedIn === layout) continue;\n\t\t\tentry.renderedIn = layout;\n\t\t\tif (this.renderEntry(entry, width)) changed = true;\n\t\t}\n\t\tthis.windowStart = first;\n\t\tthis.windowEnd = index;\n\t\treturn changed;\n\t}\n\n\tprivate renderEntry(entry: Entry, width: number): boolean {\n\t\tconst lines = entry.component.render(width);\n\t\tif (entry.width === 0) {\n\t\t\tthis.measuredRows += lines.length;\n\t\t\tthis.measuredChildren++;\n\t\t}\n\t\tentry.lines = lines;\n\t\tentry.width = width;\n\t\tentry.current = true;\n\t\tif (entry.height === lines.length) return false;\n\t\tentry.height = lines.length;\n\t\tif (this.laidOut[entry.index] === entry) this.staleOffsetsFrom = Math.min(this.staleOffsetsFrom, entry.index);\n\t\treturn true;\n\t}\n\n\tprivate scheduleSweep(): void {\n\t\tif (this.sweepScheduled) return;\n\t\tthis.sweepScheduled = true;\n\t\tconst run = () => this.sweepSlice();\n\t\tif (this.sweptStale !== staleChanges) yieldThen(run);\n\t\telse setTimeout(run, Math.max(0, this.lastFullSweepAt + SWEEP_INTERVAL_MS - performance.now())).unref();\n\t}\n\n\tprivate sweepSlice(): void {\n\t\tif (this.width === 0) {\n\t\t\tthis.sweepScheduled = false;\n\t\t\treturn;\n\t\t}\n\t\tlet sweep = this.sweep;\n\t\tif (!sweep || sweep.stale !== staleChanges) {\n\t\t\tconst full = sweep?.full ?? this.sweptStale === staleChanges;\n\t\t\tsweep = { stale: staleChanges, up: this.windowStart - 1, down: this.windowEnd, full };\n\t\t\tthis.sweep = sweep;\n\t\t}\n\t\tconst deadline = performance.now() + SLICE_BUDGET_MS;\n\t\tlet rendered = 0;\n\t\tlet moved = false;\n\t\twhile (rendered < SLICE_CHILDREN && performance.now() < deadline) {\n\t\t\tlet index: number;\n\t\t\tif (sweep.up >= 0) index = sweep.up--;\n\t\t\telse if (sweep.down < this.laidOut.length) index = sweep.down++;\n\t\t\telse break;\n\t\t\tconst entry = this.laidOut[index];\n\t\t\tif (!entry || (entry.current && !sweep.full)) continue;\n\t\t\trendered++;\n\t\t\tif (this.renderEntry(entry, this.width)) moved = true;\n\t\t}\n\t\tif (moved) this.requestRender?.();\n\t\tif (sweep.up >= 0 || sweep.down < this.laidOut.length) {\n\t\t\tyieldThen(() => this.sweepSlice());\n\t\t\treturn;\n\t\t}\n\t\tthis.sweep = undefined;\n\t\tthis.sweepScheduled = false;\n\t\tthis.sweptStale = sweep.stale;\n\t\tif (sweep.full) this.lastFullSweepAt = performance.now();\n\t}\n}\n"]}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export { Marked, type Token, type Tokens } from "marked";
2
2
  export { type AutocompleteItem, type AutocompleteProvider, type AutocompleteSuggestions, CombinedAutocompleteProvider, type SlashCommand, } from "./autocomplete.ts";
3
+ export { bindBundledHintCommands, clickableHint, clickableHintText, clickableKeysHint, clickableKeyTextHint, commandHintAction, type HintAction, type HintKeyPart, type HintSpan, hasHintMarkers, hintActionAt, hintKeyId, hintKeyParts, isHintActivation, keyHintAction, readHintSpans, runAsHintActivation, slashCommandHint, stripHintMarkers, } from "./clickable-hints.ts";
3
4
  export { backgroundAnsi, type Color, type ColorMixSpace, colorToHex, colorToOkhsl, colorToOklch, colorToRgb, foregroundAnsi, type IndexedColor, indexedColor, mixColors, type OkhslChannels, type OklchChannels, type OklchColorValue, okhslColor, oklchColor, parseColor, type RgbColorValue, rgbColor, styleText, styleTextWithAnsi, type TerminalColorMode, type TextAttributes, type TextStyle, } from "./colors.ts";
4
5
  export { Box } from "./components/box.ts";
5
6
  export { CancellableLoader } from "./components/cancellable-loader.ts";
@@ -21,7 +22,7 @@ export { WindowedContainer, type WindowLayout, type WindowRequest, type WindowRo
21
22
  export type { EditorComponent } from "./editor-component.ts";
22
23
  export { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from "./fuzzy.ts";
23
24
  export { getKeybindings, getSelectPageIndex, type Keybinding, type KeybindingConflict, type KeybindingDefinition, type KeybindingDefinitions, type Keybindings, type KeybindingsConfig, KeybindingsManager, setKeybindings, TUI_KEYBINDINGS, } from "./keybindings.ts";
24
- export { decodeKittyPrintable, decodePrintableKey, isKeyRelease, isKeyRepeat, isKittyProtocolActive, Key, type KeyEventType, type KeyId, matchesKey, parseKey, setKittyProtocolActive, } from "./keys.ts";
25
+ export { decodeKittyPrintable, decodePrintableKey, isKeyRelease, isKeyRepeat, isKittyProtocolActive, Key, type KeyEventType, type KeyId, keyInputData, matchesKey, parseKey, setKittyProtocolActive, } from "./keys.ts";
25
26
  export { type RenderLatexOptions, renderLatex } from "./latex.ts";
26
27
  export { getNativeClipboard, type NativeClipboard } from "./native-platform.ts";
27
28
  export { oklabToOkhslLightness } from "./oklab.ts";
@@ -32,7 +33,7 @@ export { isAppleTerminalSession, ProcessTerminal, type Terminal } from "./termin
32
33
  export { parseTerminalColorSchemeReport, type RgbColor, type TerminalColorScheme, type TerminalColors, } from "./terminal-colors.ts";
33
34
  export { allocateImageId, type CellDimensions, calculateImageRows, deleteAllKittyImages, deleteKittyImage, detectCapabilities, encodeITerm2, encodeKitty, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getPngDimensions, getTerminalColorMode, getWebpDimensions, hyperlink, type ImageDimensions, type ImageProtocol, type ImageRenderOptions, imageFallback, renderImage, resetCapabilitiesCache, setCapabilities, setCapabilityOverrides, setCellDimensions, type TerminalCapabilities, } from "./terminal-image.ts";
34
35
  export { type Component, Container, CURSOR_MARKER, compositeTuiLine, type Focusable, isFocusable, isViewportTUI, type OverlayAnchor, type OverlayBounds, type OverlayHandle, type OverlayMargin, type OverlayOptions, type OverlayUnfocusOptions, renderFakeCursor, type SizeValue, type TUI, type TuiInputListener, type TuiInputListenerResult, type TuiMode, type TuiMouseButton, type TuiMouseEvent, type TuiMouseEventResult, type TuiMouseEventType, type TuiStopOptions, type ViewportTUI, } from "./tui.ts";
35
- export { TuiAltScreen, type TuiAltScreenOptions, turnPromptAbove } from "./tui-alt-screen.ts";
36
+ export { MULTI_CLICK_INTERVAL_MS, TuiAltScreen, type TuiAltScreenOptions, turnPromptAbove, } from "./tui-alt-screen.ts";
36
37
  export { TuiMainScreen, type TuiMainScreenRenderState } from "./tui-main-screen.ts";
37
38
  export { getOsc8LinkAtColumn, replaceControlCharacters, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.ts";
38
39
  export type { WheelScrollLines } from "./wheel-scroll.ts";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["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KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,KAAK,WAAW,GAChB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,uBAAuB,EACvB,YAAY,EACZ,KAAK,mBAAmB,EACxB,eAAe,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,KAAK,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEpF,OAAO,EACN,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,YAAY,CAAC;AACpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js CHANGED
@@ -2,6 +2,8 @@
2
2
  export { Marked } from "marked";
3
3
  // Autocomplete support
4
4
  export { CombinedAutocompleteProvider, } from "./autocomplete.js";
5
+ // Clickable key hints
6
+ export { bindBundledHintCommands, clickableHint, clickableHintText, clickableKeysHint, clickableKeyTextHint, commandHintAction, hasHintMarkers, hintActionAt, hintKeyId, hintKeyParts, isHintActivation, keyHintAction, readHintSpans, runAsHintActivation, slashCommandHint, stripHintMarkers, } from "./clickable-hints.js";
5
7
  // Colors and styling
6
8
  export { backgroundAnsi, colorToHex, colorToOkhsl, colorToOklch, colorToRgb, foregroundAnsi, indexedColor, mixColors, okhslColor, oklchColor, parseColor, rgbColor, styleText, styleTextWithAnsi, } from "./colors.js";
7
9
  // Components
@@ -27,7 +29,7 @@ export { fuzzyFilter, fuzzyMatch } from "./fuzzy.js";
27
29
  // Keybindings
28
30
  export { getKeybindings, getSelectPageIndex, KeybindingsManager, setKeybindings, TUI_KEYBINDINGS, } from "./keybindings.js";
29
31
  // Keyboard input handling
30
- export { decodeKittyPrintable, decodePrintableKey, isKeyRelease, isKeyRepeat, isKittyProtocolActive, Key, matchesKey, parseKey, setKittyProtocolActive, } from "./keys.js";
32
+ export { decodeKittyPrintable, decodePrintableKey, isKeyRelease, isKeyRepeat, isKittyProtocolActive, Key, keyInputData, matchesKey, parseKey, setKittyProtocolActive, } from "./keys.js";
31
33
  // LaTeX rendering
32
34
  export { renderLatex } from "./latex.js";
33
35
  // Native platform integration
@@ -45,7 +47,7 @@ export { parseTerminalColorSchemeReport, } from "./terminal-colors.js";
45
47
  // Terminal image support
46
48
  export { allocateImageId, calculateImageRows, deleteAllKittyImages, deleteKittyImage, detectCapabilities, encodeITerm2, encodeKitty, getCapabilities, getCellDimensions, getGifDimensions, getImageDimensions, getJpegDimensions, getPngDimensions, getTerminalColorMode, getWebpDimensions, hyperlink, imageFallback, renderImage, resetCapabilitiesCache, setCapabilities, setCapabilityOverrides, setCellDimensions, } from "./terminal-image.js";
47
49
  export { Container, CURSOR_MARKER, compositeTuiLine, isFocusable, isViewportTUI, renderFakeCursor, } from "./tui.js";
48
- export { TuiAltScreen, turnPromptAbove } from "./tui-alt-screen.js";
50
+ export { MULTI_CLICK_INTERVAL_MS, TuiAltScreen, turnPromptAbove, } from "./tui-alt-screen.js";
49
51
  export { TuiMainScreen } from "./tui-main-screen.js";
50
52
  // Utilities
51
53
  export { getOsc8LinkAtColumn, replaceControlCharacters, sliceByColumn, stripTerminalSequences, truncateToWidth, visibleWidth, wrapTextWithAnsi, } from "./utils.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAA2B,MAAM,QAAQ,CAAC;AACzD,uBAAuB;AACvB,OAAO,EAIN,4BAA4B,GAE5B,MAAM,mBAAmB,CAAC;AAC3B,qBAAqB;AACrB,OAAO,EACN,cAAc,EAGd,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,cAAc,EAEd,YAAY,EACZ,SAAS,EAIT,UAAU,EACV,UAAU,EACV,UAAU,EAEV,QAAQ,EACR,SAAS,EACT,iBAAiB,G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,YAAY,EACZ,gBAAgB,GAChB,MAAM,YAAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\nexport { Marked, type Token, type Tokens } from \"marked\";\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.ts\";\n// Colors and styling\nexport {\n\tbackgroundAnsi,\n\ttype Color,\n\ttype ColorMixSpace,\n\tcolorToHex,\n\tcolorToOkhsl,\n\tcolorToOklch,\n\tcolorToRgb,\n\tforegroundAnsi,\n\ttype IndexedColor,\n\tindexedColor,\n\tmixColors,\n\ttype OkhslChannels,\n\ttype OklchChannels,\n\ttype OklchColorValue,\n\tokhslColor,\n\toklchColor,\n\tparseColor,\n\ttype RgbColorValue,\n\trgbColor,\n\tstyleText,\n\tstyleTextWithAnsi,\n\ttype TerminalColorMode,\n\ttype TextAttributes,\n\ttype TextStyle,\n} from \"./colors.ts\";\n// Components\nexport { Box } from \"./components/box.ts\";\nexport { CancellableLoader } from \"./components/cancellable-loader.ts\";\nexport {\n\tEditor,\n\ttype EditorAutocompleteHintEntry,\n\ttype EditorOptions,\n\ttype EditorTheme,\n} from \"./components/editor.ts\";\nexport { HStack } from \"./components/h-stack.ts\";\nexport {\n\tImage,\n\ttype ImageOptions,\n\ttype ImageTheme,\n\ttype ImageTranscoder,\n\tsetImageTranscoder,\n} from \"./components/image.ts\";\nexport { Input } from \"./components/input.ts\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.ts\";\nexport { type DefaultTextStyle, Markdown, type MarkdownOptions, type MarkdownTheme } from \"./components/markdown.ts\";\nexport { MouseRegion, type MouseRegionHandler } from \"./components/mouse-region.ts\";\nexport {\n\tScrollView,\n\ttype ScrollViewOptions,\n\ttype ScrollViewScrollbar,\n\ttype ScrollViewScrollToOptions,\n} from \"./components/scroll-view.ts\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.ts\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.ts\";\nexport { Spacer } from \"./components/spacer.ts\";\nexport { Text } from \"./components/text.ts\";\nexport { TruncatedText } from \"./components/truncated-text.ts\";\nexport {\n\ttype StackChild,\n\ttype StackEntry,\n\ttype StackEntryOptions,\n\ttype StackOptions,\n\tVStack,\n} from \"./components/v-stack.ts\";\nexport {\n\tWindowedContainer,\n\ttype WindowLayout,\n\ttype WindowRequest,\n\ttype WindowRows,\n} from \"./components/windowed-container.ts\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent } from \"./editor-component.ts\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from \"./fuzzy.ts\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\tgetSelectPageIndex,\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.ts\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tdecodePrintableKey,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.ts\";\n// LaTeX rendering\nexport { type RenderLatexOptions, renderLatex } from \"./latex.ts\";\n// Native platform integration\nexport { getNativeClipboard, type NativeClipboard } from \"./native-platform.ts\";\nexport { oklabToOkhslLightness } from \"./oklab.ts\";\nexport { normalizePastedText } from \"./paste.ts\";\n// Program status reporting (OSC 7501)\nexport { formatProgramStatus, type ProgramStatus } from \"./program-status.ts\";\n// Input buffering for batch splitting\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.ts\";\n// Terminal interface and implementations\nexport { isAppleTerminalSession, ProcessTerminal, type Terminal } from \"./terminal.ts\";\n// Terminal colors\nexport {\n\tparseTerminalColorSchemeReport,\n\ttype RgbColor,\n\ttype TerminalColorScheme,\n\ttype TerminalColors,\n} from \"./terminal-colors.ts\";\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\tgetTerminalColorMode,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCapabilityOverrides,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n} from \"./terminal-image.ts\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\tcompositeTuiLine,\n\ttype Focusable,\n\tisFocusable,\n\tisViewportTUI,\n\ttype OverlayAnchor,\n\ttype OverlayBounds,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype OverlayUnfocusOptions,\n\trenderFakeCursor,\n\ttype SizeValue,\n\ttype TUI,\n\ttype TuiInputListener,\n\ttype TuiInputListenerResult,\n\ttype TuiMode,\n\ttype TuiMouseButton,\n\ttype TuiMouseEvent,\n\ttype TuiMouseEventResult,\n\ttype TuiMouseEventType,\n\ttype TuiStopOptions,\n\ttype ViewportTUI,\n} from \"./tui.ts\";\nexport { TuiAltScreen, type TuiAltScreenOptions, turnPromptAbove } from \"./tui-alt-screen.ts\";\nexport { TuiMainScreen, type TuiMainScreenRenderState } from \"./tui-main-screen.ts\";\n// Utilities\nexport {\n\tgetOsc8LinkAtColumn,\n\treplaceControlCharacters,\n\tsliceByColumn,\n\tstripTerminalSequences,\n\ttruncateToWidth,\n\tvisibleWidth,\n\twrapTextWithAnsi,\n} from \"./utils.ts\";\nexport type { WheelScrollLines } from \"./wheel-scroll.ts\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAElC,OAAO,EAAE,MAAM,EAA2B,MAAM,QAAQ,CAAC;AACzD,uBAAuB;AACvB,OAAO,EAIN,4BAA4B,GAE5B,MAAM,mBAAmB,CAAC;AAC3B,sBAAsB;AACtB,OAAO,EACN,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,EAIjB,cAAc,EACd,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,GAChB,MAAM,sBAAsB,CAAC;AAC9B,qBAAqB;AACrB,OAAO,EACN,cAAc,EAGd,UAAU,EACV,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,cAAc,EAEd,YAAY,EACZ,SAAS,EAIT,UAAU,EACV,UAAU,EACV,UAAU,EAEV,QAAQ,EACR,SAAS,EACT,iBAAiB,GAIjB,MAAM,aAAa,CAAC;AACrB,aAAa;AACb,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EACN,MAAM,GAIN,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACjD,OAAO,EACN,KAAK,EAIL,kBAAkB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAE,MAAM,EAA+B,MAAM,wBAAwB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,EAAqD,MAAM,mBAAmB,CAAC;AACnG,yCAAyC;AACzC,OAAO,EAAE,sBAAsB,EAAE,eAAe,EAAiB,MAAM,eAAe,CAAC;AACvF,kBAAkB;AAClB,OAAO,EACN,8BAA8B,GAI9B,MAAM,sBAAsB,CAAC;AAC9B,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,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,EAIT,aAAa,EACb,WAAW,EACX,sBAAsB,EACtB,eAAe,EACf,sBAAsB,EACtB,iBAAiB,GAEjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEN,SAAS,EACT,aAAa,EACb,gBAAgB,EAEhB,WAAW,EACX,aAAa,EAOb,gBAAgB,GAYhB,MAAM,UAAU,CAAC;AAClB,OAAO,EACN,uBAAuB,EACvB,YAAY,EAEZ,eAAe,GACf,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAiC,MAAM,sBAAsB,CAAC;AACpF,YAAY;AACZ,OAAO,EACN,mBAAmB,EACnB,wBAAwB,EACxB,aAAa,EACb,sBAAsB,EACtB,eAAe,EACf,YAAY,EACZ,gBAAgB,GAChB,MAAM,YAAY,CAAC","sourcesContent":["// Core TUI interfaces and classes\n\nexport { Marked, type Token, type Tokens } from \"marked\";\n// Autocomplete support\nexport {\n\ttype AutocompleteItem,\n\ttype AutocompleteProvider,\n\ttype AutocompleteSuggestions,\n\tCombinedAutocompleteProvider,\n\ttype SlashCommand,\n} from \"./autocomplete.ts\";\n// Clickable key hints\nexport {\n\tbindBundledHintCommands,\n\tclickableHint,\n\tclickableHintText,\n\tclickableKeysHint,\n\tclickableKeyTextHint,\n\tcommandHintAction,\n\ttype HintAction,\n\ttype HintKeyPart,\n\ttype HintSpan,\n\thasHintMarkers,\n\thintActionAt,\n\thintKeyId,\n\thintKeyParts,\n\tisHintActivation,\n\tkeyHintAction,\n\treadHintSpans,\n\trunAsHintActivation,\n\tslashCommandHint,\n\tstripHintMarkers,\n} from \"./clickable-hints.ts\";\n// Colors and styling\nexport {\n\tbackgroundAnsi,\n\ttype Color,\n\ttype ColorMixSpace,\n\tcolorToHex,\n\tcolorToOkhsl,\n\tcolorToOklch,\n\tcolorToRgb,\n\tforegroundAnsi,\n\ttype IndexedColor,\n\tindexedColor,\n\tmixColors,\n\ttype OkhslChannels,\n\ttype OklchChannels,\n\ttype OklchColorValue,\n\tokhslColor,\n\toklchColor,\n\tparseColor,\n\ttype RgbColorValue,\n\trgbColor,\n\tstyleText,\n\tstyleTextWithAnsi,\n\ttype TerminalColorMode,\n\ttype TextAttributes,\n\ttype TextStyle,\n} from \"./colors.ts\";\n// Components\nexport { Box } from \"./components/box.ts\";\nexport { CancellableLoader } from \"./components/cancellable-loader.ts\";\nexport {\n\tEditor,\n\ttype EditorAutocompleteHintEntry,\n\ttype EditorOptions,\n\ttype EditorTheme,\n} from \"./components/editor.ts\";\nexport { HStack } from \"./components/h-stack.ts\";\nexport {\n\tImage,\n\ttype ImageOptions,\n\ttype ImageTheme,\n\ttype ImageTranscoder,\n\tsetImageTranscoder,\n} from \"./components/image.ts\";\nexport { Input } from \"./components/input.ts\";\nexport { Loader, type LoaderIndicatorOptions } from \"./components/loader.ts\";\nexport { type DefaultTextStyle, Markdown, type MarkdownOptions, type MarkdownTheme } from \"./components/markdown.ts\";\nexport { MouseRegion, type MouseRegionHandler } from \"./components/mouse-region.ts\";\nexport {\n\tScrollView,\n\ttype ScrollViewOptions,\n\ttype ScrollViewScrollbar,\n\ttype ScrollViewScrollToOptions,\n} from \"./components/scroll-view.ts\";\nexport {\n\ttype SelectItem,\n\tSelectList,\n\ttype SelectListLayoutOptions,\n\ttype SelectListTheme,\n\ttype SelectListTruncatePrimaryContext,\n} from \"./components/select-list.ts\";\nexport { type SettingItem, SettingsList, type SettingsListTheme } from \"./components/settings-list.ts\";\nexport { Spacer } from \"./components/spacer.ts\";\nexport { Text } from \"./components/text.ts\";\nexport { TruncatedText } from \"./components/truncated-text.ts\";\nexport {\n\ttype StackChild,\n\ttype StackEntry,\n\ttype StackEntryOptions,\n\ttype StackOptions,\n\tVStack,\n} from \"./components/v-stack.ts\";\nexport {\n\tWindowedContainer,\n\ttype WindowLayout,\n\ttype WindowRequest,\n\ttype WindowRows,\n} from \"./components/windowed-container.ts\";\n// Editor component interface (for custom editors)\nexport type { EditorComponent } from \"./editor-component.ts\";\n// Fuzzy matching\nexport { type FuzzyMatch, fuzzyFilter, fuzzyMatch } from \"./fuzzy.ts\";\n// Keybindings\nexport {\n\tgetKeybindings,\n\tgetSelectPageIndex,\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.ts\";\n// Keyboard input handling\nexport {\n\tdecodeKittyPrintable,\n\tdecodePrintableKey,\n\tisKeyRelease,\n\tisKeyRepeat,\n\tisKittyProtocolActive,\n\tKey,\n\ttype KeyEventType,\n\ttype KeyId,\n\tkeyInputData,\n\tmatchesKey,\n\tparseKey,\n\tsetKittyProtocolActive,\n} from \"./keys.ts\";\n// LaTeX rendering\nexport { type RenderLatexOptions, renderLatex } from \"./latex.ts\";\n// Native platform integration\nexport { getNativeClipboard, type NativeClipboard } from \"./native-platform.ts\";\nexport { oklabToOkhslLightness } from \"./oklab.ts\";\nexport { normalizePastedText } from \"./paste.ts\";\n// Program status reporting (OSC 7501)\nexport { formatProgramStatus, type ProgramStatus } from \"./program-status.ts\";\n// Input buffering for batch splitting\nexport { StdinBuffer, type StdinBufferEventMap, type StdinBufferOptions } from \"./stdin-buffer.ts\";\n// Terminal interface and implementations\nexport { isAppleTerminalSession, ProcessTerminal, type Terminal } from \"./terminal.ts\";\n// Terminal colors\nexport {\n\tparseTerminalColorSchemeReport,\n\ttype RgbColor,\n\ttype TerminalColorScheme,\n\ttype TerminalColors,\n} from \"./terminal-colors.ts\";\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\tgetTerminalColorMode,\n\tgetWebpDimensions,\n\thyperlink,\n\ttype ImageDimensions,\n\ttype ImageProtocol,\n\ttype ImageRenderOptions,\n\timageFallback,\n\trenderImage,\n\tresetCapabilitiesCache,\n\tsetCapabilities,\n\tsetCapabilityOverrides,\n\tsetCellDimensions,\n\ttype TerminalCapabilities,\n} from \"./terminal-image.ts\";\nexport {\n\ttype Component,\n\tContainer,\n\tCURSOR_MARKER,\n\tcompositeTuiLine,\n\ttype Focusable,\n\tisFocusable,\n\tisViewportTUI,\n\ttype OverlayAnchor,\n\ttype OverlayBounds,\n\ttype OverlayHandle,\n\ttype OverlayMargin,\n\ttype OverlayOptions,\n\ttype OverlayUnfocusOptions,\n\trenderFakeCursor,\n\ttype SizeValue,\n\ttype TUI,\n\ttype TuiInputListener,\n\ttype TuiInputListenerResult,\n\ttype TuiMode,\n\ttype TuiMouseButton,\n\ttype TuiMouseEvent,\n\ttype TuiMouseEventResult,\n\ttype TuiMouseEventType,\n\ttype TuiStopOptions,\n\ttype ViewportTUI,\n} from \"./tui.ts\";\nexport {\n\tMULTI_CLICK_INTERVAL_MS,\n\tTuiAltScreen,\n\ttype TuiAltScreenOptions,\n\tturnPromptAbove,\n} from \"./tui-alt-screen.ts\";\nexport { TuiMainScreen, type TuiMainScreenRenderState } from \"./tui-main-screen.ts\";\n// Utilities\nexport {\n\tgetOsc8LinkAtColumn,\n\treplaceControlCharacters,\n\tsliceByColumn,\n\tstripTerminalSequences,\n\ttruncateToWidth,\n\tvisibleWidth,\n\twrapTextWithAnsi,\n} from \"./utils.ts\";\nexport type { WheelScrollLines } from \"./wheel-scroll.ts\";\n"]}
package/dist/keys.d.ts CHANGED
@@ -180,5 +180,10 @@ export declare function parseKey(data: string): string | undefined;
180
180
  */
181
181
  export declare function decodeKittyPrintable(data: string): string | undefined;
182
182
  export declare function decodePrintableKey(data: string): string | undefined;
183
+ /**
184
+ * The terminal input a press of `keyId` sends, as `matchesKey` reads it: what a click on a key hint feeds to the
185
+ * input path so it acts exactly as the key. Undefined for a key id no input matches.
186
+ */
187
+ export declare function keyInputData(keyId: KeyId): string | undefined;
183
188
  export {};
184
189
  //# sourceMappingURL=keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../src/keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,CAE5D;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,OAAO,CAE/C;AAMD,KAAK,MAAM,GACR,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAC;AAEP,KAAK,KAAK,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAEvE,KAAK,SAAS,G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AoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAqCrE;AAgBD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEnE;AAiED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAiC7D"}
package/dist/keys.js CHANGED
@@ -1257,4 +1257,119 @@ function decodeModifyOtherKeysPrintable(data) {
1257
1257
  export function decodePrintableKey(data) {
1258
1258
  return decodeKittyPrintable(data) ?? decodeModifyOtherKeysPrintable(data);
1259
1259
  }
1260
+ const UNMODIFIED_KEY_INPUT = {
1261
+ escape: "\x1b",
1262
+ esc: "\x1b",
1263
+ enter: "\r",
1264
+ return: "\r",
1265
+ tab: "\t",
1266
+ space: " ",
1267
+ backspace: "\x7f",
1268
+ up: "\x1b[A",
1269
+ down: "\x1b[B",
1270
+ right: "\x1b[C",
1271
+ left: "\x1b[D",
1272
+ home: "\x1b[H",
1273
+ end: "\x1b[F",
1274
+ insert: "\x1b[2~",
1275
+ delete: "\x1b[3~",
1276
+ pageup: "\x1b[5~",
1277
+ pagedown: "\x1b[6~",
1278
+ clear: "\x1b[E",
1279
+ f1: "\x1bOP",
1280
+ f2: "\x1bOQ",
1281
+ f3: "\x1bOR",
1282
+ f4: "\x1bOS",
1283
+ f5: "\x1b[15~",
1284
+ f6: "\x1b[17~",
1285
+ f7: "\x1b[18~",
1286
+ f8: "\x1b[19~",
1287
+ f9: "\x1b[20~",
1288
+ f10: "\x1b[21~",
1289
+ f11: "\x1b[23~",
1290
+ f12: "\x1b[24~",
1291
+ };
1292
+ const KITTY_KEY_CODEPOINTS = {
1293
+ escape: CODEPOINTS.escape,
1294
+ esc: CODEPOINTS.escape,
1295
+ enter: CODEPOINTS.enter,
1296
+ return: CODEPOINTS.enter,
1297
+ tab: CODEPOINTS.tab,
1298
+ space: CODEPOINTS.space,
1299
+ backspace: CODEPOINTS.backspace,
1300
+ };
1301
+ const CSI_TILDE_KEYS = {
1302
+ insert: 2,
1303
+ delete: 3,
1304
+ pageup: 5,
1305
+ pagedown: 6,
1306
+ f1: 11,
1307
+ f2: 12,
1308
+ f3: 13,
1309
+ f4: 14,
1310
+ f5: 15,
1311
+ f6: 17,
1312
+ f7: 18,
1313
+ f8: 19,
1314
+ f9: 20,
1315
+ f10: 21,
1316
+ f11: 23,
1317
+ f12: 24,
1318
+ };
1319
+ const CSI_LETTER_KEYS = { up: "A", down: "B", right: "C", left: "D", home: "H", end: "F" };
1320
+ /**
1321
+ * The terminal input a press of `keyId` sends, as `matchesKey` reads it: what a click on a key hint feeds to the
1322
+ * input path so it acts exactly as the key. Undefined for a key id no input matches.
1323
+ */
1324
+ export function keyInputData(keyId) {
1325
+ const parsed = parseKeyId(keyId);
1326
+ if (!parsed)
1327
+ return undefined;
1328
+ const { key, ctrl, shift, alt, super: superModifier } = parsed;
1329
+ let modifier = 0;
1330
+ if (shift)
1331
+ modifier |= MODIFIERS.shift;
1332
+ if (alt)
1333
+ modifier |= MODIFIERS.alt;
1334
+ if (ctrl)
1335
+ modifier |= MODIFIERS.ctrl;
1336
+ if (superModifier)
1337
+ modifier |= MODIFIERS.super;
1338
+ const candidates = [];
1339
+ const unmodified = UNMODIFIED_KEY_INPUT[key];
1340
+ if (modifier === 0 && unmodified !== undefined)
1341
+ candidates.push(unmodified);
1342
+ if (key.length === 1) {
1343
+ if (modifier === 0)
1344
+ candidates.push(key);
1345
+ const rawCtrl = rawCtrlChar(key);
1346
+ if (modifier === MODIFIERS.ctrl && rawCtrl)
1347
+ candidates.push(rawCtrl);
1348
+ if (modifier === MODIFIERS.alt)
1349
+ candidates.push(`\x1b${key}`);
1350
+ if (modifier === MODIFIERS.shift && key >= "a" && key <= "z")
1351
+ candidates.push(key.toUpperCase());
1352
+ candidates.push(`\x1b[${key.charCodeAt(0)};${modifier + 1}u`);
1353
+ }
1354
+ if (key === "clear") {
1355
+ if (modifier === MODIFIERS.shift)
1356
+ candidates.push(...LEGACY_SHIFT_SEQUENCES.clear);
1357
+ if (modifier === MODIFIERS.ctrl)
1358
+ candidates.push(...LEGACY_CTRL_SEQUENCES.clear);
1359
+ }
1360
+ if (key === "tab" && modifier === MODIFIERS.shift)
1361
+ candidates.push("\x1b[Z");
1362
+ if (key === "enter" && modifier === MODIFIERS.alt)
1363
+ candidates.push("\x1b\r");
1364
+ const codepoint = KITTY_KEY_CODEPOINTS[key];
1365
+ if (codepoint !== undefined)
1366
+ candidates.push(`\x1b[${codepoint};${modifier + 1}u`);
1367
+ const tilde = CSI_TILDE_KEYS[key];
1368
+ if (tilde !== undefined)
1369
+ candidates.push(`\x1b[${tilde};${modifier + 1}~`);
1370
+ const letter = CSI_LETTER_KEYS[key];
1371
+ if (letter !== undefined)
1372
+ candidates.push(`\x1b[1;${modifier + 1}${letter}`);
1373
+ return candidates.find((candidate) => matchesKey(candidate, keyId));
1374
+ }
1260
1375
  //# sourceMappingURL=keys.js.map