@simon_he/vue-tui 1.0.2 → 1.1.1

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 (104) hide show
  1. package/README.md +44 -26
  2. package/dist/TMermaidText-CXm_L969.js +885 -0
  3. package/dist/{TSelect-DR0FomSu.js → TSelect-CiyMvwl-.js} +60 -81
  4. package/dist/{TTree-kzhlB5P0.js → TTree-DKGiuIcM.js} +140 -103
  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 +31184 -24907
  10. package/dist/agent.d.cts +11 -1
  11. package/dist/agent.d.ts +11 -1
  12. package/dist/agent.js +1700 -13
  13. package/dist/block-source-5CQp4tF8.js +3230 -0
  14. package/dist/cli/stdin-buffer.d.ts +1 -1
  15. package/dist/cli.cjs +5037 -6767
  16. package/dist/cli.d.cts +4 -0
  17. package/dist/cli.d.ts +4 -0
  18. package/dist/cli.js +2733 -148
  19. package/dist/core/buffer/eaw-ranges-unicode-17.d.ts +14 -0
  20. package/dist/core/perf/instrumentation-noop.d.ts +48 -0
  21. package/dist/core/perf/instrumentation.d.ts +136 -0
  22. package/dist/core/terminal/create-terminal.d.ts +1 -0
  23. package/dist/core.cjs +843 -1469
  24. package/dist/core.js +6 -6
  25. package/dist/{create-terminal-DBFNYr8f.js → create-terminal-DXuZ2fci.js} +39 -13
  26. package/dist/debug-logger-ChY_PXVk.js +74 -0
  27. package/dist/{dom-renderer-BniJSQyX.js → dom-renderer-DNzmg2As.js} +2 -2
  28. package/dist/experimental.cjs +4115 -5928
  29. package/dist/experimental.d.cts +2 -0
  30. package/dist/experimental.d.ts +2 -0
  31. package/dist/experimental.js +1490 -9
  32. package/dist/frame-perf-BBhE-iuS.js +111 -0
  33. package/dist/{sgr-BmzxEjAO.js → hyperlink-B35-O-cW.js} +100 -1
  34. package/dist/index.cjs +5017 -10339
  35. package/dist/index.js +16 -14
  36. package/dist/{linkify-D_gzn9Xq.js → linkify-CuuquMQT.js} +32 -3
  37. package/dist/markdown.cjs +21295 -12691
  38. package/dist/markdown.d.cts +1 -1
  39. package/dist/markdown.d.ts +1 -1
  40. package/dist/markdown.js +211 -51
  41. package/dist/mermaid-CWto52Wk.js +123 -0
  42. package/dist/mermaid.cjs +1707 -0
  43. package/dist/mermaid.d.cts +3 -0
  44. package/dist/mermaid.d.ts +3 -0
  45. package/dist/mermaid.js +6 -0
  46. package/dist/observability/frame-perf-store.d.ts +2 -1
  47. package/dist/observability/frame-perf.d.ts +33 -0
  48. package/dist/observability.cjs +106 -107
  49. package/dist/observability.d.cts +2 -2
  50. package/dist/observability.d.ts +2 -2
  51. package/dist/observability.js +3 -3
  52. package/dist/{path-suggest-BNqcuE3-.js → path-suggest-fPzRsgPv.js} +1 -1
  53. package/dist/{wheel-scroll-vBRaQ7p-.js → rect-Ng-3eKzF.js} +253 -117
  54. package/dist/renderer/cli/stdout-metrics.d.ts +10 -0
  55. package/dist/renderer/cli/stdout-renderer.d.ts +3 -0
  56. package/dist/renderer/terminal-graphic-render-queue.d.ts +50 -0
  57. package/dist/renderer/terminal-graphics-trace.d.ts +53 -0
  58. package/dist/renderer/terminal-graphics.d.ts +146 -0
  59. package/dist/renderer-dom.cjs +364 -903
  60. package/dist/renderer-dom.js +4 -4
  61. package/dist/runtime/index.d.ts +2 -0
  62. package/dist/{runtime-rfcZCyJq.js → runtime-D77C03RM.js} +28 -15
  63. package/dist/runtime.cjs +427 -889
  64. package/dist/runtime.js +2 -2
  65. package/dist/{terminal-selection-DBinO6p5.js → terminal-selection-CQYr--26.js} +4 -1
  66. package/dist/{tlog-theme-CvLFNMwk.js → tlog-theme-CopRt9SC.js} +37 -6
  67. package/dist/{trace-CjzYeIxN.js → trace-CYHDKM1m.js} +5 -0
  68. package/dist/vue/agent/create-png-terminal-graphic-renderer.d.ts +19 -0
  69. package/dist/vue/components/TAgentTerminalGraphic.d.ts +481 -0
  70. package/dist/vue/components/TCharts.d.ts +1121 -0
  71. package/dist/vue/components/TFeedback.d.ts +1 -1
  72. package/dist/vue/components/TFlex.d.ts +389 -0
  73. package/dist/vue/components/TForm.d.ts +4 -4
  74. package/dist/vue/components/TLogSearchBar.d.ts +3 -3
  75. package/dist/vue/components/TLogSearchPager.d.ts +2 -2
  76. package/dist/vue/components/TMarkdownText.d.ts +162 -4
  77. package/dist/vue/components/TMermaidText.d.ts +900 -0
  78. package/dist/vue/components/TVirtualList.d.ts +9 -0
  79. package/dist/vue/components/TVirtualMarkdown.d.ts +170 -9
  80. package/dist/vue/components/TVirtualRows.d.ts +9 -0
  81. package/dist/vue/components/TerminalProvider.d.ts +2 -0
  82. package/dist/vue/context.d.ts +24 -0
  83. package/dist/vue/index.d.ts +5 -0
  84. package/dist/vue/layout/flex.d.ts +67 -0
  85. package/dist/vue/markdown/ast.d.ts +5 -2
  86. package/dist/vue/markdown/document.d.ts +5 -0
  87. package/dist/vue/markdown/image-actions.d.ts +14 -0
  88. package/dist/vue/markdown/image.d.ts +11 -0
  89. package/dist/vue/markdown/link-actions.d.ts +14 -0
  90. package/dist/vue/markdown/math-actions.d.ts +14 -0
  91. package/dist/vue/markdown/math.d.ts +6 -0
  92. package/dist/vue/markdown/render.d.ts +28 -0
  93. package/dist/vue/markdown/types.d.ts +78 -0
  94. package/dist/vue/mermaid/beautiful-mermaid.d.ts +1436 -0
  95. package/dist/vue/render/render-manager.d.ts +7 -0
  96. package/dist/vue.cjs +7207 -12437
  97. package/dist/vue.js +706 -39
  98. package/dist/wheel-scroll-CQ22Hcyj.js +106 -0
  99. package/dist/{hyperlink-Bn02UXJb.js → width-GqllnV8C.js} +166 -111
  100. package/package.json +85 -14
  101. package/dist/block-source-CKUOnkgT.js +0 -1663
  102. package/dist/frame-perf-C6Xfg85O.js +0 -24
  103. /package/dist/{env-Cl8qmNFN.js → env-DNCzvX8b.js} +0 -0
  104. /package/dist/{path-mnSgEpCm.js → path-BI9W15Zt.js} +0 -0
