@adecore/editor-react 0.31.11 → 0.32.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.
Files changed (137) hide show
  1. package/dist/AnchoredPopup.js +73 -19
  2. package/dist/AttributionCard.js +162 -4
  3. package/dist/BaselineStatus.js +62 -8
  4. package/dist/CallHierarchyPanel.js +977 -60
  5. package/dist/ChangeReview.js +76 -25
  6. package/dist/CodeAuthorsCard.js +314 -14
  7. package/dist/CompletionPopup.js +490 -83
  8. package/dist/DiffView.js +548 -181
  9. package/dist/EditorContextMenu.js +352 -34
  10. package/dist/EditorView.js +276 -99
  11. package/dist/FindReplace.js +525 -67
  12. package/dist/HoverCard.js +378 -38
  13. package/dist/HoverSections.js +367 -56
  14. package/dist/LanguagePopups.js +95 -34
  15. package/dist/Markdown.js +41 -6
  16. package/dist/PanelResizeHandle.js +199 -66
  17. package/dist/PathText.js +49 -7
  18. package/dist/PeekPanel.js +675 -72
  19. package/dist/PickPopup.js +304 -34
  20. package/dist/RenameCard.js +679 -85
  21. package/dist/RenderedDocs.js +329 -58
  22. package/dist/SignatureCard.js +91 -7
  23. package/dist/SplitDiffView.js +344 -254
  24. package/dist/SymbolPicker.js +440 -85
  25. package/dist/call-hierarchy-model.js +102 -68
  26. package/dist/call-hierarchy.js +458 -359
  27. package/dist/code-actions-model.js +88 -76
  28. package/dist/code-actions.js +372 -283
  29. package/dist/code-authors.js +64 -55
  30. package/dist/code-vision-model.js +134 -127
  31. package/dist/code-vision.js +224 -206
  32. package/dist/completion-call.js +94 -67
  33. package/dist/completion-model.js +334 -244
  34. package/dist/completion.js +840 -649
  35. package/dist/conflict-model.js +35 -29
  36. package/dist/context-menu-rows.js +42 -17
  37. package/dist/context-menu.js +64 -46
  38. package/dist/definition-link.js +88 -85
  39. package/dist/diagnostics-model.js +74 -55
  40. package/dist/diagnostics.js +121 -100
  41. package/dist/diff-expansion.js +38 -35
  42. package/dist/diff-overlays.js +144 -22
  43. package/dist/diff-syntax.js +65 -42
  44. package/dist/diff-wordmarks.js +26 -23
  45. package/dist/doc-comment-model.js +265 -216
  46. package/dist/editor-language.js +177 -152
  47. package/dist/error-message.js +2 -2
  48. package/dist/find-query.js +49 -36
  49. package/dist/folding.js +81 -62
  50. package/dist/format-on-type.js +86 -67
  51. package/dist/highlight-layers.js +19 -20
  52. package/dist/highlights.js +105 -83
  53. package/dist/history.js +44 -38
  54. package/dist/holder.js +18 -18
  55. package/dist/host-types.js +1 -1
  56. package/dist/hover-content.js +167 -129
  57. package/dist/hover.js +285 -245
  58. package/dist/index.js +10 -10
  59. package/dist/inlay-hints.js +369 -324
  60. package/dist/key-priority.js +34 -31
  61. package/dist/language-ids.js +45 -42
  62. package/dist/line-edits.js +74 -28
  63. package/dist/line-text.js +18 -3
  64. package/dist/locales/en.json +38 -38
  65. package/dist/locales/nl.json +41 -41
  66. package/dist/models.js +1 -1
  67. package/dist/navigation-history.js +40 -41
  68. package/dist/navigation.js +141 -123
  69. package/dist/panel-size.js +8 -8
  70. package/dist/patch-decorations.js +236 -160
  71. package/dist/patch-layout.js +331 -262
  72. package/dist/paths.js +3 -3
  73. package/dist/peek-model.js +86 -69
  74. package/dist/peek.js +254 -192
  75. package/dist/pick.js +164 -157
  76. package/dist/popup-focus.js +5 -5
  77. package/dist/popup-placement.js +36 -21
  78. package/dist/popups.js +13 -13
  79. package/dist/project-language.js +228 -211
  80. package/dist/project-problems.js +81 -69
  81. package/dist/proposal-model.js +163 -126
  82. package/dist/recent-choices.js +25 -25
  83. package/dist/refresher.js +44 -49
  84. package/dist/rename-model.js +113 -113
  85. package/dist/rename.js +321 -233
  86. package/dist/rendered-docs.d.ts +4 -2
  87. package/dist/rendered-docs.js +384 -318
  88. package/dist/rendering-context.js +5 -3
  89. package/dist/rendering.js +22 -4
  90. package/dist/review-group.js +42 -39
  91. package/dist/row-host.d.ts +4 -2
  92. package/dist/row-host.js +90 -78
  93. package/dist/selection-ranges.js +21 -17
  94. package/dist/semantic-delta.js +22 -19
  95. package/dist/semantic-model.js +86 -73
  96. package/dist/semantic-tokens.js +201 -162
  97. package/dist/shortcut-keys.js +16 -10
  98. package/dist/signature-model.js +34 -28
  99. package/dist/signature.js +177 -129
  100. package/dist/snippet-field-transforms.js +118 -106
  101. package/dist/snippet-indent.js +48 -43
  102. package/dist/snippet-range-order.js +11 -11
  103. package/dist/snippet-session.js +703 -667
  104. package/dist/snippet-transform-client.js +59 -59
  105. package/dist/snippet-transform-format.js +285 -263
  106. package/dist/snippet-transform-protocol.js +1 -1
  107. package/dist/snippet-transform-queue.js +163 -153
  108. package/dist/snippet-transform-worker.js +42 -35
  109. package/dist/snippet-variable-names.js +1 -36
  110. package/dist/snippet-variables.js +53 -63
  111. package/dist/snippet.js +477 -405
  112. package/dist/split-alignment.js +47 -35
  113. package/dist/split-scroll.js +42 -40
  114. package/dist/symbol-links.js +33 -25
  115. package/dist/symbol-picker-model.js +126 -116
  116. package/dist/symbol-picker.js +98 -59
  117. package/dist/symbols.js +117 -88
  118. package/dist/testing.js +248 -165
  119. package/dist/timers.js +35 -30
  120. package/dist/use-panel-body.js +49 -8
  121. package/dist/use-problem-counts.js +29 -15
  122. package/dist/view-state.js +54 -33
  123. package/dist/word-diff.js +18 -18
  124. package/dist/workspace-edit.js +300 -249
  125. package/package.json +6 -6
  126. package/src/CallHierarchyPanel.tsx +2 -2
  127. package/src/DiffView.tsx +3 -3
  128. package/src/FindReplace.tsx +2 -2
  129. package/src/LanguagePopups.tsx +2 -0
  130. package/src/PeekPanel.tsx +3 -3
  131. package/src/RenderedDocs.tsx +9 -10
  132. package/src/SymbolPicker.tsx +2 -2
  133. package/src/diff-overlays.tsx +6 -4
  134. package/src/locales/en.json +38 -38
  135. package/src/locales/nl.json +41 -41
  136. package/src/rendered-docs.ts +14 -3
  137. package/src/row-host.ts +14 -3
