@simon_he/vue-tui 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +84 -26
  2. package/dist/TMermaidText-frVr8Ysb.js +885 -0
  3. package/dist/{TSelect-DR0FomSu.js → TSelect-tJ87rKPM.js} +59 -242
  4. package/dist/{TTree-kzhlB5P0.js → TTree-CGdE-CYu.js} +138 -102
  5. package/dist/agent/mermaid.cjs +2 -0
  6. package/dist/agent/mermaid.d.cts +2 -0
  7. package/dist/agent/mermaid.d.ts +2 -0
  8. package/dist/agent/mermaid.js +1 -0
  9. package/dist/agent.cjs +31188 -24907
  10. package/dist/agent.d.cts +11 -1
  11. package/dist/agent.d.ts +11 -1
  12. package/dist/agent.js +516 -11
  13. package/dist/{block-source-CKUOnkgT.js → block-source-CrlmaBM5.js} +1039 -66
  14. package/dist/cli/input.d.ts +8 -0
  15. package/dist/cli/stdin-buffer.d.ts +1 -1
  16. package/dist/cli/video/ffmpeg-frame-source.d.ts +10 -0
  17. package/dist/cli/video/png-frame-parser.d.ts +4 -0
  18. package/dist/cli/video/raw-frame-parser.d.ts +1 -0
  19. package/dist/cli/video/yt-dlp-frame-source.d.ts +11 -0
  20. package/dist/cli.cjs +5146 -6767
  21. package/dist/cli.d.cts +5 -1
  22. package/dist/cli.d.ts +5 -1
  23. package/dist/cli.js +2869 -154
  24. package/dist/core/buffer/eaw-ranges-unicode-17.d.ts +14 -0
  25. package/dist/core/perf/instrumentation-noop.d.ts +48 -0
  26. package/dist/core/perf/instrumentation.d.ts +136 -0
  27. package/dist/core/terminal/create-terminal.d.ts +1 -0
  28. package/dist/core.cjs +843 -1469
  29. package/dist/core.js +4 -5
  30. package/dist/create-terminal-app.d.ts +24 -1
  31. package/dist/debug-logger-CmsGI4of.js +74 -0
  32. package/dist/{dom-renderer-BniJSQyX.js → dom-renderer-DXx8fWzD.js} +2 -3
  33. package/dist/experimental/3d/bun/contributor-avatar-atlas.d.ts +12 -0
  34. package/dist/experimental/3d/bun/png.d.ts +1 -0
  35. package/dist/experimental/3d/bun/terminal-badge-scene.d.ts +11 -0
  36. package/dist/experimental/3d/bun/terminal-badge.wgsl.d.ts +1 -0
  37. package/dist/experimental/3d/bun/webgpu-renderer.d.ts +26 -0
  38. package/dist/experimental/3d/bun.cjs +7271 -0
  39. package/dist/experimental/3d/bun.d.cts +4 -0
  40. package/dist/experimental/3d/bun.d.ts +4 -0
  41. package/dist/experimental/3d/bun.js +7390 -0
  42. package/dist/experimental/video/node.cjs +497 -0
  43. package/dist/experimental/video/node.d.cts +4 -0
  44. package/dist/experimental/video/node.d.ts +4 -0
  45. package/dist/experimental/video/node.js +610 -0
  46. package/dist/experimental.cjs +6876 -6192
  47. package/dist/experimental.d.cts +7 -0
  48. package/dist/experimental.d.ts +7 -0
  49. package/dist/experimental.js +3005 -9
  50. package/dist/frame-perf-CHpWhbC4.js +111 -0
  51. package/dist/{create-terminal-DBFNYr8f.js → hyperlink-_1FAj7Wq.js} +440 -13
  52. package/dist/index.cjs +5017 -10339
  53. package/dist/index.js +14 -13
  54. package/dist/{linkify-D_gzn9Xq.js → linkify-D68T7rdW.js} +193 -3
  55. package/dist/markdown.cjs +21295 -12691
  56. package/dist/markdown.d.cts +1 -1
  57. package/dist/markdown.d.ts +1 -1
  58. package/dist/markdown.js +211 -51
  59. package/dist/mermaid-BNhM1jAZ.js +123 -0
  60. package/dist/mermaid.cjs +1707 -0
  61. package/dist/mermaid.d.cts +3 -0
  62. package/dist/mermaid.d.ts +3 -0
  63. package/dist/mermaid.js +6 -0
  64. package/dist/observability/frame-perf-store.d.ts +2 -1
  65. package/dist/observability/frame-perf.d.ts +33 -0
  66. package/dist/observability.cjs +106 -107
  67. package/dist/observability.d.cts +2 -2
  68. package/dist/observability.d.ts +2 -2
  69. package/dist/observability.js +3 -3
  70. package/dist/{wheel-scroll-vBRaQ7p-.js → rect-DUpeDfBg.js} +253 -117
  71. package/dist/renderer/cli/stdout-metrics.d.ts +10 -0
  72. package/dist/renderer/cli/stdout-renderer.d.ts +3 -0
  73. package/dist/renderer/terminal-graphic-render-queue.d.ts +50 -0
  74. package/dist/renderer/terminal-graphics-trace.d.ts +53 -0
  75. package/dist/renderer/terminal-graphics.d.ts +147 -0
  76. package/dist/renderer-dom.cjs +364 -903
  77. package/dist/renderer-dom.js +4 -5
  78. package/dist/runtime/index.d.ts +2 -0
  79. package/dist/{runtime-rfcZCyJq.js → runtime-Byf8XXOT.js} +28 -15
  80. package/dist/runtime.cjs +427 -889
  81. package/dist/runtime.js +2 -2
  82. package/dist/terminal-graphics-Bbe83wSr.js +597 -0
  83. package/dist/{terminal-selection-DBinO6p5.js → terminal-selection-4W1SJj4c.js} +4 -1
  84. package/dist/{tlog-theme-CvLFNMwk.js → tlog-theme-Bul2Na3u.js} +1237 -12
  85. package/dist/{trace-CjzYeIxN.js → trace-Bh8WnoMo.js} +5 -0
  86. package/dist/vue/agent/create-png-terminal-graphic-renderer.d.ts +19 -0
  87. package/dist/vue/components/T3DViewport.d.ts +473 -0
  88. package/dist/vue/components/TAgentTerminalGraphic.d.ts +494 -0
  89. package/dist/vue/components/TCharts.d.ts +1121 -0
  90. package/dist/vue/components/TFeedback.d.ts +1 -1
  91. package/dist/vue/components/TFlex.d.ts +389 -0
  92. package/dist/vue/components/TForm.d.ts +4 -4
  93. package/dist/vue/components/TLogSearchBar.d.ts +3 -3
  94. package/dist/vue/components/TLogSearchPager.d.ts +2 -2
  95. package/dist/vue/components/TMarkdownText.d.ts +162 -4
  96. package/dist/vue/components/TMermaidText.d.ts +900 -0
  97. package/dist/vue/components/TVideo.d.ts +291 -0
  98. package/dist/vue/components/TVirtualList.d.ts +9 -0
  99. package/dist/vue/components/TVirtualMarkdown.d.ts +170 -9
  100. package/dist/vue/components/TVirtualRows.d.ts +9 -0
  101. package/dist/vue/components/TerminalProvider.d.ts +2 -0
  102. package/dist/vue/context.d.ts +24 -0
  103. package/dist/vue/index.d.ts +5 -0
  104. package/dist/vue/layout/flex.d.ts +67 -0
  105. package/dist/vue/markdown/ast.d.ts +5 -2
  106. package/dist/vue/markdown/document.d.ts +5 -0
  107. package/dist/vue/markdown/image-actions.d.ts +14 -0
  108. package/dist/vue/markdown/image.d.ts +11 -0
  109. package/dist/vue/markdown/link-actions.d.ts +14 -0
  110. package/dist/vue/markdown/math-actions.d.ts +14 -0
  111. package/dist/vue/markdown/math.d.ts +6 -0
  112. package/dist/vue/markdown/render.d.ts +28 -0
  113. package/dist/vue/markdown/types.d.ts +78 -0
  114. package/dist/vue/mermaid/beautiful-mermaid.d.ts +1436 -0
  115. package/dist/vue/render/render-manager.d.ts +7 -0
  116. package/dist/vue/video/types.d.ts +39 -0
  117. package/dist/vue.cjs +7207 -12437
  118. package/dist/vue.js +704 -38
  119. package/dist/wheel-scroll-DASkEZr-.js +106 -0
  120. package/dist/{hyperlink-Bn02UXJb.js → width-GqllnV8C.js} +166 -111
  121. package/package.json +119 -14
  122. package/dist/frame-perf-C6Xfg85O.js +0 -24
  123. package/dist/sgr-BmzxEjAO.js +0 -304
  124. /package/dist/{ansi-palette-CNXqFciC.js → ansi-palette-CH6jc2Z7.js} +0 -0
  125. /package/dist/{path-suggest-BNqcuE3-.js → path-suggest-Dndu4dTi.js} +0 -0
