@simon_he/vue-tui 0.0.8 → 1.0.0-rc.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 +130 -27
- package/dist/TSelect-BmSkar0D.js +8697 -0
- package/dist/ansi-palette-Bv5Vqr4k.js +1499 -0
- package/dist/ansi-styles.d.ts +200 -0
- package/dist/cli/headless-renderer.d.ts +29 -0
- package/dist/cli/input.d.ts +49 -0
- package/dist/cli/node-file-writers.d.ts +12 -0
- package/dist/cli/node-module.d.ts +2 -0
- package/dist/cli/parse-kitty.d.ts +2 -0
- package/dist/cli/parse-mouse.d.ts +2 -0
- package/dist/cli/parse-utils.d.ts +14 -0
- package/dist/cli/parse-xterm.d.ts +2 -0
- package/dist/cli/path-provider-types.d.ts +1 -0
- package/dist/cli/path-provider.d.ts +4 -0
- package/dist/cli/path-suggest-core.d.ts +1 -0
- package/dist/cli/path-suggest.d.ts +15 -0
- package/dist/cli/recording.d.ts +4 -0
- package/dist/cli/stdin-buffer.d.ts +33 -0
- package/dist/cli.cjs +10664 -0
- package/dist/cli.d.cts +22 -0
- package/dist/cli.d.ts +22 -0
- package/dist/cli.js +9521 -0
- package/dist/core/ansi/capability.d.ts +20 -0
- package/dist/core/ansi/colors.d.ts +41 -0
- package/dist/core/ansi/sgr.d.ts +7 -0
- package/dist/core/ansi/theme.d.ts +6 -0
- package/dist/core/ansi-palette.d.ts +14 -0
- package/dist/core/buffer/buffer.d.ts +54 -0
- package/dist/core/buffer/width.d.ts +4 -0
- package/dist/core/debug-logger.d.ts +18 -0
- package/dist/core/hyperlink.d.ts +9 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/path-provider-types.d.ts +24 -0
- package/dist/core/path-suggest.d.ts +35 -0
- package/dist/core/render-plane.d.ts +3 -0
- package/dist/core/terminal/create-terminal.d.ts +7 -0
- package/dist/core/terminal/emitter.d.ts +7 -0
- package/dist/core/types.d.ts +107 -0
- package/dist/core.cjs +3072 -0
- package/dist/core.d.cts +14 -0
- package/dist/core.d.ts +14 -0
- package/dist/core.js +422 -0
- package/dist/create-terminal-app.d.ts +34 -0
- package/dist/dom-renderer-CDVQIcIL.js +1172 -0
- package/dist/events/index.d.ts +6 -0
- package/dist/events/manager/cli-event-manager.d.ts +22 -0
- package/dist/events/manager/event-manager.d.ts +30 -0
- package/dist/events/manager/selection-suppression.d.ts +3 -0
- package/dist/events/manager/types.d.ts +108 -0
- package/dist/events/recording.d.ts +44 -0
- package/dist/experimental.cjs +1777 -1244
- package/dist/experimental.d.cts +39 -0
- package/dist/experimental.d.ts +39 -825
- package/dist/experimental.js +492 -343
- package/dist/frame-perf-C-w8mjJL.js +98 -0
- package/dist/hyperlink-B5PD7a3Q.js +331 -0
- package/dist/index.cjs +13133 -19960
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -1528
- package/dist/index.js +13 -20026
- package/dist/markdown.cjs +8728 -7359
- package/dist/markdown.d.cts +10 -0
- package/dist/markdown.d.ts +10 -112
- package/dist/markdown.js +169 -101
- package/dist/observability/cli-latency-node.d.ts +3 -0
- package/dist/observability/cli-latency-types.d.ts +41 -0
- package/dist/observability/cli-latency.d.ts +3 -0
- package/dist/observability/frame-perf-store.d.ts +13 -0
- package/dist/observability/frame-perf.d.ts +40 -0
- package/dist/observability/trace.d.ts +40 -0
- package/dist/observability/tui-profiler.d.ts +33 -0
- package/dist/observability.cjs +99 -0
- package/dist/observability.d.cts +6 -0
- package/dist/observability.d.ts +6 -0
- package/dist/observability.js +3 -0
- package/dist/path-DDiSCXrQ.js +99 -0
- package/dist/path-suggest-0Q2BDsuj.js +274 -0
- package/dist/path-suggest-Dk9TRLh5.js +3 -0
- package/dist/{path-suggest-DmrmeueH.js → path-suggest-bvR9SY6Q.js} +86 -18
- package/dist/renderer/capabilities.d.ts +13 -0
- package/dist/renderer/cli/index.d.ts +2 -0
- package/dist/renderer/cli/stdout-metrics.d.ts +18 -0
- package/dist/renderer/cli/stdout-renderer.d.ts +48 -0
- package/dist/renderer/dom/dom-renderer.d.ts +157 -0
- package/dist/renderer/dom/index.d.ts +2 -0
- package/dist/renderer/index.d.ts +2 -0
- package/dist/renderer-dom.cjs +1511 -0
- package/dist/renderer-dom.d.cts +4 -0
- package/dist/renderer-dom.d.ts +4 -0
- package/dist/renderer-dom.js +6 -0
- package/dist/runtime/index.d.ts +36 -0
- package/dist/runtime/osc52.d.ts +9 -0
- package/dist/runtime-DtrcQidD.js +1197 -0
- package/dist/runtime.cjs +1697 -0
- package/dist/runtime.d.cts +9 -0
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.js +4 -0
- package/dist/selection/terminal-selection.d.ts +122 -0
- package/dist/sgr-DMK2AvuT.js +304 -0
- package/dist/style-cache-i0ZABZRq.js +178 -0
- package/dist/terminal-selection-BCOh9jsL.js +329 -0
- package/dist/utils/env.d.ts +3 -0
- package/dist/utils/newlines.d.ts +1 -0
- package/dist/utils/path.d.ts +7 -0
- package/dist/utils/url-safety.d.ts +2 -0
- package/dist/vue/components/TAnchor.d.ts +108 -0
- package/dist/vue/components/TBox.d.ts +144 -0
- package/dist/vue/components/TDebugOverlay.d.ts +43 -0
- package/dist/vue/components/TDialog.d.ts +256 -0
- package/dist/vue/components/TFlow.d.ts +85 -0
- package/dist/vue/components/TInput.d.ts +554 -0
- package/dist/vue/components/TInputBox.d.ts +158 -0
- package/dist/vue/components/TJsonEditor.d.ts +165 -0
- package/dist/vue/components/TList.d.ts +119 -0
- package/dist/vue/components/TLogLinksPanel.d.ts +238 -0
- package/dist/vue/components/TLogMinimap.d.ts +263 -0
- package/dist/vue/components/TLogScrollbar.d.ts +236 -0
- package/dist/vue/components/TLogSearchBar.d.ts +267 -0
- package/dist/vue/components/TLogSearchPager.d.ts +162 -0
- package/dist/vue/components/TLogSearchResults.d.ts +200 -0
- package/dist/vue/components/TLogView.d.ts +502 -0
- package/dist/vue/components/TLogVirtualLinksPanel.d.ts +141 -0
- package/dist/vue/components/TLogVirtualSearchResults.d.ts +146 -0
- package/dist/vue/components/TMarkdownText.d.ts +134 -0
- package/dist/vue/components/TMultilineModal.d.ts +62 -0
- package/dist/vue/components/TPathPicker.d.ts +213 -0
- package/dist/vue/components/TRenderLayer.d.ts +16 -0
- package/dist/vue/components/TRenderPlane.d.ts +17 -0
- package/dist/vue/components/TSelect.d.ts +215 -0
- package/dist/vue/components/TText.d.ts +116 -0
- package/dist/vue/components/TTransition.d.ts +83 -0
- package/dist/vue/components/TView.d.ts +127 -0
- package/dist/vue/components/TVirtualList.d.ts +182 -0
- package/dist/vue/components/TVirtualMarkdown.d.ts +168 -0
- package/dist/vue/components/TerminalProvider.d.ts +195 -0
- package/dist/vue/components/input/host.d.ts +17 -0
- package/dist/vue/components/input/plugins/hostPlugin.d.ts +7 -0
- package/dist/vue/components/input/plugins/hostPlugin.node.d.ts +15 -0
- package/dist/vue/components/input/plugins/mentionUtils.d.ts +17 -0
- package/dist/vue/components/input/plugins/nodeMentionPathProvider.d.ts +2 -0
- package/dist/vue/components/input/plugins/promptMentionPlugin.d.ts +8 -0
- package/dist/vue/components/input/plugins/promptMentionState.d.ts +98 -0
- package/dist/vue/components/input/plugins/restrictText.d.ts +27 -0
- package/dist/vue/components/input/plugins/types.d.ts +90 -0
- package/dist/vue/components/input/utils/inlineText.d.ts +57 -0
- package/dist/vue/components/input/utils/inlineTextTokens.d.ts +34 -0
- package/dist/vue/components/input/utils/primitives.d.ts +3 -0
- package/dist/vue/components/input/utils/wordNavigation.d.ts +6 -0
- package/dist/vue/components/list/list-geometry.d.ts +16 -0
- package/dist/vue/components/list/list-paint.d.ts +1 -0
- package/dist/vue/components/list/scroll-state.d.ts +25 -0
- package/dist/vue/components/list/selection-state.d.ts +6 -0
- package/dist/vue/components/terminal-provider/copy-toast.d.ts +6 -0
- package/dist/vue/components/terminal-provider/portals.d.ts +17 -0
- package/dist/vue/components/terminal-provider/scheduler.d.ts +29 -0
- package/dist/vue/components/terminal-provider/selection-config.d.ts +15 -0
- package/dist/vue/components/terminal-provider/utils.d.ts +5 -0
- package/dist/vue/composables/use-layout.d.ts +2 -0
- package/dist/vue/composables/use-render-node.d.ts +19 -0
- package/dist/vue/composables/use-render-stack.d.ts +3 -0
- package/dist/vue/composables/use-runtime.d.ts +5 -0
- package/dist/vue/composables/use-terminal-node.d.ts +14 -0
- package/dist/vue/composables/use-terminal.d.ts +2 -0
- package/dist/vue/composables/use-visibility.d.ts +12 -0
- package/dist/vue/context.d.ts +153 -0
- package/dist/vue/index.d.ts +39 -0
- package/dist/vue/injection-key.d.ts +2 -0
- package/dist/vue/log/append-only-log-store.d.ts +2 -0
- package/dist/vue/log/tlog-keymap.d.ts +28 -0
- package/dist/vue/log/tlog-plugins.d.ts +144 -0
- package/dist/vue/log/tlog-session.d.ts +81 -0
- package/dist/vue/log/tlog-theme.d.ts +68 -0
- package/dist/vue/log/types.d.ts +43 -0
- package/dist/vue/log/use-tlog-link-controller.d.ts +31 -0
- package/dist/vue/log/use-tlog-retained-index.d.ts +26 -0
- package/dist/vue/log/use-tlog-search-controller.d.ts +51 -0
- package/dist/vue/log/use-tlog-search-results-page.d.ts +31 -0
- package/dist/vue/log/use-tlog-virtual-search-results.d.ts +22 -0
- package/dist/vue/markdown/ast.d.ts +3 -0
- package/dist/vue/markdown/block-source.d.ts +22 -0
- package/dist/vue/markdown/document.d.ts +18 -0
- package/dist/vue/markdown/layout.d.ts +16 -0
- package/dist/vue/markdown/parser.d.ts +11 -0
- package/dist/vue/markdown/render.d.ts +10 -0
- package/dist/vue/markdown/theme.d.ts +186 -0
- package/dist/vue/markdown/types.d.ts +47 -0
- package/dist/vue/render/context.d.ts +3 -0
- package/dist/vue/render/render-manager.d.ts +94 -0
- package/dist/vue/router/RouterView.d.ts +25 -0
- package/dist/vue/router/composables.d.ts +4 -0
- package/dist/vue/router/context.d.ts +4 -0
- package/dist/vue/router/router.d.ts +7 -0
- package/dist/vue/router/types.d.ts +29 -0
- package/dist/vue/scheduler/frame-mailbox.d.ts +55 -0
- package/dist/vue/scheduler/frame-scheduler.d.ts +51 -0
- package/dist/vue/utils/frame-task.d.ts +6 -0
- package/dist/vue/utils/rect.d.ts +4 -0
- package/dist/vue/utils/style-cache.d.ts +3 -0
- package/dist/vue/utils/text.d.ts +26 -0
- package/dist/vue/utils/wheel-scroll.d.ts +18 -0
- package/dist/vue.cjs +18882 -0
- package/dist/vue.d.cts +3 -0
- package/dist/vue.d.ts +3 -0
- package/dist/vue.js +3066 -0
- package/dist/{wheel-scroll-CiNsasLf.js → wheel-scroll-B-WlFuNB.js} +361 -367
- package/package.json +165 -35
- package/dist/path-suggest-BeV6n7m-.js +0 -3
- package/dist/sgr-Tko2EQ0U.js +0 -484
- package/dist/theme-Bsm65g8k.d.ts +0 -32
- package/dist/types-ClIV2h1o.d.ts +0 -103
package/dist/experimental.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { applyAnsiSgrStyle, parseAnsiSgr } from "./sgr-DMK2AvuT.js";
|
|
2
|
+
import { sanitizeTerminalHref } from "./hyperlink-B5PD7a3Q.js";
|
|
3
|
+
import { terminalSelectionRowSpans, terminalSelectionVisibleRowSpans } from "./terminal-selection-BCOh9jsL.js";
|
|
4
|
+
import { EventZIndexContextKey, RenderPlaneContextKey, applyWheelScroll, createWheelScrollState, forEachTextCellSegment, formatInlineCellLine, intersectRect, normalizeCellRect, padEndByCells, resetWheelScrollState, sanitizeInlineText, sliceByCellsRange, spaces, textCellWidth, translateRect, useLayout, useRenderNode, useTerminal, useTerminalNode, useVisibility, wrapByCells } from "./wheel-scroll-B-WlFuNB.js";
|
|
5
|
+
import { createFrameMailbox, defaultActiveStyle } from "./style-cache-i0ZABZRq.js";
|
|
3
6
|
import { computed, defineComponent, getCurrentInstance, h, inject, onBeforeUnmount, ref, watch, watchEffect } from "vue";
|
|
4
7
|
|
|
5
8
|
//#region src/vue/components/TVirtualList.ts
|
|
@@ -92,6 +95,14 @@ const TVirtualList = defineComponent({
|
|
|
92
95
|
type: Boolean,
|
|
93
96
|
default: false
|
|
94
97
|
},
|
|
98
|
+
selectionText: {
|
|
99
|
+
type: Function,
|
|
100
|
+
default: void 0
|
|
101
|
+
},
|
|
102
|
+
selectable: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: false
|
|
105
|
+
},
|
|
95
106
|
rowScrollMode: {
|
|
96
107
|
type: String,
|
|
97
108
|
default: "off"
|
|
@@ -108,7 +119,7 @@ const TVirtualList = defineComponent({
|
|
|
108
119
|
"keydown"
|
|
109
120
|
],
|
|
110
121
|
setup(props, { emit }) {
|
|
111
|
-
const { terminal, scheduler, render, defaultStyle, events } = useTerminal();
|
|
122
|
+
const { terminal, scheduler, render, defaultStyle, events, selection } = useTerminal();
|
|
112
123
|
const instance = getCurrentInstance();
|
|
113
124
|
const layout = useLayout();
|
|
114
125
|
const { visible, rootProps } = useVisibility();
|
|
@@ -126,6 +137,7 @@ const TVirtualList = defineComponent({
|
|
|
126
137
|
let warnedRenderItemIdentity = false;
|
|
127
138
|
let alive = true;
|
|
128
139
|
let pendingWheelTop = null;
|
|
140
|
+
let pendingSelectionScrollFocusRemap = false;
|
|
129
141
|
const wheelState = createWheelScrollState();
|
|
130
142
|
const itemCount = computed(() => {
|
|
131
143
|
const n = Math.floor(Number(props.itemCount));
|
|
@@ -188,7 +200,7 @@ const TVirtualList = defineComponent({
|
|
|
188
200
|
return visible.value && r.w > 0 && r.h > 0;
|
|
189
201
|
}
|
|
190
202
|
function isScrollControlled() {
|
|
191
|
-
return Object.prototype.hasOwnProperty.call(
|
|
203
|
+
return Object.prototype.hasOwnProperty.call(instance?.vnode.props ?? {}, "scrollTop");
|
|
192
204
|
}
|
|
193
205
|
const visibleWindow = computed(() => {
|
|
194
206
|
const clip = normalizedRect();
|
|
@@ -220,7 +232,9 @@ const TVirtualList = defineComponent({
|
|
|
220
232
|
const visibleEnd = visibleStart + clip.h - 1;
|
|
221
233
|
if (active.value < visibleStart) nextTop = clamp$10(active.value - clipY, 0, maxTop);
|
|
222
234
|
else if (active.value > visibleEnd) nextTop = clamp$10(active.value - (clipY + clip.h - 1), 0, maxTop);
|
|
223
|
-
|
|
235
|
+
const result = applyScrollTop(nextTop, options);
|
|
236
|
+
if (result.changed) selection.refresh();
|
|
237
|
+
return result;
|
|
224
238
|
}
|
|
225
239
|
function normalizedModelValue() {
|
|
226
240
|
return normalizeIndex(props.modelValue, itemCount.value);
|
|
@@ -245,6 +259,7 @@ const TVirtualList = defineComponent({
|
|
|
245
259
|
resetWheelScrollState(wheelState);
|
|
246
260
|
return;
|
|
247
261
|
}
|
|
262
|
+
selection.refresh();
|
|
248
263
|
if (changed.dirty) ctx.invalidate({
|
|
249
264
|
priority: "high",
|
|
250
265
|
plane: plane.value,
|
|
@@ -304,6 +319,7 @@ const TVirtualList = defineComponent({
|
|
|
304
319
|
active.value = normalizedModelValue();
|
|
305
320
|
const nextTop = clampScrollTop(scrollTop.value);
|
|
306
321
|
const changed = applyScrollTop(nextTop, { emitScroll });
|
|
322
|
+
if (changed.changed) selection.refresh();
|
|
307
323
|
if (!changed.changed) markViewportDirty();
|
|
308
324
|
if (pendingWheelTop !== null && !hasPaintableViewport()) cancelWheelScrollFrame();
|
|
309
325
|
else if (pendingWheelTop !== null) {
|
|
@@ -322,6 +338,9 @@ const TVirtualList = defineComponent({
|
|
|
322
338
|
const changed = scrollTop.value !== nextTop;
|
|
323
339
|
scrollTop.value = nextTop;
|
|
324
340
|
if (!wasInitialized || !changed) return;
|
|
341
|
+
const remap = pendingSelectionScrollFocusRemap;
|
|
342
|
+
pendingSelectionScrollFocusRemap = false;
|
|
343
|
+
selection.refresh(remap ? { remapFocus: true } : void 0);
|
|
325
344
|
markViewportDirty();
|
|
326
345
|
invalidateSelf("high", "scroll");
|
|
327
346
|
}, { immediate: true });
|
|
@@ -335,10 +354,14 @@ const TVirtualList = defineComponent({
|
|
|
335
354
|
warnedRenderItemIdentity = true;
|
|
336
355
|
console.warn("[vue-tui] TVirtualList renderItem changed identity; use a stable function reference and itemVersion.");
|
|
337
356
|
});
|
|
357
|
+
watch(() => props.itemVersion, () => {
|
|
358
|
+
selection.refresh();
|
|
359
|
+
});
|
|
338
360
|
function itemText(index) {
|
|
339
361
|
const item = props.getItem(index);
|
|
362
|
+
if (props.selectionText) return String(props.selectionText(item, index) ?? "");
|
|
340
363
|
const raw = props.renderItem ? props.renderItem(item, index) : item;
|
|
341
|
-
return String(raw
|
|
364
|
+
return typeof raw === "string" || typeof raw === "number" || typeof raw === "boolean" ? String(raw) : "";
|
|
342
365
|
}
|
|
343
366
|
function commit(index) {
|
|
344
367
|
if (itemCount.value <= 0) return;
|
|
@@ -406,11 +429,91 @@ const TVirtualList = defineComponent({
|
|
|
406
429
|
commit(active.value);
|
|
407
430
|
}
|
|
408
431
|
}
|
|
432
|
+
function scrollSelectionBy(delta) {
|
|
433
|
+
const n = Math.trunc(Number(delta));
|
|
434
|
+
if (!Number.isFinite(n) || n === 0) return false;
|
|
435
|
+
cancelWheelScrollFrame();
|
|
436
|
+
if (isScrollControlled()) {
|
|
437
|
+
const nextTop = clampScrollTop(scrollTop.value + n);
|
|
438
|
+
if (nextTop === scrollTop.value) return false;
|
|
439
|
+
if (pendingSelectionScrollFocusRemap) return false;
|
|
440
|
+
pendingSelectionScrollFocusRemap = true;
|
|
441
|
+
emit("update:scrollTop", nextTop);
|
|
442
|
+
emit("scroll", nextTop);
|
|
443
|
+
return true;
|
|
444
|
+
}
|
|
445
|
+
const changed = applyScrollTop(scrollTop.value + n, {
|
|
446
|
+
emitScroll: true,
|
|
447
|
+
emitUpdate: true,
|
|
448
|
+
priority: "high",
|
|
449
|
+
reason: "scroll"
|
|
450
|
+
});
|
|
451
|
+
if (!changed.changed) return false;
|
|
452
|
+
selection.refresh({ remapFocus: true });
|
|
453
|
+
return true;
|
|
454
|
+
}
|
|
455
|
+
function selectionPointForCell(point) {
|
|
456
|
+
const r = normalizedRect();
|
|
457
|
+
if (point.x < r.x || point.y < r.y || point.x >= r.x + r.w || point.y >= r.y + r.h) return null;
|
|
458
|
+
const { x: clipX, y: clipY } = clipOffsets();
|
|
459
|
+
const virtualY = scrollTop.value + clipY + (point.y - r.y);
|
|
460
|
+
if (virtualY < 0 || virtualY >= itemCount.value) return null;
|
|
461
|
+
return {
|
|
462
|
+
x: clamp$10(clipX + (point.x - r.x), 0, Math.max(0, props.w - 1)),
|
|
463
|
+
y: virtualY
|
|
464
|
+
};
|
|
465
|
+
}
|
|
466
|
+
function canHandleSelectionRange(range) {
|
|
467
|
+
return Boolean(selectionPointForCell(range.anchor) && selectionPointForCell(range.focus));
|
|
468
|
+
}
|
|
469
|
+
function textForSelectionRange(range) {
|
|
470
|
+
const cols = Math.max(1, Math.floor(props.w));
|
|
471
|
+
return terminalSelectionRowSpans(range, cols, itemCount.value).map((span) => {
|
|
472
|
+
const text = sliceByCellsRange(itemText(span.y), span.x0, span.x1);
|
|
473
|
+
return span.x1 >= cols ? text.trimEnd() : text;
|
|
474
|
+
}).join("\n");
|
|
475
|
+
}
|
|
476
|
+
function visibleSpansForSelectionRange(providerRange, _screenRange) {
|
|
477
|
+
const r = normalizedRect();
|
|
478
|
+
const { x: clipX, y: clipY } = clipOffsets();
|
|
479
|
+
const cols = Math.max(1, Math.floor(props.w));
|
|
480
|
+
const top = scrollTop.value + clipY;
|
|
481
|
+
const bottom = top + r.h;
|
|
482
|
+
const providerSpans = terminalSelectionVisibleRowSpans(providerRange, cols, itemCount.value, top, bottom);
|
|
483
|
+
const result = [];
|
|
484
|
+
for (const span of providerSpans) {
|
|
485
|
+
const screenY = r.y + (span.y - top);
|
|
486
|
+
const screenX0 = r.x + span.x0 - clipX;
|
|
487
|
+
const screenX1 = r.x + span.x1 - clipX;
|
|
488
|
+
const x0 = Math.max(r.x, screenX0);
|
|
489
|
+
const x1 = Math.min(r.x + r.w, screenX1);
|
|
490
|
+
if (screenY >= r.y && screenY < r.y + r.h && x1 > x0) result.push({
|
|
491
|
+
y: screenY,
|
|
492
|
+
x0,
|
|
493
|
+
x1
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
return result;
|
|
497
|
+
}
|
|
498
|
+
const selectionTextProvider = {
|
|
499
|
+
id: `TVirtualList:${virtualListInstanceId}:selection-text`,
|
|
500
|
+
get rect() {
|
|
501
|
+
return normalizedRect();
|
|
502
|
+
},
|
|
503
|
+
canHandle: canHandleSelectionRange,
|
|
504
|
+
pointForCell: selectionPointForCell,
|
|
505
|
+
getText: textForSelectionRange,
|
|
506
|
+
getVisibleSpans: visibleSpansForSelectionRange
|
|
507
|
+
};
|
|
508
|
+
const unregisterSelectionTextProvider = selection.registerTextProvider(selectionTextProvider);
|
|
509
|
+
onBeforeUnmount(unregisterSelectionTextProvider);
|
|
409
510
|
const eventNode = useTerminalNode(() => ({
|
|
410
511
|
rect: normalizedRect(),
|
|
411
512
|
zIndex: eventZ.value,
|
|
412
513
|
visible: visible.value,
|
|
413
514
|
focusable: true,
|
|
515
|
+
selectable: props.selectable,
|
|
516
|
+
selectionScrollBy: scrollSelectionBy,
|
|
414
517
|
handlers: {
|
|
415
518
|
click: (e) => {
|
|
416
519
|
cancelWheelScrollFrame();
|
|
@@ -435,7 +538,6 @@ const TVirtualList = defineComponent({
|
|
|
435
538
|
if (idx >= 0 && idx < itemCount.value) commit(idx);
|
|
436
539
|
},
|
|
437
540
|
wheel: (e) => {
|
|
438
|
-
var _e$preventDefault;
|
|
439
541
|
const { deltaY, mode } = getWheelScrollInput$1(e);
|
|
440
542
|
if (!deltaY) return;
|
|
441
543
|
const maxTop = maxScrollTop();
|
|
@@ -444,7 +546,7 @@ const TVirtualList = defineComponent({
|
|
|
444
546
|
const { nextTop, dir } = applyWheelScroll(wheelState, deltaY, baseTop, maxTop, now, mode, { disableAcceleration: mode === "pixel" });
|
|
445
547
|
if (!dir || nextTop === baseTop) return;
|
|
446
548
|
if (!requestWheelScroll(nextTop)) return;
|
|
447
|
-
|
|
549
|
+
e.preventDefault?.();
|
|
448
550
|
},
|
|
449
551
|
focus: () => {
|
|
450
552
|
focused.value = true;
|
|
@@ -484,7 +586,7 @@ const TVirtualList = defineComponent({
|
|
|
484
586
|
return rows;
|
|
485
587
|
}
|
|
486
588
|
function unionDirtyRows(nextRows) {
|
|
487
|
-
if (!
|
|
589
|
+
if (!dirtyRowsHint?.length) return nextRows.slice().sort((a, b) => a - b);
|
|
488
590
|
const rows = new Set(dirtyRowsHint);
|
|
489
591
|
for (const y of nextRows) rows.add(y);
|
|
490
592
|
return Array.from(rows).sort((a, b) => a - b);
|
|
@@ -520,8 +622,8 @@ const TVirtualList = defineComponent({
|
|
|
520
622
|
controlled
|
|
521
623
|
};
|
|
522
624
|
if (controlled) {
|
|
523
|
-
if (
|
|
524
|
-
if (options
|
|
625
|
+
if (options?.emitUpdate ?? true) emit("update:scrollTop", clampedTop);
|
|
626
|
+
if (options?.emitScroll) emit("scroll", clampedTop);
|
|
525
627
|
return {
|
|
526
628
|
changed: true,
|
|
527
629
|
dirty: false,
|
|
@@ -530,10 +632,10 @@ const TVirtualList = defineComponent({
|
|
|
530
632
|
};
|
|
531
633
|
}
|
|
532
634
|
scrollTop.value = clampedTop;
|
|
533
|
-
if (options
|
|
635
|
+
if (options?.emitUpdate) emit("update:scrollTop", clampedTop);
|
|
534
636
|
const dirty = markViewportDirty();
|
|
535
|
-
if (options
|
|
536
|
-
if (
|
|
637
|
+
if (options?.emitScroll) emit("scroll", clampedTop);
|
|
638
|
+
if (options?.priority && dirty) invalidateSelf(options.priority, options.reason ?? "scroll");
|
|
537
639
|
return {
|
|
538
640
|
changed: true,
|
|
539
641
|
dirty,
|
|
@@ -586,7 +688,7 @@ const TVirtualList = defineComponent({
|
|
|
586
688
|
});
|
|
587
689
|
};
|
|
588
690
|
const rows = dirtyRows;
|
|
589
|
-
if (rows
|
|
691
|
+
if (rows?.length) {
|
|
590
692
|
for (const y of rows) paintRow(y);
|
|
591
693
|
return;
|
|
592
694
|
}
|
|
@@ -794,7 +896,7 @@ function parseAnsiLineToSegments(text, baseStyle, links, linkStyle) {
|
|
|
794
896
|
if (!osc) continue;
|
|
795
897
|
flush(i);
|
|
796
898
|
const parts = osc.body.split(";");
|
|
797
|
-
if (parts[0] === "8" && parts.length >= 3) href = parts.slice(2).join(";")
|
|
899
|
+
if (parts[0] === "8" && parts.length >= 3) href = sanitizeTerminalHref(parts.slice(2).join(";")) ?? void 0;
|
|
798
900
|
i = osc.end;
|
|
799
901
|
textStart = osc.end + 1;
|
|
800
902
|
continue;
|
|
@@ -1015,6 +1117,10 @@ const TLogView = defineComponent({
|
|
|
1015
1117
|
type: Boolean,
|
|
1016
1118
|
default: false
|
|
1017
1119
|
},
|
|
1120
|
+
selectable: {
|
|
1121
|
+
type: Boolean,
|
|
1122
|
+
default: true
|
|
1123
|
+
},
|
|
1018
1124
|
autoStickToBottom: {
|
|
1019
1125
|
type: Boolean,
|
|
1020
1126
|
default: true
|
|
@@ -1099,7 +1205,7 @@ const TLogView = defineComponent({
|
|
|
1099
1205
|
"keydown"
|
|
1100
1206
|
],
|
|
1101
1207
|
setup(props, { emit, expose }) {
|
|
1102
|
-
const { terminal, scheduler, render, rendererCapabilities, defaultStyle, events } = useTerminal();
|
|
1208
|
+
const { terminal, scheduler, render, rendererCapabilities, defaultStyle, events, selection } = useTerminal();
|
|
1103
1209
|
const layout = useLayout();
|
|
1104
1210
|
const { visible, rootProps } = useVisibility();
|
|
1105
1211
|
const plane = inject(RenderPlaneContextKey, ref("default"));
|
|
@@ -1113,6 +1219,7 @@ const TLogView = defineComponent({
|
|
|
1113
1219
|
let renderNodeId = null;
|
|
1114
1220
|
let alive = true;
|
|
1115
1221
|
let pendingWheelTop = null;
|
|
1222
|
+
let pendingSelectionScrollFocusRemap = false;
|
|
1116
1223
|
let initializedScrollTop = false;
|
|
1117
1224
|
let lastLineCount = 0;
|
|
1118
1225
|
let lastFirstLineIndex = 0;
|
|
@@ -1206,13 +1313,11 @@ const TLogView = defineComponent({
|
|
|
1206
1313
|
return Number.isFinite(n) ? Math.max(0, n) : 0;
|
|
1207
1314
|
}
|
|
1208
1315
|
function firstLineIndex() {
|
|
1209
|
-
|
|
1210
|
-
const n = Math.floor(Number(((_props$source$firstLi = (_props$source = props.source).firstLineIndex) === null || _props$source$firstLi === void 0 ? void 0 : _props$source$firstLi.call(_props$source)) ?? 0));
|
|
1316
|
+
const n = Math.floor(Number(props.source.firstLineIndex?.() ?? 0));
|
|
1211
1317
|
return Number.isFinite(n) ? Math.max(0, n) : 0;
|
|
1212
1318
|
}
|
|
1213
1319
|
function lineKey(index) {
|
|
1214
|
-
|
|
1215
|
-
return ((_props$source$getLine = (_props$source2 = props.source).getLineKey) === null || _props$source$getLine === void 0 ? void 0 : _props$source$getLine.call(_props$source2, index)) ?? `v:${props.version}:i:${index}`;
|
|
1320
|
+
return props.source.getLineKey?.(index) ?? `v:${props.version}:i:${index}`;
|
|
1216
1321
|
}
|
|
1217
1322
|
function renderCacheKey(key, fullW, clipX, visibleW) {
|
|
1218
1323
|
return JSON.stringify([
|
|
@@ -1443,42 +1548,36 @@ const TLogView = defineComponent({
|
|
|
1443
1548
|
return query.trim() ? query : "";
|
|
1444
1549
|
}
|
|
1445
1550
|
function maxSearchMatches() {
|
|
1446
|
-
|
|
1447
|
-
const n = Math.floor(Number(((_props$searchOptions = props.searchOptions) === null || _props$searchOptions === void 0 ? void 0 : _props$searchOptions.maxMatches) ?? DEFAULT_SEARCH_MAX_MATCHES));
|
|
1551
|
+
const n = Math.floor(Number(props.searchOptions?.maxMatches ?? DEFAULT_SEARCH_MAX_MATCHES));
|
|
1448
1552
|
if (!Number.isFinite(n)) return DEFAULT_SEARCH_MAX_MATCHES;
|
|
1449
1553
|
return Math.max(0, n);
|
|
1450
1554
|
}
|
|
1451
1555
|
function searchScanBudgetMs() {
|
|
1452
|
-
|
|
1453
|
-
const n = Number(((_props$searchOptions2 = props.searchOptions) === null || _props$searchOptions2 === void 0 ? void 0 : _props$searchOptions2.scanBudgetMs) ?? DEFAULT_SEARCH_SCAN_BUDGET_MS);
|
|
1556
|
+
const n = Number(props.searchOptions?.scanBudgetMs ?? DEFAULT_SEARCH_SCAN_BUDGET_MS);
|
|
1454
1557
|
if (!Number.isFinite(n)) return DEFAULT_SEARCH_SCAN_BUDGET_MS;
|
|
1455
1558
|
return Math.max(0, n);
|
|
1456
1559
|
}
|
|
1457
1560
|
function searchMode() {
|
|
1458
|
-
|
|
1459
|
-
return ((_props$searchOptions3 = props.searchOptions) === null || _props$searchOptions3 === void 0 ? void 0 : _props$searchOptions3.mode) === "regex" ? "regex" : "text";
|
|
1561
|
+
return props.searchOptions?.mode === "regex" ? "regex" : "text";
|
|
1460
1562
|
}
|
|
1461
1563
|
function normalizedMaxMatchesPerLine() {
|
|
1462
|
-
|
|
1463
|
-
const n = Math.floor(Number(((_props$searchOptions4 = props.searchOptions) === null || _props$searchOptions4 === void 0 ? void 0 : _props$searchOptions4.maxMatchesPerLine) ?? DEFAULT_SEARCH_MAX_MATCHES_PER_LINE));
|
|
1564
|
+
const n = Math.floor(Number(props.searchOptions?.maxMatchesPerLine ?? DEFAULT_SEARCH_MAX_MATCHES_PER_LINE));
|
|
1464
1565
|
if (!Number.isFinite(n)) return DEFAULT_SEARCH_MAX_MATCHES_PER_LINE;
|
|
1465
1566
|
return Math.max(0, n);
|
|
1466
1567
|
}
|
|
1467
1568
|
function normalizeRegexFlags() {
|
|
1468
|
-
var _props$searchOptions5, _props$searchOptions6;
|
|
1469
1569
|
const flags = new Set();
|
|
1470
|
-
for (const ch of
|
|
1570
|
+
for (const ch of props.searchOptions?.regexFlags ?? "") {
|
|
1471
1571
|
if (ch === "g" || ch === "y") continue;
|
|
1472
1572
|
flags.add(ch);
|
|
1473
1573
|
}
|
|
1474
|
-
if (
|
|
1574
|
+
if (props.searchOptions?.caseSensitive !== true) flags.add("i");
|
|
1475
1575
|
flags.add("g");
|
|
1476
1576
|
return Array.from(flags).join("");
|
|
1477
1577
|
}
|
|
1478
1578
|
function compileTextSearch(query) {
|
|
1479
|
-
|
|
1480
|
-
const
|
|
1481
|
-
const wholeWord = ((_props$searchOptions8 = props.searchOptions) === null || _props$searchOptions8 === void 0 ? void 0 : _props$searchOptions8.wholeWord) === true;
|
|
1579
|
+
const caseSensitive = props.searchOptions?.caseSensitive === true;
|
|
1580
|
+
const wholeWord = props.searchOptions?.wholeWord === true;
|
|
1482
1581
|
const haystackQuery = caseSensitive ? query : query.toLowerCase();
|
|
1483
1582
|
return {
|
|
1484
1583
|
key: JSON.stringify([
|
|
@@ -1868,7 +1967,7 @@ const TLogView = defineComponent({
|
|
|
1868
1967
|
function applySearchHighlightsToSegments(segments, lineIndex, visibleStartCell) {
|
|
1869
1968
|
if (!props.highlightMatches || !searchMatches.length) return segments;
|
|
1870
1969
|
const lineMatches = matchesByLine.get(lineIndex);
|
|
1871
|
-
if (!
|
|
1970
|
+
if (!lineMatches?.length) return segments;
|
|
1872
1971
|
const out = [];
|
|
1873
1972
|
let cursor = visibleStartCell;
|
|
1874
1973
|
for (const seg of segments) {
|
|
@@ -1945,14 +2044,12 @@ const TLogView = defineComponent({
|
|
|
1945
2044
|
return Math.max(1, normalizedFullRect().w);
|
|
1946
2045
|
}
|
|
1947
2046
|
function visualIndexMeasureBudgetMs() {
|
|
1948
|
-
|
|
1949
|
-
const raw = Number((_props$visualIndexOpt = props.visualIndexOptions) === null || _props$visualIndexOpt === void 0 ? void 0 : _props$visualIndexOpt.measureBudgetMs);
|
|
2047
|
+
const raw = Number(props.visualIndexOptions?.measureBudgetMs);
|
|
1950
2048
|
if (!Number.isFinite(raw)) return DEFAULT_VISUAL_INDEX_MEASURE_BUDGET_MS;
|
|
1951
2049
|
return Math.max(0, raw);
|
|
1952
2050
|
}
|
|
1953
2051
|
function visualIndexMaxMeasuredLines(count = lineCount()) {
|
|
1954
|
-
|
|
1955
|
-
const raw = (_props$visualIndexOpt2 = props.visualIndexOptions) === null || _props$visualIndexOpt2 === void 0 ? void 0 : _props$visualIndexOpt2.maxMeasuredLines;
|
|
2052
|
+
const raw = props.visualIndexOptions?.maxMeasuredLines;
|
|
1956
2053
|
if (raw == null) return count;
|
|
1957
2054
|
const n = Math.floor(Number(raw));
|
|
1958
2055
|
if (!Number.isFinite(n)) return count;
|
|
@@ -2377,7 +2474,7 @@ const TLogView = defineComponent({
|
|
|
2377
2474
|
const href = seg.style.href;
|
|
2378
2475
|
if (href) {
|
|
2379
2476
|
const previous = rowLinks[rowLinks.length - 1];
|
|
2380
|
-
if (
|
|
2477
|
+
if (previous?.href === href && previous.endX === x && previous.endCell === cell && previous.index === lineIndex) rowLinks[rowLinks.length - 1] = {
|
|
2381
2478
|
...previous,
|
|
2382
2479
|
endX: x + seg.cells,
|
|
2383
2480
|
text: previous.text + seg.text,
|
|
@@ -2424,7 +2521,7 @@ const TLogView = defineComponent({
|
|
|
2424
2521
|
return out;
|
|
2425
2522
|
}
|
|
2426
2523
|
function focusedLinkMatches(link) {
|
|
2427
|
-
return
|
|
2524
|
+
return focusedLinkTarget?.href === link.href && focusedLinkTarget.absoluteLineIndex === link.absoluteLineIndex && focusedLinkTarget.index === link.index && focusedLinkTarget.startCell === link.startCell && focusedLinkTarget.endCell === link.endCell;
|
|
2428
2525
|
}
|
|
2429
2526
|
function emitLinkFocusPayload(link, focusedLinkIndex) {
|
|
2430
2527
|
emit("linkFocus", {
|
|
@@ -2510,10 +2607,9 @@ const TLogView = defineComponent({
|
|
|
2510
2607
|
clearLinkFocus();
|
|
2511
2608
|
}
|
|
2512
2609
|
function emitLinkClick(e) {
|
|
2513
|
-
|
|
2514
|
-
const link = (_visibleLinksByRow$ge = visibleLinksByRow.get(e.cellY)) === null || _visibleLinksByRow$ge === void 0 ? void 0 : _visibleLinksByRow$ge.find((candidate) => e.cellX >= candidate.startX && e.cellX < candidate.endX);
|
|
2610
|
+
const link = visibleLinksByRow.get(e.cellY)?.find((candidate) => e.cellX >= candidate.startX && e.cellX < candidate.endX);
|
|
2515
2611
|
if (!link) return;
|
|
2516
|
-
|
|
2612
|
+
e.preventDefault?.();
|
|
2517
2613
|
emit("linkClick", {
|
|
2518
2614
|
href: link.href,
|
|
2519
2615
|
text: link.text,
|
|
@@ -2549,6 +2645,7 @@ const TLogView = defineComponent({
|
|
|
2549
2645
|
resetWheelScrollState(wheelState);
|
|
2550
2646
|
return;
|
|
2551
2647
|
}
|
|
2648
|
+
selection.refresh();
|
|
2552
2649
|
ctx.invalidate({
|
|
2553
2650
|
priority: "high",
|
|
2554
2651
|
plane: plane.value,
|
|
@@ -2579,13 +2676,13 @@ const TLogView = defineComponent({
|
|
|
2579
2676
|
for (const [y, links] of visibleLinksByRow) if (y < y0 || y >= y1) next.set(y, links);
|
|
2580
2677
|
if (delta > 0) for (let y = y0; y < y1 - delta; y++) {
|
|
2581
2678
|
const links = visibleLinksByRow.get(y + delta);
|
|
2582
|
-
if (links
|
|
2679
|
+
if (links?.length) next.set(y, links);
|
|
2583
2680
|
}
|
|
2584
2681
|
else {
|
|
2585
2682
|
const n = -delta;
|
|
2586
2683
|
for (let y = y0 + n; y < y1; y++) {
|
|
2587
2684
|
const links = visibleLinksByRow.get(y + delta);
|
|
2588
|
-
if (links
|
|
2685
|
+
if (links?.length) next.set(y, links);
|
|
2589
2686
|
}
|
|
2590
2687
|
}
|
|
2591
2688
|
visibleLinksByRow.clear();
|
|
@@ -2598,7 +2695,7 @@ const TLogView = defineComponent({
|
|
|
2598
2695
|
return rows;
|
|
2599
2696
|
}
|
|
2600
2697
|
function unionDirtyRows(nextRows) {
|
|
2601
|
-
if (!
|
|
2698
|
+
if (!dirtyRowsHint?.length) return nextRows.slice().sort((a, b) => a - b);
|
|
2602
2699
|
const rows = new Set(dirtyRowsHint);
|
|
2603
2700
|
for (const y of nextRows) rows.add(y);
|
|
2604
2701
|
return Array.from(rows).sort((a, b) => a - b);
|
|
@@ -2681,7 +2778,7 @@ const TLogView = defineComponent({
|
|
|
2681
2778
|
if (props.wrap) return null;
|
|
2682
2779
|
if (delta <= 0 || delta >= r.h) return null;
|
|
2683
2780
|
if (prevCount <= 0 || nextCount <= prevCount) return null;
|
|
2684
|
-
if (
|
|
2781
|
+
if (lastPaintedBottom?.index !== prevCount - 1) return null;
|
|
2685
2782
|
if (lineKey(prevCount - 1) === lastPaintedBottom.lineKey) return null;
|
|
2686
2783
|
return r.y + r.h - delta - 1;
|
|
2687
2784
|
}
|
|
@@ -2690,39 +2787,38 @@ const TLogView = defineComponent({
|
|
|
2690
2787
|
const full = normalizedFullRect();
|
|
2691
2788
|
const h$1 = r.h;
|
|
2692
2789
|
if (h$1 <= 0 || full.h <= 0) return false;
|
|
2693
|
-
if (
|
|
2790
|
+
if (options?.stickToBottom === true && props.wrap) ensureBottomMeasured();
|
|
2694
2791
|
const prevTop = rawScrollTop();
|
|
2695
2792
|
const clampedTop = normalizeScrollTop(nextTop);
|
|
2696
2793
|
const delta = clampedTop - prevTop;
|
|
2697
2794
|
if (!delta) {
|
|
2698
|
-
if (
|
|
2795
|
+
if (options?.stickToBottom != null) stickToBottom.value = options.stickToBottom;
|
|
2699
2796
|
return false;
|
|
2700
2797
|
}
|
|
2701
2798
|
const uncontrolled = !isScrollControlled();
|
|
2702
2799
|
if (uncontrolled) {
|
|
2703
2800
|
innerScrollTop.value = clampedTop;
|
|
2704
|
-
stickToBottom.value =
|
|
2801
|
+
stickToBottom.value = options?.stickToBottom ?? isAtBottom(clampedTop);
|
|
2705
2802
|
}
|
|
2706
|
-
if (
|
|
2803
|
+
if (options?.emitUpdate !== false) emit("update:scrollTop", clampedTop);
|
|
2707
2804
|
if (!uncontrolled) {
|
|
2708
2805
|
markViewportDirty();
|
|
2709
|
-
if (options
|
|
2806
|
+
if (options?.emitScroll) emitScroll(clampedTop);
|
|
2710
2807
|
return true;
|
|
2711
2808
|
}
|
|
2712
2809
|
const size = terminal.size();
|
|
2713
2810
|
const ownsFullRows = Math.floor(r.x) === 0 && Math.floor(r.w) >= size.cols;
|
|
2714
2811
|
const withinTerminalRows = r.y >= 0 && r.y + h$1 <= size.rows;
|
|
2715
|
-
const canUseScrollPlane = strategy === "auto" && props.rowScrollMode === "unsafe-full-row" && rendererCapabilities.value.scrollOperations && !props.wrap && ownsFullRows && withinTerminalRows && !isClipped() && Math.abs(delta) < h$1 && !
|
|
2812
|
+
const canUseScrollPlane = strategy === "auto" && props.rowScrollMode === "unsafe-full-row" && rendererCapabilities.value.scrollOperations && !props.wrap && ownsFullRows && withinTerminalRows && !isClipped() && Math.abs(delta) < h$1 && !dirtyRowsHint?.length;
|
|
2716
2813
|
if (canUseScrollPlane) {
|
|
2717
|
-
var _options$extraDirtyRo;
|
|
2718
2814
|
render.unsafeScrollPlaneRows(plane.value, r.y, r.y + h$1, delta);
|
|
2719
2815
|
shiftVisibleLinksForScrollRegion(r.y, r.y + h$1, delta);
|
|
2720
|
-
markRowsDirty(
|
|
2721
|
-
if (options
|
|
2816
|
+
markRowsDirty(options?.extraDirtyRows?.length ? [...exposedRowsForDelta(r.y, h$1, delta), ...options.extraDirtyRows] : exposedRowsForDelta(r.y, h$1, delta));
|
|
2817
|
+
if (options?.emitScroll) emitScroll(clampedTop);
|
|
2722
2818
|
return true;
|
|
2723
2819
|
}
|
|
2724
2820
|
markViewportDirty();
|
|
2725
|
-
if (options
|
|
2821
|
+
if (options?.emitScroll) emitScroll(clampedTop);
|
|
2726
2822
|
return true;
|
|
2727
2823
|
}
|
|
2728
2824
|
function visibleLineRange() {
|
|
@@ -2748,7 +2844,7 @@ const TLogView = defineComponent({
|
|
|
2748
2844
|
}
|
|
2749
2845
|
function handleSourceVersionChanged(payload) {
|
|
2750
2846
|
const prevCount = lastLineCount;
|
|
2751
|
-
const nextCount =
|
|
2847
|
+
const nextCount = payload?.lineCount ?? lineCount();
|
|
2752
2848
|
const prevFirst = lastFirstLineIndex;
|
|
2753
2849
|
const nextFirst = firstLineIndex();
|
|
2754
2850
|
const droppedHeadLines = Math.max(0, nextFirst - prevFirst);
|
|
@@ -2784,6 +2880,7 @@ const TLogView = defineComponent({
|
|
|
2784
2880
|
emitScroll: true,
|
|
2785
2881
|
stickToBottom: false
|
|
2786
2882
|
});
|
|
2883
|
+
if (changed) selection.refresh();
|
|
2787
2884
|
if (!changed) markViewportDirty();
|
|
2788
2885
|
resumeVisualMeasurement();
|
|
2789
2886
|
return true;
|
|
@@ -2794,6 +2891,7 @@ const TLogView = defineComponent({
|
|
|
2794
2891
|
emitScroll: true,
|
|
2795
2892
|
stickToBottom: stickToBottom.value && nextTop >= maxScrollTop()
|
|
2796
2893
|
});
|
|
2894
|
+
if (changed) selection.refresh();
|
|
2797
2895
|
if (!changed) markViewportDirty();
|
|
2798
2896
|
resumeVisualMeasurement();
|
|
2799
2897
|
return true;
|
|
@@ -2809,6 +2907,7 @@ const TLogView = defineComponent({
|
|
|
2809
2907
|
stickToBottom: true,
|
|
2810
2908
|
extraDirtyRows: extraDirtyRow == null ? void 0 : [extraDirtyRow]
|
|
2811
2909
|
});
|
|
2910
|
+
if (changed) selection.refresh();
|
|
2812
2911
|
if (!changed) if (sameCountTailDirtyRows.length) markRowsDirty(sameCountTailDirtyRows);
|
|
2813
2912
|
else markViewportDirty();
|
|
2814
2913
|
resumeVisualMeasurement();
|
|
@@ -2827,6 +2926,7 @@ const TLogView = defineComponent({
|
|
|
2827
2926
|
emitScroll: true,
|
|
2828
2927
|
stickToBottom: isAtBottom()
|
|
2829
2928
|
});
|
|
2929
|
+
if (changed) selection.refresh();
|
|
2830
2930
|
if (!changed) markViewportDirty();
|
|
2831
2931
|
resumeVisualMeasurement();
|
|
2832
2932
|
return true;
|
|
@@ -2909,7 +3009,10 @@ const TLogView = defineComponent({
|
|
|
2909
3009
|
stickToBottom: nextStick
|
|
2910
3010
|
});
|
|
2911
3011
|
if (!changed && nextStick != null) stickToBottom.value = nextStick;
|
|
2912
|
-
if (changed)
|
|
3012
|
+
if (changed) {
|
|
3013
|
+
selection.refresh();
|
|
3014
|
+
invalidateSelf("high", "input");
|
|
3015
|
+
}
|
|
2913
3016
|
}
|
|
2914
3017
|
function scrollToBottom() {
|
|
2915
3018
|
cancelWheelScrollFrame();
|
|
@@ -2917,7 +3020,10 @@ const TLogView = defineComponent({
|
|
|
2917
3020
|
emitScroll: true,
|
|
2918
3021
|
stickToBottom: true
|
|
2919
3022
|
});
|
|
2920
|
-
if (changed)
|
|
3023
|
+
if (changed) {
|
|
3024
|
+
selection.refresh();
|
|
3025
|
+
invalidateSelf("high", "scroll");
|
|
3026
|
+
}
|
|
2921
3027
|
}
|
|
2922
3028
|
function scrollToTop() {
|
|
2923
3029
|
cancelWheelScrollFrame();
|
|
@@ -2925,7 +3031,10 @@ const TLogView = defineComponent({
|
|
|
2925
3031
|
emitScroll: true,
|
|
2926
3032
|
stickToBottom: false
|
|
2927
3033
|
});
|
|
2928
|
-
if (changed)
|
|
3034
|
+
if (changed) {
|
|
3035
|
+
selection.refresh();
|
|
3036
|
+
invalidateSelf("high", "scroll");
|
|
3037
|
+
}
|
|
2929
3038
|
}
|
|
2930
3039
|
function scrollToVisualRow(row) {
|
|
2931
3040
|
cancelWheelScrollFrame();
|
|
@@ -2934,12 +3043,100 @@ const TLogView = defineComponent({
|
|
|
2934
3043
|
emitScroll: true,
|
|
2935
3044
|
stickToBottom: target >= maxScrollTop()
|
|
2936
3045
|
});
|
|
2937
|
-
if (changed)
|
|
3046
|
+
if (changed) {
|
|
3047
|
+
selection.refresh();
|
|
3048
|
+
invalidateSelf("high", "scroll");
|
|
3049
|
+
}
|
|
2938
3050
|
}
|
|
2939
3051
|
function scrollBy(delta) {
|
|
2940
3052
|
const n = Math.trunc(Number(delta));
|
|
2941
3053
|
scrollToVisualRow(currentScrollTop() + (Number.isFinite(n) ? n : 0));
|
|
2942
3054
|
}
|
|
3055
|
+
function scrollSelectionBy(delta) {
|
|
3056
|
+
const n = Math.trunc(Number(delta));
|
|
3057
|
+
if (!Number.isFinite(n) || n === 0) return false;
|
|
3058
|
+
cancelWheelScrollFrame();
|
|
3059
|
+
if (isScrollControlled()) {
|
|
3060
|
+
const target$1 = currentScrollTop() + n;
|
|
3061
|
+
const clampedTop = normalizeScrollTop(target$1);
|
|
3062
|
+
if (clampedTop === currentScrollTop()) return false;
|
|
3063
|
+
if (pendingSelectionScrollFocusRemap) return false;
|
|
3064
|
+
pendingSelectionScrollFocusRemap = true;
|
|
3065
|
+
emit("update:scrollTop", clampedTop);
|
|
3066
|
+
emit("scroll", scrollPayload(clampedTop));
|
|
3067
|
+
invalidateSelf("high", "scroll");
|
|
3068
|
+
return true;
|
|
3069
|
+
}
|
|
3070
|
+
const target = currentScrollTop() + n;
|
|
3071
|
+
const changed = applyScrollTop(target, "viewport-repaint", {
|
|
3072
|
+
emitScroll: true,
|
|
3073
|
+
stickToBottom: target >= maxScrollTop()
|
|
3074
|
+
});
|
|
3075
|
+
if (!changed) return false;
|
|
3076
|
+
selection.refresh({ remapFocus: true });
|
|
3077
|
+
invalidateSelf("high", "scroll");
|
|
3078
|
+
return true;
|
|
3079
|
+
}
|
|
3080
|
+
function selectionPointForCell(point) {
|
|
3081
|
+
const r = normalizedRect();
|
|
3082
|
+
if (point.x < r.x || point.y < r.y || point.x >= r.x + r.w || point.y >= r.y + r.h) return null;
|
|
3083
|
+
const { x: clipX, y: clipY } = clipOffsets();
|
|
3084
|
+
const visualY = currentScrollTop() + clipY + (point.y - r.y);
|
|
3085
|
+
if (visualY < 0 || visualY >= estimatedVisualRowCount()) return null;
|
|
3086
|
+
return {
|
|
3087
|
+
x: clamp$9(clipX + (point.x - r.x), 0, Math.max(0, currentWrapWidth() - 1)),
|
|
3088
|
+
y: visualY
|
|
3089
|
+
};
|
|
3090
|
+
}
|
|
3091
|
+
function canHandleSelectionRange(range) {
|
|
3092
|
+
return Boolean(selectionPointForCell(range.anchor) && selectionPointForCell(range.focus));
|
|
3093
|
+
}
|
|
3094
|
+
function textForVisualRow(visualRow) {
|
|
3095
|
+
const count = lineCount();
|
|
3096
|
+
if (!props.wrap) {
|
|
3097
|
+
if (visualRow < 0 || visualRow >= count) return "";
|
|
3098
|
+
if (!props.ansi) return sanitizeInlineText(props.source.getLine(visualRow));
|
|
3099
|
+
const base$1 = props.style ?? defaultStyle.value;
|
|
3100
|
+
return ansiSegmentsForLine(visualRow, count, base$1, styleCacheKey(base$1)).map((segment) => segment.text).join("");
|
|
3101
|
+
}
|
|
3102
|
+
const located = locateVisualRow(visualRow);
|
|
3103
|
+
if (!located) return "";
|
|
3104
|
+
if (!props.ansi) return wrappedRowsForLine(located.lineIndex, count, currentWrapWidth())[located.partIndex] ?? "";
|
|
3105
|
+
const base = props.style ?? defaultStyle.value;
|
|
3106
|
+
const rows = ansiWrappedRowsForLine(located.lineIndex, count, currentWrapWidth(), base, styleCacheKey(base));
|
|
3107
|
+
return (rows[located.partIndex] ?? []).map((segment) => segment.text).join("");
|
|
3108
|
+
}
|
|
3109
|
+
function textForSelectionRange(range) {
|
|
3110
|
+
const cols = currentWrapWidth();
|
|
3111
|
+
const rows = estimatedVisualRowCount();
|
|
3112
|
+
return terminalSelectionRowSpans(range, cols, rows).map((span) => {
|
|
3113
|
+
const text = sliceByCellsRange(textForVisualRow(span.y), span.x0, span.x1);
|
|
3114
|
+
return span.x1 >= cols ? text.trimEnd() : text;
|
|
3115
|
+
}).join("\n");
|
|
3116
|
+
}
|
|
3117
|
+
function visibleSpansForSelectionRange(providerRange, _screenRange) {
|
|
3118
|
+
const r = normalizedRect();
|
|
3119
|
+
const { x: clipX, y: clipY } = clipOffsets();
|
|
3120
|
+
const cols = currentWrapWidth();
|
|
3121
|
+
const totalRows = Math.max(estimatedVisualRowCount(), providerRange.anchor.y + 1, providerRange.focus.y + 1);
|
|
3122
|
+
const top = currentScrollTop() + clipY;
|
|
3123
|
+
const bottom = top + r.h;
|
|
3124
|
+
const providerSpans = terminalSelectionVisibleRowSpans(providerRange, cols, totalRows, top, bottom);
|
|
3125
|
+
const result = [];
|
|
3126
|
+
for (const span of providerSpans) {
|
|
3127
|
+
const screenY = r.y + (span.y - top);
|
|
3128
|
+
const screenX0 = r.x + span.x0 - clipX;
|
|
3129
|
+
const screenX1 = r.x + span.x1 - clipX;
|
|
3130
|
+
const x0 = Math.max(r.x, screenX0);
|
|
3131
|
+
const x1 = Math.min(r.x + r.w, screenX1);
|
|
3132
|
+
if (screenY >= r.y && screenY < r.y + r.h && x1 > x0) result.push({
|
|
3133
|
+
y: screenY,
|
|
3134
|
+
x0,
|
|
3135
|
+
x1
|
|
3136
|
+
});
|
|
3137
|
+
}
|
|
3138
|
+
return result;
|
|
3139
|
+
}
|
|
2943
3140
|
function scrollToLine(index, options) {
|
|
2944
3141
|
const count = lineCount();
|
|
2945
3142
|
if (count <= 0) return;
|
|
@@ -2953,8 +3150,8 @@ const TLogView = defineComponent({
|
|
|
2953
3150
|
visualCount = visualCounts[lineIndex] ?? 1;
|
|
2954
3151
|
}
|
|
2955
3152
|
const h$1 = viewportHeight();
|
|
2956
|
-
if (
|
|
2957
|
-
else if (
|
|
3153
|
+
if (options?.align === "center") target -= Math.floor((h$1 - visualCount) / 2);
|
|
3154
|
+
else if (options?.align === "end") target += visualCount - h$1;
|
|
2958
3155
|
scrollToVisualRow(target);
|
|
2959
3156
|
}
|
|
2960
3157
|
function repaintInvalidatedViewport() {
|
|
@@ -2963,6 +3160,7 @@ const TLogView = defineComponent({
|
|
|
2963
3160
|
emitScroll: true,
|
|
2964
3161
|
stickToBottom: stickToBottom.value && nextTop >= maxScrollTop()
|
|
2965
3162
|
});
|
|
3163
|
+
if (changed) selection.refresh();
|
|
2966
3164
|
if (!changed) markViewportDirty();
|
|
2967
3165
|
invalidateSelf("normal", "data");
|
|
2968
3166
|
}
|
|
@@ -3024,7 +3222,7 @@ const TLogView = defineComponent({
|
|
|
3024
3222
|
return index$1 >= 0 ? index$1 : 0;
|
|
3025
3223
|
}
|
|
3026
3224
|
const located = locateVisualRow(visibleLineRange().start);
|
|
3027
|
-
const firstVisibleLine =
|
|
3225
|
+
const firstVisibleLine = located?.lineIndex ?? 0;
|
|
3028
3226
|
const index = searchMatches.findIndex((match) => match.index >= firstVisibleLine);
|
|
3029
3227
|
return index >= 0 ? index : 0;
|
|
3030
3228
|
}
|
|
@@ -3036,7 +3234,7 @@ const TLogView = defineComponent({
|
|
|
3036
3234
|
return searchMatches.length - 1;
|
|
3037
3235
|
}
|
|
3038
3236
|
const located = locateVisualRow(Math.max(0, visibleLineRange().end - 1));
|
|
3039
|
-
const lastVisibleLine =
|
|
3237
|
+
const lastVisibleLine = located?.lineIndex ?? lineCount() - 1;
|
|
3040
3238
|
for (let i = searchMatches.length - 1; i >= 0; i--) if (searchMatches[i].index <= lastVisibleLine) return i;
|
|
3041
3239
|
return searchMatches.length - 1;
|
|
3042
3240
|
}
|
|
@@ -3058,7 +3256,7 @@ const TLogView = defineComponent({
|
|
|
3058
3256
|
emitSearchMatch();
|
|
3059
3257
|
invalidateSearchMarkers();
|
|
3060
3258
|
emitSearchMarkers(true);
|
|
3061
|
-
if (
|
|
3259
|
+
if (options?.scroll !== false) scrollToMatch(searchMatches[index], options?.align ?? "center");
|
|
3062
3260
|
markViewportDirty();
|
|
3063
3261
|
invalidateSelf("high", "data");
|
|
3064
3262
|
return true;
|
|
@@ -3079,11 +3277,11 @@ const TLogView = defineComponent({
|
|
|
3079
3277
|
return match ? copySearchMatch(match) : null;
|
|
3080
3278
|
}
|
|
3081
3279
|
function getSearchResults(options) {
|
|
3082
|
-
const rawOffset = Number(
|
|
3083
|
-
const rawLimit = Number(
|
|
3280
|
+
const rawOffset = Number(options?.offset ?? 0);
|
|
3281
|
+
const rawLimit = Number(options?.limit ?? searchMatches.length);
|
|
3084
3282
|
const offset = Number.isFinite(rawOffset) ? Math.max(0, Math.floor(rawOffset)) : 0;
|
|
3085
3283
|
const limit = Number.isFinite(rawLimit) ? Math.max(0, Math.floor(rawLimit)) : searchMatches.length;
|
|
3086
|
-
const includePreview =
|
|
3284
|
+
const includePreview = options?.includePreview === true;
|
|
3087
3285
|
if (!includePreview) return searchMatches.slice(offset, offset + limit).map((match, index) => ({
|
|
3088
3286
|
matchIndex: offset + index,
|
|
3089
3287
|
match: copySearchMatch(match)
|
|
@@ -3091,8 +3289,8 @@ const TLogView = defineComponent({
|
|
|
3091
3289
|
const count = lineCount();
|
|
3092
3290
|
const base = props.style ?? defaultStyle.value;
|
|
3093
3291
|
const baseStyleKey = styleCacheKey(base);
|
|
3094
|
-
const previewWidth = normalizeSearchResultPreviewWidth(options
|
|
3095
|
-
const contextCells = normalizeSearchResultContextCells(options
|
|
3292
|
+
const previewWidth = normalizeSearchResultPreviewWidth(options?.previewWidth);
|
|
3293
|
+
const contextCells = normalizeSearchResultContextCells(options?.contextCells);
|
|
3096
3294
|
return searchMatches.slice(offset, offset + limit).map((match, index) => ({
|
|
3097
3295
|
matchIndex: offset + index,
|
|
3098
3296
|
match: copySearchMatch(match),
|
|
@@ -3213,14 +3411,27 @@ const TLogView = defineComponent({
|
|
|
3213
3411
|
keyboardScroll(bottomScrollTop(), true);
|
|
3214
3412
|
}
|
|
3215
3413
|
}
|
|
3414
|
+
const selectionTextProvider = {
|
|
3415
|
+
id: `${frameTaskId}:selection-text`,
|
|
3416
|
+
get rect() {
|
|
3417
|
+
return normalizedRect();
|
|
3418
|
+
},
|
|
3419
|
+
canHandle: canHandleSelectionRange,
|
|
3420
|
+
pointForCell: selectionPointForCell,
|
|
3421
|
+
getText: textForSelectionRange,
|
|
3422
|
+
getVisibleSpans: visibleSpansForSelectionRange
|
|
3423
|
+
};
|
|
3424
|
+
const unregisterSelectionTextProvider = selection.registerTextProvider(selectionTextProvider);
|
|
3425
|
+
onBeforeUnmount(unregisterSelectionTextProvider);
|
|
3216
3426
|
const eventNode = useTerminalNode(() => ({
|
|
3217
3427
|
rect: normalizedRect(),
|
|
3218
3428
|
zIndex: eventZ.value,
|
|
3219
3429
|
visible: visible.value,
|
|
3220
3430
|
focusable: true,
|
|
3431
|
+
selectable: props.selectable,
|
|
3432
|
+
selectionScrollBy: scrollSelectionBy,
|
|
3221
3433
|
handlers: {
|
|
3222
3434
|
wheel: (e) => {
|
|
3223
|
-
var _e$preventDefault2;
|
|
3224
3435
|
const { deltaY, mode } = getWheelScrollInput(e);
|
|
3225
3436
|
if (!deltaY) return;
|
|
3226
3437
|
const maxTop = maxScrollTop();
|
|
@@ -3229,7 +3440,7 @@ const TLogView = defineComponent({
|
|
|
3229
3440
|
const { nextTop, dir } = applyWheelScroll(wheelState, deltaY, baseTop, maxTop, now, mode, { disableAcceleration: mode === "pixel" });
|
|
3230
3441
|
if (!dir || nextTop === baseTop) return;
|
|
3231
3442
|
if (!requestWheelScroll(nextTop)) return;
|
|
3232
|
-
|
|
3443
|
+
e.preventDefault?.();
|
|
3233
3444
|
},
|
|
3234
3445
|
focus: () => {
|
|
3235
3446
|
focused.value = true;
|
|
@@ -3284,6 +3495,9 @@ const TLogView = defineComponent({
|
|
|
3284
3495
|
watch(() => props.scrollTop, () => {
|
|
3285
3496
|
cancelWheelScrollFrame();
|
|
3286
3497
|
syncStickFromCurrentScrollTop();
|
|
3498
|
+
const remap = pendingSelectionScrollFocusRemap;
|
|
3499
|
+
pendingSelectionScrollFocusRemap = false;
|
|
3500
|
+
selection.refresh(remap ? { remapFocus: true } : void 0);
|
|
3287
3501
|
markViewportDirty();
|
|
3288
3502
|
invalidateSelf("high", "scroll");
|
|
3289
3503
|
});
|
|
@@ -3291,14 +3505,8 @@ const TLogView = defineComponent({
|
|
|
3291
3505
|
() => props.source,
|
|
3292
3506
|
() => props.wrap,
|
|
3293
3507
|
() => props.visualIndexMode,
|
|
3294
|
-
() =>
|
|
3295
|
-
|
|
3296
|
-
return (_props$visualIndexOpt3 = props.visualIndexOptions) === null || _props$visualIndexOpt3 === void 0 ? void 0 : _props$visualIndexOpt3.measureBudgetMs;
|
|
3297
|
-
},
|
|
3298
|
-
() => {
|
|
3299
|
-
var _props$visualIndexOpt4;
|
|
3300
|
-
return (_props$visualIndexOpt4 = props.visualIndexOptions) === null || _props$visualIndexOpt4 === void 0 ? void 0 : _props$visualIndexOpt4.maxMeasuredLines;
|
|
3301
|
-
},
|
|
3508
|
+
() => props.visualIndexOptions?.measureBudgetMs,
|
|
3509
|
+
() => props.visualIndexOptions?.maxMeasuredLines,
|
|
3302
3510
|
() => props.ansi,
|
|
3303
3511
|
() => props.links,
|
|
3304
3512
|
() => props.linkStyle,
|
|
@@ -3316,30 +3524,12 @@ const TLogView = defineComponent({
|
|
|
3316
3524
|
}, { immediate: true });
|
|
3317
3525
|
watch([
|
|
3318
3526
|
() => props.searchQuery,
|
|
3319
|
-
() =>
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
() =>
|
|
3324
|
-
|
|
3325
|
-
return (_props$searchOptions10 = props.searchOptions) === null || _props$searchOptions10 === void 0 ? void 0 : _props$searchOptions10.caseSensitive;
|
|
3326
|
-
},
|
|
3327
|
-
() => {
|
|
3328
|
-
var _props$searchOptions11;
|
|
3329
|
-
return (_props$searchOptions11 = props.searchOptions) === null || _props$searchOptions11 === void 0 ? void 0 : _props$searchOptions11.wholeWord;
|
|
3330
|
-
},
|
|
3331
|
-
() => {
|
|
3332
|
-
var _props$searchOptions12;
|
|
3333
|
-
return (_props$searchOptions12 = props.searchOptions) === null || _props$searchOptions12 === void 0 ? void 0 : _props$searchOptions12.regexFlags;
|
|
3334
|
-
},
|
|
3335
|
-
() => {
|
|
3336
|
-
var _props$searchOptions13;
|
|
3337
|
-
return (_props$searchOptions13 = props.searchOptions) === null || _props$searchOptions13 === void 0 ? void 0 : _props$searchOptions13.maxMatchesPerLine;
|
|
3338
|
-
},
|
|
3339
|
-
() => {
|
|
3340
|
-
var _props$searchOptions14;
|
|
3341
|
-
return (_props$searchOptions14 = props.searchOptions) === null || _props$searchOptions14 === void 0 ? void 0 : _props$searchOptions14.maxMatches;
|
|
3342
|
-
},
|
|
3527
|
+
() => props.searchOptions?.mode,
|
|
3528
|
+
() => props.searchOptions?.caseSensitive,
|
|
3529
|
+
() => props.searchOptions?.wholeWord,
|
|
3530
|
+
() => props.searchOptions?.regexFlags,
|
|
3531
|
+
() => props.searchOptions?.maxMatchesPerLine,
|
|
3532
|
+
() => props.searchOptions?.maxMatches,
|
|
3343
3533
|
() => props.ansi,
|
|
3344
3534
|
() => props.links,
|
|
3345
3535
|
() => props.source
|
|
@@ -3384,6 +3574,7 @@ const TLogView = defineComponent({
|
|
|
3384
3574
|
emitUpdate: wasInitialized,
|
|
3385
3575
|
stickToBottom: nextStick
|
|
3386
3576
|
});
|
|
3577
|
+
if (changed) selection.refresh();
|
|
3387
3578
|
if (!changed) markViewportDirty();
|
|
3388
3579
|
invalidateSelf("normal", "data");
|
|
3389
3580
|
}, { immediate: true });
|
|
@@ -3526,7 +3717,7 @@ const TLogView = defineComponent({
|
|
|
3526
3717
|
});
|
|
3527
3718
|
};
|
|
3528
3719
|
const rows = dirtyRows;
|
|
3529
|
-
if (rows
|
|
3720
|
+
if (rows?.length) {
|
|
3530
3721
|
for (const y of rows) paintRow(y);
|
|
3531
3722
|
syncFocusedVisibleLinkFromViewport();
|
|
3532
3723
|
trimRenderCache();
|
|
@@ -3726,7 +3917,6 @@ const TLogScrollbar = defineComponent({
|
|
|
3726
3917
|
return intersectRect(translated, parent.clipRect) ?? EMPTY_RECT$5;
|
|
3727
3918
|
});
|
|
3728
3919
|
function emitTrackScroll(e) {
|
|
3729
|
-
var _e$preventDefault4;
|
|
3730
3920
|
const metrics = props.metrics;
|
|
3731
3921
|
if (!metrics) return;
|
|
3732
3922
|
const full = fullRect.value;
|
|
@@ -3735,15 +3925,13 @@ const TLogScrollbar = defineComponent({
|
|
|
3735
3925
|
const { arrowRows, trackTop, trackHeight } = trackGeometry(full.h, props.showArrows);
|
|
3736
3926
|
if (arrowRows) {
|
|
3737
3927
|
if (localY === 0) {
|
|
3738
|
-
var _e$preventDefault;
|
|
3739
3928
|
emit("scrollBy", -Math.max(1, normalizeInt$7(metrics.viewportRows)));
|
|
3740
|
-
|
|
3929
|
+
e.preventDefault?.();
|
|
3741
3930
|
return;
|
|
3742
3931
|
}
|
|
3743
3932
|
if (localY === full.h - 1) {
|
|
3744
|
-
var _e$preventDefault2;
|
|
3745
3933
|
emit("scrollBy", Math.max(1, normalizeInt$7(metrics.viewportRows)));
|
|
3746
|
-
|
|
3934
|
+
e.preventDefault?.();
|
|
3747
3935
|
return;
|
|
3748
3936
|
}
|
|
3749
3937
|
}
|
|
@@ -3752,7 +3940,6 @@ const TLogScrollbar = defineComponent({
|
|
|
3752
3940
|
const isThumbRow = thumb != null && localY >= thumb.top && localY < thumb.top + thumb.size;
|
|
3753
3941
|
const markerHit = !isThumbRow && props.showMarkers ? collectMarkersByRow$1(props.markers, metrics, full.h, props.showArrows).get(localY) : void 0;
|
|
3754
3942
|
if (markerHit != null) {
|
|
3755
|
-
var _e$preventDefault3;
|
|
3756
3943
|
emit("markerClick", {
|
|
3757
3944
|
marker: markerHit.marker,
|
|
3758
3945
|
markerIndex: markerHit.index,
|
|
@@ -3760,14 +3947,14 @@ const TLogScrollbar = defineComponent({
|
|
|
3760
3947
|
cellX: e.cellX,
|
|
3761
3948
|
cellY: e.cellY
|
|
3762
3949
|
});
|
|
3763
|
-
|
|
3950
|
+
e.preventDefault?.();
|
|
3764
3951
|
return;
|
|
3765
3952
|
}
|
|
3766
3953
|
const pos = clamp$8(localY - trackTop, 0, trackHeight - 1);
|
|
3767
3954
|
const ratio = trackHeight <= 1 ? 0 : pos / (trackHeight - 1);
|
|
3768
3955
|
const target = Math.round(ratio * Math.max(0, normalizeInt$7(metrics.maxScrollTop)));
|
|
3769
3956
|
emit("scrollTo", target);
|
|
3770
|
-
|
|
3957
|
+
e.preventDefault?.();
|
|
3771
3958
|
}
|
|
3772
3959
|
useTerminalNode(() => ({
|
|
3773
3960
|
rect: rect.value,
|
|
@@ -3777,11 +3964,10 @@ const TLogScrollbar = defineComponent({
|
|
|
3777
3964
|
handlers: {
|
|
3778
3965
|
click: emitTrackScroll,
|
|
3779
3966
|
wheel: (e) => {
|
|
3780
|
-
var _e$preventDefault5;
|
|
3781
3967
|
const dir = Math.sign(Number(e.deltaY ?? 0));
|
|
3782
3968
|
if (!dir) return;
|
|
3783
3969
|
emit("scrollBy", dir);
|
|
3784
|
-
|
|
3970
|
+
e.preventDefault?.();
|
|
3785
3971
|
}
|
|
3786
3972
|
}
|
|
3787
3973
|
}));
|
|
@@ -3837,18 +4023,15 @@ const TLogScrollbar = defineComponent({
|
|
|
3837
4023
|
style = markerHit.marker.current ? currentMarkerStyle : markerStyle;
|
|
3838
4024
|
}
|
|
3839
4025
|
}
|
|
3840
|
-
if (thumb && localY >= thumb.top && localY < thumb.top + thumb.size) {
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
char = EXACT_THUMB_CHAR;
|
|
3850
|
-
style = thumbStyle;
|
|
3851
|
-
}
|
|
4026
|
+
if (thumb && localY >= thumb.top && localY < thumb.top + thumb.size) if (props.metrics?.visualIndexStatus === "measuring") {
|
|
4027
|
+
char = MEASURING_THUMB_CHAR;
|
|
4028
|
+
style = measuringThumbStyle;
|
|
4029
|
+
} else if (props.metrics?.visualIndexStatus === "estimated") {
|
|
4030
|
+
char = ESTIMATED_THUMB_CHAR;
|
|
4031
|
+
style = estimatedThumbStyle;
|
|
4032
|
+
} else {
|
|
4033
|
+
char = EXACT_THUMB_CHAR;
|
|
4034
|
+
style = thumbStyle;
|
|
3852
4035
|
}
|
|
3853
4036
|
terminal.put(r.x, y, char, style);
|
|
3854
4037
|
};
|
|
@@ -4057,7 +4240,6 @@ const TLogMinimap = defineComponent({
|
|
|
4057
4240
|
return intersectRect(translated, parent.clipRect) ?? EMPTY_RECT$4;
|
|
4058
4241
|
});
|
|
4059
4242
|
function onClick(e) {
|
|
4060
|
-
var _e$preventDefault2;
|
|
4061
4243
|
const metrics = props.metrics;
|
|
4062
4244
|
if (!metrics) return;
|
|
4063
4245
|
const full = fullRect.value;
|
|
@@ -4065,7 +4247,6 @@ const TLogMinimap = defineComponent({
|
|
|
4065
4247
|
if (localY < 0 || localY >= full.h) return;
|
|
4066
4248
|
const markerHit = props.showMarkers ? collectMarkersByRow(props.markers, metrics, full.h).get(localY) : void 0;
|
|
4067
4249
|
if (markerHit) {
|
|
4068
|
-
var _e$preventDefault;
|
|
4069
4250
|
emit("markerClick", {
|
|
4070
4251
|
marker: markerHit.marker,
|
|
4071
4252
|
markerIndex: markerHit.index,
|
|
@@ -4073,7 +4254,7 @@ const TLogMinimap = defineComponent({
|
|
|
4073
4254
|
cellX: e.cellX,
|
|
4074
4255
|
cellY: e.cellY
|
|
4075
4256
|
});
|
|
4076
|
-
|
|
4257
|
+
e.preventDefault?.();
|
|
4077
4258
|
return;
|
|
4078
4259
|
}
|
|
4079
4260
|
emit("scrollTo", {
|
|
@@ -4081,7 +4262,7 @@ const TLogMinimap = defineComponent({
|
|
|
4081
4262
|
cellX: e.cellX,
|
|
4082
4263
|
cellY: e.cellY
|
|
4083
4264
|
});
|
|
4084
|
-
|
|
4265
|
+
e.preventDefault?.();
|
|
4085
4266
|
}
|
|
4086
4267
|
useTerminalNode(() => ({
|
|
4087
4268
|
rect: rect.value,
|
|
@@ -4225,7 +4406,7 @@ function cellToStringIndex(text, cell) {
|
|
|
4225
4406
|
return text.length;
|
|
4226
4407
|
}
|
|
4227
4408
|
function errorLabel$1(error) {
|
|
4228
|
-
if (
|
|
4409
|
+
if (error?.kind === "invalid-regex") return "Invalid regex";
|
|
4229
4410
|
return "Search error";
|
|
4230
4411
|
}
|
|
4231
4412
|
const TLogSearchBar = defineComponent({
|
|
@@ -4462,9 +4643,8 @@ const TLogSearchBar = defineComponent({
|
|
|
4462
4643
|
};
|
|
4463
4644
|
});
|
|
4464
4645
|
function focusSelf() {
|
|
4465
|
-
var _events$value;
|
|
4466
4646
|
const nodeId = eventNode.id.value;
|
|
4467
|
-
if (nodeId)
|
|
4647
|
+
if (nodeId) events.value?.focus(nodeId);
|
|
4468
4648
|
}
|
|
4469
4649
|
function applyUpdate(next, field) {
|
|
4470
4650
|
pendingUpdate.value = next;
|
|
@@ -4545,19 +4725,17 @@ const TLogSearchBar = defineComponent({
|
|
|
4545
4725
|
if (localX < 0 || localX >= full.w) return;
|
|
4546
4726
|
const layout = rowLayout.value;
|
|
4547
4727
|
for (const hit of layout.hits) {
|
|
4548
|
-
var _e$preventDefault;
|
|
4549
4728
|
if (localX < hit.start || localX >= hit.end) continue;
|
|
4550
4729
|
if (hit.action === "mode") toggleMode();
|
|
4551
4730
|
else if (hit.action === "case") toggleCaseSensitive();
|
|
4552
4731
|
else if (hit.action === "wholeWord") toggleWholeWord();
|
|
4553
4732
|
else emitNavigation(hit.action);
|
|
4554
|
-
|
|
4733
|
+
e.preventDefault?.();
|
|
4555
4734
|
return;
|
|
4556
4735
|
}
|
|
4557
4736
|
if (localX >= layout.inputStart && localX < layout.inputStart + layout.inputWidth) {
|
|
4558
|
-
var _e$preventDefault2;
|
|
4559
4737
|
setCursorFromLocalX(localX);
|
|
4560
|
-
|
|
4738
|
+
e.preventDefault?.();
|
|
4561
4739
|
}
|
|
4562
4740
|
}
|
|
4563
4741
|
function onKeydown(e) {
|
|
@@ -4934,17 +5112,16 @@ const TLogSearchResults = defineComponent({
|
|
|
4934
5112
|
}
|
|
4935
5113
|
}
|
|
4936
5114
|
function onClick(e) {
|
|
4937
|
-
var _events$value, _e$preventDefault;
|
|
4938
5115
|
const full = fullRect.value;
|
|
4939
5116
|
const localY = e.cellY - full.y;
|
|
4940
5117
|
if (localY < 0 || localY >= full.h) return;
|
|
4941
5118
|
const result = props.results[localY];
|
|
4942
5119
|
if (!result) return;
|
|
4943
5120
|
const nodeId = eventNode.id.value;
|
|
4944
|
-
if (props.focusable && nodeId)
|
|
5121
|
+
if (props.focusable && nodeId) events.value?.focus(nodeId);
|
|
4945
5122
|
setActiveIndex(localY);
|
|
4946
5123
|
emitSelect(localY);
|
|
4947
|
-
|
|
5124
|
+
e.preventDefault?.();
|
|
4948
5125
|
}
|
|
4949
5126
|
const eventNode = useTerminalNode(() => ({
|
|
4950
5127
|
rect: rect.value,
|
|
@@ -5097,7 +5274,7 @@ function formatCount(matchCount) {
|
|
|
5097
5274
|
return `${matchCount} ${matchCount === 1 ? "match" : "matches"}`;
|
|
5098
5275
|
}
|
|
5099
5276
|
function errorLabel(error) {
|
|
5100
|
-
if (
|
|
5277
|
+
if (error?.kind === "invalid-regex") return "Invalid regex";
|
|
5101
5278
|
return "Search error";
|
|
5102
5279
|
}
|
|
5103
5280
|
const TLogSearchPager = defineComponent({
|
|
@@ -5231,9 +5408,8 @@ const TLogSearchPager = defineComponent({
|
|
|
5231
5408
|
scheduler.invalidate({ reason: "input" });
|
|
5232
5409
|
}
|
|
5233
5410
|
function focusSelf() {
|
|
5234
|
-
var _events$value;
|
|
5235
5411
|
const nodeId = eventNode.id.value;
|
|
5236
|
-
if (nodeId)
|
|
5412
|
+
if (nodeId) events.value?.focus(nodeId);
|
|
5237
5413
|
}
|
|
5238
5414
|
function actionAt(cellX) {
|
|
5239
5415
|
const full = fullRect.value;
|
|
@@ -5248,14 +5424,13 @@ const TLogSearchPager = defineComponent({
|
|
|
5248
5424
|
return null;
|
|
5249
5425
|
}
|
|
5250
5426
|
function onClick(e) {
|
|
5251
|
-
var _e$preventDefault;
|
|
5252
5427
|
const full = fullRect.value;
|
|
5253
5428
|
if (e.cellY !== full.y) return;
|
|
5254
5429
|
focusSelf();
|
|
5255
5430
|
const action = actionAt(e.cellX);
|
|
5256
5431
|
if (!action) return;
|
|
5257
5432
|
emitPage(action);
|
|
5258
|
-
|
|
5433
|
+
e.preventDefault?.();
|
|
5259
5434
|
}
|
|
5260
5435
|
function onKeydown(e) {
|
|
5261
5436
|
if (e.key === "ArrowLeft" || e.key === "PageUp") {
|
|
@@ -5534,17 +5709,16 @@ const TLogLinksPanel = defineComponent({
|
|
|
5534
5709
|
}
|
|
5535
5710
|
}
|
|
5536
5711
|
function onClick(e) {
|
|
5537
|
-
var _events$value, _e$preventDefault;
|
|
5538
5712
|
const full = fullRect.value;
|
|
5539
5713
|
const localY = e.cellY - full.y;
|
|
5540
5714
|
if (localY < 0 || localY >= full.h) return;
|
|
5541
5715
|
const item = props.links[localY];
|
|
5542
5716
|
if (!item) return;
|
|
5543
5717
|
const nodeId = eventNode.id.value;
|
|
5544
|
-
if (props.focusable && nodeId)
|
|
5718
|
+
if (props.focusable && nodeId) events.value?.focus(nodeId);
|
|
5545
5719
|
setActiveIndex(localY);
|
|
5546
5720
|
emitSelect(localY);
|
|
5547
|
-
|
|
5721
|
+
e.preventDefault?.();
|
|
5548
5722
|
}
|
|
5549
5723
|
const eventNode = useTerminalNode(() => ({
|
|
5550
5724
|
rect: rect.value,
|
|
@@ -5942,7 +6116,7 @@ function normalizeMaxLines(value) {
|
|
|
5942
6116
|
function createAppendOnlyLogStore(options) {
|
|
5943
6117
|
const lines = [];
|
|
5944
6118
|
const version = ref(0);
|
|
5945
|
-
const maxLines = normalizeMaxLines(options
|
|
6119
|
+
const maxLines = normalizeMaxLines(options?.maxLines);
|
|
5946
6120
|
let head = 0;
|
|
5947
6121
|
let firstLineIndex = 0;
|
|
5948
6122
|
let tail = "";
|
|
@@ -5987,16 +6161,14 @@ function createAppendOnlyLogStore(options) {
|
|
|
5987
6161
|
lineCount: () => retainedLineCount(),
|
|
5988
6162
|
firstLineIndex: () => firstLineIndex,
|
|
5989
6163
|
getLine(index) {
|
|
5990
|
-
var _completedAt;
|
|
5991
6164
|
const completedCount = retainedCompletedCount();
|
|
5992
|
-
if (index >= 0 && index < completedCount) return
|
|
6165
|
+
if (index >= 0 && index < completedCount) return completedAt(index)?.text ?? "";
|
|
5993
6166
|
if (index === completedCount && tail) return tail;
|
|
5994
6167
|
return "";
|
|
5995
6168
|
},
|
|
5996
6169
|
getLineKey(index) {
|
|
5997
|
-
var _completedAt2;
|
|
5998
6170
|
const completedCount = retainedCompletedCount();
|
|
5999
|
-
if (index >= 0 && index < completedCount) return
|
|
6171
|
+
if (index >= 0 && index < completedCount) return completedAt(index)?.id ?? `missing:${firstLineIndex}:${index}`;
|
|
6000
6172
|
if (index === completedCount && tail) return `tail:${tailVersion}`;
|
|
6001
6173
|
return `empty:${firstLineIndex}:${index}`;
|
|
6002
6174
|
}
|
|
@@ -6061,6 +6233,12 @@ function escapeRegExp(value) {
|
|
|
6061
6233
|
function stringIndexToCell(text, index) {
|
|
6062
6234
|
return textCellWidth(text.slice(0, Math.max(0, index)));
|
|
6063
6235
|
}
|
|
6236
|
+
function testRegex(pattern, text) {
|
|
6237
|
+
pattern.lastIndex = 0;
|
|
6238
|
+
const ok = pattern.test(text);
|
|
6239
|
+
pattern.lastIndex = 0;
|
|
6240
|
+
return ok;
|
|
6241
|
+
}
|
|
6064
6242
|
function stripTLogAnsiText(text) {
|
|
6065
6243
|
return parseTLogAnnotatedText(text).plainText;
|
|
6066
6244
|
}
|
|
@@ -6090,13 +6268,15 @@ function parseTLogAnnotatedText(text) {
|
|
|
6090
6268
|
const ch = text[i];
|
|
6091
6269
|
out.push(ch);
|
|
6092
6270
|
plainLength += ch.length;
|
|
6093
|
-
if (currentHref)
|
|
6094
|
-
|
|
6095
|
-
href
|
|
6096
|
-
|
|
6097
|
-
|
|
6098
|
-
|
|
6099
|
-
|
|
6271
|
+
if (currentHref) {
|
|
6272
|
+
const link = activeLink;
|
|
6273
|
+
if (link && link.href === currentHref) link.endIndex += ch.length;
|
|
6274
|
+
else activeLink = {
|
|
6275
|
+
href: currentHref,
|
|
6276
|
+
startIndex: plainLength - ch.length,
|
|
6277
|
+
endIndex: plainLength
|
|
6278
|
+
};
|
|
6279
|
+
} else if (activeLink) flushLink();
|
|
6100
6280
|
continue;
|
|
6101
6281
|
}
|
|
6102
6282
|
const next = text[i + 1];
|
|
@@ -6129,7 +6309,7 @@ function parseTLogAnnotatedText(text) {
|
|
|
6129
6309
|
const parts = body.split(";");
|
|
6130
6310
|
if (parts[0] === "8" && parts.length >= 3) {
|
|
6131
6311
|
flushLink();
|
|
6132
|
-
currentHref = parts.slice(2).join(";")
|
|
6312
|
+
currentHref = sanitizeTerminalHref(parts.slice(2).join(";")) ?? void 0;
|
|
6133
6313
|
}
|
|
6134
6314
|
i = j;
|
|
6135
6315
|
continue;
|
|
@@ -6142,16 +6322,21 @@ function parseTLogAnnotatedText(text) {
|
|
|
6142
6322
|
};
|
|
6143
6323
|
}
|
|
6144
6324
|
function detectTLogUrls(text, options = {}) {
|
|
6145
|
-
const pattern = options.pattern ?? /\b(?:https?:\/\/|file:\/\/)[^\s<>"'`]+/giu;
|
|
6325
|
+
const pattern = options.pattern ?? (options.allowFileUrls ? /\b(?:https?:\/\/|mailto:|file:\/\/)[^\s<>"'`]+/giu : /\b(?:https?:\/\/|mailto:)[^\s<>"'`]+/giu);
|
|
6146
6326
|
const flags = pattern.flags.includes("g") ? pattern.flags : `${pattern.flags}g`;
|
|
6147
6327
|
const regex = new RegExp(pattern.source, flags);
|
|
6148
6328
|
const links = [];
|
|
6149
6329
|
let match;
|
|
6150
6330
|
while ((match = regex.exec(text)) != null) {
|
|
6151
|
-
const
|
|
6331
|
+
const rawHref = match[0] ?? "";
|
|
6332
|
+
if (rawHref.length === 0) {
|
|
6333
|
+
regex.lastIndex = Math.max(regex.lastIndex, match.index + 1);
|
|
6334
|
+
continue;
|
|
6335
|
+
}
|
|
6336
|
+
const href = sanitizeTerminalHref(rawHref, { allowFileUrls: options.allowFileUrls === true });
|
|
6152
6337
|
if (!href) continue;
|
|
6153
6338
|
const startIndex = match.index;
|
|
6154
|
-
const endIndex = startIndex +
|
|
6339
|
+
const endIndex = startIndex + rawHref.length;
|
|
6155
6340
|
const startCell = stringIndexToCell(text, startIndex);
|
|
6156
6341
|
const endCell = stringIndexToCell(text, endIndex);
|
|
6157
6342
|
if (endCell <= startCell) continue;
|
|
@@ -6162,7 +6347,6 @@ function detectTLogUrls(text, options = {}) {
|
|
|
6162
6347
|
endCell,
|
|
6163
6348
|
source: "url"
|
|
6164
6349
|
});
|
|
6165
|
-
if (!href.length) regex.lastIndex += 1;
|
|
6166
6350
|
}
|
|
6167
6351
|
return links;
|
|
6168
6352
|
}
|
|
@@ -6170,9 +6354,9 @@ function detectTLogLevel(text, options = {}) {
|
|
|
6170
6354
|
const errorPattern = options.errorPattern ?? /\b(?:ERROR|FATAL|ERR)\b/u;
|
|
6171
6355
|
const warningPattern = options.warningPattern ?? /\b(?:WARN|WARNING)\b/u;
|
|
6172
6356
|
const infoPattern = options.infoPattern ?? /\bINFO\b/u;
|
|
6173
|
-
if (errorPattern
|
|
6174
|
-
if (warningPattern
|
|
6175
|
-
if (options.includeInfo !== false && infoPattern
|
|
6357
|
+
if (testRegex(errorPattern, text)) return "error";
|
|
6358
|
+
if (testRegex(warningPattern, text)) return "warning";
|
|
6359
|
+
if (options.includeInfo !== false && testRegex(infoPattern, text)) return "info";
|
|
6176
6360
|
return null;
|
|
6177
6361
|
}
|
|
6178
6362
|
function createTLogDensityBucketsFromMarkers(markers, totalVisualRows$1, bucketCount = 12) {
|
|
@@ -6196,12 +6380,10 @@ function createTLogDensityBucketsFromMarkers(markers, totalVisualRows$1, bucketC
|
|
|
6196
6380
|
}).filter((bucket) => bucket != null);
|
|
6197
6381
|
}
|
|
6198
6382
|
function getTLogPluginMetadata(line, pluginName) {
|
|
6199
|
-
|
|
6200
|
-
return ((_line$results$find = line.results.find((result) => result.pluginName === pluginName)) === null || _line$results$find === void 0 ? void 0 : _line$results$find.metadata) ?? null;
|
|
6383
|
+
return line.results.find((result) => result.pluginName === pluginName)?.metadata ?? null;
|
|
6201
6384
|
}
|
|
6202
6385
|
function dispatchTLogPluginLinkAction(plugins, action) {
|
|
6203
|
-
|
|
6204
|
-
for (const plugin of plugins ?? []) (_plugin$onLinkAction = plugin.onLinkAction) === null || _plugin$onLinkAction === void 0 || _plugin$onLinkAction.call(plugin, action);
|
|
6386
|
+
for (const plugin of plugins ?? []) plugin.onLinkAction?.(action);
|
|
6205
6387
|
}
|
|
6206
6388
|
function createTLogLevelPlugin(options = {}) {
|
|
6207
6389
|
return {
|
|
@@ -6213,7 +6395,7 @@ function createTLogLevelPlugin(options = {}) {
|
|
|
6213
6395
|
getMarkers(ctx) {
|
|
6214
6396
|
return ctx.lines.flatMap((line) => {
|
|
6215
6397
|
const metadata = getTLogPluginMetadata(line, "tlog-levels");
|
|
6216
|
-
const level = metadata
|
|
6398
|
+
const level = metadata?.level;
|
|
6217
6399
|
if (!level || level === "info" && options.includeInfo === false) return [];
|
|
6218
6400
|
return [{
|
|
6219
6401
|
id: `level:${line.absoluteLineIndex}:${level}`,
|
|
@@ -6230,7 +6412,7 @@ function createTLogLevelPlugin(options = {}) {
|
|
|
6230
6412
|
getDensityBuckets(ctx) {
|
|
6231
6413
|
const markers = ctx.lines.flatMap((line) => {
|
|
6232
6414
|
const metadata = getTLogPluginMetadata(line, "tlog-levels");
|
|
6233
|
-
const level = metadata
|
|
6415
|
+
const level = metadata?.level;
|
|
6234
6416
|
if (!level || level === "info" && options.includeInfo === false) return [];
|
|
6235
6417
|
return [{
|
|
6236
6418
|
id: `density:${line.absoluteLineIndex}:${level}`,
|
|
@@ -6250,14 +6432,22 @@ function createTLogOsc8LinkPlugin() {
|
|
|
6250
6432
|
name: "tlog-osc8-links",
|
|
6251
6433
|
parseLine(ctx) {
|
|
6252
6434
|
if (!ctx.osc8Links.length) return;
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
6435
|
+
const links = [];
|
|
6436
|
+
for (let index = 0; index < ctx.osc8Links.length; index++) {
|
|
6437
|
+
const link = ctx.osc8Links[index];
|
|
6438
|
+
const href = sanitizeTerminalHref(link.href);
|
|
6439
|
+
if (!href) continue;
|
|
6440
|
+
links.push({
|
|
6441
|
+
id: `osc8:${ctx.absoluteLineIndex}:${index}:${href}`,
|
|
6442
|
+
href,
|
|
6443
|
+
text: link.text,
|
|
6444
|
+
startCell: link.startCell,
|
|
6445
|
+
endCell: link.endCell,
|
|
6446
|
+
source: "osc8"
|
|
6447
|
+
});
|
|
6448
|
+
}
|
|
6449
|
+
if (!links.length) return;
|
|
6450
|
+
return { externalLinks: links };
|
|
6261
6451
|
}
|
|
6262
6452
|
};
|
|
6263
6453
|
}
|
|
@@ -6293,7 +6483,7 @@ function createTLogLineMatcherPlugin(options) {
|
|
|
6293
6483
|
return {
|
|
6294
6484
|
name: options.name,
|
|
6295
6485
|
parseLine(ctx) {
|
|
6296
|
-
if (!pattern
|
|
6486
|
+
if (!testRegex(pattern, ctx.plainText)) return;
|
|
6297
6487
|
return { markers: [{
|
|
6298
6488
|
id: `${options.name}:${ctx.absoluteLineIndex}`,
|
|
6299
6489
|
label: options.label,
|
|
@@ -6303,7 +6493,7 @@ function createTLogLineMatcherPlugin(options) {
|
|
|
6303
6493
|
getMarkers(ctx) {
|
|
6304
6494
|
return ctx.lines.flatMap((line) => {
|
|
6305
6495
|
const metadata = getTLogPluginMetadata(line, options.name);
|
|
6306
|
-
return (
|
|
6496
|
+
return (metadata?.markers ?? []).map((marker, index) => ({
|
|
6307
6497
|
id: String(marker.id ?? `${options.name}:${line.absoluteLineIndex}:${index}`),
|
|
6308
6498
|
absoluteLineIndex: line.absoluteLineIndex,
|
|
6309
6499
|
lineIndex: line.lineIndex,
|
|
@@ -6359,8 +6549,7 @@ function useTLogLinkController(logView, options = {}) {
|
|
|
6359
6549
|
const activeIndex = ref(-1);
|
|
6360
6550
|
let suppressedActivateKey = null;
|
|
6361
6551
|
function emitAction(action) {
|
|
6362
|
-
|
|
6363
|
-
(_options$onAction = options.onAction) === null || _options$onAction === void 0 || _options$onAction.call(options, action);
|
|
6552
|
+
options.onAction?.(action);
|
|
6364
6553
|
dispatchTLogPluginLinkAction(options.plugins, action);
|
|
6365
6554
|
}
|
|
6366
6555
|
function suppressProgrammaticActivation(link) {
|
|
@@ -6378,32 +6567,27 @@ function useTLogLinkController(logView, options = {}) {
|
|
|
6378
6567
|
});
|
|
6379
6568
|
}
|
|
6380
6569
|
function refresh() {
|
|
6381
|
-
|
|
6382
|
-
const next = ((_logView$value = logView.value) === null || _logView$value === void 0 ? void 0 : _logView$value.getVisibleLinks().map(toPanelItem)) ?? [];
|
|
6570
|
+
const next = logView.value?.getVisibleLinks().map(toPanelItem) ?? [];
|
|
6383
6571
|
visibleLinks.value = next;
|
|
6384
6572
|
activeIndex.value = next.findIndex((link) => link.current === true);
|
|
6385
6573
|
}
|
|
6386
6574
|
function focusVisibleLink(visibleIndex) {
|
|
6387
|
-
|
|
6388
|
-
const focused = ((_logView$value2 = logView.value) === null || _logView$value2 === void 0 ? void 0 : _logView$value2.focusVisibleLink(visibleIndex)) === true;
|
|
6575
|
+
const focused = logView.value?.focusVisibleLink(visibleIndex) === true;
|
|
6389
6576
|
refresh();
|
|
6390
6577
|
return focused;
|
|
6391
6578
|
}
|
|
6392
6579
|
function focusNextLink() {
|
|
6393
|
-
|
|
6394
|
-
const focused = ((_logView$value3 = logView.value) === null || _logView$value3 === void 0 ? void 0 : _logView$value3.focusNextLink()) === true;
|
|
6580
|
+
const focused = logView.value?.focusNextLink() === true;
|
|
6395
6581
|
refresh();
|
|
6396
6582
|
return focused;
|
|
6397
6583
|
}
|
|
6398
6584
|
function focusPreviousLink() {
|
|
6399
|
-
|
|
6400
|
-
const focused = ((_logView$value4 = logView.value) === null || _logView$value4 === void 0 ? void 0 : _logView$value4.focusPreviousLink()) === true;
|
|
6585
|
+
const focused = logView.value?.focusPreviousLink() === true;
|
|
6401
6586
|
refresh();
|
|
6402
6587
|
return focused;
|
|
6403
6588
|
}
|
|
6404
6589
|
function clearFocus() {
|
|
6405
|
-
|
|
6406
|
-
(_logView$value5 = logView.value) === null || _logView$value5 === void 0 || _logView$value5.clearLinkFocus();
|
|
6590
|
+
logView.value?.clearLinkFocus();
|
|
6407
6591
|
refresh();
|
|
6408
6592
|
}
|
|
6409
6593
|
function activateVisibleLink(visibleIndex) {
|
|
@@ -6540,18 +6724,15 @@ function useTLogSearchResultsPage(logView, options = {}) {
|
|
|
6540
6724
|
previewWidth: options.previewWidth,
|
|
6541
6725
|
contextCells: options.contextCells
|
|
6542
6726
|
}) : [];
|
|
6543
|
-
const results = rawResults.map((entry) => {
|
|
6544
|
-
|
|
6545
|
-
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
|
|
6549
|
-
|
|
6550
|
-
|
|
6551
|
-
|
|
6552
|
-
current: entry.matchIndex === search.currentMatchIndex
|
|
6553
|
-
};
|
|
6554
|
-
});
|
|
6727
|
+
const results = rawResults.map((entry) => ({
|
|
6728
|
+
matchIndex: entry.matchIndex,
|
|
6729
|
+
absoluteLineIndex: entry.match.absoluteLineIndex,
|
|
6730
|
+
lineIndex: entry.match.index,
|
|
6731
|
+
text: entry.preview?.text ?? "",
|
|
6732
|
+
matchStartCell: entry.preview?.matchStartCell ?? 0,
|
|
6733
|
+
matchEndCell: entry.preview?.matchEndCell ?? 0,
|
|
6734
|
+
current: entry.matchIndex === search.currentMatchIndex
|
|
6735
|
+
}));
|
|
6555
6736
|
const activeIndex = search.currentMatchIndex >= offset && search.currentMatchIndex < offset + results.length ? search.currentMatchIndex - offset : -1;
|
|
6556
6737
|
currentPage.value = page;
|
|
6557
6738
|
state.value = {
|
|
@@ -6578,8 +6759,7 @@ function useTLogSearchResultsPage(logView, options = {}) {
|
|
|
6578
6759
|
setPage(currentPage.value - 1);
|
|
6579
6760
|
}
|
|
6580
6761
|
function syncPageToCurrentMatch() {
|
|
6581
|
-
|
|
6582
|
-
const currentMatchIndex = ((_logView$value = logView.value) === null || _logView$value === void 0 ? void 0 : _logView$value.getSearchState().currentMatchIndex) ?? -1;
|
|
6762
|
+
const currentMatchIndex = logView.value?.getSearchState().currentMatchIndex ?? -1;
|
|
6583
6763
|
if (currentMatchIndex >= 0) currentPage.value = Math.floor(currentMatchIndex / pageSize);
|
|
6584
6764
|
refresh();
|
|
6585
6765
|
}
|
|
@@ -6708,25 +6888,22 @@ function useTLogSearchController(logView, options = {}) {
|
|
|
6708
6888
|
regexFlags.value = String(value ?? "");
|
|
6709
6889
|
}
|
|
6710
6890
|
function nextMatch() {
|
|
6711
|
-
var _logView$value;
|
|
6712
6891
|
recordHistory();
|
|
6713
|
-
|
|
6892
|
+
logView.value?.findNext();
|
|
6714
6893
|
resultsPage.syncPageToCurrentMatch();
|
|
6715
6894
|
refresh();
|
|
6716
6895
|
}
|
|
6717
6896
|
function previousMatch() {
|
|
6718
|
-
var _logView$value2;
|
|
6719
6897
|
recordHistory();
|
|
6720
|
-
|
|
6898
|
+
logView.value?.findPrevious();
|
|
6721
6899
|
resultsPage.syncPageToCurrentMatch();
|
|
6722
6900
|
refresh();
|
|
6723
6901
|
}
|
|
6724
6902
|
function clearSearch() {
|
|
6725
|
-
var _logView$value3;
|
|
6726
6903
|
query.value = "";
|
|
6727
6904
|
searchState.value = normalizeSearchState("");
|
|
6728
6905
|
markers.value = [];
|
|
6729
|
-
metrics.value =
|
|
6906
|
+
metrics.value = logView.value?.getScrollMetrics() ?? null;
|
|
6730
6907
|
resultsPage.clear();
|
|
6731
6908
|
}
|
|
6732
6909
|
function selectMatch(matchIndex) {
|
|
@@ -6740,7 +6917,7 @@ function useTLogSearchController(logView, options = {}) {
|
|
|
6740
6917
|
if (!normalizedQuery) return null;
|
|
6741
6918
|
recordHistory(normalizedQuery);
|
|
6742
6919
|
const candidate = {
|
|
6743
|
-
label:
|
|
6920
|
+
label: label?.trim() || void 0,
|
|
6744
6921
|
query: normalizedQuery,
|
|
6745
6922
|
mode: mode.value,
|
|
6746
6923
|
caseSensitive: caseSensitive.value,
|
|
@@ -6778,18 +6955,15 @@ function useTLogSearchController(logView, options = {}) {
|
|
|
6778
6955
|
searchHistory.value = value.map((entry) => String(entry ?? "").trim()).filter(Boolean).slice(0, historyLimit);
|
|
6779
6956
|
}
|
|
6780
6957
|
function setSavedSearches(value) {
|
|
6781
|
-
savedSearches.value = value.map((entry) => {
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
|
|
6789
|
-
|
|
6790
|
-
regexFlags: entry.regexFlags || void 0
|
|
6791
|
-
};
|
|
6792
|
-
});
|
|
6958
|
+
savedSearches.value = value.map((entry) => ({
|
|
6959
|
+
id: String(entry.id),
|
|
6960
|
+
label: entry.label?.trim() || void 0,
|
|
6961
|
+
query: String(entry.query ?? ""),
|
|
6962
|
+
mode: entry.mode === "regex" ? "regex" : "text",
|
|
6963
|
+
caseSensitive: entry.caseSensitive === true,
|
|
6964
|
+
wholeWord: entry.wholeWord === true,
|
|
6965
|
+
regexFlags: entry.regexFlags || void 0
|
|
6966
|
+
}));
|
|
6793
6967
|
}
|
|
6794
6968
|
watch(() => logView.value, () => {
|
|
6795
6969
|
refresh();
|
|
@@ -6845,22 +7019,21 @@ function useTLogVirtualSearchResults(logView, options = {}) {
|
|
|
6845
7019
|
}
|
|
6846
7020
|
function refresh() {
|
|
6847
7021
|
const handle = logView.value;
|
|
6848
|
-
const search = handle
|
|
6849
|
-
const itemCount = Math.max(0, normalizeInt(
|
|
6850
|
-
const currentMatchIndex = normalizeInt(
|
|
7022
|
+
const search = handle?.getSearchState();
|
|
7023
|
+
const itemCount = Math.max(0, normalizeInt(search?.matchCount ?? 0));
|
|
7024
|
+
const currentMatchIndex = normalizeInt(search?.currentMatchIndex ?? -1, -1);
|
|
6851
7025
|
const nextState = {
|
|
6852
7026
|
itemCount,
|
|
6853
7027
|
itemVersion: state.value.itemVersion + 1,
|
|
6854
7028
|
activeIndex: currentMatchIndex >= 0 ? currentMatchIndex : -1,
|
|
6855
7029
|
currentMatchIndex,
|
|
6856
|
-
status:
|
|
6857
|
-
error:
|
|
7030
|
+
status: search?.status ?? "idle",
|
|
7031
|
+
error: search?.error ?? null
|
|
6858
7032
|
};
|
|
6859
7033
|
clearCache();
|
|
6860
7034
|
state.value = nextState;
|
|
6861
7035
|
}
|
|
6862
7036
|
function getItem(index) {
|
|
6863
|
-
var _entry$preview, _entry$preview2, _entry$preview3;
|
|
6864
7037
|
const normalizedIndex = normalizeInt(index, -1);
|
|
6865
7038
|
if (normalizedIndex < 0 || normalizedIndex >= state.value.itemCount) return null;
|
|
6866
7039
|
const cached = cache.get(normalizedIndex);
|
|
@@ -6879,9 +7052,9 @@ function useTLogVirtualSearchResults(logView, options = {}) {
|
|
|
6879
7052
|
matchIndex: entry.matchIndex,
|
|
6880
7053
|
absoluteLineIndex: entry.match.absoluteLineIndex,
|
|
6881
7054
|
lineIndex: entry.match.index,
|
|
6882
|
-
text:
|
|
6883
|
-
matchStartCell:
|
|
6884
|
-
matchEndCell:
|
|
7055
|
+
text: entry.preview?.text ?? entry.match.text,
|
|
7056
|
+
matchStartCell: entry.preview?.matchStartCell ?? 0,
|
|
7057
|
+
matchEndCell: entry.preview?.matchEndCell ?? Math.max(0, entry.match.text.length),
|
|
6885
7058
|
current: entry.matchIndex === state.value.currentMatchIndex
|
|
6886
7059
|
};
|
|
6887
7060
|
cache.set(normalizedIndex, item);
|
|
@@ -6918,6 +7091,9 @@ function normalizeMaxItems(value) {
|
|
|
6918
7091
|
const n = Math.floor(Number(value ?? DEFAULT_MAX_ITEMS));
|
|
6919
7092
|
return Number.isFinite(n) ? Math.max(1, n) : DEFAULT_MAX_ITEMS;
|
|
6920
7093
|
}
|
|
7094
|
+
function sanitizeIndexedExternalHref(value, options = {}) {
|
|
7095
|
+
return sanitizeTerminalHref(value, options);
|
|
7096
|
+
}
|
|
6921
7097
|
function useTLogRetainedIndex(logView, source, version, options = {}) {
|
|
6922
7098
|
const status = ref("idle");
|
|
6923
7099
|
const links = ref([]);
|
|
@@ -6926,7 +7102,7 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
|
|
|
6926
7102
|
const plugins = computed(() => {
|
|
6927
7103
|
const builtins = [];
|
|
6928
7104
|
if (options.links) builtins.push(createTLogOsc8LinkPlugin());
|
|
6929
|
-
if (options.urls) builtins.push(createTLogUrlPlugin());
|
|
7105
|
+
if (options.urls) builtins.push(createTLogUrlPlugin({ allowFileUrls: options.allowFileUrls }));
|
|
6930
7106
|
if (options.levels) builtins.push(createTLogLevelPlugin({ bucketCount: options.bucketCount }));
|
|
6931
7107
|
return [...builtins, ...options.plugins ?? []];
|
|
6932
7108
|
});
|
|
@@ -6948,8 +7124,7 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
|
|
|
6948
7124
|
function cancelFrame(handle) {
|
|
6949
7125
|
if (!handle) return;
|
|
6950
7126
|
if (handle.kind === "raf") {
|
|
6951
|
-
|
|
6952
|
-
(_cancelAnimationFrame = (_ref = globalThis).cancelAnimationFrame) === null || _cancelAnimationFrame === void 0 || _cancelAnimationFrame.call(_ref, handle.id);
|
|
7127
|
+
globalThis.cancelAnimationFrame?.(handle.id);
|
|
6953
7128
|
return;
|
|
6954
7129
|
}
|
|
6955
7130
|
clearTimeout(handle.id);
|
|
@@ -6962,25 +7137,22 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
|
|
|
6962
7137
|
if (status.value === "indexing") status.value = "idle";
|
|
6963
7138
|
}
|
|
6964
7139
|
function estimateVisualRow(lineIndex) {
|
|
6965
|
-
|
|
6966
|
-
const metrics = (_logView$value = logView.value) === null || _logView$value === void 0 ? void 0 : _logView$value.getScrollMetrics();
|
|
7140
|
+
const metrics = logView.value?.getScrollMetrics();
|
|
6967
7141
|
if (!metrics) return Math.max(0, lineIndex);
|
|
6968
7142
|
const lineCount = Math.max(1, metrics.lineCount);
|
|
6969
7143
|
const totalVisualRows$1 = Math.max(metrics.visualRowCount, metrics.viewportRows, lineCount, 1);
|
|
6970
7144
|
return clamp$1(Math.round(lineIndex / Math.max(1, lineCount - 1) * Math.max(0, totalVisualRows$1 - 1)), 0, Math.max(0, totalVisualRows$1 - 1));
|
|
6971
7145
|
}
|
|
6972
7146
|
function currentMatchLineIndex() {
|
|
6973
|
-
var _handle$getSearchMatc;
|
|
6974
7147
|
const handle = logView.value;
|
|
6975
7148
|
if (!handle) return null;
|
|
6976
7149
|
const current = handle.getSearchState().currentMatchIndex;
|
|
6977
7150
|
if (current < 0) return null;
|
|
6978
|
-
return
|
|
7151
|
+
return handle.getSearchMatch(current)?.index ?? null;
|
|
6979
7152
|
}
|
|
6980
7153
|
function finalize(generationAtStart) {
|
|
6981
|
-
var _logView$value2, _logView$value3;
|
|
6982
7154
|
if (generationAtStart !== generation) return;
|
|
6983
|
-
const totalVisualRows$1 = Math.max(
|
|
7155
|
+
const totalVisualRows$1 = Math.max(logView.value?.getScrollMetrics().visualRowCount ?? indexedLines.length, logView.value?.getScrollMetrics().viewportRows ?? 0, indexedLines.length, 1);
|
|
6984
7156
|
const markerCtx = {
|
|
6985
7157
|
lines: indexedLines,
|
|
6986
7158
|
currentMatchLineIndex: currentMatchLineIndex(),
|
|
@@ -6991,10 +7163,9 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
|
|
|
6991
7163
|
const nextDiagnostics = [];
|
|
6992
7164
|
const nextDensity = [];
|
|
6993
7165
|
for (const plugin of plugins.value) {
|
|
6994
|
-
|
|
6995
|
-
const markers = (_plugin$getMarkers = plugin.getMarkers) === null || _plugin$getMarkers === void 0 ? void 0 : _plugin$getMarkers.call(plugin, markerCtx);
|
|
7166
|
+
const markers = plugin.getMarkers?.(markerCtx);
|
|
6996
7167
|
if (Array.isArray(markers) && markers.length) nextDiagnostics.push(...markers);
|
|
6997
|
-
const buckets =
|
|
7168
|
+
const buckets = plugin.getDensityBuckets?.(markerCtx);
|
|
6998
7169
|
if (Array.isArray(buckets) && buckets.length) nextDensity.push(...buckets);
|
|
6999
7170
|
}
|
|
7000
7171
|
links.value = indexedLines.flatMap((line) => line.externalLinks);
|
|
@@ -7003,13 +7174,12 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
|
|
|
7003
7174
|
status.value = "done";
|
|
7004
7175
|
}
|
|
7005
7176
|
function schedule() {
|
|
7006
|
-
var _sourceValue$firstLin;
|
|
7007
7177
|
const generationAtStart = generation;
|
|
7008
7178
|
const sourceValue = source.value;
|
|
7009
7179
|
const budgetMs = normalizeBudgetMs(options.budgetMs);
|
|
7010
7180
|
const maxItems = normalizeMaxItems(options.maxItems);
|
|
7011
7181
|
const lineCount = Math.max(0, Math.floor(Number(sourceValue.lineCount())));
|
|
7012
|
-
const firstLineIndex = Math.max(0, Math.floor(Number(
|
|
7182
|
+
const firstLineIndex = Math.max(0, Math.floor(Number(sourceValue.firstLineIndex?.() ?? 0)));
|
|
7013
7183
|
const activePlugins = plugins.value;
|
|
7014
7184
|
if (!lineCount) {
|
|
7015
7185
|
links.value = [];
|
|
@@ -7022,17 +7192,15 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
|
|
|
7022
7192
|
if (generationAtStart !== generation) return;
|
|
7023
7193
|
const start = Date.now();
|
|
7024
7194
|
while (cursor < lineCount && Date.now() - start < budgetMs) {
|
|
7025
|
-
var _sourceValue$getLineK;
|
|
7026
7195
|
const lineIndex = cursor++;
|
|
7027
7196
|
const text = sourceValue.getLine(lineIndex);
|
|
7028
|
-
const lineKey =
|
|
7197
|
+
const lineKey = sourceValue.getLineKey?.(lineIndex) ?? `line:${version.value}:${lineIndex}`;
|
|
7029
7198
|
const parsed = parseTLogAnnotatedText(text);
|
|
7030
7199
|
const results = [];
|
|
7031
7200
|
const externalLinks = [];
|
|
7032
7201
|
const seenLinks = new Set();
|
|
7033
7202
|
for (const plugin of activePlugins) {
|
|
7034
|
-
|
|
7035
|
-
const metadata = (_plugin$parseLine = plugin.parseLine) === null || _plugin$parseLine === void 0 ? void 0 : _plugin$parseLine.call(plugin, {
|
|
7203
|
+
const metadata = plugin.parseLine?.({
|
|
7036
7204
|
lineIndex,
|
|
7037
7205
|
absoluteLineIndex: firstLineIndex + lineIndex,
|
|
7038
7206
|
lineKey,
|
|
@@ -7046,12 +7214,14 @@ function useTLogRetainedIndex(logView, source, version, options = {}) {
|
|
|
7046
7214
|
metadata
|
|
7047
7215
|
});
|
|
7048
7216
|
for (const link of metadata.externalLinks ?? []) {
|
|
7049
|
-
const
|
|
7217
|
+
const href = sanitizeIndexedExternalHref(link.href, { allowFileUrls: options.allowFileUrls === true });
|
|
7218
|
+
if (!href) continue;
|
|
7219
|
+
const id = String(link.id ?? `${plugin.name}:${firstLineIndex + lineIndex}:${link.startCell}:${link.endCell}:${href}`);
|
|
7050
7220
|
if (seenLinks.has(id) || externalLinks.length >= maxItems) continue;
|
|
7051
7221
|
seenLinks.add(id);
|
|
7052
7222
|
externalLinks.push({
|
|
7053
7223
|
id,
|
|
7054
|
-
href
|
|
7224
|
+
href,
|
|
7055
7225
|
text: link.text,
|
|
7056
7226
|
absoluteLineIndex: firstLineIndex + lineIndex,
|
|
7057
7227
|
lineIndex,
|
|
@@ -7131,17 +7301,17 @@ function createTLogViewSessionStore(options = {}) {
|
|
|
7131
7301
|
const storage = options.storage ?? globalThis.localStorage ?? null;
|
|
7132
7302
|
const state = ref(null);
|
|
7133
7303
|
function load() {
|
|
7134
|
-
const next = deserializeTLogViewSessionState(storage
|
|
7304
|
+
const next = deserializeTLogViewSessionState(storage?.getItem(storageKey));
|
|
7135
7305
|
state.value = next;
|
|
7136
7306
|
return next;
|
|
7137
7307
|
}
|
|
7138
7308
|
function save(nextState) {
|
|
7139
7309
|
state.value = nextState;
|
|
7140
|
-
storage
|
|
7310
|
+
storage?.setItem(storageKey, serializeTLogViewSessionState(nextState));
|
|
7141
7311
|
}
|
|
7142
7312
|
function clear() {
|
|
7143
7313
|
state.value = null;
|
|
7144
|
-
storage
|
|
7314
|
+
storage?.removeItem(storageKey);
|
|
7145
7315
|
}
|
|
7146
7316
|
return {
|
|
7147
7317
|
state,
|
|
@@ -7151,35 +7321,33 @@ function createTLogViewSessionStore(options = {}) {
|
|
|
7151
7321
|
};
|
|
7152
7322
|
}
|
|
7153
7323
|
function captureTLogViewSessionState(bindings) {
|
|
7154
|
-
|
|
7155
|
-
const metrics = (_bindings$logView$val = bindings.logView.value) === null || _bindings$logView$val === void 0 ? void 0 : _bindings$logView$val.getScrollMetrics();
|
|
7324
|
+
const metrics = bindings.logView.value?.getScrollMetrics();
|
|
7156
7325
|
if (!metrics) return null;
|
|
7157
7326
|
return {
|
|
7158
7327
|
scrollTop: metrics.scrollTop,
|
|
7159
7328
|
firstLineIndex: metrics.firstLineIndex,
|
|
7160
|
-
visualIndexMode:
|
|
7329
|
+
visualIndexMode: bindings.visualIndexMode?.value ?? "estimated",
|
|
7161
7330
|
search: bindings.search ? {
|
|
7162
7331
|
query: bindings.search.query.value,
|
|
7163
7332
|
mode: bindings.search.mode.value,
|
|
7164
7333
|
caseSensitive: bindings.search.caseSensitive.value,
|
|
7165
7334
|
wholeWord: bindings.search.wholeWord.value,
|
|
7166
7335
|
regexFlags: bindings.search.regexFlags.value || void 0,
|
|
7167
|
-
currentMatchIndex:
|
|
7168
|
-
history:
|
|
7169
|
-
savedSearches:
|
|
7336
|
+
currentMatchIndex: bindings.logView.value?.getSearchState().currentMatchIndex ?? -1,
|
|
7337
|
+
history: bindings.search.searchHistory?.value ?? [],
|
|
7338
|
+
savedSearches: bindings.search.savedSearches?.value ?? []
|
|
7170
7339
|
} : void 0,
|
|
7171
7340
|
ui: {
|
|
7172
|
-
resultsPage:
|
|
7173
|
-
linksPanelActiveIndex:
|
|
7174
|
-
wrap:
|
|
7175
|
-
ansi:
|
|
7176
|
-
links:
|
|
7177
|
-
keyboardLinks:
|
|
7341
|
+
resultsPage: bindings.search?.resultsPage?.state.value.page,
|
|
7342
|
+
linksPanelActiveIndex: bindings.linkController?.activeIndex.value,
|
|
7343
|
+
wrap: bindings.wrap?.value,
|
|
7344
|
+
ansi: bindings.ansi?.value,
|
|
7345
|
+
links: bindings.links?.value,
|
|
7346
|
+
keyboardLinks: bindings.keyboardLinks?.value
|
|
7178
7347
|
}
|
|
7179
7348
|
};
|
|
7180
7349
|
}
|
|
7181
7350
|
function restoreTLogViewSessionState(bindings, state) {
|
|
7182
|
-
var _state$ui2;
|
|
7183
7351
|
if (!state) return false;
|
|
7184
7352
|
if (bindings.visualIndexMode) bindings.visualIndexMode.value = state.visualIndexMode;
|
|
7185
7353
|
if (state.ui) {
|
|
@@ -7189,33 +7357,27 @@ function restoreTLogViewSessionState(bindings, state) {
|
|
|
7189
7357
|
if (bindings.keyboardLinks && state.ui.keyboardLinks != null) bindings.keyboardLinks.value = state.ui.keyboardLinks;
|
|
7190
7358
|
}
|
|
7191
7359
|
if (bindings.search && state.search) {
|
|
7192
|
-
var _bindings$search$setS, _bindings$search2, _bindings$search$setS2, _bindings$search3, _state$ui, _bindings$search$resu;
|
|
7193
7360
|
bindings.search.updateQuery(state.search.query);
|
|
7194
7361
|
bindings.search.updateMode(state.search.mode);
|
|
7195
7362
|
bindings.search.updateCaseSensitive(state.search.caseSensitive);
|
|
7196
7363
|
bindings.search.updateWholeWord(state.search.wholeWord);
|
|
7197
7364
|
bindings.search.updateRegexFlags(state.search.regexFlags ?? "");
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
if (
|
|
7365
|
+
bindings.search.setSearchHistory?.(state.search.history ?? []);
|
|
7366
|
+
bindings.search.setSavedSearches?.(state.search.savedSearches ?? []);
|
|
7367
|
+
if (state.ui?.resultsPage != null) bindings.search.resultsPage?.setPage(state.ui.resultsPage);
|
|
7201
7368
|
if (!state.search.query) bindings.search.clearSearch();
|
|
7202
7369
|
}
|
|
7203
7370
|
const handle = bindings.logView.value;
|
|
7204
|
-
const metrics = handle
|
|
7371
|
+
const metrics = handle?.getScrollMetrics();
|
|
7205
7372
|
if (handle && metrics) {
|
|
7206
|
-
var _state$search;
|
|
7207
7373
|
const firstLineDelta = metrics.firstLineIndex - state.firstLineIndex;
|
|
7208
7374
|
const restoredScrollTop = clamp(state.scrollTop - Math.max(0, firstLineDelta), 0, metrics.maxScrollTop);
|
|
7209
7375
|
handle.scrollToVisualRow(restoredScrollTop);
|
|
7210
|
-
if ((
|
|
7211
|
-
var _bindings$search4;
|
|
7212
|
-
(_bindings$search4 = bindings.search) === null || _bindings$search4 === void 0 || _bindings$search4.selectMatch(state.search.currentMatchIndex);
|
|
7213
|
-
}
|
|
7376
|
+
if ((state.search?.currentMatchIndex ?? -1) >= 0) bindings.search?.selectMatch(state.search.currentMatchIndex);
|
|
7214
7377
|
}
|
|
7215
|
-
if (
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
if (!restored && state.ui.linksPanelActiveIndex < 0) (_bindings$linkControl3 = bindings.linkController) === null || _bindings$linkControl3 === void 0 || _bindings$linkControl3.clearFocus();
|
|
7378
|
+
if (state.ui?.linksPanelActiveIndex != null) {
|
|
7379
|
+
const restored = bindings.linkController?.focusVisibleLink(state.ui.linksPanelActiveIndex) === true;
|
|
7380
|
+
if (!restored && state.ui.linksPanelActiveIndex < 0) bindings.linkController?.clearFocus();
|
|
7219
7381
|
}
|
|
7220
7382
|
return true;
|
|
7221
7383
|
}
|
|
@@ -7247,45 +7409,39 @@ function eventSignature(event) {
|
|
|
7247
7409
|
return parts.join("+");
|
|
7248
7410
|
}
|
|
7249
7411
|
function matchesTLogKeyBinding(event, bindings) {
|
|
7250
|
-
if (!
|
|
7412
|
+
if (!bindings?.length) return false;
|
|
7251
7413
|
const signature = eventSignature(event);
|
|
7252
7414
|
return bindings.some((binding) => normalizeKeyToken(binding) === signature);
|
|
7253
7415
|
}
|
|
7254
7416
|
function handleTLogKeymapEvent(event, keymap, actions) {
|
|
7255
7417
|
if (matchesTLogKeyBinding(event, keymap.searchNext)) {
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
(_event$preventDefault = event.preventDefault) === null || _event$preventDefault === void 0 || _event$preventDefault.call(event);
|
|
7418
|
+
actions.searchNext?.();
|
|
7419
|
+
event.preventDefault?.();
|
|
7259
7420
|
return true;
|
|
7260
7421
|
}
|
|
7261
7422
|
if (matchesTLogKeyBinding(event, keymap.searchPrevious)) {
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
(_event$preventDefault2 = event.preventDefault) === null || _event$preventDefault2 === void 0 || _event$preventDefault2.call(event);
|
|
7423
|
+
actions.searchPrevious?.();
|
|
7424
|
+
event.preventDefault?.();
|
|
7265
7425
|
return true;
|
|
7266
7426
|
}
|
|
7267
7427
|
if (matchesTLogKeyBinding(event, keymap.clearSearch)) {
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
(_event$preventDefault3 = event.preventDefault) === null || _event$preventDefault3 === void 0 || _event$preventDefault3.call(event);
|
|
7428
|
+
actions.clearSearch?.();
|
|
7429
|
+
event.preventDefault?.();
|
|
7271
7430
|
return true;
|
|
7272
7431
|
}
|
|
7273
7432
|
if (matchesTLogKeyBinding(event, keymap.nextLink)) {
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
if (handled) (_event$preventDefault4 = event.preventDefault) === null || _event$preventDefault4 === void 0 || _event$preventDefault4.call(event);
|
|
7433
|
+
const handled = actions.nextLink?.() === true;
|
|
7434
|
+
if (handled) event.preventDefault?.();
|
|
7277
7435
|
return handled;
|
|
7278
7436
|
}
|
|
7279
7437
|
if (matchesTLogKeyBinding(event, keymap.previousLink)) {
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
if (handled) (_event$preventDefault5 = event.preventDefault) === null || _event$preventDefault5 === void 0 || _event$preventDefault5.call(event);
|
|
7438
|
+
const handled = actions.previousLink?.() === true;
|
|
7439
|
+
if (handled) event.preventDefault?.();
|
|
7283
7440
|
return handled;
|
|
7284
7441
|
}
|
|
7285
7442
|
if (matchesTLogKeyBinding(event, keymap.activateLink)) {
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
if (handled) (_event$preventDefault6 = event.preventDefault) === null || _event$preventDefault6 === void 0 || _event$preventDefault6.call(event);
|
|
7443
|
+
const handled = actions.activateLink?.() === true;
|
|
7444
|
+
if (handled) event.preventDefault?.();
|
|
7289
7445
|
return handled;
|
|
7290
7446
|
}
|
|
7291
7447
|
return false;
|
|
@@ -7405,71 +7561,64 @@ const tlogHighContrastPreset = Object.freeze({
|
|
|
7405
7561
|
keymap: tlogHighContrastKeymap
|
|
7406
7562
|
});
|
|
7407
7563
|
function resolveTLogViewTheme(theme) {
|
|
7408
|
-
var _theme$links, _theme$links2, _theme$search, _theme$search2;
|
|
7409
7564
|
return {
|
|
7410
7565
|
style: theme.base,
|
|
7411
|
-
linkStyle:
|
|
7412
|
-
linkFocusStyle:
|
|
7413
|
-
matchStyle:
|
|
7414
|
-
currentMatchStyle:
|
|
7566
|
+
linkStyle: theme.links?.link,
|
|
7567
|
+
linkFocusStyle: theme.links?.focused,
|
|
7568
|
+
matchStyle: theme.search?.match,
|
|
7569
|
+
currentMatchStyle: theme.search?.currentMatch
|
|
7415
7570
|
};
|
|
7416
7571
|
}
|
|
7417
7572
|
function resolveTLogSearchBarTheme(theme) {
|
|
7418
|
-
var _theme$search3, _theme$search4, _theme$search5, _theme$search6;
|
|
7419
7573
|
return {
|
|
7420
7574
|
style: theme.base,
|
|
7421
|
-
inputStyle:
|
|
7422
|
-
activeStyle:
|
|
7423
|
-
errorStyle:
|
|
7424
|
-
disabledStyle:
|
|
7575
|
+
inputStyle: theme.search?.input,
|
|
7576
|
+
activeStyle: theme.search?.active,
|
|
7577
|
+
errorStyle: theme.search?.error,
|
|
7578
|
+
disabledStyle: theme.search?.disabled,
|
|
7425
7579
|
toggleStyle: theme.base
|
|
7426
7580
|
};
|
|
7427
7581
|
}
|
|
7428
7582
|
function resolveTLogSearchResultsTheme(theme) {
|
|
7429
|
-
var _theme$search7;
|
|
7430
7583
|
return {
|
|
7431
7584
|
style: theme.base,
|
|
7432
|
-
activeStyle:
|
|
7585
|
+
activeStyle: theme.search?.active
|
|
7433
7586
|
};
|
|
7434
7587
|
}
|
|
7435
7588
|
function resolveTLogSearchPagerTheme(theme) {
|
|
7436
|
-
var _theme$search8, _theme$search9, _theme$search10;
|
|
7437
7589
|
return {
|
|
7438
7590
|
style: theme.base,
|
|
7439
|
-
activeStyle:
|
|
7440
|
-
disabledStyle:
|
|
7441
|
-
errorStyle:
|
|
7591
|
+
activeStyle: theme.search?.active,
|
|
7592
|
+
disabledStyle: theme.search?.disabled,
|
|
7593
|
+
errorStyle: theme.search?.error
|
|
7442
7594
|
};
|
|
7443
7595
|
}
|
|
7444
7596
|
function resolveTLogLinksPanelTheme(theme) {
|
|
7445
|
-
var _theme$links3;
|
|
7446
7597
|
return {
|
|
7447
7598
|
style: theme.base,
|
|
7448
|
-
activeStyle:
|
|
7599
|
+
activeStyle: theme.links?.active
|
|
7449
7600
|
};
|
|
7450
7601
|
}
|
|
7451
7602
|
function resolveTLogScrollbarTheme(theme) {
|
|
7452
|
-
var _theme$scrollbar, _theme$scrollbar2, _theme$scrollbar3, _theme$scrollbar4, _theme$scrollbar5;
|
|
7453
7603
|
return {
|
|
7454
7604
|
style: theme.base,
|
|
7455
|
-
trackStyle:
|
|
7456
|
-
thumbStyle:
|
|
7457
|
-
measuringStyle:
|
|
7458
|
-
markerStyle:
|
|
7459
|
-
currentMarkerStyle:
|
|
7605
|
+
trackStyle: theme.scrollbar?.track,
|
|
7606
|
+
thumbStyle: theme.scrollbar?.thumb,
|
|
7607
|
+
measuringStyle: theme.scrollbar?.measuring,
|
|
7608
|
+
markerStyle: theme.scrollbar?.marker,
|
|
7609
|
+
currentMarkerStyle: theme.scrollbar?.currentMarker
|
|
7460
7610
|
};
|
|
7461
7611
|
}
|
|
7462
7612
|
function resolveTLogMinimapTheme(theme) {
|
|
7463
|
-
var _theme$minimap, _theme$minimap2, _theme$minimap3, _theme$minimap4, _theme$minimap5;
|
|
7464
7613
|
return {
|
|
7465
7614
|
style: theme.base,
|
|
7466
|
-
densityStyle:
|
|
7467
|
-
viewportStyle:
|
|
7468
|
-
markerStyle:
|
|
7469
|
-
currentMarkerStyle:
|
|
7470
|
-
estimatedStyle:
|
|
7615
|
+
densityStyle: theme.minimap?.density,
|
|
7616
|
+
viewportStyle: theme.minimap?.viewport,
|
|
7617
|
+
markerStyle: theme.minimap?.marker,
|
|
7618
|
+
currentMarkerStyle: theme.minimap?.currentMarker,
|
|
7619
|
+
estimatedStyle: theme.minimap?.estimated
|
|
7471
7620
|
};
|
|
7472
7621
|
}
|
|
7473
7622
|
|
|
7474
7623
|
//#endregion
|
|
7475
|
-
export { TLogLinksPanel, TLogMinimap, TLogScrollbar, TLogSearchBar, TLogSearchPager, TLogSearchResults, TLogView, TLogVirtualLinksPanel, TLogVirtualSearchResults, TVirtualList, captureTLogViewSessionState, createAppendOnlyLogStore, createTLogDensityBucketsFromMarkers, createTLogLevelPlugin, createTLogLineMatcherPlugin, createTLogLinkActionPlugin, createTLogOsc8LinkPlugin, createTLogUrlPlugin, createTLogViewSessionStore, deserializeTLogViewSessionState, dispatchTLogPluginLinkAction, getTLogPluginMetadata, handleTLogKeymapEvent, matchesTLogKeyBinding, parseTLogAnnotatedText, resolveTLogLinksPanelTheme, resolveTLogMinimapTheme, resolveTLogScrollbarTheme, resolveTLogSearchBarTheme, resolveTLogSearchPagerTheme, resolveTLogSearchResultsTheme, resolveTLogViewTheme, restoreTLogViewSessionState, serializeTLogViewSessionState, stripTLogAnsiText, tlogDarkPreset, tlogDarkTheme, tlogDefaultKeymap, tlogDefaultPreset, tlogDefaultTheme, tlogHighContrastKeymap, tlogHighContrastPreset, tlogHighContrastTheme, toTLogExternalLinkFromVisibleLink, useTLogLinkController, useTLogRetainedIndex, useTLogSearchController, useTLogSearchResultsPage, useTLogVirtualSearchResults };
|
|
7624
|
+
export { TLogLinksPanel, TLogMinimap, TLogScrollbar, TLogSearchBar, TLogSearchPager, TLogSearchResults, TLogView, TLogVirtualLinksPanel, TLogVirtualSearchResults, TVirtualList, captureTLogViewSessionState, createAppendOnlyLogStore, createTLogDensityBucketsFromMarkers, createTLogLevelPlugin, createTLogLineMatcherPlugin, createTLogLinkActionPlugin, createTLogOsc8LinkPlugin, createTLogUrlPlugin, createTLogViewSessionStore, deserializeTLogViewSessionState, detectTLogUrls, dispatchTLogPluginLinkAction, getTLogPluginMetadata, handleTLogKeymapEvent, matchesTLogKeyBinding, parseTLogAnnotatedText, resolveTLogLinksPanelTheme, resolveTLogMinimapTheme, resolveTLogScrollbarTheme, resolveTLogSearchBarTheme, resolveTLogSearchPagerTheme, resolveTLogSearchResultsTheme, resolveTLogViewTheme, restoreTLogViewSessionState, sanitizeTerminalHref, serializeTLogViewSessionState, stripTLogAnsiText, tlogDarkPreset, tlogDarkTheme, tlogDefaultKeymap, tlogDefaultPreset, tlogDefaultTheme, tlogHighContrastKeymap, tlogHighContrastPreset, tlogHighContrastTheme, toTLogExternalLinkFromVisibleLink, useTLogLinkController, useTLogRetainedIndex, useTLogSearchController, useTLogSearchResultsPage, useTLogVirtualSearchResults };
|