@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.
- package/README.md +84 -26
- package/dist/TMermaidText-frVr8Ysb.js +885 -0
- package/dist/{TSelect-DR0FomSu.js → TSelect-tJ87rKPM.js} +59 -242
- package/dist/{TTree-kzhlB5P0.js → TTree-CGdE-CYu.js} +138 -102
- package/dist/agent/mermaid.cjs +2 -0
- package/dist/agent/mermaid.d.cts +2 -0
- package/dist/agent/mermaid.d.ts +2 -0
- package/dist/agent/mermaid.js +1 -0
- package/dist/agent.cjs +31188 -24907
- package/dist/agent.d.cts +11 -1
- package/dist/agent.d.ts +11 -1
- package/dist/agent.js +516 -11
- package/dist/{block-source-CKUOnkgT.js → block-source-CrlmaBM5.js} +1039 -66
- package/dist/cli/input.d.ts +8 -0
- package/dist/cli/stdin-buffer.d.ts +1 -1
- package/dist/cli/video/ffmpeg-frame-source.d.ts +10 -0
- package/dist/cli/video/png-frame-parser.d.ts +4 -0
- package/dist/cli/video/raw-frame-parser.d.ts +1 -0
- package/dist/cli/video/yt-dlp-frame-source.d.ts +11 -0
- package/dist/cli.cjs +5146 -6767
- package/dist/cli.d.cts +5 -1
- package/dist/cli.d.ts +5 -1
- package/dist/cli.js +2869 -154
- package/dist/core/buffer/eaw-ranges-unicode-17.d.ts +14 -0
- package/dist/core/perf/instrumentation-noop.d.ts +48 -0
- package/dist/core/perf/instrumentation.d.ts +136 -0
- package/dist/core/terminal/create-terminal.d.ts +1 -0
- package/dist/core.cjs +843 -1469
- package/dist/core.js +4 -5
- package/dist/create-terminal-app.d.ts +24 -1
- package/dist/debug-logger-CmsGI4of.js +74 -0
- package/dist/{dom-renderer-BniJSQyX.js → dom-renderer-DXx8fWzD.js} +2 -3
- package/dist/experimental/3d/bun/contributor-avatar-atlas.d.ts +12 -0
- package/dist/experimental/3d/bun/png.d.ts +1 -0
- package/dist/experimental/3d/bun/terminal-badge-scene.d.ts +11 -0
- package/dist/experimental/3d/bun/terminal-badge.wgsl.d.ts +1 -0
- package/dist/experimental/3d/bun/webgpu-renderer.d.ts +26 -0
- package/dist/experimental/3d/bun.cjs +7271 -0
- package/dist/experimental/3d/bun.d.cts +4 -0
- package/dist/experimental/3d/bun.d.ts +4 -0
- package/dist/experimental/3d/bun.js +7390 -0
- package/dist/experimental/video/node.cjs +497 -0
- package/dist/experimental/video/node.d.cts +4 -0
- package/dist/experimental/video/node.d.ts +4 -0
- package/dist/experimental/video/node.js +610 -0
- package/dist/experimental.cjs +6876 -6192
- package/dist/experimental.d.cts +7 -0
- package/dist/experimental.d.ts +7 -0
- package/dist/experimental.js +3005 -9
- package/dist/frame-perf-CHpWhbC4.js +111 -0
- package/dist/{create-terminal-DBFNYr8f.js → hyperlink-_1FAj7Wq.js} +440 -13
- package/dist/index.cjs +5017 -10339
- package/dist/index.js +14 -13
- package/dist/{linkify-D_gzn9Xq.js → linkify-D68T7rdW.js} +193 -3
- package/dist/markdown.cjs +21295 -12691
- package/dist/markdown.d.cts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.js +211 -51
- package/dist/mermaid-BNhM1jAZ.js +123 -0
- package/dist/mermaid.cjs +1707 -0
- package/dist/mermaid.d.cts +3 -0
- package/dist/mermaid.d.ts +3 -0
- package/dist/mermaid.js +6 -0
- package/dist/observability/frame-perf-store.d.ts +2 -1
- package/dist/observability/frame-perf.d.ts +33 -0
- package/dist/observability.cjs +106 -107
- package/dist/observability.d.cts +2 -2
- package/dist/observability.d.ts +2 -2
- package/dist/observability.js +3 -3
- package/dist/{wheel-scroll-vBRaQ7p-.js → rect-DUpeDfBg.js} +253 -117
- package/dist/renderer/cli/stdout-metrics.d.ts +10 -0
- package/dist/renderer/cli/stdout-renderer.d.ts +3 -0
- package/dist/renderer/terminal-graphic-render-queue.d.ts +50 -0
- package/dist/renderer/terminal-graphics-trace.d.ts +53 -0
- package/dist/renderer/terminal-graphics.d.ts +147 -0
- package/dist/renderer-dom.cjs +364 -903
- package/dist/renderer-dom.js +4 -5
- package/dist/runtime/index.d.ts +2 -0
- package/dist/{runtime-rfcZCyJq.js → runtime-Byf8XXOT.js} +28 -15
- package/dist/runtime.cjs +427 -889
- package/dist/runtime.js +2 -2
- package/dist/terminal-graphics-Bbe83wSr.js +597 -0
- package/dist/{terminal-selection-DBinO6p5.js → terminal-selection-4W1SJj4c.js} +4 -1
- package/dist/{tlog-theme-CvLFNMwk.js → tlog-theme-Bul2Na3u.js} +1237 -12
- package/dist/{trace-CjzYeIxN.js → trace-Bh8WnoMo.js} +5 -0
- package/dist/vue/agent/create-png-terminal-graphic-renderer.d.ts +19 -0
- package/dist/vue/components/T3DViewport.d.ts +473 -0
- package/dist/vue/components/TAgentTerminalGraphic.d.ts +494 -0
- package/dist/vue/components/TCharts.d.ts +1121 -0
- package/dist/vue/components/TFeedback.d.ts +1 -1
- package/dist/vue/components/TFlex.d.ts +389 -0
- package/dist/vue/components/TForm.d.ts +4 -4
- package/dist/vue/components/TLogSearchBar.d.ts +3 -3
- package/dist/vue/components/TLogSearchPager.d.ts +2 -2
- package/dist/vue/components/TMarkdownText.d.ts +162 -4
- package/dist/vue/components/TMermaidText.d.ts +900 -0
- package/dist/vue/components/TVideo.d.ts +291 -0
- package/dist/vue/components/TVirtualList.d.ts +9 -0
- package/dist/vue/components/TVirtualMarkdown.d.ts +170 -9
- package/dist/vue/components/TVirtualRows.d.ts +9 -0
- package/dist/vue/components/TerminalProvider.d.ts +2 -0
- package/dist/vue/context.d.ts +24 -0
- package/dist/vue/index.d.ts +5 -0
- package/dist/vue/layout/flex.d.ts +67 -0
- package/dist/vue/markdown/ast.d.ts +5 -2
- package/dist/vue/markdown/document.d.ts +5 -0
- package/dist/vue/markdown/image-actions.d.ts +14 -0
- package/dist/vue/markdown/image.d.ts +11 -0
- package/dist/vue/markdown/link-actions.d.ts +14 -0
- package/dist/vue/markdown/math-actions.d.ts +14 -0
- package/dist/vue/markdown/math.d.ts +6 -0
- package/dist/vue/markdown/render.d.ts +28 -0
- package/dist/vue/markdown/types.d.ts +78 -0
- package/dist/vue/mermaid/beautiful-mermaid.d.ts +1436 -0
- package/dist/vue/render/render-manager.d.ts +7 -0
- package/dist/vue/video/types.d.ts +39 -0
- package/dist/vue.cjs +7207 -12437
- package/dist/vue.js +704 -38
- package/dist/wheel-scroll-DASkEZr-.js +106 -0
- package/dist/{hyperlink-Bn02UXJb.js → width-GqllnV8C.js} +166 -111
- package/package.json +119 -14
- package/dist/frame-perf-C6Xfg85O.js +0 -24
- package/dist/sgr-BmzxEjAO.js +0 -304
- /package/dist/{ansi-palette-CNXqFciC.js → ansi-palette-CH6jc2Z7.js} +0 -0
- /package/dist/{path-suggest-BNqcuE3-.js → path-suggest-Dndu4dTi.js} +0 -0
package/dist/index.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import { createTerminal } from "./
|
|
2
|
-
import "./
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import
|
|
6
|
-
import "./
|
|
7
|
-
import
|
|
8
|
-
import "./
|
|
9
|
-
import "./trace-
|
|
1
|
+
import { createTerminal } from "./hyperlink-_1FAj7Wq.js";
|
|
2
|
+
import "./width-GqllnV8C.js";
|
|
3
|
+
import "./ansi-palette-CH6jc2Z7.js";
|
|
4
|
+
import { createDomRenderer } from "./dom-renderer-DXx8fWzD.js";
|
|
5
|
+
import "./rect-DUpeDfBg.js";
|
|
6
|
+
import { TText, TView, createTheme, linkifyTextSegments, tuiDefaultTheme } from "./linkify-D68T7rdW.js";
|
|
7
|
+
import "./runtime-Byf8XXOT.js";
|
|
8
|
+
import "./frame-perf-CHpWhbC4.js";
|
|
9
|
+
import "./trace-Bh8WnoMo.js";
|
|
10
10
|
import "./env-Cl8qmNFN.js";
|
|
11
|
-
import { TAutocompleteInput, TBadge, TCheckbox, TCode, TDataTable, TDivider, TFormField, TLink, TLinkifyText, TList, TPasswordInput, TRadioGroup, TSlider, TSwitch, TTable, TTag, TTree, TerminalProvider, createTInputHostPlugin } from "./TTree-
|
|
12
|
-
import "./terminal-selection-
|
|
13
|
-
import
|
|
14
|
-
import "./
|
|
11
|
+
import { TAutocompleteInput, TBadge, TCheckbox, TCode, TDataTable, TDivider, TFormField, TLink, TLinkifyText, TList, TPasswordInput, TRadioGroup, TSlider, TSwitch, TTable, TTag, TTree, TerminalProvider, createTInputHostPlugin } from "./TTree-CGdE-CYu.js";
|
|
12
|
+
import "./terminal-selection-4W1SJj4c.js";
|
|
13
|
+
import "./debug-logger-CmsGI4of.js";
|
|
14
|
+
import { TBox, TCommandPalette, TDialog, TInput, TSelect, computeCommandPaletteMatchRanges } from "./TSelect-tJ87rKPM.js";
|
|
15
15
|
import "./path-mnSgEpCm.js";
|
|
16
|
+
import "./wheel-scroll-DASkEZr-.js";
|
|
16
17
|
|
|
17
18
|
export { TAutocompleteInput, TBadge, TBox, TCheckbox, TCode, TCommandPalette, TDataTable, TDialog, TDivider, TFormField, TInput, TLink, TLinkifyText, TList, TPasswordInput, TRadioGroup, TSelect, TSlider, TSwitch, TTable, TTag, TText, TTree, TView, TerminalProvider, computeCommandPaletteMatchRanges, createDomRenderer, createTInputHostPlugin, createTerminal, createTheme, linkifyTextSegments, tuiDefaultTheme };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { sanitizeDomHref } from "./hyperlink-
|
|
2
|
-
import { EventZIndexContextKey, LayoutContextKey, RenderStackKey, injectionKey, intersectRect, translateRect, useLayout, useRenderStack, useTerminal, useTerminalNode, useVisibility } from "./
|
|
1
|
+
import { sanitizeDomHref } from "./hyperlink-_1FAj7Wq.js";
|
|
2
|
+
import { EventZIndexContextKey, LayoutContextKey, RenderStackKey, injectionKey, intersectRect, padEndByCells$1 as padEndByCells, sanitizeInlineText, sanitizeTextBlock, sliceByCells, sliceByCellsRange, spaces, textCellWidth$1 as textCellWidth, translateRect, useLayout, useRenderNode, useRenderStack, useTerminal, useTerminalNode, useVisibility, wrapByCells } from "./rect-DUpeDfBg.js";
|
|
3
3
|
import { computed, defineComponent, h, inject, provide, shallowReactive, watchEffect } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/vue/theme.ts
|
|
@@ -105,6 +105,167 @@ function createTheme(overrides = {}) {
|
|
|
105
105
|
}
|
|
106
106
|
const TuiThemeContextKey = injectionKey("TuiTheme");
|
|
107
107
|
|
|
108
|
+
//#endregion
|
|
109
|
+
//#region src/vue/components/TText.ts
|
|
110
|
+
function fitText(text, max) {
|
|
111
|
+
if (max <= 0) return "";
|
|
112
|
+
text = sanitizeInlineText(text);
|
|
113
|
+
return sliceByCells(text, max);
|
|
114
|
+
}
|
|
115
|
+
function splitLines(text) {
|
|
116
|
+
return sanitizeTextBlock(text).split("\n");
|
|
117
|
+
}
|
|
118
|
+
function computeDefaultWidth(text) {
|
|
119
|
+
const lines = splitLines(text);
|
|
120
|
+
let max = 0;
|
|
121
|
+
for (const line of lines) max = Math.max(max, textCellWidth(line));
|
|
122
|
+
return max;
|
|
123
|
+
}
|
|
124
|
+
const TText = defineComponent({
|
|
125
|
+
name: "TText",
|
|
126
|
+
props: {
|
|
127
|
+
x: {
|
|
128
|
+
type: Number,
|
|
129
|
+
required: true
|
|
130
|
+
},
|
|
131
|
+
y: {
|
|
132
|
+
type: Number,
|
|
133
|
+
required: true
|
|
134
|
+
},
|
|
135
|
+
zIndex: {
|
|
136
|
+
type: Number,
|
|
137
|
+
default: 0
|
|
138
|
+
},
|
|
139
|
+
value: {
|
|
140
|
+
type: String,
|
|
141
|
+
required: true
|
|
142
|
+
},
|
|
143
|
+
w: {
|
|
144
|
+
type: Number,
|
|
145
|
+
default: void 0
|
|
146
|
+
},
|
|
147
|
+
h: {
|
|
148
|
+
type: Number,
|
|
149
|
+
default: void 0
|
|
150
|
+
},
|
|
151
|
+
style: {
|
|
152
|
+
type: Object,
|
|
153
|
+
default: void 0
|
|
154
|
+
},
|
|
155
|
+
clear: {
|
|
156
|
+
type: Boolean,
|
|
157
|
+
default: true
|
|
158
|
+
},
|
|
159
|
+
wrap: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
default: false
|
|
162
|
+
},
|
|
163
|
+
depsKey: {
|
|
164
|
+
type: null,
|
|
165
|
+
default: void 0
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
setup(props) {
|
|
169
|
+
const { terminal, defaultStyle } = useTerminal();
|
|
170
|
+
const layout = useLayout();
|
|
171
|
+
const { visible, rootProps } = useVisibility();
|
|
172
|
+
const defaultWidth = computed(() => computeDefaultWidth(props.value));
|
|
173
|
+
const lines = computed(() => {
|
|
174
|
+
const w = props.w ?? defaultWidth.value;
|
|
175
|
+
if (w <= 0) return [""];
|
|
176
|
+
if (!props.wrap) return splitLines(props.value).map((l) => fitText(l, w));
|
|
177
|
+
const safe = sanitizeTextBlock(props.value);
|
|
178
|
+
return wrapByCells(safe, w).map((l) => fitText(l, w));
|
|
179
|
+
});
|
|
180
|
+
const absRect = computed(() => {
|
|
181
|
+
const width = props.w ?? defaultWidth.value;
|
|
182
|
+
const height = props.h ?? (props.wrap ? lines.value.length || 1 : lines.value.length || 1);
|
|
183
|
+
const raw = {
|
|
184
|
+
x: props.x,
|
|
185
|
+
y: props.y,
|
|
186
|
+
w: width,
|
|
187
|
+
h: height
|
|
188
|
+
};
|
|
189
|
+
const translated = translateRect(raw, layout.originX, layout.originY);
|
|
190
|
+
if (!layout.clipRect) return translated;
|
|
191
|
+
return intersectRect(translated, layout.clipRect) ?? {
|
|
192
|
+
x: 0,
|
|
193
|
+
y: 0,
|
|
194
|
+
w: 0,
|
|
195
|
+
h: 0
|
|
196
|
+
};
|
|
197
|
+
});
|
|
198
|
+
const fullRect = computed(() => {
|
|
199
|
+
const width = props.w ?? defaultWidth.value;
|
|
200
|
+
const height = props.h ?? (props.wrap ? lines.value.length || 1 : lines.value.length || 1);
|
|
201
|
+
return translateRect({
|
|
202
|
+
x: props.x,
|
|
203
|
+
y: props.y,
|
|
204
|
+
w: width,
|
|
205
|
+
h: height
|
|
206
|
+
}, layout.originX, layout.originY);
|
|
207
|
+
});
|
|
208
|
+
useRenderNode(() => ({
|
|
209
|
+
zIndex: props.zIndex,
|
|
210
|
+
rect: visible.value ? absRect.value : {
|
|
211
|
+
x: 0,
|
|
212
|
+
y: 0,
|
|
213
|
+
w: 0,
|
|
214
|
+
h: 0
|
|
215
|
+
},
|
|
216
|
+
deps: [
|
|
217
|
+
visible.value,
|
|
218
|
+
absRect.value,
|
|
219
|
+
fullRect.value,
|
|
220
|
+
props.value,
|
|
221
|
+
props.w,
|
|
222
|
+
props.h,
|
|
223
|
+
props.wrap,
|
|
224
|
+
props.style,
|
|
225
|
+
defaultStyle.value,
|
|
226
|
+
props.depsKey
|
|
227
|
+
],
|
|
228
|
+
paint: (dirtyRows) => {
|
|
229
|
+
if (!visible.value) return;
|
|
230
|
+
const r = absRect.value;
|
|
231
|
+
if (r.w <= 0 || r.h <= 0) return;
|
|
232
|
+
const full = fullRect.value;
|
|
233
|
+
const style = props.style ?? defaultStyle.value;
|
|
234
|
+
const blank = props.clear ? spaces(r.w) : "";
|
|
235
|
+
const out = lines.value;
|
|
236
|
+
const dx = Math.max(0, Math.floor(r.x - full.x));
|
|
237
|
+
const fullY = Math.floor(full.y);
|
|
238
|
+
const paintRow = (y) => {
|
|
239
|
+
const relY = y - r.y;
|
|
240
|
+
if (relY < 0 || relY >= r.h) return;
|
|
241
|
+
const i = y - fullY;
|
|
242
|
+
if (i < 0 || i >= out.length) {
|
|
243
|
+
if (props.clear) terminal.write(blank, {
|
|
244
|
+
x: r.x,
|
|
245
|
+
y,
|
|
246
|
+
style
|
|
247
|
+
});
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const src = out[i] ?? "";
|
|
251
|
+
const clipped = dx > 0 ? sliceByCellsRange(src, dx, dx + r.w) : sliceByCells(src, r.w);
|
|
252
|
+
terminal.write(padEndByCells(clipped, r.w), {
|
|
253
|
+
x: r.x,
|
|
254
|
+
y,
|
|
255
|
+
style
|
|
256
|
+
});
|
|
257
|
+
};
|
|
258
|
+
if (!dirtyRows) {
|
|
259
|
+
for (let i = 0; i < r.h; i++) paintRow(r.y + i);
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
for (const y of dirtyRows) paintRow(y);
|
|
263
|
+
}
|
|
264
|
+
}));
|
|
265
|
+
return () => h("span", rootProps);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
|
|
108
269
|
//#endregion
|
|
109
270
|
//#region src/vue/components/TView.ts
|
|
110
271
|
const EMPTY_RECT = Object.freeze({
|
|
@@ -267,6 +428,35 @@ const TView = defineComponent({
|
|
|
267
428
|
}
|
|
268
429
|
});
|
|
269
430
|
|
|
431
|
+
//#endregion
|
|
432
|
+
//#region src/vue/components/simple-utils.ts
|
|
433
|
+
function clamp(n, min, max) {
|
|
434
|
+
return Math.max(min, Math.min(max, n));
|
|
435
|
+
}
|
|
436
|
+
function mergeStyle(...styles) {
|
|
437
|
+
const out = {};
|
|
438
|
+
for (const style of styles) {
|
|
439
|
+
if (!style) continue;
|
|
440
|
+
Object.assign(out, style);
|
|
441
|
+
}
|
|
442
|
+
return out;
|
|
443
|
+
}
|
|
444
|
+
function fitCellText(value, width, align = "left") {
|
|
445
|
+
const w = Math.max(0, Math.floor(width));
|
|
446
|
+
if (w <= 0) return "";
|
|
447
|
+
const text = sliceByCells(sanitizeInlineText(String(value ?? "")), w);
|
|
448
|
+
if (align === "right") {
|
|
449
|
+
const cells = textCellWidth(text);
|
|
450
|
+
return `${" ".repeat(Math.max(0, w - cells))}${text}`;
|
|
451
|
+
}
|
|
452
|
+
return padEndByCells(text, w);
|
|
453
|
+
}
|
|
454
|
+
function repeatToCells(ch, width) {
|
|
455
|
+
const w = Math.max(0, Math.floor(width));
|
|
456
|
+
if (w <= 0) return "";
|
|
457
|
+
return ch.repeat(w);
|
|
458
|
+
}
|
|
459
|
+
|
|
270
460
|
//#endregion
|
|
271
461
|
//#region src/vue/scheduler/frame-mailbox.ts
|
|
272
462
|
const EMPTY = Symbol("frame-mailbox-empty");
|
|
@@ -559,4 +749,4 @@ function linkifyTextSegments(text, options = {}) {
|
|
|
559
749
|
}
|
|
560
750
|
|
|
561
751
|
//#endregion
|
|
562
|
-
export { TView, TuiThemeContextKey, createFrameMailbox, createTheme, defaultActiveStyle, defaultDimStyle, linkifyTextSegments, tuiDefaultTheme };
|
|
752
|
+
export { TText, TView, TuiThemeContextKey, clamp, createFrameMailbox, createTheme, defaultActiveStyle, defaultDimStyle, fitCellText, linkifyTextSegments, mergeStyle, repeatToCells, tuiDefaultTheme };
|