@adecore/editor-react 0.53.2 → 0.54.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 (131) hide show
  1. package/dist/AnchoredPopup.d.ts +1 -1
  2. package/dist/AnchoredPopup.js +27 -12
  3. package/dist/AttributionCard.d.ts +1 -1
  4. package/dist/BaselineStatus.js +1 -1
  5. package/dist/CallHierarchyPanel.js +11 -10
  6. package/dist/ChangeReview.d.ts +1 -1
  7. package/dist/CodeAuthorsCard.js +2 -2
  8. package/dist/CompletionPopup.js +18 -14
  9. package/dist/DiffView.d.ts +2 -2
  10. package/dist/DiffView.js +159 -143
  11. package/dist/EditorContextMenu.js +1 -1
  12. package/dist/EditorView.d.ts +2 -2
  13. package/dist/EditorView.js +97 -81
  14. package/dist/FindReplace.js +3 -3
  15. package/dist/HoverCard.d.ts +3 -3
  16. package/dist/HoverCard.js +3 -3
  17. package/dist/HoverSections.js +1 -1
  18. package/dist/LanguagePopups.js +1 -1
  19. package/dist/Markdown.js +15 -3
  20. package/dist/PeekPanel.js +124 -103
  21. package/dist/PickPopup.js +8 -4
  22. package/dist/RenameCard.js +7 -7
  23. package/dist/RenderedDocs.d.ts +1 -1
  24. package/dist/RenderedDocs.js +1 -1
  25. package/dist/SplitDiffView.js +21 -4
  26. package/dist/SymbolPicker.js +93 -89
  27. package/dist/WrapCard.js +1 -1
  28. package/dist/call-hierarchy.d.ts +1 -1
  29. package/dist/call-hierarchy.js +3 -3
  30. package/dist/code-actions.js +2 -2
  31. package/dist/code-vision.d.ts +1 -1
  32. package/dist/completion-model.d.ts +1 -1
  33. package/dist/completion-model.js +2 -2
  34. package/dist/completion.d.ts +1 -1
  35. package/dist/completion.js +12 -12
  36. package/dist/diagnostics.d.ts +1 -1
  37. package/dist/diagnostics.js +1 -1
  38. package/dist/diff-overlays.js +2 -2
  39. package/dist/editor-language.d.ts +12 -12
  40. package/dist/editor-language.js +10 -10
  41. package/dist/editor-react.css +4 -4
  42. package/dist/highlights.d.ts +1 -1
  43. package/dist/highlights.js +2 -2
  44. package/dist/host-types.d.ts +4 -4
  45. package/dist/hover.js +1 -1
  46. package/dist/inlay-hints.js +1 -1
  47. package/dist/live-templates.js +1 -1
  48. package/dist/markup.js +1 -1
  49. package/dist/navigation.d.ts +1 -1
  50. package/dist/navigation.js +3 -3
  51. package/dist/peek.js +1 -1
  52. package/dist/popups.d.ts +5 -5
  53. package/dist/project-language.d.ts +4 -4
  54. package/dist/project-language.js +5 -5
  55. package/dist/rename.js +1 -1
  56. package/dist/rendered-docs.d.ts +1 -1
  57. package/dist/rendered-docs.js +1 -1
  58. package/dist/shortcut-keys.d.ts +1 -1
  59. package/dist/signature.js +1 -1
  60. package/dist/snippet-field-transforms.d.ts +2 -2
  61. package/dist/snippet-insert.js +3 -3
  62. package/dist/snippet-session.d.ts +2 -2
  63. package/dist/snippet-session.js +5 -5
  64. package/dist/snippet-transform-queue.d.ts +1 -1
  65. package/dist/surround.js +1 -1
  66. package/dist/symbol-picker.js +2 -2
  67. package/dist/templates.js +1 -1
  68. package/dist/use-problem-counts.d.ts +1 -1
  69. package/package.json +6 -6
  70. package/src/AnchoredPopup.tsx +7 -3
  71. package/src/AttributionCard.tsx +1 -1
  72. package/src/BaselineStatus.tsx +1 -1
  73. package/src/CallHierarchyPanel.tsx +13 -12
  74. package/src/ChangeReview.tsx +1 -1
  75. package/src/CodeAuthorsCard.tsx +2 -2
  76. package/src/CompletionPopup.tsx +16 -13
  77. package/src/DiffView.tsx +12 -6
  78. package/src/EditorContextMenu.tsx +2 -2
  79. package/src/EditorView.tsx +14 -6
  80. package/src/FindReplace.tsx +3 -3
  81. package/src/HoverCard.tsx +7 -7
  82. package/src/HoverSections.tsx +1 -1
  83. package/src/LanguagePopups.tsx +3 -3
  84. package/src/Markdown.tsx +13 -2
  85. package/src/PeekPanel.tsx +13 -13
  86. package/src/PickPopup.tsx +6 -5
  87. package/src/RenameCard.tsx +8 -8
  88. package/src/RenderedDocs.tsx +3 -3
  89. package/src/SplitDiffView.tsx +14 -5
  90. package/src/SymbolPicker.tsx +6 -6
  91. package/src/WrapCard.tsx +2 -2
  92. package/src/call-hierarchy.ts +5 -5
  93. package/src/code-actions.ts +3 -3
  94. package/src/code-authors.ts +1 -1
  95. package/src/code-vision.ts +3 -3
  96. package/src/completion-model.ts +3 -3
  97. package/src/completion.ts +15 -15
  98. package/src/diagnostics.ts +4 -4
  99. package/src/diff-overlays.tsx +4 -4
  100. package/src/editor-language.ts +13 -13
  101. package/src/editor-react.css +4 -4
  102. package/src/format-on-type.ts +1 -1
  103. package/src/highlights.ts +3 -3
  104. package/src/host-types.ts +4 -4
  105. package/src/hover.ts +3 -3
  106. package/src/inlay-hints.ts +1 -1
  107. package/src/line-edits.ts +1 -1
  108. package/src/live-templates.ts +2 -2
  109. package/src/markup.ts +2 -2
  110. package/src/navigation.ts +5 -5
  111. package/src/patch-decorations.ts +1 -1
  112. package/src/peek.ts +3 -3
  113. package/src/pick.ts +1 -1
  114. package/src/popups.ts +5 -5
  115. package/src/postfix.ts +1 -1
  116. package/src/project-language.ts +7 -7
  117. package/src/proposal-model.ts +1 -1
  118. package/src/rename.ts +3 -3
  119. package/src/rendered-docs.ts +2 -2
  120. package/src/shortcut-keys.ts +1 -1
  121. package/src/signature.ts +3 -3
  122. package/src/snippet-field-transforms.ts +2 -2
  123. package/src/snippet-insert.ts +3 -3
  124. package/src/snippet-session.ts +7 -7
  125. package/src/snippet-transform-queue.ts +1 -1
  126. package/src/surround.ts +1 -1
  127. package/src/symbol-picker-model.ts +1 -1
  128. package/src/symbol-picker.ts +3 -3
  129. package/src/templates.ts +1 -1
  130. package/src/use-problem-counts.ts +1 -1
  131. package/src/workspace-edit.ts +1 -1
