@adecore/editor-react 0.31.12 → 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
package/dist/PickPopup.js CHANGED
@@ -1,47 +1,317 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { useId, useLayoutEffect, useRef } from 'react';
3
3
  import { createPortal } from 'react-dom';
4
- import { PathText } from './PathText.js';
4
+ import { PathText } from "./PathText.js";
5
5
  import { keepFocusOutOfList } 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
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)';
8
- function PreviewLines({ preview }) {
9
- return (_jsxs("div", { className: "flex flex-col gap-px border-t border-border p-1 font-mono text-code", children: [preview.removed.map((line, index) => (_jsxs("div", { className: "flex gap-2 rounded-sm bg-status-error/10 px-1.5 whitespace-pre", children: [_jsx("span", { className: "text-status-error", children: "\u2212" }), _jsx("span", { className: "min-w-0 truncate", children: line })] }, `-${index}`))), preview.added.map((line, index) => (_jsxs("div", { className: "flex gap-2 rounded-sm bg-status-idle/10 px-1.5 whitespace-pre", children: [_jsx("span", { className: "text-status-idle", children: "+" }), _jsx("span", { className: "min-w-0 truncate", children: line })] }, `+${index}`))), preview.note !== null && _jsx("div", { className: "px-1.5 font-sans text-xs text-text-muted", children: preview.note }), preview.refusal !== undefined && (_jsx("div", { role: "alert", className: "px-1.5 py-0.5 font-sans text-xs text-status-error", children: preview.refusal }))] }));
9
+ function PreviewLines(t0) {
10
+ const $ = _c(13);
11
+ const {
12
+ preview
13
+ } = t0;
14
+ let t1;
15
+ if ($[0] !== preview.removed) {
16
+ t1 = preview.removed.map(_temp);
17
+ $[0] = preview.removed;
18
+ $[1] = t1;
19
+ } else {
20
+ t1 = $[1];
21
+ }
22
+ let t2;
23
+ if ($[2] !== preview.added) {
24
+ t2 = preview.added.map(_temp2);
25
+ $[2] = preview.added;
26
+ $[3] = t2;
27
+ } else {
28
+ t2 = $[3];
29
+ }
30
+ let t3;
31
+ if ($[4] !== preview.note) {
32
+ t3 = preview.note !== null && /*#__PURE__*/_jsx("div", {
33
+ className: "px-1.5 font-sans text-xs text-text-muted",
34
+ children: preview.note
35
+ });
36
+ $[4] = preview.note;
37
+ $[5] = t3;
38
+ } else {
39
+ t3 = $[5];
40
+ }
41
+ let t4;
42
+ if ($[6] !== preview.refusal) {
43
+ t4 = preview.refusal !== undefined && /*#__PURE__*/_jsx("div", {
44
+ role: "alert",
45
+ className: "px-1.5 py-0.5 font-sans text-xs text-status-error",
46
+ children: preview.refusal
47
+ });
48
+ $[6] = preview.refusal;
49
+ $[7] = t4;
50
+ } else {
51
+ t4 = $[7];
52
+ }
53
+ let t5;
54
+ if ($[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
55
+ t5 = /*#__PURE__*/_jsxs("div", {
56
+ className: "flex flex-col gap-px border-t border-border p-1 font-mono text-code",
57
+ children: [t1, t2, t3, t4]
58
+ });
59
+ $[8] = t1;
60
+ $[9] = t2;
61
+ $[10] = t3;
62
+ $[11] = t4;
63
+ $[12] = t5;
64
+ } else {
65
+ t5 = $[12];
66
+ }
67
+ return t5;
10
68
  }
11
69
  /*
12
70
  * The list of an editor's pick feature under the character it belongs to. A press on a row never takes
13
71
  * the focus from the editor, so the keys keep going to it while the list is open.
14
72
  */
15
- export function PickPopup({ language, view, rect }) {
16
- const listId = useId();
17
- const card = useRef(null);
18
- const activeRow = useRef(null);
19
- // Every render: the character moves with the scroll, and the list changes size with its preview.
20
- useLayoutEffect(() => {
21
- const element = card.current;
22
- if (element === null) {
23
- return;
24
- }
25
- const placed = placePopup(rect, { width: element.offsetWidth, height: element.offsetHeight }, { width: window.innerWidth, height: window.innerHeight }, { gap: 2 });
26
- element.style.left = `${Math.round(placed.left)}px`;
27
- element.style.top = `${Math.round(placed.top)}px`;
28
- element.style.maxHeight = `${Math.floor(placed.maxHeight)}px`;
29
- element.style.visibility = 'visible';
30
- });
31
- useLayoutEffect(() => {
32
- activeRow.current?.scrollIntoView({ block: 'nearest' });
33
- }, [view.active]);
34
- const optionIds = new Map();
73
+ function _temp2(line_0, index_0) {
74
+ return /*#__PURE__*/_jsxs("div", {
75
+ className: "flex gap-2 rounded-sm bg-status-idle/10 px-1.5 whitespace-pre",
76
+ children: [/*#__PURE__*/_jsx("span", {
77
+ className: "text-status-idle",
78
+ children: "+"
79
+ }), /*#__PURE__*/_jsx("span", {
80
+ className: "min-w-0 truncate",
81
+ children: line_0
82
+ })]
83
+ }, `+${index_0}`);
84
+ }
85
+ function _temp(line, index) {
86
+ return /*#__PURE__*/_jsxs("div", {
87
+ className: "flex gap-2 rounded-sm bg-status-error/10 px-1.5 whitespace-pre",
88
+ children: [/*#__PURE__*/_jsx("span", {
89
+ className: "text-status-error",
90
+ children: "\u2212"
91
+ }), /*#__PURE__*/_jsx("span", {
92
+ className: "min-w-0 truncate",
93
+ children: line
94
+ })]
95
+ }, `-${index}`);
96
+ }
97
+ export function PickPopup(t0) {
98
+ const $ = _c(39);
99
+ const {
100
+ language,
101
+ view,
102
+ rect
103
+ } = t0;
104
+ const listId = useId();
105
+ const card = useRef(null);
106
+ const activeRow = useRef(null);
107
+ let t1;
108
+ if ($[0] !== rect) {
109
+ t1 = () => {
110
+ const element = card.current;
111
+ if (element === null) {
112
+ return;
113
+ }
114
+ const placed = placePopup(rect, {
115
+ width: element.offsetWidth,
116
+ height: element.offsetHeight
117
+ }, {
118
+ width: window.innerWidth,
119
+ height: window.innerHeight
120
+ }, {
121
+ gap: 2
122
+ });
123
+ element.style.left = `${Math.round(placed.left)}px`;
124
+ element.style.top = `${Math.round(placed.top)}px`;
125
+ element.style.maxHeight = `${Math.floor(placed.maxHeight)}px`;
126
+ element.style.visibility = "visible";
127
+ };
128
+ $[0] = rect;
129
+ $[1] = t1;
130
+ } else {
131
+ t1 = $[1];
132
+ }
133
+ useLayoutEffect(t1);
134
+ let t2;
135
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
136
+ t2 = () => {
137
+ activeRow.current?.scrollIntoView({
138
+ block: "nearest"
139
+ });
140
+ };
141
+ $[2] = t2;
142
+ } else {
143
+ t2 = $[2];
144
+ }
145
+ let t3;
146
+ if ($[3] !== view.active) {
147
+ t3 = [view.active];
148
+ $[3] = view.active;
149
+ $[4] = t3;
150
+ } else {
151
+ t3 = $[4];
152
+ }
153
+ useLayoutEffect(t2, t3);
154
+ let optionIds;
155
+ if ($[5] !== listId || $[6] !== view.groups) {
156
+ optionIds = new Map();
35
157
  for (const group of view.groups) {
36
- for (const row of group.rows) {
37
- optionIds.set(row.id, `${listId}-option-${optionIds.size}`);
38
- }
158
+ for (const row of group.rows) {
159
+ optionIds.set(row.id, `${listId}-option-${optionIds.size}`);
160
+ }
39
161
  }
40
- const activeId = optionIds.get(view.active);
41
- // The focus stays in the text, so the input is what names the list and its active option.
42
- useLayoutEffect(() => {
43
- language.editor.setInputPopup({ controls: listId, activeDescendant: activeId });
44
- return () => language.editor.setInputPopup(null);
45
- }, [language, listId, activeId]);
46
- return createPortal(_jsxs("div", { ref: card, className: CARD, style: { visibility: 'hidden' }, onPointerDown: (event) => event.preventDefault(), ...keepFocusOutOfList(() => language.editor.focus()), children: [view.title !== null && _jsx("div", { className: "border-b border-border px-3 py-1.5 text-xs text-text-muted", children: view.title }), _jsx("div", { id: listId, role: "listbox", className: "min-h-0 flex-1 overflow-y-auto p-1", children: view.groups.map((group, groupIndex) => (_jsxs("div", { role: "group", className: "flex flex-col", children: [group.title !== null && _jsx("div", { className: "px-2 pt-1.5 pb-0.5 text-xs font-medium text-text-faint", children: group.title }), group.rows.map((row) => (_jsxs("button", { id: optionIds.get(row.id), ref: row.id === view.active ? activeRow : undefined, type: "button", role: "option", tabIndex: -1, "aria-selected": row.id === view.active, "data-active": row.id === view.active, className: "flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-xs cursor-row", onClick: () => language.pick.choose(row.id), children: [_jsx("span", { className: row.path ? 'shrink-0' : 'min-w-0 truncate', children: row.label }), row.path ? (_jsx(PathText, { path: row.detail, className: "ml-auto font-mono text-text-faint" })) : (_jsx("span", { className: "ml-auto shrink-0 font-mono text-text-faint", children: row.id === view.active && row.detail === '' ? '↵' : row.detail }))] }, row.id)))] }, group.title ?? groupIndex))) }), view.preview !== null && _jsx(PreviewLines, { preview: view.preview })] }), document.body);
162
+ $[5] = listId;
163
+ $[6] = view.groups;
164
+ $[7] = optionIds;
165
+ } else {
166
+ optionIds = $[7];
167
+ }
168
+ let t4;
169
+ if ($[8] !== optionIds || $[9] !== view.active) {
170
+ t4 = optionIds.get(view.active);
171
+ $[8] = optionIds;
172
+ $[9] = view.active;
173
+ $[10] = t4;
174
+ } else {
175
+ t4 = $[10];
176
+ }
177
+ const activeId = t4;
178
+ let t5;
179
+ if ($[11] !== activeId || $[12] !== language.editor || $[13] !== listId) {
180
+ t5 = () => {
181
+ language.editor.setInputPopup({
182
+ controls: listId,
183
+ activeDescendant: activeId
184
+ });
185
+ return () => language.editor.setInputPopup(null);
186
+ };
187
+ $[11] = activeId;
188
+ $[12] = language.editor;
189
+ $[13] = listId;
190
+ $[14] = t5;
191
+ } else {
192
+ t5 = $[14];
193
+ }
194
+ let t6;
195
+ if ($[15] !== activeId || $[16] !== language || $[17] !== listId) {
196
+ t6 = [language, listId, activeId];
197
+ $[15] = activeId;
198
+ $[16] = language;
199
+ $[17] = listId;
200
+ $[18] = t6;
201
+ } else {
202
+ t6 = $[18];
203
+ }
204
+ useLayoutEffect(t5, t6);
205
+ let t7;
206
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
207
+ t7 = {
208
+ visibility: "hidden"
209
+ };
210
+ $[19] = t7;
211
+ } else {
212
+ t7 = $[19];
213
+ }
214
+ let t8;
215
+ if ($[20] !== language.editor) {
216
+ t8 = keepFocusOutOfList(() => language.editor.focus());
217
+ $[20] = language.editor;
218
+ $[21] = t8;
219
+ } else {
220
+ t8 = $[21];
221
+ }
222
+ let t9;
223
+ if ($[22] !== view.title) {
224
+ t9 = view.title !== null && /*#__PURE__*/_jsx("div", {
225
+ className: "border-b border-border px-3 py-1.5 text-xs text-text-muted",
226
+ children: view.title
227
+ });
228
+ $[22] = view.title;
229
+ $[23] = t9;
230
+ } else {
231
+ t9 = $[23];
232
+ }
233
+ let t10;
234
+ if ($[24] !== language.pick || $[25] !== optionIds || $[26] !== view.active || $[27] !== view.groups) {
235
+ t10 = view.groups.map((group_0, groupIndex) => /*#__PURE__*/_jsxs("div", {
236
+ role: "group",
237
+ className: "flex flex-col",
238
+ children: [group_0.title !== null && /*#__PURE__*/_jsx("div", {
239
+ className: "px-2 pt-1.5 pb-0.5 text-xs font-medium text-text-faint",
240
+ children: group_0.title
241
+ }), group_0.rows.map(row_0 => /*#__PURE__*/_jsxs("button", {
242
+ id: optionIds.get(row_0.id),
243
+ ref: row_0.id === view.active ? activeRow : undefined,
244
+ type: "button",
245
+ role: "option",
246
+ tabIndex: -1,
247
+ "aria-selected": row_0.id === view.active,
248
+ "data-active": row_0.id === view.active,
249
+ className: "flex h-7 w-full items-center gap-2 rounded-md px-2 text-left text-xs cursor-row",
250
+ onClick: () => language.pick.choose(row_0.id),
251
+ children: [/*#__PURE__*/_jsx("span", {
252
+ className: row_0.path ? "shrink-0" : "min-w-0 truncate",
253
+ children: row_0.label
254
+ }), row_0.path ? /*#__PURE__*/_jsx(PathText, {
255
+ path: row_0.detail,
256
+ className: "ml-auto font-mono text-text-faint"
257
+ }) : /*#__PURE__*/_jsx("span", {
258
+ className: "ml-auto shrink-0 font-mono text-text-faint",
259
+ children: row_0.id === view.active && row_0.detail === "" ? "\u21B5" : row_0.detail
260
+ })]
261
+ }, row_0.id))]
262
+ }, group_0.title ?? groupIndex));
263
+ $[24] = language.pick;
264
+ $[25] = optionIds;
265
+ $[26] = view.active;
266
+ $[27] = view.groups;
267
+ $[28] = t10;
268
+ } else {
269
+ t10 = $[28];
270
+ }
271
+ let t11;
272
+ if ($[29] !== listId || $[30] !== t10) {
273
+ t11 = /*#__PURE__*/_jsx("div", {
274
+ id: listId,
275
+ role: "listbox",
276
+ className: "min-h-0 flex-1 overflow-y-auto p-1",
277
+ children: t10
278
+ });
279
+ $[29] = listId;
280
+ $[30] = t10;
281
+ $[31] = t11;
282
+ } else {
283
+ t11 = $[31];
284
+ }
285
+ let t12;
286
+ if ($[32] !== view.preview) {
287
+ t12 = view.preview !== null && /*#__PURE__*/_jsx(PreviewLines, {
288
+ preview: view.preview
289
+ });
290
+ $[32] = view.preview;
291
+ $[33] = t12;
292
+ } else {
293
+ t12 = $[33];
294
+ }
295
+ let t13;
296
+ if ($[34] !== t11 || $[35] !== t12 || $[36] !== t8 || $[37] !== t9) {
297
+ t13 = createPortal(/*#__PURE__*/_jsxs("div", {
298
+ ref: card,
299
+ className: CARD,
300
+ style: t7,
301
+ onPointerDown: _temp3,
302
+ ...t8,
303
+ children: [t9, t11, t12]
304
+ }), document.body);
305
+ $[34] = t11;
306
+ $[35] = t12;
307
+ $[36] = t8;
308
+ $[37] = t9;
309
+ $[38] = t13;
310
+ } else {
311
+ t13 = $[38];
312
+ }
313
+ return t13;
47
314
  }
315
+ function _temp3(event) {
316
+ return event.preventDefault();
317
+ }