@dou-ui/code 0.1.0-alpha.0 → 0.1.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/code-diff.js.map +1 -1
- package/dist/code-diff.vue_vue_type_script_setup_true_lang.js +491 -17
- package/dist/code-diff.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-editor.js.map +1 -1
- package/dist/code-editor.vue_vue_type_script_setup_true_lang.js +408 -125
- package/dist/code-editor.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-keys.vue_vue_type_script_setup_true_lang.js +138 -62
- package/dist/code-keys.vue_vue_type_script_setup_true_lang.js.map +1 -1
- package/dist/code-keys2.js.map +1 -1
- package/dist/extension.js +6 -1
- package/dist/extension.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/locale.js +6 -12
- package/dist/locale.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types/code-diff.vue.d.ts +6 -3
- package/dist/types/code-editor.vue.d.ts +1 -0
- package/dist/types/extension.d.ts +44 -4
- package/dist/types/index.d.ts +8 -4
- package/dist/types/locale.d.ts +5 -5
- package/dist/types/types.d.ts +91 -5
- package/dist/types/view/viewport.d.ts +16 -0
- package/dist/types/view/viewport.test.d.ts +1 -0
- package/dist/view/viewport.js +31 -0
- package/dist/view/viewport.js.map +1 -0
- package/package.json +3 -3
|
@@ -13,8 +13,9 @@ import { lineParts, tokenTypes } from "./language/language.js";
|
|
|
13
13
|
import { CodeHighlighter } from "./language/highlighter.js";
|
|
14
14
|
import { SyntaxWorkerClient, holdWorker, ownWorker } from "./language/worker-client.js";
|
|
15
15
|
import { format, useCodeMessages } from "./locale.js";
|
|
16
|
+
import { visibleViewport } from "./view/viewport.js";
|
|
16
17
|
import code_keys_default from "./code-keys2.js";
|
|
17
|
-
import { CODE_EDITOR_KEY } from "./extension.js";
|
|
18
|
+
import { CODE_EDITOR_KEY, WIDGET_HEIGHT_KEY } from "./extension.js";
|
|
18
19
|
import render_part_default from "./render-part.js";
|
|
19
20
|
import { matchCompletion } from "./completion/match.js";
|
|
20
21
|
import { parseSnippet } from "./completion/snippet.js";
|
|
@@ -22,33 +23,38 @@ import { diffText } from "./view/input.js";
|
|
|
22
23
|
import { LineLayout, UNWRAPPED, rowOfCol, updateRows, wrapLine } from "./view/layout.js";
|
|
23
24
|
import { Measure } from "./view/measure.js";
|
|
24
25
|
import { DouFindReplace, DouToggle, DouTooltip, holdPointer, isApplePlatform, isComposing, scrollPositionOf, useLocale, useNamespace, useTeleport, useZIndex } from "dou-ui";
|
|
25
|
-
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";
|
|
26
|
-
import { AlertTriangleIcon, ChevronDownIcon, ChevronRightIcon, FunctionIcon, InfoIcon, LetterCaseIcon, LightbulbIcon, PackageIcon, RegexIcon, SquareCodeIcon, SymbolClassIcon, SymbolConstantIcon, SymbolKeywordIcon, SymbolTypeAliasIcon, TypeIcon, VariableIcon, WholeWordIcon, WrenchIcon, XCircleIcon } from "@dou-ui/icons";
|
|
26
|
+
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
|
+
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";
|
|
27
28
|
// src/code-editor.vue?vue&type=script&setup=true&lang.ts
|
|
28
29
|
var _hoisted_1 = [
|
|
29
30
|
"title",
|
|
30
31
|
"data-gutter-cell",
|
|
31
|
-
"data-line"
|
|
32
|
+
"data-line",
|
|
33
|
+
"onKeydown"
|
|
32
34
|
];
|
|
33
|
-
var _hoisted_2 =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
var
|
|
38
|
-
var
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
var
|
|
35
|
+
var _hoisted_2 = {
|
|
36
|
+
key: 1,
|
|
37
|
+
"aria-hidden": "true"
|
|
38
|
+
};
|
|
39
|
+
var _hoisted_3 = ["data-fold"];
|
|
40
|
+
var _hoisted_4 = ["title"];
|
|
41
|
+
var _hoisted_5 = ["data-unfold", "title"];
|
|
42
|
+
var _hoisted_6 = ["title"];
|
|
43
|
+
var _hoisted_7 = ["data-unfold", "title"];
|
|
44
|
+
var _hoisted_8 = ["aria-label"];
|
|
45
|
+
var _hoisted_9 = ["aria-current", "onClick"];
|
|
46
|
+
var _hoisted_10 = ["aria-label"];
|
|
47
|
+
var _hoisted_11 = [
|
|
42
48
|
"id",
|
|
43
49
|
"aria-selected",
|
|
44
50
|
"onClick"
|
|
45
51
|
];
|
|
46
|
-
var
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
52
|
+
var _hoisted_12 = ["aria-label"];
|
|
53
|
+
var _hoisted_13 = ["onPointerdown"];
|
|
54
|
+
var _hoisted_14 = ["title"];
|
|
55
|
+
var _hoisted_15 = ["aria-label"];
|
|
56
|
+
var _hoisted_16 = ["onClick"];
|
|
57
|
+
var _hoisted_17 = [
|
|
52
58
|
"aria-label",
|
|
53
59
|
"aria-placeholder",
|
|
54
60
|
"aria-autocomplete",
|
|
@@ -56,7 +62,8 @@ var _hoisted_16 = [
|
|
|
56
62
|
"readonly",
|
|
57
63
|
"disabled"
|
|
58
64
|
];
|
|
59
|
-
var
|
|
65
|
+
var _hoisted_18 = ["role", "aria-label"];
|
|
66
|
+
var _hoisted_19 = ["aria-label", "title"];
|
|
60
67
|
var MAX_HEIGHT = 8e6;
|
|
61
68
|
var OVERSCAN = 6;
|
|
62
69
|
/** The textarea mirrors at most this much text around the cursor. */
|
|
@@ -69,6 +76,8 @@ var GAP = 8;
|
|
|
69
76
|
var HANDLE = 24;
|
|
70
77
|
var KEYS_HEIGHT = 44;
|
|
71
78
|
var KEYS_GAP = 8;
|
|
79
|
+
var TABBABLE = "a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]";
|
|
80
|
+
/** Tab out of the bar goes on to what follows the editor; Shift+Tab, or Escape, back into it. */
|
|
72
81
|
var MINI_ROW = 2;
|
|
73
82
|
var MINI_CELL = 1;
|
|
74
83
|
/** The minimap's width, padding included. */
|
|
@@ -92,6 +101,10 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
92
101
|
type: Boolean,
|
|
93
102
|
default: true
|
|
94
103
|
},
|
|
104
|
+
bordered: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: true
|
|
107
|
+
},
|
|
95
108
|
activeLine: {
|
|
96
109
|
type: Boolean,
|
|
97
110
|
default: true
|
|
@@ -542,6 +555,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
542
555
|
});
|
|
543
556
|
/** The widgets' heights as last measured, by key. */
|
|
544
557
|
const widgetHeights = shallowReactive(/* @__PURE__ */ new Map());
|
|
558
|
+
const onWidgetHeight = inject(WIDGET_HEIGHT_KEY, null);
|
|
545
559
|
const widgets = computed(() => {
|
|
546
560
|
const drawn = layout.value;
|
|
547
561
|
const lh = lineHeight.value;
|
|
@@ -665,7 +679,10 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
665
679
|
const id = observedWidgets.get(target);
|
|
666
680
|
if (!id || !target.isConnected) return;
|
|
667
681
|
const height = target.offsetHeight;
|
|
668
|
-
if (height && widgetHeights.get(id) !== height)
|
|
682
|
+
if (height && widgetHeights.get(id) !== height) {
|
|
683
|
+
onWidgetHeight?.(id, height);
|
|
684
|
+
widgetHeights.set(id, height);
|
|
685
|
+
}
|
|
669
686
|
};
|
|
670
687
|
measureNow(el);
|
|
671
688
|
if (typeof ResizeObserver === "undefined") return;
|
|
@@ -790,12 +807,28 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
790
807
|
for (const extension of extensions.value) for (const gutter of extension.gutters ?? []) columns.push({
|
|
791
808
|
name: gutter.name,
|
|
792
809
|
width: gutter.width ?? 16,
|
|
793
|
-
markers: () => gutter.markers(context),
|
|
794
|
-
onPress: gutter.onPress && ((line, event) => gutter.onPress(line, event, context))
|
|
810
|
+
markers: () => withHoverMarker(gutter.markers?.(context) ?? [], gutter.hoverMarker),
|
|
811
|
+
onPress: gutter.onPress && ((line, event) => gutter.onPress(line, event, context)),
|
|
812
|
+
pressOn: gutter.pressOn
|
|
795
813
|
});
|
|
796
814
|
return columns;
|
|
797
815
|
});
|
|
798
816
|
const gutterCells = computed(() => gutterColumns.value.reduce((sum, column) => sum + column.width, 0));
|
|
817
|
+
/** A column's markers, and its `hoverMarker` on the other lines in view. */
|
|
818
|
+
function withHoverMarker(own, hover) {
|
|
819
|
+
if (!hover) return own;
|
|
820
|
+
const taken = new Set(own.map((marker) => marker.line));
|
|
821
|
+
const out = [...own];
|
|
822
|
+
for (let line = visibleFrom.value; line <= visibleTo.value; line++) if (!taken.has(line)) out.push({
|
|
823
|
+
icon: hover.icon,
|
|
824
|
+
text: hover.text,
|
|
825
|
+
class: hover.class,
|
|
826
|
+
title: typeof hover.title === "function" ? hover.title(line) : hover.title,
|
|
827
|
+
line,
|
|
828
|
+
visible: "hover"
|
|
829
|
+
});
|
|
830
|
+
return out;
|
|
831
|
+
}
|
|
799
832
|
/** The worst problem on each line in view, as a marker. */
|
|
800
833
|
function problemMarkers() {
|
|
801
834
|
const text = doc.value;
|
|
@@ -819,9 +852,40 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
819
852
|
}));
|
|
820
853
|
}
|
|
821
854
|
/** The markers of each column, by line, for the lines in view. */
|
|
855
|
+
/** The line the mouse is over in the text, so the gutter can show markers waiting for it. */
|
|
856
|
+
const hoveredLine = ref(null);
|
|
857
|
+
function lineAtY(y) {
|
|
858
|
+
const rect = content.value?.getBoundingClientRect();
|
|
859
|
+
if (!rect) return null;
|
|
860
|
+
return doc.value.lineAt(posAtCoords({
|
|
861
|
+
x: rect.left + 1,
|
|
862
|
+
y
|
|
863
|
+
})).number;
|
|
864
|
+
}
|
|
865
|
+
/** A marker in a pressable column is a button: Enter or Space presses it. */
|
|
866
|
+
function onCellKeydown(event, column, line) {
|
|
867
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
868
|
+
const press = gutterColumns.value[column]?.onPress;
|
|
869
|
+
if (!press || props.disabled) return;
|
|
870
|
+
event.preventDefault();
|
|
871
|
+
const cell = event.currentTarget;
|
|
872
|
+
press(line, event);
|
|
873
|
+
nextTick(() => {
|
|
874
|
+
const where = document.activeElement;
|
|
875
|
+
if ((!cell.isConnected || cell.getAttribute("role") !== "button") && (!where || where === document.body || where === cell)) focusInput();
|
|
876
|
+
});
|
|
877
|
+
}
|
|
878
|
+
/** Columns already warned about markers without a name, while developing. */
|
|
879
|
+
const unnamed = /* @__PURE__ */ new Set();
|
|
822
880
|
const gutterMarkers = computed(() => gutterColumns.value.map((column) => {
|
|
823
881
|
const byLine = /* @__PURE__ */ new Map();
|
|
824
|
-
for (const marker of column.markers())
|
|
882
|
+
for (const marker of column.markers()) {
|
|
883
|
+
byLine.set(marker.line, marker);
|
|
884
|
+
if (process.env.NODE_ENV !== "production" && column.onPress && !marker.title) {
|
|
885
|
+
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.`);
|
|
886
|
+
unnamed.add(column.name);
|
|
887
|
+
}
|
|
888
|
+
}
|
|
825
889
|
return byLine;
|
|
826
890
|
}));
|
|
827
891
|
const gutterWidth = computed(() => {
|
|
@@ -2058,6 +2122,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2058
2122
|
* the mouse events a browser makes up after it would only close it again.
|
|
2059
2123
|
*/
|
|
2060
2124
|
function onContentHover(event) {
|
|
2125
|
+
if (event.pointerType === "mouse") hoveredLine.value = lineAtY(event.clientY);
|
|
2061
2126
|
if (event.pointerType !== "mouse" || drag || problemBox.value?.keyboard) return;
|
|
2062
2127
|
if (!content.value?.getBoundingClientRect()) return;
|
|
2063
2128
|
const point = {
|
|
@@ -2081,6 +2146,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2081
2146
|
clearTimeout(problemTimer);
|
|
2082
2147
|
}
|
|
2083
2148
|
function onContentLeave(event) {
|
|
2149
|
+
hoveredLine.value = null;
|
|
2084
2150
|
if (event.pointerType !== "mouse" || problemBox.value?.keyboard) return;
|
|
2085
2151
|
clearTimeout(problemTimer);
|
|
2086
2152
|
problemTimer = window.setTimeout(closeProblems, 250);
|
|
@@ -2590,9 +2656,13 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2590
2656
|
}
|
|
2591
2657
|
bumpViewport();
|
|
2592
2658
|
}
|
|
2593
|
-
|
|
2659
|
+
/** Whether the focus is on the bar of keys itself, reached by Escape then Tab: the bar stays while it is. */
|
|
2660
|
+
const keysFocused = ref(false);
|
|
2661
|
+
/** The bar of keys, on a touch screen while the editor takes input, or while the focus is on it. */
|
|
2662
|
+
const showKeys = computed(() => !!props.keys && coarse.value && (focused.value || keysFocused.value) && !props.readonly && !props.disabled);
|
|
2663
|
+
const floatingOpen = computed(() => !!(problemBox.value || completion.value || signature.value) || touchUi.value && focused.value || showKeys.value);
|
|
2594
2664
|
watch(floatingOpen, (open, _old, onCleanup) => {
|
|
2595
|
-
if (!open ||
|
|
2665
|
+
if (!open || typeof window === "undefined") return;
|
|
2596
2666
|
floatingZ.value = nextZIndex();
|
|
2597
2667
|
readFrameFont();
|
|
2598
2668
|
readAnchorMode();
|
|
@@ -2648,16 +2718,12 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
2648
2718
|
*/
|
|
2649
2719
|
function pageBox() {
|
|
2650
2720
|
viewportTick.value;
|
|
2651
|
-
const
|
|
2652
|
-
const left = vv ? vv.offsetLeft : 0;
|
|
2653
|
-
const top = vv ? vv.offsetTop : 0;
|
|
2654
|
-
const width = vv ? vv.width : document.documentElement.clientWidth;
|
|
2655
|
-
const height = vv ? vv.height : document.documentElement.clientHeight;
|
|
2721
|
+
const { left, top, width, height } = visibleViewport();
|
|
2656
2722
|
return {
|
|
2657
2723
|
left,
|
|
2658
2724
|
top,
|
|
2659
2725
|
right: left + width,
|
|
2660
|
-
bottom: top + height
|
|
2726
|
+
bottom: top + height
|
|
2661
2727
|
};
|
|
2662
2728
|
}
|
|
2663
2729
|
/** After each change: opens, updates or closes the completion list and the parameter hints, and moves the snippet's places. */
|
|
@@ -3022,6 +3088,12 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3022
3088
|
], apple));
|
|
3023
3089
|
/** After Escape, Tab leaves the editor instead of indenting, so keyboard users are never stuck. */
|
|
3024
3090
|
let tabLeaves = false;
|
|
3091
|
+
const MODIFIERS = /* @__PURE__ */ new Set([
|
|
3092
|
+
"Shift",
|
|
3093
|
+
"Control",
|
|
3094
|
+
"Alt",
|
|
3095
|
+
"Meta"
|
|
3096
|
+
]);
|
|
3025
3097
|
/** When Enter last confirmed a composition; some browsers also put a line break into the textarea for it, right after. */
|
|
3026
3098
|
let confirmEnter = -Infinity;
|
|
3027
3099
|
function onKeydown(event) {
|
|
@@ -3049,8 +3121,15 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3049
3121
|
return;
|
|
3050
3122
|
}
|
|
3051
3123
|
const leaving = tabLeaves && (name === "tab" || name === "shift+tab");
|
|
3052
|
-
tabLeaves = name === "escape";
|
|
3053
|
-
if (leaving)
|
|
3124
|
+
if (!MODIFIERS.has(event.key)) tabLeaves = name === "escape";
|
|
3125
|
+
if (leaving) {
|
|
3126
|
+
const first = name === "tab" && !shownWidgets.value.length ? keysEl.value?.querySelector("button") : null;
|
|
3127
|
+
if (first) {
|
|
3128
|
+
event.preventDefault();
|
|
3129
|
+
first.focus();
|
|
3130
|
+
}
|
|
3131
|
+
return;
|
|
3132
|
+
}
|
|
3054
3133
|
for (const command of keymap.value.get(name) ?? []) if (command(target)) {
|
|
3055
3134
|
event.preventDefault();
|
|
3056
3135
|
event.stopPropagation();
|
|
@@ -3276,6 +3355,27 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3276
3355
|
}
|
|
3277
3356
|
/** A tap that may turn into a scroll or a long press; touches only act once they end in place. */
|
|
3278
3357
|
let touch = null;
|
|
3358
|
+
/** A finger or pen on a pressable gutter cell, which presses if it lifts in place. */
|
|
3359
|
+
let cellTap = null;
|
|
3360
|
+
/**
|
|
3361
|
+
* A tap on a gutter cell lifted in place. A marker still out of sight (shown
|
|
3362
|
+
* on hover, which a finger can't do) isn't pressed yet: the cursor moves to
|
|
3363
|
+
* its line, which shows it, and the next tap presses it.
|
|
3364
|
+
*/
|
|
3365
|
+
function endCellTap(event) {
|
|
3366
|
+
const tap = cellTap;
|
|
3367
|
+
cellTap = null;
|
|
3368
|
+
if (!tap) return;
|
|
3369
|
+
const column = gutterColumns.value[tap.column];
|
|
3370
|
+
if (!column?.onPress || props.disabled) return;
|
|
3371
|
+
if ((gutterMarkers.value[tap.column]?.get(tap.line))?.visible === "hover" && !(focused.value && activeLineNumber.value === tap.line)) {
|
|
3372
|
+
touchUi.value = true;
|
|
3373
|
+
select("char", doc.value.line(tap.line).from, false);
|
|
3374
|
+
focusInput();
|
|
3375
|
+
return;
|
|
3376
|
+
}
|
|
3377
|
+
column.onPress(tap.line, event);
|
|
3378
|
+
}
|
|
3279
3379
|
/** The fold toggle or folded marker under a pointer, as the line it belongs to. */
|
|
3280
3380
|
function foldTarget(event) {
|
|
3281
3381
|
const el = event.target?.closest?.("[data-fold], [data-unfold]");
|
|
@@ -3292,11 +3392,24 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3292
3392
|
function onPointerDown(event, area) {
|
|
3293
3393
|
if (event.button !== 0 || props.disabled) return;
|
|
3294
3394
|
const cell = event.target?.closest?.("[data-gutter-cell]");
|
|
3295
|
-
const
|
|
3395
|
+
const c = Number(cell?.getAttribute("data-gutter-cell"));
|
|
3396
|
+
const column = cell && gutterColumns.value[c];
|
|
3296
3397
|
if (column?.onPress) {
|
|
3297
3398
|
event.preventDefault();
|
|
3298
3399
|
event.stopPropagation();
|
|
3299
|
-
|
|
3400
|
+
const line = Number(cell.getAttribute("data-line"));
|
|
3401
|
+
if (event.pointerType === "touch" || event.pointerType === "pen") {
|
|
3402
|
+
onPointerCancel();
|
|
3403
|
+
cellTap = {
|
|
3404
|
+
x: event.clientX,
|
|
3405
|
+
y: event.clientY,
|
|
3406
|
+
pointer: event.pointerId,
|
|
3407
|
+
column: c,
|
|
3408
|
+
line
|
|
3409
|
+
};
|
|
3410
|
+
return;
|
|
3411
|
+
}
|
|
3412
|
+
column.onPress(line, event);
|
|
3300
3413
|
return;
|
|
3301
3414
|
}
|
|
3302
3415
|
const fold = foldTarget(event);
|
|
@@ -3389,10 +3502,15 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3389
3502
|
return count;
|
|
3390
3503
|
}
|
|
3391
3504
|
function onPointerMove(event) {
|
|
3505
|
+
if (cellTap && event.pointerId === cellTap.pointer) {
|
|
3506
|
+
if (Math.hypot(event.clientX - cellTap.x, event.clientY - cellTap.y) > 8) cellTap = null;
|
|
3507
|
+
return;
|
|
3508
|
+
}
|
|
3392
3509
|
if (!touch || event.pointerId !== touch.pointer) return;
|
|
3393
3510
|
if (Math.hypot(event.clientX - touch.x, event.clientY - touch.y) > 8) onPointerCancel();
|
|
3394
3511
|
}
|
|
3395
3512
|
function onPointerUp(event, area) {
|
|
3513
|
+
if (cellTap && event.pointerId === cellTap.pointer) return endCellTap(event);
|
|
3396
3514
|
if (!touch || event.pointerId !== touch.pointer) return;
|
|
3397
3515
|
onPointerCancel();
|
|
3398
3516
|
const iconLine = area === "gutter" ? problemIconLine(event) : null;
|
|
@@ -3413,6 +3531,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3413
3531
|
focusInput();
|
|
3414
3532
|
}
|
|
3415
3533
|
function onPointerCancel() {
|
|
3534
|
+
cellTap = null;
|
|
3416
3535
|
if (touch) {
|
|
3417
3536
|
clearTimeout(touch.timer);
|
|
3418
3537
|
touch.hold.release();
|
|
@@ -3735,7 +3854,6 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3735
3854
|
caret
|
|
3736
3855
|
};
|
|
3737
3856
|
});
|
|
3738
|
-
const showKeys = computed(() => !!props.keys && coarse.value && focused.value && !props.readonly && !props.disabled);
|
|
3739
3857
|
const keysList = computed(() => Array.isArray(props.keys) ? props.keys : void 0);
|
|
3740
3858
|
const keysEditor = { run };
|
|
3741
3859
|
const { next: nextZIndex } = useZIndex();
|
|
@@ -3744,41 +3862,189 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3744
3862
|
if (shown) keysZIndex.value = nextZIndex();
|
|
3745
3863
|
});
|
|
3746
3864
|
/**
|
|
3747
|
-
* The bar of keys
|
|
3748
|
-
*
|
|
3749
|
-
*
|
|
3865
|
+
* The bar of keys sits in the page below the editor, and scrolls with it:
|
|
3866
|
+
* it never follows the keyboard, whose bars and panels each browser draws
|
|
3867
|
+
* its own way. A finger moves it anywhere by its grip, and it keeps that
|
|
3868
|
+
* place by the editor while the editor is in use.
|
|
3750
3869
|
*/
|
|
3751
|
-
const
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3870
|
+
const keysEl = ref();
|
|
3871
|
+
/** Where the bar is, from the editor's top left corner; `null` until it first shows. */
|
|
3872
|
+
const keysAt = ref(null);
|
|
3873
|
+
/** Whether a finger or a key moved the bar: then it stays put, even as the keyboard comes up. */
|
|
3874
|
+
let keysMoved = false;
|
|
3875
|
+
const keysShift = ref({
|
|
3876
|
+
x: 0,
|
|
3877
|
+
y: 0
|
|
3757
3878
|
});
|
|
3758
|
-
function
|
|
3759
|
-
const
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
left: 0,
|
|
3768
|
-
width: window.innerWidth,
|
|
3769
|
-
height: window.innerHeight
|
|
3879
|
+
function readKeysShift() {
|
|
3880
|
+
const el = keysEl.value;
|
|
3881
|
+
if (!el) return;
|
|
3882
|
+
const rect = el.getBoundingClientRect();
|
|
3883
|
+
const at = keysClient.value;
|
|
3884
|
+
if (!at) return;
|
|
3885
|
+
keysShift.value = {
|
|
3886
|
+
x: keysShift.value.x + at.x - rect.left,
|
|
3887
|
+
y: keysShift.value.y + at.y - rect.top
|
|
3770
3888
|
};
|
|
3771
3889
|
}
|
|
3890
|
+
/** The editor's box in the window, as of the last scroll. */
|
|
3891
|
+
function rootInPage() {
|
|
3892
|
+
viewportTick.value;
|
|
3893
|
+
return root.value?.getBoundingClientRect() ?? null;
|
|
3894
|
+
}
|
|
3895
|
+
/** The bar's width: the editor's, within the window. */
|
|
3896
|
+
const keysWidth = computed(() => {
|
|
3897
|
+
const rect = rootInPage();
|
|
3898
|
+
if (!rect) return 0;
|
|
3899
|
+
return Math.max(0, Math.min(rect.width, visibleViewport().width - 16));
|
|
3900
|
+
});
|
|
3901
|
+
/** Keeps the bar within the part of the page in view. */
|
|
3902
|
+
function clampKeys(at) {
|
|
3903
|
+
const rect = rootInPage();
|
|
3904
|
+
if (!rect) return at;
|
|
3905
|
+
const view = visibleViewport();
|
|
3906
|
+
const x = rect.left + at.x;
|
|
3907
|
+
const y = rect.top + at.y;
|
|
3908
|
+
const left = Math.max(view.left + KEYS_GAP, Math.min(x, view.left + view.width - keysWidth.value - KEYS_GAP));
|
|
3909
|
+
const top = Math.max(view.top + KEYS_GAP, Math.min(y, view.top + view.height - KEYS_HEIGHT - KEYS_GAP));
|
|
3910
|
+
return {
|
|
3911
|
+
x: left - rect.left,
|
|
3912
|
+
y: top - rect.top
|
|
3913
|
+
};
|
|
3914
|
+
}
|
|
3915
|
+
/** Below the editor, a gap apart, or as low as the page in view goes. */
|
|
3916
|
+
function placeKeys() {
|
|
3917
|
+
const rect = rootInPage();
|
|
3918
|
+
if (!rect) return;
|
|
3919
|
+
keysAt.value = clampKeys({
|
|
3920
|
+
x: 0,
|
|
3921
|
+
y: rect.height + KEYS_GAP
|
|
3922
|
+
});
|
|
3923
|
+
}
|
|
3924
|
+
const keysClient = computed(() => {
|
|
3925
|
+
const rect = rootInPage();
|
|
3926
|
+
const at = keysAt.value;
|
|
3927
|
+
return rect && at ? {
|
|
3928
|
+
x: rect.left + at.x,
|
|
3929
|
+
y: rect.top + at.y
|
|
3930
|
+
} : null;
|
|
3931
|
+
});
|
|
3772
3932
|
const keysStyle = computed(() => {
|
|
3773
|
-
const
|
|
3933
|
+
const at = keysClient.value;
|
|
3934
|
+
if (!at) return {
|
|
3935
|
+
visibility: "hidden",
|
|
3936
|
+
zIndex: keysZIndex.value
|
|
3937
|
+
};
|
|
3774
3938
|
return {
|
|
3775
|
-
transform: `translate(${
|
|
3776
|
-
width: `${
|
|
3939
|
+
transform: `translate(${at.x + keysShift.value.x}px, ${at.y + keysShift.value.y}px)`,
|
|
3940
|
+
width: `${keysWidth.value}px`,
|
|
3777
3941
|
zIndex: keysZIndex.value
|
|
3778
3942
|
};
|
|
3779
3943
|
});
|
|
3944
|
+
watch(showKeys, (shown) => {
|
|
3945
|
+
if (!shown) keysFocused.value = false;
|
|
3946
|
+
else if (typeof window !== "undefined") settleKeys();
|
|
3947
|
+
});
|
|
3948
|
+
/**
|
|
3949
|
+
* Brings the bar into the page in view: not moved yet, to its place below
|
|
3950
|
+
* the editor; moved, only as far as it takes to be seen again.
|
|
3951
|
+
*/
|
|
3952
|
+
function settleKeys() {
|
|
3953
|
+
if (!showKeys.value) return;
|
|
3954
|
+
if (keysMoved && keysAt.value) keysAt.value = clampKeys(keysAt.value);
|
|
3955
|
+
else placeKeys();
|
|
3956
|
+
}
|
|
3957
|
+
/** How much of the bottom of the page in view the bar takes, when it sits there. */
|
|
3958
|
+
function keysRoom() {
|
|
3959
|
+
const rect = showKeys.value && keysAt.value ? root.value?.getBoundingClientRect() : null;
|
|
3960
|
+
if (!rect || !keysAt.value) return 0;
|
|
3961
|
+
const view = visibleViewport();
|
|
3962
|
+
const bottom = view.top + view.height;
|
|
3963
|
+
const top = rect.top + keysAt.value.y;
|
|
3964
|
+
return top + KEYS_HEIGHT >= bottom - KEYS_GAP - 1 ? bottom - top + KEYS_GAP : 0;
|
|
3965
|
+
}
|
|
3966
|
+
function onKeysKeydown(event) {
|
|
3967
|
+
const bar = keysEl.value;
|
|
3968
|
+
if (!bar) return;
|
|
3969
|
+
if (event.key === "Escape") {
|
|
3970
|
+
event.preventDefault();
|
|
3971
|
+
input.value?.focus();
|
|
3972
|
+
return;
|
|
3973
|
+
}
|
|
3974
|
+
if (event.key !== "Tab") return;
|
|
3975
|
+
const inside = [...bar.querySelectorAll(TABBABLE)].filter((el) => el.tabIndex >= 0);
|
|
3976
|
+
const here = inside.indexOf(document.activeElement);
|
|
3977
|
+
if (event.shiftKey && here <= 0) {
|
|
3978
|
+
event.preventDefault();
|
|
3979
|
+
input.value?.focus();
|
|
3980
|
+
} else if (!event.shiftKey && here === inside.length - 1) {
|
|
3981
|
+
event.preventDefault();
|
|
3982
|
+
const from = document.activeElement;
|
|
3983
|
+
for (const el of document.querySelectorAll(TABBABLE)) {
|
|
3984
|
+
if (el.tabIndex < 0 || bar.contains(el) || !root.value || root.value.contains(el) || !(root.value.compareDocumentPosition(el) & Node.DOCUMENT_POSITION_FOLLOWING)) continue;
|
|
3985
|
+
el.focus();
|
|
3986
|
+
if (document.activeElement === el) return;
|
|
3987
|
+
}
|
|
3988
|
+
from?.blur();
|
|
3989
|
+
}
|
|
3990
|
+
}
|
|
3991
|
+
function onKeysFocusOut(event) {
|
|
3992
|
+
if (!keysEl.value?.contains(event.relatedTarget)) keysFocused.value = false;
|
|
3993
|
+
}
|
|
3994
|
+
watch([showKeys, viewportTick], () => readKeysShift(), { flush: "post" });
|
|
3995
|
+
/** A finger on the bar's grip: where it went down, and where the bar was then. */
|
|
3996
|
+
let keysDrag = null;
|
|
3997
|
+
function onKeysGripDown(event) {
|
|
3998
|
+
if (event.button !== 0 || !keysAt.value) return;
|
|
3999
|
+
event.preventDefault();
|
|
4000
|
+
const hold = holdPointer(event, keysEl.value, endKeysDrag);
|
|
4001
|
+
hold.grab();
|
|
4002
|
+
keysDrag = {
|
|
4003
|
+
pointer: event.pointerId,
|
|
4004
|
+
x: event.clientX,
|
|
4005
|
+
y: event.clientY,
|
|
4006
|
+
from: keysAt.value,
|
|
4007
|
+
hold
|
|
4008
|
+
};
|
|
4009
|
+
window.addEventListener("pointermove", onKeysGripMove);
|
|
4010
|
+
window.addEventListener("pointerup", endKeysDrag);
|
|
4011
|
+
window.addEventListener("pointercancel", endKeysDrag);
|
|
4012
|
+
}
|
|
4013
|
+
function onKeysGripMove(event) {
|
|
4014
|
+
const press = keysDrag;
|
|
4015
|
+
if (!press || event.pointerId !== press.pointer) return;
|
|
4016
|
+
keysMoved = true;
|
|
4017
|
+
keysAt.value = clampKeys({
|
|
4018
|
+
x: press.from.x + event.clientX - press.x,
|
|
4019
|
+
y: press.from.y + event.clientY - press.y
|
|
4020
|
+
});
|
|
4021
|
+
}
|
|
4022
|
+
function endKeysDrag() {
|
|
4023
|
+
keysDrag?.hold.release();
|
|
4024
|
+
keysDrag = null;
|
|
4025
|
+
window.removeEventListener("pointermove", onKeysGripMove);
|
|
4026
|
+
window.removeEventListener("pointerup", endKeysDrag);
|
|
4027
|
+
window.removeEventListener("pointercancel", endKeysDrag);
|
|
4028
|
+
}
|
|
4029
|
+
/** The grip moves by the arrow keys too, a step at a time. */
|
|
4030
|
+
function onKeysGripKey(event) {
|
|
4031
|
+
const step = {
|
|
4032
|
+
ArrowUp: [0, -1],
|
|
4033
|
+
ArrowDown: [0, 1],
|
|
4034
|
+
ArrowLeft: [-1, 0],
|
|
4035
|
+
ArrowRight: [1, 0]
|
|
4036
|
+
}[event.key];
|
|
4037
|
+
if (!step || !keysAt.value) return;
|
|
4038
|
+
event.preventDefault();
|
|
4039
|
+
keysMoved = true;
|
|
4040
|
+
const by = event.shiftKey ? 40 : 8;
|
|
4041
|
+
keysAt.value = clampKeys({
|
|
4042
|
+
x: keysAt.value.x + step[0] * by,
|
|
4043
|
+
y: keysAt.value.y + step[1] * by
|
|
4044
|
+
});
|
|
4045
|
+
}
|
|
3780
4046
|
/**
|
|
3781
|
-
* Keeps the main cursor clear of the phone's keyboard
|
|
4047
|
+
* Keeps the main cursor clear of the phone's keyboard:
|
|
3782
4048
|
* scrolls the editor when the cursor can move inside it, else the page.
|
|
3783
4049
|
*/
|
|
3784
4050
|
function followViewport() {
|
|
@@ -3790,8 +4056,11 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3790
4056
|
const lh = lineHeight.value;
|
|
3791
4057
|
const room = lh / 2 + (handles.value.length ? HANDLE : 0);
|
|
3792
4058
|
const rect = el.getBoundingClientRect();
|
|
3793
|
-
const
|
|
3794
|
-
const
|
|
4059
|
+
const view = visibleViewport();
|
|
4060
|
+
const covered = keysRoom();
|
|
4061
|
+
const bottom = view.top + view.height - covered;
|
|
4062
|
+
const visibleTop = Math.max(rect.top, view.top);
|
|
4063
|
+
const visibleBottom = Math.min(rect.bottom, bottom);
|
|
3795
4064
|
if (at.bottom + room > visibleBottom && visibleBottom - visibleTop >= lh * 3) {
|
|
3796
4065
|
el.scrollTop += (at.bottom + room - visibleBottom) / ratio.value;
|
|
3797
4066
|
onScroll();
|
|
@@ -3800,12 +4069,13 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3800
4069
|
onScroll();
|
|
3801
4070
|
}
|
|
3802
4071
|
const after = coordsAtPos(mainRange(state.value.selection).head);
|
|
3803
|
-
if (!after) return;
|
|
3804
|
-
const
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
|
|
4072
|
+
if (!after || after.bottom + room <= bottom) return;
|
|
4073
|
+
const before = window.scrollY;
|
|
4074
|
+
window.scrollBy(0, after.bottom + room - bottom);
|
|
4075
|
+
if (covered && keysAt.value) keysAt.value = {
|
|
4076
|
+
x: keysAt.value.x,
|
|
4077
|
+
y: keysAt.value.y + window.scrollY - before
|
|
4078
|
+
};
|
|
3809
4079
|
}
|
|
3810
4080
|
/** How much of the window the keyboard took when last seen. */
|
|
3811
4081
|
let keyboardHeight = 0;
|
|
@@ -3820,18 +4090,14 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3820
4090
|
* cursor then would fight the finger.
|
|
3821
4091
|
*/
|
|
3822
4092
|
function onViewportChange() {
|
|
3823
|
-
readViewport();
|
|
3824
4093
|
const now = readKeyboard();
|
|
3825
4094
|
const grew = now > keyboardHeight + 1;
|
|
3826
4095
|
keyboardHeight = now;
|
|
3827
|
-
if (grew
|
|
4096
|
+
if (!grew || fingerScrolling) return;
|
|
4097
|
+
settleKeys();
|
|
4098
|
+
followViewport();
|
|
3828
4099
|
}
|
|
3829
4100
|
/**
|
|
3830
|
-
* While the page scrolls, the bar of keys fades out: the browser moves the
|
|
3831
|
-
* page faster than the bar can follow the keyboard, and it would shake.
|
|
3832
|
-
*/
|
|
3833
|
-
const pageScrolling = ref(false);
|
|
3834
|
-
/**
|
|
3835
4101
|
* A finger scrolls the page, by dragging or by the glide after it: the view
|
|
3836
4102
|
* resizing meanwhile is the browser's bars, never a reason to scroll back.
|
|
3837
4103
|
* The browser scrolling to the cursor on its own, as a tap brings the
|
|
@@ -3839,20 +4105,12 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3839
4105
|
*/
|
|
3840
4106
|
let fingerScrolling = false;
|
|
3841
4107
|
let pageScrollTimer = 0;
|
|
3842
|
-
/** Until when a page scroll is the editor's own, keeping the cursor in view, which leaves the bar be. */
|
|
3843
|
-
let ownScrollUntil = 0;
|
|
3844
4108
|
function settleLater() {
|
|
3845
4109
|
clearTimeout(pageScrollTimer);
|
|
3846
|
-
pageScrollTimer = window.setTimeout(() =>
|
|
3847
|
-
readViewport();
|
|
3848
|
-
pageScrolling.value = false;
|
|
3849
|
-
fingerScrolling = false;
|
|
3850
|
-
}, 160);
|
|
4110
|
+
pageScrollTimer = window.setTimeout(() => fingerScrolling = false, 160);
|
|
3851
4111
|
}
|
|
3852
4112
|
function onPageScroll() {
|
|
3853
|
-
if (
|
|
3854
|
-
pageScrolling.value = true;
|
|
3855
|
-
settleLater();
|
|
4113
|
+
if (fingerScrolling) settleLater();
|
|
3856
4114
|
}
|
|
3857
4115
|
function onFingerMove() {
|
|
3858
4116
|
fingerScrolling = true;
|
|
@@ -3862,24 +4120,17 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
3862
4120
|
const following = computed(() => coarse.value && focused.value);
|
|
3863
4121
|
function unfollow() {
|
|
3864
4122
|
if (typeof window === "undefined") return;
|
|
3865
|
-
|
|
3866
|
-
vv?.removeEventListener("resize", onViewportChange);
|
|
3867
|
-
vv?.removeEventListener("scroll", readViewport);
|
|
3868
|
-
vv?.removeEventListener("scroll", onPageScroll);
|
|
4123
|
+
window.visualViewport?.removeEventListener("resize", onViewportChange);
|
|
3869
4124
|
window.removeEventListener("scroll", onPageScroll);
|
|
3870
4125
|
window.removeEventListener("touchmove", onFingerMove);
|
|
3871
4126
|
clearTimeout(pageScrollTimer);
|
|
3872
|
-
pageScrolling.value = false;
|
|
3873
4127
|
fingerScrolling = false;
|
|
3874
4128
|
}
|
|
3875
4129
|
watch(following, (on) => {
|
|
3876
4130
|
const vv = window.visualViewport;
|
|
3877
4131
|
if (on) {
|
|
3878
|
-
readViewport();
|
|
3879
4132
|
keyboardHeight = readKeyboard();
|
|
3880
4133
|
vv?.addEventListener("resize", onViewportChange);
|
|
3881
|
-
vv?.addEventListener("scroll", readViewport);
|
|
3882
|
-
vv?.addEventListener("scroll", onPageScroll, { passive: true });
|
|
3883
4134
|
window.addEventListener("scroll", onPageScroll, { passive: true });
|
|
3884
4135
|
window.addEventListener("touchmove", onFingerMove, { passive: true });
|
|
3885
4136
|
} else unfollow();
|
|
@@ -4307,6 +4558,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4307
4558
|
};
|
|
4308
4559
|
context = api;
|
|
4309
4560
|
provide(CODE_EDITOR_KEY, api);
|
|
4561
|
+
provide(WIDGET_HEIGHT_KEY, null);
|
|
4310
4562
|
__expose(api);
|
|
4311
4563
|
return (_ctx, _cache) => {
|
|
4312
4564
|
return openBlock(), createElementBlock("div", {
|
|
@@ -4318,7 +4570,8 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4318
4570
|
unref(ns).is("readonly", !!__props.readonly),
|
|
4319
4571
|
unref(ns).is("disabled", !!__props.disabled),
|
|
4320
4572
|
unref(ns).is("foldable", __props.foldable),
|
|
4321
|
-
unref(ns).is("wrap", __props.wrap)
|
|
4573
|
+
unref(ns).is("wrap", __props.wrap),
|
|
4574
|
+
unref(ns).is("bordered", __props.bordered)
|
|
4322
4575
|
]),
|
|
4323
4576
|
style: normalizeStyle({
|
|
4324
4577
|
"--dou-code-editor-gutter": `${gutterWidth.value}px`,
|
|
@@ -4443,7 +4696,6 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4443
4696
|
}, [__props.gutter && (__props.lineNumbers || __props.foldable || gutterCells.value) ? (openBlock(), createElementBlock("div", {
|
|
4444
4697
|
key: 0,
|
|
4445
4698
|
class: normalizeClass(unref(ns).e("gutter")),
|
|
4446
|
-
"aria-hidden": "true",
|
|
4447
4699
|
onPointerdown: _cache[5] || (_cache[5] = ($event) => onPointerDown($event, "gutter")),
|
|
4448
4700
|
onPointermove: onPointerMove,
|
|
4449
4701
|
onPointerup: _cache[6] || (_cache[6] = ($event) => onPointerUp($event, "gutter")),
|
|
@@ -4457,7 +4709,11 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4457
4709
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(rows.value, (row) => {
|
|
4458
4710
|
return openBlock(), createElementBlock("div", {
|
|
4459
4711
|
key: row.n,
|
|
4460
|
-
class: normalizeClass([
|
|
4712
|
+
class: normalizeClass([
|
|
4713
|
+
unref(ns).e("number"),
|
|
4714
|
+
unref(ns).is("active", row.n === activeLineNumber.value),
|
|
4715
|
+
unref(ns).is("hovered", row.n === hoveredLine.value)
|
|
4716
|
+
]),
|
|
4461
4717
|
style: normalizeStyle({
|
|
4462
4718
|
height: row.wrapped.breaks.length ? `${(row.wrapped.breaks.length + 1) * lineHeight.value}px` : void 0,
|
|
4463
4719
|
marginTop: gapBefore(row.n) ? `${gapBefore(row.n)}px` : void 0
|
|
@@ -4467,21 +4723,30 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4467
4723
|
key: 0,
|
|
4468
4724
|
class: normalizeClass(unref(ns).e("cells"))
|
|
4469
4725
|
}, [(openBlock(true), createElementBlock(Fragment, null, renderList(gutterColumns.value, (column, c) => {
|
|
4470
|
-
return openBlock(), createElementBlock("span", {
|
|
4726
|
+
return openBlock(), createElementBlock("span", mergeProps({
|
|
4471
4727
|
key: column.name,
|
|
4472
|
-
class:
|
|
4473
|
-
|
|
4728
|
+
class: [
|
|
4729
|
+
unref(ns).e("cell"),
|
|
4730
|
+
unref(ns).is("on-hover", gutterMarkers.value[c]?.get(row.n)?.visible === "hover"),
|
|
4731
|
+
gutterMarkers.value[c]?.get(row.n)?.class
|
|
4732
|
+
],
|
|
4733
|
+
style: { width: `${column.width}px` },
|
|
4474
4734
|
title: gutterMarkers.value[c]?.get(row.n)?.title,
|
|
4475
|
-
"data-gutter-cell": column.onPress ? c : void 0,
|
|
4735
|
+
"data-gutter-cell": column.onPress && (column.pressOn !== "markers" || gutterMarkers.value[c]?.has(row.n)) ? c : void 0,
|
|
4476
4736
|
"data-line": row.n
|
|
4477
|
-
},
|
|
4737
|
+
}, { ref_for: true }, column.onPress && gutterMarkers.value[c]?.get(row.n) && !__props.disabled ? {
|
|
4738
|
+
role: "button",
|
|
4739
|
+
tabindex: row.n === activeLineNumber.value ? 0 : -1,
|
|
4740
|
+
"aria-label": gutterMarkers.value[c].get(row.n).title
|
|
4741
|
+
} : { "aria-hidden": "true" }, { onKeydown: ($event) => onCellKeydown($event, c, row.n) }), [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)], 16, _hoisted_1);
|
|
4478
4742
|
}), 128))], 2)) : createCommentVNode("", true),
|
|
4479
|
-
__props.lineNumbers ? (openBlock(), createElementBlock(
|
|
4743
|
+
__props.lineNumbers ? (openBlock(), createElementBlock("span", _hoisted_2, toDisplayString(row.n), 1)) : createCommentVNode("", true),
|
|
4480
4744
|
__props.foldable && (row.folded || foldableLines.value.has(row.n)) ? (openBlock(), createElementBlock("span", {
|
|
4481
4745
|
key: 2,
|
|
4482
4746
|
class: normalizeClass([unref(ns).e("fold-toggle"), unref(ns).is("folded", row.folded)]),
|
|
4483
|
-
"data-fold": row.n
|
|
4484
|
-
|
|
4747
|
+
"data-fold": row.n,
|
|
4748
|
+
"aria-hidden": "true"
|
|
4749
|
+
}, [row.folded ? (openBlock(), createBlock(unref(ChevronRightIcon), { key: 0 })) : (openBlock(), createBlock(unref(ChevronDownIcon), { key: 1 }))], 10, _hoisted_3)) : createCommentVNode("", true)
|
|
4485
4750
|
], 6);
|
|
4486
4751
|
}), 128))], 6)], 34)) : createCommentVNode("", true), createElementVNode("div", {
|
|
4487
4752
|
ref_key: "content",
|
|
@@ -4593,13 +4858,13 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4593
4858
|
class: normalizeClass(part[1]),
|
|
4594
4859
|
title: part[2],
|
|
4595
4860
|
style: normalizeStyle(part[4])
|
|
4596
|
-
}, toDisplayString(part[0]), 15,
|
|
4861
|
+
}, toDisplayString(part[0]), 15, _hoisted_4)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
|
|
4597
4862
|
}), 128)), row.folded && sub === row.wrapped.breaks.length ? (openBlock(), createElementBlock("span", {
|
|
4598
4863
|
key: 0,
|
|
4599
4864
|
class: normalizeClass(unref(ns).e("fold-marker")),
|
|
4600
4865
|
"data-unfold": row.n,
|
|
4601
4866
|
title: unref(messages).unfold
|
|
4602
|
-
}, "⋯", 10,
|
|
4867
|
+
}, "⋯", 10, _hoisted_5)) : createCommentVNode("", true)], 6);
|
|
4603
4868
|
}), 128)) : row.tokens || row.marks || row.inlines ? (openBlock(true), createElementBlock(Fragment, { key: 2 }, renderList(partsOf(row), (part, i) => {
|
|
4604
4869
|
return openBlock(), createElementBlock(Fragment, { key: i }, [part[3] !== void 0 ? (openBlock(), createElementBlock("span", {
|
|
4605
4870
|
key: 0,
|
|
@@ -4612,13 +4877,13 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4612
4877
|
class: normalizeClass(part[1]),
|
|
4613
4878
|
title: part[2],
|
|
4614
4879
|
style: normalizeStyle(part[4])
|
|
4615
|
-
}, toDisplayString(part[0]), 15,
|
|
4880
|
+
}, toDisplayString(part[0]), 15, _hoisted_6)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
|
|
4616
4881
|
}), 128)) : (openBlock(), createElementBlock(Fragment, { key: 3 }, [createTextVNode(toDisplayString(row.text), 1)], 64)), row.folded && !row.wrapped.breaks.length ? (openBlock(), createElementBlock("span", {
|
|
4617
4882
|
key: 4,
|
|
4618
4883
|
class: normalizeClass(unref(ns).e("fold-marker")),
|
|
4619
4884
|
"data-unfold": row.n,
|
|
4620
4885
|
title: unref(messages).unfold
|
|
4621
|
-
}, "⋯", 10,
|
|
4886
|
+
}, "⋯", 10, _hoisted_7)) : createCommentVNode("", true)], 6));
|
|
4622
4887
|
_item.memo = _memo;
|
|
4623
4888
|
return _item;
|
|
4624
4889
|
}, _cache, 10), 128))], 6),
|
|
@@ -4698,9 +4963,9 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4698
4963
|
class: normalizeClass([unref(ns).e("fix"), unref(ns).is("active", i === problemBox.value.index)]),
|
|
4699
4964
|
"aria-current": i === problemBox.value.index || void 0,
|
|
4700
4965
|
onClick: ($event) => runFix(i)
|
|
4701
|
-
}, toDisplayString(fix.action.label), 11,
|
|
4966
|
+
}, toDisplayString(fix.action.label), 11, _hoisted_9);
|
|
4702
4967
|
}), 128))], 2)) : createCommentVNode("", true)
|
|
4703
|
-
], 46,
|
|
4968
|
+
], 46, _hoisted_8)) : createCommentVNode("", true),
|
|
4704
4969
|
completionStyle.value ? (openBlock(), createElementBlock("div", {
|
|
4705
4970
|
key: 1,
|
|
4706
4971
|
ref_key: "completionEl",
|
|
@@ -4739,8 +5004,8 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4739
5004
|
key: 0,
|
|
4740
5005
|
class: normalizeClass(unref(ns).e("completion-detail"))
|
|
4741
5006
|
}, toDisplayString(item.option.detail), 3)) : createCommentVNode("", true)
|
|
4742
|
-
], 10,
|
|
4743
|
-
}), 128))], 10,
|
|
5007
|
+
], 10, _hoisted_11);
|
|
5008
|
+
}), 128))], 10, _hoisted_10), completion.value.items[completion.value.index]?.option.info ? (openBlock(), createElementBlock("div", {
|
|
4744
5009
|
key: 0,
|
|
4745
5010
|
class: normalizeClass(unref(ns).e("completion-info"))
|
|
4746
5011
|
}, [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), {
|
|
@@ -4767,7 +5032,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4767
5032
|
}, [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), {
|
|
4768
5033
|
key: 1,
|
|
4769
5034
|
render: signature.value.result.info
|
|
4770
|
-
}, null, 8, ["render"]))], 2)) : createCommentVNode("", true)], 46,
|
|
5035
|
+
}, null, 8, ["render"]))], 2)) : createCommentVNode("", true)], 46, _hoisted_12)) : createCommentVNode("", true),
|
|
4771
5036
|
(openBlock(true), createElementBlock(Fragment, null, renderList(handles.value, (handle) => {
|
|
4772
5037
|
return openBlock(), createElementBlock("div", {
|
|
4773
5038
|
key: handle.kind,
|
|
@@ -4775,7 +5040,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4775
5040
|
style: normalizeStyle({ transform: `translate(${handle.left}px, ${handle.top}px)` }),
|
|
4776
5041
|
"aria-hidden": "true",
|
|
4777
5042
|
onPointerdown: ($event) => onHandleDown($event, handle.kind)
|
|
4778
|
-
}, null, 46,
|
|
5043
|
+
}, null, 46, _hoisted_13);
|
|
4779
5044
|
}), 128)),
|
|
4780
5045
|
magnifier.value ? (openBlock(), createElementBlock("div", {
|
|
4781
5046
|
key: 3,
|
|
@@ -4795,7 +5060,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4795
5060
|
class: normalizeClass(part[1]),
|
|
4796
5061
|
title: part[2],
|
|
4797
5062
|
style: normalizeStyle(part[4])
|
|
4798
|
-
}, toDisplayString(part[0]), 15,
|
|
5063
|
+
}, toDisplayString(part[0]), 15, _hoisted_14)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [createTextVNode(toDisplayString(part[0]), 1)], 64))], 64);
|
|
4799
5064
|
}), 128))], 6), createElementVNode("div", {
|
|
4800
5065
|
class: normalizeClass(unref(ns).e("magnifier-caret")),
|
|
4801
5066
|
style: normalizeStyle({ left: `${magnifier.value.caret - 1}px` })
|
|
@@ -4816,8 +5081,8 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4816
5081
|
tabindex: "-1",
|
|
4817
5082
|
class: normalizeClass(unref(ns).e("menu-button")),
|
|
4818
5083
|
onClick: ($event) => item.run()
|
|
4819
|
-
}, toDisplayString(item.label), 11,
|
|
4820
|
-
}), 128))], 46,
|
|
5084
|
+
}, toDisplayString(item.label), 11, _hoisted_16);
|
|
5085
|
+
}), 128))], 46, _hoisted_15)) : createCommentVNode("", true)
|
|
4821
5086
|
], 6)], 8, ["to", "disabled"])),
|
|
4822
5087
|
createElementVNode("textarea", {
|
|
4823
5088
|
ref_key: "input",
|
|
@@ -4850,7 +5115,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4850
5115
|
onPaste,
|
|
4851
5116
|
onFocus,
|
|
4852
5117
|
onBlur
|
|
4853
|
-
}, null, 46,
|
|
5118
|
+
}, null, 46, _hoisted_17),
|
|
4854
5119
|
shownWidgets.value.length ? (openBlock(), createElementBlock("div", {
|
|
4855
5120
|
key: 3,
|
|
4856
5121
|
class: normalizeClass(unref(ns).e("widgets")),
|
|
@@ -4869,7 +5134,7 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4869
5134
|
transform: `translate(${scrollLeft.value}px, ${widget.top}px)`,
|
|
4870
5135
|
width: `${Math.max(0, viewWidth.value - gutterWidth.value)}px`
|
|
4871
5136
|
})
|
|
4872
|
-
}, [createVNode(unref(render_part_default), { render: widget.render }, null, 8, ["render"])], 14,
|
|
5137
|
+
}, [createVNode(unref(render_part_default), { render: widget.render }, null, 8, ["render"])], 14, _hoisted_18);
|
|
4873
5138
|
}), 128))], 34)) : createCommentVNode("", true)
|
|
4874
5139
|
], 34)], 6)], 34), minimapOn.value && minimap.value ? (openBlock(), createElementBlock("div", {
|
|
4875
5140
|
key: 0,
|
|
@@ -4901,13 +5166,31 @@ var code_editor_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
4901
5166
|
}), 128))], 2)) : createCommentVNode("", true),
|
|
4902
5167
|
(openBlock(), createBlock(Teleport, { to: "body" }, [showKeys.value ? (openBlock(), createElementBlock("div", {
|
|
4903
5168
|
key: 0,
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
5169
|
+
ref_key: "keysEl",
|
|
5170
|
+
ref: keysEl,
|
|
5171
|
+
class: normalizeClass([
|
|
5172
|
+
unref(ns).e("keys"),
|
|
5173
|
+
unref(ns).is("fixed", anchorMode.value === "fixed"),
|
|
5174
|
+
unref(ns).is("scrolling", boxScrolling.value)
|
|
5175
|
+
]),
|
|
5176
|
+
style: normalizeStyle(keysStyle.value),
|
|
5177
|
+
onFocusin: _cache[26] || (_cache[26] = ($event) => keysFocused.value = true),
|
|
5178
|
+
onFocusout: onKeysFocusOut,
|
|
5179
|
+
onKeydown: onKeysKeydown
|
|
5180
|
+
}, [createElementVNode("button", {
|
|
5181
|
+
type: "button",
|
|
5182
|
+
class: normalizeClass(unref(ns).e("keys-grip")),
|
|
5183
|
+
"aria-label": unref(messages).moveKeys,
|
|
5184
|
+
title: unref(messages).moveKeys,
|
|
5185
|
+
"aria-keyshortcuts": "ArrowUp ArrowDown ArrowLeft ArrowRight",
|
|
5186
|
+
onPointerdown: onKeysGripDown,
|
|
5187
|
+
onKeydown: onKeysGripKey,
|
|
5188
|
+
onMousedown: _cache[25] || (_cache[25] = withModifiers(() => {}, ["prevent"]))
|
|
5189
|
+
}, [createVNode(unref(GripVerticalIcon))], 42, _hoisted_19), createVNode(code_keys_default, {
|
|
4907
5190
|
editor: keysEditor,
|
|
4908
5191
|
keys: keysList.value,
|
|
4909
5192
|
messages: unref(messages)
|
|
4910
|
-
}, null, 8, ["keys", "messages"])],
|
|
5193
|
+
}, null, 8, ["keys", "messages"])], 38)) : createCommentVNode("", true)]))
|
|
4911
5194
|
], 6);
|
|
4912
5195
|
};
|
|
4913
5196
|
}
|