@draht/tui 2026.11.19 → 2026.11.21

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 (43) hide show
  1. package/dist/components/box.d.ts +2 -3
  2. package/dist/components/box.d.ts.map +1 -1
  3. package/dist/components/box.js +14 -42
  4. package/dist/components/box.js.map +1 -1
  5. package/dist/components/editor.d.ts +2 -1
  6. package/dist/components/editor.d.ts.map +1 -1
  7. package/dist/components/editor.js +16 -6
  8. package/dist/components/editor.js.map +1 -1
  9. package/dist/components/image.d.ts +1 -1
  10. package/dist/components/image.d.ts.map +1 -1
  11. package/dist/components/image.js.map +1 -1
  12. package/dist/components/markdown.d.ts +1 -1
  13. package/dist/components/markdown.d.ts.map +1 -1
  14. package/dist/components/markdown.js.map +1 -1
  15. package/dist/components/mouse-region.d.ts +1 -1
  16. package/dist/components/mouse-region.d.ts.map +1 -1
  17. package/dist/components/mouse-region.js.map +1 -1
  18. package/dist/components/scroll-view.d.ts +1 -1
  19. package/dist/components/scroll-view.d.ts.map +1 -1
  20. package/dist/components/scroll-view.js.map +1 -1
  21. package/dist/components/settings-list.d.ts +1 -1
  22. package/dist/components/settings-list.d.ts.map +1 -1
  23. package/dist/components/settings-list.js +5 -1
  24. package/dist/components/settings-list.js.map +1 -1
  25. package/dist/components/text.d.ts +1 -1
  26. package/dist/components/text.d.ts.map +1 -1
  27. package/dist/components/text.js.map +1 -1
  28. package/dist/layout.d.ts +13 -1
  29. package/dist/layout.d.ts.map +1 -1
  30. package/dist/layout.js +14 -3
  31. package/dist/layout.js.map +1 -1
  32. package/dist/tui-alt-screen.d.ts +1 -1
  33. package/dist/tui-alt-screen.d.ts.map +1 -1
  34. package/dist/tui-alt-screen.js +14 -8
  35. package/dist/tui-alt-screen.js.map +1 -1
  36. package/dist/tui.d.ts +42 -5
  37. package/dist/tui.d.ts.map +1 -1
  38. package/dist/tui.js +98 -30
  39. package/dist/tui.js.map +1 -1
  40. package/dist/utils.d.ts.map +1 -1
  41. package/dist/utils.js +106 -8
  42. package/dist/utils.js.map +1 -1
  43. package/package.json +1 -1
@@ -296,15 +296,15 @@ export class TuiAltScreen extends TuiBase {
296
296
  }
297
297
  scrollBy(lines) {
298
298
  this.getPrimaryScrollView().scrollBy(lines);
299
- this.requestRender();
299
+ this.requestViewRender();
300
300
  }
301
301
  scrollToTop() {
302
302
  this.getPrimaryScrollView().scrollToStart();
303
- this.requestRender();
303
+ this.requestViewRender();
304
304
  }
305
305
  scrollToBottom() {
306
306
  this.getPrimaryScrollView().scrollToEnd();
307
- this.requestRender();
307
+ this.requestViewRender();
308
308
  }
309
309
  scrollToPrompt(direction) {
310
310
  if (!this.currentLayout)
@@ -317,7 +317,7 @@ export class TuiAltScreen extends TuiBase {
317
317
  if (!OSC133_PROMPT_START.test(lines[row] ?? ""))
318
318
  continue;
319
319
  scrollView.scrollTo(row);
320
- this.requestRender();
320
+ this.requestViewRender();
321
321
  return;
322
322
  }
323
323
  }
@@ -816,7 +816,9 @@ export class TuiAltScreen extends TuiBase {
816
816
  if (remaining !== 0 && !seen.has(primary))
817
817
  primary.scrollBy(remaining);
818
818
  this.updateScrollbarHover(event.x, event.y);
819
- this.requestRender();
819
+ // Scrolling moves the viewport only. Reusing the previous component output keeps a wheel
820
+ // frame O(viewport); re-rendering a long transcript on every wheel event saturated a core.
821
+ this.requestViewRender();
820
822
  }
821
823
  parseSgrMouseEvent(data) {
822
824
  const match = /^\x1b\[<(\d+);(\d+);(\d+)([Mm])$/.exec(data);
@@ -1085,7 +1087,8 @@ export class TuiAltScreen extends TuiBase {
1085
1087
  const point = this.getScrollSelectionPoint(scrollView, pointer.x, pointer.y);
1086
1088
  if (point)
1087
1089
  this.updateSelectionFocus(point);
1088
- this.requestRender();
1090
+ // Selection is painted onto the screen after layout, so it needs no new component output.
1091
+ this.requestViewRender();
1089
1092
  }
1090
1093
  stopSelectionAutoScroll() {
1091
1094
  if (this.selectionAutoScrollTimer) {
@@ -1452,9 +1455,12 @@ export class TuiAltScreen extends TuiBase {
1452
1455
  const width = Math.max(1, this.terminal.columns);
1453
1456
  const height = Math.max(1, this.terminal.rows);
1454
1457
  const root = this.layoutRoot ?? this.implicitScrollView;
1455
- let nextLayout = renderLayoutFrame(root, width, height, () => this.requestRender());
1458
+ const requestViewRender = () => this.requestViewRender();
1459
+ const reusableOutput = this.contentChanged ? undefined : this.currentLayout?.renderCache;
1460
+ this.contentChanged = false;
1461
+ let nextLayout = renderLayoutFrame(root, width, height, requestViewRender, reusableOutput);
1456
1462
  if (this.refreshSearch(nextLayout)) {
1457
- nextLayout = renderLayoutFrame(root, width, height, () => this.requestRender());
1463
+ nextLayout = renderLayoutFrame(root, width, height, requestViewRender, nextLayout.renderCache);
1458
1464
  }
1459
1465
  // Resolve fake cursors before highlighting and compositing, which only track SGR codes
1460
1466
  let screen = this.resolveFakeCursors(nextLayout.lines.map((line) => line.replace(OSC133_ZONE_PREFIX, "")));