@@ -1,9 +1,10 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { createHolder } from './holder.js';
3
- import { useLayoutEffect, useMemo, useRef, useSyncExternalStore } from 'react';
4
- import { useTranslation } from 'react-i18next';
5
2
  import { DEFAULT_SMART_KEYS, DEFAULT_TODO_WORDS } from '@adecore/editor';
3
+ import { useOverlayScrollbars } from '@adecore/ui';
4
+ import { useLayoutEffect, useMemo, useRef, useState, useSyncExternalStore } from 'react';
5
+ import { useTranslation } from 'react-i18next';
6
6
  import { EditorLanguage } from './editor-language.js';
7
+ import { createHolder } from './holder.js';
7
8
  import { LanguagePopups } from "./LanguagePopups.js";
8
9
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
10
  const DEFAULT_INDENTATION = {
@@ -78,7 +79,7 @@ function applyChangedOptions(editor, before, after) {
78
79
  }
79
80
  }
80
81
  export function EditorView(t0) {
81
- const $ = _c(37);
82
+ const $ = _c(39);
82
83
  const {
83
84
  engine,
84
85
  options,
@@ -126,9 +127,20 @@ export function EditorView(t0) {
126
127
  }
127
128
  const holder = t2;
128
129
  const language = useSyncExternalStore(holder.subscribe, holder.get, holder.get);
130
+ const [scroller, setScroller] = useState(null);
129
131
  let t3;
130
- if ($[6] !== languageOptions || $[7] !== onMount || $[8] !== options || $[9] !== timers) {
131
- t3 = () => {
132
+ if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
133
+ t3 = {
134
+ axis: "both"
135
+ };
136
+ $[6] = t3;
137
+ } else {
138
+ t3 = $[6];
139
+ }
140
+ const scrollbars = useOverlayScrollbars(scroller, t3);
141
+ let t4;
142
+ if ($[7] !== languageOptions || $[8] !== onMount || $[9] !== options || $[10] !== timers) {
143
+ t4 = () => {
132
144
  latest.current = {
133
145
  options,
134
146
  timers,
@@ -136,19 +148,19 @@ export function EditorView(t0) {
136
148
  onMount
137
149
  };
138
150
  };
139
- $[6] = languageOptions;
140
- $[7] = onMount;
141
- $[8] = options;
142
- $[9] = timers;
143
- $[10] = t3;
151
+ $[7] = languageOptions;
152
+ $[8] = onMount;
153
+ $[9] = options;
154
+ $[10] = timers;
155
+ $[11] = t4;
144
156
  } else {
145
- t3 = $[10];
157
+ t4 = $[11];
146
158
  }
147
- useLayoutEffect(t3);
148
- let t4;
159
+ useLayoutEffect(t4);
149
160
  let t5;
150
- if ($[11] !== engine || $[12] !== languageId || $[13] !== project || $[14] !== uri) {
151
- t4 = () => {
161
+ let t6;
162
+ if ($[12] !== engine || $[13] !== languageId || $[14] !== project || $[15] !== uri) {
163
+ t5 = () => {
152
164
  const host = element.current;
153
165
  if (host === null) {
154
166
  return;
@@ -163,32 +175,34 @@ export function EditorView(t0) {
163
175
  });
164
176
  mounted.current = editor;
165
177
  applied.current = inputs.options;
178
+ setScroller(host.querySelector(".se-viewport"));
166
179
  const attached = project === undefined || uri === undefined || languageId === undefined ? null : new EditorLanguage(project, editor, uri, languageId, inputs.timers, inputs.languageOptions);
167
180
  holder.set(attached);
168
181
  const stop = inputs.onMount?.(editor, attached);
169
182
  return () => {
170
183
  mounted.current = null;
184
+ setScroller(null);
171
185
  holder.set(null);
172
186
  stop?.();
173
187
  attached?.dispose();
174
188
  editor.dispose();
175
189
  };
176
190
  };
177
- t5 = [engine, project, uri, languageId, holder];
178
- $[11] = engine;
179
- $[12] = languageId;
180
- $[13] = project;
181
- $[14] = uri;
182
- $[15] = t4;
191
+ t6 = [engine, project, uri, languageId, holder];
192
+ $[12] = engine;
193
+ $[13] = languageId;
194
+ $[14] = project;
195
+ $[15] = uri;
183
196
  $[16] = t5;
197
+ $[17] = t6;
184
198
  } else {
185
- t4 = $[15];
186
199
  t5 = $[16];
200
+ t6 = $[17];
187
201
  }
188
- useLayoutEffect(t4, t5);
189
- let t6;
190
- if ($[17] !== options) {
191
- t6 = () => {
202
+ useLayoutEffect(t5, t6);
203
+ let t7;
204
+ if ($[18] !== options) {
205
+ t7 = () => {
192
206
  const editor_0 = mounted.current;
193
207
  if (editor_0 === null || applied.current === options) {
194
208
  return;
@@ -196,29 +210,29 @@ export function EditorView(t0) {
196
210
  applyChangedOptions(editor_0, applied.current, options);
197
211
  applied.current = options;
198
212
  };
199
- $[17] = options;
200
- $[18] = t6;
213
+ $[18] = options;
214
+ $[19] = t7;
201
215
  } else {
202
- t6 = $[18];
216
+ t7 = $[19];
203
217
  }
204
- useLayoutEffect(t6);
205
- let t7;
206
- if ($[19] !== options.messages) {
207
- t7 = options.messages ?? {};
208
- $[19] = options.messages;
209
- $[20] = t7;
218
+ useLayoutEffect(t7);
219
+ let t8;
220
+ if ($[20] !== options.messages) {
221
+ t8 = options.messages ?? {};
222
+ $[20] = options.messages;
223
+ $[21] = t8;
210
224
  } else {
211
- t7 = $[20];
225
+ t8 = $[21];
212
226
  }
213
227
  const {
214
228
  fold,
215
229
  unfold,
216
230
  noMoreOccurrences
217
- } = t7;
218
- let t8;
231
+ } = t8;
232
+ let t10;
219
233
  let t9;
220
- if ($[21] !== fold || $[22] !== noMoreOccurrences || $[23] !== t || $[24] !== unfold) {
221
- t8 = () => {
234
+ if ($[22] !== fold || $[23] !== noMoreOccurrences || $[24] !== t || $[25] !== unfold) {
235
+ t9 = () => {
222
236
  words.current = t;
223
237
  const localized = foldMessages(t);
224
238
  mounted.current?.setMessages({
@@ -229,69 +243,71 @@ export function EditorView(t0) {
229
243
  })
230
244
  });
231
245
  };
232
- t9 = [t, fold, unfold, noMoreOccurrences];
233
- $[21] = fold;
234
- $[22] = noMoreOccurrences;
235
- $[23] = t;
236
- $[24] = unfold;
237
- $[25] = t8;
238
- $[26] = t9;
246
+ t10 = [t, fold, unfold, noMoreOccurrences];
247
+ $[22] = fold;
248
+ $[23] = noMoreOccurrences;
249
+ $[24] = t;
250
+ $[25] = unfold;
251
+ $[26] = t10;
252
+ $[27] = t9;
239
253
  } else {
240
- t8 = $[25];
241
- t9 = $[26];
254
+ t10 = $[26];
255
+ t9 = $[27];
242
256
  }
243
- useLayoutEffect(t8, t9);
244
- let t10;
245
- if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
246
- t10 = {
257
+ useLayoutEffect(t9, t10);
258
+ let t11;
259
+ if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
260
+ t11 = {
247
261
  position: "relative",
248
262
  minHeight: 0
249
263
  };
250
- $[27] = t10;
264
+ $[28] = t11;
251
265
  } else {
252
- t10 = $[27];
266
+ t11 = $[28];
253
267
  }
254
- let t11;
255
- if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
256
- t11 = /*#__PURE__*/_jsx("div", {
268
+ let t12;
269
+ if ($[29] === Symbol.for("react.memo_cache_sentinel")) {
270
+ t12 = /*#__PURE__*/_jsx("div", {
257
271
  ref: element,
258
272
  style: {
259
273
  position: "absolute",
260
- inset: 0
274
+ inset: 0,
275
+ isolation: "isolate"
261
276
  }
262
277
  });
263
- $[28] = t11;
278
+ $[29] = t12;
264
279
  } else {
265
- t11 = $[28];
280
+ t12 = $[29];
266
281
  }
267
- let t12;
268
- if ($[29] !== contextMenuItems || $[30] !== hoverFooter || $[31] !== language) {
269
- t12 = language !== null && /*#__PURE__*/_jsx(LanguagePopups, {
282
+ let t13;
283
+ if ($[30] !== contextMenuItems || $[31] !== hoverFooter || $[32] !== language) {
284
+ t13 = language !== null && /*#__PURE__*/_jsx(LanguagePopups, {
270
285
  language: language,
271
286
  contextMenuItems: contextMenuItems,
272
287
  hoverFooter: hoverFooter
273
288
  });
274
- $[29] = contextMenuItems;
275
- $[30] = hoverFooter;
276
- $[31] = language;
277
- $[32] = t12;
289
+ $[30] = contextMenuItems;
290
+ $[31] = hoverFooter;
291
+ $[32] = language;
292
+ $[33] = t13;
278
293
  } else {
279
- t12 = $[32];
294
+ t13 = $[33];
280
295
  }
281
- let t13;
282
- if ($[33] !== className || $[34] !== ref || $[35] !== t12) {
283
- t13 = /*#__PURE__*/_jsxs("div", {
296
+ let t14;
297
+ if ($[34] !== className || $[35] !== ref || $[36] !== scrollbars || $[37] !== t13) {
298
+ t14 = /*#__PURE__*/_jsxs("div", {
284
299
  className: className,
285
300
  ref: ref,
286
- style: t10,
287
- children: [t11, t12]
301
+ style: t11,
302
+ children: [t12, scrollbars, t13]
288
303
  });
289
- $[33] = className;
290
- $[34] = ref;
291
- $[35] = t12;
292
- $[36] = t13;
304
+ $[34] = className;
305
+ $[35] = ref;
306
+ $[36] = scrollbars;
307
+ $[37] = t13;
308
+ $[38] = t14;
293
309
  } else {
294
- t13 = $[36];
310
+ t14 = $[38];
295
311
  }
296
- return t13;
312
+ return t14;
297
313
  }
@@ -1,9 +1,9 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { useEffect, useLayoutEffect, useRef, useState } from 'react';
3
- import { useTranslation } from 'react-i18next';
2
+ import { MAX_REPLACEMENT_PAGE, MAX_REPLACEMENT_CHARACTERS } from '@adecore/editor';
4
3
  import { Button } from '@adecore/ui';
5
4
  import { formatNumber } from '@adecore/ui/format';
6
- import { MAX_REPLACEMENT_PAGE, MAX_REPLACEMENT_CHARACTERS } from '@adecore/editor';
5
+ import { useEffect, useLayoutEffect, useRef, useState } from 'react';
6
+ import { useTranslation } from 'react-i18next';
7
7
  import { compileFind, EMPTY_FIND_QUERY } from './find-query.js';
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
9
  export function FindReplace(t0) {
@@ -1,8 +1,8 @@
1
- import type { ReactNode } from 'react';
2
- import { type Location } from '@adecore/lsp';
3
1
  import type { EditorPosition } from '@adecore/editor';
4
- import type { EditorLanguage } from './editor-language.ts';
2
+ import { type Location } from '@adecore/lsp';
3
+ import type { ReactNode } from 'react';
5
4
  import { type Problem } from './diagnostics-model.ts';
5
+ import type { EditorLanguage } from './editor-language.ts';
6
6
  import type { HoverInfo } from './popups.ts';
7
7
  export declare function DefinitionPlace({ definition, uri, folder }: {
8
8
  definition: Location;
package/dist/HoverCard.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { useTranslation } from 'react-i18next';
3
- import { CircleX, Info, TriangleAlert } from 'lucide-react';
4
2
  import { fileUriToPath } from '@adecore/lsp';
5
3
  import { Button, Icon, Tooltip } from '@adecore/ui';
6
4
  import { formatNumber } from '@adecore/ui/format';
7
- import { basenameOf } from './paths.js';
5
+ import { CircleX, Info, TriangleAlert } from 'lucide-react';
6
+ import { useTranslation } from 'react-i18next';
8
7
  import { codeLabelOf, severityOf } from './diagnostics-model.js';
9
8
  import { SymbolSections } from "./HoverSections.js";
9
+ import { basenameOf } from './paths.js';
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
11
  const SEVERITY_ICONS = {
12
12
  error: CircleX,
@@ -1,6 +1,6 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
- import { useEffect, useState } from 'react';
3
2
  import { Tooltip } from '@adecore/ui';
3
+ import { useEffect, useState } from 'react';
4
4
  import { BaselineStatus } from "./BaselineStatus.js";
5
5
  import { hoverSectionsOf, markdownParts } from './hover-content.js';
6
6
  import { Markdown } from "./Markdown.js";
@@ -10,8 +10,8 @@ import { PeekPanel } from "./PeekPanel.js";
10
10
  import { PickPopup } from "./PickPopup.js";
11
11
  import { RenameCard } from "./RenameCard.js";
12
12
  import { RenderedDocs } from "./RenderedDocs.js";
13
- import { SymbolPicker } from "./SymbolPicker.js";
14
13
  import { SignatureCard } from "./SignatureCard.js";
14
+ import { SymbolPicker } from "./SymbolPicker.js";
15
15
  import { WrapCard } from "./WrapCard.js";
16
16
  /*
17
17
  * Every card a language feature opens over the editor. Each feature keeps its own state and these
package/dist/Markdown.js CHANGED
@@ -1,10 +1,22 @@
1
1
  import { c as _c } from "react/compiler-runtime";
2
+ import { ScrollArea } from '@adecore/ui';
2
3
  import ReactMarkdown from 'react-markdown';
3
- import remarkGfm from 'remark-gfm';
4
4
  import remarkBreaks from 'remark-breaks';
5
+ import remarkGfm from 'remark-gfm';
6
+ /* A code block wider than its card scrolls on its own. */
7
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
8
+ const CODE_BLOCKS = {
9
+ pre: ({
10
+ children
11
+ }) => /*#__PURE__*/_jsx(ScrollArea, {
12
+ axis: "both",
13
+ render: /*#__PURE__*/_jsx("pre", {}),
14
+ children: children
15
+ })
16
+ };
5
17
  /* An image becomes its alt text, so a comment cannot make the editor fetch a page of its choosing. */
6
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
7
18
  const WITHOUT_IMAGES = {
19
+ ...CODE_BLOCKS,
8
20
  img: ({
9
21
  alt
10
22
  }) => /*#__PURE__*/_jsx(_Fragment, {
@@ -25,7 +37,7 @@ export function Markdown(t0) {
25
37
  } else {
26
38
  t2 = $[0];
27
39
  }
28
- const t3 = images ? undefined : WITHOUT_IMAGES;
40
+ const t3 = images ? CODE_BLOCKS : WITHOUT_IMAGES;
29
41
  let t4;
30
42
  if ($[1] !== t3 || $[2] !== text) {
31
43
  t4 = /*#__PURE__*/_jsx("div", {