@@ -0,0 +1,106 @@
1
+ //#region src/vue/utils/wheel-scroll.ts
2
+ const LINE_UNIT_THRESHOLD = 3;
3
+ const PIXELS_PER_LINE = 16;
4
+ const ACCEL_WINDOW_MS = 120;
5
+ const MAX_ACCEL = 26;
6
+ const EDGE_BOUNCE_MS = 120;
7
+ function clamp(n, min, max) {
8
+ return Math.max(min, Math.min(max, n));
9
+ }
10
+ function isLineUnitDelta(deltaY, mode = "auto") {
11
+ if (mode === "line") return true;
12
+ if (mode === "pixel") return false;
13
+ const abs = Math.abs(deltaY);
14
+ return abs > 0 && abs <= LINE_UNIT_THRESHOLD && Number.isInteger(deltaY);
15
+ }
16
+ function normalizeDelta(deltaY, mode = "auto") {
17
+ if (mode === "line") return deltaY;
18
+ if (mode === "pixel") return deltaY / PIXELS_PER_LINE;
19
+ const abs = Math.abs(deltaY);
20
+ if (abs <= LINE_UNIT_THRESHOLD && Number.isInteger(deltaY)) return deltaY;
21
+ return deltaY / PIXELS_PER_LINE;
22
+ }
23
+ function accelFactor(now, lastAt, maxAccel = MAX_ACCEL) {
24
+ const dt = now - lastAt;
25
+ if (!Number.isFinite(dt) || dt <= 0 || dt > ACCEL_WINDOW_MS) return 1;
26
+ const t = 1 - dt / ACCEL_WINDOW_MS;
27
+ return 1 + t * (maxAccel - 1);
28
+ }
29
+ function createWheelScrollState() {
30
+ return {
31
+ accumulator: 0,
32
+ lastAt: 0,
33
+ lastEdgeDir: 0,
34
+ lastEdgeAt: 0
35
+ };
36
+ }
37
+ function resetWheelScrollState(state) {
38
+ state.accumulator = 0;
39
+ state.lastAt = 0;
40
+ state.lastEdgeDir = 0;
41
+ state.lastEdgeAt = 0;
42
+ }
43
+ function applyWheelScroll(state, deltaY, scrollTop, maxTop, now = Date.now(), deltaMode = "auto", options = {}) {
44
+ if (!Number.isFinite(deltaY) || deltaY === 0 || maxTop <= 0) {
45
+ if (maxTop <= 0) {
46
+ state.accumulator = 0;
47
+ state.lastEdgeDir = 0;
48
+ state.lastEdgeAt = 0;
49
+ }
50
+ return {
51
+ nextTop: scrollTop,
52
+ dir: 0,
53
+ lines: 0
54
+ };
55
+ }
56
+ const lineUnits = isLineUnitDelta(deltaY, deltaMode);
57
+ const normalizedDelta = normalizeDelta(deltaY, deltaMode);
58
+ const accel = options.disableAcceleration ? 1 : lineUnits ? 1 : state.lastAt ? accelFactor(now, state.lastAt) : 1;
59
+ state.lastAt = now;
60
+ state.accumulator += normalizedDelta * accel;
61
+ const lines = Math.trunc(state.accumulator);
62
+ if (lines === 0) return {
63
+ nextTop: scrollTop,
64
+ dir: 0,
65
+ lines: 0
66
+ };
67
+ state.accumulator -= lines;
68
+ const dir = lines > 0 ? 1 : -1;
69
+ const atTop = scrollTop <= 0;
70
+ const atBottom = scrollTop >= maxTop;
71
+ if (dir < 0 && atTop || dir > 0 && atBottom) {
72
+ state.lastEdgeDir = dir;
73
+ state.lastEdgeAt = now;
74
+ state.accumulator = 0;
75
+ return {
76
+ nextTop: scrollTop,
77
+ dir: 0,
78
+ lines: 0
79
+ };
80
+ }
81
+ if (state.lastEdgeDir !== 0 && now - state.lastEdgeAt < EDGE_BOUNCE_MS && dir === -state.lastEdgeDir && (atTop || atBottom)) return {
82
+ nextTop: scrollTop,
83
+ dir: 0,
84
+ lines: 0
85
+ };
86
+ const unclamped = scrollTop + lines;
87
+ const nextTop = clamp(unclamped, 0, maxTop);
88
+ if (nextTop === scrollTop) {
89
+ state.accumulator = 0;
90
+ return {
91
+ nextTop: scrollTop,
92
+ dir: 0,
93
+ lines: 0
94
+ };
95
+ }
96
+ if (nextTop !== unclamped) state.accumulator = 0;
97
+ state.lastEdgeDir = 0;
98
+ return {
99
+ nextTop,
100
+ dir: nextTop > scrollTop ? 1 : -1,
101
+ lines: nextTop - scrollTop
102
+ };
103
+ }
104
+
105
+ //#endregion
106
+ export { applyWheelScroll, createWheelScrollState, resetWheelScrollState };
@@ -86,17 +86,131 @@ function segmentedGraphemes(text) {
86
86
  }
