@dou-ui/code 0.1.0-alpha.3 → 0.1.0-alpha.30

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.
Files changed (42) hide show
  1. package/dist/assets/default-BWWFJmzn.js.map +1 -0
  2. package/dist/code-diff.js.map +1 -1
  3. package/dist/code-diff.vue_vue_type_script_setup_true_lang.js +756 -63
  4. package/dist/code-diff.vue_vue_type_script_setup_true_lang.js.map +1 -1
  5. package/dist/code-editor.js.map +1 -1
  6. package/dist/code-editor.vue_vue_type_script_setup_true_lang.js +784 -474
  7. package/dist/code-editor.vue_vue_type_script_setup_true_lang.js.map +1 -1
  8. package/dist/extension.js +6 -1
  9. package/dist/extension.js.map +1 -1
  10. package/dist/index.js +3 -2
  11. package/dist/index.js.map +1 -1
  12. package/dist/language/highlighter.js +1 -1
  13. package/dist/language/highlighter.js.map +1 -1
  14. package/dist/language/language.js +24 -2
  15. package/dist/language/language.js.map +1 -1
  16. package/dist/language/remote-tokens.js +131 -0
  17. package/dist/language/remote-tokens.js.map +1 -0
  18. package/dist/language/worker-client.js +308 -33
  19. package/dist/language/worker-client.js.map +1 -1
  20. package/dist/language/worker-protocol.js.map +1 -1
  21. package/dist/shiki/index.js +54 -3
  22. package/dist/shiki/index.js.map +1 -1
  23. package/dist/style.css +1 -1
  24. package/dist/types/code-diff.vue.d.ts +18 -21
  25. package/dist/types/code-editor.vue.d.ts +3 -1
  26. package/dist/types/extension.d.ts +57 -5
  27. package/dist/types/index.d.ts +97 -21
  28. package/dist/types/language/language.d.ts +27 -0
  29. package/dist/types/language/remote-tokens.d.ts +38 -0
  30. package/dist/types/language/worker-client.d.ts +85 -15
  31. package/dist/types/language/worker-protocol.d.ts +53 -2
  32. package/dist/types/shiki/index.d.ts +36 -1
  33. package/dist/types/types.d.ts +166 -10
  34. package/dist/types/view/measure.d.ts +6 -0
  35. package/dist/types/worker/index.d.ts +27 -12
  36. package/dist/view/measure.js +23 -5
  37. package/dist/view/measure.js.map +1 -1
  38. package/dist/worker/default.js +1 -1
  39. package/dist/worker/index.js +280 -53
  40. package/dist/worker/index.js.map +1 -1
  41. package/package.json +3 -3
  42. package/dist/assets/default-BZBMZKf_.js.map +0 -1
@@ -11,11 +11,12 @@ import { CodeTransaction } from "./core/transaction.js";
11
11
  import { matchAfter, replacementFor, searchText } from "./core/search.js";
12
12
  import { lineParts, tokenTypes } from "./language/language.js";
13
13
  import { CodeHighlighter } from "./language/highlighter.js";
14
- import { SyntaxWorkerClient, holdWorker, ownWorker } from "./language/worker-client.js";
14
+ import { RemoteTokenStore, compressLineRanges } from "./language/remote-tokens.js";
15
+ import { SyntaxWorkerClient, acquirePoolWorker, holdWorker, isCodeWorkerPool, ownWorker } from "./language/worker-client.js";
15
16
  import { format, useCodeMessages } from "./locale.js";
16
17
  import { visibleViewport } from "./view/viewport.js";
17
18
  import code_keys_default from "./code-keys2.js";
18
- import { CODE_EDITOR_KEY } from "./extension.js";
19
+ import { CODE_EDITOR_KEY, WIDGET_HEIGHT_KEY } from "./extension.js";
19
20
  import render_part_default from "./render-part.js";
20
21
  import { matchCompletion } from "./completion/match.js";
21
22
  import { parseSnippet } from "./completion/snippet.js";
@@ -23,33 +24,44 @@ import { diffText } from "./view/input.js";
23
24
  import { LineLayout, UNWRAPPED, rowOfCol, updateRows, wrapLine } from "./view/layout.js";
24
25
  import { Measure } from "./view/measure.js";
25
26
  import { DouFindReplace, DouToggle, DouTooltip, holdPointer, isApplePlatform, isComposing, scrollPositionOf, useLocale, useNamespace, useTeleport, useZIndex } from "dou-ui";
26
- import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, isMemoSame, markRaw, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, provide, reactive, ref, renderList, resolveDynamicComponent, shallowReactive, shallowRef, toDisplayString, toRaw, unref, watch, withCtx, withModifiers } from "vue";
27
+ import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, getCurrentInstance, inject, isMemoSame, markRaw, mergeProps, nextTick, normalizeClass, normalizeStyle, onBeforeUnmount, onMounted, openBlock, provide, reactive, ref, renderList, resolveDynamicComponent, shallowReactive, shallowRef, toDisplayString, toRaw, unref, watch, withCtx, withModifiers } from "vue";
27
28
  import { AlertTriangleIcon, ChevronDownIcon, ChevronRightIcon, FunctionIcon, GripVerticalIcon, InfoIcon, LetterCaseIcon, LightbulbIcon, PackageIcon, RegexIcon, SquareCodeIcon, SymbolClassIcon, SymbolConstantIcon, SymbolKeywordIcon, SymbolTypeAliasIcon, TypeIcon, VariableIcon, WholeWordIcon, WrenchIcon, XCircleIcon } from "@dou-ui/icons";
28
29
  // src/code-editor.vue?vue&type=script&setup=true&lang.ts
29
30
  var _hoisted_1 = [
30
31
  "title",
31
32
  "data-gutter-cell",
32
- "data-line"
33
+ "data-line",
34
+ "onKeydown"
35
+ ];
36
+ var _hoisted_2 = {
37
+ key: 1,
38
+ "aria-hidden": "true"
39
+ };
40
+ var _hoisted_3 = ["data-fold"];
41
+ var _hoisted_4 = [
42
+ "title",
43
+ "data-gutter-cell",
44
+ "data-line",
45
+ "onKeydown"
33
46
  ];
34
- var _hoisted_2 = ["data-fold"];
35
- var _hoisted_3 = ["title"];
36
- var _hoisted_4 = ["data-unfold", "title"];
37
47
  var _hoisted_5 = ["title"];
38
48
  var _hoisted_6 = ["data-unfold", "title"];
39
- var _hoisted_7 = ["aria-label"];
40
- var _hoisted_8 = ["aria-current", "onClick"];
49
+ var _hoisted_7 = ["title"];
50
+ var _hoisted_8 = ["data-unfold", "title"];
41
51
  var _hoisted_9 = ["aria-label"];
42
- var _hoisted_10 = [
52
+ var _hoisted_10 = ["aria-current", "onClick"];
53
+ var _hoisted_11 = ["aria-label"];
54
+ var _hoisted_12 = [
43
55
  "id",
44
56
  "aria-selected",
45
57
  "onClick"
46
58
  ];
47
- var _hoisted_11 = ["aria-label"];
48
- var _hoisted_12 = ["onPointerdown"];
49
- var _hoisted_13 = ["title"];
50
- var _hoisted_14 = ["aria-label"];
51
- var _hoisted_15 = ["onClick"];
52
- var _hoisted_16 = [
59
+ var _hoisted_13 = ["aria-label"];
60
+ var _hoisted_14 = ["onPointerdown"];
61
+ var _hoisted_15 = ["title"];
62
+ var _hoisted_16 = ["aria-label"];
63
+ var _hoisted_17 = ["onClick"];
64
+ var _hoisted_18 = [
53
65
  "aria-label",
54
66
  "aria-placeholder",
55
67
  "aria-autocomplete",
@@ -57,8 +69,8 @@ var _hoisted_16 = [
57
69
  "readonly",
58
70
  "disabled"
59
71
  ];
60
- var _hoisted_17 = ["role", "aria-label"];
61
- var _hoisted_18 = ["aria-label", "title"];
72
+ var _hoisted_19 = ["role", "aria-label"];
73
+ var _hoisted_20 = ["aria-label", "title"];
62
74
  var MAX_HEIGHT = 8e6;
63
75
  var OVERSCAN = 6;
64
76
  /** The textarea mirrors at most this much text around the cursor. */
@@ -100,6 +112,10 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
100
112
  type: Boolean,
101
113
  default: true
102
114
  },
115
+ scrollY: {
116
+ type: Boolean,
117
+ default: true
118
+ },
103
119
  activeLine: {
104
120
  type: Boolean,
105
121
  default: true
@@ -109,9 +125,14 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
109
125
  placeholder: {},
110
126
  language: { default: void 0 },
111
127
  worker: {
112
- type: [Boolean, Function],
128
+ type: [
129
+ Boolean,
130
+ Function,
131
+ Object
132
+ ],
113
133
  default: false
114
134
  },
135
+ syncHighlightLines: { default: void 0 },
115
136
  closeBrackets: {
116
137
  type: Boolean,
117
138
  default: true
@@ -169,10 +190,12 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
169
190
  const emit = __emit;
170
191
  const ns = useNamespace("code-editor");
171
192
  const instance = getCurrentInstance();
172
- /** Space above the first line and below the last, and before and after each line; set from the styles once measured. */
193
+ /** Space above the first line and below the last, before and after each line, and around line numbers; set from the styles once measured. */
173
194
  const pad = reactive({
174
195
  x: 12,
175
- y: 8
196
+ y: 8,
197
+ gutterLeft: 16,
198
+ gutterRight: 12
176
199
  });
177
200
  /** Browsers stop growing an element somewhere past 16M px; taller texts scroll in scaled steps. */
178
201
  const apple = isApplePlatform();
@@ -550,6 +573,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
550
573
  });
551
574
  /** The widgets' heights as last measured, by key. */
552
575
  const widgetHeights = shallowReactive(/* @__PURE__ */ new Map());
576
+ const onWidgetHeight = inject(WIDGET_HEIGHT_KEY, null);
553
577
  const widgets = computed(() => {
554
578
  const drawn = layout.value;
555
579
  const lh = lineHeight.value;
@@ -567,6 +591,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
567
591
  above,
568
592
  render: widget.render,
569
593
  label: widget.label,
594
+ fullWidth: !!widget.fullWidth,
570
595
  row: drawn.rowOf(n) + (above ? 0 : drawn.rowsOf(n)),
571
596
  height: widgetHeights.get(key) ?? widget.height ?? lh,
572
597
  before: 0
@@ -673,7 +698,10 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
673
698
  const id = observedWidgets.get(target);
674
699
  if (!id || !target.isConnected) return;
675
700
  const height = target.offsetHeight;
676
- if (height && widgetHeights.get(id) !== height) widgetHeights.set(id, height);
701
+ if (height && widgetHeights.get(id) !== height) {
702
+ onWidgetHeight?.(id, height);
703
+ widgetHeights.set(id, height);
704
+ }
677
705
  };
678
706
  measureNow(el);
679
707
  if (typeof ResizeObserver === "undefined") return;
@@ -793,17 +821,43 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
793
821
  if (props.diagnostics !== void 0 || linting.value || diagnostics.value.length) columns.push({
794
822
  name: "problems",
795
823
  width: 16,
824
+ overlay: false,
796
825
  markers: problemMarkers
797
826
  });
798
827
  for (const extension of extensions.value) for (const gutter of extension.gutters ?? []) columns.push({
799
828
  name: gutter.name,
800
- width: gutter.width ?? 16,
801
- markers: () => gutter.markers(context),
802
- onPress: gutter.onPress && ((line, event) => gutter.onPress(line, event, context))
829
+ width: gutter.width ?? (gutter.overlay ? 18 : 16),
830
+ overlay: !!gutter.overlay,
831
+ markers: () => withHoverMarker(gutter.markers?.(context) ?? [], gutter.hoverMarker),
832
+ onPress: gutter.onPress && ((line, event) => gutter.onPress(line, event, context)),
833
+ pressOn: gutter.pressOn
803
834
  });
804
835
  return columns;
805
836
  });
806
- const gutterCells = computed(() => gutterColumns.value.reduce((sum, column) => sum + column.width, 0));
837
+ const flowGutterColumns = computed(() => gutterColumns.value.map((column, index) => ({
838
+ column,
839
+ index
840
+ })).filter((item) => !item.column.overlay));
841
+ const overlayGutterColumns = computed(() => gutterColumns.value.map((column, index) => ({
842
+ column,
843
+ index
844
+ })).filter((item) => item.column.overlay));
845
+ const gutterCells = computed(() => flowGutterColumns.value.reduce((sum, item) => sum + item.column.width, 0));
846
+ /** A column's markers, and its `hoverMarker` on the other lines in view. */
847
+ function withHoverMarker(own, hover) {
848
+ if (!hover) return own;
849
+ const taken = new Set(own.map((marker) => marker.line));
850
+ const out = [...own];
851
+ for (let line = visibleFrom.value; line <= visibleTo.value; line++) if (!taken.has(line)) out.push({
852
+ icon: hover.icon,
853
+ text: hover.text,
854
+ class: hover.class,
855
+ title: typeof hover.title === "function" ? hover.title(line) : hover.title,
856
+ line,
857
+ visible: "hover"
858
+ });
859
+ return out;
860
+ }
807
861
  /** The worst problem on each line in view, as a marker. */
808
862
  function problemMarkers() {
809
863
  const text = doc.value;
@@ -827,9 +881,40 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
827
881
  }));
