@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
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { TERMINAL_RENDER_PLANES, createTerminal, getPlaneTerminal, resetPlaneRowsForRender, scrollPlaneRows } from "./
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { createFramePerfStore, createTraceStore } from "./trace-
|
|
1
|
+
import { TERMINAL_RENDER_PLANES, createTerminal, getPlaneTerminal, resetPlaneRowsForRender, sanitizeDomHref, scrollPlaneRows } from "./hyperlink-_1FAj7Wq.js";
|
|
2
|
+
import { DOM_RENDERER_CAPABILITIES, createDomRenderer } from "./dom-renderer-DXx8fWzD.js";
|
|
3
|
+
import { EventZIndexContextKey, ImeAnchorContextKey, LayoutContextKey, RenderStackKey, TInputPluginsContextKey, TPathPickerProviderContextKey, TerminalContextKey, VisibilityContextKey, clearTextCaches, forEachTextCellSegment, formatInlineCellLine, injectionKey, intersectRect, normalizeCellRect, padEndByCells$1 as padEndByCells, sanitizeInlineText, sanitizeTextBlock, sliceByCells, sliceByCellsRange, spaces, textCellWidth$1 as textCellWidth, translateRect, useLayout, useRenderNode, useTerminal, useTerminalNode, useVisibility, withTextRenderPass } from "./rect-DUpeDfBg.js";
|
|
4
|
+
import { TText, TView, TuiThemeContextKey, clamp, createFrameMailbox, createTheme, defaultActiveStyle, defaultDimStyle, fitCellText, linkifyTextSegments, mergeStyle, repeatToCells, tuiDefaultTheme } from "./linkify-D68T7rdW.js";
|
|
5
|
+
import { SUPPRESS_TERMINAL_POINTER_DOWN, SUPPRESS_TERMINAL_POINTER_MOVE, SUPPRESS_TERMINAL_POINTER_UP, createEventManager, createRuntime } from "./runtime-Byf8XXOT.js";
|
|
6
|
+
import { framePerfNow, mergeFramePerfReason } from "./frame-perf-CHpWhbC4.js";
|
|
7
|
+
import { createFramePerfStore, createTraceStore } from "./trace-Bh8WnoMo.js";
|
|
8
8
|
import { envFlag, envString, firstNonEmptyEnv } from "./env-Cl8qmNFN.js";
|
|
9
|
-
import { createTerminalSelectionController } from "./terminal-selection-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
9
|
+
import { createTerminalSelectionController } from "./terminal-selection-4W1SJj4c.js";
|
|
10
|
+
import { createDebugLogger, isDebugEnabled } from "./debug-logger-CmsGI4of.js";
|
|
11
|
+
import { TBox, TInput, TRenderPlane, resolveOverlayPlacement } from "./TSelect-tJ87rKPM.js";
|
|
12
|
+
import { applyWheelScroll, createWheelScrollState, resetWheelScrollState } from "./wheel-scroll-DASkEZr-.js";
|
|
12
13
|
import { computed, defineComponent, effectScope, getCurrentInstance, h, inject, nextTick, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, provide, ref, shallowReactive, shallowRef, toRef, watch, watchEffect } from "vue";
|
|
13
14
|
|
|
14
15
|
//#region src/observability/tui-profiler.ts
|
|
@@ -200,77 +201,6 @@ function createTuiProfiler(name, options = {}) {
|
|
|
200
201
|
};
|
|
201
202
|
}
|
|
202
203
|
|
|
203
|
-
//#endregion
|
|
204
|
-
//#region src/core/debug-logger.ts
|
|
205
|
-
const DEFAULT_LOG_FILE = "vue-tui-debug.log";
|
|
206
|
-
let debugFileWriter = null;
|
|
207
|
-
let debugLogDefaultPath = DEFAULT_LOG_FILE;
|
|
208
|
-
const initializedDebugLogPaths = new Set();
|
|
209
|
-
function getFileWriter() {
|
|
210
|
-
const writer = globalThis.__VT_DEBUG_FILE_WRITER__;
|
|
211
|
-
if (writer && typeof writer === "object") return writer;
|
|
212
|
-
return debugFileWriter;
|
|
213
|
-
}
|
|
214
|
-
function resolveDebugLogPath(env, fallback = DEFAULT_LOG_FILE) {
|
|
215
|
-
return envString(env, "VUE_TUI_DEBUG_LOG_PATH", "DIMCODE_DEBUG_LOG_PATH", fallback);
|
|
216
|
-
}
|
|
217
|
-
function debugLogPath() {
|
|
218
|
-
const env = globalThis.process?.env;
|
|
219
|
-
return resolveDebugLogPath(env, debugLogDefaultPath);
|
|
220
|
-
}
|
|
221
|
-
function safeJson(value) {
|
|
222
|
-
try {
|
|
223
|
-
return JSON.stringify(value);
|
|
224
|
-
} catch {
|
|
225
|
-
return "[unserializable]";
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
function createDebugLogger(enable = false) {
|
|
229
|
-
const enabled = enable;
|
|
230
|
-
const ensureHeader = () => {
|
|
231
|
-
if (!enabled) return;
|
|
232
|
-
const writer = getFileWriter();
|
|
233
|
-
if (!writer?.writeFileSync) return;
|
|
234
|
-
const path = debugLogPath();
|
|
235
|
-
if (initializedDebugLogPaths.has(path)) return;
|
|
236
|
-
try {
|
|
237
|
-
const data = `=== Vue TUI Debug Log Started at ${new Date().toISOString()} ===\n\n`;
|
|
238
|
-
writer.writeFileSync(path, data);
|
|
239
|
-
initializedDebugLogPaths.add(path);
|
|
240
|
-
} catch {}
|
|
241
|
-
};
|
|
242
|
-
const write = (data) => {
|
|
243
|
-
if (!enabled) return;
|
|
244
|
-
ensureHeader();
|
|
245
|
-
try {
|
|
246
|
-
getFileWriter()?.appendFileSync?.(debugLogPath(), data);
|
|
247
|
-
} catch {}
|
|
248
|
-
};
|
|
249
|
-
const log = (category, message) => {
|
|
250
|
-
if (!enabled) return;
|
|
251
|
-
const timestamp = new Date().toISOString().split("T")[1].slice(0, -1);
|
|
252
|
-
write(`[${timestamp}] ${category} ${message}\n`);
|
|
253
|
-
};
|
|
254
|
-
ensureHeader();
|
|
255
|
-
return {
|
|
256
|
-
render: (message) => log("[RENDER]", message),
|
|
257
|
-
stream: (message) => log("[STREAM]", message),
|
|
258
|
-
error: (message, ...args) => {
|
|
259
|
-
if (!enabled) return;
|
|
260
|
-
const timestamp = new Date().toISOString().split("T")[1].slice(0, -1);
|
|
261
|
-
const fullMessage = `[${timestamp}] [ERROR] ${message}${args.length ? ` ${safeJson(args)}` : ""}`;
|
|
262
|
-
write(`${fullMessage}\n`);
|
|
263
|
-
}
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
/**
|
|
267
|
-
* Check if debug logging is enabled via environment variable
|
|
268
|
-
*/
|
|
269
|
-
function isDebugEnabled() {
|
|
270
|
-
const env = globalThis.process?.env;
|
|
271
|
-
return envFlag(env, "VUE_TUI_DEBUG", "DIMCODE_DEBUG") || env?.DEBUG === "1";
|
|
272
|
-
}
|
|
273
|
-
|
|
274
204
|
//#endregion
|
|
275
205
|
//#region src/vue/render/render-manager.ts
|
|
276
206
|
const renderMgrDebugLog = createDebugLogger(isDebugEnabled());
|
|
@@ -302,6 +232,10 @@ function sameRect(a, b) {
|
|
|
302
232
|
if (!a || !b) return false;
|
|
303
233
|
return a.x === b.x && a.y === b.y && a.w === b.w && a.h === b.h;
|
|
304
234
|
}
|
|
235
|
+
function rectsIntersect(a, b) {
|
|
236
|
+
if (isEmptyRect(a) || isEmptyRect(b)) return false;
|
|
237
|
+
return a.x < b.x + b.w && a.x + a.w > b.x && a.y < b.y + b.h && a.y + a.h > b.y;
|
|
238
|
+
}
|
|
305
239
|
function createRenderManager(terminal, options = {}) {
|
|
306
240
|
const widthProvider = options.widthProvider ?? "default";
|
|
307
241
|
const withRenderTextPass = (fn) => withTextRenderPass(fn, widthProvider);
|
|
@@ -309,6 +243,7 @@ function createRenderManager(terminal, options = {}) {
|
|
|
309
243
|
const nodes = new Map();
|
|
310
244
|
const planeDirtyStates = new Map();
|
|
311
245
|
const initialSize = terminal.size();
|
|
246
|
+
let terminalCols = initialSize.cols;
|
|
312
247
|
let terminalRows = initialSize.rows;
|
|
313
248
|
let allRows = Array.from({ length: terminalRows }, (_, index) => index);
|
|
314
249
|
let sortedNodes = [];
|
|
@@ -329,19 +264,37 @@ function createRenderManager(terminal, options = {}) {
|
|
|
329
264
|
let disposed = false;
|
|
330
265
|
const stackPathCache = new WeakMap();
|
|
331
266
|
const profiler = createTuiProfiler("render-manager", options.profiler);
|
|
332
|
-
const offResize = terminal.on("resize", ({ rows }) => {
|
|
267
|
+
const offResize = terminal.on("resize", ({ cols, rows }) => {
|
|
333
268
|
if (disposed) return;
|
|
269
|
+
const colsChanged = cols !== terminalCols;
|
|
270
|
+
const prevRows = terminalRows;
|
|
271
|
+
terminalCols = cols;
|
|
334
272
|
terminalRows = rows;
|
|
335
273
|
allRows = Array.from({ length: terminalRows }, (_, index) => index);
|
|
336
274
|
for (const state of planeDirtyStates.values()) {
|
|
337
|
-
|
|
275
|
+
const prevBits = state.dirtyRowBits;
|
|
338
276
|
state.dirtyRowBits = new Uint8Array(terminalRows);
|
|
339
277
|
state.dirtyRowCount = 0;
|
|
340
278
|
state.dirtyMinY = Number.POSITIVE_INFINITY;
|
|
341
279
|
state.dirtyMaxY = -1;
|
|
280
|
+
const limit = Math.min(terminalRows, prevBits.length);
|
|
281
|
+
for (let y = 0; y < limit; y++) {
|
|
282
|
+
if (prevBits[y] !== 1) continue;
|
|
283
|
+
state.dirtyRowBits[y] = 1;
|
|
284
|
+
state.dirtyRowCount++;
|
|
285
|
+
if (y < state.dirtyMinY) state.dirtyMinY = y;
|
|
286
|
+
if (y > state.dirtyMaxY) state.dirtyMaxY = y;
|
|
287
|
+
}
|
|
288
|
+
for (let y = prevRows; y < terminalRows; y++) {
|
|
289
|
+
if (state.dirtyRowBits[y] === 1) continue;
|
|
290
|
+
state.dirtyRowBits[y] = 1;
|
|
291
|
+
state.dirtyRowCount++;
|
|
292
|
+
if (y < state.dirtyMinY) state.dirtyMinY = y;
|
|
293
|
+
if (y > state.dirtyMaxY) state.dirtyMaxY = y;
|
|
294
|
+
}
|
|
342
295
|
}
|
|
343
296
|
rebuildRowBuckets();
|
|
344
|
-
clearTextCaches();
|
|
297
|
+
if (colsChanged) clearTextCaches();
|
|
345
298
|
});
|
|
346
299
|
const rootStack = Object.freeze({
|
|
347
300
|
id: `s${nextStackId++}`,
|
|
@@ -539,6 +492,33 @@ function createRenderManager(terminal, options = {}) {
|
|
|
539
492
|
if (y > state.dirtyMaxY) state.dirtyMaxY = y;
|
|
540
493
|
}
|
|
541
494
|
}
|
|
495
|
+
function markLowerPlanesForRect(plane, rect) {
|
|
496
|
+
const planeIndex = TERMINAL_RENDER_PLANES.indexOf(plane);
|
|
497
|
+
if (planeIndex <= 0) return;
|
|
498
|
+
for (let i = 0; i < planeIndex; i++) markRect(TERMINAL_RENDER_PLANES[i], rect);
|
|
499
|
+
}
|
|
500
|
+
function markRowRange(plane, startY, endY) {
|
|
501
|
+
const state = getDirtyState(plane);
|
|
502
|
+
const start = Math.max(0, Math.min(terminalRows, Math.floor(startY)));
|
|
503
|
+
const end = Math.max(start, Math.min(terminalRows, Math.floor(endY)));
|
|
504
|
+
for (let y = start; y < end; y++) {
|
|
505
|
+
if (state.dirtyRowBits[y] === 1) continue;
|
|
506
|
+
state.dirtyRowBits[y] = 1;
|
|
507
|
+
state.dirtyRowCount++;
|
|
508
|
+
if (y < state.dirtyMinY) state.dirtyMinY = y;
|
|
509
|
+
if (y > state.dirtyMaxY) state.dirtyMaxY = y;
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
function markRectHeightDelta(plane, prev, next) {
|
|
513
|
+
if (!prev || !next) return false;
|
|
514
|
+
if (prev.x !== next.x || prev.y !== next.y || prev.w !== next.w) return false;
|
|
515
|
+
const prevBounds = rectToYBounds(prev);
|
|
516
|
+
const nextBounds = rectToYBounds(next);
|
|
517
|
+
if (prevBounds.y0 !== nextBounds.y0) return false;
|
|
518
|
+
if (nextBounds.y1 > prevBounds.y1) markRowRange(plane, prevBounds.y1, nextBounds.y1);
|
|
519
|
+
else if (prevBounds.y1 > nextBounds.y1) markRowRange(plane, nextBounds.y1, prevBounds.y1);
|
|
520
|
+
return true;
|
|
521
|
+
}
|
|
542
522
|
function markRowsForNode(node, rows) {
|
|
543
523
|
if (!rows.length) return false;
|
|
544
524
|
warnIfRowsLookLocal(node, rows);
|
|
@@ -586,6 +566,7 @@ function createRenderManager(terminal, options = {}) {
|
|
|
586
566
|
nodes.set(id, full);
|
|
587
567
|
addToRowBuckets(full);
|
|
588
568
|
markRect(full.plane, full.rect);
|
|
569
|
+
markLowerPlanesForRect(full.plane, full.rect);
|
|
589
570
|
sortedDirty = true;
|
|
590
571
|
return full;
|
|
591
572
|
}
|
|
@@ -597,6 +578,7 @@ function createRenderManager(terminal, options = {}) {
|
|
|
597
578
|
const nextPlane = next.plane ?? prev.plane;
|
|
598
579
|
const planeChanged = nextPlane !== prev.plane;
|
|
599
580
|
const hasRect = Object.prototype.hasOwnProperty.call(next, "rect");
|
|
581
|
+
const paintChanged = Object.prototype.hasOwnProperty.call(next, "paint");
|
|
600
582
|
const nextRect = hasRect ? next.rect ?? null : prev.rect;
|
|
601
583
|
const rectChanged = !sameRect(prev.rect, nextRect);
|
|
602
584
|
const bucketChanged = planeChanged || rectChanged;
|
|
@@ -604,10 +586,12 @@ function createRenderManager(terminal, options = {}) {
|
|
|
604
586
|
const dirtyRowsHint = next.dirtyRowsHint;
|
|
605
587
|
const canUseDirtyRowsHint = !sortChanged && !rectChanged && nextPlane === prev.plane && dirtyRowsHint != null && dirtyRowsHint.length > 0;
|
|
606
588
|
if (canUseDirtyRowsHint) markRowsForNode(prev, dirtyRowsHint);
|
|
607
|
-
else {
|
|
589
|
+
else if (rectChanged && !paintChanged && !sortChanged && !planeChanged && markRectHeightDelta(prev.plane, prev.rect, nextRect)) {} else {
|
|
608
590
|
markRect(prev.plane, prev.rect);
|
|
609
591
|
markRect(nextPlane, nextRect);
|
|
610
592
|
}
|
|
593
|
+
markLowerPlanesForRect(prev.plane, prev.rect);
|
|
594
|
+
markLowerPlanesForRect(nextPlane, nextRect);
|
|
611
595
|
if (bucketChanged) removeFromRowBuckets(prev);
|
|
612
596
|
const full = Object.freeze({
|
|
613
597
|
...prev,
|
|
@@ -637,11 +621,41 @@ function createRenderManager(terminal, options = {}) {
|
|
|
637
621
|
if (!node) return false;
|
|
638
622
|
return markRowsForNode(node, rows);
|
|
639
623
|
}
|
|
624
|
+
function isRectCoveredByHigherNode(id, rect, options$1 = {}) {
|
|
625
|
+
return higherNodeCoverageRects(id, rect, options$1).length > 0;
|
|
626
|
+
}
|
|
627
|
+
function higherNodeCoverageRects(id, rect, options$1 = {}) {
|
|
628
|
+
if (disposed || isEmptyRect(rect)) return [];
|
|
629
|
+
const owner = nodes.get(id);
|
|
630
|
+
if (!owner) return [];
|
|
631
|
+
const ownerPlaneIndex = TERMINAL_RENDER_PLANES.indexOf(owner.plane);
|
|
632
|
+
if (ownerPlaneIndex < 0) return [];
|
|
633
|
+
const out = [];
|
|
634
|
+
for (const candidate of nodes.values()) {
|
|
635
|
+
if (candidate.id === id || !candidate.rect || isEmptyRect(candidate.rect)) continue;
|
|
636
|
+
if (!rectsIntersect(rect, candidate.rect)) continue;
|
|
637
|
+
const candidatePlaneIndex = TERMINAL_RENDER_PLANES.indexOf(candidate.plane);
|
|
638
|
+
const covered = candidatePlaneIndex > ownerPlaneIndex || !options$1.ignoreSamePlane && candidatePlaneIndex === ownerPlaneIndex && compareNodes(owner, candidate) < 0;
|
|
639
|
+
if (!covered) continue;
|
|
640
|
+
const x0 = Math.max(rect.x, candidate.rect.x);
|
|
641
|
+
const y0 = Math.max(rect.y, candidate.rect.y);
|
|
642
|
+
const x1 = Math.min(rect.x + rect.w, candidate.rect.x + candidate.rect.w);
|
|
643
|
+
const y1 = Math.min(rect.y + rect.h, candidate.rect.y + candidate.rect.h);
|
|
644
|
+
if (x1 > x0 && y1 > y0) out.push({
|
|
645
|
+
x: x0,
|
|
646
|
+
y: y0,
|
|
647
|
+
w: x1 - x0,
|
|
648
|
+
h: y1 - y0
|
|
649
|
+
});
|
|
650
|
+
}
|
|
651
|
+
return out;
|
|
652
|
+
}
|
|
640
653
|
function unregister(id) {
|
|
641
654
|
if (disposed) return;
|
|
642
655
|
const prev = nodes.get(id);
|
|
643
656
|
if (prev) {
|
|
644
657
|
markRect(prev.plane, prev.rect);
|
|
658
|
+
markLowerPlanesForRect(prev.plane, prev.rect);
|
|
645
659
|
removeFromRowBuckets(prev);
|
|
646
660
|
warnedLocalDirtyRows.delete(id);
|
|
647
661
|
}
|
|
@@ -856,6 +870,8 @@ function createRenderManager(terminal, options = {}) {
|
|
|
856
870
|
register,
|
|
857
871
|
update,
|
|
858
872
|
markDirtyRows,
|
|
873
|
+
isRectCoveredByHigherNode,
|
|
874
|
+
higherNodeCoverageRects,
|
|
859
875
|
unregister,
|
|
860
876
|
render,
|
|
861
877
|
dispose() {
|
|
@@ -1669,6 +1685,12 @@ function createTerminalProviderScheduler(options) {
|
|
|
1669
1685
|
|
|
1670
1686
|
//#endregion
|
|
1671
1687
|
//#region src/vue/components/TerminalProvider.ts
|
|
1688
|
+
function clipboardCanRead(api) {
|
|
1689
|
+
return api.canRead ?? api.supported;
|
|
1690
|
+
}
|
|
1691
|
+
function clipboardCanWrite(api) {
|
|
1692
|
+
return api.canWrite ?? api.supported;
|
|
1693
|
+
}
|
|
1672
1694
|
const TerminalProvider = defineComponent({
|
|
1673
1695
|
name: "TerminalProvider",
|
|
1674
1696
|
props: {
|
|
@@ -1806,15 +1828,22 @@ const TerminalProvider = defineComponent({
|
|
|
1806
1828
|
const schedulerApi = scheduler.api;
|
|
1807
1829
|
const invalidate = schedulerApi.invalidate;
|
|
1808
1830
|
const platformRuntime = createRuntime();
|
|
1831
|
+
const activeClipboard = computed(() => props.clipboard ?? platformRuntime.clipboard);
|
|
1809
1832
|
const selectionClipboard = {
|
|
1810
1833
|
get supported() {
|
|
1811
|
-
return
|
|
1834
|
+
return activeClipboard.value.supported;
|
|
1835
|
+
},
|
|
1836
|
+
get canRead() {
|
|
1837
|
+
return clipboardCanRead(activeClipboard.value);
|
|
1838
|
+
},
|
|
1839
|
+
get canWrite() {
|
|
1840
|
+
return clipboardCanWrite(activeClipboard.value);
|
|
1812
1841
|
},
|
|
1813
1842
|
readText() {
|
|
1814
|
-
return
|
|
1843
|
+
return activeClipboard.value.readText();
|
|
1815
1844
|
},
|
|
1816
1845
|
writeText(text) {
|
|
1817
|
-
return
|
|
1846
|
+
return activeClipboard.value.writeText(text);
|
|
1818
1847
|
}
|
|
1819
1848
|
};
|
|
1820
1849
|
const selectionTextProviders = new Map();
|
|
@@ -1841,6 +1870,7 @@ const TerminalProvider = defineComponent({
|
|
|
1841
1870
|
};
|
|
1842
1871
|
const selectionOverlay = getPlaneTerminal(terminal, "overlay");
|
|
1843
1872
|
let selectionRenderNodeId = null;
|
|
1873
|
+
const selectionRenderRect = () => null;
|
|
1844
1874
|
const selection = createTerminalSelectionController({
|
|
1845
1875
|
terminal,
|
|
1846
1876
|
overlayTerminal: selectionOverlay,
|
|
@@ -1888,15 +1918,22 @@ const TerminalProvider = defineComponent({
|
|
|
1888
1918
|
stack: render.rootStack,
|
|
1889
1919
|
plane: "overlay",
|
|
1890
1920
|
zIndex: -1e4,
|
|
1891
|
-
rect:
|
|
1892
|
-
x: 0,
|
|
1893
|
-
y: 0,
|
|
1894
|
-
w: props.cols,
|
|
1895
|
-
h: props.rows
|
|
1896
|
-
},
|
|
1921
|
+
rect: selectionRenderRect(),
|
|
1897
1922
|
paint: selection.paint
|
|
1898
1923
|
});
|
|
1899
1924
|
selectionRenderNodeId = selectionRenderNode.id;
|
|
1925
|
+
watch(() => [
|
|
1926
|
+
selection.state.value.active,
|
|
1927
|
+
selection.state.value.hasRange,
|
|
1928
|
+
props.cols,
|
|
1929
|
+
props.rows
|
|
1930
|
+
], () => {
|
|
1931
|
+
render.update(selectionRenderNode.id, { rect: selectionRenderRect() });
|
|
1932
|
+
invalidate({
|
|
1933
|
+
plane: "overlay",
|
|
1934
|
+
reason: "selection"
|
|
1935
|
+
});
|
|
1936
|
+
});
|
|
1900
1937
|
const { portals, runtime } = createTerminalPortals(invalidate);
|
|
1901
1938
|
const rootLayout = shallowReactive({
|
|
1902
1939
|
originX: 0,
|
|
@@ -1915,6 +1952,7 @@ const TerminalProvider = defineComponent({
|
|
|
1915
1952
|
events,
|
|
1916
1953
|
scheduler: schedulerApi,
|
|
1917
1954
|
runtime,
|
|
1955
|
+
clipboard: selectionClipboard,
|
|
1918
1956
|
observability: {
|
|
1919
1957
|
trace,
|
|
1920
1958
|
framePerf
|
|
@@ -1949,6 +1987,11 @@ const TerminalProvider = defineComponent({
|
|
|
1949
1987
|
scope.run(() => {
|
|
1950
1988
|
const el = containerRef.value;
|
|
1951
1989
|
if (!el) return;
|
|
1990
|
+
const imeInput = imeRef.value;
|
|
1991
|
+
if (imeInput) {
|
|
1992
|
+
imeInput.style.left = "0px";
|
|
1993
|
+
imeInput.style.top = "0px";
|
|
1994
|
+
}
|
|
1952
1995
|
const r = createDomRenderer(terminal, el, props.domRendererOptions ?? {});
|
|
1953
1996
|
renderer.value = r;
|
|
1954
1997
|
rendererCapabilities.value = r.capabilities;
|
|
@@ -2006,12 +2049,7 @@ const TerminalProvider = defineComponent({
|
|
|
2006
2049
|
h: rows
|
|
2007
2050
|
};
|
|
2008
2051
|
selection.clear();
|
|
2009
|
-
render.update(selectionRenderNode.id, { rect:
|
|
2010
|
-
x: 0,
|
|
2011
|
-
y: 0,
|
|
2012
|
-
w: cols,
|
|
2013
|
-
h: rows
|
|
2014
|
-
} });
|
|
2052
|
+
render.update(selectionRenderNode.id, { rect: selectionRenderRect() });
|
|
2015
2053
|
clearTextCaches();
|
|
2016
2054
|
invalidate({ reason: "resize" });
|
|
2017
2055
|
});
|
|
@@ -2829,8 +2867,6 @@ const TerminalProvider = defineComponent({
|
|
|
2829
2867
|
inputmode: "text",
|
|
2830
2868
|
style: {
|
|
2831
2869
|
position: "fixed",
|
|
2832
|
-
left: "0px",
|
|
2833
|
-
top: "0px",
|
|
2834
2870
|
width: debugIme ? "240px" : "10px",
|
|
2835
2871
|
height: debugIme ? "90px" : "20px",
|
|
2836
2872
|
opacity: debugIme ? 1 : .01,
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { TMermaidAsciiOptions, TMermaidAsciiTheme, TMermaidCopyPayload, TMermaidRenderer, TMermaidRenderEligibility, TMermaidRenderEligibilityContext, TMermaidResolvedAsciiOptions, TMermaidTextProps, TMermaidTransientErrorClassifier, TMermaidTransientErrorContext, } from "../mermaid.js";
|
|
2
|
+
export { beautifulMermaidRenderer, createBeautifulMermaidRenderer, isSimpleMermaidFlowchartSource, markMermaidRenderErrorFatal, TBeautifulMermaid, TBeautifulMermaidText, TMermaid, TMermaidText, } from "../mermaid.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export type { TMermaidAsciiOptions, TMermaidAsciiTheme, TMermaidCopyPayload, TMermaidRenderer, TMermaidRenderEligibility, TMermaidRenderEligibilityContext, TMermaidResolvedAsciiOptions, TMermaidTextProps, TMermaidTransientErrorClassifier, TMermaidTransientErrorContext, } from "../mermaid.js";
|
|
2
|
+
export { beautifulMermaidRenderer, createBeautifulMermaidRenderer, isSimpleMermaidFlowchartSource, markMermaidRenderErrorFatal, TBeautifulMermaid, TBeautifulMermaidText, TMermaid, TMermaidText, } from "../mermaid.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../mermaid.js";
|