@@ -1,7 +1,7 @@
1
- import { getPlaneTerminal } from "./create-terminal-DBFNYr8f.js";
2
- import { charCellWidth, hasEncodedControl } from "./hyperlink-Bn02UXJb.js";
3
- import { DialogContextKey, EventZIndexContextKey, ImeAnchorContextKey, LayoutContextKey, RenderPlaneContextKey, RenderStackKey, TInputPluginsContextKey, TerminalContextKey, forEachTextCellSegment, graphemeRangeAt, hasTextWidthAsciiFastPath, intersectRect, padEndByCells$1 as padEndByCells, repeatChar, sanitizeInlineText, sanitizeTextBlock, sliceByCells, sliceByCellsRange, spaces, textCellWidth$1 as textCellWidth, translateRect, useLayout, useRenderNode, useRenderStack, useTerminal, useTerminalNode, useVisibility, withTextWidthProvider, wrapByCells } from "./wheel-scroll-vBRaQ7p-.js";
4
- import { TView } from "./linkify-D_gzn9Xq.js";
1
+ import { getPlaneTerminal, hasEncodedControl } from "./hyperlink-_1FAj7Wq.js";
2
+ import { charCellWidth } from "./width-GqllnV8C.js";
3
+ import { DialogContextKey, EventZIndexContextKey, ImeAnchorContextKey, LayoutContextKey, RenderPlaneContextKey, RenderStackKey, TInputPluginsContextKey, TerminalContextKey, forEachTextCellSegment, graphemeRangeAt, hasTextWidthAsciiFastPath, intersectRect, repeatChar, sanitizeInlineText, sanitizeTextBlock, sliceByCells, spaces, textCellWidth$1 as textCellWidth, translateRect, useLayout, useRenderNode, useRenderStack, useTerminal, useTerminalNode, useVisibility, withTextWidthProvider } from "./rect-DUpeDfBg.js";
4
+ import { TText, TView, mergeStyle } from "./linkify-D68T7rdW.js";
5
5
  import { isAbsolutePath, normalizeNewlines, normalizePath, resolvePath } from "./path-mnSgEpCm.js";