828
882
  }
829
883
  /** The markers of each column, by line, for the lines in view. */
884
+ /** The line the mouse is over in the text, so the gutter can show markers waiting for it. */
885
+ const hoveredLine = ref(null);
886
+ function lineAtY(y) {
887
+ const rect = content.value?.getBoundingClientRect();
888
+ if (!rect) return null;
889
+ return doc.value.lineAt(posAtCoords({
890
+ x: rect.left + 1,
891
+ y
892
+ })).number;
893
+ }
894
+ /** A marker in a pressable column is a button: Enter or Space presses it. */
895
+ function onCellKeydown(event, column, line) {
896
+ if (event.key !== "Enter" && event.key !== " ") return;
897
+ const press = gutterColumns.value[column]?.onPress;
898
+ if (!press || props.disabled) return;
899
+ event.preventDefault();
900
+ const cell = event.currentTarget;
901
+ press(line, event);
902
+ nextTick(() => {
903
+ const where = document.activeElement;
904
+ if ((!cell.isConnected || cell.getAttribute("role") !== "button") && (!where || where === document.body || where === cell)) focusInput();
905
+ });
906
+ }
907
+ /** Columns already warned about markers without a name, while developing. */
908
+ const unnamed = /* @__PURE__ */ new Set();
830
909
  const gutterMarkers = computed(() => gutterColumns.value.map((column) => {
831
910
  const byLine = /* @__PURE__ */ new Map();
832
- for (const marker of column.markers()) byLine.set(marker.line, marker);
911
+ for (const marker of column.markers()) {
912
+ byLine.set(marker.line, marker);
913
+ if (process.env.NODE_ENV !== "production" && column.onPress && !marker.title) {
914
+ if (!unnamed.has(column.name)) console.warn(`[@dou-ui/code] gutter "${column.name}": a marker in a column with \`onPress\` is a button and needs a \`title\` to name it.`);
915
+ unnamed.add(column.name);
916
+ }
917
+ }
833
918
  return byLine;
834
919
  }));
835
920
  const gutterWidth = computed(() => {
@@ -837,7 +922,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
837
922
  if (!props.gutter || !props.lineNumbers && !props.foldable && !cells) return 0;
838
923
  metrics.value;
839
924
  const digits = Math.max(2, String(doc.value.lines).length);
840
- return cells + (props.lineNumbers ? Math.ceil(digits * measure.cell) + 28 : 12) + (props.foldable ? 14 : 0);
925
+ return cells + (props.lineNumbers ? Math.ceil(digits * measure.cell) + pad.gutterLeft + pad.gutterRight : props.foldable ? 12 : 0) + (props.foldable ? 14 : 0);
841
926
  });
