@m4l/components 9.24.0-beta-feature-731-m4l-components-code-editor.3 → 9.24.0-beta-feature-731-m4l-components-code-editor.4
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/components/extended/ReactSimpleCodeEditor/CodeEditor.d.ts.map +1 -1
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.js +118 -118
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.js +10 -10
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts +1 -1
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts.map +1 -1
- package/components/extended/ReactSimpleCodeEditor/constants.js +30 -30
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts +1 -1
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts.map +1 -1
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.js +59 -59
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/extended/ReactSimpleCodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,SAAS,CAAC;AAgBjB;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/extended/ReactSimpleCodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAyCA,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,SAAS,CAAC;AAgBjB;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,oDAuXhD"}
|
|
@@ -1,91 +1,91 @@
|
|
|
1
1
|
import { jsx as a, jsxs as D } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useModuleDictionary as
|
|
2
|
+
import { useModuleDictionary as Me, useModuleSkeleton as Ve } from "@m4l/core";
|
|
3
3
|
import _ from "clsx";
|
|
4
|
-
import { useId as
|
|
5
|
-
import { useTheme as
|
|
6
|
-
import { getPropDataTestId as x, getNameDataTestId as
|
|
7
|
-
import { CODE_EDITOR_DEFAULT_MAX_LINES as
|
|
8
|
-
import { CODE_EDITOR_DICTIONARY as
|
|
9
|
-
import { resolveCodeEditorLanguageIcon as
|
|
10
|
-
import { ensureCodeEditorRuntimeDependencies as
|
|
11
|
-
import { SkeletonStyled as
|
|
4
|
+
import { useId as Pe, useState as Q, useRef as ke, useMemo as E, useEffect as W, useCallback as z } from "react";
|
|
5
|
+
import { useTheme as ze } from "@mui/material/styles";
|
|
6
|
+
import { getPropDataTestId as x, getNameDataTestId as Be } from "../../../test/getNameDataTestId.js";
|
|
7
|
+
import { CODE_EDITOR_DEFAULT_MAX_LINES as He, CODE_EDITOR_DEFAULT_MIN_LINES as we, CODE_EDITOR_DEFAULT_LANGUAGE as Ge, CODE_EDITOR_LINE_HEIGHT_BY_SIZE as Ue, CODE_EDITOR_CLASSES as C, CODE_EDITOR_KEY_COMPONENT as p, CODE_EDITOR_READ_ONLY_LABEL as Ye, CODE_EDITOR_LANGUAGE_CHIP_ICON_INSTANCE_ID as Fe } from "./constants.js";
|
|
8
|
+
import { CODE_EDITOR_DICTIONARY as ee } from "./dictionary.js";
|
|
9
|
+
import { resolveCodeEditorLanguageIcon as je } from "./helpers/languageIcon.js";
|
|
10
|
+
import { ensureCodeEditorRuntimeDependencies as qe, getCodeEditorLineCount as Ke, createCodeEditorPrismTheme as Xe, resolveCodeEditorLanguageTemplate as Ze, validateCodeEditorSyntax as $e, highlightCode as Je } from "./helpers/highlighting.js";
|
|
11
|
+
import { SkeletonStyled as Qe, RootStyled as We, HeaderStyled as et, LanguageChipStyled as tt, LanguageChipIconStyled as at, HeaderBadgesStyled as nt, ReadOnlyChipStyled as rt, BodyStyled as ot, LineNumbersStyled as lt, LineNumberStyled as it, EditorScrollerStyled as st, PlaceholderStyled as dt, EditorStyled as ct } from "./slots/CodeEditorSlots.js";
|
|
12
12
|
import { CodeEditorSlots as f } from "./slots/CodeEditorEnum.js";
|
|
13
|
-
function
|
|
13
|
+
function ut(L, y) {
|
|
14
14
|
return L.length !== y.length ? !1 : L.every((S, o) => S === y[o]);
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function _t(L) {
|
|
17
17
|
const {
|
|
18
18
|
className: y,
|
|
19
19
|
customLanguages: S,
|
|
20
20
|
dataTestId: o,
|
|
21
|
-
defaultValue:
|
|
22
|
-
disabled:
|
|
23
|
-
editorClassName:
|
|
24
|
-
error:
|
|
25
|
-
highlightTheme:
|
|
26
|
-
id:
|
|
27
|
-
insertSpaces:
|
|
28
|
-
languageIcon:
|
|
29
|
-
languageLabel:
|
|
21
|
+
defaultValue: te,
|
|
22
|
+
disabled: T = !1,
|
|
23
|
+
editorClassName: ae,
|
|
24
|
+
error: ne = !1,
|
|
25
|
+
highlightTheme: B,
|
|
26
|
+
id: re,
|
|
27
|
+
insertSpaces: oe,
|
|
28
|
+
languageIcon: le,
|
|
29
|
+
languageLabel: ie,
|
|
30
30
|
languageTemplate: n,
|
|
31
|
-
languageText:
|
|
32
|
-
maxLines:
|
|
33
|
-
minLines: O =
|
|
34
|
-
onBlur:
|
|
31
|
+
languageText: se,
|
|
32
|
+
maxLines: de = He,
|
|
33
|
+
minLines: O = we,
|
|
34
|
+
onBlur: ce,
|
|
35
35
|
onChange: v,
|
|
36
36
|
placeholder: R,
|
|
37
|
-
preClassName:
|
|
37
|
+
preClassName: ue,
|
|
38
38
|
readOnly: d = !1,
|
|
39
|
-
readOnlyLabel:
|
|
39
|
+
readOnlyLabel: me,
|
|
40
40
|
runtimeDependencies: c,
|
|
41
|
-
showLineNumbers:
|
|
42
|
-
showPlaceholder:
|
|
43
|
-
size:
|
|
41
|
+
showLineNumbers: H = !1,
|
|
42
|
+
showPlaceholder: w = !0,
|
|
43
|
+
size: G = "medium",
|
|
44
44
|
syntaxValidator: N,
|
|
45
|
-
skeleton:
|
|
46
|
-
textareaClassName:
|
|
47
|
-
validateSyntax:
|
|
45
|
+
skeleton: ge = !1,
|
|
46
|
+
textareaClassName: he,
|
|
47
|
+
validateSyntax: U = !1,
|
|
48
48
|
value: u,
|
|
49
|
-
variant:
|
|
50
|
-
...
|
|
51
|
-
} = L,
|
|
52
|
-
u ??
|
|
53
|
-
),
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
) || (
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
m && u !== void 0 &&
|
|
61
|
-
}, [m, u]),
|
|
62
|
-
if (!
|
|
49
|
+
variant: Ee = "outlined",
|
|
50
|
+
...I
|
|
51
|
+
} = L, Ce = Pe(), pe = re || Ce, b = ze(), Y = b.palette.mode, { getLabel: fe } = Me(), Le = Ve() || ge, m = v === void 0, [A, ye] = Q(0), M = ke([]), [Se, F] = Q(
|
|
52
|
+
u ?? te ?? ""
|
|
53
|
+
), j = E(() => c ? Array.isArray(c) ? c : [c] : [], [c]);
|
|
54
|
+
ut(
|
|
55
|
+
M.current,
|
|
56
|
+
j
|
|
57
|
+
) || (M.current = j);
|
|
58
|
+
const V = M.current;
|
|
59
|
+
W(() => {
|
|
60
|
+
m && u !== void 0 && F(u);
|
|
61
|
+
}, [m, u]), W(() => {
|
|
62
|
+
if (!V.length)
|
|
63
63
|
return;
|
|
64
64
|
let e = !0;
|
|
65
|
-
return
|
|
65
|
+
return qe(V).catch(() => {
|
|
66
66
|
}).then(() => {
|
|
67
|
-
e &&
|
|
67
|
+
e && ye((s) => s + 1);
|
|
68
68
|
}), () => {
|
|
69
69
|
e = !1;
|
|
70
70
|
};
|
|
71
|
-
}, [
|
|
72
|
-
const r = m ?
|
|
73
|
-
() =>
|
|
74
|
-
[
|
|
71
|
+
}, [V]);
|
|
72
|
+
const r = m ? Se : u ?? "", Te = w && r.length === 0 && !!R, Ie = Ue[G], q = Ke(r), K = Math.max(q, O), P = Math.max(O, de), De = Math.min(K, P), _e = q >= P, X = E(
|
|
73
|
+
() => B ?? Xe(b, Y),
|
|
74
|
+
[B, Y, b]
|
|
75
75
|
), l = E(
|
|
76
|
-
() =>
|
|
77
|
-
[n,
|
|
78
|
-
), g =
|
|
79
|
-
|
|
80
|
-
),
|
|
76
|
+
() => Ze(n),
|
|
77
|
+
[n, A]
|
|
78
|
+
), g = se ?? l?.languageText ?? Ge, Z = ie ?? l?.languageLabel, $ = !!Z, xe = je(
|
|
79
|
+
le ?? l?.languageIcon
|
|
80
|
+
), k = d ? fe(ee.readOnly) : void 0, Oe = me ?? (k && k !== ee.readOnly ? k : Ye), h = E(() => {
|
|
81
81
|
if (N)
|
|
82
82
|
return N({
|
|
83
83
|
code: r,
|
|
84
84
|
languageTemplate: l ?? n,
|
|
85
85
|
languageText: g
|
|
86
86
|
});
|
|
87
|
-
if (
|
|
88
|
-
return
|
|
87
|
+
if (U)
|
|
88
|
+
return $e({
|
|
89
89
|
code: r,
|
|
90
90
|
languageTemplate: l ?? n,
|
|
91
91
|
languageText: g
|
|
@@ -95,121 +95,121 @@ function Dt(L) {
|
|
|
95
95
|
l,
|
|
96
96
|
g,
|
|
97
97
|
r,
|
|
98
|
-
|
|
98
|
+
A,
|
|
99
99
|
N,
|
|
100
|
-
|
|
101
|
-
]),
|
|
100
|
+
U
|
|
101
|
+
]), J = ne || !!h && !h.isValid, i = h && !h.isValid ? h.errorRange : void 0, ve = E(() => {
|
|
102
102
|
if (!i)
|
|
103
103
|
return /* @__PURE__ */ new Set();
|
|
104
104
|
const e = i.start.line, s = i.end?.line ?? e;
|
|
105
105
|
return new Set(
|
|
106
106
|
Array.from(
|
|
107
107
|
{ length: Math.max(s - e + 1, 1) },
|
|
108
|
-
(
|
|
108
|
+
(mt, Ae) => e + Ae
|
|
109
109
|
)
|
|
110
110
|
);
|
|
111
111
|
}, [i]), t = {
|
|
112
|
-
disabled:
|
|
113
|
-
error:
|
|
114
|
-
isLineCapped:
|
|
112
|
+
disabled: T,
|
|
113
|
+
error: J,
|
|
114
|
+
isLineCapped: _e,
|
|
115
115
|
isEmpty: r.length === 0,
|
|
116
|
-
isPlaceholderVisible:
|
|
116
|
+
isPlaceholderVisible: Te,
|
|
117
117
|
lineHeight: Ie,
|
|
118
|
-
maxLines:
|
|
118
|
+
maxLines: P,
|
|
119
119
|
minLines: O,
|
|
120
120
|
readOnly: d,
|
|
121
|
-
showLineNumbers:
|
|
122
|
-
size:
|
|
123
|
-
variant:
|
|
124
|
-
visibleLineCount:
|
|
125
|
-
},
|
|
126
|
-
(e) =>
|
|
121
|
+
showLineNumbers: H,
|
|
122
|
+
size: G,
|
|
123
|
+
variant: Ee,
|
|
124
|
+
visibleLineCount: De
|
|
125
|
+
}, Re = z(
|
|
126
|
+
(e) => Je({
|
|
127
127
|
code: e,
|
|
128
128
|
customLanguages: S,
|
|
129
129
|
languageTemplate: n,
|
|
130
130
|
languageText: g,
|
|
131
|
-
prismTheme:
|
|
131
|
+
prismTheme: X,
|
|
132
132
|
syntaxErrorRange: i
|
|
133
133
|
}),
|
|
134
134
|
[
|
|
135
135
|
S,
|
|
136
136
|
n,
|
|
137
|
-
|
|
137
|
+
X,
|
|
138
138
|
g,
|
|
139
|
-
|
|
139
|
+
A,
|
|
140
140
|
i
|
|
141
141
|
]
|
|
142
|
-
),
|
|
142
|
+
), Ne = z(
|
|
143
143
|
(e) => {
|
|
144
|
-
m &&
|
|
144
|
+
m && F(e), v?.(e);
|
|
145
145
|
},
|
|
146
146
|
[v, m]
|
|
147
|
-
),
|
|
147
|
+
), be = z(
|
|
148
148
|
(e) => {
|
|
149
|
-
if (
|
|
149
|
+
if (T || e.target instanceof Element && e.target.closest("textarea"))
|
|
150
150
|
return;
|
|
151
151
|
e.currentTarget.querySelector("textarea")?.focus();
|
|
152
152
|
},
|
|
153
|
-
[
|
|
153
|
+
[T]
|
|
154
154
|
);
|
|
155
|
-
return
|
|
156
|
-
|
|
155
|
+
return Le ? /* @__PURE__ */ a(Qe, { ownerState: t }) : /* @__PURE__ */ D(
|
|
156
|
+
We,
|
|
157
157
|
{
|
|
158
158
|
ownerState: t,
|
|
159
159
|
"aria-disabled": t.disabled || void 0,
|
|
160
160
|
className: _(C.root, y),
|
|
161
161
|
...x(p, f.root, o),
|
|
162
162
|
children: [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
163
|
+
$ || d ? /* @__PURE__ */ D(et, { ownerState: t, className: C.header, children: [
|
|
164
|
+
$ ? /* @__PURE__ */ a(
|
|
165
|
+
tt,
|
|
166
166
|
{
|
|
167
|
-
label:
|
|
167
|
+
label: Z,
|
|
168
168
|
size: "small",
|
|
169
169
|
variant: "outlined",
|
|
170
170
|
color: "default",
|
|
171
171
|
startIcon: /* @__PURE__ */ a(
|
|
172
|
-
|
|
172
|
+
at,
|
|
173
173
|
{
|
|
174
174
|
...x(
|
|
175
175
|
p,
|
|
176
176
|
f.languageChipIcon,
|
|
177
|
-
|
|
177
|
+
Fe
|
|
178
178
|
),
|
|
179
|
-
children: /* @__PURE__ */ a(
|
|
179
|
+
children: /* @__PURE__ */ a(xe, { fontSize: "small" })
|
|
180
180
|
}
|
|
181
181
|
)
|
|
182
182
|
}
|
|
183
183
|
) : null,
|
|
184
|
-
/* @__PURE__ */ a(
|
|
185
|
-
|
|
184
|
+
/* @__PURE__ */ a(nt, { ownerState: t, children: d ? /* @__PURE__ */ a(
|
|
185
|
+
rt,
|
|
186
186
|
{
|
|
187
|
-
label:
|
|
187
|
+
label: Oe,
|
|
188
188
|
size: "small"
|
|
189
189
|
}
|
|
190
190
|
) : null })
|
|
191
191
|
] }) : null,
|
|
192
192
|
/* @__PURE__ */ D(
|
|
193
|
-
|
|
193
|
+
ot,
|
|
194
194
|
{
|
|
195
195
|
ownerState: t,
|
|
196
|
-
onClick:
|
|
196
|
+
onClick: be,
|
|
197
197
|
...x(p, f.body, o),
|
|
198
198
|
children: [
|
|
199
|
-
|
|
199
|
+
H ? /* @__PURE__ */ a(lt, { ownerState: t, "aria-hidden": "true", children: Array.from({ length: K }, (e, s) => s + 1).map(
|
|
200
200
|
(e) => /* @__PURE__ */ a(
|
|
201
|
-
|
|
201
|
+
it,
|
|
202
202
|
{
|
|
203
203
|
ownerState: t,
|
|
204
|
-
"data-code-editor-error-line":
|
|
204
|
+
"data-code-editor-error-line": ve.has(e) || void 0,
|
|
205
205
|
children: e
|
|
206
206
|
},
|
|
207
207
|
`code-editor-line-${e}`
|
|
208
208
|
)
|
|
209
209
|
) }) : null,
|
|
210
|
-
/* @__PURE__ */ D(
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
/* @__PURE__ */ D(st, { ownerState: t, children: [
|
|
211
|
+
w && t.isEmpty && R ? /* @__PURE__ */ a(
|
|
212
|
+
dt,
|
|
213
213
|
{
|
|
214
214
|
ownerState: t,
|
|
215
215
|
...x(
|
|
@@ -221,31 +221,31 @@ function Dt(L) {
|
|
|
221
221
|
}
|
|
222
222
|
) : null,
|
|
223
223
|
/* @__PURE__ */ a(
|
|
224
|
-
|
|
224
|
+
ct,
|
|
225
225
|
{
|
|
226
|
-
...
|
|
226
|
+
...I,
|
|
227
227
|
ownerState: t,
|
|
228
|
-
"aria-label":
|
|
229
|
-
"aria-invalid":
|
|
230
|
-
className: _(C.editor,
|
|
231
|
-
"data-testid":
|
|
228
|
+
"aria-label": I["aria-label"] ?? "Code editor",
|
|
229
|
+
"aria-invalid": I["aria-invalid"] ?? (J || void 0),
|
|
230
|
+
className: _(C.editor, ae),
|
|
231
|
+
"data-testid": Be(
|
|
232
232
|
p,
|
|
233
233
|
f.textarea,
|
|
234
234
|
o
|
|
235
235
|
),
|
|
236
|
-
disabled:
|
|
237
|
-
highlight:
|
|
238
|
-
insertSpaces:
|
|
239
|
-
onBlur:
|
|
240
|
-
onValueChange:
|
|
241
|
-
preClassName: _(C.pre,
|
|
236
|
+
disabled: T,
|
|
237
|
+
highlight: Re,
|
|
238
|
+
insertSpaces: oe,
|
|
239
|
+
onBlur: ce,
|
|
240
|
+
onValueChange: Ne,
|
|
241
|
+
preClassName: _(C.pre, ue),
|
|
242
242
|
readOnly: d,
|
|
243
|
-
tabSize:
|
|
243
|
+
tabSize: I.tabSize,
|
|
244
244
|
textareaClassName: _(
|
|
245
245
|
C.textarea,
|
|
246
|
-
|
|
246
|
+
he
|
|
247
247
|
),
|
|
248
|
-
textareaId:
|
|
248
|
+
textareaId: pe,
|
|
249
249
|
value: r
|
|
250
250
|
}
|
|
251
251
|
)
|
|
@@ -258,5 +258,5 @@ function Dt(L) {
|
|
|
258
258
|
);
|
|
259
259
|
}
|
|
260
260
|
export {
|
|
261
|
-
|
|
261
|
+
_t as CodeEditor
|
|
262
262
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getTypographyStyles as d } from "../../../utils/getTypographyStyles.js";
|
|
2
|
-
import { getCodeEditorVSCodeModernPalette as s, CODE_EDITOR_LINE_HEIGHT_BY_SIZE as n, CODE_EDITOR_MONO_FONT_FAMILY as
|
|
2
|
+
import { getCodeEditorVSCodeModernPalette as s, CODE_EDITOR_LINE_HEIGHT_BY_SIZE as n, CODE_EDITOR_MONO_FONT_FAMILY as l, CODE_EDITOR_PADDING_PX as i } from "./constants.js";
|
|
3
3
|
import { getSizeStyles as p } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
4
4
|
const b = {
|
|
5
5
|
/** Resolve the interactive shell colors and focus treatment for the editor root. */
|
|
@@ -156,14 +156,14 @@ const b = {
|
|
|
156
156
|
}),
|
|
157
157
|
/** Build the two-column layout used by the gutter and editor scroller. */
|
|
158
158
|
body: ({ theme: r, ownerState: e }) => {
|
|
159
|
-
const o = e?.visibleLineCount || e?.minLines || 1, a = e?.lineHeight || n.medium,
|
|
159
|
+
const o = e?.visibleLineCount || e?.minLines || 1, a = e?.lineHeight || n.medium, t = e?.isLineCapped ? i : i * 2;
|
|
160
160
|
return {
|
|
161
161
|
display: "grid",
|
|
162
162
|
gridTemplateColumns: e?.showLineNumbers ? "auto minmax(0, 1fr)" : "minmax(0, 1fr)",
|
|
163
163
|
width: "100%",
|
|
164
164
|
alignItems: "start",
|
|
165
165
|
columnGap: 0,
|
|
166
|
-
maxHeight: `${o * a +
|
|
166
|
+
maxHeight: `${o * a + t}px`,
|
|
167
167
|
minHeight: 0,
|
|
168
168
|
overflow: "auto",
|
|
169
169
|
pointerEvents: e?.disabled ? "none" : "auto",
|
|
@@ -183,7 +183,7 @@ const b = {
|
|
|
183
183
|
color: e?.disabled ? o.surface.placeholderForeground : o.surface.lineNumberForeground,
|
|
184
184
|
userSelect: "none",
|
|
185
185
|
...d(r.generalSettings.isMobile, e?.size || "medium", "bodyStandard"),
|
|
186
|
-
fontFamily:
|
|
186
|
+
fontFamily: l,
|
|
187
187
|
lineHeight: `${n[e?.size || "medium"]}px`
|
|
188
188
|
};
|
|
189
189
|
},
|
|
@@ -203,7 +203,7 @@ const b = {
|
|
|
203
203
|
};
|
|
204
204
|
},
|
|
205
205
|
/** Provide horizontal overflow for long code lines without wrapping them. */
|
|
206
|
-
editorScroller: ({ theme: r
|
|
206
|
+
editorScroller: ({ theme: r }) => ({
|
|
207
207
|
position: "relative",
|
|
208
208
|
width: "fit-content",
|
|
209
209
|
minWidth: "100%",
|
|
@@ -215,21 +215,21 @@ const b = {
|
|
|
215
215
|
}),
|
|
216
216
|
/** Style the underlying react-simple-code-editor surface and its inner elements. */
|
|
217
217
|
editor: ({ theme: r, ownerState: e }) => {
|
|
218
|
-
const o = s(r), a = e?.isLineCapped ? 0 : i,
|
|
218
|
+
const o = s(r), a = e?.isLineCapped ? 0 : i, t = i + a;
|
|
219
219
|
return {
|
|
220
220
|
position: "relative",
|
|
221
221
|
zIndex: 0,
|
|
222
222
|
width: "max-content",
|
|
223
223
|
minWidth: "100%",
|
|
224
|
-
minHeight: `calc(${e?.minLines || 1} * ${e?.lineHeight || n.medium}px + ${
|
|
224
|
+
minHeight: `calc(${e?.minLines || 1} * ${e?.lineHeight || n.medium}px + ${t}px)`,
|
|
225
225
|
backgroundColor: "transparent",
|
|
226
|
-
fontFamily:
|
|
226
|
+
fontFamily: l,
|
|
227
227
|
fontSize: "11px",
|
|
228
228
|
lineHeight: `${e?.lineHeight || n.medium}px`,
|
|
229
229
|
fontWeight: 400,
|
|
230
230
|
"& textarea, & pre": {
|
|
231
231
|
...d(r.generalSettings.isMobile, e?.size || "medium", "bodyStandard"),
|
|
232
|
-
fontFamily:
|
|
232
|
+
fontFamily: l,
|
|
233
233
|
lineHeight: `${e?.lineHeight || n.medium}px`,
|
|
234
234
|
whiteSpace: "pre !important",
|
|
235
235
|
wordBreak: "normal",
|
|
@@ -280,7 +280,7 @@ const b = {
|
|
|
280
280
|
pointerEvents: "none",
|
|
281
281
|
color: o.surface.placeholderForeground,
|
|
282
282
|
...d(r.generalSettings.isMobile, e?.size || "medium", "bodyStandard"),
|
|
283
|
-
fontFamily:
|
|
283
|
+
fontFamily: l,
|
|
284
284
|
lineHeight: `${e?.lineHeight || n.medium}px`,
|
|
285
285
|
whiteSpace: "pre-wrap"
|
|
286
286
|
};
|
|
@@ -76,7 +76,7 @@ export declare const CODE_EDITOR_FALLBACK_LANGUAGE_ICON: import('@mui/material/O
|
|
|
76
76
|
muiName: string;
|
|
77
77
|
};
|
|
78
78
|
/** Resolve the exact VS Code Modern palette for the current light or dark theme mode. */
|
|
79
|
-
export declare function getCodeEditorVSCodeModernPalette(theme: Theme): CodeEditorVSCodeModernPalette;
|
|
79
|
+
export declare function getCodeEditorVSCodeModernPalette(theme: Theme, modeOverride?: Theme['palette']['mode']): CodeEditorVSCodeModernPalette;
|
|
80
80
|
export declare const CODE_EDITOR_CLASSES: Record<"root" | "skeleton" | "body" | "header" | "pre" | "textarea" | "placeholder" | "headerBadges" | "languageChip" | "languageChipIcon" | "readOnlyChip" | "lineNumbers" | "lineNumber" | "editorScroller" | "editor", string>;
|
|
81
81
|
export {};
|
|
82
82
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/extended/ReactSimpleCodeEditor/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAS3C,KAAK,oCAAoC,GAAG;IAC1C,2BAA2B,EAAE,MAAM,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,2BAA2B,EAAE,MAAM,CAAC;IACpC,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,0BAA0B,EAAE,MAAM,CAAC;IACnC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,KAAK,mCAAmC,GAAG;IACzC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EA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GACtC,6BAA6B,CAM/B;AAED,eAAO,MAAM,mBAAmB,mOAG/B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { FileFolderFileOutlined as
|
|
2
|
-
import { getComponentClasses as
|
|
3
|
-
import { CodeEditorSlots as
|
|
4
|
-
const
|
|
1
|
+
import { FileFolderFileOutlined as a } from "@m4l/icons";
|
|
2
|
+
import { getComponentClasses as t } from "../../../utils/getComponentSlotRoot.js";
|
|
3
|
+
import { CodeEditorSlots as C } from "./slots/CodeEditorEnum.js";
|
|
4
|
+
const d = {
|
|
5
5
|
dark: {
|
|
6
6
|
bracketPalette: ["#FFD700", "#DA70D6", "#179FFF"],
|
|
7
7
|
surface: {
|
|
@@ -100,15 +100,15 @@ const C = {
|
|
|
100
100
|
variable: "#001080"
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
|
-
},
|
|
103
|
+
}, E = "M4LCodeEditor", g = "text", u = 4, D = 10, _ = 12, B = {
|
|
104
104
|
small: 18,
|
|
105
105
|
medium: 20
|
|
106
|
-
},
|
|
106
|
+
}, s = '"Geist Mono", "JetBrains Mono", "Cascadia Code", "Liberation Mono", monospace', l = "Read Only", r = "at-commands", A = "at-basic", O = "AT Commands", T = "CodeEditorLanguageChipIcon", m = {
|
|
107
107
|
commandPrefixes: ["AT+", "+"],
|
|
108
108
|
concatenationSeparators: [";"],
|
|
109
109
|
argumentSeparators: [","],
|
|
110
110
|
reservedWords: ["SET", "INFO", "SAVE", "CLEAR"]
|
|
111
|
-
},
|
|
111
|
+
}, p = {
|
|
112
112
|
js: "javascript",
|
|
113
113
|
jsx: "jsx",
|
|
114
114
|
ts: "typescript",
|
|
@@ -119,31 +119,31 @@ const C = {
|
|
|
119
119
|
yml: "yaml",
|
|
120
120
|
at: r,
|
|
121
121
|
"telemetry-at": r
|
|
122
|
-
},
|
|
123
|
-
function
|
|
124
|
-
const
|
|
125
|
-
return
|
|
122
|
+
}, I = a;
|
|
123
|
+
function L(o, e) {
|
|
124
|
+
const n = (e ?? o.palette.mode) === "dark" ? "dark" : "light";
|
|
125
|
+
return d[n];
|
|
126
126
|
}
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
127
|
+
const h = t(
|
|
128
|
+
E,
|
|
129
|
+
C
|
|
130
130
|
);
|
|
131
131
|
export {
|
|
132
132
|
r as CODE_EDITOR_AT_LANGUAGE,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
133
|
+
O as CODE_EDITOR_AT_TEMPLATE_LANGUAGE_LABEL,
|
|
134
|
+
A as CODE_EDITOR_AT_TEMPLATE_NAME,
|
|
135
|
+
m as CODE_EDITOR_AT_TEMPLATE_TOKENS,
|
|
136
|
+
h as CODE_EDITOR_CLASSES,
|
|
137
|
+
g as CODE_EDITOR_DEFAULT_LANGUAGE,
|
|
138
|
+
D as CODE_EDITOR_DEFAULT_MAX_LINES,
|
|
139
|
+
u as CODE_EDITOR_DEFAULT_MIN_LINES,
|
|
140
|
+
I as CODE_EDITOR_FALLBACK_LANGUAGE_ICON,
|
|
141
|
+
E as CODE_EDITOR_KEY_COMPONENT,
|
|
142
|
+
p as CODE_EDITOR_LANGUAGE_ALIASES,
|
|
143
|
+
T as CODE_EDITOR_LANGUAGE_CHIP_ICON_INSTANCE_ID,
|
|
144
|
+
B as CODE_EDITOR_LINE_HEIGHT_BY_SIZE,
|
|
145
|
+
s as CODE_EDITOR_MONO_FONT_FAMILY,
|
|
146
|
+
_ as CODE_EDITOR_PADDING_PX,
|
|
147
|
+
l as CODE_EDITOR_READ_ONLY_LABEL,
|
|
148
|
+
L as getCodeEditorVSCodeModernPalette
|
|
149
149
|
};
|
|
@@ -51,7 +51,7 @@ export declare function getCodeEditorLineCount(value: string): number;
|
|
|
51
51
|
/**
|
|
52
52
|
* Build the Prism theme used by CodeEditor from the exact VS Code Modern palettes.
|
|
53
53
|
*/
|
|
54
|
-
export declare function createCodeEditorPrismTheme(theme: Theme): PrismTheme;
|
|
54
|
+
export declare function createCodeEditorPrismTheme(theme: Theme, modeOverride?: Theme['palette']['mode']): PrismTheme;
|
|
55
55
|
/**
|
|
56
56
|
* Render the highlighted code tree consumed by react-simple-code-editor.
|
|
57
57
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"highlighting.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/extended/ReactSimpleCodeEditor/helpers/highlighting.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAUjF,OAAO,KAAK,EACV,yBAAyB,EAEzB,qCAAqC,EACrC,0BAA0B,EAC1B,+BAA+B,EAC/B,2BAA2B,EAC3B,oBAAoB,EAGpB,iCAAiC,EACjC,yBAAyB,EACzB,gCAAgC,EACjC,MAAM,UAAU,CAAC;AA2GlB,eAAO,MAAM,wCAAwC,EAAE,0BAWtD,CAAC;
|
|
1
|
+
{"version":3,"file":"highlighting.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/components/src/components/extended/ReactSimpleCodeEditor/helpers/highlighting.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,MAAM,SAAS,CAAC;AAC5B,OAAO,EAA4B,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAUjF,OAAO,KAAK,EACV,yBAAyB,EAEzB,qC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2B,EAAE,GAChF,OAAO,CAAC,IAAI,CAAC,CAsBf;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,eAAe,CAAC,EAAE,yBAAyB,GAC1C,IAAI,CAQN;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACvC,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAKR;AAmqBD,qGAAqG;AACrG,wBAAgB,wBAAwB,CAAC,EACvC,IAAI,EACJ,gBAAgB,EAChB,YAAY,GACb,EAAE,iCAAiC,GAAG,gCAAgC,CAkBtE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5D;AA+HD;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,KAAK,EACZ,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,GACtC,UAAU,CAiIZ;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,gBAAgB,GACjB,EAAE,oBAAoB,GAAG,YAAY,CA6QrC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as d, Fragment as st } from "@emotion/react/jsx-runtime";
|
|
2
2
|
import K from "prismjs";
|
|
3
3
|
import { Highlight as Tt } from "prism-react-renderer";
|
|
4
4
|
import { CODE_EDITOR_AT_TEMPLATE_TOKENS as S, CODE_EDITOR_AT_LANGUAGE as B, CODE_EDITOR_AT_TEMPLATE_NAME as St, CODE_EDITOR_AT_TEMPLATE_LANGUAGE_LABEL as vt, CODE_EDITOR_DEFAULT_LANGUAGE as at, CODE_EDITOR_LANGUAGE_ALIASES as Ot, getCodeEditorVSCodeModernPalette as Q } from "../constants.js";
|
|
@@ -67,15 +67,15 @@ const V = K.languages, ct = {}, lt = {}, j = /* @__PURE__ */ new WeakMap(), At =
|
|
|
67
67
|
reservedWords: [...S.reservedWords]
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
function Nt(t) {
|
|
71
|
-
return [...Q(t).bracketPalette];
|
|
70
|
+
function Nt(t, e) {
|
|
71
|
+
return [...Q(t, e).bracketPalette];
|
|
72
72
|
}
|
|
73
|
-
function Rt(t) {
|
|
74
|
-
const
|
|
73
|
+
function Rt(t, e) {
|
|
74
|
+
const n = Q(t, e);
|
|
75
75
|
return {
|
|
76
|
-
constant:
|
|
77
|
-
type:
|
|
78
|
-
variable:
|
|
76
|
+
constant: n.syntax.constant,
|
|
77
|
+
type: n.syntax.type,
|
|
78
|
+
variable: n.syntax.variable
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
function Pt(t) {
|
|
@@ -298,7 +298,7 @@ function m(t, e) {
|
|
|
298
298
|
offset: n
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
function
|
|
301
|
+
function ft(t, e, n) {
|
|
302
302
|
const r = t.split(`
|
|
303
303
|
`), s = Math.min(Math.max(e, 1), Math.max(r.length, 1)), o = r.slice(0, s - 1).join(`
|
|
304
304
|
`), i = s === 1 ? 0 : o.length + 1, c = r[s - 1] || "";
|
|
@@ -310,7 +310,7 @@ function dt(t, e, n) {
|
|
|
310
310
|
function it(t, e) {
|
|
311
311
|
return typeof e.offset == "number" ? m(t, e.offset) : m(
|
|
312
312
|
t,
|
|
313
|
-
|
|
313
|
+
ft(t, e.line, e.column)
|
|
314
314
|
);
|
|
315
315
|
}
|
|
316
316
|
function w(t, e, n) {
|
|
@@ -379,7 +379,7 @@ function Jt(t, e) {
|
|
|
379
379
|
return D(t, Number(n[1]));
|
|
380
380
|
const r = e.match(/\bline\s+(\d+)\s+column\s+(\d+)\b/i);
|
|
381
381
|
if (r)
|
|
382
|
-
return
|
|
382
|
+
return ft(
|
|
383
383
|
t,
|
|
384
384
|
Number(r[1]),
|
|
385
385
|
Number(r[2])
|
|
@@ -719,129 +719,129 @@ function le(t, e, n) {
|
|
|
719
719
|
text: t.slice(c)
|
|
720
720
|
}), a.filter((l) => l.text.length > 0);
|
|
721
721
|
}
|
|
722
|
-
function Se(t) {
|
|
723
|
-
const
|
|
722
|
+
function Se(t, e) {
|
|
723
|
+
const n = Q(t, e), r = Rt(t, e);
|
|
724
724
|
return {
|
|
725
725
|
plain: {
|
|
726
726
|
backgroundColor: "transparent",
|
|
727
|
-
color:
|
|
727
|
+
color: n.surface.editorForeground
|
|
728
728
|
},
|
|
729
|
-
bracketPalette: Nt(t),
|
|
730
|
-
semanticPalette:
|
|
729
|
+
bracketPalette: Nt(t, e),
|
|
730
|
+
semanticPalette: r,
|
|
731
731
|
styles: [
|
|
732
732
|
{
|
|
733
733
|
types: ["comment", "prolog", "doctype", "cdata"],
|
|
734
734
|
style: {
|
|
735
|
-
color:
|
|
735
|
+
color: n.syntax.comment,
|
|
736
736
|
fontStyle: "italic"
|
|
737
737
|
}
|
|
738
738
|
},
|
|
739
739
|
{
|
|
740
740
|
types: ["punctuation"],
|
|
741
741
|
style: {
|
|
742
|
-
color:
|
|
742
|
+
color: n.surface.editorForeground
|
|
743
743
|
}
|
|
744
744
|
},
|
|
745
745
|
{
|
|
746
746
|
types: ["operator"],
|
|
747
747
|
style: {
|
|
748
|
-
color:
|
|
748
|
+
color: n.syntax.operator
|
|
749
749
|
}
|
|
750
750
|
},
|
|
751
751
|
{
|
|
752
752
|
types: ["property", "literal-property", "selector"],
|
|
753
753
|
style: {
|
|
754
|
-
color:
|
|
754
|
+
color: r.variable
|
|
755
755
|
}
|
|
756
756
|
},
|
|
757
757
|
{
|
|
758
758
|
types: ["attr-name"],
|
|
759
759
|
style: {
|
|
760
|
-
color:
|
|
760
|
+
color: n.syntax.attributeName
|
|
761
761
|
}
|
|
762
762
|
},
|
|
763
763
|
{
|
|
764
764
|
types: ["tag"],
|
|
765
765
|
style: {
|
|
766
|
-
color:
|
|
766
|
+
color: n.syntax.tag
|
|
767
767
|
}
|
|
768
768
|
},
|
|
769
769
|
{
|
|
770
770
|
types: ["boolean"],
|
|
771
771
|
style: {
|
|
772
|
-
color:
|
|
772
|
+
color: n.syntax.boolean
|
|
773
773
|
}
|
|
774
774
|
},
|
|
775
775
|
{
|
|
776
776
|
types: ["number"],
|
|
777
777
|
style: {
|
|
778
|
-
color:
|
|
778
|
+
color: n.syntax.number
|
|
779
779
|
}
|
|
780
780
|
},
|
|
781
781
|
{
|
|
782
782
|
types: ["symbol"],
|
|
783
783
|
style: {
|
|
784
|
-
color:
|
|
784
|
+
color: n.syntax.constant
|
|
785
785
|
}
|
|
786
786
|
},
|
|
787
787
|
{
|
|
788
788
|
types: ["atrule"],
|
|
789
789
|
style: {
|
|
790
|
-
color:
|
|
790
|
+
color: n.syntax.keyword
|
|
791
791
|
}
|
|
792
792
|
},
|
|
793
793
|
{
|
|
794
794
|
types: ["constant"],
|
|
795
795
|
style: {
|
|
796
|
-
color:
|
|
796
|
+
color: r.constant
|
|
797
797
|
}
|
|
798
798
|
},
|
|
799
799
|
{
|
|
800
800
|
types: ["string", "char", "inserted"],
|
|
801
801
|
style: {
|
|
802
|
-
color:
|
|
802
|
+
color: n.syntax.string
|
|
803
803
|
}
|
|
804
804
|
},
|
|
805
805
|
{
|
|
806
806
|
types: ["regex"],
|
|
807
807
|
style: {
|
|
808
|
-
color:
|
|
808
|
+
color: n.syntax.regex
|
|
809
809
|
}
|
|
810
810
|
},
|
|
811
811
|
{
|
|
812
812
|
types: ["constant.character.escape"],
|
|
813
813
|
style: {
|
|
814
|
-
color:
|
|
814
|
+
color: n.syntax.escape
|
|
815
815
|
}
|
|
816
816
|
},
|
|
817
817
|
{
|
|
818
818
|
types: ["keyword"],
|
|
819
819
|
style: {
|
|
820
|
-
color:
|
|
820
|
+
color: n.syntax.keyword
|
|
821
821
|
}
|
|
822
822
|
},
|
|
823
823
|
{
|
|
824
824
|
types: ["function", "function-variable", "method", "method-variable"],
|
|
825
825
|
style: {
|
|
826
|
-
color:
|
|
826
|
+
color: n.syntax.function
|
|
827
827
|
}
|
|
828
828
|
},
|
|
829
829
|
{
|
|
830
830
|
types: ["builtin", "class-name", "known-class-name", "maybe-class-name"],
|
|
831
831
|
style: {
|
|
832
|
-
color:
|
|
832
|
+
color: r.type
|
|
833
833
|
}
|
|
834
834
|
},
|
|
835
835
|
{
|
|
836
836
|
types: ["alias", "imports", "parameter", "variable"],
|
|
837
837
|
style: {
|
|
838
|
-
color:
|
|
838
|
+
color: r.variable
|
|
839
839
|
}
|
|
840
840
|
},
|
|
841
841
|
{
|
|
842
842
|
types: ["deleted"],
|
|
843
843
|
style: {
|
|
844
|
-
color:
|
|
844
|
+
color: n.surface.errorBorderColor
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
]
|
|
@@ -864,8 +864,8 @@ function ve({
|
|
|
864
864
|
`), M = q(l), C = jt(
|
|
865
865
|
t,
|
|
866
866
|
o
|
|
867
|
-
),
|
|
868
|
-
return !a || c === at ? /* @__PURE__ */
|
|
867
|
+
), dt = ce(c, a);
|
|
868
|
+
return !a || c === at ? /* @__PURE__ */ d(st, { children: l.map((L, _) => {
|
|
869
869
|
const k = M[_] || 0, N = A(
|
|
870
870
|
C,
|
|
871
871
|
k,
|
|
@@ -875,12 +875,12 @@ function ve({
|
|
|
875
875
|
k,
|
|
876
876
|
C
|
|
877
877
|
) : [{ hasError: !1, text: L || " " }];
|
|
878
|
-
return /* @__PURE__ */
|
|
878
|
+
return /* @__PURE__ */ d(
|
|
879
879
|
"div",
|
|
880
880
|
{
|
|
881
881
|
className: "token-line",
|
|
882
882
|
"data-code-editor-error-line": N || void 0,
|
|
883
|
-
children: R.map(($, z) => /* @__PURE__ */
|
|
883
|
+
children: R.map(($, z) => /* @__PURE__ */ d(
|
|
884
884
|
"span",
|
|
885
885
|
{
|
|
886
886
|
className: "token plain",
|
|
@@ -892,18 +892,18 @@ function ve({
|
|
|
892
892
|
},
|
|
893
893
|
`plain-line-${_}`
|
|
894
894
|
);
|
|
895
|
-
}) }) : /* @__PURE__ */
|
|
895
|
+
}) }) : /* @__PURE__ */ d(
|
|
896
896
|
Tt,
|
|
897
897
|
{
|
|
898
898
|
code: t || " ",
|
|
899
899
|
language: c,
|
|
900
|
-
prism:
|
|
900
|
+
prism: dt,
|
|
901
901
|
theme: s,
|
|
902
902
|
children: ({ tokens: L, getLineProps: _, getTokenProps: k }) => {
|
|
903
903
|
const N = s.bracketPalette, R = s.semanticPalette, $ = !!R && Pt(c);
|
|
904
904
|
let z = 0;
|
|
905
905
|
const x = {};
|
|
906
|
-
return /* @__PURE__ */
|
|
906
|
+
return /* @__PURE__ */ d(st, { children: L.map((W, O) => {
|
|
907
907
|
const H = M[O] || 0, mt = l[O] || "", pt = A(
|
|
908
908
|
C,
|
|
909
909
|
H,
|
|
@@ -911,7 +911,7 @@ function ve({
|
|
|
911
911
|
);
|
|
912
912
|
let et = 0;
|
|
913
913
|
const gt = _({ line: W });
|
|
914
|
-
return /* @__PURE__ */
|
|
914
|
+
return /* @__PURE__ */ d(
|
|
915
915
|
"div",
|
|
916
916
|
{
|
|
917
917
|
...gt,
|
|
@@ -930,28 +930,28 @@ function ve({
|
|
|
930
930
|
const g = It(u.content);
|
|
931
931
|
if (g.some((h) => h.isIdentifier)) {
|
|
932
932
|
let h = 0;
|
|
933
|
-
return g.map((
|
|
934
|
-
const P = `token-${O}-${G}-${F}`, rt = T + h, yt = rt +
|
|
933
|
+
return g.map((f, F) => {
|
|
934
|
+
const P = `token-${O}-${G}-${F}`, rt = T + h, yt = rt + f.content.length, ot = A(
|
|
935
935
|
C,
|
|
936
936
|
rt,
|
|
937
937
|
yt
|
|
938
938
|
);
|
|
939
|
-
if (h +=
|
|
939
|
+
if (h += f.content.length, !f.isIdentifier || !R)
|
|
940
940
|
return I(
|
|
941
941
|
x,
|
|
942
|
-
|
|
943
|
-
), /* @__PURE__ */
|
|
942
|
+
f.content
|
|
943
|
+
), /* @__PURE__ */ d(
|
|
944
944
|
"span",
|
|
945
945
|
{
|
|
946
946
|
className: p.className,
|
|
947
947
|
style: p.style,
|
|
948
948
|
"data-code-editor-error-token": ot || void 0,
|
|
949
|
-
children:
|
|
949
|
+
children: f.content
|
|
950
950
|
},
|
|
951
951
|
P
|
|
952
952
|
);
|
|
953
953
|
const Ct = g.slice(F + 1).map((xt) => xt.content).join(""), U = Gt({
|
|
954
|
-
identifier:
|
|
954
|
+
identifier: f.content,
|
|
955
955
|
nextSignificantText: wt(
|
|
956
956
|
W,
|
|
957
957
|
G,
|
|
@@ -962,9 +962,9 @@ function ve({
|
|
|
962
962
|
});
|
|
963
963
|
return I(
|
|
964
964
|
x,
|
|
965
|
-
|
|
965
|
+
f.content,
|
|
966
966
|
U
|
|
967
|
-
), /* @__PURE__ */
|
|
967
|
+
), /* @__PURE__ */ d(
|
|
968
968
|
"span",
|
|
969
969
|
{
|
|
970
970
|
className: p.className,
|
|
@@ -974,7 +974,7 @@ function ve({
|
|
|
974
974
|
} : p.style,
|
|
975
975
|
"data-code-editor-error-token": ot || void 0,
|
|
976
976
|
"data-code-editor-token-group": U,
|
|
977
|
-
children:
|
|
977
|
+
children: f.content
|
|
978
978
|
},
|
|
979
979
|
P
|
|
980
980
|
);
|
|
@@ -985,7 +985,7 @@ function ve({
|
|
|
985
985
|
x,
|
|
986
986
|
u.content,
|
|
987
987
|
nt
|
|
988
|
-
), /* @__PURE__ */
|
|
988
|
+
), /* @__PURE__ */ d(
|
|
989
989
|
"span",
|
|
990
990
|
{
|
|
991
991
|
...p,
|
|
@@ -994,9 +994,9 @@ function ve({
|
|
|
994
994
|
},
|
|
995
995
|
`token-${O}-${G}`
|
|
996
996
|
)) : Array.from(u.content).map((g, h) => {
|
|
997
|
-
const
|
|
997
|
+
const f = `token-${O}-${G}-${h}`;
|
|
998
998
|
if (!Ft(g))
|
|
999
|
-
return I(x, g), /* @__PURE__ */
|
|
999
|
+
return I(x, g), /* @__PURE__ */ d(
|
|
1000
1000
|
"span",
|
|
1001
1001
|
{
|
|
1002
1002
|
className: p.className,
|
|
@@ -1008,13 +1008,13 @@ function ve({
|
|
|
1008
1008
|
) || void 0,
|
|
1009
1009
|
children: g
|
|
1010
1010
|
},
|
|
1011
|
-
|
|
1011
|
+
f
|
|
1012
1012
|
);
|
|
1013
1013
|
const {
|
|
1014
1014
|
nextBracketDepth: F,
|
|
1015
1015
|
renderedBracketDepth: P
|
|
1016
1016
|
} = Ut(g, z);
|
|
1017
|
-
return z = F, I(x, g), /* @__PURE__ */
|
|
1017
|
+
return z = F, I(x, g), /* @__PURE__ */ d(
|
|
1018
1018
|
"span",
|
|
1019
1019
|
{
|
|
1020
1020
|
className: p.className,
|
|
@@ -1030,7 +1030,7 @@ function ve({
|
|
|
1030
1030
|
"data-code-editor-bracket-depth": P,
|
|
1031
1031
|
children: g
|
|
1032
1032
|
},
|
|
1033
|
-
|
|
1033
|
+
f
|
|
1034
1034
|
);
|
|
1035
1035
|
});
|
|
1036
1036
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
|
-
"version": "9.24.0-beta-feature-731-m4l-components-code-editor.
|
|
3
|
+
"version": "9.24.0-beta-feature-731-m4l-components-code-editor.4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -53,24 +53,24 @@
|
|
|
53
53
|
"@hookform/resolvers": "2.9.11",
|
|
54
54
|
"nprogress": "0.2.0",
|
|
55
55
|
"react-transition-group": "4.4.5",
|
|
56
|
-
"react-dropzone": "14.4.1",
|
|
57
|
-
"react-color": "2.19.3",
|
|
58
56
|
"react-rnd": "10.5.2",
|
|
59
57
|
"@mui/x-date-pickers": "6.20.2",
|
|
58
|
+
"react-color": "2.19.3",
|
|
60
59
|
"react-draggable": "4.5.0",
|
|
61
|
-
"date-fns": "2.30.0",
|
|
62
60
|
"react-spinners": "0.13.8",
|
|
61
|
+
"date-fns": "2.30.0",
|
|
62
|
+
"react-dropzone": "14.4.1",
|
|
63
63
|
"chart.js": "4.5.1",
|
|
64
64
|
"chartjs-chart-error-bars": "4.4.5",
|
|
65
65
|
"qrcode.react": "3.2.0",
|
|
66
|
-
"react-resizable-panels": "2.1.9",
|
|
67
|
-
"react-simple-code-editor": "0.14.1",
|
|
68
66
|
"simplebar-react": "3.2.6",
|
|
67
|
+
"react-simple-code-editor": "0.14.1",
|
|
68
|
+
"react-resizable-panels": "2.1.9",
|
|
69
69
|
"react-data-grid": "7.0.0-beta.47",
|
|
70
70
|
"react-dnd": "16.0.1",
|
|
71
71
|
"react-dnd-html5-backend": "16.0.1",
|
|
72
|
-
"react-window": "1.8.11",
|
|
73
72
|
"react-resizable": "3.1.3",
|
|
73
|
+
"react-window": "1.8.11",
|
|
74
74
|
"@tanstack/react-virtual": "3.13.23"
|
|
75
75
|
}
|
|
76
76
|
}
|