@adecore/editor-react 0.31.12 → 0.33.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/AnchoredPopup.js +73 -19
- package/dist/AttributionCard.js +162 -4
- package/dist/BaselineStatus.js +62 -8
- package/dist/CallHierarchyPanel.js +977 -60
- package/dist/ChangeReview.js +76 -25
- package/dist/CodeAuthorsCard.js +314 -14
- package/dist/CompletionPopup.js +490 -83
- package/dist/DiffView.js +548 -181
- package/dist/EditorContextMenu.js +352 -34
- package/dist/EditorView.js +276 -99
- package/dist/FindReplace.js +525 -67
- package/dist/HoverCard.js +378 -38
- package/dist/HoverSections.js +367 -56
- package/dist/LanguagePopups.js +95 -34
- package/dist/Markdown.js +41 -6
- package/dist/PanelResizeHandle.js +199 -66
- package/dist/PathText.js +49 -7
- package/dist/PeekPanel.js +675 -72
- package/dist/PickPopup.js +304 -34
- package/dist/RenameCard.js +679 -85
- package/dist/RenderedDocs.js +329 -58
- package/dist/SignatureCard.js +91 -7
- package/dist/SplitDiffView.js +344 -254
- package/dist/SymbolPicker.js +440 -85
- package/dist/call-hierarchy-model.js +102 -68
- package/dist/call-hierarchy.js +458 -359
- package/dist/code-actions-model.js +88 -76
- package/dist/code-actions.js +372 -283
- package/dist/code-authors.js +64 -55
- package/dist/code-vision-model.js +134 -127
- package/dist/code-vision.js +224 -206
- package/dist/completion-call.js +94 -67
- package/dist/completion-model.js +334 -244
- package/dist/completion.js +840 -649
- package/dist/conflict-model.js +35 -29
- package/dist/context-menu-rows.js +42 -17
- package/dist/context-menu.js +64 -46
- package/dist/definition-link.js +88 -85
- package/dist/diagnostics-model.js +74 -55
- package/dist/diagnostics.js +121 -100
- package/dist/diff-expansion.js +38 -35
- package/dist/diff-overlays.js +144 -22
- package/dist/diff-syntax.js +65 -42
- package/dist/diff-wordmarks.js +26 -23
- package/dist/doc-comment-model.js +265 -216
- package/dist/editor-language.js +177 -152
- package/dist/error-message.js +2 -2
- package/dist/find-query.js +49 -36
- package/dist/folding.js +81 -62
- package/dist/format-on-type.js +86 -67
- package/dist/highlight-layers.js +19 -20
- package/dist/highlights.js +105 -83
- package/dist/history.js +44 -38
- package/dist/holder.js +18 -18
- package/dist/host-types.js +1 -1
- package/dist/hover-content.js +167 -129
- package/dist/hover.js +285 -245
- package/dist/index.js +10 -10
- package/dist/inlay-hints.js +369 -324
- package/dist/key-priority.js +34 -31
- package/dist/language-ids.js +45 -42
- package/dist/line-edits.js +74 -28
- package/dist/line-text.js +18 -3
- package/dist/locales/en.json +38 -38
- package/dist/locales/nl.json +41 -41
- package/dist/models.js +1 -1
- package/dist/navigation-history.js +40 -41
- package/dist/navigation.js +141 -123
- package/dist/panel-size.js +8 -8
- package/dist/patch-decorations.js +236 -160
- package/dist/patch-layout.js +331 -262
- package/dist/paths.js +3 -3
- package/dist/peek-model.js +86 -69
- package/dist/peek.js +254 -192
- package/dist/pick.js +164 -157
- package/dist/popup-focus.js +5 -5
- package/dist/popup-placement.js +36 -21
- package/dist/popups.js +13 -13
- package/dist/project-language.js +228 -211
- package/dist/project-problems.js +81 -69
- package/dist/proposal-model.js +163 -126
- package/dist/recent-choices.js +25 -25
- package/dist/refresher.js +44 -49
- package/dist/rename-model.js +113 -113
- package/dist/rename.js +321 -233
- package/dist/rendered-docs.d.ts +4 -2
- package/dist/rendered-docs.js +384 -318
- package/dist/rendering-context.js +5 -3
- package/dist/rendering.js +22 -4
- package/dist/review-group.js +42 -39
- package/dist/row-host.d.ts +4 -2
- package/dist/row-host.js +90 -78
- package/dist/selection-ranges.js +21 -17
- package/dist/semantic-delta.js +22 -19
- package/dist/semantic-model.js +86 -73
- package/dist/semantic-tokens.js +201 -162
- package/dist/shortcut-keys.js +16 -10
- package/dist/signature-model.js +34 -28
- package/dist/signature.js +177 -129
- package/dist/snippet-field-transforms.js +118 -106
- package/dist/snippet-indent.js +48 -43
- package/dist/snippet-range-order.js +11 -11
- package/dist/snippet-session.js +703 -667
- package/dist/snippet-transform-client.js +59 -59
- package/dist/snippet-transform-format.js +285 -263
- package/dist/snippet-transform-protocol.js +1 -1
- package/dist/snippet-transform-queue.js +163 -153
- package/dist/snippet-transform-worker.js +42 -35
- package/dist/snippet-variable-names.js +1 -36
- package/dist/snippet-variables.js +53 -63
- package/dist/snippet.js +477 -405
- package/dist/split-alignment.js +47 -35
- package/dist/split-scroll.js +42 -40
- package/dist/symbol-links.js +33 -25
- package/dist/symbol-picker-model.js +126 -116
- package/dist/symbol-picker.js +98 -59
- package/dist/symbols.js +117 -88
- package/dist/testing.js +248 -165
- package/dist/timers.js +35 -30
- package/dist/use-panel-body.js +49 -8
- package/dist/use-problem-counts.js +29 -15
- package/dist/view-state.js +54 -33
- package/dist/word-diff.js +18 -18
- package/dist/workspace-edit.js +300 -249
- package/package.json +6 -6
- package/src/CallHierarchyPanel.tsx +2 -2
- package/src/DiffView.tsx +3 -3
- package/src/FindReplace.tsx +2 -2
- package/src/LanguagePopups.tsx +2 -0
- package/src/PeekPanel.tsx +3 -3
- package/src/RenderedDocs.tsx +9 -10
- package/src/SymbolPicker.tsx +2 -2
- package/src/diff-overlays.tsx +6 -4
- package/src/locales/en.json +38 -38
- package/src/locales/nl.json +41 -41
- package/src/rendered-docs.ts +14 -3
- package/src/row-host.ts +14 -3
package/dist/RenameCard.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
2
|
import { useLayoutEffect, useRef, useState } from 'react';
|
|
3
3
|
import { createPortal } from 'react-dom';
|
|
4
4
|
import { useTranslation } from 'react-i18next';
|
|
@@ -7,109 +7,703 @@ import { fileUriToPath } from '@adecore/lsp';
|
|
|
7
7
|
import { Button, Icon } from '@adecore/ui';
|
|
8
8
|
import { formatNumber } from '@adecore/ui/format';
|
|
9
9
|
import { basenameOf, relativeTo } from './paths.js';
|
|
10
|
-
import { AnchoredPopup } from
|
|
10
|
+
import { AnchoredPopup } from "./AnchoredPopup.js";
|
|
11
11
|
import { keepFocusOutOfList } from './popup-focus.js';
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
13
|
const CARD_ATTRIBUTE = 'data-rename-card';
|
|
13
14
|
/* Whether the focus moved to something that belongs to the rename, which is not leaving it. */
|
|
14
15
|
function staysInside(target) {
|
|
15
|
-
|
|
16
|
+
return target instanceof Element && target.closest(`[${CARD_ATTRIBUTE}]`) !== null;
|
|
16
17
|
}
|
|
17
18
|
/*
|
|
18
19
|
* Suggested names from the host, in a list under the input; a press fills the input and the
|
|
19
20
|
* typed name stays what Enter applies. While it is up the card says only its two keys.
|
|
20
21
|
*/
|
|
21
|
-
function Suggestions(
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
function Suggestions(t0) {
|
|
23
|
+
const $ = _c(30);
|
|
24
|
+
const {
|
|
25
|
+
names,
|
|
26
|
+
active,
|
|
27
|
+
onPick,
|
|
28
|
+
onFocusBack
|
|
29
|
+
} = t0;
|
|
30
|
+
const {
|
|
31
|
+
t
|
|
32
|
+
} = useTranslation("editor");
|
|
33
|
+
let t1;
|
|
34
|
+
if ($[0] !== onFocusBack) {
|
|
35
|
+
t1 = keepFocusOutOfList(onFocusBack);
|
|
36
|
+
$[0] = onFocusBack;
|
|
37
|
+
$[1] = t1;
|
|
38
|
+
} else {
|
|
39
|
+
t1 = $[1];
|
|
40
|
+
}
|
|
41
|
+
let t2;
|
|
42
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
43
|
+
t2 = /*#__PURE__*/_jsx(Icon, {
|
|
44
|
+
icon: Sparkles,
|
|
45
|
+
size: 12,
|
|
46
|
+
className: "shrink-0"
|
|
47
|
+
});
|
|
48
|
+
$[2] = t2;
|
|
49
|
+
} else {
|
|
50
|
+
t2 = $[2];
|
|
51
|
+
}
|
|
52
|
+
let t3;
|
|
53
|
+
if ($[3] !== t) {
|
|
54
|
+
t3 = t("language.rename.suggestions");
|
|
55
|
+
$[3] = t;
|
|
56
|
+
$[4] = t3;
|
|
57
|
+
} else {
|
|
58
|
+
t3 = $[4];
|
|
59
|
+
}
|
|
60
|
+
let t4;
|
|
61
|
+
if ($[5] !== t3) {
|
|
62
|
+
t4 = /*#__PURE__*/_jsxs("div", {
|
|
63
|
+
className: "flex items-center gap-1.5 px-2.25 pt-1.25 pb-1 text-xs font-semibold text-text-faint",
|
|
64
|
+
children: [t2, t3]
|
|
65
|
+
});
|
|
66
|
+
$[5] = t3;
|
|
67
|
+
$[6] = t4;
|
|
68
|
+
} else {
|
|
69
|
+
t4 = $[6];
|
|
70
|
+
}
|
|
71
|
+
let t5;
|
|
72
|
+
if ($[7] !== active || $[8] !== names || $[9] !== onPick) {
|
|
73
|
+
let t6;
|
|
74
|
+
if ($[11] !== active || $[12] !== onPick) {
|
|
75
|
+
t6 = (name, index) => /*#__PURE__*/_jsxs("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
tabIndex: -1,
|
|
78
|
+
className: `flex h-6.5 items-center gap-2 rounded-md px-2.25 text-left font-mono text-code text-text ${index === active ? "bg-accent/20" : "hover:bg-surface-hover"}`,
|
|
79
|
+
onClick: () => onPick(name),
|
|
80
|
+
children: [/*#__PURE__*/_jsx(Icon, {
|
|
81
|
+
icon: Sparkles,
|
|
82
|
+
size: 12,
|
|
83
|
+
className: `shrink-0 ${index === active ? "text-accent" : "text-text-faint"}`
|
|
84
|
+
}), name]
|
|
85
|
+
}, name);
|
|
86
|
+
$[11] = active;
|
|
87
|
+
$[12] = onPick;
|
|
88
|
+
$[13] = t6;
|
|
89
|
+
} else {
|
|
90
|
+
t6 = $[13];
|
|
91
|
+
}
|
|
92
|
+
t5 = names.map(t6);
|
|
93
|
+
$[7] = active;
|
|
94
|
+
$[8] = names;
|
|
95
|
+
$[9] = onPick;
|
|
96
|
+
$[10] = t5;
|
|
97
|
+
} else {
|
|
98
|
+
t5 = $[10];
|
|
99
|
+
}
|
|
100
|
+
let t6;
|
|
101
|
+
if ($[14] !== t) {
|
|
102
|
+
t6 = t("language.rename.rename");
|
|
103
|
+
$[14] = t;
|
|
104
|
+
$[15] = t6;
|
|
105
|
+
} else {
|
|
106
|
+
t6 = $[15];
|
|
107
|
+
}
|
|
108
|
+
let t7;
|
|
109
|
+
if ($[16] !== t6) {
|
|
110
|
+
t7 = /*#__PURE__*/_jsxs("span", {
|
|
111
|
+
children: ["\u21B5 ", t6]
|
|
112
|
+
});
|
|
113
|
+
$[16] = t6;
|
|
114
|
+
$[17] = t7;
|
|
115
|
+
} else {
|
|
116
|
+
t7 = $[17];
|
|
117
|
+
}
|
|
118
|
+
let t8;
|
|
119
|
+
if ($[18] !== t) {
|
|
120
|
+
t8 = t("language.rename.useSuggestion");
|
|
121
|
+
$[18] = t;
|
|
122
|
+
$[19] = t8;
|
|
123
|
+
} else {
|
|
124
|
+
t8 = $[19];
|
|
125
|
+
}
|
|
126
|
+
let t9;
|
|
127
|
+
if ($[20] !== t8) {
|
|
128
|
+
t9 = /*#__PURE__*/_jsxs("span", {
|
|
129
|
+
children: ["\u21E5 ", t8]
|
|
130
|
+
});
|
|
131
|
+
$[20] = t8;
|
|
132
|
+
$[21] = t9;
|
|
133
|
+
} else {
|
|
134
|
+
t9 = $[21];
|
|
135
|
+
}
|
|
136
|
+
let t10;
|
|
137
|
+
if ($[22] !== t7 || $[23] !== t9) {
|
|
138
|
+
t10 = /*#__PURE__*/_jsxs("div", {
|
|
139
|
+
className: "mt-1 flex gap-3 border-t border-border px-2.25 pt-1.75 pb-0.75 text-xs text-text-muted",
|
|
140
|
+
children: [t7, t9]
|
|
141
|
+
});
|
|
142
|
+
$[22] = t7;
|
|
143
|
+
$[23] = t9;
|
|
144
|
+
$[24] = t10;
|
|
145
|
+
} else {
|
|
146
|
+
t10 = $[24];
|
|
147
|
+
}
|
|
148
|
+
let t11;
|
|
149
|
+
if ($[25] !== t1 || $[26] !== t10 || $[27] !== t4 || $[28] !== t5) {
|
|
150
|
+
t11 = /*#__PURE__*/_jsxs("div", {
|
|
151
|
+
className: "flex w-[250px] flex-col p-1.25",
|
|
152
|
+
...t1,
|
|
153
|
+
children: [t4, t5, t10]
|
|
154
|
+
});
|
|
155
|
+
$[25] = t1;
|
|
156
|
+
$[26] = t10;
|
|
157
|
+
$[27] = t4;
|
|
158
|
+
$[28] = t5;
|
|
159
|
+
$[29] = t11;
|
|
160
|
+
} else {
|
|
161
|
+
t11 = $[29];
|
|
162
|
+
}
|
|
163
|
+
return t11;
|
|
24
164
|
}
|
|
25
|
-
function Hints(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
165
|
+
function Hints(t0) {
|
|
166
|
+
const $ = _c(12);
|
|
167
|
+
const {
|
|
168
|
+
view,
|
|
169
|
+
active,
|
|
170
|
+
onPick,
|
|
171
|
+
onFocusBack
|
|
172
|
+
} = t0;
|
|
173
|
+
const {
|
|
174
|
+
t
|
|
175
|
+
} = useTranslation("editor");
|
|
176
|
+
const {
|
|
177
|
+
occurrences
|
|
178
|
+
} = view;
|
|
179
|
+
let t1;
|
|
180
|
+
if ($[0] !== view.error) {
|
|
181
|
+
t1 = view.error !== null && /*#__PURE__*/_jsx("div", {
|
|
182
|
+
role: "alert",
|
|
183
|
+
className: "max-w-[420px] px-2.5 py-1.5 text-xs text-status-error",
|
|
184
|
+
children: view.error
|
|
185
|
+
});
|
|
186
|
+
$[0] = view.error;
|
|
187
|
+
$[1] = t1;
|
|
188
|
+
} else {
|
|
189
|
+
t1 = $[1];
|
|
190
|
+
}
|
|
191
|
+
let t2;
|
|
192
|
+
if ($[2] !== active || $[3] !== occurrences || $[4] !== onFocusBack || $[5] !== onPick || $[6] !== t || $[7] !== view.suggestions) {
|
|
193
|
+
t2 = view.suggestions.length > 0 ? /*#__PURE__*/_jsx(Suggestions, {
|
|
194
|
+
names: view.suggestions,
|
|
195
|
+
active: active,
|
|
196
|
+
onPick: onPick,
|
|
197
|
+
onFocusBack: onFocusBack
|
|
198
|
+
}) : /*#__PURE__*/_jsxs("div", {
|
|
199
|
+
className: "flex items-center gap-3 px-2.5 py-1.5 text-xs whitespace-nowrap text-text-muted",
|
|
200
|
+
children: [occurrences !== null && /*#__PURE__*/_jsx("span", {
|
|
201
|
+
children: occurrences.files > 1 ? t("language.rename.occurrencesFiles", {
|
|
202
|
+
count: occurrences.count,
|
|
203
|
+
formatted: formatNumber(occurrences.count),
|
|
204
|
+
files: formatNumber(occurrences.files)
|
|
205
|
+
}) : t("language.rename.occurrences", {
|
|
206
|
+
count: occurrences.count,
|
|
207
|
+
formatted: formatNumber(occurrences.count)
|
|
208
|
+
})
|
|
209
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
210
|
+
children: ["\u21B5 ", t("language.rename.rename")]
|
|
211
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
212
|
+
children: ["\u21E7\u21B5 ", t("language.rename.preview")]
|
|
213
|
+
})]
|
|
214
|
+
});
|
|
215
|
+
$[2] = active;
|
|
216
|
+
$[3] = occurrences;
|
|
217
|
+
$[4] = onFocusBack;
|
|
218
|
+
$[5] = onPick;
|
|
219
|
+
$[6] = t;
|
|
220
|
+
$[7] = view.suggestions;
|
|
221
|
+
$[8] = t2;
|
|
222
|
+
} else {
|
|
223
|
+
t2 = $[8];
|
|
224
|
+
}
|
|
225
|
+
let t3;
|
|
226
|
+
if ($[9] !== t1 || $[10] !== t2) {
|
|
227
|
+
t3 = /*#__PURE__*/_jsxs("div", {
|
|
228
|
+
className: "flex flex-col",
|
|
229
|
+
children: [t1, t2]
|
|
230
|
+
});
|
|
231
|
+
$[9] = t1;
|
|
232
|
+
$[10] = t2;
|
|
233
|
+
$[11] = t3;
|
|
234
|
+
} else {
|
|
235
|
+
t3 = $[11];
|
|
236
|
+
}
|
|
237
|
+
return t3;
|
|
35
238
|
}
|
|
36
|
-
function Preview(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
239
|
+
function Preview(t0) {
|
|
240
|
+
const $ = _c(36);
|
|
241
|
+
const {
|
|
242
|
+
language,
|
|
243
|
+
view
|
|
244
|
+
} = t0;
|
|
245
|
+
const {
|
|
246
|
+
t
|
|
247
|
+
} = useTranslation("editor");
|
|
248
|
+
const folder = language.project.folder;
|
|
249
|
+
let t1;
|
|
250
|
+
if ($[0] !== view.operations) {
|
|
251
|
+
t1 = view.operations ?? [];
|
|
252
|
+
$[0] = view.operations;
|
|
253
|
+
$[1] = t1;
|
|
254
|
+
} else {
|
|
255
|
+
t1 = $[1];
|
|
256
|
+
}
|
|
257
|
+
const operations = t1;
|
|
258
|
+
let t2;
|
|
259
|
+
if ($[2] !== folder) {
|
|
260
|
+
t2 = uri => {
|
|
261
|
+
const path = fileUriToPath(uri);
|
|
262
|
+
return path === null ? uri : relativeTo(path, folder);
|
|
43
263
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
264
|
+
$[2] = folder;
|
|
265
|
+
$[3] = t2;
|
|
266
|
+
} else {
|
|
267
|
+
t2 = $[3];
|
|
268
|
+
}
|
|
269
|
+
const shownPath = t2;
|
|
270
|
+
let t3;
|
|
271
|
+
if ($[4] !== folder || $[5] !== view.files) {
|
|
272
|
+
let t4;
|
|
273
|
+
if ($[7] !== folder) {
|
|
274
|
+
t4 = file => {
|
|
275
|
+
const path_0 = fileUriToPath(file.uri);
|
|
276
|
+
const shown = path_0 === null ? file.uri : relativeTo(path_0, folder);
|
|
277
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
278
|
+
className: "border-b border-border last:border-b-0",
|
|
279
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
280
|
+
className: "flex items-center gap-2 px-3 py-1.5 text-xs",
|
|
281
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
282
|
+
className: "font-medium",
|
|
283
|
+
children: path_0 === null ? shown : basenameOf(path_0)
|
|
284
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
285
|
+
className: "min-w-0 truncate text-text-faint",
|
|
286
|
+
children: shown
|
|
287
|
+
})]
|
|
288
|
+
}), /*#__PURE__*/_jsx("div", {
|
|
289
|
+
className: "flex flex-col gap-px px-1 pb-1.5 font-mono text-code",
|
|
290
|
+
children: file.rows.map(_temp2)
|
|
291
|
+
})]
|
|
292
|
+
}, file.uri);
|
|
293
|
+
};
|
|
294
|
+
$[7] = folder;
|
|
295
|
+
$[8] = t4;
|
|
296
|
+
} else {
|
|
297
|
+
t4 = $[8];
|
|
298
|
+
}
|
|
299
|
+
t3 = view.files.map(t4);
|
|
300
|
+
$[4] = folder;
|
|
301
|
+
$[5] = view.files;
|
|
302
|
+
$[6] = t3;
|
|
303
|
+
} else {
|
|
304
|
+
t3 = $[6];
|
|
305
|
+
}
|
|
306
|
+
let t4;
|
|
307
|
+
if ($[9] !== operations || $[10] !== shownPath || $[11] !== t) {
|
|
308
|
+
t4 = operations.length > 0 && /*#__PURE__*/_jsx("div", {
|
|
309
|
+
className: "flex flex-col gap-px border-b border-border px-3 py-1.5 text-xs last:border-b-0",
|
|
310
|
+
children: operations.map((operation, index) => /*#__PURE__*/_jsxs("div", {
|
|
311
|
+
className: "flex items-center gap-2",
|
|
312
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
313
|
+
className: "shrink-0 font-medium",
|
|
314
|
+
children: t(`language.rename.operations.${operation.kind}`)
|
|
315
|
+
}), /*#__PURE__*/_jsxs("span", {
|
|
316
|
+
className: "min-w-0 truncate text-text-faint",
|
|
317
|
+
children: [shownPath(operation.uri), operation.newUri === undefined ? "" : ` \u2192 ${shownPath(operation.newUri)}`]
|
|
318
|
+
})]
|
|
319
|
+
}, `${operation.kind}:${operation.uri}:${index}`))
|
|
320
|
+
});
|
|
321
|
+
$[9] = operations;
|
|
322
|
+
$[10] = shownPath;
|
|
323
|
+
$[11] = t;
|
|
324
|
+
$[12] = t4;
|
|
325
|
+
} else {
|
|
326
|
+
t4 = $[12];
|
|
327
|
+
}
|
|
328
|
+
let t5;
|
|
329
|
+
if ($[13] !== t3 || $[14] !== t4) {
|
|
330
|
+
t5 = /*#__PURE__*/_jsxs("div", {
|
|
331
|
+
className: "max-h-[320px] overflow-y-auto",
|
|
332
|
+
children: [t3, t4]
|
|
333
|
+
});
|
|
334
|
+
$[13] = t3;
|
|
335
|
+
$[14] = t4;
|
|
336
|
+
$[15] = t5;
|
|
337
|
+
} else {
|
|
338
|
+
t5 = $[15];
|
|
339
|
+
}
|
|
340
|
+
let t6;
|
|
341
|
+
if ($[16] !== language.rename) {
|
|
342
|
+
t6 = () => language.rename.cancel();
|
|
343
|
+
$[16] = language.rename;
|
|
344
|
+
$[17] = t6;
|
|
345
|
+
} else {
|
|
346
|
+
t6 = $[17];
|
|
347
|
+
}
|
|
348
|
+
let t7;
|
|
349
|
+
if ($[18] !== t) {
|
|
350
|
+
t7 = t("language.rename.cancel");
|
|
351
|
+
$[18] = t;
|
|
352
|
+
$[19] = t7;
|
|
353
|
+
} else {
|
|
354
|
+
t7 = $[19];
|
|
355
|
+
}
|
|
356
|
+
let t8;
|
|
357
|
+
if ($[20] !== t6 || $[21] !== t7) {
|
|
358
|
+
t8 = /*#__PURE__*/_jsx(Button, {
|
|
359
|
+
size: "xs",
|
|
360
|
+
variant: "ghost",
|
|
361
|
+
onClick: t6,
|
|
362
|
+
children: t7
|
|
363
|
+
});
|
|
364
|
+
$[20] = t6;
|
|
365
|
+
$[21] = t7;
|
|
366
|
+
$[22] = t8;
|
|
367
|
+
} else {
|
|
368
|
+
t8 = $[22];
|
|
369
|
+
}
|
|
370
|
+
let t9;
|
|
371
|
+
if ($[23] !== language.rename) {
|
|
372
|
+
t9 = () => void language.rename.confirm();
|
|
373
|
+
$[23] = language.rename;
|
|
374
|
+
$[24] = t9;
|
|
375
|
+
} else {
|
|
376
|
+
t9 = $[24];
|
|
377
|
+
}
|
|
378
|
+
let t10;
|
|
379
|
+
if ($[25] !== t) {
|
|
380
|
+
t10 = t("language.rename.apply");
|
|
381
|
+
$[25] = t;
|
|
382
|
+
$[26] = t10;
|
|
383
|
+
} else {
|
|
384
|
+
t10 = $[26];
|
|
385
|
+
}
|
|
386
|
+
let t11;
|
|
387
|
+
if ($[27] !== t10 || $[28] !== t9) {
|
|
388
|
+
t11 = /*#__PURE__*/_jsx(Button, {
|
|
389
|
+
size: "xs",
|
|
390
|
+
variant: "primary",
|
|
391
|
+
onClick: t9,
|
|
392
|
+
children: t10
|
|
393
|
+
});
|
|
394
|
+
$[27] = t10;
|
|
395
|
+
$[28] = t9;
|
|
396
|
+
$[29] = t11;
|
|
397
|
+
} else {
|
|
398
|
+
t11 = $[29];
|
|
399
|
+
}
|
|
400
|
+
let t12;
|
|
401
|
+
if ($[30] !== t11 || $[31] !== t8) {
|
|
402
|
+
t12 = /*#__PURE__*/_jsxs("div", {
|
|
403
|
+
className: "flex items-center justify-end gap-2 border-t border-border p-2",
|
|
404
|
+
children: [t8, t11]
|
|
405
|
+
});
|
|
406
|
+
$[30] = t11;
|
|
407
|
+
$[31] = t8;
|
|
408
|
+
$[32] = t12;
|
|
409
|
+
} else {
|
|
410
|
+
t12 = $[32];
|
|
411
|
+
}
|
|
412
|
+
let t13;
|
|
413
|
+
if ($[33] !== t12 || $[34] !== t5) {
|
|
414
|
+
t13 = /*#__PURE__*/_jsxs("div", {
|
|
415
|
+
className: "flex w-[520px] max-w-full flex-col",
|
|
416
|
+
onPointerDown: _temp,
|
|
417
|
+
children: [t5, t12]
|
|
418
|
+
});
|
|
419
|
+
$[33] = t12;
|
|
420
|
+
$[34] = t5;
|
|
421
|
+
$[35] = t13;
|
|
422
|
+
} else {
|
|
423
|
+
t13 = $[35];
|
|
424
|
+
}
|
|
425
|
+
return t13;
|
|
49
426
|
}
|
|
50
427
|
/*
|
|
51
428
|
* The rename of a symbol: an input over the symbol itself, and under it either the count of its places with
|
|
52
429
|
* the keys, or after Shift+Enter the lines the rename would change. The input keeps the focus the whole time,
|
|
53
430
|
* so Enter and Escape mean the same in both, and the focus leaving the card means the person went elsewhere.
|
|
54
431
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
432
|
+
function _temp2(row) {
|
|
433
|
+
return /*#__PURE__*/_jsxs("div", {
|
|
434
|
+
className: "flex flex-col gap-px",
|
|
435
|
+
children: [/*#__PURE__*/_jsxs("div", {
|
|
436
|
+
className: "flex gap-2 rounded-sm bg-status-error/10 px-1.5 whitespace-pre",
|
|
437
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
438
|
+
className: "w-8 shrink-0 text-right text-text-faint",
|
|
439
|
+
children: row.line
|
|
440
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
441
|
+
className: "min-w-0 truncate",
|
|
442
|
+
children: row.before
|
|
443
|
+
})]
|
|
444
|
+
}), /*#__PURE__*/_jsxs("div", {
|
|
445
|
+
className: "flex gap-2 rounded-sm bg-status-idle/10 px-1.5 whitespace-pre",
|
|
446
|
+
children: [/*#__PURE__*/_jsx("span", {
|
|
447
|
+
className: "w-8 shrink-0"
|
|
448
|
+
}), /*#__PURE__*/_jsx("span", {
|
|
449
|
+
className: "min-w-0 truncate",
|
|
450
|
+
children: row.after
|
|
451
|
+
})]
|
|
452
|
+
})]
|
|
453
|
+
}, row.line);
|
|
454
|
+
}
|
|
455
|
+
function _temp(event) {
|
|
456
|
+
return event.preventDefault();
|
|
457
|
+
}
|
|
458
|
+
export function RenameCard(t0) {
|
|
459
|
+
const $ = _c(47);
|
|
460
|
+
const {
|
|
461
|
+
language,
|
|
462
|
+
view,
|
|
463
|
+
rect,
|
|
464
|
+
endRect
|
|
465
|
+
} = t0;
|
|
466
|
+
const input = useRef(null);
|
|
467
|
+
const [value, setValue] = useState(view.placeholder);
|
|
468
|
+
const [active, setActive] = useState(0);
|
|
469
|
+
let t1;
|
|
470
|
+
let t2;
|
|
471
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
472
|
+
t1 = () => {
|
|
473
|
+
input.current?.focus();
|
|
474
|
+
input.current?.select();
|
|
475
|
+
};
|
|
476
|
+
t2 = [];
|
|
477
|
+
$[0] = t1;
|
|
478
|
+
$[1] = t2;
|
|
479
|
+
} else {
|
|
480
|
+
t1 = $[0];
|
|
481
|
+
t2 = $[1];
|
|
482
|
+
}
|
|
483
|
+
useLayoutEffect(t1, t2);
|
|
484
|
+
let t3;
|
|
485
|
+
if ($[2] !== language.rename) {
|
|
486
|
+
t3 = function fill(name) {
|
|
487
|
+
setValue(name);
|
|
488
|
+
language.rename.edited();
|
|
489
|
+
input.current?.focus();
|
|
490
|
+
};
|
|
491
|
+
$[2] = language.rename;
|
|
492
|
+
$[3] = t3;
|
|
493
|
+
} else {
|
|
494
|
+
t3 = $[3];
|
|
495
|
+
}
|
|
496
|
+
const fill = t3;
|
|
497
|
+
let t4;
|
|
498
|
+
if ($[4] !== active || $[5] !== fill || $[6] !== language.rename || $[7] !== value || $[8] !== view.busy || $[9] !== view.phase || $[10] !== view.suggestions) {
|
|
499
|
+
t4 = function onKeyDown(event) {
|
|
500
|
+
const names = view.phase === "input" ? view.suggestions : [];
|
|
501
|
+
if (names.length > 0 && !event.nativeEvent.isComposing && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
|
|
502
|
+
const step = event.key === "ArrowDown" ? 1 : event.key === "ArrowUp" ? -1 : 0;
|
|
503
|
+
if (step !== 0 || event.key === "Tab") {
|
|
504
|
+
event.preventDefault();
|
|
505
|
+
event.stopPropagation();
|
|
506
|
+
if (event.key === "Tab") {
|
|
507
|
+
fill(names[Math.min(active, names.length - 1)]);
|
|
508
|
+
} else {
|
|
509
|
+
setActive((active + step + names.length) % names.length);
|
|
510
|
+
}
|
|
511
|
+
return;
|
|
88
512
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
513
|
+
}
|
|
514
|
+
if (event.key === "Escape") {
|
|
515
|
+
event.preventDefault();
|
|
516
|
+
event.stopPropagation();
|
|
517
|
+
language.rename.cancel();
|
|
518
|
+
} else {
|
|
519
|
+
if (event.key === "Enter" && !event.nativeEvent.isComposing) {
|
|
520
|
+
event.preventDefault();
|
|
521
|
+
event.stopPropagation();
|
|
522
|
+
if (view.phase === "preview") {
|
|
523
|
+
language.rename.confirm();
|
|
524
|
+
} else {
|
|
525
|
+
if (!view.busy) {
|
|
526
|
+
language.rename.submit(value, event.shiftKey);
|
|
97
527
|
}
|
|
528
|
+
}
|
|
98
529
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
530
|
+
}
|
|
531
|
+
};
|
|
532
|
+
$[4] = active;
|
|
533
|
+
$[5] = fill;
|
|
534
|
+
$[6] = language.rename;
|
|
535
|
+
$[7] = value;
|
|
536
|
+
$[8] = view.busy;
|
|
537
|
+
$[9] = view.phase;
|
|
538
|
+
$[10] = view.suggestions;
|
|
539
|
+
$[11] = t4;
|
|
540
|
+
} else {
|
|
541
|
+
t4 = $[11];
|
|
542
|
+
}
|
|
543
|
+
const onKeyDown = t4;
|
|
544
|
+
const symbolWidth = endRect === null ? 0 : Math.max(0, endRect.left - rect.left);
|
|
545
|
+
let t5;
|
|
546
|
+
if ($[12] === Symbol.for("react.memo_cache_sentinel")) {
|
|
547
|
+
t5 = {
|
|
548
|
+
[CARD_ATTRIBUTE]: ""
|
|
549
|
+
};
|
|
550
|
+
$[12] = t5;
|
|
551
|
+
} else {
|
|
552
|
+
t5 = $[12];
|
|
553
|
+
}
|
|
554
|
+
const t6 = view.phase === "preview" ? view.name : value;
|
|
555
|
+
const t7 = view.phase === "preview" || view.busy;
|
|
556
|
+
const t8 = Math.round(rect.left) - 1;
|
|
557
|
+
const t9 = Math.round(rect.top) - 2;
|
|
558
|
+
const t10 = Math.round(rect.bottom - rect.top) + 4;
|
|
559
|
+
const t11 = Math.round(symbolWidth) + 2;
|
|
560
|
+
let t12;
|
|
561
|
+
if ($[13] !== t10 || $[14] !== t11 || $[15] !== t8 || $[16] !== t9) {
|
|
562
|
+
t12 = {
|
|
563
|
+
left: t8,
|
|
564
|
+
top: t9,
|
|
565
|
+
height: t10,
|
|
566
|
+
minWidth: t11
|
|
567
|
+
};
|
|
568
|
+
$[13] = t10;
|
|
569
|
+
$[14] = t11;
|
|
570
|
+
$[15] = t8;
|
|
571
|
+
$[16] = t9;
|
|
572
|
+
$[17] = t12;
|
|
573
|
+
} else {
|
|
574
|
+
t12 = $[17];
|
|
575
|
+
}
|
|
576
|
+
let t13;
|
|
577
|
+
if ($[18] !== language.rename) {
|
|
578
|
+
t13 = event_0 => {
|
|
579
|
+
setValue(event_0.target.value);
|
|
580
|
+
language.rename.edited();
|
|
581
|
+
};
|
|
582
|
+
$[18] = language.rename;
|
|
583
|
+
$[19] = t13;
|
|
584
|
+
} else {
|
|
585
|
+
t13 = $[19];
|
|
586
|
+
}
|
|
587
|
+
let t14;
|
|
588
|
+
if ($[20] !== language.rename) {
|
|
589
|
+
t14 = event_1 => {
|
|
590
|
+
if (!staysInside(event_1.relatedTarget)) {
|
|
591
|
+
language.rename.cancel();
|
|
592
|
+
}
|
|
593
|
+
};
|
|
594
|
+
$[20] = language.rename;
|
|
595
|
+
$[21] = t14;
|
|
596
|
+
} else {
|
|
597
|
+
t14 = $[21];
|
|
598
|
+
}
|
|
599
|
+
let t15;
|
|
600
|
+
if ($[22] !== onKeyDown || $[23] !== t12 || $[24] !== t13 || $[25] !== t14 || $[26] !== t6 || $[27] !== t7 || $[28] !== view.original) {
|
|
601
|
+
t15 = /*#__PURE__*/_jsx("input", {
|
|
602
|
+
ref: input,
|
|
603
|
+
...t5,
|
|
604
|
+
value: t6,
|
|
605
|
+
readOnly: t7,
|
|
606
|
+
spellCheck: false,
|
|
607
|
+
autoComplete: "off",
|
|
608
|
+
"aria-label": view.original,
|
|
609
|
+
className: "fixed z-(--z-popup) rounded-sm border border-accent bg-surface px-0 font-mono text-(length:--code-font-size) text-text shadow-(--float-shadow) outline-none [font-kerning:none] [field-sizing:content]",
|
|
610
|
+
style: t12,
|
|
611
|
+
onChange: t13,
|
|
612
|
+
onKeyDown: onKeyDown,
|
|
613
|
+
onBlur: t14
|
|
614
|
+
});
|
|
615
|
+
$[22] = onKeyDown;
|
|
616
|
+
$[23] = t12;
|
|
617
|
+
$[24] = t13;
|
|
618
|
+
$[25] = t14;
|
|
619
|
+
$[26] = t6;
|
|
620
|
+
$[27] = t7;
|
|
621
|
+
$[28] = view.original;
|
|
622
|
+
$[29] = t15;
|
|
623
|
+
} else {
|
|
624
|
+
t15 = $[29];
|
|
625
|
+
}
|
|
626
|
+
const t16 = rect.top - 2;
|
|
627
|
+
const t17 = rect.bottom + 2;
|
|
628
|
+
let t18;
|
|
629
|
+
if ($[30] !== rect || $[31] !== t16 || $[32] !== t17) {
|
|
630
|
+
t18 = {
|
|
631
|
+
...rect,
|
|
632
|
+
top: t16,
|
|
633
|
+
bottom: t17
|
|
634
|
+
};
|
|
635
|
+
$[30] = rect;
|
|
636
|
+
$[31] = t16;
|
|
637
|
+
$[32] = t17;
|
|
638
|
+
$[33] = t18;
|
|
639
|
+
} else {
|
|
640
|
+
t18 = $[33];
|
|
641
|
+
}
|
|
642
|
+
let t19;
|
|
643
|
+
let t20;
|
|
644
|
+
if ($[34] === Symbol.for("react.memo_cache_sentinel")) {
|
|
645
|
+
t19 = {
|
|
646
|
+
gap: 2
|
|
647
|
+
};
|
|
648
|
+
t20 = {
|
|
649
|
+
[CARD_ATTRIBUTE]: ""
|
|
650
|
+
};
|
|
651
|
+
$[34] = t19;
|
|
652
|
+
$[35] = t20;
|
|
653
|
+
} else {
|
|
654
|
+
t19 = $[34];
|
|
655
|
+
t20 = $[35];
|
|
656
|
+
}
|
|
657
|
+
let t21;
|
|
658
|
+
if ($[36] !== active || $[37] !== fill || $[38] !== language || $[39] !== view) {
|
|
659
|
+
t21 = /*#__PURE__*/_jsx("div", {
|
|
660
|
+
...t20,
|
|
661
|
+
onPointerDown: _temp3,
|
|
662
|
+
children: view.phase === "preview" ? /*#__PURE__*/_jsx(Preview, {
|
|
663
|
+
language: language,
|
|
664
|
+
view: view
|
|
665
|
+
}) : /*#__PURE__*/_jsx(Hints, {
|
|
666
|
+
view: view,
|
|
667
|
+
active: active,
|
|
668
|
+
onPick: fill,
|
|
669
|
+
onFocusBack: () => input.current?.focus()
|
|
670
|
+
})
|
|
671
|
+
});
|
|
672
|
+
$[36] = active;
|
|
673
|
+
$[37] = fill;
|
|
674
|
+
$[38] = language;
|
|
675
|
+
$[39] = view;
|
|
676
|
+
$[40] = t21;
|
|
677
|
+
} else {
|
|
678
|
+
t21 = $[40];
|
|
679
|
+
}
|
|
680
|
+
let t22;
|
|
681
|
+
if ($[41] !== t18 || $[42] !== t21) {
|
|
682
|
+
t22 = /*#__PURE__*/_jsx(AnchoredPopup, {
|
|
683
|
+
rect: t18,
|
|
684
|
+
overflow: "clip",
|
|
685
|
+
placement: t19,
|
|
686
|
+
children: t21
|
|
687
|
+
});
|
|
688
|
+
$[41] = t18;
|
|
689
|
+
$[42] = t21;
|
|
690
|
+
$[43] = t22;
|
|
691
|
+
} else {
|
|
692
|
+
t22 = $[43];
|
|
693
|
+
}
|
|
694
|
+
let t23;
|
|
695
|
+
if ($[44] !== t15 || $[45] !== t22) {
|
|
696
|
+
t23 = createPortal(/*#__PURE__*/_jsxs(_Fragment, {
|
|
697
|
+
children: [t15, t22]
|
|
698
|
+
}), document.body);
|
|
699
|
+
$[44] = t15;
|
|
700
|
+
$[45] = t22;
|
|
701
|
+
$[46] = t23;
|
|
702
|
+
} else {
|
|
703
|
+
t23 = $[46];
|
|
704
|
+
}
|
|
705
|
+
return t23;
|
|
115
706
|
}
|
|
707
|
+
function _temp3(event_2) {
|
|
708
|
+
return event_2.preventDefault();
|
|
709
|
+
}
|