@simon_he/vue-tui 1.0.1 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +99 -46
- package/dist/TMermaidText-CXm_L969.js +885 -0
- package/dist/{TSelect-HzILuti9.js → TSelect-CiyMvwl-.js} +60 -81
- package/dist/{TTree-ChOot2Bh.js → TTree-DKGiuIcM.js} +140 -103
- package/dist/agent/mermaid.cjs +2 -0
- package/dist/agent/mermaid.d.cts +2 -0
- package/dist/agent/mermaid.d.ts +2 -0
- package/dist/agent/mermaid.js +1 -0
- package/dist/agent.cjs +31184 -24907
- package/dist/agent.d.cts +11 -1
- package/dist/agent.d.ts +11 -1
- package/dist/agent.js +1700 -13
- package/dist/block-source-5CQp4tF8.js +3230 -0
- package/dist/cli/stdin-buffer.d.ts +1 -1
- package/dist/cli.cjs +5363 -6178
- package/dist/cli.d.cts +5 -1
- package/dist/cli.d.ts +5 -1
- package/dist/cli.js +3569 -302
- package/dist/core/buffer/buffer.d.ts +2 -2
- package/dist/core/buffer/eaw-ranges-unicode-17.d.ts +14 -0
- package/dist/core/perf/instrumentation-noop.d.ts +48 -0
- package/dist/core/perf/instrumentation.d.ts +136 -0
- package/dist/core/terminal/create-terminal.d.ts +1 -0
- package/dist/core/types.d.ts +0 -4
- package/dist/core.cjs +851 -1462
- package/dist/core.js +6 -6
- package/dist/{create-terminal-C2oiWFJU.js → create-terminal-DXuZ2fci.js} +54 -19
- package/dist/debug-logger-ChY_PXVk.js +74 -0
- package/dist/{dom-renderer-BqGijQID.js → dom-renderer-DNzmg2As.js} +2 -2
- package/dist/experimental.cjs +4115 -5928
- package/dist/experimental.d.cts +2 -0
- package/dist/experimental.d.ts +2 -0
- package/dist/experimental.js +1490 -9
- package/dist/frame-perf-BBhE-iuS.js +111 -0
- package/dist/{sgr-BmzxEjAO.js → hyperlink-B35-O-cW.js} +100 -1
- package/dist/index.cjs +5025 -10332
- package/dist/index.js +16 -14
- package/dist/{linkify-D_gzn9Xq.js → linkify-CuuquMQT.js} +32 -3
- package/dist/markdown.cjs +21295 -12691
- package/dist/markdown.d.cts +1 -1
- package/dist/markdown.d.ts +1 -1
- package/dist/markdown.js +211 -51
- package/dist/mermaid-CWto52Wk.js +123 -0
- package/dist/mermaid.cjs +1707 -0
- package/dist/mermaid.d.cts +3 -0
- package/dist/mermaid.d.ts +3 -0
- package/dist/mermaid.js +6 -0
- package/dist/observability/frame-perf-store.d.ts +2 -1
- package/dist/observability/frame-perf.d.ts +33 -0
- package/dist/observability.cjs +106 -107
- package/dist/observability.d.cts +2 -2
- package/dist/observability.d.ts +2 -2
- package/dist/observability.js +3 -3
- package/dist/{path-suggest-BNqcuE3-.js → path-suggest-fPzRsgPv.js} +1 -1
- package/dist/{wheel-scroll-vBRaQ7p-.js → rect-Ng-3eKzF.js} +253 -117
- package/dist/renderer/cli/index.d.ts +1 -1
- package/dist/renderer/cli/stdout-metrics.d.ts +10 -0
- package/dist/renderer/cli/stdout-renderer.d.ts +53 -7
- package/dist/renderer/terminal-graphic-render-queue.d.ts +50 -0
- package/dist/renderer/terminal-graphics-trace.d.ts +53 -0
- package/dist/renderer/terminal-graphics.d.ts +146 -0
- package/dist/renderer-dom.cjs +364 -903
- package/dist/renderer-dom.js +4 -4
- package/dist/runtime/index.d.ts +2 -0
- package/dist/{runtime-rfcZCyJq.js → runtime-D77C03RM.js} +28 -15
- package/dist/runtime.cjs +427 -889
- package/dist/runtime.js +2 -2
- package/dist/{terminal-selection-DBinO6p5.js → terminal-selection-CQYr--26.js} +4 -1
- package/dist/{tlog-theme-CvLFNMwk.js → tlog-theme-CopRt9SC.js} +37 -6
- package/dist/{trace-CjzYeIxN.js → trace-CYHDKM1m.js} +5 -0
- package/dist/vue/agent/create-png-terminal-graphic-renderer.d.ts +19 -0
- package/dist/vue/components/TAgentTerminalGraphic.d.ts +481 -0
- package/dist/vue/components/TCharts.d.ts +1121 -0
- package/dist/vue/components/TFeedback.d.ts +1 -1
- package/dist/vue/components/TFlex.d.ts +389 -0
- package/dist/vue/components/TForm.d.ts +4 -4
- package/dist/vue/components/TLogSearchBar.d.ts +3 -3
- package/dist/vue/components/TLogSearchPager.d.ts +2 -2
- package/dist/vue/components/TMarkdownText.d.ts +162 -4
- package/dist/vue/components/TMermaidText.d.ts +900 -0
- package/dist/vue/components/TVirtualList.d.ts +9 -0
- package/dist/vue/components/TVirtualMarkdown.d.ts +170 -9
- package/dist/vue/components/TVirtualRows.d.ts +9 -0
- package/dist/vue/components/TerminalProvider.d.ts +2 -0
- package/dist/vue/context.d.ts +24 -0
- package/dist/vue/index.d.ts +5 -0
- package/dist/vue/layout/flex.d.ts +67 -0
- package/dist/vue/markdown/ast.d.ts +5 -2
- package/dist/vue/markdown/document.d.ts +5 -0
- package/dist/vue/markdown/image-actions.d.ts +14 -0
- package/dist/vue/markdown/image.d.ts +11 -0
- package/dist/vue/markdown/link-actions.d.ts +14 -0
- package/dist/vue/markdown/math-actions.d.ts +14 -0
- package/dist/vue/markdown/math.d.ts +6 -0
- package/dist/vue/markdown/render.d.ts +28 -0
- package/dist/vue/markdown/types.d.ts +78 -0
- package/dist/vue/mermaid/beautiful-mermaid.d.ts +1436 -0
- package/dist/vue/render/render-manager.d.ts +7 -0
- package/dist/vue.cjs +7215 -12430
- package/dist/vue.js +706 -39
- package/dist/wheel-scroll-CQ22Hcyj.js +106 -0
- package/dist/{hyperlink-Bn02UXJb.js → width-GqllnV8C.js} +166 -111
- package/package.json +107 -18
- package/dist/block-source-CKUOnkgT.js +0 -1663
- package/dist/frame-perf-C6Xfg85O.js +0 -24
- /package/dist/{env-Cl8qmNFN.js → env-DNCzvX8b.js} +0 -0
- /package/dist/{path-mnSgEpCm.js → path-BI9W15Zt.js} +0 -0
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { getPlaneTerminal } from "./create-terminal-
|
|
2
|
-
import { charCellWidth
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { getPlaneTerminal } from "./create-terminal-DXuZ2fci.js";
|
|
2
|
+
import { charCellWidth } from "./width-GqllnV8C.js";
|
|
3
|
+
import { hasEncodedControl } from "./hyperlink-B35-O-cW.js";
|
|
4
|
+
import { DialogContextKey, EventZIndexContextKey, ImeAnchorContextKey, LayoutContextKey, RenderPlaneContextKey, RenderStackKey, TInputPluginsContextKey, TerminalContextKey, forEachTextCellSegment, graphemeRangeAt, hasTextWidthAsciiFastPath, intersectRect, padEndByCells$1 as padEndByCells, repeatChar, sanitizeInlineText, sanitizeTextBlock, sliceByCells, sliceByCellsRange, spaces, textCellWidth$1 as textCellWidth, translateRect, useLayout, useRenderNode, useRenderStack, useTerminal, useTerminalNode, useVisibility, withTextWidthProvider, wrapByCells } from "./rect-Ng-3eKzF.js";
|
|
5
|
+
import { TView, mergeStyle } from "./linkify-CuuquMQT.js";
|
|
6
|
+
import { isAbsolutePath, normalizeNewlines, normalizePath, resolvePath } from "./path-BI9W15Zt.js";
|
|
6
7
|
import { computed, defineComponent, h, inject, nextTick, onBeforeUnmount, onMounted, provide, ref, shallowReactive, shallowRef, watch, watchEffect } from "vue";
|
|
7
8
|
|
|
8
9
|
//#region src/vue/components/TRenderPlane.ts
|
|
@@ -204,7 +205,7 @@ const TBox = defineComponent({
|
|
|
204
205
|
const max = Math.max(0, w - 4);
|
|
205
206
|
const safe = sanitizeInlineText(props.title);
|
|
206
207
|
const title = sliceByCells(safe, max);
|
|
207
|
-
const ts = titleStyle ??
|
|
208
|
+
const ts = titleStyle ?? style;
|
|
208
209
|
terminal.write(` ${title} `, {
|
|
209
210
|
x: x0 + 1,
|
|
210
211
|
y: y0,
|
|
@@ -332,7 +333,7 @@ const TBox = defineComponent({
|
|
|
332
333
|
|
|
333
334
|
//#endregion
|
|
334
335
|
//#region src/vue/overlay.ts
|
|
335
|
-
function clamp$
|
|
336
|
+
function clamp$4(n, min, max) {
|
|
336
337
|
return Math.max(min, Math.min(max, n));
|
|
337
338
|
}
|
|
338
339
|
function cellCount(value) {
|
|
@@ -439,8 +440,8 @@ function resolveOverlayPlacement(opts) {
|
|
|
439
440
|
x,
|
|
440
441
|
y
|
|
441
442
|
} : {
|
|
442
|
-
x: clamp$
|
|
443
|
-
y: clamp$
|
|
443
|
+
x: clamp$4(x, 0, maxX),
|
|
444
|
+
y: clamp$4(y, 0, maxY)
|
|
444
445
|
};
|
|
445
446
|
}
|
|
446
447
|
function createOverlayFocusStack() {
|
|
@@ -624,7 +625,7 @@ const TText = defineComponent({
|
|
|
624
625
|
|
|
625
626
|
//#endregion
|
|
626
627
|
//#region src/vue/components/TDialog.ts
|
|
627
|
-
function clamp$
|
|
628
|
+
function clamp$3(n, min, max) {
|
|
628
629
|
return Math.max(min, Math.min(max, n));
|
|
629
630
|
}
|
|
630
631
|
function computePosition(opts) {
|
|
@@ -824,7 +825,7 @@ const DialogSurface = defineComponent({
|
|
|
824
825
|
}
|
|
825
826
|
},
|
|
826
827
|
setup(props) {
|
|
827
|
-
const { events, scheduler } = useTerminal();
|
|
828
|
+
const { events, scheduler, defaultStyle } = useTerminal();
|
|
828
829
|
const layout = useLayout();
|
|
829
830
|
const cols = computed(() => layout.clipRect?.w ?? 0);
|
|
830
831
|
const rows = computed(() => layout.clipRect?.h ?? 0);
|
|
@@ -1091,7 +1092,15 @@ const DialogSurface = defineComponent({
|
|
|
1091
1092
|
padding: props.padding,
|
|
1092
1093
|
border: true
|
|
1093
1094
|
});
|
|
1094
|
-
const
|
|
1095
|
+
const dialogStyle = props.style && props.style.bg == null && defaultStyle.value.bg != null ? {
|
|
1096
|
+
...props.style,
|
|
1097
|
+
bg: defaultStyle.value.bg
|
|
1098
|
+
} : props.style;
|
|
1099
|
+
const rawContentStyle = props.contentStyle ?? dialogStyle;
|
|
1100
|
+
const contentStyle = rawContentStyle && rawContentStyle.bg == null && defaultStyle.value.bg != null ? {
|
|
1101
|
+
...rawContentStyle,
|
|
1102
|
+
bg: defaultStyle.value.bg
|
|
1103
|
+
} : rawContentStyle;
|
|
1095
1104
|
const dialogBox = h(TView, {
|
|
1096
1105
|
x,
|
|
1097
1106
|
y,
|
|
@@ -1116,7 +1125,7 @@ const DialogSurface = defineComponent({
|
|
|
1116
1125
|
clear: true,
|
|
1117
1126
|
title: props.title,
|
|
1118
1127
|
padding: props.padding,
|
|
1119
|
-
style:
|
|
1128
|
+
style: dialogStyle,
|
|
1120
1129
|
titleStyle: props.titleStyle
|
|
1121
1130
|
}, () => [h(TText, {
|
|
1122
1131
|
x: 0,
|
|
@@ -1244,7 +1253,7 @@ const TDialog = defineComponent({
|
|
|
1244
1253
|
"confirm"
|
|
1245
1254
|
],
|
|
1246
1255
|
setup(props, { emit, slots }) {
|
|
1247
|
-
const { runtime, events, scheduler } = useTerminal();
|
|
1256
|
+
const { runtime, events, scheduler, defaultStyle } = useTerminal();
|
|
1248
1257
|
const layout = useLayout();
|
|
1249
1258
|
const cols = computed(() => layout.clipRect?.w ?? 0);
|
|
1250
1259
|
const rows = computed(() => layout.clipRect?.h ?? 0);
|
|
@@ -1425,7 +1434,7 @@ const TDialog = defineComponent({
|
|
|
1425
1434
|
const isDanger = b.kind === "danger";
|
|
1426
1435
|
const isAccent = b.kind === "accent";
|
|
1427
1436
|
const isMuted = b.kind === "muted";
|
|
1428
|
-
const baseBg = b.style?.bg ?? props.contentStyle?.bg ?? props.style?.bg;
|
|
1437
|
+
const baseBg = b.style?.bg ?? props.contentStyle?.bg ?? props.style?.bg ?? defaultStyle.value.bg;
|
|
1429
1438
|
const variantStyle = b.style ?? (isPrimary ? { bold: true } : isDanger ? { bold: true } : isAccent ? { underline: true } : isMuted ? { dim: true } : {});
|
|
1430
1439
|
const style = {
|
|
1431
1440
|
...variantStyle,
|
|
@@ -1547,7 +1556,7 @@ const TDialog = defineComponent({
|
|
|
1547
1556
|
}
|
|
1548
1557
|
watch(() => props.modelValue, (next, prev) => {
|
|
1549
1558
|
if (next && !prev) captureRestoreFocus();
|
|
1550
|
-
if (next && !prev) selectedButtonIndex.value = clamp$
|
|
1559
|
+
if (next && !prev) selectedButtonIndex.value = clamp$3(defaultButtonIndex(), 0, Math.max(0, props.buttons.length - 1));
|
|
1551
1560
|
if (!prev || next) return;
|
|
1552
1561
|
const closeAlreadyEmitted = skipNextCloseEmit.value;
|
|
1553
1562
|
skipNextCloseEmit.value = false;
|
|
@@ -1848,7 +1857,7 @@ function mentionChipStyle(baseStyle, _absPath, _fsKind) {
|
|
|
1848
1857
|
|
|
1849
1858
|
//#endregion
|
|
1850
1859
|
//#region src/vue/components/input/utils/inlineText.ts
|
|
1851
|
-
function clamp$
|
|
1860
|
+
function clamp$2(n, min, max) {
|
|
1852
1861
|
return Math.max(min, Math.min(max, n));
|
|
1853
1862
|
}
|
|
1854
1863
|
function isAscii(text) {
|
|
@@ -1910,7 +1919,7 @@ function mentionLabelAt(mentions, mentionIndex) {
|
|
|
1910
1919
|
}
|
|
1911
1920
|
function countTokens(value, token, endIndex = value.length) {
|
|
1912
1921
|
let count = 0;
|
|
1913
|
-
const limit = clamp$
|
|
1922
|
+
const limit = clamp$2(endIndex, 0, value.length);
|
|
1914
1923
|
for (let i = 0; i < limit; i++) if (value[i] === token) count++;
|
|
1915
1924
|
return count;
|
|
1916
1925
|
}
|
|
@@ -1925,8 +1934,8 @@ function nextInlineBoundary(value, multilineToken, mentionToken, start, end) {
|
|
|
1925
1934
|
return next;
|
|
1926
1935
|
}
|
|
1927
1936
|
function forEachInlineUnit(value, multilineToken, mentionToken, multilineTexts, mentions, start, end, cb) {
|
|
1928
|
-
const safeStart = clamp$
|
|
1929
|
-
const safeEnd = clamp$
|
|
1937
|
+
const safeStart = clamp$2(start, 0, value.length);
|
|
1938
|
+
const safeEnd = clamp$2(end, safeStart, value.length);
|
|
1930
1939
|
let tokenIndex = countMultilineTokens$1(value, multilineToken, safeStart);
|
|
1931
1940
|
let mentionIndex = countMentionTokens$1(value, mentionToken, safeStart);
|
|
1932
1941
|
for (let i = safeStart; i < safeEnd;) {
|
|
@@ -2009,8 +2018,8 @@ function mentionIndexAt$1(value, mentionToken, index) {
|
|
|
2009
2018
|
return countMentionTokens$1(value, mentionToken, index);
|
|
2010
2019
|
}
|
|
2011
2020
|
function textCellWidthInline(value, multilineToken, mentionToken, multilineTexts, mentions, start, end) {
|
|
2012
|
-
const safeStart = clamp$
|
|
2013
|
-
const safeEnd = clamp$
|
|
2021
|
+
const safeStart = clamp$2(start, 0, value.length);
|
|
2022
|
+
const safeEnd = clamp$2(end, safeStart, value.length);
|
|
2014
2023
|
let cells = 0;
|
|
2015
2024
|
forEachInlineUnit(value, multilineToken, mentionToken, multilineTexts, mentions, 0, safeEnd, (unit) => {
|
|
2016
2025
|
if (unit.end > safeStart) cells += unit.cells;
|
|
@@ -2118,7 +2127,7 @@ function wrapToLinesFirstWidthInline$1(value, multilineToken, mentionToken, mult
|
|
|
2118
2127
|
}];
|
|
2119
2128
|
}
|
|
2120
2129
|
function indexToWrappedCellColFirstWidthInline$1(value, multilineToken, mentionToken, multilineTexts, mentions, index, firstWidth, width) {
|
|
2121
|
-
const safe = clamp$
|
|
2130
|
+
const safe = clamp$2(index, 0, value.length);
|
|
2122
2131
|
const lines = wrapToLinesFirstWidthInline$1(value, multilineToken, mentionToken, multilineTexts, mentions, firstWidth, width);
|
|
2123
2132
|
for (let i = 0; i < lines.length; i++) {
|
|
2124
2133
|
const info = lines[i];
|
|
@@ -2139,7 +2148,7 @@ function indexToWrappedCellColFirstWidthInline$1(value, multilineToken, mentionT
|
|
|
2139
2148
|
};
|
|
2140
2149
|
}
|
|
2141
2150
|
function indexToLineCellColInline$1(value, multilineToken, mentionToken, multilineTexts, mentions, index) {
|
|
2142
|
-
const safe = clamp$
|
|
2151
|
+
const safe = clamp$2(index, 0, value.length);
|
|
2143
2152
|
const lines = computeLines$1(value);
|
|
2144
2153
|
for (let i = 0; i < lines.length; i++) {
|
|
2145
2154
|
const info = lines[i];
|
|
@@ -2315,7 +2324,7 @@ function buildInlineSelectionSegments(value, displayValue, multilineTexts, menti
|
|
|
2315
2324
|
|
|
2316
2325
|
//#endregion
|
|
2317
2326
|
//#region src/vue/components/input/utils/primitives.ts
|
|
2318
|
-
function clamp$
|
|
2327
|
+
function clamp$1(n, min, max) {
|
|
2319
2328
|
return Math.max(min, Math.min(max, n));
|
|
2320
2329
|
}
|
|
2321
2330
|
function isWhitespace(ch) {
|
|
@@ -2328,7 +2337,7 @@ function isWordChar(ch) {
|
|
|
2328
2337
|
//#endregion
|
|
2329
2338
|
//#region src/vue/components/input/utils/wordNavigation.ts
|
|
2330
2339
|
function findWordLeft(text, index) {
|
|
2331
|
-
let i = clamp$
|
|
2340
|
+
let i = clamp$1(index, 0, text.length);
|
|
2332
2341
|
if (i === 0) return 0;
|
|
2333
2342
|
while (i > 0 && isWhitespace(text[i - 1])) i--;
|
|
2334
2343
|
if (i === 0) return 0;
|
|
@@ -2342,7 +2351,7 @@ function findWordLeft(text, index) {
|
|
|
2342
2351
|
return i;
|
|
2343
2352
|
}
|
|
2344
2353
|
function findWordRight(text, index) {
|
|
2345
|
-
let i = clamp$
|
|
2354
|
+
let i = clamp$1(index, 0, text.length);
|
|
2346
2355
|
if (i >= text.length) return text.length;
|
|
2347
2356
|
while (i < text.length && isWhitespace(text[i])) i++;
|
|
2348
2357
|
if (i >= text.length) return text.length;
|
|
@@ -2357,7 +2366,7 @@ function findWordRight(text, index) {
|
|
|
2357
2366
|
}
|
|
2358
2367
|
function tokenRangeAt(value, index) {
|
|
2359
2368
|
if (!value) return null;
|
|
2360
|
-
let i = clamp$
|
|
2369
|
+
let i = clamp$1(index, 0, value.length);
|
|
2361
2370
|
if (i === value.length) i = value.length - 1;
|
|
2362
2371
|
if (i < 0) return null;
|
|
2363
2372
|
const ch0 = value[i];
|
|
@@ -2406,7 +2415,7 @@ function computeLines(value) {
|
|
|
2406
2415
|
return computeLines$1(value);
|
|
2407
2416
|
}
|
|
2408
2417
|
function indexToLineCellCol(value, index) {
|
|
2409
|
-
const safe = clamp$
|
|
2418
|
+
const safe = clamp$1(index, 0, value.length);
|
|
2410
2419
|
const lines = computeLines(value);
|
|
2411
2420
|
for (let i = 0; i < lines.length; i++) {
|
|
2412
2421
|
const info = lines[i];
|
|
@@ -2670,7 +2679,7 @@ const TInput = defineComponent({
|
|
|
2670
2679
|
function measureContent(r) {
|
|
2671
2680
|
const wAll = Math.max(0, Math.floor(r.w));
|
|
2672
2681
|
const hAll = Math.max(0, Math.floor(r.h));
|
|
2673
|
-
const padX = clamp$
|
|
2682
|
+
const padX = clamp$1(PADDING_X, 0, Math.floor(wAll / 2));
|
|
2674
2683
|
const w = Math.max(0, wAll - padX * 2);
|
|
2675
2684
|
return {
|
|
2676
2685
|
wAll,
|
|
@@ -2772,8 +2781,8 @@ const TInput = defineComponent({
|
|
|
2772
2781
|
cursor.value = nextLen;
|
|
2773
2782
|
anchor.value = null;
|
|
2774
2783
|
} else {
|
|
2775
|
-
cursor.value = clamp$
|
|
2776
|
-
if (anchor.value != null) anchor.value = clamp$
|
|
2784
|
+
cursor.value = clamp$1(cursor.value, 0, nextLen);
|
|
2785
|
+
if (anchor.value != null) anchor.value = clamp$1(anchor.value, 0, nextLen);
|
|
2777
2786
|
}
|
|
2778
2787
|
if (composing.value && next !== prev) {
|
|
2779
2788
|
compositionBlocked.value = true;
|
|
@@ -2895,10 +2904,10 @@ const TInput = defineComponent({
|
|
|
2895
2904
|
});
|
|
2896
2905
|
const useCompositionEnd = typeof document !== "undefined";
|
|
2897
2906
|
function getComposedTextAndCursor(value) {
|
|
2898
|
-
const baseCursor = clamp$
|
|
2907
|
+
const baseCursor = clamp$1(cursor.value, 0, value.length);
|
|
2899
2908
|
if (composing.value && compositionText.value) {
|
|
2900
2909
|
const text = `${value.slice(0, baseCursor)}${compositionText.value}${value.slice(baseCursor)}`;
|
|
2901
|
-
const cursorIndex = useCompositionEnd ? clamp$
|
|
2910
|
+
const cursorIndex = useCompositionEnd ? clamp$1(baseCursor + compositionText.value.length, 0, text.length) : baseCursor;
|
|
2902
2911
|
return {
|
|
2903
2912
|
text,
|
|
2904
2913
|
cursor: cursorIndex
|
|
@@ -2928,9 +2937,9 @@ const TInput = defineComponent({
|
|
|
2928
2937
|
else if (col > scrollX.value + viewW - 1) scrollX.value = Math.max(0, col - (viewW - 1));
|
|
2929
2938
|
}
|
|
2930
2939
|
const maxTop = Math.max(0, lines.length - height);
|
|
2931
|
-
scrollY.value = clamp$
|
|
2940
|
+
scrollY.value = clamp$1(scrollY.value, 0, maxTop);
|
|
2932
2941
|
if (line < scrollY.value) scrollY.value = line;
|
|
2933
|
-
else if (line > scrollY.value + height - 1) scrollY.value = clamp$
|
|
2942
|
+
else if (line > scrollY.value + height - 1) scrollY.value = clamp$1(line - (height - 1), 0, maxTop);
|
|
2934
2943
|
});
|
|
2935
2944
|
}
|
|
2936
2945
|
function computeImeAnchorCell() {
|
|
@@ -2952,8 +2961,8 @@ const TInput = defineComponent({
|
|
|
2952
2961
|
const pos = wrap ? indexToWrappedCellColFirstWidthInline(cursorText, props.multilineTexts, props.mentions, composed.cursor, firstWidth, width) : indexToLineCellColInline(cursorText, props.multilineTexts, props.mentions, composed.cursor);
|
|
2953
2962
|
const cx0 = pos.col - offX;
|
|
2954
2963
|
const cy = pos.line - offY;
|
|
2955
|
-
const cx = clamp$
|
|
2956
|
-
const cyClamped = clamp$
|
|
2964
|
+
const cx = clamp$1(cx0, 0, Math.max(0, width - 1));
|
|
2965
|
+
const cyClamped = clamp$1(cy, 0, Math.max(0, r.h - 1));
|
|
2957
2966
|
return {
|
|
2958
2967
|
cellX: r.x + padX + cx,
|
|
2959
2968
|
cellY: r.y + cyClamped
|
|
@@ -2981,8 +2990,8 @@ const TInput = defineComponent({
|
|
|
2981
2990
|
const r = absRect.value;
|
|
2982
2991
|
const { w: contentW, padX } = measureContent(r);
|
|
2983
2992
|
const width = Math.max(1, contentW);
|
|
2984
|
-
const localX = clamp$
|
|
2985
|
-
const localY = clamp$
|
|
2993
|
+
const localX = clamp$1(cellX - (r.x + padX), 0, Math.max(0, contentW - 1));
|
|
2994
|
+
const localY = clamp$1(cellY - r.y, 0, Math.max(0, r.h - 1));
|
|
2986
2995
|
const value = getValue();
|
|
2987
2996
|
const wrap = wrapMode.value;
|
|
2988
2997
|
const xText = localX;
|
|
@@ -2991,14 +3000,14 @@ const TInput = defineComponent({
|
|
|
2991
3000
|
let hit = null;
|
|
2992
3001
|
if (wrap) {
|
|
2993
3002
|
const lines = wrapToLinesFirstWidthInline(value, props.multilineTexts, props.mentions, firstWidth, width);
|
|
2994
|
-
const line = clamp$
|
|
3003
|
+
const line = clamp$1(scrollY.value + localY, 0, lines.length - 1);
|
|
2995
3004
|
const col = xText;
|
|
2996
3005
|
const hit2 = wrappedCellColToIndexInline(value, props.multilineTexts, props.mentions, lines[line], col);
|
|
2997
3006
|
next = hit2.index;
|
|
2998
3007
|
hit = hit2.hit;
|
|
2999
3008
|
} else {
|
|
3000
3009
|
const lines = computeLines(value);
|
|
3001
|
-
const line = clamp$
|
|
3010
|
+
const line = clamp$1(scrollY.value + localY, 0, lines.length - 1);
|
|
3002
3011
|
const col = scrollX.value + xText;
|
|
3003
3012
|
const info = lines[line];
|
|
3004
3013
|
const hit2 = lineCellColToIndexInline(value, props.multilineTexts, props.mentions, info.start, info.end, col);
|
|
@@ -3028,7 +3037,7 @@ const TInput = defineComponent({
|
|
|
3028
3037
|
}
|
|
3029
3038
|
function applyEdit(nextValue, nextCursor, commit = false) {
|
|
3030
3039
|
withInputWidth(() => {
|
|
3031
|
-
const c = clamp$
|
|
3040
|
+
const c = clamp$1(nextCursor, 0, nextValue.length);
|
|
3032
3041
|
cursor.value = c;
|
|
3033
3042
|
anchor.value = null;
|
|
3034
3043
|
composing.value = false;
|
|
@@ -3058,7 +3067,7 @@ const TInput = defineComponent({
|
|
|
3058
3067
|
if (extend) {
|
|
3059
3068
|
if (anchor.value == null) anchor.value = prev;
|
|
3060
3069
|
} else anchor.value = null;
|
|
3061
|
-
cursor.value = clamp$
|
|
3070
|
+
cursor.value = clamp$1(nextCursor, 0, value.length);
|
|
3062
3071
|
if (wrapMode.value) {
|
|
3063
3072
|
const { w: contentW } = measureContent(absRect.value);
|
|
3064
3073
|
const w = Math.max(1, contentW);
|
|
@@ -3962,7 +3971,7 @@ const TInput = defineComponent({
|
|
|
3962
3971
|
anchor.value = null;
|
|
3963
3972
|
}
|
|
3964
3973
|
hasFocusedOnce.value = true;
|
|
3965
|
-
cursor.value = clamp$
|
|
3974
|
+
cursor.value = clamp$1(cursor.value, 0, valueLen);
|
|
3966
3975
|
ensureCursorVisible();
|
|
3967
3976
|
syncImeAnchorNow();
|
|
3968
3977
|
startBlink();
|
|
@@ -4352,8 +4361,8 @@ const TInput = defineComponent({
|
|
|
4352
4361
|
const cx0 = pos.col - offX;
|
|
4353
4362
|
const cy = pos.line - offY;
|
|
4354
4363
|
if (imeAnchor && focused.value) {
|
|
4355
|
-
const cx = clamp$
|
|
4356
|
-
const cyClamped = clamp$
|
|
4364
|
+
const cx = clamp$1(cx0, 0, Math.max(0, width - 1));
|
|
4365
|
+
const cyClamped = clamp$1(cy, 0, Math.max(0, r.h - 1));
|
|
4357
4366
|
imeAnchor.value = {
|
|
4358
4367
|
cellX: r.x + padX + cx,
|
|
4359
4368
|
cellY: r.y + cyClamped,
|
|
@@ -4396,35 +4405,6 @@ const TInput = defineComponent({
|
|
|
4396
4405
|
}
|
|
4397
4406
|
});
|
|
4398
4407
|
|
|
4399
|
-
//#endregion
|
|
4400
|
-
//#region src/vue/components/simple-utils.ts
|
|
4401
|
-
function clamp$1(n, min, max) {
|
|
4402
|
-
return Math.max(min, Math.min(max, n));
|
|
4403
|
-
}
|
|
4404
|
-
function mergeStyle(...styles) {
|
|
4405
|
-
const out = {};
|
|
4406
|
-
for (const style of styles) {
|
|
4407
|
-
if (!style) continue;
|
|
4408
|
-
Object.assign(out, style);
|
|
4409
|
-
}
|
|
4410
|
-
return out;
|
|
4411
|
-
}
|
|
4412
|
-
function fitCellText(value, width, align = "left") {
|
|
4413
|
-
const w = Math.max(0, Math.floor(width));
|
|
4414
|
-
if (w <= 0) return "";
|
|
4415
|
-
const text = sliceByCells(sanitizeInlineText(String(value ?? "")), w);
|
|
4416
|
-
if (align === "right") {
|
|
4417
|
-
const cells = textCellWidth(text);
|
|
4418
|
-
return `${" ".repeat(Math.max(0, w - cells))}${text}`;
|
|
4419
|
-
}
|
|
4420
|
-
return padEndByCells(text, w);
|
|
4421
|
-
}
|
|
4422
|
-
function repeatToCells(ch, width) {
|
|
4423
|
-
const w = Math.max(0, Math.floor(width));
|
|
4424
|
-
if (w <= 0) return "";
|
|
4425
|
-
return ch.repeat(w);
|
|
4426
|
-
}
|
|
4427
|
-
|
|
4428
4408
|
//#endregion
|
|
4429
4409
|
//#region src/vue/components/TCommandPalette.ts
|
|
4430
4410
|
function computeCommandPaletteMatchRanges(text, query) {
|
|
@@ -5910,14 +5890,13 @@ const TSelect = defineComponent({
|
|
|
5910
5890
|
const optDetailStyle = getOptionDetailStyle(opt);
|
|
5911
5891
|
const rowDetailStyle = {
|
|
5912
5892
|
...rowBase,
|
|
5913
|
-
|
|
5914
|
-
|
|
5893
|
+
dim: true,
|
|
5894
|
+
...optDetailStyle ?? {}
|
|
5915
5895
|
};
|
|
5916
5896
|
const optHighlightDetailStyle = getOptionHighlightDetailStyle(opt);
|
|
5917
5897
|
const rowHighlightDetailStyle = {
|
|
5918
5898
|
...rowHighlightBase,
|
|
5919
|
-
...optHighlightDetailStyle ?? {}
|
|
5920
|
-
dim: true
|
|
5899
|
+
...optHighlightDetailStyle ?? {}
|
|
5921
5900
|
};
|
|
5922
5901
|
const optAccentStyle = getOptionAccentStyle(opt);
|
|
5923
5902
|
const rowAccentStyle = optAccentStyle ? {
|
|
@@ -6135,4 +6114,4 @@ const TSelect = defineComponent({
|
|
|
6135
6114
|
});
|
|
6136
6115
|
|
|
6137
6116
|
//#endregion
|
|
6138
|
-
export { TBox, TCommandPalette, TDialog, TInput, TRenderPlane, TSelect, TText, clamp$1
|
|
6117
|
+
export { TBox, TCommandPalette, TDialog, TInput, TRenderPlane, TSelect, TText, clamp$1, computeCommandPaletteMatchRanges, createOverlayFocusStack, isCommitMention, isWhitespace, mentionChipStyle, padEndByCells$1 as padEndByCells, resolveOverlayPlacement, sliceByCellsWindow, textCellWidth$1 as textCellWidth };
|