87
87
 
88
88
  //#endregion
89
- //#region src/core/buffer/width.ts
89
+ //#region src/core/buffer/eaw-ranges-unicode-17.ts
90
90
  const fullWidthRanges = [
91
91
  [4352, 4447],
92
+ [8986, 8987],
92
93
  [9001, 9002],
93
- [11904, 42191],
94
+ [9193, 9196],
95
+ [9200, 9200],
96
+ [9203, 9203],
97
+ [9725, 9726],
98
+ [9748, 9749],
99
+ [9776, 9783],
100
+ [9800, 9811],
101
+ [9855, 9855],
102
+ [9866, 9871],
103
+ [9875, 9875],
104
+ [9889, 9889],
105
+ [9898, 9899],
106
+ [9917, 9918],
107
+ [9924, 9925],
108
+ [9934, 9934],
109
+ [9940, 9940],
110
+ [9962, 9962],
111
+ [9970, 9971],
112
+ [9973, 9973],
113
+ [9978, 9978],
114
+ [9981, 9981],
115
+ [9989, 9989],
116
+ [9994, 9995],
117
+ [10024, 10024],
118
+ [10060, 10060],
119
+ [10062, 10062],
120
+ [10067, 10069],
121
+ [10071, 10071],
122
+ [10133, 10135],
123
+ [10160, 10160],
124
+ [10175, 10175],
125
+ [11035, 11036],
126
+ [11088, 11088],
127
+ [11093, 11093],
128
+ [11904, 11929],
129
+ [11931, 12019],
130
+ [12032, 12245],
131
+ [12272, 12350],
132
+ [12353, 12438],
133
+ [12441, 12543],
134
+ [12549, 12591],
135
+ [12593, 12686],
136
+ [12688, 12773],
137
+ [12783, 12830],
138
+ [12832, 12871],
139
+ [12880, 42124],
140
+ [42128, 42182],
141
+ [43360, 43388],
94
142
  [44032, 55203],
95
143
  [63744, 64255],
96
144
  [65040, 65049],
97
- [65072, 65135],
98
- [65280, 65376],
99
- [65504, 65510]
145
+ [65072, 65106],
146
+ [65108, 65126],
147
+ [65128, 65131],
148
+ [65281, 65376],
149
+ [65504, 65510],
150
+ [94176, 94180],
151
+ [94192, 94198],
152
+ [94208, 101589],
153
+ [101631, 101662],
154
+ [101760, 101874],
155
+ [110576, 110579],
156
+ [110581, 110587],
157
+ [110589, 110590],
158
+ [110592, 110882],
159
+ [110898, 110898],
160
+ [110928, 110930],
161
+ [110933, 110933],
162
+ [110948, 110951],
163
+ [110960, 111355],
164
+ [119552, 119638],
165
+ [119648, 119670],
166
+ [126980, 126980],
167
+ [127183, 127183],
168
+ [127374, 127374],
169
+ [127377, 127386],
170
+ [127488, 127490],
171
+ [127504, 127547],
172
+ [127552, 127560],
173
+ [127568, 127569],
174
+ [127584, 127589],
175
+ [127744, 127776],
176
+ [127789, 127797],
177
+ [127799, 127868],
178
+ [127870, 127891],
179
+ [127904, 127946],
180
+ [127951, 127955],
181
+ [127968, 127984],
182
+ [127988, 127988],
183
+ [127992, 128062],
184
+ [128064, 128064],
185
+ [128066, 128252],
186
+ [128255, 128317],
187
+ [128331, 128334],
188
+ [128336, 128359],
189
+ [128378, 128378],
190
+ [128405, 128406],
191
+ [128420, 128420],
192
+ [128507, 128591],
193
+ [128640, 128709],
194
+ [128716, 128716],
195
+ [128720, 128722],
196
+ [128725, 128728],
197
+ [128732, 128735],
198
+ [128747, 128748],
199
+ [128756, 128764],
200
+ [128992, 129003],
201
+ [129008, 129008],
202
+ [129292, 129338],
203
+ [129340, 129349],
204
+ [129351, 129535],
205
+ [129648, 129660],
206
+ [129664, 129674],
207
+ [129678, 129734],
208
+ [129736, 129736],
209
+ [129741, 129756],
210
+ [129759, 129770],
211
+ [129775, 129784],
212
+ [131072, 196605],
213
+ [196608, 262141]
100
214
  ];
