@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,76 +1,387 @@
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 { useEffect, useState } from 'react';
3
3
  import { Tooltip } from '@adecore/ui';
4
- import { BaselineStatus } from './BaselineStatus.js';
4
+ import { BaselineStatus } from "./BaselineStatus.js";
5
5
  import { hoverSectionsOf, markdownParts } from './hover-content.js';
6
- import { Markdown } from './Markdown.js';
6
+ import { Markdown } from "./Markdown.js";
7
7
  import { useEditorRendering } from './rendering-context.js';
8
8
  import { declaredNameOf, linkTypeNames } from './symbol-links.js';
9
9
  /* Code as the viewer colors it, plain until the grammar is in so the card never changes size under the pointer by much. */
10
- export function Signature({ code, language, onName }) {
11
- const { theme, highlight } = useEditorRendering();
12
- const [html, setHtml] = useState(null);
13
- const key = `${language}\0${theme}\0${code}\0${onName !== undefined}`;
14
- // Only whether there are links goes into the highlighting; the handler is read when a name is pressed.
15
- const linked = onName !== undefined;
16
- useEffect(() => {
17
- if (highlight === undefined) {
18
- return;
19
- }
20
- let alive = true;
21
- highlight(code, language, theme)
22
- .then((result) => alive && setHtml({ key, html: linked ? linkTypeNames(result) : result }))
23
- .catch(() => undefined);
24
- return () => {
25
- alive = false;
26
- };
27
- }, [code, language, theme, key, linked, highlight]);
28
- const className = 'font-mono text-code break-words whitespace-pre-wrap [&_.line]:block [&_pre]:m-0 [&_pre]:bg-transparent! [&_pre]:whitespace-pre-wrap [&_code]:font-mono';
29
- // One handler for every name, since the names are part of the highlighted HTML and not elements of ours.
30
- const follow = (event) => {
31
- const name = event.target.closest('[data-symbol]')?.dataset.symbol;
32
- if (name !== undefined && onName !== undefined) {
33
- onName(name);
34
- }
10
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
+ export function Signature(t0) {
12
+ const $ = _c(15);
13
+ const {
14
+ code,
15
+ language,
16
+ onName
17
+ } = t0;
18
+ const {
19
+ theme,
20
+ highlight
21
+ } = useEditorRendering();
22
+ const [html, setHtml] = useState(null);
23
+ const key = `${language}\0${theme}\0${code}\0${onName !== undefined}`;
24
+ const linked = onName !== undefined;
25
+ let t1;
26
+ let t2;
27
+ if ($[0] !== code || $[1] !== highlight || $[2] !== key || $[3] !== language || $[4] !== linked || $[5] !== theme) {
28
+ t1 = () => {
29
+ if (highlight === undefined) {
30
+ return;
31
+ }
32
+ let alive = true;
33
+ highlight(code, language, theme).then(result => alive && setHtml({
34
+ key,
35
+ html: linked ? linkTypeNames(result) : result
36
+ })).catch(_temp);
37
+ return () => {
38
+ alive = false;
39
+ };
35
40
  };
36
- return html?.key === key ? (_jsx("div", { className: className, onClick: follow, dangerouslySetInnerHTML: { __html: html.html } })) : (_jsx("div", { className: className, children: code }));
41
+ t2 = [code, language, theme, key, linked, highlight];
42
+ $[0] = code;
43
+ $[1] = highlight;
44
+ $[2] = key;
45
+ $[3] = language;
46
+ $[4] = linked;
47
+ $[5] = theme;
48
+ $[6] = t1;
49
+ $[7] = t2;
50
+ } else {
51
+ t1 = $[6];
52
+ t2 = $[7];
53
+ }
54
+ useEffect(t1, t2);
55
+ let t3;
56
+ if ($[8] !== onName) {
57
+ t3 = event => {
58
+ const name = event.target.closest("[data-symbol]")?.dataset.symbol;
59
+ if (name !== undefined && onName !== undefined) {
60
+ onName(name);
61
+ }
62
+ };
63
+ $[8] = onName;
64
+ $[9] = t3;
65
+ } else {
66
+ t3 = $[9];
67
+ }
68
+ const follow = t3;
69
+ let t4;
70
+ if ($[10] !== code || $[11] !== follow || $[12] !== html || $[13] !== key) {
71
+ t4 = html?.key === key ? /*#__PURE__*/_jsx("div", {
72
+ className: "font-mono text-code break-words whitespace-pre-wrap [&_.line]:block [&_pre]:m-0 [&_pre]:bg-transparent! [&_pre]:whitespace-pre-wrap [&_code]:font-mono",
73
+ onClick: follow,
74
+ dangerouslySetInnerHTML: {
75
+ __html: html.html
76
+ }
77
+ }) : /*#__PURE__*/_jsx("div", {
78
+ className: "font-mono text-code break-words whitespace-pre-wrap [&_.line]:block [&_pre]:m-0 [&_pre]:bg-transparent! [&_pre]:whitespace-pre-wrap [&_code]:font-mono",
79
+ children: code
80
+ });
81
+ $[10] = code;
82
+ $[11] = follow;
83
+ $[12] = html;
84
+ $[13] = key;
85
+ $[14] = t4;
86
+ } else {
87
+ t4 = $[14];
88
+ }
89
+ return t4;
37
90
  }
38
91
  /* A docblock's tags as rows: the tag once beside each run of the same tag, so a list of parameters reads as one. */
39
- export function DocTags({ tags }) {
40
- return (_jsx("div", { className: "grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs/[18px] select-text", children: tags.map((tag, index) => (_jsxs("div", { className: "contents", children: [_jsx("span", { className: "font-mono text-text-faint", children: tags[index - 1]?.name === tag.name ? '' : `@${tag.name}` }), _jsx("div", { className: "min-w-0 break-words text-text-muted [&_.adecore-editor-markdown]:text-xs [&_code]:bg-transparent! [&_code]:p-0! [&_p]:m-0", children: _jsx(Markdown, { text: tag.markdown }) })] }, index))) }));
92
+ function _temp() {}
93
+ export function DocTags(t0) {
94
+ const $ = _c(4);
95
+ const {
96
+ tags
97
+ } = t0;
98
+ let t1;
99
+ if ($[0] !== tags) {
100
+ t1 = tags.map((tag, index) => /*#__PURE__*/_jsxs("div", {
101
+ className: "contents",
102
+ children: [/*#__PURE__*/_jsx("span", {
103
+ className: "font-mono text-text-faint",
104
+ children: tags[index - 1]?.name === tag.name ? "" : `@${tag.name}`
105
+ }), /*#__PURE__*/_jsx("div", {
106
+ className: "min-w-0 break-words text-text-muted [&_.adecore-editor-markdown]:text-xs [&_code]:bg-transparent! [&_code]:p-0! [&_p]:m-0",
107
+ children: /*#__PURE__*/_jsx(Markdown, {
108
+ text: tag.markdown
109
+ })
110
+ })]
111
+ }, index));
112
+ $[0] = tags;
113
+ $[1] = t1;
114
+ } else {
115
+ t1 = $[1];
116
+ }
117
+ let t2;
118
+ if ($[2] !== t1) {
119
+ t2 = /*#__PURE__*/_jsx("div", {
120
+ className: "grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-0.5 text-xs/[18px] select-text",
121
+ children: t1
122
+ });
123
+ $[2] = t1;
124
+ $[3] = t2;
125
+ } else {
126
+ t2 = $[3];
127
+ }
128
+ return t2;
41
129
  }
42
130
  /* One symbol: its qualified name muted, its signature, the prose and examples as compact blocks, and its tags as rows. Names in the signature are links only where `onName` says what a press does. */
43
- export function SymbolSection({ section, onName }) {
44
- const declared = declaredNameOf(section.signatures[0]?.code ?? '');
45
- const follow = onName === undefined ? undefined : (name) => onName(name, declared);
46
- return (_jsxs("div", { className: "flex flex-col gap-1.5 px-3 py-2", children: [section.title !== null && _jsx("div", { className: "truncate font-mono text-xs text-text-faint select-text", children: section.title }), section.signatures.map((block, index) => (_jsx(Signature, { code: block.code, language: block.language, onName: follow }, index))), section.baseline !== null && _jsx(BaselineStatus, { baseline: section.baseline }), markdownParts(section.markdown).map((part, index) => part.kind === 'code' ? (_jsx("div", { className: "rounded-md bg-surface-sunken px-2 py-1.5", children: _jsx(Signature, { code: part.block.code, language: part.block.language, onName: follow }) }, index)) : (_jsx("div", { className: "text-text-muted select-text [&_.adecore-editor-markdown]:text-xs [&_p]:my-1", children: _jsx(Markdown, { text: part.text }) }, index))), section.tags.length > 0 && _jsx(DocTags, { tags: section.tags })] }));
131
+ export function SymbolSection(t0) {
132
+ const $ = _c(27);
133
+ const {
134
+ section,
135
+ onName
136
+ } = t0;
137
+ const t1 = section.signatures[0]?.code ?? "";
138
+ let t2;
139
+ if ($[0] !== t1) {
140
+ t2 = declaredNameOf(t1);
141
+ $[0] = t1;
142
+ $[1] = t2;
143
+ } else {
144
+ t2 = $[1];
145
+ }
146
+ const declared = t2;
147
+ let t3;
148
+ if ($[2] !== declared || $[3] !== onName) {
149
+ t3 = onName === undefined ? undefined : name => onName(name, declared);
150
+ $[2] = declared;
151
+ $[3] = onName;
152
+ $[4] = t3;
153
+ } else {
154
+ t3 = $[4];
155
+ }
156
+ const follow = t3;
157
+ let t4;
158
+ if ($[5] !== section.title) {
159
+ t4 = section.title !== null && /*#__PURE__*/_jsx("div", {
160
+ className: "truncate font-mono text-xs text-text-faint select-text",
161
+ children: section.title
162
+ });
163
+ $[5] = section.title;
164
+ $[6] = t4;
165
+ } else {
166
+ t4 = $[6];
167
+ }
168
+ let t5;
169
+ if ($[7] !== follow || $[8] !== section.signatures) {
170
+ let t6;
171
+ if ($[10] !== follow) {
172
+ t6 = (block, index) => /*#__PURE__*/_jsx(Signature, {
173
+ code: block.code,
174
+ language: block.language,
175
+ onName: follow
176
+ }, index);
177
+ $[10] = follow;
178
+ $[11] = t6;
179
+ } else {
180
+ t6 = $[11];
181
+ }
182
+ t5 = section.signatures.map(t6);
183
+ $[7] = follow;
184
+ $[8] = section.signatures;
185
+ $[9] = t5;
186
+ } else {
187
+ t5 = $[9];
188
+ }
189
+ let t6;
190
+ if ($[12] !== section.baseline) {
191
+ t6 = section.baseline !== null && /*#__PURE__*/_jsx(BaselineStatus, {
192
+ baseline: section.baseline
193
+ });
194
+ $[12] = section.baseline;
195
+ $[13] = t6;
196
+ } else {
197
+ t6 = $[13];
198
+ }
199
+ let t7;
200
+ if ($[14] !== follow || $[15] !== section.markdown) {
201
+ let t8;
202
+ if ($[17] !== follow) {
203
+ t8 = (part, index_0) => part.kind === "code" ? /*#__PURE__*/_jsx("div", {
204
+ className: "rounded-md bg-surface-sunken px-2 py-1.5",
205
+ children: /*#__PURE__*/_jsx(Signature, {
206
+ code: part.block.code,
207
+ language: part.block.language,
208
+ onName: follow
209
+ })
210
+ }, index_0) : /*#__PURE__*/_jsx("div", {
211
+ className: "text-text-muted select-text [&_.adecore-editor-markdown]:text-xs [&_p]:my-1",
212
+ children: /*#__PURE__*/_jsx(Markdown, {
213
+ text: part.text
214
+ })
215
+ }, index_0);
216
+ $[17] = follow;
217
+ $[18] = t8;
218
+ } else {
219
+ t8 = $[18];
220
+ }
221
+ t7 = markdownParts(section.markdown).map(t8);
222
+ $[14] = follow;
223
+ $[15] = section.markdown;
224
+ $[16] = t7;
225
+ } else {
226
+ t7 = $[16];
227
+ }
228
+ let t8;
229
+ if ($[19] !== section.tags) {
230
+ t8 = section.tags.length > 0 && /*#__PURE__*/_jsx(DocTags, {
231
+ tags: section.tags
232
+ });
233
+ $[19] = section.tags;
234
+ $[20] = t8;
235
+ } else {
236
+ t8 = $[20];
237
+ }
238
+ let t9;
239
+ if ($[21] !== t4 || $[22] !== t5 || $[23] !== t6 || $[24] !== t7 || $[25] !== t8) {
240
+ t9 = /*#__PURE__*/_jsxs("div", {
241
+ className: "flex flex-col gap-1.5 px-3 py-2",
242
+ children: [t4, t5, t6, t7, t8]
243
+ });
244
+ $[21] = t4;
245
+ $[22] = t5;
246
+ $[23] = t6;
247
+ $[24] = t7;
248
+ $[25] = t8;
249
+ $[26] = t9;
250
+ } else {
251
+ t9 = $[26];
252
+ }
253
+ return t9;
47
254
  }
48
255
  /* What a server says about a symbol as the sections of a hover card, shared by the hover and the documentation beside the suggestions. */
49
- export function SymbolSections({ text, onName }) {
50
- return (_jsx(_Fragment, { children: hoverSectionsOf(text).map((section, index) => (_jsx(SymbolSection, { section: section, onName: onName }, index))) }));
256
+ export function SymbolSections(t0) {
257
+ const $ = _c(7);
258
+ const {
259
+ text,
260
+ onName
261
+ } = t0;
262
+ let t1;
263
+ if ($[0] !== onName || $[1] !== text) {
264
+ let t2;
265
+ if ($[3] !== onName) {
266
+ t2 = (section, index) => /*#__PURE__*/_jsx(SymbolSection, {
267
+ section: section,
268
+ onName: onName
269
+ }, index);
270
+ $[3] = onName;
271
+ $[4] = t2;
272
+ } else {
273
+ t2 = $[4];
274
+ }
275
+ t1 = hoverSectionsOf(text).map(t2);
276
+ $[0] = onName;
277
+ $[1] = text;
278
+ $[2] = t1;
279
+ } else {
280
+ t1 = $[2];
281
+ }
282
+ let t2;
283
+ if ($[5] !== t1) {
284
+ t2 = /*#__PURE__*/_jsx(_Fragment, {
285
+ children: t1
286
+ });
287
+ $[5] = t1;
288
+ $[6] = t2;
289
+ } else {
290
+ t2 = $[6];
291
+ }
292
+ return t2;
51
293
  }
52
294
  /* PHP highlights only after its opening tag, which is put in front for the grammar and taken off again. */
53
295
  function phpWithoutOpenTag(html) {
54
- return html.replace(/<span[^>]*>&#x3C;\?<\/span><span[^>]*>php<\/span>(<span[^>]*>) /, '$1');
296
+ return html.replace(/<span[^>]*>&#x3C;\?<\/span><span[^>]*>php<\/span>(<span[^>]*>) /, '$1');
55
297
  }
56
298
  /* Where a suggestion comes from, such as a PHP `use` line, cut from its start so the end of the name stays readable. */
57
- export function SourceLine({ text, language }) {
58
- const { theme, highlight } = useEditorRendering();
59
- const [html, setHtml] = useState(null);
60
- const highlighted = language === 'php' && text.startsWith('use ');
61
- const key = `${theme}\0${text}`;
62
- useEffect(() => {
63
- if (!highlighted || highlight === undefined) {
64
- return;
299
+ export function SourceLine(t0) {
300
+ const $ = _c(18);
301
+ const {
302
+ text,
303
+ language
304
+ } = t0;
305
+ const {
306
+ theme,
307
+ highlight
308
+ } = useEditorRendering();
309
+ const [html, setHtml] = useState(null);
310
+ let t1;
311
+ if ($[0] !== language || $[1] !== text) {
312
+ t1 = language === "php" && text.startsWith("use ");
313
+ $[0] = language;
314
+ $[1] = text;
315
+ $[2] = t1;
316
+ } else {
317
+ t1 = $[2];
318
+ }
319
+ const highlighted = t1;
320
+ const key = `${theme}\0${text}`;
321
+ let t2;
322
+ let t3;
323
+ if ($[3] !== highlight || $[4] !== highlighted || $[5] !== key || $[6] !== text || $[7] !== theme) {
324
+ t2 = () => {
325
+ if (!highlighted || highlight === undefined) {
326
+ return;
327
+ }
328
+ let alive = true;
329
+ highlight(`<?php ${text}`, "php", theme).then(result => alive && setHtml({
330
+ key,
331
+ html: phpWithoutOpenTag(result)
332
+ })).catch(_temp2);
333
+ return () => {
334
+ alive = false;
335
+ };
336
+ };
337
+ t3 = [highlighted, text, theme, key, highlight];
338
+ $[3] = highlight;
339
+ $[4] = highlighted;
340
+ $[5] = key;
341
+ $[6] = text;
342
+ $[7] = theme;
343
+ $[8] = t2;
344
+ $[9] = t3;
345
+ } else {
346
+ t2 = $[8];
347
+ t3 = $[9];
348
+ }
349
+ useEffect(t2, t3);
350
+ let t4;
351
+ if ($[10] !== highlighted || $[11] !== html || $[12] !== key || $[13] !== text) {
352
+ t4 = highlighted && html?.key === key ? /*#__PURE__*/_jsx("div", {
353
+ className: "block overflow-hidden text-left font-mono text-code text-ellipsis whitespace-nowrap [direction:rtl] [&_code]:font-mono [&_pre]:m-0 [&_pre]:inline [&_pre]:bg-transparent! [&_pre]:p-0 [&_code]:inline [&_.line]:inline",
354
+ children: /*#__PURE__*/_jsx("bdi", {
355
+ dangerouslySetInnerHTML: {
356
+ __html: html.html
65
357
  }
66
- let alive = true;
67
- highlight(`<?php ${text}`, 'php', theme)
68
- .then((result) => alive && setHtml({ key, html: phpWithoutOpenTag(result) }))
69
- .catch(() => undefined);
70
- return () => {
71
- alive = false;
72
- };
73
- }, [highlighted, text, theme, key, highlight]);
74
- const className = 'block overflow-hidden text-left font-mono text-code text-ellipsis whitespace-nowrap [direction:rtl] [&_code]:font-mono [&_pre]:m-0 [&_pre]:inline [&_pre]:bg-transparent! [&_pre]:p-0 [&_code]:inline [&_.line]:inline';
75
- return (_jsx(Tooltip, { label: text, children: highlighted && html?.key === key ? (_jsx("div", { className: className, children: _jsx("bdi", { dangerouslySetInnerHTML: { __html: html.html } }) })) : (_jsx("div", { className: `${className} text-text-muted`, children: _jsx("bdi", { children: text }) })) }));
358
+ })
359
+ }) : /*#__PURE__*/_jsx("div", {
360
+ className: "block overflow-hidden text-left font-mono text-code text-ellipsis whitespace-nowrap [direction:rtl] [&_code]:font-mono [&_pre]:m-0 [&_pre]:inline [&_pre]:bg-transparent! [&_pre]:p-0 [&_code]:inline [&_.line]:inline text-text-muted",
361
+ children: /*#__PURE__*/_jsx("bdi", {
362
+ children: text
363
+ })
364
+ });
365
+ $[10] = highlighted;
366
+ $[11] = html;
367
+ $[12] = key;
368
+ $[13] = text;
369
+ $[14] = t4;
370
+ } else {
371
+ t4 = $[14];
372
+ }
373
+ let t5;
374
+ if ($[15] !== t4 || $[16] !== text) {
375
+ t5 = /*#__PURE__*/_jsx(Tooltip, {
376
+ label: text,
377
+ children: t4
378
+ });
379
+ $[15] = t4;
380
+ $[16] = text;
381
+ $[17] = t5;
382
+ } else {
383
+ t5 = $[17];
384
+ }
385
+ return t5;
76
386
  }
387
+ function _temp2() {}
@@ -1,41 +1,102 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { useEffect, useReducer } from 'react';
3
2
  import { useStore } from 'zustand';
4
- import { AnchoredPopup } from './AnchoredPopup.js';
5
- import { CallHierarchyPanel } from './CallHierarchyPanel.js';
6
- import { CodeAuthorsCard } from './CodeAuthorsCard.js';
7
- import { CompletionPopup } from './CompletionPopup.js';
8
- import { EditorContextMenu } from './EditorContextMenu.js';
9
- import { HoverCard } from './HoverCard.js';
10
- import { PeekPanel } from './PeekPanel.js';
11
- import { PickPopup } from './PickPopup.js';
12
- import { RenameCard } from './RenameCard.js';
13
- import { RenderedDocs } from './RenderedDocs.js';
14
- import { SymbolPicker } from './SymbolPicker.js';
15
- import { SignatureCard } from './SignatureCard.js';
3
+ import { AnchoredPopup } from "./AnchoredPopup.js";
4
+ import { CallHierarchyPanel } from "./CallHierarchyPanel.js";
5
+ import { CodeAuthorsCard } from "./CodeAuthorsCard.js";
6
+ import { CompletionPopup } from "./CompletionPopup.js";
7
+ import { EditorContextMenu } from "./EditorContextMenu.js";
8
+ import { HoverCard } from "./HoverCard.js";
9
+ import { PeekPanel } from "./PeekPanel.js";
10
+ import { PickPopup } from "./PickPopup.js";
11
+ import { RenameCard } from "./RenameCard.js";
12
+ import { RenderedDocs } from "./RenderedDocs.js";
13
+ import { SymbolPicker } from "./SymbolPicker.js";
14
+ import { SignatureCard } from "./SignatureCard.js";
16
15
  /*
17
16
  * Every card a language feature opens over the editor. Each feature keeps its own state and these
18
17
  * only draw it, placed by the screen position of the character it belongs to, which is read again
19
18
  * whenever the editor scrolls or resizes.
20
19
  */
21
- export function LanguagePopups({ language, contextMenuItems, hoverFooter, children }) {
22
- const [, redraw] = useReducer((count) => count + 1, 0);
23
- const hover = useStore(language.popups, (state) => state.hover);
24
- const completion = useStore(language.popups, (state) => state.completion);
25
- const signature = useStore(language.popups, (state) => state.signature);
26
- const pick = useStore(language.popups, (state) => state.pick);
27
- const rename = useStore(language.popups, (state) => state.rename);
28
- const peek = useStore(language.popups, (state) => state.peek);
29
- const callHierarchy = useStore(language.popups, (state) => state.callHierarchy);
30
- const symbols = useStore(language.popups, (state) => state.symbols);
31
- const menu = useStore(language.popups, (state) => state.menu);
32
- const authors = useStore(language.popups, (state) => state.authors);
33
- useEffect(() => language.editor.onViewChange(redraw), [language]);
34
- const hoverRect = hover === null ? null : language.editor.rectAt(hover.anchor);
35
- const completionRect = completion === null ? null : language.editor.rectAt(completion.anchor);
36
- const signatureRect = signature === null ? null : language.editor.rectAt(signature.anchor);
37
- const pickRect = pick === null ? null : language.editor.rectAt(pick.anchor);
38
- const renameRect = rename === null ? null : language.editor.rectAt(rename.range.start);
39
- const renameEnd = rename === null ? null : language.editor.rectAt(rename.range.end);
40
- return (_jsxs(_Fragment, { children: [_jsx(RenderedDocs, { language: language }), hover !== null && hoverRect !== null && (_jsx(AnchoredPopup, { rect: hoverRect, onPointerEnter: () => language.hover.holdCard(true), onPointerLeave: () => language.hover.holdCard(false), children: _jsx(HoverCard, { language: language, problems: hover.problems, info: hover.info, anchor: hover.anchor, position: hover.position, footer: hoverFooter?.(hover, language) }) })), signature !== null && signatureRect !== null && (_jsx(AnchoredPopup, { rect: signatureRect, placement: { prefer: 'above' }, children: _jsx(SignatureCard, { model: signature.model }) })), completion !== null && completionRect !== null && _jsx(CompletionPopup, { language: language, view: completion, rect: completionRect }), pick !== null && pickRect !== null && _jsx(PickPopup, { language: language, view: pick, rect: pickRect }), menu !== null && (_jsx(EditorContextMenu, { language: language, view: menu, children: contextMenuItems?.(language) })), symbols !== null && _jsx(SymbolPicker, { language: language, view: symbols }), peek !== null && _jsx(PeekPanel, { language: language, view: peek }), callHierarchy !== null && _jsx(CallHierarchyPanel, { language: language, view: callHierarchy }), authors !== null && _jsx(CodeAuthorsCard, { language: language, view: authors }), children, rename !== null && renameRect !== null && _jsx(RenameCard, { language: language, view: rename, rect: renameRect, endRect: renameEnd })] }));
41
- }
20
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
21
+ export function LanguagePopups({
22
+ language,
23
+ contextMenuItems,
24
+ hoverFooter,
25
+ children
26
+ }) {
27
+ // The React Compiler would keep each card's place from the render before; it is read from the editor again on every scroll.
28
+ 'use no memo';
29
+
30
+ const [, redraw] = useReducer(count => count + 1, 0);
31
+ const hover = useStore(language.popups, state => state.hover);
32
+ const completion = useStore(language.popups, state_0 => state_0.completion);
33
+ const signature = useStore(language.popups, state_1 => state_1.signature);
34
+ const pick = useStore(language.popups, state_2 => state_2.pick);
35
+ const rename = useStore(language.popups, state_3 => state_3.rename);
36
+ const peek = useStore(language.popups, state_4 => state_4.peek);
37
+ const callHierarchy = useStore(language.popups, state_5 => state_5.callHierarchy);
38
+ const symbols = useStore(language.popups, state_6 => state_6.symbols);
39
+ const menu = useStore(language.popups, state_7 => state_7.menu);
40
+ const authors = useStore(language.popups, state_8 => state_8.authors);
41
+ useEffect(() => language.editor.onViewChange(redraw), [language]);
42
+ const hoverRect = hover === null ? null : language.editor.rectAt(hover.anchor);
43
+ const completionRect = completion === null ? null : language.editor.rectAt(completion.anchor);
44
+ const signatureRect = signature === null ? null : language.editor.rectAt(signature.anchor);
45
+ const pickRect = pick === null ? null : language.editor.rectAt(pick.anchor);
46
+ const renameRect = rename === null ? null : language.editor.rectAt(rename.range.start);
47
+ const renameEnd = rename === null ? null : language.editor.rectAt(rename.range.end);
48
+ return /*#__PURE__*/_jsxs(_Fragment, {
49
+ children: [/*#__PURE__*/_jsx(RenderedDocs, {
50
+ language: language
51
+ }), hover !== null && hoverRect !== null && /*#__PURE__*/_jsx(AnchoredPopup, {
52
+ rect: hoverRect,
53
+ onPointerEnter: () => language.hover.holdCard(true),
54
+ onPointerLeave: () => language.hover.holdCard(false),
55
+ children: /*#__PURE__*/_jsx(HoverCard, {
56
+ language: language,
57
+ problems: hover.problems,
58
+ info: hover.info,
59
+ anchor: hover.anchor,
60
+ position: hover.position,
61
+ footer: hoverFooter?.(hover, language)
62
+ })
63
+ }), signature !== null && signatureRect !== null && /*#__PURE__*/_jsx(AnchoredPopup, {
64
+ rect: signatureRect,
65
+ placement: {
66
+ prefer: 'above'
67
+ },
68
+ children: /*#__PURE__*/_jsx(SignatureCard, {
69
+ model: signature.model
70
+ })
71
+ }), completion !== null && completionRect !== null && /*#__PURE__*/_jsx(CompletionPopup, {
72
+ language: language,
73
+ view: completion,
74
+ rect: completionRect
75
+ }), pick !== null && pickRect !== null && /*#__PURE__*/_jsx(PickPopup, {
76
+ language: language,
77
+ view: pick,
78
+ rect: pickRect
79
+ }), menu !== null && /*#__PURE__*/_jsx(EditorContextMenu, {
80
+ language: language,
81
+ view: menu,
82
+ children: contextMenuItems?.(language)
83
+ }), symbols !== null && /*#__PURE__*/_jsx(SymbolPicker, {
84
+ language: language,
85
+ view: symbols
86
+ }), peek !== null && /*#__PURE__*/_jsx(PeekPanel, {
87
+ language: language,
88
+ view: peek
89
+ }), callHierarchy !== null && /*#__PURE__*/_jsx(CallHierarchyPanel, {
90
+ language: language,
91
+ view: callHierarchy
92
+ }), authors !== null && /*#__PURE__*/_jsx(CodeAuthorsCard, {
93
+ language: language,
94
+ view: authors
95
+ }), children, rename !== null && renameRect !== null && /*#__PURE__*/_jsx(RenameCard, {
96
+ language: language,
97
+ view: rename,
98
+ rect: renameRect,
99
+ endRect: renameEnd
100
+ })]
101
+ });
102
+ }
package/dist/Markdown.js CHANGED
@@ -1,11 +1,46 @@
1
- import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
- import ReactMarkdown, {} from 'react-markdown';
1
+ import { c as _c } from "react/compiler-runtime";
2
+ import ReactMarkdown from 'react-markdown';
3
3
  import remarkGfm from 'remark-gfm';
4
4
  import remarkBreaks from 'remark-breaks';
5
5
  /* 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";
6
7
  const WITHOUT_IMAGES = {
7
- img: ({ alt }) => _jsx(_Fragment, { children: alt ?? '' })
8
+ img: ({
9
+ alt
10
+ }) => /*#__PURE__*/_jsx(_Fragment, {
11
+ children: alt ?? ''
12
+ })
8
13
  };
9
- export function Markdown({ text, images = true }) {
10
- return (_jsx("div", { className: "adecore-editor-markdown", children: _jsx(ReactMarkdown, { remarkPlugins: [remarkGfm, remarkBreaks], components: images ? undefined : WITHOUT_IMAGES, children: text }) }));
11
- }
14
+ export function Markdown(t0) {
15
+ const $ = _c(4);
16
+ const {
17
+ text,
18
+ images: t1
19
+ } = t0;
20
+ const images = t1 === undefined ? true : t1;
21
+ let t2;
22
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
23
+ t2 = [remarkGfm, remarkBreaks];
24
+ $[0] = t2;
25
+ } else {
26
+ t2 = $[0];
27
+ }
28
+ const t3 = images ? undefined : WITHOUT_IMAGES;
29
+ let t4;
30
+ if ($[1] !== t3 || $[2] !== text) {
31
+ t4 = /*#__PURE__*/_jsx("div", {
32
+ className: "adecore-editor-markdown",
33
+ children: /*#__PURE__*/_jsx(ReactMarkdown, {
34
+ remarkPlugins: t2,
35
+ components: t3,
36
+ children: text
37
+ })
38
+ });
39
+ $[1] = t3;
40
+ $[2] = text;
41
+ $[3] = t4;
42
+ } else {
43
+ t4 = $[3];
44
+ }
45
+ return t4;
46
+ }