@adecore/editor-react 0.42.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CallHierarchyPanel.js +177 -181
- package/dist/EditorContextMenu.js +118 -105
- package/dist/LanguagePopups.js +7 -0
- package/dist/PickPopup.js +245 -104
- package/dist/WrapCard.d.ts +8 -0
- package/dist/WrapCard.js +172 -0
- package/dist/call-hierarchy-model.d.ts +4 -2
- package/dist/call-hierarchy-model.js +20 -0
- package/dist/call-hierarchy.d.ts +3 -0
- package/dist/call-hierarchy.js +54 -22
- package/dist/clipboard-history.d.ts +31 -0
- package/dist/clipboard-history.js +70 -0
- package/dist/code-actions.d.ts +3 -1
- package/dist/code-actions.js +50 -10
- package/dist/code-vision.js +2 -3
- package/dist/completion.d.ts +28 -0
- package/dist/completion.js +83 -27
- package/dist/context-menu-rows.d.ts +1 -1
- package/dist/context-menu-rows.js +4 -0
- package/dist/definition-link.js +15 -5
- package/dist/document-colors.d.ts +24 -0
- package/dist/document-colors.js +194 -0
- package/dist/document-links.d.ts +22 -0
- package/dist/document-links.js +133 -0
- package/dist/document-query.d.ts +15 -0
- package/dist/document-query.js +54 -0
- package/dist/edit-locations.d.ts +20 -0
- package/dist/edit-locations.js +136 -0
- package/dist/editor-language.d.ts +23 -1
- package/dist/editor-language.js +83 -2
- package/dist/emmet.d.ts +13 -0
- package/dist/emmet.js +62 -0
- package/dist/folding.js +2 -3
- package/dist/format-on-type.js +3 -5
- package/dist/highlights.js +2 -3
- package/dist/history.d.ts +7 -0
- package/dist/history.js +79 -1
- package/dist/host-types.d.ts +10 -0
- package/dist/index.d.ts +13 -2
- package/dist/index.js +10 -0
- package/dist/inlay-hints.js +2 -2
- package/dist/inline-completion.d.ts +39 -0
- package/dist/inline-completion.js +221 -0
- package/dist/key-priority.d.ts +9 -5
- package/dist/key-priority.js +11 -6
- package/dist/linked-editing.d.ts +26 -0
- package/dist/linked-editing.js +215 -0
- package/dist/live-templates.d.ts +16 -0
- package/dist/live-templates.js +289 -0
- package/dist/locales/en.json +61 -2
- package/dist/locales/nl.json +61 -2
- package/dist/markup-context.d.ts +55 -0
- package/dist/markup-context.js +408 -0
- package/dist/markup.d.ts +39 -0
- package/dist/markup.js +465 -0
- package/dist/navigation.js +4 -6
- package/dist/paste-history.d.ts +7 -0
- package/dist/paste-history.js +104 -0
- package/dist/peek.js +3 -4
- package/dist/pick.d.ts +21 -2
- package/dist/pick.js +152 -19
- package/dist/popups.d.ts +10 -0
- package/dist/popups.js +2 -1
- package/dist/postfix.d.ts +21 -0
- package/dist/postfix.js +212 -0
- package/dist/project-language.d.ts +20 -1
- package/dist/project-language.js +132 -18
- package/dist/rename.js +8 -11
- package/dist/rendered-docs.js +1 -2
- package/dist/selection-ranges.js +2 -3
- package/dist/shortcut-keys.d.ts +24 -0
- package/dist/signature.js +3 -6
- package/dist/snippet-insert.d.ts +10 -0
- package/dist/snippet-insert.js +217 -0
- package/dist/snippet-session.d.ts +2 -2
- package/dist/snippet-session.js +3 -3
- package/dist/snippet.d.ts +7 -1
- package/dist/snippet.js +65 -8
- package/dist/surround-constructs.d.ts +10 -0
- package/dist/surround-constructs.js +100 -0
- package/dist/surround.d.ts +18 -0
- package/dist/surround.js +399 -0
- package/dist/symbol-picker.js +4 -6
- package/dist/symbols.js +22 -3
- package/dist/template-builtins.d.ts +3 -0
- package/dist/template-builtins.js +46 -0
- package/dist/template-context.d.ts +12 -0
- package/dist/template-context.js +56 -0
- package/dist/templates.d.ts +59 -0
- package/dist/templates.js +103 -0
- package/dist/testing.d.ts +23 -1
- package/dist/testing.js +114 -0
- package/package.json +7 -6
- package/src/CallHierarchyPanel.tsx +26 -11
- package/src/EditorContextMenu.tsx +7 -0
- package/src/LanguagePopups.tsx +4 -0
- package/src/PickPopup.tsx +47 -5
- package/src/WrapCard.tsx +64 -0
- package/src/call-hierarchy-model.ts +25 -3
- package/src/call-hierarchy.ts +62 -20
- package/src/clipboard-history.ts +102 -0
- package/src/code-actions.ts +48 -11
- package/src/code-vision.ts +3 -3
- package/src/completion.ts +123 -25
- package/src/context-menu-rows.ts +3 -2
- package/src/definition-link.ts +17 -5
- package/src/document-colors.ts +189 -0
- package/src/document-links.ts +129 -0
- package/src/document-query.ts +71 -0
- package/src/edit-locations.ts +162 -0
- package/src/editor-language.ts +86 -3
- package/src/emmet-module.d.ts +44 -0
- package/src/emmet.ts +73 -0
- package/src/folding.ts +3 -3
- package/src/format-on-type.ts +5 -5
- package/src/highlights.ts +3 -3
- package/src/history.ts +81 -1
- package/src/host-types.ts +17 -0
- package/src/index.ts +28 -3
- package/src/inlay-hints.ts +2 -2
- package/src/inline-completion.ts +221 -0
- package/src/key-priority.ts +11 -6
- package/src/linked-editing.ts +199 -0
- package/src/live-templates.ts +315 -0
- package/src/locales/en.json +61 -2
- package/src/locales/nl.json +61 -2
- package/src/markup-context.ts +387 -0
- package/src/markup.ts +377 -0
- package/src/navigation.ts +6 -6
- package/src/paste-history.ts +111 -0
- package/src/peek.ts +4 -4
- package/src/pick.ts +218 -20
- package/src/popups.ts +21 -1
- package/src/postfix.ts +224 -0
- package/src/project-language.ts +139 -19
- package/src/rename.ts +11 -11
- package/src/rendered-docs.ts +2 -2
- package/src/selection-ranges.ts +3 -3
- package/src/signature.ts +6 -6
- package/src/snippet-insert.ts +258 -0
- package/src/snippet-session.ts +9 -4
- package/src/snippet.ts +82 -7
- package/src/surround-constructs.ts +85 -0
- package/src/surround.ts +430 -0
- package/src/symbol-picker.ts +6 -6
- package/src/symbols.ts +30 -4
- package/src/template-builtins.ts +94 -0
- package/src/template-context.ts +65 -0
- package/src/templates.ts +197 -0
- package/src/testing.ts +126 -1
package/dist/PickPopup.js
CHANGED
|
@@ -4,65 +4,164 @@ import { createPortal } from 'react-dom';
|
|
|
4
4
|
import { PathText } from "./PathText.js";
|
|
5
5
|
import { keepFocusOutOfList, useInputPopup } from './popup-focus.js';
|
|
6
6
|
import { placePopup } from './popup-placement.js';
|
|
7
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
8
|
const CARD = 'fixed top-0 left-0 z-(--z-popup) flex w-[420px] flex-col overflow-hidden rounded-lg border border-border bg-surface-raised text-text shadow-(--float-shadow)';
|
|
9
|
+
/* The label with the part a query matched marked, whatever the case. */
|
|
10
|
+
function MatchedLabel(t0) {
|
|
11
|
+
const $ = _c(18);
|
|
12
|
+
const {
|
|
13
|
+
label,
|
|
14
|
+
query
|
|
15
|
+
} = t0;
|
|
16
|
+
let start;
|
|
17
|
+
let t1;
|
|
18
|
+
let t2;
|
|
19
|
+
let t3;
|
|
20
|
+
let t4;
|
|
21
|
+
if ($[0] !== label || $[1] !== query) {
|
|
22
|
+
t4 = Symbol.for("react.early_return_sentinel");
|
|
23
|
+
bb0: {
|
|
24
|
+
start = query === null || query === "" ? -1 : label.toLowerCase().indexOf(query.toLowerCase());
|
|
25
|
+
if (query === null || start < 0) {
|
|
26
|
+
t4 = label;
|
|
27
|
+
break bb0;
|
|
28
|
+
}
|
|
29
|
+
t3 = label.slice(0, start);
|
|
30
|
+
t1 = "bg-transparent font-semibold text-accent";
|
|
31
|
+
t2 = label.slice(start, start + query.length);
|
|
32
|
+
}
|
|
33
|
+
$[0] = label;
|
|
34
|
+
$[1] = query;
|
|
35
|
+
$[2] = start;
|
|
36
|
+
$[3] = t1;
|
|
37
|
+
$[4] = t2;
|
|
38
|
+
$[5] = t3;
|
|
39
|
+
$[6] = t4;
|
|
40
|
+
} else {
|
|
41
|
+
start = $[2];
|
|
42
|
+
t1 = $[3];
|
|
43
|
+
t2 = $[4];
|
|
44
|
+
t3 = $[5];
|
|
45
|
+
t4 = $[6];
|
|
46
|
+
}
|
|
47
|
+
if (t4 !== Symbol.for("react.early_return_sentinel")) {
|
|
48
|
+
return t4;
|
|
49
|
+
}
|
|
50
|
+
let t5;
|
|
51
|
+
if ($[7] !== t1 || $[8] !== t2) {
|
|
52
|
+
t5 = /*#__PURE__*/_jsx("mark", {
|
|
53
|
+
className: t1,
|
|
54
|
+
children: t2
|
|
55
|
+
});
|
|
56
|
+
$[7] = t1;
|
|
57
|
+
$[8] = t2;
|
|
58
|
+
$[9] = t5;
|
|
59
|
+
} else {
|
|
60
|
+
t5 = $[9];
|
|
61
|
+
}
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[10] !== label || $[11] !== query.length || $[12] !== start) {
|
|
64
|
+
t6 = label.slice(start + query.length);
|
|
65
|
+
$[10] = label;
|
|
66
|
+
$[11] = query.length;
|
|
67
|
+
$[12] = start;
|
|
68
|
+
$[13] = t6;
|
|
69
|
+
} else {
|
|
70
|
+
t6 = $[13];
|
|
71
|
+
}
|
|
72
|
+
let t7;
|
|
73
|
+
if ($[14] !== t3 || $[15] !== t5 || $[16] !== t6) {
|
|
74
|
+
t7 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
75
|
+
children: [t3, t5, t6]
|
|
76
|
+
});
|
|
77
|
+
$[14] = t3;
|
|
78
|
+
$[15] = t5;
|
|
79
|
+
$[16] = t6;
|
|
80
|
+
$[17] = t7;
|
|
81
|
+
} else {
|
|
82
|
+
t7 = $[17];
|
|
83
|
+
}
|
|
84
|
+
return t7;
|
|
85
|
+
}
|
|
9
86
|
function PreviewLines(t0) {
|
|
10
|
-
const $ = _c(
|
|
87
|
+
const $ = _c(17);
|
|
11
88
|
const {
|
|
12
89
|
preview
|
|
13
90
|
} = t0;
|
|
91
|
+
if (preview.kind === "text") {
|
|
92
|
+
let t1;
|
|
93
|
+
if ($[0] !== preview.added) {
|
|
94
|
+
t1 = preview.added.map(_temp);
|
|
95
|
+
$[0] = preview.added;
|
|
96
|
+
$[1] = t1;
|
|
97
|
+
} else {
|
|
98
|
+
t1 = $[1];
|
|
99
|
+
}
|
|
100
|
+
let t2;
|
|
101
|
+
if ($[2] !== t1) {
|
|
102
|
+
t2 = /*#__PURE__*/_jsx("div", {
|
|
103
|
+
className: "max-h-48 overflow-auto border-t border-border p-2 font-mono text-code whitespace-pre",
|
|
104
|
+
children: t1
|
|
105
|
+
});
|
|
106
|
+
$[2] = t1;
|
|
107
|
+
$[3] = t2;
|
|
108
|
+
} else {
|
|
109
|
+
t2 = $[3];
|
|
110
|
+
}
|
|
111
|
+
return t2;
|
|
112
|
+
}
|
|
14
113
|
let t1;
|
|
15
|
-
if ($[
|
|
16
|
-
t1 = preview.removed.map(
|
|
17
|
-
$[
|
|
18
|
-
$[
|
|
114
|
+
if ($[4] !== preview.removed) {
|
|
115
|
+
t1 = preview.removed.map(_temp2);
|
|
116
|
+
$[4] = preview.removed;
|
|
117
|
+
$[5] = t1;
|
|
19
118
|
} else {
|
|
20
|
-
t1 = $[
|
|
119
|
+
t1 = $[5];
|
|
21
120
|
}
|
|
22
121
|
let t2;
|
|
23
|
-
if ($[
|
|
24
|
-
t2 = preview.added.map(
|
|
25
|
-
$[
|
|
26
|
-
$[
|
|
122
|
+
if ($[6] !== preview.added) {
|
|
123
|
+
t2 = preview.added.map(_temp3);
|
|
124
|
+
$[6] = preview.added;
|
|
125
|
+
$[7] = t2;
|
|
27
126
|
} else {
|
|
28
|
-
t2 = $[
|
|
127
|
+
t2 = $[7];
|
|
29
128
|
}
|
|
30
129
|
let t3;
|
|
31
|
-
if ($[
|
|
130
|
+
if ($[8] !== preview.note) {
|
|
32
131
|
t3 = preview.note !== null && /*#__PURE__*/_jsx("div", {
|
|
33
132
|
className: "px-1.5 font-sans text-xs text-text-muted",
|
|
34
133
|
children: preview.note
|
|
35
134
|
});
|
|
36
|
-
$[
|
|
37
|
-
$[
|
|
135
|
+
$[8] = preview.note;
|
|
136
|
+
$[9] = t3;
|
|
38
137
|
} else {
|
|
39
|
-
t3 = $[
|
|
138
|
+
t3 = $[9];
|
|
40
139
|
}
|
|
41
140
|
let t4;
|
|
42
|
-
if ($[
|
|
141
|
+
if ($[10] !== preview.refusal) {
|
|
43
142
|
t4 = preview.refusal !== undefined && /*#__PURE__*/_jsx("div", {
|
|
44
143
|
role: "alert",
|
|
45
144
|
className: "px-1.5 py-0.5 font-sans text-xs text-status-error",
|
|
46
145
|
children: preview.refusal
|
|
47
146
|
});
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
147
|
+
$[10] = preview.refusal;
|
|
148
|
+
$[11] = t4;
|
|
50
149
|
} else {
|
|
51
|
-
t4 = $[
|
|
150
|
+
t4 = $[11];
|
|
52
151
|
}
|
|
53
152
|
let t5;
|
|
54
|
-
if ($[
|
|
153
|
+
if ($[12] !== t1 || $[13] !== t2 || $[14] !== t3 || $[15] !== t4) {
|
|
55
154
|
t5 = /*#__PURE__*/_jsxs("div", {
|
|
56
155
|
className: "flex flex-col gap-px border-t border-border p-1 font-mono text-code",
|
|
57
156
|
children: [t1, t2, t3, t4]
|
|
58
157
|
});
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
62
|
-
$[
|
|
63
|
-
$[
|
|
158
|
+
$[12] = t1;
|
|
159
|
+
$[13] = t2;
|
|
160
|
+
$[14] = t3;
|
|
161
|
+
$[15] = t4;
|
|
162
|
+
$[16] = t5;
|
|
64
163
|
} else {
|
|
65
|
-
t5 = $[
|
|
164
|
+
t5 = $[16];
|
|
66
165
|
}
|
|
67
166
|
return t5;
|
|
68
167
|
}
|
|
@@ -70,7 +169,7 @@ function PreviewLines(t0) {
|
|
|
70
169
|
* The list of an editor's pick feature under the character it belongs to. A press on a row never takes
|
|
71
170
|
* the focus from the editor, so the keys keep going to it while the list is open.
|
|
72
171
|
*/
|
|
73
|
-
function
|
|
172
|
+
function _temp3(line_1, index_1) {
|
|
74
173
|
return /*#__PURE__*/_jsxs("div", {
|
|
75
174
|
className: "flex gap-2 rounded-sm bg-status-idle/10 px-1.5 whitespace-pre",
|
|
76
175
|
children: [/*#__PURE__*/_jsx("span", {
|
|
@@ -78,11 +177,11 @@ function _temp2(line_0, index_0) {
|
|
|
78
177
|
children: "+"
|
|
79
178
|
}), /*#__PURE__*/_jsx("span", {
|
|
80
179
|
className: "min-w-0 truncate",
|
|
81
|
-
children:
|
|
180
|
+
children: line_1
|
|
82
181
|
})]
|
|
83
|
-
}, `+${
|
|
182
|
+
}, `+${index_1}`);
|
|
84
183
|
}
|
|
85
|
-
function
|
|
184
|
+
function _temp2(line_0, index_0) {
|
|
86
185
|
return /*#__PURE__*/_jsxs("div", {
|
|
87
186
|
className: "flex gap-2 rounded-sm bg-status-error/10 px-1.5 whitespace-pre",
|
|
88
187
|
children: [/*#__PURE__*/_jsx("span", {
|
|
@@ -90,12 +189,17 @@ function _temp(line, index) {
|
|
|
90
189
|
children: "\u2212"
|
|
91
190
|
}), /*#__PURE__*/_jsx("span", {
|
|
92
191
|
className: "min-w-0 truncate",
|
|
93
|
-
children:
|
|
192
|
+
children: line_0
|
|
94
193
|
})]
|
|
95
|
-
}, `-${
|
|
194
|
+
}, `-${index_0}`);
|
|
195
|
+
}
|
|
196
|
+
function _temp(line, index) {
|
|
197
|
+
return /*#__PURE__*/_jsx("div", {
|
|
198
|
+
children: line === "" ? " " : line
|
|
199
|
+
}, index);
|
|
96
200
|
}
|
|
97
201
|
export function PickPopup(t0) {
|
|
98
|
-
const $ = _c(
|
|
202
|
+
const $ = _c(37);
|
|
99
203
|
const {
|
|
100
204
|
language,
|
|
101
205
|
view,
|
|
@@ -175,117 +279,154 @@ export function PickPopup(t0) {
|
|
|
175
279
|
t4 = $[10];
|
|
176
280
|
}
|
|
177
281
|
const activeId = t4;
|
|
178
|
-
useInputPopup(language, listId, activeId);
|
|
179
282
|
let t5;
|
|
180
|
-
if ($[11]
|
|
181
|
-
t5 =
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
$[11] = t5;
|
|
283
|
+
if ($[11] !== view.groups) {
|
|
284
|
+
t5 = view.groups.some(_temp5);
|
|
285
|
+
$[11] = view.groups;
|
|
286
|
+
$[12] = t5;
|
|
185
287
|
} else {
|
|
186
|
-
t5 = $[
|
|
288
|
+
t5 = $[12];
|
|
187
289
|
}
|
|
290
|
+
const mnemonics = t5;
|
|
291
|
+
useInputPopup(language, listId, activeId);
|
|
188
292
|
let t6;
|
|
189
|
-
if ($[
|
|
190
|
-
t6 =
|
|
191
|
-
|
|
293
|
+
if ($[13] === Symbol.for("react.memo_cache_sentinel")) {
|
|
294
|
+
t6 = {
|
|
295
|
+
visibility: "hidden"
|
|
296
|
+
};
|
|
192
297
|
$[13] = t6;
|
|
193
298
|
} else {
|
|
194
299
|
t6 = $[13];
|
|
195
300
|
}
|
|
196
301
|
let t7;
|
|
197
|
-
if ($[14] !==
|
|
198
|
-
t7 =
|
|
199
|
-
|
|
200
|
-
children: view.title
|
|
201
|
-
});
|
|
202
|
-
$[14] = view.title;
|
|
302
|
+
if ($[14] !== language) {
|
|
303
|
+
t7 = keepFocusOutOfList(() => language.editor.focus());
|
|
304
|
+
$[14] = language;
|
|
203
305
|
$[15] = t7;
|
|
204
306
|
} else {
|
|
205
307
|
t7 = $[15];
|
|
206
308
|
}
|
|
207
309
|
let t8;
|
|
208
|
-
if ($[16] !==
|
|
209
|
-
t8 = view.
|
|
310
|
+
if ($[16] !== view.query || $[17] !== view.title) {
|
|
311
|
+
t8 = (view.title !== null || view.query !== null) && /*#__PURE__*/_jsxs("div", {
|
|
312
|
+
className: "flex items-baseline gap-2 border-b border-border px-3 py-1.5 text-xs text-text-muted",
|
|
313
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
314
|
+
className: "min-w-0 truncate",
|
|
315
|
+
children: view.title
|
|
316
|
+
}), view.query !== null && view.query !== "" && /*#__PURE__*/_jsx("span", {
|
|
317
|
+
className: "ml-auto shrink-0 font-mono text-text",
|
|
318
|
+
children: view.query
|
|
319
|
+
})]
|
|
320
|
+
});
|
|
321
|
+
$[16] = view.query;
|
|
322
|
+
$[17] = view.title;
|
|
323
|
+
$[18] = t8;
|
|
324
|
+
} else {
|
|
325
|
+
t8 = $[18];
|
|
326
|
+
}
|
|
327
|
+
let t9;
|
|
328
|
+
if ($[19] !== language || $[20] !== mnemonics || $[21] !== optionIds || $[22] !== view.active || $[23] !== view.chosen || $[24] !== view.groups || $[25] !== view.query) {
|
|
329
|
+
t9 = view.groups.map((group_1, groupIndex) => /*#__PURE__*/_jsxs("div", {
|
|
210
330
|
role: "group",
|
|
211
331
|
className: "flex flex-col",
|
|
212
|
-
children: [
|
|
332
|
+
children: [group_1.title !== null && /*#__PURE__*/_jsx("div", {
|
|
213
333
|
className: "px-2 pt-1.5 pb-0.5 text-xs font-medium text-text-faint",
|
|
214
|
-
children:
|
|
215
|
-
}),
|
|
216
|
-
id: optionIds.get(
|
|
217
|
-
ref:
|
|
334
|
+
children: group_1.title
|
|
335
|
+
}), group_1.rows.map(row_1 => /*#__PURE__*/_jsxs("button", {
|
|
336
|
+
id: optionIds.get(row_1.id),
|
|
337
|
+
ref: row_1.id === view.active ? activeRow : undefined,
|
|
218
338
|
type: "button",
|
|
219
339
|
role: "option",
|
|
220
340
|
tabIndex: -1,
|
|
221
|
-
"aria-selected":
|
|
222
|
-
"
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
341
|
+
"aria-selected": row_1.id === view.active || view.chosen.includes(row_1.id),
|
|
342
|
+
"aria-keyshortcuts": row_1.mnemonic,
|
|
343
|
+
"data-active": row_1.id === view.active,
|
|
344
|
+
"data-chosen": view.chosen.includes(row_1.id),
|
|
345
|
+
className: "flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-xs cursor-row data-[chosen=true]:bg-accent/15",
|
|
346
|
+
onClick: event_0 => language.pick.choose(row_1.id, {
|
|
347
|
+
toggle: event_0.metaKey || event_0.ctrlKey,
|
|
348
|
+
range: event_0.shiftKey
|
|
349
|
+
}),
|
|
350
|
+
children: [mnemonics && /*#__PURE__*/_jsx("span", {
|
|
351
|
+
"aria-hidden": "true",
|
|
352
|
+
className: "w-3 shrink-0 text-center font-mono text-text-faint",
|
|
353
|
+
children: row_1.mnemonic
|
|
354
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
355
|
+
className: row_1.path ? "shrink-0" : "min-w-0 truncate",
|
|
356
|
+
children: /*#__PURE__*/_jsx(MatchedLabel, {
|
|
357
|
+
label: row_1.label,
|
|
358
|
+
query: view.query
|
|
359
|
+
})
|
|
360
|
+
}), row_1.path ? /*#__PURE__*/_jsx(PathText, {
|
|
361
|
+
path: row_1.detail,
|
|
230
362
|
className: "ml-auto font-mono text-text-faint"
|
|
231
363
|
}) : /*#__PURE__*/_jsx("span", {
|
|
232
364
|
className: "ml-auto shrink-0 font-mono text-text-faint",
|
|
233
|
-
children:
|
|
365
|
+
children: row_1.id === view.active && row_1.detail === "" ? "\u21B5" : row_1.detail
|
|
234
366
|
})]
|
|
235
|
-
},
|
|
236
|
-
},
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
367
|
+
}, row_1.id))]
|
|
368
|
+
}, group_1.title ?? groupIndex));
|
|
369
|
+
$[19] = language;
|
|
370
|
+
$[20] = mnemonics;
|
|
371
|
+
$[21] = optionIds;
|
|
372
|
+
$[22] = view.active;
|
|
373
|
+
$[23] = view.chosen;
|
|
374
|
+
$[24] = view.groups;
|
|
375
|
+
$[25] = view.query;
|
|
376
|
+
$[26] = t9;
|
|
242
377
|
} else {
|
|
243
|
-
|
|
378
|
+
t9 = $[26];
|
|
244
379
|
}
|
|
245
|
-
let
|
|
246
|
-
if ($[
|
|
247
|
-
|
|
380
|
+
let t10;
|
|
381
|
+
if ($[27] !== listId || $[28] !== t9) {
|
|
382
|
+
t10 = /*#__PURE__*/_jsx("div", {
|
|
248
383
|
id: listId,
|
|
249
384
|
role: "listbox",
|
|
250
385
|
className: "min-h-0 flex-1 overflow-y-auto p-1",
|
|
251
|
-
children:
|
|
386
|
+
children: t9
|
|
252
387
|
});
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
388
|
+
$[27] = listId;
|
|
389
|
+
$[28] = t9;
|
|
390
|
+
$[29] = t10;
|
|
256
391
|
} else {
|
|
257
|
-
|
|
392
|
+
t10 = $[29];
|
|
258
393
|
}
|
|
259
|
-
let
|
|
260
|
-
if ($[
|
|
261
|
-
|
|
394
|
+
let t11;
|
|
395
|
+
if ($[30] !== view.preview) {
|
|
396
|
+
t11 = view.preview !== null && /*#__PURE__*/_jsx(PreviewLines, {
|
|
262
397
|
preview: view.preview
|
|
263
398
|
});
|
|
264
|
-
$[
|
|
265
|
-
$[
|
|
399
|
+
$[30] = view.preview;
|
|
400
|
+
$[31] = t11;
|
|
266
401
|
} else {
|
|
267
|
-
|
|
402
|
+
t11 = $[31];
|
|
268
403
|
}
|
|
269
|
-
let
|
|
270
|
-
if ($[
|
|
271
|
-
|
|
404
|
+
let t12;
|
|
405
|
+
if ($[32] !== t10 || $[33] !== t11 || $[34] !== t7 || $[35] !== t8) {
|
|
406
|
+
t12 = createPortal(/*#__PURE__*/_jsxs("div", {
|
|
272
407
|
ref: card,
|
|
273
408
|
className: CARD,
|
|
274
|
-
style:
|
|
275
|
-
onPointerDown:
|
|
276
|
-
...
|
|
277
|
-
children: [
|
|
409
|
+
style: t6,
|
|
410
|
+
onPointerDown: _temp6,
|
|
411
|
+
...t7,
|
|
412
|
+
children: [t8, t10, t11]
|
|
278
413
|
}), document.body);
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
$[
|
|
283
|
-
$[
|
|
414
|
+
$[32] = t10;
|
|
415
|
+
$[33] = t11;
|
|
416
|
+
$[34] = t7;
|
|
417
|
+
$[35] = t8;
|
|
418
|
+
$[36] = t12;
|
|
284
419
|
} else {
|
|
285
|
-
|
|
420
|
+
t12 = $[36];
|
|
286
421
|
}
|
|
287
|
-
return
|
|
422
|
+
return t12;
|
|
288
423
|
}
|
|
289
|
-
function
|
|
424
|
+
function _temp6(event) {
|
|
290
425
|
return event.preventDefault();
|
|
426
|
+
}
|
|
427
|
+
function _temp5(group_0) {
|
|
428
|
+
return group_0.rows.some(_temp4);
|
|
429
|
+
}
|
|
430
|
+
function _temp4(row_0) {
|
|
431
|
+
return row_0.mnemonic !== undefined;
|
|
291
432
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EditorRect } from '@adecore/editor';
|
|
2
|
+
import type { EditorLanguage } from './editor-language.ts';
|
|
3
|
+
import type { WrapView } from './popups.ts';
|
|
4
|
+
export declare function WrapCard({ language, view, rect }: {
|
|
5
|
+
language: EditorLanguage;
|
|
6
|
+
view: WrapView;
|
|
7
|
+
rect: EditorRect;
|
|
8
|
+
}): import("react").JSX.Element;
|
package/dist/WrapCard.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { useLayoutEffect, useRef, useState } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
import { Input } from '@adecore/ui';
|
|
5
|
+
import { AnchoredPopup } from "./AnchoredPopup.js";
|
|
6
|
+
/* The field for the abbreviation a selection is wrapped in: Enter wraps, Escape or leaving the field cancels. */
|
|
7
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
export function WrapCard(t0) {
|
|
9
|
+
const $ = _c(30);
|
|
10
|
+
const {
|
|
11
|
+
language,
|
|
12
|
+
view,
|
|
13
|
+
rect
|
|
14
|
+
} = t0;
|
|
15
|
+
const {
|
|
16
|
+
t
|
|
17
|
+
} = useTranslation("editor");
|
|
18
|
+
const input = useRef(null);
|
|
19
|
+
const [value, setValue] = useState("");
|
|
20
|
+
let t1;
|
|
21
|
+
let t2;
|
|
22
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
23
|
+
t1 = () => {
|
|
24
|
+
input.current?.focus();
|
|
25
|
+
};
|
|
26
|
+
t2 = [];
|
|
27
|
+
$[0] = t1;
|
|
28
|
+
$[1] = t2;
|
|
29
|
+
} else {
|
|
30
|
+
t1 = $[0];
|
|
31
|
+
t2 = $[1];
|
|
32
|
+
}
|
|
33
|
+
useLayoutEffect(t1, t2);
|
|
34
|
+
let t3;
|
|
35
|
+
if ($[2] !== language.editor || $[3] !== language.markup || $[4] !== value) {
|
|
36
|
+
t3 = function onKeyDown(event) {
|
|
37
|
+
if (event.nativeEvent.isComposing) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (event.key === "Escape") {
|
|
41
|
+
event.preventDefault();
|
|
42
|
+
event.stopPropagation();
|
|
43
|
+
language.markup.cancelWrap();
|
|
44
|
+
language.editor.focus();
|
|
45
|
+
} else {
|
|
46
|
+
if (event.key === "Enter") {
|
|
47
|
+
event.preventDefault();
|
|
48
|
+
event.stopPropagation();
|
|
49
|
+
if (value.trim() !== "") {
|
|
50
|
+
language.markup.submitWrap(value);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
$[2] = language.editor;
|
|
56
|
+
$[3] = language.markup;
|
|
57
|
+
$[4] = value;
|
|
58
|
+
$[5] = t3;
|
|
59
|
+
} else {
|
|
60
|
+
t3 = $[5];
|
|
61
|
+
}
|
|
62
|
+
const onKeyDown = t3;
|
|
63
|
+
let t4;
|
|
64
|
+
if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
|
|
65
|
+
t4 = {
|
|
66
|
+
prefer: "above"
|
|
67
|
+
};
|
|
68
|
+
$[6] = t4;
|
|
69
|
+
} else {
|
|
70
|
+
t4 = $[6];
|
|
71
|
+
}
|
|
72
|
+
let t5;
|
|
73
|
+
if ($[7] !== t) {
|
|
74
|
+
t5 = t("language.markup.wrap");
|
|
75
|
+
$[7] = t;
|
|
76
|
+
$[8] = t5;
|
|
77
|
+
} else {
|
|
78
|
+
t5 = $[8];
|
|
79
|
+
}
|
|
80
|
+
const t6 = view.error !== null;
|
|
81
|
+
let t7;
|
|
82
|
+
if ($[9] !== t) {
|
|
83
|
+
t7 = t("language.markup.placeholder");
|
|
84
|
+
$[9] = t;
|
|
85
|
+
$[10] = t7;
|
|
86
|
+
} else {
|
|
87
|
+
t7 = $[10];
|
|
88
|
+
}
|
|
89
|
+
let t8;
|
|
90
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
91
|
+
t8 = event_0 => setValue(event_0.target.value);
|
|
92
|
+
$[11] = t8;
|
|
93
|
+
} else {
|
|
94
|
+
t8 = $[11];
|
|
95
|
+
}
|
|
96
|
+
let t9;
|
|
97
|
+
if ($[12] !== language.markup) {
|
|
98
|
+
t9 = () => language.markup.cancelWrap();
|
|
99
|
+
$[12] = language.markup;
|
|
100
|
+
$[13] = t9;
|
|
101
|
+
} else {
|
|
102
|
+
t9 = $[13];
|
|
103
|
+
}
|
|
104
|
+
let t10;
|
|
105
|
+
if ($[14] !== onKeyDown || $[15] !== t5 || $[16] !== t6 || $[17] !== t7 || $[18] !== t9 || $[19] !== value) {
|
|
106
|
+
t10 = /*#__PURE__*/_jsx(Input, {
|
|
107
|
+
ref: input,
|
|
108
|
+
size: "sm",
|
|
109
|
+
mono: true,
|
|
110
|
+
value: value,
|
|
111
|
+
spellCheck: false,
|
|
112
|
+
autoComplete: "off",
|
|
113
|
+
"aria-label": t5,
|
|
114
|
+
"aria-invalid": t6,
|
|
115
|
+
placeholder: t7,
|
|
116
|
+
onChange: t8,
|
|
117
|
+
onKeyDown: onKeyDown,
|
|
118
|
+
onBlur: t9
|
|
119
|
+
});
|
|
120
|
+
$[14] = onKeyDown;
|
|
121
|
+
$[15] = t5;
|
|
122
|
+
$[16] = t6;
|
|
123
|
+
$[17] = t7;
|
|
124
|
+
$[18] = t9;
|
|
125
|
+
$[19] = value;
|
|
126
|
+
$[20] = t10;
|
|
127
|
+
} else {
|
|
128
|
+
t10 = $[20];
|
|
129
|
+
}
|
|
130
|
+
let t11;
|
|
131
|
+
if ($[21] !== t || $[22] !== view.error) {
|
|
132
|
+
t11 = view.error !== null ? /*#__PURE__*/_jsx("div", {
|
|
133
|
+
role: "alert",
|
|
134
|
+
className: "text-xs text-status-error",
|
|
135
|
+
children: view.error
|
|
136
|
+
}) : /*#__PURE__*/_jsxs("div", {
|
|
137
|
+
className: "text-xs text-text-muted",
|
|
138
|
+
children: ["\u21B5 ", t("language.markup.apply")]
|
|
139
|
+
});
|
|
140
|
+
$[21] = t;
|
|
141
|
+
$[22] = view.error;
|
|
142
|
+
$[23] = t11;
|
|
143
|
+
} else {
|
|
144
|
+
t11 = $[23];
|
|
145
|
+
}
|
|
146
|
+
let t12;
|
|
147
|
+
if ($[24] !== t10 || $[25] !== t11) {
|
|
148
|
+
t12 = /*#__PURE__*/_jsxs("div", {
|
|
149
|
+
className: "flex w-[280px] flex-col gap-1.5 p-2",
|
|
150
|
+
children: [t10, t11]
|
|
151
|
+
});
|
|
152
|
+
$[24] = t10;
|
|
153
|
+
$[25] = t11;
|
|
154
|
+
$[26] = t12;
|
|
155
|
+
} else {
|
|
156
|
+
t12 = $[26];
|
|
157
|
+
}
|
|
158
|
+
let t13;
|
|
159
|
+
if ($[27] !== rect || $[28] !== t12) {
|
|
160
|
+
t13 = /*#__PURE__*/_jsx(AnchoredPopup, {
|
|
161
|
+
rect: rect,
|
|
162
|
+
placement: t4,
|
|
163
|
+
children: t12
|
|
164
|
+
});
|
|
165
|
+
$[27] = rect;
|
|
166
|
+
$[28] = t12;
|
|
167
|
+
$[29] = t13;
|
|
168
|
+
} else {
|
|
169
|
+
t13 = $[29];
|
|
170
|
+
}
|
|
171
|
+
return t13;
|
|
172
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, Range } from '@adecore/lsp';
|
|
2
|
-
export type CallDirection = 'incoming' | 'outgoing';
|
|
1
|
+
import type { CallHierarchyIncomingCall, CallHierarchyItem, CallHierarchyOutgoingCall, Range, TypeHierarchyItem } from '@adecore/lsp';
|
|
2
|
+
export type CallDirection = 'incoming' | 'outgoing' | 'supertypes' | 'subtypes';
|
|
3
|
+
export declare function isTypeDirection(direction: CallDirection): direction is 'supertypes' | 'subtypes';
|
|
3
4
|
export declare const CALL_LEVEL_LIMIT = 50;
|
|
4
5
|
export type CallLoad = 'idle' | 'loading' | 'loaded' | 'failed';
|
|
5
6
|
export interface CallNode {
|
|
@@ -44,6 +45,7 @@ export declare function statusIdOf(parent: string): string;
|
|
|
44
45
|
export declare function moreIdOf(parent: string): string;
|
|
45
46
|
export declare function rootsOf(items: readonly CallHierarchyItem[]): CallNode[];
|
|
46
47
|
export declare function childrenOf(direction: CallDirection, parent: CallNode, calls: readonly (CallHierarchyIncomingCall | CallHierarchyOutgoingCall)[]): CallNode[];
|
|
48
|
+
export declare function typeChildrenOf(parent: CallNode, items: readonly TypeHierarchyItem[]): CallNode[];
|
|
47
49
|
export declare function rowsOf(nodes: ReadonlyMap<string, CallNode>, roots: readonly string[]): CallRow[];
|
|
48
50
|
export declare function stepsOf(rows: readonly CallRow[]): CallRow[];
|
|
49
51
|
export declare function targetOf(node: CallNode, site?: number): {
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
/* Whether a direction walks a type hierarchy and not the calls. */
|
|
2
|
+
export function isTypeDirection(direction) {
|
|
3
|
+
return direction === 'supertypes' || direction === 'subtypes';
|
|
4
|
+
}
|
|
1
5
|
/* The most calls of one level that are drawn at once; the rest wait behind a row that shows more. */
|
|
2
6
|
export const CALL_LEVEL_LIMIT = 50;
|
|
3
7
|
/* The id of the status line under a node. */
|
|
@@ -47,6 +51,22 @@ export function childrenOf(direction, parent, calls) {
|
|
|
47
51
|
shown: 0
|
|
48
52
|
}));
|
|
49
53
|
}
|
|
54
|
+
/* The children of a node made from the types a server returned; a type has no call sites, so a row goes to the type itself. */
|
|
55
|
+
export function typeChildrenOf(parent, items) {
|
|
56
|
+
return items.map((item, index) => ({
|
|
57
|
+
id: `${parent.id}.${index}`,
|
|
58
|
+
parent: parent.id,
|
|
59
|
+
level: parent.level + 1,
|
|
60
|
+
item,
|
|
61
|
+
sites: [],
|
|
62
|
+
siteUri: null,
|
|
63
|
+
expanded: false,
|
|
64
|
+
load: 'idle',
|
|
65
|
+
error: null,
|
|
66
|
+
children: [],
|
|
67
|
+
shown: 0
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
50
70
|
/* The lines the tree draws: every root, and under an expanded node its status, its calls and the row that shows more. */
|
|
51
71
|
export function rowsOf(nodes, roots) {
|
|
52
72
|
const rows = [];
|