842
927
  const contentWidth = computed(() => {
843
928
  if (props.wrap) return 0;
@@ -880,11 +965,12 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
880
965
  const lineOf = texts ? (k) => texts[k - 1] : void 0;
881
966
  return (n) => {
882
967
  const read = !!hl?.ready(n);
968
+ const hasTokens = read || usesRemoteTokens() && !!remoteTokens.line(n);
883
969
  const language = outer ? (read ? hl.languageAt(n) : null) ?? outer : null;
884
970
  return foldEndAt(text, n, {
885
971
  brackets: language?.brackets,
886
972
  tabSize,
887
- skip: read ? inStringOrComment : void 0,
973
+ skip: hasTokens ? inStringOrComment : void 0,
888
974
  lineText: lineOf
889
975
  });
890
976
  };
@@ -1067,7 +1153,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
1067
1153
  const { numbers, texts } = shownLines.value;
1068
1154
  const p = preview.value;
1069
1155
  const line = p ? doc.value.lineAt(p.from) : null;
1070
- const tokensOf = syntaxLines(visibleFrom.value, visibleTo.value);
1156
+ const tokensOf = syntaxLines(visibleFrom.value, visibleTo.value, numbers);
1071
1157
  const starts = new Set(foldHidden.value.map(([from]) => from - 1));
1072
1158
  const { marks, lineClasses, inlines } = lineDecorations.value;
1073
1159
  return texts.map((text, i) => {
@@ -1257,17 +1343,48 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
1257
1343
  }
1258
1344
  /** Lines read ahead of the last read one while drawing; further away, idle time catches up first. */
1259
1345
  let highlighter = null;
1260
- /** Bumped when lines in view got their tokens in idle time. */
1346
+ const remoteTokens = markRaw(new RemoteTokenStore());
1347
+ /** Bumped when lines in view got their tokens asynchronously (idle time or worker). */
1261
1348
  const syntaxTick = ref(0);
1262
- watch(() => props.language, (language) => {
1263
- highlighter = language ? markRaw(new CodeHighlighter(language, doc.value, props.tabSize)) : null;
1264
- syntaxTick.value++;
1265
- }, { immediate: true });
1349
+ const syncReach = () => {
1350
+ const configured = props.syncHighlightLines;
1351
+ return configured === void 0 ? SYNTAX_REACH : Math.max(0, configured);
1352
+ };
1353
+ /** Whether the editor is currently intersecting the viewport (plus prewarm margin). */
1354
+ let inViewport = true;
1355
+ let viewportObserver;
1266
1356
  /** The worker reading ahead, with `worker`, and how to let go of it. */
1267
1357
  let syntaxWorker = null;
1268
1358
  let releaseWorker = null;
1269
1359
  let workerJob = 0;
1360
+ let workerAcquiring = false;
1361
+ let workerFallenBack = false;
1362
+ /** True once the worker has responded in flat per-line `tokens` mode for the current language. */
1363
+ let workerTokenMode = false;
1364
+ const workerConfigured = () => !!props.language && !!props.worker && !workerFallenBack && typeof Worker !== "undefined";
1365
+ const usesRemoteTokens = () => workerTokenMode || props.language?.workerMode === "tokens" && workerConfigured();
1366
+ let syntaxJob = 0;
1367
+ let syntaxUntil = 0;
1368
+ /** Runs `task` when the page is idle, with how long it may take (ms). */
1369
+ const idle = typeof requestIdleCallback === "function" ? (task) => requestIdleCallback((deadline) => task(deadline.timeRemaining()), { timeout: 100 }) : (task) => window.setTimeout(() => task(8), 16);
1370
+ const cancelIdle = (id) => typeof cancelIdleCallback === "function" ? cancelIdleCallback(id) : clearTimeout(id);
1371
+ function cancelScheduledSyntax() {
1372
+ if (syntaxJob) {
1373
+ cancelIdle(syntaxJob);
1374
+ syntaxJob = 0;
1375
+ }
1376
+ syntaxUntil = 0;
1377
+ }
1378
+ watch(() => props.language, (language) => {
1379
+ cancelScheduledSyntax();
1380
+ remoteTokens.clear();
1381
+ workerTokenMode = false;
1382
+ workerFallenBack = false;
1383
+ highlighter = language ? markRaw(new CodeHighlighter(language, doc.value, props.tabSize)) : null;
1384
+ syntaxTick.value++;
1385
+ }, { immediate: true });
1270
1386
  function stopSyntaxWorker() {
1387
+ workerAcquiring = false;
1271
1388
  syntaxWorker?.dispose();
1272
1389
  syntaxWorker = null;
1273
1390
  releaseWorker?.();
@@ -1275,13 +1392,21 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
1275
1392
  }
1276
1393
  /** Reading goes back to the page, saying why while developing. */
1277
1394
  function workerFallback(message, error) {
1395
+ workerFallenBack = true;
1396
+ workerTokenMode = false;
1278
1397
  stopSyntaxWorker();
1279
1398
  syntaxTick.value++;
1280
1399
  if (process.env.NODE_ENV !== "production") console.warn(`[@dou-ui/code] ${message}: colors are read on the page instead.`, ...error ? [error] : []);
1281
1400
  }
1282
- function attachWorker(worker, release) {
1401
+ function attachWorker(worker, release, setBusy) {
1283
1402
  const language = props.language;
1403
+ if (!language) {
1404
+ release();
1405
+ return;
1406
+ }
1407
+ cancelScheduledSyntax();
1284
1408
  releaseWorker = release;
1409
+ workerTokenMode = language.workerMode === "tokens";
1285
1410
  syntaxWorker = new SyntaxWorkerClient(worker, language, () => doc.value, props.tabSize, {
1286
1411
  states(points) {
1287
1412
  const hl = highlighter;
@@ -1289,35 +1414,63 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
1289
1414
  hl.adopt(points);
1290
1415
  syntaxTick.value++;
1291
1416
  },
1417
+ tokens(from, tokenLines, frontier, ranges) {
1418
+ if (props.language !== language) return;
1419
+ workerTokenMode = true;
1420
+ if (ranges) remoteTokens.adoptRanges(ranges, frontier);
1421
+ else remoteTokens.adopt(from, tokenLines, frontier);
1422
+ syntaxTick.value++;
1423
+ },
1292
1424
  unsupported(missing) {
1293
- workerFallback(missing ? `the worker has no language named "${missing}" (for "${language.name}"); pass it to serveCodeHighlighting in the worker` : `the states of "${language.name}" can't be sent from the worker; keep them to plain data`);
1425
+ workerFallback(missing ? `the worker has no language named "${missing}" (for "${language.name}"); pass it to serveCodeHighlighting in the worker` : `the worker could not highlight "${language.name}"`);
1294
1426
  },
1295
1427
  failed(error) {
1296
1428
  workerFallback("the highlighting worker failed", error);
1297
- }
1429
+ },
1430
+ onBusyChange: setBusy
1298
1431
  });
1299
1432
  syntaxTick.value++;
1300
1433
  }
1434
+ /** Lazily acquires a worker from the built-in or user-supplied pool when highlighting is actually needed. */
1435
+ function ensureWorkerClient() {
1436
+ if (syntaxWorker || workerAcquiring || !mounted.value || !workerConfigured()) return;
1437
+ const option = props.worker;
1438
+ if (option !== true && !isCodeWorkerPool(option)) return;
1439
+ const job = workerJob;
1440
+ workerAcquiring = true;
1441
+ (option === true ? ownWorker() : acquirePoolWorker(option)).then(({ worker, release, setBusy }) => {
1442
+ if (job !== workerJob) {
1443
+ release();
1444
+ return;
1445
+ }
1446
+ workerAcquiring = false;
1447
+ attachWorker(worker, release, setBusy);
1448
+ }, (error) => {
1449
+ if (job !== workerJob) return;
1450
+ workerAcquiring = false;
1451
+ workerFallback(option === true ? "the built-in worker could not start" : "the worker pool could not start", error);
1452
+ });
1453
+ }
1301
1454
  watch([
1302
1455
  () => props.language,
1303
1456
  () => props.worker,
1304
1457
  mounted
1305
1458
  ], ([language, option, isMounted]) => {
1306
1459
  stopSyntaxWorker();
1460
+ remoteTokens.clear();
1461
+ workerFallenBack = false;
1462
+ workerTokenMode = false;
1307
1463
  const job = ++workerJob;
1308
1464
  if (!language || !option || !isMounted || typeof Worker === "undefined") return;
1309
- if (option === true) {
1310
- ownWorker().then(({ worker, release }) => {
1311
- if (job === workerJob) attachWorker(worker, release);
1312
- else release();
1313
- }, (error) => job === workerJob && workerFallback("the built-in worker could not start", error));
1465
+ if (option === true || isCodeWorkerPool(option)) {
1466
+ syntaxTick.value++;
1314
1467
  return;
1315
1468
  }
1316
1469
  let worker;
1317
1470
  try {
1318
1471
  worker = option();
1319
1472
  } catch (error) {
1320
- workerFallback("the worker could not start", error);
1473
+ if (job === workerJob) workerFallback("the worker could not start", error);
1321
1474
  return;
1322
1475
  }
1323
1476
  attachWorker(worker, holdWorker(worker));
@@ -1328,38 +1481,67 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
1328
1481
  });
1329
1482
  /** Brings the colors along with a change of the text. */
1330
1483
  function syntaxChange(next, changes) {
1484
+ const prev = highlighter?.text ?? doc.value;
1485
+ remoteTokens.update(prev, next, changes);
1331
1486
  highlighter?.update(next, changes);
1332
1487
  syntaxWorker?.change(changes);
1333
1488
  }
1334
- /** Gets the tokens of the lines in view, asking idle time for the ones too far ahead. */
1335
- function syntaxLines(from, to) {
1489
+ /** Gets the tokens of the lines in view, delegating unread ranges to the worker or idle slices. */
1490
+ function syntaxLines(from, to, shownNumbers) {
1336
1491
  syntaxTick.value;
1337
1492
  const hl = highlighter;
1338
1493
  if (!hl) return () => null;
1339
- if (!hl.ready(to) && to - hl.frontier > SYNTAX_REACH) {
1340
- if (syntaxWorker) syntaxWorker.want(hl.frontier, to);
1341
- else scheduleSyntax(to);
1494
+ const reach = syncReach();
1495
+ const tokenRanges = shownNumbers ? compressLineRanges(shownNumbers) : from <= to ? [[from, to]] : [];
1496
+ if (usesRemoteTokens()) {
1497
+ const ready = shownNumbers ? remoteTokens.readyNumbers(shownNumbers) : remoteTokens.readyRange(from, to);
1498
+ if (inViewport && !ready && tokenRanges.length > 0) {
1499
+ const firstFrom = tokenRanges[0][0];
1500
+ const lastTo = tokenRanges[tokenRanges.length - 1][1];
1501
+ if (syntaxWorker) syntaxWorker.want(remoteTokens.frontier, lastTo, firstFrom, lastTo, tokenRanges);
1502
+ else ensureWorkerClient();
1503
+ }
1504
+ return (n) => remoteTokens.line(n);
1505
+ }
1506
+ if (!hl.ready(to) && to - hl.frontier > reach) {
1507
+ if (inViewport) {
1508
+ if (workerConfigured()) {
1509
+ if (syntaxWorker) syntaxWorker.want(hl.frontier, to, from, to, tokenRanges);
1510
+ else ensureWorkerClient();
1511
+ } else scheduleSyntax(to);
1512
+ }
1342
1513
  return (n) => hl.ready(n) ? hl.line(n) : null;
1343
1514
  }
1344
1515
  return (n) => hl.line(n);
1345
1516
  }
1346
- let syntaxJob = 0;
1347
- let syntaxUntil = 0;
1348
- /** Runs `task` when the page is idle, with how long it may take (ms). */
1349
- const idle = typeof requestIdleCallback === "function" ? (task) => requestIdleCallback((deadline) => task(deadline.timeRemaining()), { timeout: 100 }) : (task) => window.setTimeout(() => task(8), 16);
1350
- const cancelIdle = (id) => typeof cancelIdleCallback === "function" ? cancelIdleCallback(id) : clearTimeout(id);
1517
+ function setInViewport(visible) {
1518
+ if (inViewport === visible) return;
1519
+ inViewport = visible;
1520
+ if (!visible) {
1521
+ syntaxWorker?.cancel();
1522
+ cancelScheduledSyntax();
1523
+ } else syntaxTick.value++;
1524
+ }
1351
1525
  function scheduleSyntax(until) {
1526
+ if (!inViewport || !mounted.value || typeof window === "undefined") return;
1352
1527
  syntaxUntil = Math.max(syntaxUntil, until);
1353
1528
  if (syntaxJob) return;
1354
1529
  syntaxJob = idle((budget) => {
1355
1530
  syntaxJob = 0;
1356
1531
  const hl = highlighter;
1357
- if (!hl) return;
1532
+ if (!hl || !inViewport) {
1533
+ syntaxUntil = 0;
1534
+ return;
1535
+ }
1536
+ const prevFrontier = hl.frontier;
1358
1537
  hl.work(performance.now() + Math.min(20, Math.max(4, budget - 1)), syntaxUntil);
1359
1538
  if (hl.ready(syntaxUntil)) {
1360
1539
  syntaxUntil = 0;
1361
1540
  syntaxTick.value++;
1362
- } else scheduleSyntax(syntaxUntil);
1541
+ } else {
1542
+ if (hl.frontier > prevFrontier && hl.frontier >= visibleFrom.value) syntaxTick.value++;
1543
+ scheduleSyntax(syntaxUntil);
1544
+ }
1363
1545
  });
1364
1546
  }
1365
1547
  /** The kind of token the character at `pos` is part of, when its line has been read. */
@@ -1367,7 +1549,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
1367
1549
  const hl = highlighter;
1368
1550
  if (!hl || pos < 0 || pos >= doc.value.length) return null;
1369
1551
  const line = doc.value.lineAt(pos);
1370
- const tokens = hl.line(line.number, SYNTAX_REACH);
1552
+ const tokens = usesRemoteTokens() ? remoteTokens.line(line.number) : hl.line(line.number, syncReach());
1371
1553
  if (!tokens) return null;
1372
1554
  const col = pos - line.from;
1373
1555
  for (let i = 0; i < tokens.length; i += 2) if (col < tokens[i]) {
@@ -1379,8 +1561,9 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
1379
1561
  function languageAt(pos) {
1380
1562
  const hl = highlighter;
1381
1563
  if (!hl) return null;
1564
+ if (usesRemoteTokens()) return hl.language;
1382
1565
  const line = doc.value.lineAt(Math.min(Math.max(pos, 0), doc.value.length));
1383
- if (line.number - hl.frontier > SYNTAX_REACH) return hl.language;
1566
+ if (line.number - hl.frontier > syncReach()) return hl.language;
1384
1567
  return hl.languageAt(line.number);
1385
1568
  }
1386
1569
  /**
@@ -2066,6 +2249,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
2066
2249
  * the mouse events a browser makes up after it would only close it again.
2067
2250
  */
2068
2251
  function onContentHover(event) {
2252
+ if (event.pointerType === "mouse") hoveredLine.value = lineAtY(event.clientY);
2069
2253
  if (event.pointerType !== "mouse" || drag || problemBox.value?.keyboard) return;
2070
2254
  if (!content.value?.getBoundingClientRect()) return;
2071
2255
  const point = {
@@ -2089,6 +2273,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
2089
2273
  clearTimeout(problemTimer);
2090
2274
  }
2091
2275
  function onContentLeave(event) {
2276
+ hoveredLine.value = null;
2092
2277
  if (event.pointerType !== "mouse" || problemBox.value?.keyboard) return;
2093
2278
  clearTimeout(problemTimer);
2094
2279
  problemTimer = window.setTimeout(closeProblems, 250);
@@ -3030,6 +3215,12 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
3030
3215
  ], apple));
3031
3216
  /** After Escape, Tab leaves the editor instead of indenting, so keyboard users are never stuck. */
3032
3217
  let tabLeaves = false;
3218
+ const MODIFIERS = /* @__PURE__ */ new Set([
3219
+ "Shift",
3220
+ "Control",
3221
+ "Alt",
3222
+ "Meta"
3223
+ ]);
3033
3224
  /** When Enter last confirmed a composition; some browsers also put a line break into the textarea for it, right after. */
3034
3225
  let confirmEnter = -Infinity;
3035
3226
  function onKeydown(event) {
@@ -3057,7 +3248,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
3057
3248
  return;
3058
3249
  }
3059
3250
  const leaving = tabLeaves && (name === "tab" || name === "shift+tab");
3060
- tabLeaves = name === "escape";
3251
+ if (!MODIFIERS.has(event.key)) tabLeaves = name === "escape";
3061
3252
  if (leaving) {
3062
3253
  const first = name === "tab" && !shownWidgets.value.length ? keysEl.value?.querySelector("button") : null;
3063
3254
  if (first) {
@@ -3214,11 +3405,11 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
3214
3405
  function autoScroll() {
3215
3406
  if (!drag || !scroller.value) return;
3216
3407
  const rect = scroller.value.getBoundingClientRect();
3217
- const dy = drag.y < rect.top ? drag.y - rect.top : drag.y > rect.bottom ? drag.y - rect.bottom : 0;
3408
+ const dy = props.scrollY ? drag.y < rect.top ? drag.y - rect.top : drag.y > rect.bottom ? drag.y - rect.bottom : 0 : 0;
3218
3409
  const dx = drag.x < rect.left + gutterWidth.value ? drag.x - rect.left - gutterWidth.value : drag.x > rect.right ? drag.x - rect.right : 0;
3219
3410
  if (dy || dx) {
3220
- scroller.value.scrollTop += dy / 2;
3221
- scroller.value.scrollLeft += dx / 2;
3411
+ if (dy) scroller.value.scrollTop += dy / 2;
3412
+ if (dx) scroller.value.scrollLeft += dx / 2;
3222
3413
  onScroll();
3223
3414
  extendTo(drag);
3224
3415
  }
@@ -3291,6 +3482,27 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
3291
3482
  }
3292
3483
  /** A tap that may turn into a scroll or a long press; touches only act once they end in place. */
3293
3484
  let touch = null;
3485
+ /** A finger or pen on a pressable gutter cell, which presses if it lifts in place. */
3486
+ let cellTap = null;
3487
+ /**
3488
+ * A tap on a gutter cell lifted in place. A marker still out of sight (shown
3489
+ * on hover, which a finger can't do) isn't pressed yet: the cursor moves to
3490
+ * its line, which shows it, and the next tap presses it.
3491
+ */
3492
+ function endCellTap(event) {
3493
+ const tap = cellTap;
3494
+ cellTap = null;
3495
+ if (!tap) return;
3496
+ const column = gutterColumns.value[tap.column];
3497
+ if (!column?.onPress || props.disabled) return;
3498
+ if ((gutterMarkers.value[tap.column]?.get(tap.line))?.visible === "hover" && !(focused.value && activeLineNumber.value === tap.line)) {
3499
+ touchUi.value = true;
3500
+ select("char", doc.value.line(tap.line).from, false);
3501
+ focusInput();
3502
+ return;
3503
+ }
3504
+ column.onPress(tap.line, event);
3505
+ }
3294
3506
  /** The fold toggle or folded marker under a pointer, as the line it belongs to. */
3295
3507
  function foldTarget(event) {
3296
3508
  const el = event.target?.closest?.("[data-fold], [data-unfold]");
@@ -3307,11 +3519,24 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
3307
3519
  function onPointerDown(event, area) {
3308
3520
  if (event.button !== 0 || props.disabled) return;
3309
3521
  const cell = event.target?.closest?.("[data-gutter-cell]");
3310
- const column = cell && gutterColumns.value[Number(cell.getAttribute("data-gutter-cell"))];
3522
+ const c = Number(cell?.getAttribute("data-gutter-cell"));
3523
+ const column = cell && gutterColumns.value[c];
3311
3524
  if (column?.onPress) {
3312
3525
  event.preventDefault();
3313
3526
  event.stopPropagation();
3314
- column.onPress(Number(cell.getAttribute("data-line")), event);
3527
+ const line = Number(cell.getAttribute("data-line"));
3528
+ if (event.pointerType === "touch" || event.pointerType === "pen") {
3529
+ onPointerCancel();
3530
+ cellTap = {
3531
+ x: event.clientX,
3532
+ y: event.clientY,
3533
+ pointer: event.pointerId,
3534
+ column: c,
3535
+ line
3536
+ };
3537
+ return;
3538
+ }
3539
+ column.onPress(line, event);
3315
3540
  return;
3316
3541
  }
3317
3542
  const fold = foldTarget(event);
@@ -3404,10 +3629,15 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
3404
3629
  return count;
3405
3630
  }
3406
3631
  function onPointerMove(event) {
3632
+ if (cellTap && event.pointerId === cellTap.pointer) {
3633
+ if (Math.hypot(event.clientX - cellTap.x, event.clientY - cellTap.y) > 8) cellTap = null;
3634
+ return;
3635
+ }
3407
3636
  if (!touch || event.pointerId !== touch.pointer) return;
3408
3637
  if (Math.hypot(event.clientX - touch.x, event.clientY - touch.y) > 8) onPointerCancel();
3409
3638
  }
3410
3639
  function onPointerUp(event, area) {
3640
+ if (cellTap && event.pointerId === cellTap.pointer) return endCellTap(event);
3411
3641
  if (!touch || event.pointerId !== touch.pointer) return;
3412
3642
  onPointerCancel();
3413
3643
  const iconLine = area === "gutter" ? problemIconLine(event) : null;
@@ -3428,6 +3658,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
3428
3658
  focusInput();
3429
3659
  }
3430
3660
  function onPointerCancel() {
3661
+ cellTap = null;
3431
3662
  if (touch) {
3432
3663
  clearTimeout(touch.timer);
3433
3664
  touch.hold.release();
@@ -3957,12 +4188,14 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
3957
4188
  const bottom = view.top + view.height - covered;
3958
4189
  const visibleTop = Math.max(rect.top, view.top);
3959
4190
  const visibleBottom = Math.min(rect.bottom, bottom);
3960
- if (at.bottom + room > visibleBottom && visibleBottom - visibleTop >= lh * 3) {
3961
- el.scrollTop += (at.bottom + room - visibleBottom) / ratio.value;
3962
- onScroll();
3963
- } else if (at.top - lh / 2 < visibleTop && visibleBottom - visibleTop >= lh * 3) {
3964
- el.scrollTop -= (visibleTop - at.top + lh / 2) / ratio.value;
3965
- onScroll();
4191
+ if (props.scrollY) {
4192
+ if (at.bottom + room > visibleBottom && visibleBottom - visibleTop >= lh * 3) {
4193
+ el.scrollTop += (at.bottom + room - visibleBottom) / ratio.value;
4194
+ onScroll();
4195
+ } else if (at.top - lh / 2 < visibleTop && visibleBottom - visibleTop >= lh * 3) {
4196
+ el.scrollTop -= (visibleTop - at.top + lh / 2) / ratio.value;
4197
+ onScroll();
4198
+ }
3966
4199
  }
3967
4200
  const after = coordsAtPos(mainRange(state.value.selection).head);
3968
4201
  if (!after || after.bottom + room <= bottom) return;
@@ -4035,7 +4268,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4035
4268
  const minimapCanvas = ref();
4036
4269
  /** The editor's own width, minimap included. */
4037
4270
  const rootWidth = ref(0);
4038
- const minimapOn = computed(() => !!props.minimap && mounted.value && rootWidth.value >= 480);
4271
+ const minimapOn = computed(() => !!props.minimap && props.scrollY && mounted.value && rootWidth.value >= 480);
4039
4272
  /** Where the minimap is: the row at its top (fractional), and the part in view as a box. */
4040
4273
  const minimap = computed(() => {
4041
4274
  if (!minimapOn.value) return null;
@@ -4114,7 +4347,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4114
4347
  const { n, sub } = lay.lineAtRow(row);
4115
4348
  const rowText = text.lineText(n);
4116
4349
  const breaks = wrapRows ? wrapOf(rowText).breaks : [];
4117
- const tokens = hl && (hl.ready(n) || n - hl.frontier <= SYNTAX_REACH) ? hl.line(n) : null;
4350
+ const tokens = usesRemoteTokens() ? remoteTokens.line(n) : hl && (hl.ready(n) || n - hl.frontier <= syncReach()) ? hl.line(n) : null;
4118
4351
  const rowsHere = lay.rowsOf(n);
4119
4352
  for (let k = sub; k < rowsHere && row <= lastRow; k++, row++) {
4120
4353
  const start = k ? breaks[k - 1] : 0;
@@ -4231,8 +4464,9 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4231
4464
  function onScroll() {
4232
4465
  const el = scroller.value;
4233
4466
  if (!el) return;
4467
+ if (!props.scrollY && el.scrollTop !== 0) el.scrollTop = 0;
4234
4468
  const { top, left } = scrollPositionOf(el);
4235
- scrollTop.value = top;
4469
+ scrollTop.value = props.scrollY ? top : 0;
4236
4470
  scrollLeft.value = left;
4237
4471
  updateClip();
4238
4472
  }
@@ -4245,17 +4479,27 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4245
4479
  const view = el.clientHeight;
4246
4480
  if (view < lh * 3) return;
4247
4481
  const at = place(line.number, line.text, pos - line.from);
4248
- const y = at.top - shift.value;
4249
- const top = el.scrollTop * ratio.value;
4250
- const margin = Math.min(lh, view / 4);
4251
- if (y - margin < top) el.scrollTop = Math.max(0, (y - margin) / ratio.value);
4252
- else if (y + lh + margin > top + view) el.scrollTop = (y + lh + margin - view) / ratio.value;
4482
+ if (props.scrollY) {
4483
+ const y = at.top - shift.value;
4484
+ const top = el.scrollTop * ratio.value;
4485
+ const margin = Math.min(lh, view / 4);
4486
+ if (y - margin < top) el.scrollTop = Math.max(0, (y - margin) / ratio.value);
4487
+ else if (y + lh + margin > top + view) el.scrollTop = (y + lh + margin - view) / ratio.value;
4488
+ }
4253
4489
  const x = pad.x + at.x;
4254
4490
  const width = el.clientWidth - gutterWidth.value;
4255
4491
  if (x - measure.cell * 2 < el.scrollLeft) el.scrollLeft = Math.max(0, x - measure.cell * 4);
4256
4492
  else if (x + measure.cell * 2 > el.scrollLeft + width) el.scrollLeft = x + measure.cell * 4 - width;
4257
4493
  onScroll();
4258
4494
  }
4495
+ watch(() => props.scrollY, (enabled) => {
4496
+ const el = scroller.value;
4497
+ if (!enabled && el) {
4498
+ if (el.scrollTop !== 0) el.scrollTop = 0;
4499
+ scrollTop.value = 0;
4500
+ updateClip();
4501
+ }
4502
+ });
4259
4503
  let clipFrame = 0;
4260
4504
  /** For an editor taller than the window, draws only the lines inside the window. */
4261
4505
  function updateClip() {
@@ -4281,10 +4525,15 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4281
4525
  });
4282
4526
  }
4283
4527
  let resize;
4284
- function refreshMetrics() {
4285
- measure.refresh(props.tabSize);
4528
+ function syncPadding() {
4286
4529
  pad.y = measure.padY;
4287
4530
  pad.x = measure.padX;
4531
+ pad.gutterLeft = measure.gutterPadLeft;
4532
+ pad.gutterRight = measure.gutterPadRight;
4533
+ }
4534
+ function refreshMetrics() {
4535
+ measure.refresh(props.tabSize);
4536
+ syncPadding();
4288
4537
  readFrameFont();
4289
4538
  metrics.value++;
4290
4539
  syncInput();
@@ -4301,13 +4550,30 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4301
4550
  viewHeight.value = el.clientHeight;
4302
4551
  viewWidth.value = el.clientWidth;
4303
4552
  rootWidth.value = root.value?.clientWidth ?? 0;
4553
+ if (measure.refreshPadding()) {
4554
+ syncPadding();
4555
+ metrics.value++;
4556
+ syncInput();
4557
+ }
4304
4558
  updateClip();
4305
4559
  });
4306
4560
  resize.observe(el);
4307
4561
  if (root.value) resize.observe(root.value);
4308
4562
  }
4309
4563
  updateClip();
4564
+ if (root.value && typeof window !== "undefined" && typeof IntersectionObserver !== "undefined") {
4565
+ const rect = root.value.getBoundingClientRect();
4566
+ if (rect.width > 0 || rect.height > 0) {
4567
+ if (rect.bottom < -200 || rect.top > window.innerHeight + 200) inViewport = false;
4568
+ }
4569
+ viewportObserver = new IntersectionObserver((entries) => {
4570
+ const entry = entries[entries.length - 1];
4571
+ if (entry) setInViewport(entry.isIntersecting);
4572
+ }, { rootMargin: "200px 0px" });
4573
+ viewportObserver.observe(root.value);
4574
+ }
4310
4575
  mounted.value = true;
4576
+ if (highlighter && !highlighter.ready(doc.value.lines)) syntaxTick.value++;
4311
4577
  window.addEventListener("scroll", onWindowScroll, {
4312
4578
  capture: true,
4313
4579
  passive: true
@@ -4350,7 +4616,9 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4350
4616
  if (restarted) warnRestarts();
4351
4617
  });
4352
4618
  onBeforeUnmount(() => {
4353
- if (syntaxJob) cancelIdle(syntaxJob);
4619
+ cancelScheduledSyntax();
4620
+ viewportObserver?.disconnect();
4621
+ viewportObserver = void 0;
4354
4622
  clearTimeout(searchTimer);
4355
4623
  resize?.disconnect();
4356
4624
  widgetObserver?.disconnect();
@@ -4454,6 +4722,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4454
4722
  };
4455
4723
  context = api;
4456
4724
  provide(CODE_EDITOR_KEY, api);
4725
+ provide(WIDGET_HEIGHT_KEY, null);
4457
4726
  __expose(api);
4458
4727
  return (_ctx, _cache) => {
4459
4728
  return openBlock(), createElementBlock("div", {
@@ -4464,13 +4733,18 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4464
4733
  unref(ns).is("focused", focused.value),
4465
4734
  unref(ns).is("readonly", !!__props.readonly),
4466
4735
  unref(ns).is("disabled", !!__props.disabled),
4736
+ unref(ns).is("line-numbers", __props.lineNumbers),
4737
+ unref(ns).is("gutter-empty", !gutterWidth.value),
4467
4738
  unref(ns).is("foldable", __props.foldable),
4468
4739
  unref(ns).is("wrap", __props.wrap),
4469
- unref(ns).is("bordered", __props.bordered)
4740
+ unref(ns).is("bordered", __props.bordered),
4741
+ unref(ns).is("scroll-y", __props.scrollY)
4470
4742
  ]),
4471
4743
  style: normalizeStyle({
4472
4744
  "--dou-code-editor-gutter": `${gutterWidth.value}px`,
4473
4745
  "--dou-code-editor-gutter-cells": `${gutterCells.value}px`,
4746
+ "--dou-code-editor-view-width": viewWidth.value > 0 ? `${viewWidth.value}px` : void 0,
4747
+ "--dou-code-editor-widget-width": viewWidth.value > 0 ? `${Math.max(0, viewWidth.value - gutterWidth.value)}px` : void 0,
4474
4748
  "--dou-code-editor-tab-size": __props.tabSize
4475
4749
  })
4476
4750
  }, [
@@ -4588,148 +4862,203 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4588
4862
  height: `${sizerHeight.value}px`,
4589
4863
  minWidth: `max(100%, ${contentWidth.value + gutterWidth.value}px)`
4590
4864
  })
4591
- }, [__props.gutter && (__props.lineNumbers || __props.foldable || gutterCells.value) ? (openBlock(), createElementBlock("div", {
4592
- key: 0,
4593
- class: normalizeClass(unref(ns).e("gutter")),
4594
- "aria-hidden": "true",
4595
- onPointerdown: _cache[5] || (_cache[5] = ($event) => onPointerDown($event, "gutter")),
4596
- onPointermove: onPointerMove,
4597
- onPointerup: _cache[6] || (_cache[6] = ($event) => onPointerUp($event, "gutter")),
4598
- onPointercancel: onPointerCancel,
4599
- onPointerenter: _cache[7] || (_cache[7] = ($event) => gutterHover.value = true),
4600
- onPointerleave: _cache[8] || (_cache[8] = ($event) => gutterHover.value = false),
4601
- onMousedown: _cache[9] || (_cache[9] = withModifiers(() => {}, ["prevent"]))
4602
- }, [createElementVNode("div", {
4603
- class: normalizeClass(unref(ns).e("numbers")),
4604
- style: normalizeStyle({ transform: `translateY(${yOf(visibleFrom.value)}px)` })
4605
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row) => {
4606
- return openBlock(), createElementBlock("div", {
4607
- key: row.n,
4608
- class: normalizeClass([unref(ns).e("number"), unref(ns).is("active", row.n === activeLineNumber.value)]),
4609
- style: normalizeStyle({
4610
- height: row.wrapped.breaks.length ? `${(row.wrapped.breaks.length + 1) * lineHeight.value}px` : void 0,
4611
- marginTop: gapBefore(row.n) ? `${gapBefore(row.n)}px` : void 0
4612
- })
4613
- }, [
4614
- gutterCells.value ? (openBlock(), createElementBlock("span", {
4615
- key: 0,
4616
- class: normalizeClass(unref(ns).e("cells"))
4617
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(gutterColumns.value, (column, c) => {
4618
- return openBlock(), createElementBlock("span", {
4619
- key: column.name,
4620
- class: normalizeClass([unref(ns).e("cell"), gutterMarkers.value[c]?.get(row.n)?.class]),
4621
- style: normalizeStyle({ width: `${column.width}px` }),
4622
- title: gutterMarkers.value[c]?.get(row.n)?.title,
4623
- "data-gutter-cell": column.onPress ? c : void 0,
4624
- "data-line": row.n
4625
- }, [gutterMarkers.value[c]?.get(row.n) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [gutterMarkers.value[c].get(row.n).icon ? (openBlock(), createBlock(resolveDynamicComponent(gutterMarkers.value[c].get(row.n).icon), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(gutterMarkers.value[c].get(row.n).text), 1)], 64))], 64)) : createCommentVNode("", true)], 14, _hoisted_1);
4626
- }), 128))], 2)) : createCommentVNode("", true),
4627
- __props.lineNumbers ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(row.n), 1)], 64)) : createCommentVNode("", true),
4628
- __props.foldable && (row.folded || foldableLines.value.has(row.n)) ? (openBlock(), createElementBlock("span", {
4629
- key: 2,
4630
- class: normalizeClass([unref(ns).e("fold-toggle"), unref(ns).is("folded", row.folded)]),
4631
- "data-fold": row.n
4632
- }, [row.folded ? (openBlock(), createBlock(unref(ChevronRightIcon), { key: 0 })) : (openBlock(), createBlock(unref(ChevronDownIcon), { key: 1 }))], 10, _hoisted_2)) : createCommentVNode("", true)
4633
- ], 6);
4634
- }), 128))], 6)], 34)) : createCommentVNode("", true), createElementVNode("div", {
4635
- ref_key: "content",
4636
- ref: content,
4637
- class: normalizeClass(unref(ns).e("content")),
4638
- onPointerdown: _cache[21] || (_cache[21] = ($event) => onPointerDown($event, "text")),
4639
- onPointermove: _cache[22] || (_cache[22] = ($event) => (onPointerMove($event), onContentHover($event))),
4640
- onPointerup: _cache[23] || (_cache[23] = ($event) => onPointerUp($event, "text")),
4641
- onPointercancel: onPointerCancel,
4642
- onPointerleave: onContentLeave,
4643
- onMousedown: _cache[24] || (_cache[24] = withModifiers(() => {}, ["prevent"]))
4644
4865
  }, [
4645
- createElementVNode("div", {
4646
- ref_key: "probe",
4647
- ref: probe,
4648
- class: normalizeClass(unref(ns).e("probe")),
4649
- "aria-hidden": "true"
4650
- }, null, 2),
4651
- __props.activeLine && activeLineTop.value !== null && !__props.disabled ? (openBlock(), createElementBlock("div", {
4866
+ __props.gutter && (__props.lineNumbers || __props.foldable || gutterColumns.value.length) ? (openBlock(), createElementBlock("div", {
4652
4867
  key: 0,
4653
- class: normalizeClass(unref(ns).e("active-line")),
4654
- style: normalizeStyle({
4655
- transform: `translateY(${activeLineTop.value}px)`,
4656
- height: activeLineRows.value > 1 ? `${activeLineRows.value * lineHeight.value}px` : void 0
4657
- })
4658
- }, null, 6)) : createCommentVNode("", true),
4659
- createElementVNode("div", {
4660
- class: normalizeClass(unref(ns).e("matches")),
4661
- "aria-hidden": "true"
4662
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(matchBoxes.value, (box) => {
4663
- return openBlock(), createElementBlock("div", {
4664
- key: box.key,
4665
- class: normalizeClass([unref(ns).e("match"), unref(ns).is("current", box.current)]),
4666
- style: normalizeStyle({
4667
- transform: `translate(${box.left}px, ${box.top}px)`,
4668
- width: `${box.width}px`
4669
- })
4670
- }, null, 6);
4671
- }), 128))], 2),
4672
- createElementVNode("div", {
4673
- class: normalizeClass(unref(ns).e("brackets")),
4674
- "aria-hidden": "true"
4675
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(bracketBoxes.value, (box) => {
4868
+ class: normalizeClass(unref(ns).e("gutter")),
4869
+ onPointerdown: _cache[5] || (_cache[5] = ($event) => onPointerDown($event, "gutter")),
4870
+ onPointermove: onPointerMove,
4871
+ onPointerup: _cache[6] || (_cache[6] = ($event) => onPointerUp($event, "gutter")),
4872
+ onPointercancel: onPointerCancel,
4873
+ onPointerenter: _cache[7] || (_cache[7] = ($event) => gutterHover.value = true),
4874
+ onPointerleave: _cache[8] || (_cache[8] = ($event) => gutterHover.value = false),
4875
+ onMousedown: _cache[9] || (_cache[9] = withModifiers(() => {}, ["prevent"]))
4876
+ }, [createElementVNode("div", {
4877
+ class: normalizeClass(unref(ns).e("numbers")),
4878
+ style: normalizeStyle({ transform: `translateY(${yOf(visibleFrom.value)}px)` })
4879
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row) => {
4676
4880
  return openBlock(), createElementBlock("div", {
4677
- key: box.key,
4678
- class: normalizeClass([unref(ns).e("bracket"), unref(ns).is("unmatched", !box.matched)]),
4881
+ key: row.n,
4882
+ class: normalizeClass([
4883
+ unref(ns).e("number"),
4884
+ unref(ns).is("active", row.n === activeLineNumber.value),
4885
+ unref(ns).is("hovered", row.n === hoveredLine.value)
4886
+ ]),
4679
4887
  style: normalizeStyle({
4680
- transform: `translate(${box.left}px, ${box.top}px)`,
4681
- width: `${box.width}px`
4888
+ height: row.wrapped.breaks.length ? `${(row.wrapped.breaks.length + 1) * lineHeight.value}px` : void 0,
4889
+ marginTop: gapBefore(row.n) ? `${gapBefore(row.n)}px` : void 0
4682
4890
  })
4683
- }, null, 6);
4684
- }), 128))], 2),
4891
+ }, [
4892
+ flowGutterColumns.value.length ? (openBlock(), createElementBlock("span", {
4893
+ key: 0,
4894
+ class: normalizeClass(unref(ns).e("cells"))
4895
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(flowGutterColumns.value, (item) => {
4896
+ return openBlock(), createElementBlock("span", mergeProps({
4897
+ key: item.column.name,
4898
+ class: [
4899
+ unref(ns).e("cell"),
4900
+ unref(ns).is("on-hover", gutterMarkers.value[item.index]?.get(row.n)?.visible === "hover"),
4901
+ gutterMarkers.value[item.index]?.get(row.n)?.class
4902
+ ],
4903
+ style: { width: `${item.column.width}px` },
4904
+ title: gutterMarkers.value[item.index]?.get(row.n)?.title,
4905
+ "data-gutter-cell": item.column.onPress && (item.column.pressOn !== "markers" || gutterMarkers.value[item.index]?.has(row.n)) ? item.index : void 0,
4906
+ "data-line": row.n
4907
+ }, { ref_for: true }, item.column.onPress && gutterMarkers.value[item.index]?.get(row.n) && !__props.disabled ? {
4908
+ role: "button",
4909
+ tabindex: row.n === activeLineNumber.value ? 0 : -1,
4910
+ "aria-label": gutterMarkers.value[item.index].get(row.n).title
4911
+ } : { "aria-hidden": "true" }, { onKeydown: ($event) => onCellKeydown($event, item.index, row.n) }), [gutterMarkers.value[item.index]?.get(row.n) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [gutterMarkers.value[item.index].get(row.n).icon ? (openBlock(), createBlock(resolveDynamicComponent(gutterMarkers.value[item.index].get(row.n).icon), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(gutterMarkers.value[item.index].get(row.n).text), 1)], 64))], 64)) : createCommentVNode("", true)], 16, _hoisted_1);
4912
+ }), 128))], 2)) : createCommentVNode("", true),
4913
+ __props.lineNumbers ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(row.n), 1)) : createCommentVNode("", true),
4914
+ __props.foldable && (row.folded || foldableLines.value.has(row.n)) ? (openBlock(), createElementBlock("span", {
4915
+ key: 2,
4916
+ class: normalizeClass([unref(ns).e("fold-toggle"), unref(ns).is("folded", row.folded)]),
4917
+ "data-fold": row.n,
4918
+ "aria-hidden": "true"
4919
+ }, [row.folded ? (openBlock(), createBlock(unref(ChevronRightIcon), { key: 0 })) : (openBlock(), createBlock(unref(ChevronDownIcon), { key: 1 }))], 10, _hoisted_3)) : createCommentVNode("", true),
4920
+ overlayGutterColumns.value.length ? (openBlock(), createElementBlock("span", {
4921
+ key: 3,
4922
+ class: normalizeClass(unref(ns).e("overlays"))
4923
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(overlayGutterColumns.value, (item) => {
4924
+ return openBlock(), createElementBlock(Fragment, { key: item.column.name }, [gutterMarkers.value[item.index]?.get(row.n) ? (openBlock(), createElementBlock("span", mergeProps({
4925
+ key: 0,
4926
+ class: [
4927
+ unref(ns).e("cell"),
4928
+ unref(ns).is("overlay", true),
4929
+ unref(ns).is("on-hover", gutterMarkers.value[item.index].get(row.n).visible === "hover"),
4930
+ gutterMarkers.value[item.index].get(row.n).class
4931
+ ],
4932
+ style: { width: `${item.column.width}px` },
4933
+ title: gutterMarkers.value[item.index].get(row.n).title,
4934
+ "data-gutter-cell": item.column.onPress ? item.index : void 0,
4935
+ "data-line": row.n
4936
+ }, { ref_for: true }, item.column.onPress && !__props.disabled ? {
4937
+ role: "button",
4938
+ tabindex: row.n === activeLineNumber.value ? 0 : -1,
4939
+ "aria-label": gutterMarkers.value[item.index].get(row.n).title
4940
+ } : { "aria-hidden": "true" }, { onKeydown: ($event) => onCellKeydown($event, item.index, row.n) }), [gutterMarkers.value[item.index].get(row.n).icon ? (openBlock(), createBlock(resolveDynamicComponent(gutterMarkers.value[item.index].get(row.n).icon), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(gutterMarkers.value[item.index].get(row.n).text), 1)], 64))], 16, _hoisted_4)) : createCommentVNode("", true)], 64);
4941
+ }), 128))], 2)) : createCommentVNode("", true)
4942
+ ], 6);
4943
+ }), 128))], 6)], 34)) : createCommentVNode("", true),
4685
4944
  createElementVNode("div", {
4686
- class: normalizeClass(unref(ns).e("selections")),
4687
- "aria-hidden": "true"
4688
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(selectionBoxes.value, (box) => {
4689
- return openBlock(), createElementBlock("div", {
4690
- key: box.key,
4691
- class: normalizeClass(unref(ns).e("selection")),
4945
+ ref_key: "content",
4946
+ ref: content,
4947
+ class: normalizeClass(unref(ns).e("content")),
4948
+ onPointerdown: _cache[18] || (_cache[18] = ($event) => onPointerDown($event, "text")),
4949
+ onPointermove: _cache[19] || (_cache[19] = ($event) => (onPointerMove($event), onContentHover($event))),
4950
+ onPointerup: _cache[20] || (_cache[20] = ($event) => onPointerUp($event, "text")),
4951
+ onPointercancel: onPointerCancel,
4952
+ onPointerleave: onContentLeave,
4953
+ onMousedown: _cache[21] || (_cache[21] = withModifiers(() => {}, ["prevent"]))
4954
+ }, [
4955
+ createElementVNode("div", {
4956
+ ref_key: "probe",
4957
+ ref: probe,
4958
+ class: normalizeClass(unref(ns).e("probe")),
4959
+ "aria-hidden": "true"
4960
+ }, null, 2),
4961
+ __props.activeLine && activeLineTop.value !== null && !__props.disabled ? (openBlock(), createElementBlock("div", {
4962
+ key: 0,
4963
+ class: normalizeClass(unref(ns).e("active-line")),
4692
4964
  style: normalizeStyle({
4693
- transform: `translate(${box.left}px, ${box.top}px)`,
4694
- width: `${box.width}px`
4965
+ transform: `translateY(${activeLineTop.value}px)`,
4966
+ height: activeLineRows.value > 1 ? `${activeLineRows.value * lineHeight.value}px` : void 0
4695
4967
  })
4696
- }, null, 6);
4697
- }), 128))], 2),
4698
- createElementVNode("div", {
4699
- class: normalizeClass(unref(ns).e("lines")),
4700
- "aria-hidden": "true",
4701
- style: normalizeStyle({ transform: `translateY(${yOf(visibleFrom.value)}px)` })
4702
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, __, ___, _cached) => {
4703
- const _memo = [
4704
- row.text,
4705
- row.tokens,
4706
- row.compose?.join("\0"),
4707
- row.wrapped,
4708
- row.folded,
4709
- row.marksKey,
4710
- row.inlinesKey,
4711
- row.lineClass,
4712
- gapBefore(row.n)
4713
- ];
4714
- if (_cached && _cached.el && _cached.key === row.n && isMemoSame(_cached, _memo)) return _cached;
4715
- const _item = (openBlock(), createElementBlock("div", {
4716
- key: row.n,
4717
- class: normalizeClass([
4718
- unref(ns).e("line"),
4719
- unref(ns).is("wrapped", !!row.wrapped.breaks.length),
4720
- row.lineClass
4721
- ]),
4722
- style: normalizeStyle(gapBefore(row.n) ? { marginTop: `${gapBefore(row.n)}px` } : void 0)
4723
- }, [row.compose ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
4724
- createTextVNode(toDisplayString(row.compose[0]), 1),
4725
- createElementVNode("span", { class: normalizeClass(unref(ns).e("compose")) }, toDisplayString(row.compose[1]), 3),
4726
- createTextVNode(toDisplayString(row.compose[2]), 1)
4727
- ], 64)) : row.wrapped.breaks.length ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(row.wrapped.breaks.length + 1, (_, sub) => {
4968
+ }, null, 6)) : createCommentVNode("", true),
4969
+ createElementVNode("div", {
4970
+ class: normalizeClass(unref(ns).e("matches")),
4971
+ "aria-hidden": "true"
4972
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(matchBoxes.value, (box) => {
4973
+ return openBlock(), createElementBlock("div", {
4974
+ key: box.key,
4975
+ class: normalizeClass([unref(ns).e("match"), unref(ns).is("current", box.current)]),
4976
+ style: normalizeStyle({
4977
+ transform: `translate(${box.left}px, ${box.top}px)`,
4978
+ width: `${box.width}px`
4979
+ })
4980
+ }, null, 6);
4981
+ }), 128))], 2),
4982
+ createElementVNode("div", {
4983
+ class: normalizeClass(unref(ns).e("brackets")),
4984
+ "aria-hidden": "true"
4985
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(bracketBoxes.value, (box) => {
4728
4986
  return openBlock(), createElementBlock("div", {
4729
- key: sub,
4730
- class: normalizeClass(unref(ns).e("row")),
4731
- style: normalizeStyle(sub ? { paddingLeft: `${row.wrapped.indent}px` } : void 0)
4732
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rowParts(row, sub), (part, i) => {
4987
+ key: box.key,
4988
+ class: normalizeClass([unref(ns).e("bracket"), unref(ns).is("unmatched", !box.matched)]),
4989
+ style: normalizeStyle({
4990
+ transform: `translate(${box.left}px, ${box.top}px)`,
4991
+ width: `${box.width}px`
4992
+ })
4993
+ }, null, 6);
4994
+ }), 128))], 2),
4995
+ createElementVNode("div", {
4996
+ class: normalizeClass(unref(ns).e("selections")),
4997
+ "aria-hidden": "true"
4998
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(selectionBoxes.value, (box) => {
4999
+ return openBlock(), createElementBlock("div", {
5000
+ key: box.key,
5001
+ class: normalizeClass(unref(ns).e("selection")),
5002
+ style: normalizeStyle({
5003
+ transform: `translate(${box.left}px, ${box.top}px)`,
5004
+ width: `${box.width}px`
5005
+ })
5006
+ }, null, 6);
5007
+ }), 128))], 2),
5008
+ createElementVNode("div", {
5009
+ class: normalizeClass(unref(ns).e("lines")),
5010
+ "aria-hidden": "true",
5011
+ style: normalizeStyle({ transform: `translateY(${yOf(visibleFrom.value)}px)` })
5012
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row, __, ___, _cached) => {
5013
+ const _memo = [
5014
+ row.text,
5015
+ row.tokens,
5016
+ row.compose?.join("\0"),
5017
+ row.wrapped,
5018
+ row.folded,
5019
+ row.marksKey,
5020
+ row.inlinesKey,
5021
+ row.lineClass,
5022
+ gapBefore(row.n)
5023
+ ];
5024
+ if (_cached && _cached.el && _cached.key === row.n && isMemoSame(_cached, _memo)) return _cached;
5025
+ const _item = (openBlock(), createElementBlock("div", {
5026
+ key: row.n,
5027
+ class: normalizeClass([
5028
+ unref(ns).e("line"),
5029
+ unref(ns).is("wrapped", !!row.wrapped.breaks.length),
5030
+ row.lineClass
5031
+ ]),
5032
+ style: normalizeStyle(gapBefore(row.n) ? { marginTop: `${gapBefore(row.n)}px` } : void 0)
5033
+ }, [row.compose ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
5034
+ createTextVNode(toDisplayString(row.compose[0]), 1),
5035
+ createElementVNode("span", { class: normalizeClass(unref(ns).e("compose")) }, toDisplayString(row.compose[1]), 3),
5036
+ createTextVNode(toDisplayString(row.compose[2]), 1)
5037
+ ], 64)) : row.wrapped.breaks.length ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(row.wrapped.breaks.length + 1, (_, sub) => {
5038
+ return openBlock(), createElementBlock("div", {
5039
+ key: sub,
5040
+ class: normalizeClass(unref(ns).e("row")),
5041
+ style: normalizeStyle(sub ? { paddingLeft: `${row.wrapped.indent}px` } : void 0)
5042
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(rowParts(row, sub), (part, i) => {
5043
+ return openBlock(), createElementBlock(Fragment, { key: i }, [part[3] !== void 0 ? (openBlock(), createElementBlock("span", {
5044
+ key: 0,
5045
+ ref_for: true,
5046
+ ref: (el) => observeInline(el, row.inlines[part[3]].key, row.inlines[part[3]].width),
5047
+ class: normalizeClass(unref(ns).e("inline")),
5048
+ style: normalizeStyle(row.inlines[part[3]].width !== void 0 ? { width: `${row.inlines[part[3]].width}px` } : void 0)
5049
+ }, [createVNode(unref(render_part_default), { render: row.inlines[part[3]].render }, null, 8, ["render"])], 6)) : part[1] ? (openBlock(), createElementBlock("span", {
5050
+ key: 1,
5051
+ class: normalizeClass(part[1]),
5052
+ title: part[2],
5053
+ style: normalizeStyle(part[4])
5054
+ }, toDisplayString(part[0]), 15, _hoisted_5)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
5055
+ }), 128)), row.folded && sub === row.wrapped.breaks.length ? (openBlock(), createElementBlock("span", {
5056
+ key: 0,
5057
+ class: normalizeClass(unref(ns).e("fold-marker")),
5058
+ "data-unfold": row.n,
5059
+ title: unref(messages).unfold
5060
+ }, "⋯", 10, _hoisted_6)) : createCommentVNode("", true)], 6);
5061
+ }), 128)) : row.tokens || row.marks || row.inlines ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(partsOf(row), (part, i) => {
4733
5062
  return openBlock(), createElementBlock(Fragment, { key: i }, [part[3] !== void 0 ? (openBlock(), createElementBlock("span", {
4734
5063
  key: 0,
4735
5064
  ref_for: true,
@@ -4741,285 +5070,266 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
4741
5070
  class: normalizeClass(part[1]),
4742
5071
  title: part[2],
4743
5072
  style: normalizeStyle(part[4])
4744
- }, toDisplayString(part[0]), 15, _hoisted_3)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
4745
- }), 128)), row.folded && sub === row.wrapped.breaks.length ? (openBlock(), createElementBlock("span", {
4746
- key: 0,
5073
+ }, toDisplayString(part[0]), 15, _hoisted_7)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
5074
+ }), 128)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [createTextVNode(toDisplayString(row.text), 1)], 64)), row.folded && !row.wrapped.breaks.length ? (openBlock(), createElementBlock("span", {
5075
+ key: 4,
4747
5076
  class: normalizeClass(unref(ns).e("fold-marker")),
4748
5077
  "data-unfold": row.n,
4749
5078
  title: unref(messages).unfold
4750
- }, "⋯", 10, _hoisted_4)) : createCommentVNode("", true)], 6);
4751
- }), 128)) : row.tokens || row.marks || row.inlines ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(partsOf(row), (part, i) => {
4752
- return openBlock(), createElementBlock(Fragment, { key: i }, [part[3] !== void 0 ? (openBlock(), createElementBlock("span", {
5079
+ }, "⋯", 10, _hoisted_8)) : createCommentVNode("", true)], 6));
5080
+ _item.memo = _memo;
5081
+ return _item;
5082
+ }, _cache, 10), 128))], 6),
5083
+ __props.placeholder && !doc.value.length && !composing.value ? (openBlock(), createElementBlock("div", {
5084
+ key: 1,
5085
+ class: normalizeClass(unref(ns).e("placeholder")),
5086
+ "aria-hidden": "true"
5087
+ }, toDisplayString(__props.placeholder), 3)) : createCommentVNode("", true),
5088
+ focused.value ? (openBlock(), createElementBlock("div", {
5089
+ key: blink.value,
5090
+ class: normalizeClass(unref(ns).e("cursors")),
5091
+ "aria-hidden": "true"
5092
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(cursors.value, (cursor) => {
5093
+ return openBlock(), createElementBlock("div", {
5094
+ key: cursor.key,
5095
+ class: normalizeClass(unref(ns).e("cursor")),
5096
+ style: normalizeStyle({ transform: `translate(${cursor.left - 1}px, ${cursor.top}px)` })
5097
+ }, null, 6);
5098
+ }), 128))], 2)) : createCommentVNode("", true),
5099
+ (openBlock(), createBlock(Teleport, {
5100
+ to: floatingTarget.value || "body",
5101
+ disabled: !floatingTarget.value
5102
+ }, [createElementVNode("div", {
5103
+ ref_key: "floatingEl",
5104
+ ref: floatingEl,
5105
+ class: normalizeClass([
5106
+ unref(ns).e("floating"),
5107
+ unref(ns).is("outside", !!floatingTarget.value),
5108
+ unref(ns).is("fixed", !!floatingTarget.value && anchorMode.value === "fixed"),
5109
+ unref(ns).is("scrolling", !!floatingTarget.value && boxScrolling.value)
5110
+ ]),
5111
+ style: normalizeStyle(floatingTarget.value ? {
5112
+ ...frameVars.value,
5113
+ zIndex: floatingZ.value,
5114
+ transform: `translate(${layerShift.value.x}px, ${layerShift.value.y}px)`
5115
+ } : void 0)
5116
+ }, [
5117
+ problemStyle.value ? (openBlock(), createElementBlock("div", {
4753
5118
  key: 0,
4754
- ref_for: true,
4755
- ref: (el) => observeInline(el, row.inlines[part[3]].key, row.inlines[part[3]].width),
4756
- class: normalizeClass(unref(ns).e("inline")),
4757
- style: normalizeStyle(row.inlines[part[3]].width !== void 0 ? { width: `${row.inlines[part[3]].width}px` } : void 0)
4758
- }, [createVNode(unref(render_part_default), { render: row.inlines[part[3]].render }, null, 8, ["render"])], 6)) : part[1] ? (openBlock(), createElementBlock("span", {
5119
+ ref_key: "problemEl",
5120
+ ref: problemEl,
5121
+ class: normalizeClass(unref(ns).e("problems")),
5122
+ role: "group",
5123
+ "aria-label": problemBox.value.problems.length ? unref(messages).problems : unref(messages).details,
5124
+ style: normalizeStyle(problemStyle.value),
5125
+ onPointerdown: _cache[12] || (_cache[12] = withModifiers(() => {}, ["stop", "prevent"])),
5126
+ onPointermove: _cache[13] || (_cache[13] = withModifiers(() => {}, ["stop"])),
5127
+ onPointerenter: keepProblems,
5128
+ onPointerleave: onContentLeave
5129
+ }, [
5130
+ (openBlock(true), createElementBlock(Fragment, null, renderList(problemBox.value.info, (item, i) => {
5131
+ return openBlock(), createElementBlock("div", {
5132
+ key: `info-${i}`,
5133
+ class: normalizeClass(unref(ns).e("hover"))
5134
+ }, [typeof item === "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(item), 1)], 64)) : (openBlock(), createBlock(unref(render_part_default), {
5135
+ key: 1,
5136
+ render: item
5137
+ }, null, 8, ["render"]))], 2);
5138
+ }), 128)),
5139
+ (openBlock(true), createElementBlock(Fragment, null, renderList(problemBox.value.problems, (problem, i) => {
5140
+ return openBlock(), createElementBlock("div", {
5141
+ key: i,
5142
+ class: normalizeClass([unref(ns).e("problem-item"), unref(ns).is(problem.severity, true)])
5143
+ }, [(openBlock(), createBlock(resolveDynamicComponent(SEVERITY_ICON[problem.severity]), { class: normalizeClass(unref(ns).e("problem-severity")) }, null, 8, ["class"])), createElementVNode("span", { class: normalizeClass(unref(ns).e("problem-message")) }, [createTextVNode(toDisplayString(problem.message), 1), problem.source ? (openBlock(), createElementBlock("span", {
5144
+ key: 0,
5145
+ class: normalizeClass(unref(ns).e("problem-source"))
5146
+ }, toDisplayString(problem.source), 3)) : createCommentVNode("", true)], 2)], 2);
5147
+ }), 128)),
5148
+ fixes.value.length ? (openBlock(), createElementBlock("div", {
5149
+ key: 0,
5150
+ class: normalizeClass(unref(ns).e("fixes"))
5151
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(fixes.value, (fix, i) => {
5152
+ return openBlock(), createElementBlock("button", {
5153
+ key: i,
5154
+ type: "button",
5155
+ tabindex: "-1",
5156
+ class: normalizeClass([unref(ns).e("fix"), unref(ns).is("active", i === problemBox.value.index)]),
5157
+ "aria-current": i === problemBox.value.index || void 0,
5158
+ onClick: ($event) => runFix(i)
5159
+ }, toDisplayString(fix.action.label), 11, _hoisted_10);
5160
+ }), 128))], 2)) : createCommentVNode("", true)
5161
+ ], 46, _hoisted_9)) : createCommentVNode("", true),
5162
+ completionStyle.value ? (openBlock(), createElementBlock("div", {
4759
5163
  key: 1,
4760
- class: normalizeClass(part[1]),
4761
- title: part[2],
4762
- style: normalizeStyle(part[4])
4763
- }, toDisplayString(part[0]), 15, _hoisted_5)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
4764
- }), 128)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [createTextVNode(toDisplayString(row.text), 1)], 64)), row.folded && !row.wrapped.breaks.length ? (openBlock(), createElementBlock("span", {
4765
- key: 4,
4766
- class: normalizeClass(unref(ns).e("fold-marker")),
4767
- "data-unfold": row.n,
4768
- title: unref(messages).unfold
4769
- }, "⋯", 10, _hoisted_6)) : createCommentVNode("", true)], 6));
4770
- _item.memo = _memo;
4771
- return _item;
4772
- }, _cache, 10), 128))], 6),
4773
- __props.placeholder && !doc.value.length && !composing.value ? (openBlock(), createElementBlock("div", {
4774
- key: 1,
4775
- class: normalizeClass(unref(ns).e("placeholder")),
4776
- "aria-hidden": "true"
4777
- }, toDisplayString(__props.placeholder), 3)) : createCommentVNode("", true),
4778
- focused.value ? (openBlock(), createElementBlock("div", {
4779
- key: blink.value,
4780
- class: normalizeClass(unref(ns).e("cursors")),
4781
- "aria-hidden": "true"
4782
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(cursors.value, (cursor) => {
4783
- return openBlock(), createElementBlock("div", {
4784
- key: cursor.key,
4785
- class: normalizeClass(unref(ns).e("cursor")),
4786
- style: normalizeStyle({ transform: `translate(${cursor.left - 1}px, ${cursor.top}px)` })
4787
- }, null, 6);
4788
- }), 128))], 2)) : createCommentVNode("", true),
4789
- (openBlock(), createBlock(Teleport, {
4790
- to: floatingTarget.value || "body",
4791
- disabled: !floatingTarget.value
4792
- }, [createElementVNode("div", {
4793
- ref_key: "floatingEl",
4794
- ref: floatingEl,
4795
- class: normalizeClass([
4796
- unref(ns).e("floating"),
4797
- unref(ns).is("outside", !!floatingTarget.value),
4798
- unref(ns).is("fixed", !!floatingTarget.value && anchorMode.value === "fixed"),
4799
- unref(ns).is("scrolling", !!floatingTarget.value && boxScrolling.value)
4800
- ]),
4801
- style: normalizeStyle(floatingTarget.value ? {
4802
- ...frameVars.value,
4803
- zIndex: floatingZ.value,
4804
- transform: `translate(${layerShift.value.x}px, ${layerShift.value.y}px)`
4805
- } : void 0)
4806
- }, [
4807
- problemStyle.value ? (openBlock(), createElementBlock("div", {
4808
- key: 0,
4809
- ref_key: "problemEl",
4810
- ref: problemEl,
4811
- class: normalizeClass(unref(ns).e("problems")),
4812
- role: "group",
4813
- "aria-label": problemBox.value.problems.length ? unref(messages).problems : unref(messages).details,
4814
- style: normalizeStyle(problemStyle.value),
4815
- onPointerdown: _cache[12] || (_cache[12] = withModifiers(() => {}, ["stop", "prevent"])),
4816
- onPointermove: _cache[13] || (_cache[13] = withModifiers(() => {}, ["stop"])),
4817
- onPointerenter: keepProblems,
4818
- onPointerleave: onContentLeave
4819
- }, [
4820
- (openBlock(true), createElementBlock(Fragment, null, renderList(problemBox.value.info, (item, i) => {
4821
- return openBlock(), createElementBlock("div", {
4822
- key: `info-${i}`,
4823
- class: normalizeClass(unref(ns).e("hover"))
4824
- }, [typeof item === "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(item), 1)], 64)) : (openBlock(), createBlock(unref(render_part_default), {
4825
- key: 1,
4826
- render: item
4827
- }, null, 8, ["render"]))], 2);
4828
- }), 128)),
4829
- (openBlock(true), createElementBlock(Fragment, null, renderList(problemBox.value.problems, (problem, i) => {
5164
+ ref_key: "completionEl",
5165
+ ref: completionEl,
5166
+ class: normalizeClass(unref(ns).e("completions")),
5167
+ style: normalizeStyle(completionStyle.value),
5168
+ onPointerdown: _cache[14] || (_cache[14] = withModifiers(() => {}, ["stop", "prevent"])),
5169
+ onPointermove: _cache[15] || (_cache[15] = withModifiers(() => {}, ["stop"]))
5170
+ }, [createElementVNode("div", {
5171
+ id: completionId,
5172
+ ref_key: "completionList",
5173
+ ref: completionList,
5174
+ class: normalizeClass(unref(ns).e("completion-list")),
5175
+ role: "listbox",
5176
+ "aria-label": unref(messages).completions
5177
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(completion.value.items, (item, i) => {
4830
5178
  return openBlock(), createElementBlock("div", {
5179
+ id: `${completionId}-${i}`,
4831
5180
  key: i,
4832
- class: normalizeClass([unref(ns).e("problem-item"), unref(ns).is(problem.severity, true)])
4833
- }, [(openBlock(), createBlock(resolveDynamicComponent(SEVERITY_ICON[problem.severity]), { class: normalizeClass(unref(ns).e("problem-severity")) }, null, 8, ["class"])), createElementVNode("span", { class: normalizeClass(unref(ns).e("problem-message")) }, [createTextVNode(toDisplayString(problem.message), 1), problem.source ? (openBlock(), createElementBlock("span", {
5181
+ role: "option",
5182
+ "aria-selected": i === completion.value.index,
5183
+ class: normalizeClass([unref(ns).e("completion"), unref(ns).is("active", i === completion.value.index)]),
5184
+ onClick: ($event) => acceptCompletion(i)
5185
+ }, [
5186
+ (openBlock(), createBlock(resolveDynamicComponent(KIND_ICON[item.option.kind ?? "text"]), {
5187
+ class: normalizeClass([unref(ns).e("completion-kind"), unref(ns).is(item.option.kind ?? "text", true)]),
5188
+ "aria-hidden": "true"
5189
+ }, null, 8, ["class"])),
5190
+ createElementVNode("span", { class: normalizeClass(unref(ns).e("completion-label")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(labelParts(item), (part, j) => {
5191
+ return openBlock(), createElementBlock(Fragment, { key: j }, [part[1] ? (openBlock(), createElementBlock("mark", {
5192
+ key: 0,
5193
+ class: normalizeClass(unref(ns).e("completion-match"))
5194
+ }, toDisplayString(part[0]), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
5195
+ }), 128))], 2),
5196
+ item.option.detail ? (openBlock(), createElementBlock("span", {
5197
+ key: 0,
5198
+ class: normalizeClass(unref(ns).e("completion-detail"))
5199
+ }, toDisplayString(item.option.detail), 3)) : createCommentVNode("", true)
5200
+ ], 10, _hoisted_12);
5201
+ }), 128))], 10, _hoisted_11), completion.value.items[completion.value.index]?.option.info ? (openBlock(), createElementBlock("div", {
5202
+ key: 0,
5203
+ class: normalizeClass(unref(ns).e("completion-info"))
5204
+ }, [typeof completion.value.items[completion.value.index].option.info === "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(completion.value.items[completion.value.index].option.info), 1)], 64)) : (openBlock(), createBlock(unref(render_part_default), {
5205
+ key: 1,
5206
+ render: completion.value.items[completion.value.index].option.info
5207
+ }, null, 8, ["render"]))], 2)) : createCommentVNode("", true)], 38)) : createCommentVNode("", true),
5208
+ signatureStyle.value ? (openBlock(), createElementBlock("div", {
5209
+ key: 2,
5210
+ ref_key: "signatureEl",
5211
+ ref: signatureEl,
5212
+ class: normalizeClass(unref(ns).e("signature")),
5213
+ role: "note",
5214
+ "aria-label": unref(messages).signature,
5215
+ style: normalizeStyle(signatureStyle.value),
5216
+ onPointerdown: _cache[16] || (_cache[16] = withModifiers(() => {}, ["stop", "prevent"]))
5217
+ }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("signature-label")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(signatureParts.value, (part, i) => {
5218
+ return openBlock(), createElementBlock(Fragment, { key: i }, [part[1] ? (openBlock(), createElementBlock("span", {
4834
5219
  key: 0,
4835
- class: normalizeClass(unref(ns).e("problem-source"))
4836
- }, toDisplayString(problem.source), 3)) : createCommentVNode("", true)], 2)], 2);
4837
- }), 128)),
4838
- fixes.value.length ? (openBlock(), createElementBlock("div", {
5220
+ class: normalizeClass(unref(ns).e("signature-active"))
5221
+ }, toDisplayString(part[0]), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
5222
+ }), 128))], 2), signature.value.result.info ? (openBlock(), createElementBlock("div", {
4839
5223
  key: 0,
4840
- class: normalizeClass(unref(ns).e("fixes"))
4841
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(fixes.value, (fix, i) => {
5224
+ class: normalizeClass(unref(ns).e("signature-info"))
5225
+ }, [typeof signature.value.result.info === "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(signature.value.result.info), 1)], 64)) : (openBlock(), createBlock(unref(render_part_default), {
5226
+ key: 1,
5227
+ render: signature.value.result.info
5228
+ }, null, 8, ["render"]))], 2)) : createCommentVNode("", true)], 46, _hoisted_13)) : createCommentVNode("", true),
5229
+ (openBlock(true), createElementBlock(Fragment, null, renderList(handles.value, (handle) => {
5230
+ return openBlock(), createElementBlock("div", {
5231
+ key: handle.kind,
5232
+ class: normalizeClass([unref(ns).e("handle"), unref(ns).is(handle.kind, true)]),
5233
+ style: normalizeStyle({ transform: `translate(${handle.left}px, ${handle.top}px)` }),
5234
+ "aria-hidden": "true",
5235
+ onPointerdown: ($event) => onHandleDown($event, handle.kind)
5236
+ }, null, 46, _hoisted_14);
5237
+ }), 128)),
5238
+ magnifier.value ? (openBlock(), createElementBlock("div", {
5239
+ key: 3,
5240
+ class: normalizeClass(unref(ns).e("magnifier")),
5241
+ style: normalizeStyle(magnifier.value.style),
5242
+ "aria-hidden": "true"
5243
+ }, [createElementVNode("div", {
5244
+ class: normalizeClass(unref(ns).e("magnifier-text")),
5245
+ style: normalizeStyle([magnifier.value.textStyle, { paddingLeft: `${magnifier.value.indent}px` }])
5246
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(magnifier.value.parts, (part, i) => {
5247
+ return openBlock(), createElementBlock(Fragment, { key: i }, [part[3] !== void 0 ? (openBlock(), createElementBlock("span", {
5248
+ key: 0,
5249
+ class: normalizeClass(unref(ns).e("inline")),
5250
+ style: normalizeStyle({ width: `${widthOf(magnifier.value.inlines[part[3]])}px` })
5251
+ }, [createVNode(unref(render_part_default), { render: magnifier.value.inlines[part[3]].render }, null, 8, ["render"])], 6)) : part[1] ? (openBlock(), createElementBlock("span", {
5252
+ key: 1,
5253
+ class: normalizeClass(part[1]),
5254
+ title: part[2],
5255
+ style: normalizeStyle(part[4])
5256
+ }, toDisplayString(part[0]), 15, _hoisted_15)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
5257
+ }), 128))], 6), createElementVNode("div", {
5258
+ class: normalizeClass(unref(ns).e("magnifier-caret")),
5259
+ style: normalizeStyle({ left: `${magnifier.value.caret - 1}px` })
5260
+ }, null, 6)], 6)) : createCommentVNode("", true),
5261
+ menuStyle.value ? (openBlock(), createElementBlock("div", {
5262
+ key: 4,
5263
+ ref_key: "menuEl",
5264
+ ref: menuEl,
5265
+ class: normalizeClass(unref(ns).e("menu")),
5266
+ role: "toolbar",
5267
+ "aria-label": unref(messages).editMenu,
5268
+ style: normalizeStyle(menuStyle.value),
5269
+ onPointerdown: _cache[17] || (_cache[17] = withModifiers(() => {}, ["stop", "prevent"]))
5270
+ }, [(openBlock(true), createElementBlock(Fragment, null, renderList(menuItems.value, (item) => {
4842
5271
  return openBlock(), createElementBlock("button", {
4843
- key: i,
5272
+ key: item.key,
4844
5273
  type: "button",
4845
5274
  tabindex: "-1",
4846
- class: normalizeClass([unref(ns).e("fix"), unref(ns).is("active", i === problemBox.value.index)]),
4847
- "aria-current": i === problemBox.value.index || void 0,
4848
- onClick: ($event) => runFix(i)
4849
- }, toDisplayString(fix.action.label), 11, _hoisted_8);
4850
- }), 128))], 2)) : createCommentVNode("", true)
4851
- ], 46, _hoisted_7)) : createCommentVNode("", true),
4852
- completionStyle.value ? (openBlock(), createElementBlock("div", {
4853
- key: 1,
4854
- ref_key: "completionEl",
4855
- ref: completionEl,
4856
- class: normalizeClass(unref(ns).e("completions")),
4857
- style: normalizeStyle(completionStyle.value),
4858
- onPointerdown: _cache[14] || (_cache[14] = withModifiers(() => {}, ["stop", "prevent"])),
4859
- onPointermove: _cache[15] || (_cache[15] = withModifiers(() => {}, ["stop"]))
4860
- }, [createElementVNode("div", {
4861
- id: completionId,
4862
- ref_key: "completionList",
4863
- ref: completionList,
4864
- class: normalizeClass(unref(ns).e("completion-list")),
4865
- role: "listbox",
4866
- "aria-label": unref(messages).completions
4867
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(completion.value.items, (item, i) => {
4868
- return openBlock(), createElementBlock("div", {
4869
- id: `${completionId}-${i}`,
4870
- key: i,
4871
- role: "option",
4872
- "aria-selected": i === completion.value.index,
4873
- class: normalizeClass([unref(ns).e("completion"), unref(ns).is("active", i === completion.value.index)]),
4874
- onClick: ($event) => acceptCompletion(i)
4875
- }, [
4876
- (openBlock(), createBlock(resolveDynamicComponent(KIND_ICON[item.option.kind ?? "text"]), {
4877
- class: normalizeClass([unref(ns).e("completion-kind"), unref(ns).is(item.option.kind ?? "text", true)]),
4878
- "aria-hidden": "true"
4879
- }, null, 8, ["class"])),
4880
- createElementVNode("span", { class: normalizeClass(unref(ns).e("completion-label")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(labelParts(item), (part, j) => {
4881
- return openBlock(), createElementBlock(Fragment, { key: j }, [part[1] ? (openBlock(), createElementBlock("mark", {
4882
- key: 0,
4883
- class: normalizeClass(unref(ns).e("completion-match"))
4884
- }, toDisplayString(part[0]), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
4885
- }), 128))], 2),
4886
- item.option.detail ? (openBlock(), createElementBlock("span", {
4887
- key: 0,
4888
- class: normalizeClass(unref(ns).e("completion-detail"))
4889
- }, toDisplayString(item.option.detail), 3)) : createCommentVNode("", true)
4890
- ], 10, _hoisted_10);
4891
- }), 128))], 10, _hoisted_9), completion.value.items[completion.value.index]?.option.info ? (openBlock(), createElementBlock("div", {
4892
- key: 0,
4893
- class: normalizeClass(unref(ns).e("completion-info"))
4894
- }, [typeof completion.value.items[completion.value.index].option.info === "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(completion.value.items[completion.value.index].option.info), 1)], 64)) : (openBlock(), createBlock(unref(render_part_default), {
4895
- key: 1,
4896
- render: completion.value.items[completion.value.index].option.info
4897
- }, null, 8, ["render"]))], 2)) : createCommentVNode("", true)], 38)) : createCommentVNode("", true),
4898
- signatureStyle.value ? (openBlock(), createElementBlock("div", {
4899
- key: 2,
4900
- ref_key: "signatureEl",
4901
- ref: signatureEl,
4902
- class: normalizeClass(unref(ns).e("signature")),
4903
- role: "note",
4904
- "aria-label": unref(messages).signature,
4905
- style: normalizeStyle(signatureStyle.value),
4906
- onPointerdown: _cache[16] || (_cache[16] = withModifiers(() => {}, ["stop", "prevent"]))
4907
- }, [createElementVNode("div", { class: normalizeClass(unref(ns).e("signature-label")) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(signatureParts.value, (part, i) => {
4908
- return openBlock(), createElementBlock(Fragment, { key: i }, [part[1] ? (openBlock(), createElementBlock("span", {
4909
- key: 0,
4910
- class: normalizeClass(unref(ns).e("signature-active"))
4911
- }, toDisplayString(part[0]), 3)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
4912
- }), 128))], 2), signature.value.result.info ? (openBlock(), createElementBlock("div", {
4913
- key: 0,
4914
- class: normalizeClass(unref(ns).e("signature-info"))
4915
- }, [typeof signature.value.result.info === "string" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(signature.value.result.info), 1)], 64)) : (openBlock(), createBlock(unref(render_part_default), {
4916
- key: 1,
4917
- render: signature.value.result.info
4918
- }, null, 8, ["render"]))], 2)) : createCommentVNode("", true)], 46, _hoisted_11)) : createCommentVNode("", true),
4919
- (openBlock(true), createElementBlock(Fragment, null, renderList(handles.value, (handle) => {
4920
- return openBlock(), createElementBlock("div", {
4921
- key: handle.kind,
4922
- class: normalizeClass([unref(ns).e("handle"), unref(ns).is(handle.kind, true)]),
4923
- style: normalizeStyle({ transform: `translate(${handle.left}px, ${handle.top}px)` }),
4924
- "aria-hidden": "true",
4925
- onPointerdown: ($event) => onHandleDown($event, handle.kind)
4926
- }, null, 46, _hoisted_12);
4927
- }), 128)),
4928
- magnifier.value ? (openBlock(), createElementBlock("div", {
4929
- key: 3,
4930
- class: normalizeClass(unref(ns).e("magnifier")),
4931
- style: normalizeStyle(magnifier.value.style),
4932
- "aria-hidden": "true"
4933
- }, [createElementVNode("div", {
4934
- class: normalizeClass(unref(ns).e("magnifier-text")),
4935
- style: normalizeStyle([magnifier.value.textStyle, { paddingLeft: `${magnifier.value.indent}px` }])
4936
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(magnifier.value.parts, (part, i) => {
4937
- return openBlock(), createElementBlock(Fragment, { key: i }, [part[3] !== void 0 ? (openBlock(), createElementBlock("span", {
4938
- key: 0,
4939
- class: normalizeClass(unref(ns).e("inline")),
4940
- style: normalizeStyle({ width: `${widthOf(magnifier.value.inlines[part[3]])}px` })
4941
- }, [createVNode(unref(render_part_default), { render: magnifier.value.inlines[part[3]].render }, null, 8, ["render"])], 6)) : part[1] ? (openBlock(), createElementBlock("span", {
4942
- key: 1,
4943
- class: normalizeClass(part[1]),
4944
- title: part[2],
4945
- style: normalizeStyle(part[4])
4946
- }, toDisplayString(part[0]), 15, _hoisted_13)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
4947
- }), 128))], 6), createElementVNode("div", {
4948
- class: normalizeClass(unref(ns).e("magnifier-caret")),
4949
- style: normalizeStyle({ left: `${magnifier.value.caret - 1}px` })
4950
- }, null, 6)], 6)) : createCommentVNode("", true),
4951
- menuStyle.value ? (openBlock(), createElementBlock("div", {
4952
- key: 4,
4953
- ref_key: "menuEl",
4954
- ref: menuEl,
4955
- class: normalizeClass(unref(ns).e("menu")),
4956
- role: "toolbar",
4957
- "aria-label": unref(messages).editMenu,
4958
- style: normalizeStyle(menuStyle.value),
4959
- onPointerdown: _cache[17] || (_cache[17] = withModifiers(() => {}, ["stop", "prevent"]))
4960
- }, [(openBlock(true), createElementBlock(Fragment, null, renderList(menuItems.value, (item) => {
4961
- return openBlock(), createElementBlock("button", {
4962
- key: item.key,
4963
- type: "button",
4964
- tabindex: "-1",
4965
- class: normalizeClass(unref(ns).e("menu-button")),
4966
- onClick: ($event) => item.run()
4967
- }, toDisplayString(item.label), 11, _hoisted_15);
4968
- }), 128))], 46, _hoisted_14)) : createCommentVNode("", true)
4969
- ], 6)], 8, ["to", "disabled"])),
4970
- createElementVNode("textarea", {
4971
- ref_key: "input",
4972
- ref: input,
4973
- class: normalizeClass(unref(ns).e("input")),
4974
- style: normalizeStyle({
4975
- top: `${inputBox.value.top}px`,
4976
- left: `${inputBox.value.left}px`,
4977
- height: `${inputBox.value.height}px`
4978
- }),
4979
- "aria-label": __props.ariaLabel,
4980
- "aria-placeholder": __props.placeholder || void 0,
4981
- "aria-autocomplete": hasCompletion.value ? "list" : void 0,
4982
- "aria-controls": completion.value ? completionId : void 0,
4983
- readonly: __props.readonly,
4984
- disabled: __props.disabled,
4985
- wrap: "off",
4986
- autocomplete: "off",
4987
- autocorrect: "off",
4988
- autocapitalize: "off",
4989
- spellcheck: "false",
4990
- enterkeyhint: "enter",
4991
- onKeydown,
4992
- onBeforeinput: onBeforeInput,
4993
- onInput,
4994
- onCompositionstart: onCompositionStart,
4995
- onCompositionend: onCompositionEnd,
4996
- onCopy,
4997
- onCut,
4998
- onPaste,
4999
- onFocus,
5000
- onBlur
5001
- }, null, 46, _hoisted_16),
5275
+ class: normalizeClass(unref(ns).e("menu-button")),
5276
+ onClick: ($event) => item.run()
5277
+ }, toDisplayString(item.label), 11, _hoisted_17);
5278
+ }), 128))], 46, _hoisted_16)) : createCommentVNode("", true)
5279
+ ], 6)], 8, ["to", "disabled"])),
5280
+ createElementVNode("textarea", {
5281
+ ref_key: "input",
5282
+ ref: input,
5283
+ class: normalizeClass(unref(ns).e("input")),
5284
+ style: normalizeStyle({
5285
+ top: `${inputBox.value.top}px`,
5286
+ left: `${inputBox.value.left}px`,
5287
+ height: `${inputBox.value.height}px`
5288
+ }),
5289
+ "aria-label": __props.ariaLabel,
5290
+ "aria-placeholder": __props.placeholder || void 0,
5291
+ "aria-autocomplete": hasCompletion.value ? "list" : void 0,
5292
+ "aria-controls": completion.value ? completionId : void 0,
5293
+ readonly: __props.readonly,
5294
+ disabled: __props.disabled,
5295
+ wrap: "off",
5296
+ autocomplete: "off",
5297
+ autocorrect: "off",
5298
+ autocapitalize: "off",
5299
+ spellcheck: "false",
5300
+ enterkeyhint: "enter",
5301
+ onKeydown,
5302
+ onBeforeinput: onBeforeInput,
5303
+ onInput,
5304
+ onCompositionstart: onCompositionStart,
5305
+ onCompositionend: onCompositionEnd,
5306
+ onCopy,
5307
+ onCut,
5308
+ onPaste,
5309
+ onFocus,
5310
+ onBlur
5311
+ }, null, 46, _hoisted_18)
5312
+ ], 34),
5002
5313
  shownWidgets.value.length ? (openBlock(), createElementBlock("div", {
5003
- key: 3,
5314
+ key: 1,
5004
5315
  class: normalizeClass(unref(ns).e("widgets")),
5005
- onPointerdown: _cache[18] || (_cache[18] = withModifiers(() => {}, ["stop"])),
5006
- onPointermove: _cache[19] || (_cache[19] = withModifiers(() => {}, ["stop"])),
5007
- onMousedown: _cache[20] || (_cache[20] = withModifiers(() => {}, ["stop"]))
5316
+ onPointerdown: _cache[22] || (_cache[22] = withModifiers(() => {}, ["stop"])),
5317
+ onPointermove: _cache[23] || (_cache[23] = withModifiers(() => {}, ["stop"])),
5318
+ onMousedown: _cache[24] || (_cache[24] = withModifiers(() => {}, ["stop"]))
5008
5319
  }, [(openBlock(true), createElementBlock(Fragment, null, renderList(shownWidgets.value, (widget) => {
5009
5320
  return openBlock(), createElementBlock("div", {
5010
5321
  key: widget.key,
5322
+ class: normalizeClass([unref(ns).e("widget-slot"), unref(ns).is("full-width", widget.fullWidth)]),
5323
+ style: normalizeStyle({ top: `${widget.top}px` })
5324
+ }, [createElementVNode("div", {
5011
5325
  ref_for: true,
5012
5326
  ref: (el) => observeWidget(el, widget.key),
5013
- class: normalizeClass(unref(ns).e("widget")),
5327
+ class: normalizeClass([unref(ns).e("widget"), unref(ns).is("full-width", widget.fullWidth)]),
5014
5328
  role: widget.label ? "group" : void 0,
5015
- "aria-label": widget.label,
5016
- style: normalizeStyle({
5017
- transform: `translate(${scrollLeft.value}px, ${widget.top}px)`,
5018
- width: `${Math.max(0, viewWidth.value - gutterWidth.value)}px`
5019
- })
5020
- }, [createVNode(unref(render_part_default), { render: widget.render }, null, 8, ["render"])], 14, _hoisted_17);
5329
+ "aria-label": widget.label
5330
+ }, [createVNode(unref(render_part_default), { render: widget.render }, null, 8, ["render"])], 10, _hoisted_19)], 6);
5021
5331
  }), 128))], 34)) : createCommentVNode("", true)
5022
- ], 34)], 6)], 34), minimapOn.value && minimap.value ? (openBlock(), createElementBlock("div", {
5332
+ ], 6)], 34), minimapOn.value && minimap.value ? (openBlock(), createElementBlock("div", {
5023
5333
  key: 0,
5024
5334
  class: normalizeClass(unref(ns).e("minimap")),
5025
5335
  "aria-hidden": "true",
@@ -5069,7 +5379,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
5069
5379
  onPointerdown: onKeysGripDown,
5070
5380
  onKeydown: onKeysGripKey,
5071
5381
  onMousedown: _cache[25] || (_cache[25] = withModifiers(() => {}, ["prevent"]))
5072
- }, [createVNode(unref(GripVerticalIcon))], 42, _hoisted_18), createVNode(code_keys_default, {
5382
+ }, [createVNode(unref(GripVerticalIcon))], 42, _hoisted_20), createVNode(code_keys_default, {
5073
5383
  editor: keysEditor,
5074
5384
  keys: keysList.value,
5075
5385
  messages: unref(messages)