@adecore/editor-react 0.31.12 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AnchoredPopup.js +73 -19
- package/dist/AttributionCard.js +162 -4
- package/dist/BaselineStatus.js +62 -8
- package/dist/CallHierarchyPanel.js +977 -60
- package/dist/ChangeReview.js +76 -25
- package/dist/CodeAuthorsCard.js +314 -14
- package/dist/CompletionPopup.js +490 -83
- package/dist/DiffView.js +548 -181
- package/dist/EditorContextMenu.js +352 -34
- package/dist/EditorView.js +276 -99
- package/dist/FindReplace.js +525 -67
- package/dist/HoverCard.js +378 -38
- package/dist/HoverSections.js +367 -56
- package/dist/LanguagePopups.js +95 -34
- package/dist/Markdown.js +41 -6
- package/dist/PanelResizeHandle.js +199 -66
- package/dist/PathText.js +49 -7
- package/dist/PeekPanel.js +675 -72
- package/dist/PickPopup.js +304 -34
- package/dist/RenameCard.js +679 -85
- package/dist/RenderedDocs.js +329 -58
- package/dist/SignatureCard.js +91 -7
- package/dist/SplitDiffView.js +344 -254
- package/dist/SymbolPicker.js +440 -85
- package/dist/call-hierarchy-model.js +102 -68
- package/dist/call-hierarchy.js +458 -359
- package/dist/code-actions-model.js +88 -76
- package/dist/code-actions.js +372 -283
- package/dist/code-authors.js +64 -55
- package/dist/code-vision-model.js +134 -127
- package/dist/code-vision.js +224 -206
- package/dist/completion-call.js +94 -67
- package/dist/completion-model.js +334 -244
- package/dist/completion.js +840 -649
- package/dist/conflict-model.js +35 -29
- package/dist/context-menu-rows.js +42 -17
- package/dist/context-menu.js +64 -46
- package/dist/definition-link.js +88 -85
- package/dist/diagnostics-model.js +74 -55
- package/dist/diagnostics.js +121 -100
- package/dist/diff-expansion.js +38 -35
- package/dist/diff-overlays.js +144 -22
- package/dist/diff-syntax.js +65 -42
- package/dist/diff-wordmarks.js +26 -23
- package/dist/doc-comment-model.js +265 -216
- package/dist/editor-language.js +177 -152
- package/dist/error-message.js +2 -2
- package/dist/find-query.js +49 -36
- package/dist/folding.js +81 -62
- package/dist/format-on-type.js +86 -67
- package/dist/highlight-layers.js +19 -20
- package/dist/highlights.js +105 -83
- package/dist/history.js +44 -38
- package/dist/holder.js +18 -18
- package/dist/host-types.js +1 -1
- package/dist/hover-content.js +167 -129
- package/dist/hover.js +285 -245
- package/dist/index.js +10 -10
- package/dist/inlay-hints.js +369 -324
- package/dist/key-priority.js +34 -31
- package/dist/language-ids.js +45 -42
- package/dist/line-edits.js +74 -28
- package/dist/line-text.js +18 -3
- package/dist/locales/en.json +38 -38
- package/dist/locales/nl.json +41 -41
- package/dist/models.js +1 -1
- package/dist/navigation-history.js +40 -41
- package/dist/navigation.js +141 -123
- package/dist/panel-size.js +8 -8
- package/dist/patch-decorations.js +236 -160
- package/dist/patch-layout.js +331 -262
- package/dist/paths.js +3 -3
- package/dist/peek-model.js +86 -69
- package/dist/peek.js +254 -192
- package/dist/pick.js +164 -157
- package/dist/popup-focus.js +5 -5
- package/dist/popup-placement.js +36 -21
- package/dist/popups.js +13 -13
- package/dist/project-language.js +228 -211
- package/dist/project-problems.js +81 -69
- package/dist/proposal-model.js +163 -126
- package/dist/recent-choices.js +25 -25
- package/dist/refresher.js +44 -49
- package/dist/rename-model.js +113 -113
- package/dist/rename.js +321 -233
- package/dist/rendered-docs.d.ts +4 -2
- package/dist/rendered-docs.js +384 -318
- package/dist/rendering-context.js +5 -3
- package/dist/rendering.js +22 -4
- package/dist/review-group.js +42 -39
- package/dist/row-host.d.ts +4 -2
- package/dist/row-host.js +90 -78
- package/dist/selection-ranges.js +21 -17
- package/dist/semantic-delta.js +22 -19
- package/dist/semantic-model.js +86 -73
- package/dist/semantic-tokens.js +201 -162
- package/dist/shortcut-keys.js +16 -10
- package/dist/signature-model.js +34 -28
- package/dist/signature.js +177 -129
- package/dist/snippet-field-transforms.js +118 -106
- package/dist/snippet-indent.js +48 -43
- package/dist/snippet-range-order.js +11 -11
- package/dist/snippet-session.js +703 -667
- package/dist/snippet-transform-client.js +59 -59
- package/dist/snippet-transform-format.js +285 -263
- package/dist/snippet-transform-protocol.js +1 -1
- package/dist/snippet-transform-queue.js +163 -153
- package/dist/snippet-transform-worker.js +42 -35
- package/dist/snippet-variable-names.js +1 -36
- package/dist/snippet-variables.js +53 -63
- package/dist/snippet.js +477 -405
- package/dist/split-alignment.js +47 -35
- package/dist/split-scroll.js +42 -40
- package/dist/symbol-links.js +33 -25
- package/dist/symbol-picker-model.js +126 -116
- package/dist/symbol-picker.js +98 -59
- package/dist/symbols.js +117 -88
- package/dist/testing.js +248 -165
- package/dist/timers.js +35 -30
- package/dist/use-panel-body.js +49 -8
- package/dist/use-problem-counts.js +29 -15
- package/dist/view-state.js +54 -33
- package/dist/word-diff.js +18 -18
- package/dist/workspace-edit.js +300 -249
- package/package.json +6 -6
- package/src/CallHierarchyPanel.tsx +2 -2
- package/src/DiffView.tsx +3 -3
- package/src/FindReplace.tsx +2 -2
- package/src/LanguagePopups.tsx +2 -0
- package/src/PeekPanel.tsx +3 -3
- package/src/RenderedDocs.tsx +9 -10
- package/src/SymbolPicker.tsx +2 -2
- package/src/diff-overlays.tsx +6 -4
- package/src/locales/en.json +38 -38
- package/src/locales/nl.json +41 -41
- package/src/rendered-docs.ts +14 -3
- package/src/row-host.ts +14 -3
package/dist/HoverSections.js
CHANGED
|
@@ -1,76 +1,387 @@
|
|
|
1
|
-
import {
|
|
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
|
|
4
|
+
import { BaselineStatus } from "./BaselineStatus.js";
|
|
5
5
|
import { hoverSectionsOf, markdownParts } from './hover-content.js';
|
|
6
|
-
import { Markdown } from
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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
|
-
|
|
40
|
-
|
|
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(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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(
|
|
50
|
-
|
|
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
|
-
|
|
296
|
+
return html.replace(/<span[^>]*><\?<\/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(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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() {}
|
package/dist/LanguagePopups.js
CHANGED
|
@@ -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
|
|
5
|
-
import { CallHierarchyPanel } from
|
|
6
|
-
import { CodeAuthorsCard } from
|
|
7
|
-
import { CompletionPopup } from
|
|
8
|
-
import { EditorContextMenu } from
|
|
9
|
-
import { HoverCard } from
|
|
10
|
-
import { PeekPanel } from
|
|
11
|
-
import { PickPopup } from
|
|
12
|
-
import { RenameCard } from
|
|
13
|
-
import { RenderedDocs } from
|
|
14
|
-
import { SymbolPicker } from
|
|
15
|
-
import { SignatureCard } from
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
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 {
|
|
2
|
-
import ReactMarkdown
|
|
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
|
-
|
|
8
|
+
img: ({
|
|
9
|
+
alt
|
|
10
|
+
}) => /*#__PURE__*/_jsx(_Fragment, {
|
|
11
|
+
children: alt ?? ''
|
|
12
|
+
})
|
|
8
13
|
};
|
|
9
|
-
export function Markdown(
|
|
10
|
-
|
|
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
|
+
}
|