6
6
  import { computed, defineComponent, h, inject, nextTick, onBeforeUnmount, onMounted, provide, ref, shallowReactive, shallowRef, watch, watchEffect } from "vue";
7
7
 
@@ -204,7 +204,7 @@ const TBox = defineComponent({
204
204
  const max = Math.max(0, w - 4);
205
205
  const safe = sanitizeInlineText(props.title);
206
206
  const title = sliceByCells(safe, max);
207
- const ts = titleStyle ?? (style.bg ? { bg: style.bg } : {});
207
+ const ts = titleStyle ?? style;
208
208
  terminal.write(` ${title} `, {
209
209
  x: x0 + 1,
210
210
  y: y0,
@@ -332,7 +332,7 @@ const TBox = defineComponent({
332
332
 
333
333
  //#endregion
334
334
  //#region src/vue/overlay.ts
335
- function clamp$5(n, min, max) {
335
+ function clamp$4(n, min, max) {
336
336
  return Math.max(min, Math.min(max, n));
337
337
  }
338
338
  function cellCount(value) {
@@ -439,8 +439,8 @@ function resolveOverlayPlacement(opts) {
439
439
  x,
440
440
  y
441
441
  } : {
442
- x: clamp$5(x, 0, maxX),
443
- y: clamp$5(y, 0, maxY)
442
+ x: clamp$4(x, 0, maxX),
443
+ y: clamp$4(y, 0, maxY)
444
444
  };
445
445
  }
446
446
  function createOverlayFocusStack() {
@@ -461,170 +461,9 @@ function createOverlayFocusStack() {
461
461
  };
462
462
  }
463
463
 
464
- //#endregion
465
- //#region src/vue/components/TText.ts
466
- function fitText(text, max) {
467
- if (max <= 0) return "";
468
- text = sanitizeInlineText(text);
469
- return sliceByCells(text, max);
470
- }
471
- function splitLines(text) {
472
- return sanitizeTextBlock(text).split("\n");
473
- }
474
- function computeDefaultWidth(text) {
475
- const lines = splitLines(text);
476
- let max = 0;
477
- for (const line of lines) max = Math.max(max, textCellWidth(line));
478
- return max;
479
- }
480
- const TText = defineComponent({
481
- name: "TText",
482
- props: {
483
- x: {
484
- type: Number,
485
- required: true
486
- },
487
- y: {
488
- type: Number,
489
- required: true
490
- },
491
- zIndex: {
492
- type: Number,
493
- default: 0
494
- },
495
- value: {
496
- type: String,
497
- required: true
498
- },
499
- w: {
500
- type: Number,
501
- default: void 0
502
- },
503
- h: {
504
- type: Number,
505
- default: void 0
506
- },
507
- style: {
508
- type: Object,
509
- default: void 0
510
- },
511
- clear: {
512
- type: Boolean,
513
- default: true
514
- },
515
- wrap: {
516
- type: Boolean,
517
- default: false
518
- },
519
- depsKey: {
520
- type: null,
521
- default: void 0
522
- }
523
- },
524
- setup(props) {
525
- const { terminal, defaultStyle } = useTerminal();
526
- const layout = useLayout();
527
- const { visible, rootProps } = useVisibility();
528
- const defaultWidth = computed(() => computeDefaultWidth(props.value));
529
- const lines = computed(() => {
530
- const w = props.w ?? defaultWidth.value;
531
- if (w <= 0) return [""];
532
- if (!props.wrap) return splitLines(props.value).map((l) => fitText(l, w));
533
- const safe = sanitizeTextBlock(props.value);
534
- return wrapByCells(safe, w).map((l) => fitText(l, w));
535
- });
536
- const absRect = computed(() => {
537
- const width = props.w ?? defaultWidth.value;
538
- const height = props.h ?? (props.wrap ? lines.value.length || 1 : lines.value.length || 1);
539
- const raw = {
540
- x: props.x,
541
- y: props.y,
542
- w: width,
543
- h: height
544
- };
545
- const translated = translateRect(raw, layout.originX, layout.originY);
546
- if (!layout.clipRect) return translated;
547
- return intersectRect(translated, layout.clipRect) ?? {
548
- x: 0,
549
- y: 0,
550
- w: 0,
551
- h: 0
552
- };
553
- });
554
- const fullRect = computed(() => {
555
- const width = props.w ?? defaultWidth.value;
556
- const height = props.h ?? (props.wrap ? lines.value.length || 1 : lines.value.length || 1);
557
- return translateRect({
558
- x: props.x,
559
- y: props.y,
560
- w: width,
561
- h: height
562
- }, layout.originX, layout.originY);
563
- });
564
- useRenderNode(() => ({
565
- zIndex: props.zIndex,
566
- rect: visible.value ? absRect.value : {
567
- x: 0,
568
- y: 0,
569
- w: 0,
570
- h: 0
571
- },
572
- deps: [
573
- visible.value,
574
- absRect.value,
575
- fullRect.value,
576
- props.value,
577
- props.w,
578
- props.h,
579
- props.wrap,
580
- props.style,
581
- defaultStyle.value,
582
- props.depsKey
583
- ],
584
- paint: (dirtyRows) => {
585
- if (!visible.value) return;
586
- const r = absRect.value;
587
- if (r.w <= 0 || r.h <= 0) return;
588
- const full = fullRect.value;
589
- const style = props.style ?? defaultStyle.value;
590
- const blank = props.clear ? spaces(r.w) : "";
591
- const out = lines.value;
592
- const dx = Math.max(0, Math.floor(r.x - full.x));
593
- const fullY = Math.floor(full.y);
594
- const paintRow = (y) => {
595
- const relY = y - r.y;
596
- if (relY < 0 || relY >= r.h) return;
597
- const i = y - fullY;
598
- if (i < 0 || i >= out.length) {
599
- if (props.clear) terminal.write(blank, {
600
- x: r.x,
601
- y,
602
- style
603
- });
604
- return;
605
- }
606
- const src = out[i] ?? "";
607
- const clipped = dx > 0 ? sliceByCellsRange(src, dx, dx + r.w) : sliceByCells(src, r.w);
608
- terminal.write(padEndByCells(clipped, r.w), {
609
- x: r.x,
610
- y,
611
- style
612
- });
613
- };
614
- if (!dirtyRows) {
615
- for (let i = 0; i < r.h; i++) paintRow(r.y + i);
616
- return;
617
- }
618
- for (const y of dirtyRows) paintRow(y);
619
- }
620
- }));
621
- return () => h("span", rootProps);
622
- }
623
- });
624
-
625
464
  //#endregion
626
465
  //#region src/vue/components/TDialog.ts
627
- function clamp$4(n, min, max) {
466
+ function clamp$3(n, min, max) {
628
467
  return Math.max(min, Math.min(max, n));
629
468
  }
630
469
  function computePosition(opts) {
@@ -824,7 +663,7 @@ const DialogSurface = defineComponent({
824
663
  }
825
664
  },
826
665
  setup(props) {
827
- const { events, scheduler } = useTerminal();
666
+ const { events, scheduler, defaultStyle } = useTerminal();
828
667
  const layout = useLayout();
829
668
  const cols = computed(() => layout.clipRect?.w ?? 0);
830
669
  const rows = computed(() => layout.clipRect?.h ?? 0);
@@ -1091,7 +930,15 @@ const DialogSurface = defineComponent({
1091
930
  padding: props.padding,
1092
931
  border: true
1093
932
  });
1094
- const contentStyle = props.contentStyle ?? props.style;
933
+ const dialogStyle = props.style && props.style.bg == null && defaultStyle.value.bg != null ? {
934
+ ...props.style,
935
+ bg: defaultStyle.value.bg
936
+ } : props.style;
937
+ const rawContentStyle = props.contentStyle ?? dialogStyle;
938
+ const contentStyle = rawContentStyle && rawContentStyle.bg == null && defaultStyle.value.bg != null ? {
939
+ ...rawContentStyle,
940
+ bg: defaultStyle.value.bg
941
+ } : rawContentStyle;
1095
942
  const dialogBox = h(TView, {
1096
943
  x,
1097
944
  y,
@@ -1116,7 +963,7 @@ const DialogSurface = defineComponent({
1116
963
  clear: true,
1117
964
  title: props.title,
1118
965
  padding: props.padding,
1119
- style: props.style,
966
+ style: dialogStyle,
1120
967
  titleStyle: props.titleStyle
1121
968
  }, () => [h(TText, {
1122
969
  x: 0,
@@ -1244,7 +1091,7 @@ const TDialog = defineComponent({
1244
1091
  "confirm"
1245
1092
  ],
1246
1093
  setup(props, { emit, slots }) {
1247
- const { runtime, events, scheduler } = useTerminal();
1094
+ const { runtime, events, scheduler, defaultStyle } = useTerminal();
1248
1095
  const layout = useLayout();
1249
1096
  const cols = computed(() => layout.clipRect?.w ?? 0);
1250
1097
  const rows = computed(() => layout.clipRect?.h ?? 0);
@@ -1425,7 +1272,7 @@ const TDialog = defineComponent({
1425
1272
  const isDanger = b.kind === "danger";
1426
1273
  const isAccent = b.kind === "accent";
1427
1274
  const isMuted = b.kind === "muted";
1428
- const baseBg = b.style?.bg ?? props.contentStyle?.bg ?? props.style?.bg;
1275
+ const baseBg = b.style?.bg ?? props.contentStyle?.bg ?? props.style?.bg ?? defaultStyle.value.bg;
1429
1276
  const variantStyle = b.style ?? (isPrimary ? { bold: true } : isDanger ? { bold: true } : isAccent ? { underline: true } : isMuted ? { dim: true } : {});
1430
1277
  const style = {
1431
1278
  ...variantStyle,
@@ -1547,7 +1394,7 @@ const TDialog = defineComponent({
1547
1394
  }
1548
1395
  watch(() => props.modelValue, (next, prev) => {
1549
1396
  if (next && !prev) captureRestoreFocus();
1550
- if (next && !prev) selectedButtonIndex.value = clamp$4(defaultButtonIndex(), 0, Math.max(0, props.buttons.length - 1));
1397
+ if (next && !prev) selectedButtonIndex.value = clamp$3(defaultButtonIndex(), 0, Math.max(0, props.buttons.length - 1));
1551
1398
  if (!prev || next) return;
1552
1399
  const closeAlreadyEmitted = skipNextCloseEmit.value;
1553
1400
  skipNextCloseEmit.value = false;
@@ -1848,7 +1695,7 @@ function mentionChipStyle(baseStyle, _absPath, _fsKind) {
1848
1695
 
1849
1696
  //#endregion
1850
1697
  //#region src/vue/components/input/utils/inlineText.ts
1851
- function clamp$3(n, min, max) {
1698
+ function clamp$2(n, min, max) {
1852
1699
  return Math.max(min, Math.min(max, n));
1853
1700
  }
1854
1701
  function isAscii(text) {
@@ -1856,7 +1703,7 @@ function isAscii(text) {
1856
1703
  return true;
1857
1704
  }
1858
1705
  const textCellWidth$1 = textCellWidth;
1859
- function padEndByCells$1(text, width) {
1706
+ function padEndByCells(text, width) {
1860
1707
  const cells = textCellWidth$1(text);
1861
1708
  if (cells >= width) return text;
1862
1709
  return text + spaces(width - cells);
@@ -1910,7 +1757,7 @@ function mentionLabelAt(mentions, mentionIndex) {
1910
1757
  }
1911
1758
  function countTokens(value, token, endIndex = value.length) {
1912
1759
  let count = 0;
1913
- const limit = clamp$3(endIndex, 0, value.length);
1760
+ const limit = clamp$2(endIndex, 0, value.length);
1914
1761
  for (let i = 0; i < limit; i++) if (value[i] === token) count++;
1915
1762
  return count;
1916
1763
  }
@@ -1925,8 +1772,8 @@ function nextInlineBoundary(value, multilineToken, mentionToken, start, end) {
1925
1772
  return next;
1926
1773
  }
1927
1774
  function forEachInlineUnit(value, multilineToken, mentionToken, multilineTexts, mentions, start, end, cb) {
1928
- const safeStart = clamp$3(start, 0, value.length);
1929
- const safeEnd = clamp$3(end, safeStart, value.length);
1775
+ const safeStart = clamp$2(start, 0, value.length);
1776
+ const safeEnd = clamp$2(end, safeStart, value.length);
1930
1777
  let tokenIndex = countMultilineTokens$1(value, multilineToken, safeStart);
1931
1778
  let mentionIndex = countMentionTokens$1(value, mentionToken, safeStart);
1932
1779
  for (let i = safeStart; i < safeEnd;) {
@@ -2009,8 +1856,8 @@ function mentionIndexAt$1(value, mentionToken, index) {
2009
1856
  return countMentionTokens$1(value, mentionToken, index);
2010
1857
  }
2011
1858
  function textCellWidthInline(value, multilineToken, mentionToken, multilineTexts, mentions, start, end) {
2012
- const safeStart = clamp$3(start, 0, value.length);
2013
- const safeEnd = clamp$3(end, safeStart, value.length);
1859
+ const safeStart = clamp$2(start, 0, value.length);
1860
+ const safeEnd = clamp$2(end, safeStart, value.length);
2014
1861
  let cells = 0;
2015
1862
  forEachInlineUnit(value, multilineToken, mentionToken, multilineTexts, mentions, 0, safeEnd, (unit) => {
2016
1863
  if (unit.end > safeStart) cells += unit.cells;
@@ -2118,7 +1965,7 @@ function wrapToLinesFirstWidthInline$1(value, multilineToken, mentionToken, mult
2118
1965
  }];
2119
1966
  }
2120
1967
  function indexToWrappedCellColFirstWidthInline$1(value, multilineToken, mentionToken, multilineTexts, mentions, index, firstWidth, width) {
2121
- const safe = clamp$3(index, 0, value.length);
1968
+ const safe = clamp$2(index, 0, value.length);
2122
1969
  const lines = wrapToLinesFirstWidthInline$1(value, multilineToken, mentionToken, multilineTexts, mentions, firstWidth, width);
2123
1970
  for (let i = 0; i < lines.length; i++) {
2124
1971
  const info = lines[i];
@@ -2139,7 +1986,7 @@ function indexToWrappedCellColFirstWidthInline$1(value, multilineToken, mentionT
2139
1986
  };
2140
1987
  }
2141
1988
  function indexToLineCellColInline$1(value, multilineToken, mentionToken, multilineTexts, mentions, index) {
2142
- const safe = clamp$3(index, 0, value.length);
1989
+ const safe = clamp$2(index, 0, value.length);
2143
1990
  const lines = computeLines$1(value);
2144
1991
  for (let i = 0; i < lines.length; i++) {
2145
1992
  const info = lines[i];
@@ -2315,7 +2162,7 @@ function buildInlineSelectionSegments(value, displayValue, multilineTexts, menti
2315
2162
 
2316
2163
  //#endregion
2317
2164
  //#region src/vue/components/input/utils/primitives.ts
2318
- function clamp$2(n, min, max) {
2165
+ function clamp$1(n, min, max) {
2319
2166
  return Math.max(min, Math.min(max, n));
2320
2167
  }
2321
2168
  function isWhitespace(ch) {
@@ -2328,7 +2175,7 @@ function isWordChar(ch) {
2328
2175
  //#endregion
2329
2176
  //#region src/vue/components/input/utils/wordNavigation.ts
2330
2177
  function findWordLeft(text, index) {
2331
- let i = clamp$2(index, 0, text.length);
2178
+ let i = clamp$1(index, 0, text.length);
2332
2179
  if (i === 0) return 0;
2333
2180
  while (i > 0 && isWhitespace(text[i - 1])) i--;
2334
2181
  if (i === 0) return 0;
@@ -2342,7 +2189,7 @@ function findWordLeft(text, index) {
2342
2189
  return i;
2343
2190
  }
2344
2191
  function findWordRight(text, index) {
2345
- let i = clamp$2(index, 0, text.length);
2192
+ let i = clamp$1(index, 0, text.length);
2346
2193
  if (i >= text.length) return text.length;
2347
2194
  while (i < text.length && isWhitespace(text[i])) i++;
2348
2195
  if (i >= text.length) return text.length;
@@ -2357,7 +2204,7 @@ function findWordRight(text, index) {
2357
2204
  }
2358
2205
  function tokenRangeAt(value, index) {
2359
2206
  if (!value) return null;
2360
- let i = clamp$2(index, 0, value.length);
2207
+ let i = clamp$1(index, 0, value.length);
2361
2208
  if (i === value.length) i = value.length - 1;
2362
2209
  if (i < 0) return null;
2363
2210
  const ch0 = value[i];
@@ -2406,7 +2253,7 @@ function computeLines(value) {
2406
2253
  return computeLines$1(value);
2407
2254
  }
2408
2255
  function indexToLineCellCol(value, index) {
2409
- const safe = clamp$2(index, 0, value.length);
2256
+ const safe = clamp$1(index, 0, value.length);
2410
2257
  const lines = computeLines(value);
2411
2258
  for (let i = 0; i < lines.length; i++) {
2412
2259
  const info = lines[i];
@@ -2670,7 +2517,7 @@ const TInput = defineComponent({
2670
2517
  function measureContent(r) {
2671
2518
  const wAll = Math.max(0, Math.floor(r.w));
2672
2519
  const hAll = Math.max(0, Math.floor(r.h));
2673
- const padX = clamp$2(PADDING_X, 0, Math.floor(wAll / 2));
2520
+ const padX = clamp$1(PADDING_X, 0, Math.floor(wAll / 2));
2674
2521
  const w = Math.max(0, wAll - padX * 2);
2675
2522
  return {
2676
2523
  wAll,
@@ -2772,8 +2619,8 @@ const TInput = defineComponent({
2772
2619
  cursor.value = nextLen;
2773
2620
  anchor.value = null;
2774
2621
  } else {
2775
- cursor.value = clamp$2(cursor.value, 0, nextLen);
2776
- if (anchor.value != null) anchor.value = clamp$2(anchor.value, 0, nextLen);
2622
+ cursor.value = clamp$1(cursor.value, 0, nextLen);
2623
+ if (anchor.value != null) anchor.value = clamp$1(anchor.value, 0, nextLen);
2777
2624
  }
2778
2625
  if (composing.value && next !== prev) {
2779
2626
  compositionBlocked.value = true;
@@ -2895,10 +2742,10 @@ const TInput = defineComponent({
2895
2742
  });
2896
2743
  const useCompositionEnd = typeof document !== "undefined";
2897
2744
  function getComposedTextAndCursor(value) {
2898
- const baseCursor = clamp$2(cursor.value, 0, value.length);
2745
+ const baseCursor = clamp$1(cursor.value, 0, value.length);
2899
2746
  if (composing.value && compositionText.value) {
2900
2747
  const text = `${value.slice(0, baseCursor)}${compositionText.value}${value.slice(baseCursor)}`;
2901
- const cursorIndex = useCompositionEnd ? clamp$2(baseCursor + compositionText.value.length, 0, text.length) : baseCursor;
2748
+ const cursorIndex = useCompositionEnd ? clamp$1(baseCursor + compositionText.value.length, 0, text.length) : baseCursor;
2902
2749
  return {
2903
2750
  text,
2904
2751
  cursor: cursorIndex
@@ -2928,9 +2775,9 @@ const TInput = defineComponent({
2928
2775
  else if (col > scrollX.value + viewW - 1) scrollX.value = Math.max(0, col - (viewW - 1));
2929
2776
  }
2930
2777
  const maxTop = Math.max(0, lines.length - height);
2931
- scrollY.value = clamp$2(scrollY.value, 0, maxTop);
2778
+ scrollY.value = clamp$1(scrollY.value, 0, maxTop);
2932
2779
  if (line < scrollY.value) scrollY.value = line;
2933
- else if (line > scrollY.value + height - 1) scrollY.value = clamp$2(line - (height - 1), 0, maxTop);
2780
+ else if (line > scrollY.value + height - 1) scrollY.value = clamp$1(line - (height - 1), 0, maxTop);
2934
2781
  });
2935
2782
  }
2936
2783
  function computeImeAnchorCell() {
@@ -2952,8 +2799,8 @@ const TInput = defineComponent({
2952
2799
  const pos = wrap ? indexToWrappedCellColFirstWidthInline(cursorText, props.multilineTexts, props.mentions, composed.cursor, firstWidth, width) : indexToLineCellColInline(cursorText, props.multilineTexts, props.mentions, composed.cursor);
2953
2800
  const cx0 = pos.col - offX;
2954
2801
  const cy = pos.line - offY;
2955
- const cx = clamp$2(cx0, 0, Math.max(0, width - 1));
2956
- const cyClamped = clamp$2(cy, 0, Math.max(0, r.h - 1));
2802
+ const cx = clamp$1(cx0, 0, Math.max(0, width - 1));
2803
+ const cyClamped = clamp$1(cy, 0, Math.max(0, r.h - 1));
2957
2804
  return {
2958
2805
  cellX: r.x + padX + cx,
2959
2806
  cellY: r.y + cyClamped
@@ -2981,8 +2828,8 @@ const TInput = defineComponent({
2981
2828
  const r = absRect.value;
2982
2829
  const { w: contentW, padX } = measureContent(r);
2983
2830
  const width = Math.max(1, contentW);
2984
- const localX = clamp$2(cellX - (r.x + padX), 0, Math.max(0, contentW - 1));
2985
- const localY = clamp$2(cellY - r.y, 0, Math.max(0, r.h - 1));
2831
+ const localX = clamp$1(cellX - (r.x + padX), 0, Math.max(0, contentW - 1));
2832
+ const localY = clamp$1(cellY - r.y, 0, Math.max(0, r.h - 1));
2986
2833
  const value = getValue();
2987
2834
  const wrap = wrapMode.value;
2988
2835
  const xText = localX;
@@ -2991,14 +2838,14 @@ const TInput = defineComponent({
2991
2838
  let hit = null;
2992
2839
  if (wrap) {
2993
2840
  const lines = wrapToLinesFirstWidthInline(value, props.multilineTexts, props.mentions, firstWidth, width);
2994
- const line = clamp$2(scrollY.value + localY, 0, lines.length - 1);
2841
+ const line = clamp$1(scrollY.value + localY, 0, lines.length - 1);
2995
2842
  const col = xText;
2996
2843
  const hit2 = wrappedCellColToIndexInline(value, props.multilineTexts, props.mentions, lines[line], col);
2997
2844
  next = hit2.index;
2998
2845
  hit = hit2.hit;
2999
2846
  } else {
3000
2847
  const lines = computeLines(value);
3001
- const line = clamp$2(scrollY.value + localY, 0, lines.length - 1);
2848
+ const line = clamp$1(scrollY.value + localY, 0, lines.length - 1);
3002
2849
  const col = scrollX.value + xText;
3003
2850
  const info = lines[line];
3004
2851
  const hit2 = lineCellColToIndexInline(value, props.multilineTexts, props.mentions, info.start, info.end, col);
@@ -3028,7 +2875,7 @@ const TInput = defineComponent({
3028
2875
  }
3029
2876
  function applyEdit(nextValue, nextCursor, commit = false) {
3030
2877
  withInputWidth(() => {
3031
- const c = clamp$2(nextCursor, 0, nextValue.length);
2878
+ const c = clamp$1(nextCursor, 0, nextValue.length);
3032
2879
  cursor.value = c;
3033
2880
  anchor.value = null;
3034
2881
  composing.value = false;
@@ -3058,7 +2905,7 @@ const TInput = defineComponent({
3058
2905
  if (extend) {
3059
2906
  if (anchor.value == null) anchor.value = prev;
3060
2907
  } else anchor.value = null;
3061
- cursor.value = clamp$2(nextCursor, 0, value.length);
2908
+ cursor.value = clamp$1(nextCursor, 0, value.length);
3062
2909
  if (wrapMode.value) {
3063
2910
  const { w: contentW } = measureContent(absRect.value);
3064
2911
  const w = Math.max(1, contentW);
@@ -3962,7 +3809,7 @@ const TInput = defineComponent({
3962
3809
  anchor.value = null;
3963
3810
  }
3964
3811
  hasFocusedOnce.value = true;
3965
- cursor.value = clamp$2(cursor.value, 0, valueLen);
3812
+ cursor.value = clamp$1(cursor.value, 0, valueLen);
3966
3813
  ensureCursorVisible();
3967
3814
  syncImeAnchorNow();
3968
3815
  startBlink();
@@ -4352,8 +4199,8 @@ const TInput = defineComponent({
4352
4199
  const cx0 = pos.col - offX;
4353
4200
  const cy = pos.line - offY;
4354
4201
  if (imeAnchor && focused.value) {
4355
- const cx = clamp$2(cx0, 0, Math.max(0, width - 1));
4356
- const cyClamped = clamp$2(cy, 0, Math.max(0, r.h - 1));
4202
+ const cx = clamp$1(cx0, 0, Math.max(0, width - 1));
4203
+ const cyClamped = clamp$1(cy, 0, Math.max(0, r.h - 1));
4357
4204
  imeAnchor.value = {
4358
4205
  cellX: r.x + padX + cx,
4359
4206
  cellY: r.y + cyClamped,
@@ -4396,35 +4243,6 @@ const TInput = defineComponent({
4396
4243
  }
4397
4244
  });
4398
4245
 
4399
- //#endregion
4400
- //#region src/vue/components/simple-utils.ts
4401
- function clamp$1(n, min, max) {
4402
- return Math.max(min, Math.min(max, n));
4403
- }
4404
- function mergeStyle(...styles) {
4405
- const out = {};
4406
- for (const style of styles) {
4407
- if (!style) continue;
4408
- Object.assign(out, style);
4409
- }
4410
- return out;
4411
- }
4412
- function fitCellText(value, width, align = "left") {
4413
- const w = Math.max(0, Math.floor(width));
4414
- if (w <= 0) return "";
4415
- const text = sliceByCells(sanitizeInlineText(String(value ?? "")), w);
4416
- if (align === "right") {
4417
- const cells = textCellWidth(text);
4418
- return `${" ".repeat(Math.max(0, w - cells))}${text}`;
4419
- }
4420
- return padEndByCells(text, w);
4421
- }
4422
- function repeatToCells(ch, width) {
4423
- const w = Math.max(0, Math.floor(width));
4424
- if (w <= 0) return "";
4425
- return ch.repeat(w);
4426
- }
4427
-
4428
4246
  //#endregion
4429
4247
  //#region src/vue/components/TCommandPalette.ts
4430
4248
  function computeCommandPaletteMatchRanges(text, query) {
@@ -5910,14 +5728,13 @@ const TSelect = defineComponent({
5910
5728
  const optDetailStyle = getOptionDetailStyle(opt);
5911
5729
  const rowDetailStyle = {
5912
5730
  ...rowBase,
5913
- ...optDetailStyle ?? {},
5914
- dim: true
5731
+ dim: true,
5732
+ ...optDetailStyle ?? {}
5915
5733
  };
5916
5734
  const optHighlightDetailStyle = getOptionHighlightDetailStyle(opt);
5917
5735
  const rowHighlightDetailStyle = {
5918
5736
  ...rowHighlightBase,
5919
- ...optHighlightDetailStyle ?? {},
5920
- dim: true
5737
+ ...optHighlightDetailStyle ?? {}
5921
5738
  };
5922
5739
  const optAccentStyle = getOptionAccentStyle(opt);
5923
5740
  const rowAccentStyle = optAccentStyle ? {
@@ -6135,4 +5952,4 @@ const TSelect = defineComponent({
6135
5952
  });
6136
5953
 
6137
5954
  //#endregion
6138
- export { TBox, TCommandPalette, TDialog, TInput, TRenderPlane, TSelect, TText, clamp$1 as clamp, clamp$2 as clamp$1, computeCommandPaletteMatchRanges, createOverlayFocusStack, fitCellText, isCommitMention, isWhitespace, mentionChipStyle, mergeStyle, padEndByCells$1 as padEndByCells, repeatToCells, resolveOverlayPlacement, sliceByCellsWindow, textCellWidth$1 as textCellWidth };
5955
+ export { TBox, TCommandPalette, TDialog, TInput, TRenderPlane, TSelect, clamp$1, computeCommandPaletteMatchRanges, createOverlayFocusStack, isCommitMention, isWhitespace, mentionChipStyle, padEndByCells, resolveOverlayPlacement, sliceByCellsWindow, textCellWidth$1 as textCellWidth };