@@ -1,4 +1,4 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
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 './AnchoredPopup.js';
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
- return target instanceof Element && target.closest(`[${CARD_ATTRIBUTE}]`) !== null;
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({ names, active, onPick, onFocusBack }) {
22
- const { t } = useTranslation('editor');
23
- return (_jsxs("div", { className: "flex w-[250px] flex-col p-1.25", ...keepFocusOutOfList(onFocusBack), children: [_jsxs("div", { className: "flex items-center gap-1.5 px-2.25 pt-1.25 pb-1 text-xs font-semibold text-text-faint", children: [_jsx(Icon, { icon: Sparkles, size: 12, className: "shrink-0" }), t('language.rename.suggestions')] }), names.map((name, index) => (_jsxs("button", { type: "button", tabIndex: -1, 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'}`, onClick: () => onPick(name), children: [_jsx(Icon, { icon: Sparkles, size: 12, className: `shrink-0 ${index === active ? 'text-accent' : 'text-text-faint'}` }), name] }, name))), _jsxs("div", { className: "mt-1 flex gap-3 border-t border-border px-2.25 pt-1.75 pb-0.75 text-xs text-text-muted", children: [_jsxs("span", { children: ["\u21B5 ", t('language.rename.rename')] }), _jsxs("span", { children: ["\u21E5 ", t('language.rename.useSuggestion')] })] })] }));
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({ view, active, onPick, onFocusBack }) {
26
- const { t } = useTranslation('editor');
27
- const { occurrences } = view;
28
- return (_jsxs("div", { className: "flex flex-col", children: [view.error !== null && (_jsx("div", { role: "alert", className: "max-w-[420px] px-2.5 py-1.5 text-xs text-status-error", children: view.error })), view.suggestions.length > 0 ? (_jsx(Suggestions, { names: view.suggestions, active: active, onPick: onPick, onFocusBack: onFocusBack })) : (_jsxs("div", { className: "flex items-center gap-3 px-2.5 py-1.5 text-xs whitespace-nowrap text-text-muted", children: [occurrences !== null && (_jsx("span", { children: occurrences.files > 1
29
- ? t('language.rename.occurrencesFiles', {
30
- count: occurrences.count,
31
- formatted: formatNumber(occurrences.count),
32
- files: formatNumber(occurrences.files)
33
- })
34
- : t('language.rename.occurrences', { count: occurrences.count, formatted: formatNumber(occurrences.count) }) })), _jsxs("span", { children: ["\u21B5 ", t('language.rename.rename')] }), _jsxs("span", { children: ["\u21E7\u21B5 ", t('language.rename.preview')] })] }))] }));
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({ language, view }) {
37
- const { t } = useTranslation('editor');
38
- const folder = language.project.folder;
39
- const operations = view.operations ?? [];
40
- const shownPath = (uri) => {
41
- const path = fileUriToPath(uri);
42
- return path === null ? uri : relativeTo(path, folder);
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
- return (_jsxs("div", { className: "flex w-[520px] max-w-full flex-col", onPointerDown: (event) => event.preventDefault(), children: [_jsxs("div", { className: "max-h-[320px] overflow-y-auto", children: [view.files.map((file) => {
45
- const path = fileUriToPath(file.uri);
46
- const shown = path === null ? file.uri : relativeTo(path, folder);
47
- return (_jsxs("div", { className: "border-b border-border last:border-b-0", children: [_jsxs("div", { className: "flex items-center gap-2 px-3 py-1.5 text-xs", children: [_jsx("span", { className: "font-medium", children: path === null ? shown : basenameOf(path) }), _jsx("span", { className: "min-w-0 truncate text-text-faint", children: shown })] }), _jsx("div", { className: "flex flex-col gap-px px-1 pb-1.5 font-mono text-code", children: file.rows.map((row) => (_jsxs("div", { className: "flex flex-col gap-px", children: [_jsxs("div", { className: "flex gap-2 rounded-sm bg-status-error/10 px-1.5 whitespace-pre", children: [_jsx("span", { className: "w-8 shrink-0 text-right text-text-faint", children: row.line }), _jsx("span", { className: "min-w-0 truncate", children: row.before })] }), _jsxs("div", { className: "flex gap-2 rounded-sm bg-status-idle/10 px-1.5 whitespace-pre", children: [_jsx("span", { className: "w-8 shrink-0" }), _jsx("span", { className: "min-w-0 truncate", children: row.after })] })] }, row.line))) })] }, file.uri));
48
- }), operations.length > 0 && (_jsx("div", { className: "flex flex-col gap-px border-b border-border px-3 py-1.5 text-xs last:border-b-0", children: operations.map((operation, index) => (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "shrink-0 font-medium", children: t(`language.rename.operations.${operation.kind}`) }), _jsxs("span", { className: "min-w-0 truncate text-text-faint", children: [shownPath(operation.uri), operation.newUri === undefined ? '' : ` \u2192 ${shownPath(operation.newUri)}`] })] }, `${operation.kind}:${operation.uri}:${index}`))) }))] }), _jsxs("div", { className: "flex items-center justify-end gap-2 border-t border-border p-2", children: [_jsx(Button, { size: "xs", variant: "ghost", onClick: () => language.rename.cancel(), children: t('language.rename.cancel') }), _jsx(Button, { size: "xs", variant: "primary", onClick: () => void language.rename.confirm(), children: t('language.rename.apply') })] })] }));
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
- export function RenameCard({ language, view, rect, endRect }) {
56
- const input = useRef(null);
57
- const [value, setValue] = useState(view.placeholder);
58
- const [active, setActive] = useState(0);
59
- useLayoutEffect(() => {
60
- input.current?.focus();
61
- input.current?.select();
62
- }, []);
63
- function fill(name) {
64
- setValue(name);
65
- language.rename.edited();
66
- input.current?.focus();
67
- }
68
- function onKeyDown(event) {
69
- const names = view.phase === 'input' ? view.suggestions : [];
70
- if (names.length > 0 && !event.nativeEvent.isComposing && !event.shiftKey && !event.altKey && !event.ctrlKey && !event.metaKey) {
71
- const step = event.key === 'ArrowDown' ? 1 : event.key === 'ArrowUp' ? -1 : 0;
72
- if (step !== 0 || event.key === 'Tab') {
73
- event.preventDefault();
74
- event.stopPropagation();
75
- if (event.key === 'Tab') {
76
- fill(names[Math.min(active, names.length - 1)]);
77
- }
78
- else {
79
- setActive((active + step + names.length) % names.length);
80
- }
81
- return;
82
- }
83
- }
84
- if (event.key === 'Escape') {
85
- event.preventDefault();
86
- event.stopPropagation();
87
- language.rename.cancel();
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
- else if (event.key === 'Enter' && !event.nativeEvent.isComposing) {
90
- event.preventDefault();
91
- event.stopPropagation();
92
- if (view.phase === 'preview') {
93
- void language.rename.confirm();
94
- }
95
- else if (!view.busy) {
96
- void language.rename.submit(value, event.shiftKey);
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
- const symbolWidth = endRect === null ? 0 : Math.max(0, endRect.left - rect.left);
101
- return createPortal(_jsxs(_Fragment, { children: [_jsx("input", { ref: input, [CARD_ATTRIBUTE]: '', value: view.phase === 'preview' ? view.name : value, readOnly: view.phase === 'preview' || view.busy, spellCheck: false, autoComplete: "off", "aria-label": view.original, 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]", style: {
102
- // Only the border stands beside the name: any padding would cover the character after it, often a `(`.
103
- left: Math.round(rect.left) - 1,
104
- top: Math.round(rect.top) - 2,
105
- height: Math.round(rect.bottom - rect.top) + 4,
106
- minWidth: Math.round(symbolWidth) + 2
107
- }, onChange: (event) => {
108
- setValue(event.target.value);
109
- language.rename.edited();
110
- }, onKeyDown: onKeyDown, onBlur: (event) => {
111
- if (!staysInside(event.relatedTarget)) {
112
- language.rename.cancel();
113
- }
114
- } }), _jsx(AnchoredPopup, { rect: { ...rect, top: rect.top - 2, bottom: rect.bottom + 2 }, overflow: "clip", placement: { gap: 2 }, children: _jsx("div", { [CARD_ATTRIBUTE]: '', onPointerDown: (event) => event.preventDefault(), children: view.phase === 'preview' ? (_jsx(Preview, { language: language, view: view })) : (_jsx(Hints, { view: view, active: active, onPick: fill, onFocusBack: () => input.current?.focus() })) }) })] }), document.body);
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
+ }