101
215
  const ambiguousWidthRanges = [
102
216
  [161, 161],
@@ -152,6 +266,7 @@ const ambiguousWidthRanges = [
152
266
  [728, 731],
153
267
  [733, 733],
154
268
  [735, 735],
269
+ [768, 879],
155
270
  [913, 929],
156
271
  [931, 937],
157
272
  [945, 961],
@@ -159,7 +274,8 @@ const ambiguousWidthRanges = [
159
274
  [1025, 1025],
160
275
  [1040, 1103],
161
276
  [1105, 1105],
162
- [8208, 8213],
277
+ [8208, 8208],
278
+ [8211, 8214],
163
279
  [8216, 8217],
164
280
  [8220, 8221],
165
281
  [8224, 8226],
@@ -221,7 +337,8 @@ const ambiguousWidthRanges = [
221
337
  [8895, 8895],
222
338
  [8978, 8978],
223
339
  [9312, 9449],
224
- [9451, 9471],
340
+ [9451, 9547],
341
+ [9552, 9587],
225
342
  [9600, 9615],
226
343
  [9618, 9621],
227
344
  [9632, 9633],
@@ -247,14 +364,40 @@ const ambiguousWidthRanges = [
247
364
  [9831, 9834],
248
365
  [9836, 9837],
249
366
  [9839, 9839],
367
+ [9886, 9887],
368
+ [9919, 9919],
369
+ [9926, 9933],
370
+ [9935, 9939],
371
+ [9941, 9953],
372
+ [9955, 9955],
373
+ [9960, 9961],
374
+ [9963, 9969],
375
+ [9972, 9972],
376
+ [9974, 9977],
377
+ [9979, 9980],
378
+ [9982, 9983],
250
379
  [10045, 10045],
251
380
  [10102, 10111],
252
- [11094, 11094],
381
+ [11094, 11097],
382
+ [12872, 12879],
253
383
  [57344, 63743],
254
- [65533, 65533]
384
+ [65024, 65039],
385
+ [65533, 65533],
386
+ [127232, 127242],
387
+ [127248, 127277],
388
+ [127280, 127337],
389
+ [127344, 127373],
390
+ [127375, 127376],
391
+ [127387, 127404],
392
+ [917760, 917999],
393
+ [983040, 1048573],
394
+ [1048576, 1114109]
255
395
  ];
396
+
397
+ //#endregion
398
+ //#region src/core/buffer/width.ts
256
399
  function isFullWidthCodePoint(codePoint) {
257
- if (codePoint < 4352 || codePoint > 65510) return false;
400
+ if (codePoint < 4352) return false;
258
401
  for (const [start, end] of fullWidthRanges) {
259
402
  if (codePoint < start) return false;
260
403
  if (codePoint <= end) return true;
@@ -262,13 +405,22 @@ function isFullWidthCodePoint(codePoint) {
262
405
  return false;
263
406
  }
264
407
  function isAmbiguousWidthCodePoint(codePoint) {
265
- if (codePoint < 161 || codePoint > 65533) return false;
408
+ const first = ambiguousWidthRanges[0];
409
+ const last = ambiguousWidthRanges[ambiguousWidthRanges.length - 1];
410
+ if (!first || !last) return false;
411
+ if (codePoint < first[0] || codePoint > last[1]) return false;
266
412
  for (const [start, end] of ambiguousWidthRanges) {
267
413
  if (codePoint < start) return false;
268
414
  if (codePoint <= end) return true;
269
415
  }
270
416
  return false;
271
417
  }
418
+ function isVariationSelectorCodePoint(codePoint) {
419
+ return codePoint >= 65024 && codePoint <= 65039 || codePoint >= 917760 && codePoint <= 917999;
420
+ }
421
+ function isCombiningMarkCodePoint(codePoint) {
422
+ return codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071 || codePoint >= 12330 && codePoint <= 12335 || codePoint >= 12441 && codePoint <= 12442 || codePoint === 94180;
423
+ }
272
424
  function isEmojiLike(codePoint) {
273
425
  return codePoint >= 127744 && codePoint <= 129791 || codePoint >= 127462 && codePoint <= 127487;
274
426
  }
@@ -303,6 +455,8 @@ function charCellWidth(text, provider = "default") {
303
455
  const codePoint = text.codePointAt(0);
304
456
  if (codePoint == null) return 1;
305
457
  const hasVs16 = text.includes("️");
458
+ if (isVariationSelectorCodePoint(codePoint) || isCombiningMarkCodePoint(codePoint)) return 1;
459
+ if (codePoint >= 9472 && codePoint <= 9599) return 1;
306
460
  if (isFullWidthCodePoint(codePoint)) return 2;
307
461
  if (provider === "cjk" && isAmbiguousWidthCodePoint(codePoint)) return 2;
308
462
  if (isEmojiLike(codePoint)) return 2;
@@ -317,103 +471,4 @@ function charCellWidth(text, provider = "default") {
317
471
  }
318
472
 
319
473
  //#endregion
320
- //#region src/utils/url-safety.ts
321
- const ENCODED_ASCII_CONTROL_RE = /%(?:0[0-9a-f]|1[0-9a-f]|7f)/i;
322
- function hasControlCodePoint(value) {
323
- for (let i = 0; i < value.length; i++) {
324
- const code = value.charCodeAt(i);
325
- if (code <= 31 || code >= 127 && code <= 159) return true;
326
- }
327
- return false;
328
- }
329
- function hasEncodedControl(value) {
330
- let current = String(value ?? "");
331
- for (let depth = 0; depth < 3; depth++) {
332
- if (ENCODED_ASCII_CONTROL_RE.test(current)) return true;
333
- let decoded;
334
- try {
335
- decoded = decodeURIComponent(current);
336
- } catch {
337
- return true;
338
- }
339
- if (hasControlCodePoint(decoded)) return true;
340
- if (decoded === current) return false;
341
- current = decoded;
342
- }
343
- return ENCODED_ASCII_CONTROL_RE.test(current) || hasControlCodePoint(current);
344
- }
345
-
346
- //#endregion
347
- //#region src/core/hyperlink.ts
348
- const SCHEME_RE = /^[a-z][a-z0-9+.-]*:/i;
349
- const BLOCKED_SCHEME_RE = /^(?:javascript|data|vbscript):/i;
350
- const SAFE_RELATIVE_HREF_RE = /^(?:[A-Za-z0-9._~!$&()*+,;=:@/?#-]|%[0-9A-Fa-f]{2})+$/u;
351
- function normalizeRawHref(value) {
352
- if (typeof value !== "string") return null;
353
- const raw = value.trim();
354
- if (!raw) return null;
355
- if (raw !== value) return null;
356
- for (let i = 0; i < value.length; i++) {
357
- const code = value.charCodeAt(i);
358
- if (code <= 31 || code >= 127 && code <= 159) return null;
359
- }
360
- if (/\s/u.test(raw)) return null;
361
- if (raw.startsWith("//")) return null;
362
- if (BLOCKED_SCHEME_RE.test(raw)) return null;
363
- if (hasEncodedControl(raw)) return null;
364
- return raw;
365
- }
366
- function hrefScheme(raw) {
367
- return raw.match(SCHEME_RE)?.[0].toLowerCase() ?? null;
368
- }
369
- function parseSafeAbsoluteUrl(raw) {
370
- if (raw.includes("\\")) return null;
371
- try {
372
- return new URL(raw);
373
- } catch {
374
- return null;
375
- }
376
- }
377
- function sanitizeAbsoluteHref(raw, options = {}) {
378
- const url = parseSafeAbsoluteUrl(raw);
379
- if (!url) return null;
380
- if (url.protocol === "http:" || url.protocol === "https:") {
381
- if (!/^https?:\/\//i.test(raw)) return null;
382
- return options.preserveHttpHref ? raw : url.toString();
383
- }
384
- if (url.protocol === "mailto:") return raw;
385
- return null;
386
- }
387
- function isSafeNormalizedRelativeHref(raw) {
388
- if (raw.includes("\\")) return false;
389
- if (raw.startsWith("//")) return false;
390
- if (SCHEME_RE.test(raw)) return false;
391
- if (hasEncodedControl(raw)) return false;
392
- if (!SAFE_RELATIVE_HREF_RE.test(raw)) return false;
393
- return raw.startsWith("#") || raw.startsWith("?") || raw.startsWith("/") || raw.startsWith("./") || raw.startsWith("../") || /^[A-Za-z0-9._~-]/u.test(raw);
394
- }
395
- function isSafeRelativeHref(value) {
396
- const raw = normalizeRawHref(value);
397
- return raw != null && isSafeNormalizedRelativeHref(raw);
398
- }
399
- function sanitizeTerminalHref(value, options = {}) {
400
- const raw = normalizeRawHref(value);
401
- if (!raw) return null;
402
- const sanitized = sanitizeAbsoluteHref(raw, { preserveHttpHref: true });
403
- if (sanitized) return sanitized;
404
- if (options.allowFileUrls) {
405
- const url = parseSafeAbsoluteUrl(raw);
406
- if (url?.protocol === "file:") return url.toString();
407
- }
408
- return null;
409
- }
410
- function sanitizeDomHref(value, options = {}) {
411
- const raw = normalizeRawHref(value);
412
- if (!raw) return null;
413
- const scheme = hrefScheme(raw);
414
- if (!scheme) return options.allowRelative !== false && isSafeNormalizedRelativeHref(raw) ? raw : null;
415
- return sanitizeAbsoluteHref(raw);
416
- }
417
-
418
- //#endregion
419
- export { charCellWidth, hasEncodedControl, isSafeRelativeHref, sanitizeDomHref, sanitizeTerminalHref, segmentedGraphemes };
474
+ export { charCellWidth, segmentedGraphemes };
package/package.json CHANGED
@@ -1,13 +1,15 @@
1
1
  {
2
2
  "name": "@simon_he/vue-tui",
3
- "version": "1.0.2",
3
+ "version": "1.1.1",
4
4
  "description": "Vue 3 terminal UI components and renderers for browser DOM, CLI stdout, logs, markdown transcripts, and agent consoles",
5
5
  "keywords": [
6
6
  "agent-console",
7
7
  "agent-ui",
8
+ "ai-agent",
8
9
  "ansi",
9
10
  "ansi-renderer",
10
11
  "browser-terminal",
12
+ "chat-ui",
11
13
  "cli",
12
14
  "cli-ui",
13
15
  "component-library",
@@ -30,6 +32,7 @@
30
32
  "virtual-list",
31
33
  "vue",
32
34
  "vue-cli-ui",
35
+ "vue-component-library",
33
36
  "vue-terminal",
34
37
  "vue-tui",
35
38
  "vue3"
@@ -58,6 +61,9 @@
58
61
  "core": [
59
62
  "./dist/core.d.ts"
60
63
  ],
64
+ "mermaid": [
65
+ "./dist/mermaid.d.ts"
66
+ ],
61
67
  "runtime": [
62
68
  "./dist/runtime.d.ts"
63
69
  ],
@@ -81,6 +87,9 @@
81
87
  ],
82
88
  "agent": [
83
89
  "./dist/agent.d.ts"
90
+ ],
91
+ "agent/mermaid": [
92
+ "./dist/agent/mermaid.d.ts"
84
93
  ]
85
94
  }
86
95
  },
@@ -185,25 +194,47 @@
185
194
  "default": "./dist/agent.cjs"
186
195
  }
187
196
  },
197
+ "./agent/mermaid": {
198
+ "import": {
199
+ "types": "./dist/agent/mermaid.d.ts",
200
+ "default": "./dist/agent/mermaid.js"
201
+ },
202
+ "require": {
203
+ "types": "./dist/agent/mermaid.d.cts",
204
+ "default": "./dist/agent/mermaid.cjs"
205
+ }
206
+ },
207
+ "./mermaid": {
208
+ "import": {
209
+ "types": "./dist/mermaid.d.ts",
210
+ "default": "./dist/mermaid.js"
211
+ },
212
+ "require": {
213
+ "types": "./dist/mermaid.d.cts",
214
+ "default": "./dist/mermaid.cjs"
215
+ }
216
+ },
188
217
  "./package.json": "./package.json"
189
218
  },
190
219
  "publishConfig": {
191
220
  "access": "public"
192
221
  },
193
222
  "dependencies": {
194
- "stream-markdown-parser": "1.0.0"
223
+ "katex": "^0.16.47",
224
+ "stream-markdown-parser": "1.0.7"
195
225
  },
196
226
  "devDependencies": {
197
227
  "@arethetypeswrong/core": "^0.18.3",
198
- "@playwright/test": "^1.60.0",
228
+ "@playwright/test": "^1.61.0",
199
229
  "@types/node": "^18.19.130",
200
- "@vitest/coverage-v8": "^4.1.8",
230
+ "@vitest/coverage-v8": "^4.1.9",
231
+ "beautiful-mermaid": "^1.1.3",
201
232
  "bumpp": "^8.2.1",
202
233
  "esbuild": "^0.20.2",
203
234
  "happy-dom": "^17.6.3",
204
235
  "lint-staged": "^13.3.0",
205
236
  "oxfmt": "^0.47.0",
206
- "oxlint": "^1.67.0",
237
+ "oxlint": "^1.70.0",
207
238
  "picocolors": "^1.1.1",
208
239
  "pinia": "^3.0.4",
209
240
  "publint": "^0.3.21",
@@ -211,14 +242,20 @@
211
242
  "tsdown": "^0.9.9",
212
243
  "tsx": "^4.22.4",
213
244
  "typescript": "^5.9.3",
214
- "vite": "6.4.1",
245
+ "vite": "8.0.16",
215
246
  "vitepress": "^1.6.4",
216
- "vitest": "^4.1.8",
217
- "vue": "^3.5.35"
247
+ "vitest": "^4.1.9",
248
+ "vue": "^3.5.38"
218
249
  },
219
250
  "peerDependencies": {
251
+ "beautiful-mermaid": "^1.1.3",
220
252
  "vue": ">=3.3.0 <4"
221
253
  },
254
+ "peerDependenciesMeta": {
255
+ "beautiful-mermaid": {
256
+ "optional": true
257
+ }
258
+ },
222
259
  "lint-staged": {
223
260
  "*": "oxfmt --write",
224
261
  "*.{vue,js,ts,jsx,tsx}": "oxlint --fix"
@@ -229,16 +266,25 @@
229
266
  "scripts": {
230
267
  "build": "pnpm run build:checked",
231
268
  "build:fast": "pnpm run build:raw",
232
- "build:raw": "rimraf dist && tsdown && node scripts/build-cjs.mjs && tsc -p tsconfig.build.json --emitDeclarationOnly && node scripts/fix-vue-dts-compat.mjs && node scripts/create-cjs-dts.mjs",
269
+ "build:raw": "rimraf dist && node scripts/prepare-build-metafiles.mjs && tsdown && node scripts/build-cjs.mjs && tsc -p tsconfig.build.json --emitDeclarationOnly && node scripts/fix-vue-dts-compat.mjs && node scripts/create-cjs-dts.mjs",
233
270
  "build:checked": "node scripts/run-build-checked.mjs && node scripts/check-build-warnings.mjs .tmp/build.log",
234
271
  "dev": "tsdown --watch",
235
272
  "build:examples": "pnpm run build && pnpm -C examples/basic build",
236
273
  "build:examples:terminal": "pnpm run build && pnpm -C examples/basic build:terminal",
274
+ "showcase": "pnpm -C examples/basic dev",
275
+ "showcase:terminal": "pnpm run build && pnpm -C examples/basic terminal",
237
276
  "example:basic:terminal-table:smoke": "pnpm run build && VT_SMOKE=1 pnpm -C examples/basic terminal:table",
238
277
  "example:agent-console": "pnpm run build && pnpm -C examples/agent-console dev",
239
278
  "example:agent-console:smoke": "pnpm run build && pnpm -C examples/agent-console smoke",
240
279
  "example:agent-console:terminal": "pnpm run build && pnpm -C examples/agent-console terminal",
241
280
  "example:agent-console:terminal:smoke": "pnpm run build && pnpm -C examples/agent-console terminal:smoke",
281
+ "profile:agent-console:cli": "tsx scripts/profile-agent-console-cli.ts",
282
+ "profile:agent-console:browser": "tsx scripts/profile-agent-console-browser.ts",
283
+ "profile:agent-console:summarize": "tsx scripts/summarize-agent-console-profile.ts",
284
+ "profile:agent-console": "tsx scripts/profile-agent-console.ts",
285
+ "profile:agent-console:smoke": "AGENT_CONSOLE_PROFILE_SMOKE=1 pnpm run profile:agent-console",
286
+ "profile:agent-console:abc": "tsx scripts/profile-agent-console-abc.ts",
287
+ "profile:agent-console:abc:smoke": "AGENT_CONSOLE_PROFILE_SMOKE=1 tsx scripts/profile-agent-console-abc.ts",
242
288
  "example:tlog-view-lab": "pnpm run build && VT_SMOKE=1 tsx examples/tlog-view-lab.ts",
243
289
  "run:basic:terminal": "pnpm run build && pnpm -C examples/basic terminal",
244
290
  "run:agent-console:terminal": "pnpm run build && pnpm -C examples/agent-console terminal",
@@ -246,7 +292,13 @@
246
292
  "run:tlog-view-lab": "pnpm run build && VT_INTERACTIVE=1 tsx examples/tlog-view-lab.ts",
247
293
  "run:component:terminal": "tsx scripts/run-component-terminal.ts",
248
294
  "run:component:terminal:list": "tsx scripts/run-component-terminal.ts --list",
295
+ "run:github-contribution-card": "pnpm -C apps/simon-terminal-card dev",
296
+ "run:logo:terminal": "tsx examples/vue-tui-logo-terminal.ts",
297
+ "run:image-showcase:terminal": "tsx examples/image-showcase.ts",
298
+ "run:katex-showcase:terminal": "tsx examples/katex-showcase.ts",
299
+ "trace:terminal-resize": "node scripts/trace-terminal-resize.mjs",
249
300
  "test:component-terminal:smoke": "VT_SMOKE=1 tsx scripts/run-component-terminal.ts --all",
301
+ "e2e:component-terminal-charts": "tsx scripts/run-component-terminal.ts --capture-charts",
250
302
  "docs:gen": "tsx scripts/generate-component-api-docs.ts",
251
303
  "docs:check-public-descriptions": "tsx scripts/check-public-api-docs.ts",
252
304
  "docs:dev": "pnpm run docs:gen && vitepress dev docs",
@@ -260,6 +312,10 @@
260
312
  "lint:fix": "oxlint . --fix",
261
313
  "check:hidden-unicode": "node scripts/check-hidden-unicode.cjs",
262
314
  "check:tracked-build-output": "node scripts/check-tracked-build-output.cjs",
315
+ "check:production-instrumentation-strip": "node scripts/check-production-instrumentation-strip.mjs && node scripts/check-production-instrumentation-negative-control.mjs",
316
+ "check:consumer-bundle": "tsx scripts/check-consumer-bundle.ts",
317
+ "validate:consumer-bundle-abc": "tsx scripts/validate-consumer-bundle-abc.ts",
318
+ "validate:built-dist-abc": "tsx scripts/validate-built-dist-abc.ts",
263
319
  "release:workflow-only": "node -e \"console.error('Use GitHub Release workflow'); process.exit(1)\"",
264
320
  "release": "pnpm run release:workflow-only",
265
321
  "release:verify": "pnpm run release:dry-run",
@@ -267,16 +323,16 @@
267
323
  "publish:npm:patch": "pnpm exec bumpp patch --yes --no-commit --no-tag --no-push && (npm whoami >/dev/null 2>&1 || npm login) && VUE_TUI_ALLOW_DIRECT_PUBLISH=1 pnpm publish --access public --no-git-checks",
268
324
  "release:local": "pnpm run release:dry-run && VUE_TUI_ALLOW_DIRECT_PUBLISH=1 npm publish .release/*.tgz --access public --tag rc",
269
325
  "release:local:dry-run": "pnpm run release:dry-run && VUE_TUI_ALLOW_DIRECT_PUBLISH=1 npm publish .release/*.tgz --access public --dry-run --tag rc",
270
- "release:bench": "pnpm run bench:baseline && FRAMES=2000 pnpm run bench:stdout-column-diff",
271
- "release:check": "pnpm run check:hidden-unicode && pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run test:coverage:core && pnpm run build:checked && pnpm run test:package-exports:dist && pnpm run check:dist-dts && pnpm run test:types:dist && pnpm run test:browser-vite-import:dist && pnpm run docs:build && pnpm run api:diff && git diff --exit-code -- docs/generated",
326
+ "release:bench": "pnpm run bench:baseline && pnpm run bench:perf-baseline:smoke && FRAMES=2000 pnpm run bench:stdout-column-diff",
327
+ "release:check": "pnpm run check:hidden-unicode && pnpm run format:check && pnpm run lint && pnpm run typecheck && pnpm run test && pnpm run test:coverage:core && pnpm run build:checked && pnpm run check:production-instrumentation-strip && pnpm run check:consumer-bundle && pnpm run test:package-exports:dist && pnpm run check:dist-dts && pnpm run test:types:dist && pnpm run test:browser-vite-import:dist && pnpm run docs:build && pnpm run api:diff && git diff --exit-code -- docs/generated",
272
328
  "release:dry-run": "pnpm run release:check && pnpm run release:bench && pnpm run release:smoke && pnpm run release:pack-smoke",
273
329
  "release:pack": "rimraf .release && pnpm run build:checked && pnpm pack --pack-destination .release",
274
330
  "release:pack-smoke": "pnpm run release:pack && pnpm run test:package-contract:existing && pnpm run release:pack-smoke:existing",
275
- "release:pack-smoke:existing": "node scripts/smoke-packed-package.mjs .release/*.tgz && node scripts/smoke-packed-ssr-import.mjs .release/*.tgz",
331
+ "release:pack-smoke:existing": "node scripts/smoke-packed-package.mjs .release/*.tgz && node scripts/smoke-packed-ssr-import.mjs .release/*.tgz && node scripts/smoke-packed-no-mermaid-peer.mjs .release/*.tgz",
276
332
  "release:smoke": "pnpm run example:tlog-view-lab && pnpm run example:agent-console:smoke && pnpm run example:agent-console:terminal:smoke && pnpm run example:basic:terminal-table:smoke",
277
333
  "start": "esno src/index.ts",
278
334
  "test": "vitest run",
279
- "test:coverage:core": "vitest run test/unicode-width.test.ts test/hyperlink-sanitizer.test.ts test/dom-renderer.test.ts test/render-manager.test.ts test/terminal-selection.test.ts test/terminal-scroll-operations.test.ts test/plane-compositor.test.ts --coverage.enabled true --coverage.reporter text-summary",
335
+ "test:coverage:core": "vitest run test/unicode-width.test.ts test/core/buffer/unicode-17-eaw.test.ts test/hyperlink-sanitizer.test.ts test/dom-renderer.test.ts test/render-manager.test.ts test/terminal-selection.test.ts test/terminal-scroll-operations.test.ts test/plane-compositor.test.ts --coverage.enabled true --coverage.reporter text-summary",
280
336
  "test:browser-packed-vite-import": "pnpm run test:browser-vite-import:package",
281
337
  "test:browser-vite-import": "pnpm run build:checked && pnpm run test:browser-vite-import:dist",
282
338
  "test:browser-vite-import:dist": "pnpm exec vite build --config test/fixtures/browser-vite-import/vite.config.ts && node scripts/check-browser-vite-import.mjs",
@@ -293,6 +349,8 @@
293
349
  "typecheck": "tsc -p tsconfig.runtime.json --noEmit && tsc -p tsconfig.json --noEmit",
294
350
  "e2e": "playwright test --project=smoke",
295
351
  "e2e:smoke": "playwright test --project=smoke",
352
+ "e2e:charts": "tsx scripts/e2e-charts.ts",
353
+ "e2e:terminal-resize": "tsx scripts/e2e-terminal-resize.ts",
296
354
  "e2e:browser-regressions": "playwright test --project=browser-regressions-chromium --project=browser-regressions-firefox --project=browser-regressions-webkit",
297
355
  "bench:vfor": "tsx scripts/bench-vfor.ts",
298
356
  "bench:dom-renderer": "tsx scripts/bench-dom-renderer.ts",
@@ -300,6 +358,19 @@
300
358
  "bench:baseline:timing": "BENCH_TIMING=1 tsx scripts/check-bench-baselines.ts",
301
359
  "bench:phase2": "tsx scripts/bench-phase2.ts",
302
360
  "bench:scroll-mailbox": "tsx scripts/bench-scroll-mailbox.ts",
303
- "bench:stdout-column-diff": "tsx scripts/bench-stdout-column-diff.ts"
361
+ "bench:stdout-column-diff": "tsx scripts/bench-stdout-column-diff.ts",
362
+ "unicode:eaw:generate": "tsx scripts/generate-eaw-ranges.ts",
363
+ "unicode:eaw:check": "tsx scripts/generate-eaw-ranges.ts && git diff --exit-code -- src/core/buffer/eaw-ranges-unicode-17.ts",
364
+ "bench:perf-baseline": "tsx scripts/bench-perf-baseline.ts",
365
+ "bench:perf-baseline:json": "tsx scripts/bench-perf-baseline.ts --output .tmp/perf-baseline.json",
366
+ "bench:perf-baseline:smoke": "BENCH_SMOKE=1 tsx scripts/bench-perf-baseline.ts --output .tmp/perf-baseline-smoke.json",
367
+ "bench:profiler": "tsx scripts/bench-profiler-complete.ts",
368
+ "bench:profiler:gc": "node --expose-gc --import=tsx scripts/bench-profiler-complete.ts",
369
+ "bench:profiler:legacy": "tsx scripts/bench-profiler-legacy.ts",
370
+ "bench:overhead": "tsx scripts/bench-instrumentation-overhead.ts",
371
+ "bench:bundle-size": "tsx scripts/bench-bundle-size.ts",
372
+ "validate:agent-console:abc": "tsx scripts/validate-agent-console-abc.ts",
373
+ "profile:agent-console:record": "tsx scripts/record-agent-console-profile.ts",
374
+ "check:agent-console-profile-baseline": "tsx scripts/check-agent-console-profile-baseline.ts"
304
375
  }
305
376
  }