@simon_he/vue-tui 1.1.5 → 1.1.7
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 +1 -0
- package/dist/TAgentTerminalGraphic-B8-YZfuP.js +1198 -0
- package/dist/{TSelect-CMBOOFwK.js → TSelect-CCsjjCOr.js} +41 -12
- package/dist/{TTree-kk8ntrpg.js → TTree-3W5A2_EH.js} +4 -3
- package/dist/TVideo-D9AOiyq2.js +948 -0
- package/dist/agent.cjs +5204 -4312
- package/dist/agent.js +11 -9
- package/dist/{block-source-DhzajB9H.js → block-source-BhvdZomx.js} +246 -53
- package/dist/cli.cjs +41 -26
- package/dist/cli.js +68 -18
- package/dist/core.js +2 -2
- package/dist/experimental/browser.cjs +3705 -0
- package/dist/experimental/browser.d.cts +3 -0
- package/dist/experimental/browser.d.ts +3 -0
- package/dist/experimental/browser.js +413 -0
- package/dist/experimental.cjs +2 -1
- package/dist/experimental.js +9 -947
- package/dist/{linkify-CL9wwnZN.js → frame-mailbox-DaTrfyaF.js} +2 -297
- package/dist/index.cjs +25 -8
- package/dist/index.js +6 -5
- package/dist/linkify-CklfA1vp.js +298 -0
- package/dist/markdown.cjs +5196 -4322
- package/dist/markdown.js +4 -4
- package/dist/{mermaid-N3kGTHFy.js → mermaid-D0ov4_A1.js} +93 -9
- package/dist/mermaid.cjs +78 -7
- package/dist/mermaid.js +4 -4
- package/dist/{path-suggest-Dndu4dTi.js → path-suggest-fPzRsgPv.js} +1 -1
- package/dist/renderer/terminal-graphics.d.ts +1 -1
- package/dist/{terminal-graphics-2FTRg9x3.js → terminal-graphics-DpSL29OQ.js} +3 -3
- package/dist/{tlog-theme-B91Wv7Zj.js → tlog-theme-BnILsD3n.js} +10 -1203
- package/dist/vue/browser/types.d.ts +52 -0
- package/dist/vue/components/TAgentTerminalGraphic.d.ts +3 -0
- package/dist/vue/components/TBrowser.d.ts +231 -0
- package/dist/vue/components/TVirtualMarkdown.d.ts +10 -0
- package/dist/vue/markdown/render.d.ts +18 -1
- package/dist/vue.cjs +25 -8
- package/dist/vue.js +8 -7
- package/package.json +27 -2
- /package/dist/{TMermaidText-wLnMMvVS.js → TMermaidText-C1akgJPU.js} +0 -0
- /package/dist/{math-image-BZhmfUeu.js → math-image-CcUpBnW0.js} +0 -0
- /package/dist/{path-mnSgEpCm.js → path-BI9W15Zt.js} +0 -0
- /package/dist/{wheel-scroll-DASkEZr-.js → wheel-scroll-CQ22Hcyj.js} +0 -0
package/dist/cli.cjs
CHANGED
|
@@ -7299,7 +7299,7 @@ var TERMINAL_GRAPHICS_PROTOCOL_PRIORITY = [
|
|
|
7299
7299
|
"kitty",
|
|
7300
7300
|
"iterm2",
|
|
7301
7301
|
"sixel"
|
|
7302
|
-
], ESC4 = "\x1B", BEL = "\x07", ST = `${ESC4}\\`, ESC_RE = "\\u001B", BEL_RE = "\\u0007", CSI_RE = new RegExp(`${ESC_RE}\\[[0-?]*[ -/]*[@-~]`, "g"), OSC_RE = new RegExp(`${ESC_RE}\\][\\s\\S]*?(?:${BEL_RE}|${ESC_RE}\\\\)`, "g"), DCS_RE = new RegExp(`${ESC_RE}P[\\s\\S]*?${ESC_RE}\\\\`, "g"), APC_RE = new RegExp(`${ESC_RE}_[\\s\\S]*?${ESC_RE}\\\\`, "g"), C1_CSI_RE = new RegExp("\\u009B[0-?]*[ -/]*[@-~]", "g"), C1_OSC_RE = new RegExp(`\\u009D[\\s\\S]*?(?:${BEL_RE}|\\u009C)`, "g"), C1_DCS_RE = new RegExp("\\u0090[\\s\\S]*?\\u009C", "g"), C1_APC_RE = new RegExp("\\u009F[\\s\\S]*?\\u009C", "g"), MAX_TERMINAL_GRAPHICS_SEQUENCE_CHARS = 16 * 1024 * 1024, MAX_TERMINAL_GRAPHICS_FALLBACK_CHARS = 16384, MAX_TERMINAL_GRAPHIC_CELLS =
|
|
7302
|
+
], ESC4 = "\x1B", BEL = "\x07", ST = `${ESC4}\\`, ESC_RE = "\\u001B", BEL_RE = "\\u0007", CSI_RE = new RegExp(`${ESC_RE}\\[[0-?]*[ -/]*[@-~]`, "g"), OSC_RE = new RegExp(`${ESC_RE}\\][\\s\\S]*?(?:${BEL_RE}|${ESC_RE}\\\\)`, "g"), DCS_RE = new RegExp(`${ESC_RE}P[\\s\\S]*?${ESC_RE}\\\\`, "g"), APC_RE = new RegExp(`${ESC_RE}_[\\s\\S]*?${ESC_RE}\\\\`, "g"), C1_CSI_RE = new RegExp("\\u009B[0-?]*[ -/]*[@-~]", "g"), C1_OSC_RE = new RegExp(`\\u009D[\\s\\S]*?(?:${BEL_RE}|\\u009C)`, "g"), C1_DCS_RE = new RegExp("\\u0090[\\s\\S]*?\\u009C", "g"), C1_APC_RE = new RegExp("\\u009F[\\s\\S]*?\\u009C", "g"), MAX_TERMINAL_GRAPHICS_SEQUENCE_CHARS = 16 * 1024 * 1024, MAX_TERMINAL_GRAPHICS_FALLBACK_CHARS = 16384, MAX_TERMINAL_GRAPHIC_CELLS = 1e5, TERMINAL_GRAPHICS_REGISTRY = Symbol.for("@simon_he/vue-tui:v1:terminal-graphics"), terminalGraphicsGlobal = globalThis, terminalGraphicsRegistry = terminalGraphicsGlobal[TERMINAL_GRAPHICS_REGISTRY] ?? {
|
|
7303
7303
|
outputs: /* @__PURE__ */ new WeakMap(),
|
|
7304
7304
|
outputVersions: /* @__PURE__ */ new WeakMap(),
|
|
7305
7305
|
outputListeners: /* @__PURE__ */ new WeakMap()
|
|
@@ -7355,7 +7355,7 @@ function pickBestTerminalGraphicsProtocol(protocols) {
|
|
|
7355
7355
|
}
|
|
7356
7356
|
function detectCandidates(env) {
|
|
7357
7357
|
let candidates = [], term = String(envString2(env, "TERM") ?? "").toLowerCase(), termProgram = String(envString2(env, "TERM_PROGRAM") ?? "").toLowerCase(), termProgramVersion = String(envString2(env, "TERM_PROGRAM_VERSION") ?? "").toLowerCase();
|
|
7358
|
-
return (envString2(env, "KITTY_WINDOW_ID") || envString2(env, "GHOSTTY_RESOURCES_DIR") || /(?:^|-)kitty(?:-|$)/i.test(term) || term.includes("ghostty") || termProgram.includes("ghostty")
|
|
7358
|
+
return (envString2(env, "KITTY_WINDOW_ID") || envString2(env, "GHOSTTY_RESOURCES_DIR") || /(?:^|-)kitty(?:-|$)/i.test(term) || term.includes("ghostty") || termProgram.includes("ghostty") || termProgram.includes("wezterm") || envString2(env, "WEZTERM_PANE") || envString2(env, "WEZTERM_EXECUTABLE")) && candidates.push("kitty"), termProgram.includes("iterm") && candidates.push("iterm2"), (truthy(envString2(env, "VUE_TUI_SIXEL")) || truthy(envString2(env, "VUE_TUI_GRAPHICS_SIXEL")) || String(envString2(env, "TERMINAL_GRAPHICS") ?? "").toLowerCase().includes("sixel") || /\bsixel\b/i.test(`${term} ${termProgram} ${termProgramVersion}`)) && candidates.push("sixel"), uniqueProtocols(candidates);
|
|
7359
7359
|
}
|
|
7360
7360
|
function capabilitiesFor(protocol, input) {
|
|
7361
7361
|
let supported = protocol === "kitty" || protocol === "iterm2" || protocol === "sixel", candidates = uniqueProtocols([...input.candidates ?? (supported ? [protocol] : [])]);
|
|
@@ -8000,7 +8000,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
8000
8000
|
return "multi-span";
|
|
8001
8001
|
}
|
|
8002
8002
|
}
|
|
8003
|
-
let effectiveDirtyRowPatchMode = resolveEffectiveDirtyRowPatchMode(), shouldUseDirtySpans = () => effectiveDirtyRowPatchMode !== "row", shouldUseMultiDirtySpans = () => effectiveDirtyRowPatchMode === "multi-span", enableOsc8Links = outputAllowsOsc8Links && !isVscodeTerminal, renderedHref = (value) => enableOsc8Links ? normalizeHref(value) : null, disposed = !1, lastFrameTime = 0, pendingRender = !1, renderTimer = null, rowsOnlyResizeRepaintTimer = null, writeEmaMs = 0, lastCursorX = null, lastCursorY = null, accumulatedAllRows = !1, accumulatedDirtyBits = null, accumulatedDirtyCount = 0, accumulatedDirtyMin = Number.POSITIVE_INFINITY, accumulatedDirtyMax = -1, accumulatedDirtyRowsRequireRepaint = !1, accumulatedScrollOperations = null, allowNextGraphicsOnlyRenderWithoutBaseline = !1, preserveNextRowsOnlyResizeBaseline = !1, deferGraphicsFlushUntilResizeCommit = !1, graphicsCapabilities = resolveTerminalGraphicsCapabilities(options, env, outputIsTTY), pendingGraphics = /* @__PURE__ */ new Map(), pendingGraphicClears = /* @__PURE__ */ new Set(), activeGraphics = /* @__PURE__ */ new Map(), pendingGraphicSignatures = /* @__PURE__ */ new Map(), activeGraphicSignatures = /* @__PURE__ */ new Map(), retainedGraphics = /* @__PURE__ */ new Map(), knownKittyImageIds = /* @__PURE__ */ new Set(), terminalResizeDirtyGraphics = /* @__PURE__ */ new Set(), nextGraphicsOrder = 0, terminalGraphicsFlushTimer = null, hasPendingTerminalGraphics = () => pendingGraphics.size > 0 || pendingGraphicClears.size > 0;
|
|
8003
|
+
let effectiveDirtyRowPatchMode = resolveEffectiveDirtyRowPatchMode(), shouldUseDirtySpans = () => effectiveDirtyRowPatchMode !== "row", shouldUseMultiDirtySpans = () => effectiveDirtyRowPatchMode === "multi-span", enableOsc8Links = outputAllowsOsc8Links && !isVscodeTerminal, renderedHref = (value) => enableOsc8Links ? normalizeHref(value) : null, disposed = !1, lastFrameTime = 0, pendingRender = !1, renderTimer = null, rowsOnlyResizeRepaintTimer = null, writeEmaMs = 0, lastCursorX = null, lastCursorY = null, accumulatedAllRows = !1, accumulatedDirtyBits = null, accumulatedDirtyCount = 0, accumulatedDirtyMin = Number.POSITIVE_INFINITY, accumulatedDirtyMax = -1, accumulatedDirtyRowsRequireRepaint = !1, accumulatedScrollOperations = null, allowNextGraphicsOnlyRenderWithoutBaseline = !1, preserveNextRowsOnlyResizeBaseline = !1, deferGraphicsFlushUntilResizeCommit = !1, graphicsCapabilities = resolveTerminalGraphicsCapabilities(options, env, outputIsTTY), pendingGraphics = /* @__PURE__ */ new Map(), pendingGraphicClears = /* @__PURE__ */ new Set(), activeGraphics = /* @__PURE__ */ new Map(), pendingGraphicSignatures = /* @__PURE__ */ new Map(), activeGraphicSignatures = /* @__PURE__ */ new Map(), validatedGraphicFrames = /* @__PURE__ */ new Map(), graphicSequenceHashes = /* @__PURE__ */ new Map(), retainedGraphics = /* @__PURE__ */ new Map(), knownKittyImageIds = /* @__PURE__ */ new Set(), terminalResizeDirtyGraphics = /* @__PURE__ */ new Set(), nextGraphicsOrder = 0, terminalGraphicsFlushTimer = null, hasPendingTerminalGraphics = () => pendingGraphics.size > 0 || pendingGraphicClears.size > 0;
|
|
8004
8004
|
function canUseTerminalGraphicsProtocol(protocol, capabilities) {
|
|
8005
8005
|
return capabilities.supported && isTerminalGraphicsProtocol(protocol) && protocol === capabilities.preferredProtocol;
|
|
8006
8006
|
}
|
|
@@ -8020,16 +8020,24 @@ function createStdoutRenderer(terminal, options) {
|
|
|
8020
8020
|
}
|
|
8021
8021
|
}
|
|
8022
8022
|
function terminalGraphicsPayloadSignature(payload) {
|
|
8023
|
-
|
|
8023
|
+
let cached = graphicSequenceHashes.get(payload.id), resizeSequence = payload.resizeSequence ?? "", clearSequence = payload.clearSequence ?? "", hashes = cached && cached.sequence === payload.sequence && cached.resizeSequence === resizeSequence && cached.clearSequence === clearSequence ? cached : {
|
|
8024
|
+
sequence: payload.sequence,
|
|
8025
|
+
resizeSequence,
|
|
8026
|
+
clearSequence,
|
|
8027
|
+
sequenceHash: hashTerminalGraphicsString(payload.sequence),
|
|
8028
|
+
resizeSequenceHash: hashTerminalGraphicsString(resizeSequence),
|
|
8029
|
+
clearSequenceHash: hashTerminalGraphicsString(clearSequence)
|
|
8030
|
+
};
|
|
8031
|
+
return hashes !== cached && graphicSequenceHashes.set(payload.id, hashes), [
|
|
8024
8032
|
payload.id,
|
|
8025
8033
|
payload.protocol,
|
|
8026
8034
|
payload.x,
|
|
8027
8035
|
payload.y,
|
|
8028
8036
|
payload.w ?? "",
|
|
8029
8037
|
payload.h ?? "",
|
|
8030
|
-
|
|
8031
|
-
|
|
8032
|
-
|
|
8038
|
+
hashes.sequenceHash,
|
|
8039
|
+
hashes.resizeSequenceHash,
|
|
8040
|
+
hashes.clearSequenceHash,
|
|
8033
8041
|
payload.allowTextOverlay ? "1" : "0"
|
|
8034
8042
|
].join(":");
|
|
8035
8043
|
}
|
|
@@ -8095,6 +8103,10 @@ function createStdoutRenderer(terminal, options) {
|
|
|
8095
8103
|
}
|
|
8096
8104
|
return null;
|
|
8097
8105
|
}
|
|
8106
|
+
function sameKittyImage(a, b) {
|
|
8107
|
+
let aId = kittyImageId(a);
|
|
8108
|
+
return aId != null && aId === kittyImageId(b);
|
|
8109
|
+
}
|
|
8098
8110
|
function canReplaceKittyPlacementWithoutClear(previous, payload) {
|
|
8099
8111
|
if (payload.terminalResizeRedraw || !payload.resizeRedraw || previous.protocol !== "kitty" || payload.protocol !== "kitty")
|
|
8100
8112
|
return !1;
|
|
@@ -8113,7 +8125,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
8113
8125
|
pendingGraphicSignatures.delete(id), terminalResizeDirtyGraphics.delete(id);
|
|
8114
8126
|
let active = activeGraphics.get(id);
|
|
8115
8127
|
if (!active)
|
|
8116
|
-
return options2.retainOnClear || retainedGraphics.delete(id), removedPendingDraw;
|
|
8128
|
+
return options2.retainOnClear || (retainedGraphics.delete(id), validatedGraphicFrames.delete(id), graphicSequenceHashes.delete(id)), removedPendingDraw;
|
|
8117
8129
|
if (active.clearSequence) {
|
|
8118
8130
|
let payload = {
|
|
8119
8131
|
id,
|
|
@@ -8155,7 +8167,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
8155
8167
|
);
|
|
8156
8168
|
for (let payload of pendingGraphics.values())
|
|
8157
8169
|
rememberImageId(payload.sequence, payload.resizeSequence, payload.clearSequence);
|
|
8158
|
-
pendingGraphics.clear(), pendingGraphicClears.clear(), activeGraphics.clear(), pendingGraphicSignatures.clear(), activeGraphicSignatures.clear(), retainedGraphics.clear(), knownKittyImageIds.clear(), terminalResizeDirtyGraphics.clear();
|
|
8170
|
+
pendingGraphics.clear(), pendingGraphicClears.clear(), activeGraphics.clear(), pendingGraphicSignatures.clear(), activeGraphicSignatures.clear(), retainedGraphics.clear(), validatedGraphicFrames.clear(), graphicSequenceHashes.clear(), knownKittyImageIds.clear(), terminalResizeDirtyGraphics.clear();
|
|
8159
8171
|
for (let imageId of imageIds) {
|
|
8160
8172
|
let payload = {
|
|
8161
8173
|
id: `__terminal_graphics_clear_image_${imageId}__`,
|
|
@@ -8263,16 +8275,17 @@ function createStdoutRenderer(terminal, options) {
|
|
|
8263
8275
|
if (!normalized.id.trim() || !Number.isFinite(normalized.x) || !Number.isFinite(normalized.y) || !canUseTerminalGraphicsProtocol(normalized.protocol, graphicsCapabilities))
|
|
8264
8276
|
return !1;
|
|
8265
8277
|
if (op === "draw") {
|
|
8266
|
-
let frame = validateTerminalGraphicFrame({
|
|
8278
|
+
let cachedFrame = validatedGraphicFrames.get(normalized.id), width = normalized.w ?? 1, height = normalized.h ?? 1, frame = cachedFrame && cachedFrame.protocol === normalized.protocol && cachedFrame.sequence === normalized.sequence && cachedFrame.width === width && cachedFrame.height === height && cachedFrame.fallbackText === (normalized.fallbackText ?? "") ? cachedFrame : validateTerminalGraphicFrame({
|
|
8267
8279
|
id: normalized.id,
|
|
8268
8280
|
protocol: normalized.protocol,
|
|
8269
8281
|
sequence: normalized.sequence,
|
|
8270
8282
|
fallbackText: normalized.fallbackText,
|
|
8271
|
-
width
|
|
8272
|
-
height
|
|
8283
|
+
width,
|
|
8284
|
+
height
|
|
8273
8285
|
});
|
|
8274
8286
|
if (!frame)
|
|
8275
8287
|
return !1;
|
|
8288
|
+
frame !== cachedFrame && validatedGraphicFrames.set(frame.id, frame);
|
|
8276
8289
|
let imageId = kittyImageId(frame.sequence) ?? kittyImageId(normalized.resizeSequence);
|
|
8277
8290
|
if (imageId != null && knownKittyImageIds.add(imageId), isDebugEnabled()) {
|
|
8278
8291
|
let size = terminal.size();
|
|
@@ -8317,7 +8330,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
8317
8330
|
}), isDebugEnabled() && getDebugLog().render(
|
|
8318
8331
|
`terminal graphic queue draw canceled clear: id=${frame.id}, x=${normalized.x}, y=${normalized.y}, w=${frame.width}, h=${frame.height}`
|
|
8319
8332
|
), !0;
|
|
8320
|
-
let active = activeGraphics.get(frame.id), activeCanReplacePlacement = active && active.sequence === frame.sequence && resizeSequence && canReplaceKittyPlacementWithoutClear(active, {
|
|
8333
|
+
let active = activeGraphics.get(frame.id), activeCanReplacePlacement = active && (active.sequence === frame.sequence || normalized.placementMoveWithoutClear && sameKittyImage(active.sequence, frame.sequence)) && resizeSequence && canReplaceKittyPlacementWithoutClear(active, {
|
|
8321
8334
|
...normalized,
|
|
8322
8335
|
id: frame.id,
|
|
8323
8336
|
w: frame.width,
|
|
@@ -8351,7 +8364,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
8351
8364
|
protocol: normalized.protocol,
|
|
8352
8365
|
bytes: resizeSequence.length
|
|
8353
8366
|
}), requestTerminalGraphicsFlush(!!normalized.deferFlush), !0;
|
|
8354
|
-
let retained = retainedGraphics.get(frame.id), retainedCanReplacePlacement = retained && retained.active.sequence === frame.sequence && resizeSequence && canReplaceKittyPlacementWithoutClear(retained.active, {
|
|
8367
|
+
let retained = retainedGraphics.get(frame.id), retainedCanReplacePlacement = retained && (retained.active.sequence === frame.sequence || normalized.placementMoveWithoutClear && sameKittyImage(retained.active.sequence, frame.sequence)) && resizeSequence && canReplaceKittyPlacementWithoutClear(retained.active, {
|
|
8355
8368
|
...normalized,
|
|
8356
8369
|
id: frame.id,
|
|
8357
8370
|
w: frame.width,
|
|
@@ -8373,7 +8386,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
8373
8386
|
clearSequence,
|
|
8374
8387
|
fallbackText: frame.fallbackText,
|
|
8375
8388
|
resizeRedraw: !0,
|
|
8376
|
-
placementMoveWithoutClear:
|
|
8389
|
+
placementMoveWithoutClear: !!normalized.placementMoveWithoutClear,
|
|
8377
8390
|
terminalResizeRedraw: forceTerminalResizeRedraw
|
|
8378
8391
|
}), pendingGraphicSignatures.set(frame.id, signature), isDebugEnabled() && getDebugLog().render(
|
|
8379
8392
|
`terminal graphic retained resize redraw: id=${frame.id}, x=${retained.active.x}, y=${retained.active.y}, w=${retained.active.w}, h=${retained.active.h}, bytes=${resizeSequence.length}`
|
|
@@ -9092,7 +9105,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
9092
9105
|
}
|
|
9093
9106
|
return end > start ? end : codePointEnd(data, start);
|
|
9094
9107
|
};
|
|
9095
|
-
function writeChunked(data) {
|
|
9108
|
+
function writeChunked(data, pin) {
|
|
9096
9109
|
if (import_node_buffer3.Buffer.byteLength(data, "utf8") <= chunkSize) {
|
|
9097
9110
|
out.write(data);
|
|
9098
9111
|
return;
|
|
@@ -9102,8 +9115,8 @@ function createStdoutRenderer(terminal, options) {
|
|
|
9102
9115
|
);
|
|
9103
9116
|
try {
|
|
9104
9117
|
for (let start = 0; start < data.length; ) {
|
|
9105
|
-
let end = safeChunkEnd(data, start, chunkSize);
|
|
9106
|
-
out.write(data.
|
|
9118
|
+
let end = safeChunkEnd(data, start, chunkSize), chunk = data.slice(start, end);
|
|
9119
|
+
out.write(end >= data.length || !pin ? chunk : `${chunk}${pin}`), start = end;
|
|
9107
9120
|
}
|
|
9108
9121
|
isDebugEnabled() && getDebugLog().render("writeChunked: chunked write completed");
|
|
9109
9122
|
} catch (e) {
|
|
@@ -9743,7 +9756,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
9743
9756
|
return opA - opB || a.order - b.order;
|
|
9744
9757
|
}), graphicsToRender = graphicsEntriesToRender.map(([, payload]) => payload));
|
|
9745
9758
|
})(), graphicsClearsToRender.length > 0 || graphicsToRender.length > 0) {
|
|
9746
|
-
let nextActiveGraphics = new Map(activeGraphics), nextActiveGraphicSignatures = new Map(activeGraphicSignatures), nextPendingGraphicSignatures = new Map(pendingGraphicSignatures), terminalGraphicsDraws = 0, terminalGraphicsClears = 0, terminalGraphicsBytes = 0, countGraphicsBytes = (value) => (terminalGraphicsBytes += import_node_buffer3.Buffer.byteLength(value, "utf8"), value), appendTerminalGraphicSequenceAt = (sequence, rect, fallbackCell, skipWithoutRect = !1) => {
|
|
9759
|
+
let nextActiveGraphics = new Map(activeGraphics), nextActiveGraphicSignatures = new Map(activeGraphicSignatures), nextPendingGraphicSignatures = new Map(pendingGraphicSignatures), clearedGraphicCacheIds = /* @__PURE__ */ new Set(), terminalGraphicsDraws = 0, terminalGraphicsClears = 0, terminalGraphicsBytes = 0, countGraphicsBytes = (value) => (terminalGraphicsBytes += import_node_buffer3.Buffer.byteLength(value, "utf8"), value), appendTerminalGraphicSequenceAt = (sequence, rect, fallbackCell, skipWithoutRect = !1) => {
|
|
9747
9760
|
if (!rect && skipWithoutRect)
|
|
9748
9761
|
return !1;
|
|
9749
9762
|
let cell = rect ? { x: rect.x, y: rect.y } : clampCellToViewport(fallbackCell, size);
|
|
@@ -9784,7 +9797,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
9784
9797
|
let clearRect2 = clearGraphicRectForRowsNotPainted(visibleRect);
|
|
9785
9798
|
clearRect2 && (frameParts.push(countGraphicsBytes(clearRect2)), wroteClear = !0);
|
|
9786
9799
|
}
|
|
9787
|
-
wroteClear = appendActiveGraphicProtocolClear(active, visibleRect) || wroteClear, wroteClear && terminalGraphicsClears++, retainedGraphics.delete(id), terminalResizeDirtyGraphics.delete(id), nextActiveGraphics.delete(id), nextActiveGraphicSignatures.delete(id), nextPendingGraphicSignatures.delete(id);
|
|
9800
|
+
wroteClear = appendActiveGraphicProtocolClear(active, visibleRect) || wroteClear, wroteClear && terminalGraphicsClears++, retainedGraphics.delete(id), clearedGraphicCacheIds.add(id), terminalResizeDirtyGraphics.delete(id), nextActiveGraphics.delete(id), nextActiveGraphicSignatures.delete(id), nextPendingGraphicSignatures.delete(id);
|
|
9788
9801
|
}
|
|
9789
9802
|
for (let payload of graphicsToRender) {
|
|
9790
9803
|
if (payload.op === "clear") {
|
|
@@ -9809,7 +9822,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
9809
9822
|
cellY: (active == null ? void 0 : active.y) ?? payload.y
|
|
9810
9823
|
},
|
|
9811
9824
|
clearSequenceNeedsVisibleCell(payload.sequence, payload.protocol)
|
|
9812
|
-
) || wroteClear, wroteClear && terminalGraphicsClears++, active && payload.retainOnClear ? retainTerminalGraphic(payload.id, active, nextActiveGraphicSignatures.get(payload.id)) : retainedGraphics.delete(payload.id), terminalResizeDirtyGraphics.delete(payload.id), nextActiveGraphics.delete(payload.id), nextActiveGraphicSignatures.delete(payload.id), nextPendingGraphicSignatures.delete(payload.id);
|
|
9825
|
+
) || wroteClear, wroteClear && terminalGraphicsClears++, active && payload.retainOnClear ? retainTerminalGraphic(payload.id, active, nextActiveGraphicSignatures.get(payload.id)) : (retainedGraphics.delete(payload.id), clearedGraphicCacheIds.add(payload.id)), terminalResizeDirtyGraphics.delete(payload.id), nextActiveGraphics.delete(payload.id), nextActiveGraphicSignatures.delete(payload.id), nextPendingGraphicSignatures.delete(payload.id);
|
|
9813
9826
|
continue;
|
|
9814
9827
|
}
|
|
9815
9828
|
let previous = nextActiveGraphics.get(payload.id), rect = anchoredGraphicRectInViewport(
|
|
@@ -9880,6 +9893,8 @@ function createStdoutRenderer(terminal, options) {
|
|
|
9880
9893
|
pendingGraphicSignatures.clear();
|
|
9881
9894
|
for (let [id, signature] of nextPendingGraphicSignatures)
|
|
9882
9895
|
pendingGraphicSignatures.set(id, signature);
|
|
9896
|
+
for (let id of clearedGraphicCacheIds)
|
|
9897
|
+
nextActiveGraphics.has(id) || retainedGraphics.has(id) || (validatedGraphicFrames.delete(id), graphicSequenceHashes.delete(id));
|
|
9883
9898
|
}, terminalGraphicsMetrics = {
|
|
9884
9899
|
draws: terminalGraphicsDraws,
|
|
9885
9900
|
clears: terminalGraphicsClears,
|
|
@@ -9889,12 +9904,12 @@ function createStdoutRenderer(terminal, options) {
|
|
|
9889
9904
|
`terminal graphics frame: draws=${terminalGraphicsDraws}, clears=${terminalGraphicsClears}, bytes=${terminalGraphicsBytes}, activeNext=${nextActiveGraphics.size}`
|
|
9890
9905
|
);
|
|
9891
9906
|
}
|
|
9892
|
-
let emittedCursorPos = null;
|
|
9907
|
+
let emittedCursorPos = null, frameCursorPin = null;
|
|
9893
9908
|
if (getImeAnchor) {
|
|
9894
9909
|
let anchor = getImeAnchor();
|
|
9895
9910
|
if (anchor) {
|
|
9896
|
-
let { x, y } = clampCellToViewport(anchor, size)
|
|
9897
|
-
(hasFrameOutput || x !== lastCursorX || y !== lastCursorY) && (hasFrameOutput = !0, emittedCursorPos = { x, y }, closeActiveHrefBeforeCursorMove(), frameParts.push(
|
|
9911
|
+
let { x, y } = clampCellToViewport(anchor, size), cursorSequence = `\x1B[${y + 1 + rowOffset};${x + 1}H`;
|
|
9912
|
+
frameCursorPin = cursorSequence, (hasFrameOutput || x !== lastCursorX || y !== lastCursorY) && (hasFrameOutput = !0, emittedCursorPos = { x, y }, closeActiveHrefBeforeCursorMove(), frameParts.push(cursorSequence));
|
|
9898
9913
|
}
|
|
9899
9914
|
}
|
|
9900
9915
|
if (!hasFrameOutput) {
|
|
@@ -9957,7 +9972,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
9957
9972
|
if (writeMode === "chunked")
|
|
9958
9973
|
isDebugEnabled() && getDebugLog().render(
|
|
9959
9974
|
` Using chunked write (chunkSize=${chunkSize}, threshold=${chunkThresholdBytes}, emaMs=${writeEmaMs.toFixed(2)})`
|
|
9960
|
-
), writeChunked(frame);
|
|
9975
|
+
), writeChunked(frame, frameCursorPin);
|
|
9961
9976
|
else if (writeMode === "sync" && canUseSyncStdout) {
|
|
9962
9977
|
isDebugEnabled() && getDebugLog().render(" Using writeSync");
|
|
9963
9978
|
try {
|
|
@@ -10275,7 +10290,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10275
10290
|
return;
|
|
10276
10291
|
disposed = !0;
|
|
10277
10292
|
let disposeError = null;
|
|
10278
|
-
renderTimer && (clearTimeout(renderTimer), renderTimer = null), terminalGraphicsFlushTimer && (clearTimeout(terminalGraphicsFlushTimer), terminalGraphicsFlushTimer = null), clearRowsOnlyResizeRepaintTimer(), accumulatedAllRows = !1, accumulatedDirtyBits = null, accumulatedDirtyCount = 0, accumulatedDirtyMin = Number.POSITIVE_INFINITY, accumulatedDirtyMax = -1, accumulatedDirtyRowsRequireRepaint = !1, pendingGraphics.clear(), pendingGraphicClears.clear(), pendingGraphicSignatures.clear(), retainedGraphics.clear(), knownKittyImageIds.clear(), terminalResizeDirtyGraphics.clear();
|
|
10293
|
+
renderTimer && (clearTimeout(renderTimer), renderTimer = null), terminalGraphicsFlushTimer && (clearTimeout(terminalGraphicsFlushTimer), terminalGraphicsFlushTimer = null), clearRowsOnlyResizeRepaintTimer(), accumulatedAllRows = !1, accumulatedDirtyBits = null, accumulatedDirtyCount = 0, accumulatedDirtyMin = Number.POSITIVE_INFINITY, accumulatedDirtyMax = -1, accumulatedDirtyRowsRequireRepaint = !1, pendingGraphics.clear(), pendingGraphicClears.clear(), pendingGraphicSignatures.clear(), retainedGraphics.clear(), validatedGraphicFrames.clear(), graphicSequenceHashes.clear(), knownKittyImageIds.clear(), terminalResizeDirtyGraphics.clear();
|
|
10279
10294
|
try {
|
|
10280
10295
|
if (activeGraphics.size > 0) {
|
|
10281
10296
|
let size = terminal.size(), clearParts = [], terminalGraphicsClears = 0;
|
package/dist/cli.js
CHANGED
|
@@ -9267,7 +9267,7 @@ const C1_DCS_RE = new RegExp("\\u0090[\\s\\S]*?\\u009C", "g");
|
|
|
9267
9267
|
const C1_APC_RE = new RegExp("\\u009F[\\s\\S]*?\\u009C", "g");
|
|
9268
9268
|
const MAX_TERMINAL_GRAPHICS_SEQUENCE_CHARS = 16 * 1024 * 1024;
|
|
9269
9269
|
const MAX_TERMINAL_GRAPHICS_FALLBACK_CHARS = 16384;
|
|
9270
|
-
const MAX_TERMINAL_GRAPHIC_CELLS =
|
|
9270
|
+
const MAX_TERMINAL_GRAPHIC_CELLS = 1e5;
|
|
9271
9271
|
const TERMINAL_GRAPHICS_REGISTRY = Symbol.for("@simon_he/vue-tui:v1:terminal-graphics");
|
|
9272
9272
|
const terminalGraphicsGlobal = globalThis;
|
|
9273
9273
|
const terminalGraphicsRegistry = terminalGraphicsGlobal[TERMINAL_GRAPHICS_REGISTRY] ?? {
|
|
@@ -9335,8 +9335,8 @@ function detectCandidates(env) {
|
|
|
9335
9335
|
const term = String(envString(env, "TERM") ?? "").toLowerCase();
|
|
9336
9336
|
const termProgram = String(envString(env, "TERM_PROGRAM") ?? "").toLowerCase();
|
|
9337
9337
|
const termProgramVersion = String(envString(env, "TERM_PROGRAM_VERSION") ?? "").toLowerCase();
|
|
9338
|
-
if (envString(env, "KITTY_WINDOW_ID") || envString(env, "GHOSTTY_RESOURCES_DIR") || /(?:^|-)kitty(?:-|$)/i.test(term) || term.includes("ghostty") || termProgram.includes("ghostty")) candidates.push("kitty");
|
|
9339
|
-
if (termProgram.includes("iterm")
|
|
9338
|
+
if (envString(env, "KITTY_WINDOW_ID") || envString(env, "GHOSTTY_RESOURCES_DIR") || /(?:^|-)kitty(?:-|$)/i.test(term) || term.includes("ghostty") || termProgram.includes("ghostty") || termProgram.includes("wezterm") || envString(env, "WEZTERM_PANE") || envString(env, "WEZTERM_EXECUTABLE")) candidates.push("kitty");
|
|
9339
|
+
if (termProgram.includes("iterm")) candidates.push("iterm2");
|
|
9340
9340
|
if (truthy(envString(env, "VUE_TUI_SIXEL")) || truthy(envString(env, "VUE_TUI_GRAPHICS_SIXEL")) || String(envString(env, "TERMINAL_GRAPHICS") ?? "").toLowerCase().includes("sixel") || /\bsixel\b/i.test(`${term} ${termProgram} ${termProgramVersion}`)) candidates.push("sixel");
|
|
9341
9341
|
return uniqueProtocols(candidates);
|
|
9342
9342
|
}
|
|
@@ -10096,6 +10096,8 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10096
10096
|
const activeGraphics = new Map();
|
|
10097
10097
|
const pendingGraphicSignatures = new Map();
|
|
10098
10098
|
const activeGraphicSignatures = new Map();
|
|
10099
|
+
const validatedGraphicFrames = new Map();
|
|
10100
|
+
const graphicSequenceHashes = new Map();
|
|
10099
10101
|
const retainedGraphics = new Map();
|
|
10100
10102
|
const knownKittyImageIds = new Set();
|
|
10101
10103
|
const terminalResizeDirtyGraphics = new Set();
|
|
@@ -10122,6 +10124,18 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10122
10124
|
}, 0);
|
|
10123
10125
|
}
|
|
10124
10126
|
function terminalGraphicsPayloadSignature(payload) {
|
|
10127
|
+
const cached = graphicSequenceHashes.get(payload.id);
|
|
10128
|
+
const resizeSequence = payload.resizeSequence ?? "";
|
|
10129
|
+
const clearSequence = payload.clearSequence ?? "";
|
|
10130
|
+
const hashes = cached && cached.sequence === payload.sequence && cached.resizeSequence === resizeSequence && cached.clearSequence === clearSequence ? cached : {
|
|
10131
|
+
sequence: payload.sequence,
|
|
10132
|
+
resizeSequence,
|
|
10133
|
+
clearSequence,
|
|
10134
|
+
sequenceHash: hashTerminalGraphicsString(payload.sequence),
|
|
10135
|
+
resizeSequenceHash: hashTerminalGraphicsString(resizeSequence),
|
|
10136
|
+
clearSequenceHash: hashTerminalGraphicsString(clearSequence)
|
|
10137
|
+
};
|
|
10138
|
+
if (hashes !== cached) graphicSequenceHashes.set(payload.id, hashes);
|
|
10125
10139
|
return [
|
|
10126
10140
|
payload.id,
|
|
10127
10141
|
payload.protocol,
|
|
@@ -10129,9 +10143,9 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10129
10143
|
payload.y,
|
|
10130
10144
|
payload.w ?? "",
|
|
10131
10145
|
payload.h ?? "",
|
|
10132
|
-
|
|
10133
|
-
|
|
10134
|
-
|
|
10146
|
+
hashes.sequenceHash,
|
|
10147
|
+
hashes.resizeSequenceHash,
|
|
10148
|
+
hashes.clearSequenceHash,
|
|
10135
10149
|
payload.allowTextOverlay ? "1" : "0"
|
|
10136
10150
|
].join(":");
|
|
10137
10151
|
}
|
|
@@ -10196,6 +10210,10 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10196
10210
|
}
|
|
10197
10211
|
return null;
|
|
10198
10212
|
}
|
|
10213
|
+
function sameKittyImage(a, b) {
|
|
10214
|
+
const aId = kittyImageId(a);
|
|
10215
|
+
return aId != null && aId === kittyImageId(b);
|
|
10216
|
+
}
|
|
10199
10217
|
function canReplaceKittyPlacementWithoutClear(previous, payload) {
|
|
10200
10218
|
if (payload.terminalResizeRedraw) return false;
|
|
10201
10219
|
if (!payload.resizeRedraw || previous.protocol !== "kitty" || payload.protocol !== "kitty") return false;
|
|
@@ -10215,7 +10233,11 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10215
10233
|
terminalResizeDirtyGraphics.delete(id);
|
|
10216
10234
|
const active = activeGraphics.get(id);
|
|
10217
10235
|
if (!active) {
|
|
10218
|
-
if (!options$1.retainOnClear)
|
|
10236
|
+
if (!options$1.retainOnClear) {
|
|
10237
|
+
retainedGraphics.delete(id);
|
|
10238
|
+
validatedGraphicFrames.delete(id);
|
|
10239
|
+
graphicSequenceHashes.delete(id);
|
|
10240
|
+
}
|
|
10219
10241
|
return removedPendingDraw;
|
|
10220
10242
|
}
|
|
10221
10243
|
if (active.clearSequence) {
|
|
@@ -10273,6 +10295,8 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10273
10295
|
pendingGraphicSignatures.clear();
|
|
10274
10296
|
activeGraphicSignatures.clear();
|
|
10275
10297
|
retainedGraphics.clear();
|
|
10298
|
+
validatedGraphicFrames.clear();
|
|
10299
|
+
graphicSequenceHashes.clear();
|
|
10276
10300
|
knownKittyImageIds.clear();
|
|
10277
10301
|
terminalResizeDirtyGraphics.clear();
|
|
10278
10302
|
for (const imageId of imageIds) {
|
|
@@ -10397,15 +10421,19 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10397
10421
|
if (!Number.isFinite(normalized.x) || !Number.isFinite(normalized.y)) return false;
|
|
10398
10422
|
if (!canUseTerminalGraphicsProtocol(normalized.protocol, graphicsCapabilities)) return false;
|
|
10399
10423
|
if (op === "draw") {
|
|
10400
|
-
const
|
|
10424
|
+
const cachedFrame = validatedGraphicFrames.get(normalized.id);
|
|
10425
|
+
const width = normalized.w ?? 1;
|
|
10426
|
+
const height = normalized.h ?? 1;
|
|
10427
|
+
const frame = cachedFrame && cachedFrame.protocol === normalized.protocol && cachedFrame.sequence === normalized.sequence && cachedFrame.width === width && cachedFrame.height === height && cachedFrame.fallbackText === (normalized.fallbackText ?? "") ? cachedFrame : validateTerminalGraphicFrame({
|
|
10401
10428
|
id: normalized.id,
|
|
10402
10429
|
protocol: normalized.protocol,
|
|
10403
10430
|
sequence: normalized.sequence,
|
|
10404
10431
|
fallbackText: normalized.fallbackText,
|
|
10405
|
-
width
|
|
10406
|
-
height
|
|
10432
|
+
width,
|
|
10433
|
+
height
|
|
10407
10434
|
});
|
|
10408
10435
|
if (!frame) return false;
|
|
10436
|
+
if (frame !== cachedFrame) validatedGraphicFrames.set(frame.id, frame);
|
|
10409
10437
|
const imageId = kittyImageId(frame.sequence) ?? kittyImageId(normalized.resizeSequence);
|
|
10410
10438
|
if (imageId != null) knownKittyImageIds.add(imageId);
|
|
10411
10439
|
if (isDebugEnabled()) {
|
|
@@ -10459,7 +10487,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10459
10487
|
return true;
|
|
10460
10488
|
}
|
|
10461
10489
|
const active = activeGraphics.get(frame.id);
|
|
10462
|
-
const activeCanReplacePlacement = active && active.sequence === frame.sequence && resizeSequence && canReplaceKittyPlacementWithoutClear(active, {
|
|
10490
|
+
const activeCanReplacePlacement = active && (active.sequence === frame.sequence || normalized.placementMoveWithoutClear && sameKittyImage(active.sequence, frame.sequence)) && resizeSequence && canReplaceKittyPlacementWithoutClear(active, {
|
|
10463
10491
|
...normalized,
|
|
10464
10492
|
id: frame.id,
|
|
10465
10493
|
w: frame.width,
|
|
@@ -10495,7 +10523,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10495
10523
|
return true;
|
|
10496
10524
|
}
|
|
10497
10525
|
const retained = retainedGraphics.get(frame.id);
|
|
10498
|
-
const retainedCanReplacePlacement = retained && retained.active.sequence === frame.sequence && resizeSequence && canReplaceKittyPlacementWithoutClear(retained.active, {
|
|
10526
|
+
const retainedCanReplacePlacement = retained && (retained.active.sequence === frame.sequence || normalized.placementMoveWithoutClear && sameKittyImage(retained.active.sequence, frame.sequence)) && resizeSequence && canReplaceKittyPlacementWithoutClear(retained.active, {
|
|
10499
10527
|
...normalized,
|
|
10500
10528
|
id: frame.id,
|
|
10501
10529
|
w: frame.width,
|
|
@@ -10521,7 +10549,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
10521
10549
|
clearSequence,
|
|
10522
10550
|
fallbackText: frame.fallbackText,
|
|
10523
10551
|
resizeRedraw: true,
|
|
10524
|
-
placementMoveWithoutClear:
|
|
10552
|
+
placementMoveWithoutClear: Boolean(normalized.placementMoveWithoutClear),
|
|
10525
10553
|
terminalResizeRedraw: forceTerminalResizeRedraw
|
|
10526
10554
|
});
|
|
10527
10555
|
pendingGraphicSignatures.set(frame.id, signature);
|
|
@@ -11518,8 +11546,14 @@ function createStdoutRenderer(terminal, options) {
|
|
|
11518
11546
|
/**
|
|
11519
11547
|
* Write data in chunks to avoid overwhelming terminal buffers.
|
|
11520
11548
|
* This is especially important for ghostty which can hang on large writes.
|
|
11549
|
+
*
|
|
11550
|
+
* `pin` is appended after every chunk but the last. A host may observe the
|
|
11551
|
+
* terminal between two writes (macOS asks for the IME rect when the marked text
|
|
11552
|
+
* changes), and a chunk boundary would otherwise expose the cell of the last
|
|
11553
|
+
* painted row instead of the frame's IME cursor, while the preedit — rendered
|
|
11554
|
+
* only when the frame's synchronized output ends — stays on that cursor.
|
|
11521
11555
|
*/
|
|
11522
|
-
function writeChunked(data) {
|
|
11556
|
+
function writeChunked(data, pin) {
|
|
11523
11557
|
if (Buffer.byteLength(data, "utf8") <= chunkSize) {
|
|
11524
11558
|
out.write(data);
|
|
11525
11559
|
return;
|
|
@@ -11528,7 +11562,8 @@ function createStdoutRenderer(terminal, options) {
|
|
|
11528
11562
|
try {
|
|
11529
11563
|
for (let start = 0; start < data.length;) {
|
|
11530
11564
|
const end = safeChunkEnd(data, start, chunkSize);
|
|
11531
|
-
|
|
11565
|
+
const chunk = data.slice(start, end);
|
|
11566
|
+
out.write(end >= data.length || !pin ? chunk : `${chunk}${pin}`);
|
|
11532
11567
|
start = end;
|
|
11533
11568
|
}
|
|
11534
11569
|
if (isDebugEnabled()) getDebugLog().render(`writeChunked: chunked write completed`);
|
|
@@ -12450,6 +12485,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
12450
12485
|
const nextActiveGraphics = new Map(activeGraphics);
|
|
12451
12486
|
const nextActiveGraphicSignatures = new Map(activeGraphicSignatures);
|
|
12452
12487
|
const nextPendingGraphicSignatures = new Map(pendingGraphicSignatures);
|
|
12488
|
+
const clearedGraphicCacheIds = new Set();
|
|
12453
12489
|
let terminalGraphicsDraws = 0;
|
|
12454
12490
|
let terminalGraphicsClears = 0;
|
|
12455
12491
|
let terminalGraphicsBytes = 0;
|
|
@@ -12504,6 +12540,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
12504
12540
|
wroteClear = appendActiveGraphicProtocolClear(active, visibleRect) || wroteClear;
|
|
12505
12541
|
if (wroteClear) terminalGraphicsClears++;
|
|
12506
12542
|
retainedGraphics.delete(id);
|
|
12543
|
+
clearedGraphicCacheIds.add(id);
|
|
12507
12544
|
terminalResizeDirtyGraphics.delete(id);
|
|
12508
12545
|
nextActiveGraphics.delete(id);
|
|
12509
12546
|
nextActiveGraphicSignatures.delete(id);
|
|
@@ -12531,7 +12568,10 @@ function createStdoutRenderer(terminal, options) {
|
|
|
12531
12568
|
}, clearSequenceNeedsVisibleCell(payload.sequence, payload.protocol)) || wroteClear;
|
|
12532
12569
|
if (wroteClear) terminalGraphicsClears++;
|
|
12533
12570
|
if (active && payload.retainOnClear) retainTerminalGraphic(payload.id, active, nextActiveGraphicSignatures.get(payload.id));
|
|
12534
|
-
else
|
|
12571
|
+
else {
|
|
12572
|
+
retainedGraphics.delete(payload.id);
|
|
12573
|
+
clearedGraphicCacheIds.add(payload.id);
|
|
12574
|
+
}
|
|
12535
12575
|
terminalResizeDirtyGraphics.delete(payload.id);
|
|
12536
12576
|
nextActiveGraphics.delete(payload.id);
|
|
12537
12577
|
nextActiveGraphicSignatures.delete(payload.id);
|
|
@@ -12618,6 +12658,11 @@ function createStdoutRenderer(terminal, options) {
|
|
|
12618
12658
|
for (const [id, signature] of nextActiveGraphicSignatures) activeGraphicSignatures.set(id, signature);
|
|
12619
12659
|
pendingGraphicSignatures.clear();
|
|
12620
12660
|
for (const [id, signature] of nextPendingGraphicSignatures) pendingGraphicSignatures.set(id, signature);
|
|
12661
|
+
for (const id of clearedGraphicCacheIds) {
|
|
12662
|
+
if (nextActiveGraphics.has(id) || retainedGraphics.has(id)) continue;
|
|
12663
|
+
validatedGraphicFrames.delete(id);
|
|
12664
|
+
graphicSequenceHashes.delete(id);
|
|
12665
|
+
}
|
|
12621
12666
|
};
|
|
12622
12667
|
terminalGraphicsMetrics = {
|
|
12623
12668
|
draws: terminalGraphicsDraws,
|
|
@@ -12628,10 +12673,13 @@ function createStdoutRenderer(terminal, options) {
|
|
|
12628
12673
|
if (isDebugEnabled()) getDebugLog().render(`terminal graphics frame: draws=${terminalGraphicsDraws}, clears=${terminalGraphicsClears}, bytes=${terminalGraphicsBytes}, activeNext=${nextActiveGraphics.size}`);
|
|
12629
12674
|
}
|
|
12630
12675
|
let emittedCursorPos = null;
|
|
12676
|
+
let frameCursorPin = null;
|
|
12631
12677
|
if (getImeAnchor) {
|
|
12632
12678
|
const anchor = getImeAnchor();
|
|
12633
12679
|
if (anchor) {
|
|
12634
12680
|
const { x, y } = clampCellToViewport(anchor, size);
|
|
12681
|
+
const cursorSequence = `\u001B[${y + 1 + rowOffset};${x + 1}H`;
|
|
12682
|
+
frameCursorPin = cursorSequence;
|
|
12635
12683
|
if (hasFrameOutput || x !== lastCursorX || y !== lastCursorY) {
|
|
12636
12684
|
hasFrameOutput = true;
|
|
12637
12685
|
emittedCursorPos = {
|
|
@@ -12639,7 +12687,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
12639
12687
|
y
|
|
12640
12688
|
};
|
|
12641
12689
|
closeActiveHrefBeforeCursorMove();
|
|
12642
|
-
frameParts.push(
|
|
12690
|
+
frameParts.push(cursorSequence);
|
|
12643
12691
|
}
|
|
12644
12692
|
}
|
|
12645
12693
|
}
|
|
@@ -12730,7 +12778,7 @@ function createStdoutRenderer(terminal, options) {
|
|
|
12730
12778
|
try {
|
|
12731
12779
|
if (writeMode === "chunked") {
|
|
12732
12780
|
if (isDebugEnabled()) getDebugLog().render(` Using chunked write (chunkSize=${chunkSize}, threshold=${chunkThresholdBytes}, emaMs=${writeEmaMs.toFixed(2)})`);
|
|
12733
|
-
writeChunked(frame);
|
|
12781
|
+
writeChunked(frame, frameCursorPin);
|
|
12734
12782
|
} else if (writeMode === "sync" && canUseSyncStdout) {
|
|
12735
12783
|
if (isDebugEnabled()) getDebugLog().render(` Using writeSync`);
|
|
12736
12784
|
try {
|
|
@@ -13206,6 +13254,8 @@ function createStdoutRenderer(terminal, options) {
|
|
|
13206
13254
|
pendingGraphicClears.clear();
|
|
13207
13255
|
pendingGraphicSignatures.clear();
|
|
13208
13256
|
retainedGraphics.clear();
|
|
13257
|
+
validatedGraphicFrames.clear();
|
|
13258
|
+
graphicSequenceHashes.clear();
|
|
13209
13259
|
knownKittyImageIds.clear();
|
|
13210
13260
|
terminalResizeDirtyGraphics.clear();
|
|
13211
13261
|
try {
|
package/dist/core.js
CHANGED
|
@@ -2,8 +2,8 @@ import { TERMINAL_RENDER_PLANES, charCellWidth, createTerminal, parseAnsiSgr } f
|
|
|
2
2
|
import { ansiColorRgb } from "./ansi-palette-BHF1rN7R.js";
|
|
3
3
|
import { isSafeRelativeHref, sanitizeDomHref, sanitizeTerminalHref } from "./hyperlink-clbb_ha_.js";
|
|
4
4
|
import { firstNonEmptyEnv } from "./env-Cl8qmNFN.js";
|
|
5
|
-
import { normalizeNewlines } from "./path-
|
|
6
|
-
import { parsePathQuery, resolveUserPath, suggestParentHint, suggestPaths } from "./path-suggest-
|
|
5
|
+
import { normalizeNewlines } from "./path-BI9W15Zt.js";
|
|
6
|
+
import { parsePathQuery, resolveUserPath, suggestParentHint, suggestPaths } from "./path-suggest-fPzRsgPv.js";
|
|
7
7
|
|
|
8
8
|
//#region src/core/ansi/colors.ts
|
|
9
9
|
const ANSI8_COLOR_NAMES = Object.freeze([
|