@m4l/components 9.24.0-beta-feature-731-m4l-components-code-editor.6 → 9.24.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/@types/types.d.ts +0 -11
- package/components/AppBar/AppBar.d.ts.map +1 -1
- package/components/AppBar/AppBar.js +36 -29
- package/components/AppBar/types.d.ts +2 -2
- package/components/AppBar/types.d.ts.map +1 -1
- package/components/GridLayout/subcomponents/GridItem/index.d.ts.map +1 -1
- package/components/GridLayout/subcomponents/GridItem/index.js +21 -20
- package/components/MFLoader/MFLoader.d.ts.map +1 -1
- package/components/MFLoader/MFLoader.js +39 -39
- package/components/MFLoader/types.d.ts +16 -0
- package/components/MFLoader/types.d.ts.map +1 -1
- package/components/SideBar/context/sideBarContext/index.d.ts.map +1 -1
- package/components/SideBar/context/sideBarContext/index.js +15 -14
- package/components/SideBar/hooks/useCollapse/useCollapse.d.ts +2 -1
- package/components/SideBar/hooks/useCollapse/useCollapse.d.ts.map +1 -1
- package/components/SideBar/hooks/useCollapse/useCollapse.js +9 -9
- package/components/SideBar/index.d.ts +1 -1
- package/components/SideBar/index.d.ts.map +1 -1
- package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItem/index.js +1 -1
- package/components/SideBar/subcomponents/TreeGroupItems/subcomponents/NodeMenuItemMain/NodeMenuItemMain.js +1 -1
- package/components/SideBar/types.d.ts +8 -1
- package/components/SideBar/types.d.ts.map +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/AreaGridLayout.d.ts.map +1 -1
- package/components/areas/components/AreasViewer/subcomponents/Area/subcomponents/AreaGridLayout/AreaGridLayout.js +66 -52
- package/components/areas/contexts/AreasContext/store.d.ts.map +1 -1
- package/components/areas/contexts/AreasContext/store.js +142 -141
- package/components/extended/index.d.ts +0 -1
- package/components/extended/index.d.ts.map +1 -1
- package/components/hook-form/index.d.ts +0 -1
- package/components/hook-form/index.d.ts.map +1 -1
- package/index.js +559 -572
- package/package.json +7 -10
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.d.ts +0 -6
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.js +0 -266
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.d.ts +0 -3
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.js +0 -311
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts +0 -82
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/constants.js +0 -148
- package/components/extended/ReactSimpleCodeEditor/dictionary.d.ts +0 -11
- package/components/extended/ReactSimpleCodeEditor/dictionary.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/dictionary.js +0 -7
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts +0 -58
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.js +0 -1063
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.d.ts +0 -6
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.js +0 -7
- package/components/extended/ReactSimpleCodeEditor/helpers/resolveEditorComponent.d.ts +0 -6
- package/components/extended/ReactSimpleCodeEditor/helpers/resolveEditorComponent.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/helpers/resolveEditorComponent.js +0 -9
- package/components/extended/ReactSimpleCodeEditor/index.d.ts +0 -4
- package/components/extended/ReactSimpleCodeEditor/index.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.d.ts +0 -18
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.js +0 -4
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.d.ts +0 -84
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.js +0 -64
- package/components/extended/ReactSimpleCodeEditor/slots/index.d.ts +0 -3
- package/components/extended/ReactSimpleCodeEditor/slots/index.d.ts.map +0 -1
- package/components/extended/ReactSimpleCodeEditor/types.d.ts +0 -452
- package/components/extended/ReactSimpleCodeEditor/types.d.ts.map +0 -1
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.d.ts +0 -7
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.d.ts.map +0 -1
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.js +0 -6
- package/components/hook-form/RHFCodeEditor/index.d.ts +0 -3
- package/components/hook-form/RHFCodeEditor/index.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@m4l/components",
|
|
3
|
-
"version": "9.24.0
|
|
3
|
+
"version": "9.24.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -46,31 +46,28 @@
|
|
|
46
46
|
"fast-equals": "5.4.0",
|
|
47
47
|
"lodash-es": "4.17.23",
|
|
48
48
|
"@textea/json-viewer": "4.0.1",
|
|
49
|
-
"prismjs": "1.30.0",
|
|
50
|
-
"prism-react-renderer": "2.4.1",
|
|
51
49
|
"react-dom": "19.2.4",
|
|
52
50
|
"react-helmet-async": "2.0.5",
|
|
53
51
|
"@hookform/resolvers": "2.9.11",
|
|
54
52
|
"nprogress": "0.2.0",
|
|
55
53
|
"react-transition-group": "4.4.5",
|
|
56
|
-
"react-color": "2.19.3",
|
|
57
|
-
"@mui/x-date-pickers": "6.20.2",
|
|
58
54
|
"react-rnd": "10.5.2",
|
|
55
|
+
"react-dropzone": "14.4.1",
|
|
56
|
+
"@mui/x-date-pickers": "6.20.2",
|
|
57
|
+
"react-color": "2.19.3",
|
|
58
|
+
"date-fns": "2.30.0",
|
|
59
59
|
"react-draggable": "4.5.0",
|
|
60
60
|
"react-spinners": "0.13.8",
|
|
61
|
-
"date-fns": "2.30.0",
|
|
62
|
-
"react-dropzone": "14.4.1",
|
|
63
61
|
"chart.js": "4.5.1",
|
|
64
62
|
"chartjs-chart-error-bars": "4.4.5",
|
|
65
63
|
"qrcode.react": "3.2.0",
|
|
66
|
-
"simplebar-react": "3.2.6",
|
|
67
|
-
"react-simple-code-editor": "0.14.1",
|
|
68
64
|
"react-resizable-panels": "2.1.9",
|
|
65
|
+
"simplebar-react": "3.2.6",
|
|
69
66
|
"react-data-grid": "7.0.0-beta.47",
|
|
70
67
|
"react-dnd": "16.0.1",
|
|
71
68
|
"react-dnd-html5-backend": "16.0.1",
|
|
72
|
-
"react-window": "1.8.11",
|
|
73
69
|
"react-resizable": "3.1.3",
|
|
70
|
+
"react-window": "1.8.11",
|
|
74
71
|
"@tanstack/react-virtual": "3.13.23"
|
|
75
72
|
}
|
|
76
73
|
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { CodeEditorProps } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Render a syntax-highlighted code editor with optional self-managed fallback state.
|
|
4
|
-
*/
|
|
5
|
-
export declare function CodeEditor(props: CodeEditorProps): import("@emotion/react/jsx-runtime").JSX.Element;
|
|
6
|
-
//# sourceMappingURL=CodeEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/extended/ReactSimpleCodeEditor/CodeEditor.tsx"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAEV,eAAe,EAEhB,MAAM,SAAS,CAAC;AAyBjB;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,oDAwXhD"}
|
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
import { jsx as a, jsxs as T } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useModuleDictionary as Me, useModuleSkeleton as Ve } from "@m4l/core";
|
|
3
|
-
import _ from "clsx";
|
|
4
|
-
import { useId as ke, useState as Q, useRef as Pe, useMemo as E, useEffect as W, useCallback as B } from "react";
|
|
5
|
-
import { getPropDataTestId as x, getNameDataTestId as ze } from "../../../test/getNameDataTestId.js";
|
|
6
|
-
import { CODE_EDITOR_DEFAULT_MAX_LINES as Be, CODE_EDITOR_DEFAULT_MIN_LINES as He, CODE_EDITOR_DEFAULT_LANGUAGE as we, CODE_EDITOR_LINE_HEIGHT_BY_SIZE as Ge, CODE_EDITOR_CLASSES as C, CODE_EDITOR_KEY_COMPONENT as p, CODE_EDITOR_READ_ONLY_LABEL as Ue, CODE_EDITOR_LANGUAGE_CHIP_ICON_INSTANCE_ID as Ye } from "./constants.js";
|
|
7
|
-
import { CODE_EDITOR_DICTIONARY as ee } from "./dictionary.js";
|
|
8
|
-
import { resolveCodeEditorLanguageIcon as Fe } from "./helpers/languageIcon.js";
|
|
9
|
-
import { ensureCodeEditorRuntimeDependencies as je, getCodeEditorLineCount as qe, createCodeEditorPrismTheme as Ke, resolveCodeEditorLanguageTemplate as Xe, validateCodeEditorSyntax as Ze, highlightCode as $e } from "./helpers/highlighting.js";
|
|
10
|
-
import { SkeletonStyled as Je, RootStyled as Qe, HeaderStyled as We, LanguageChipStyled as et, LanguageChipIconStyled as tt, HeaderBadgesStyled as at, ReadOnlyChipStyled as nt, BodyStyled as rt, LineNumbersStyled as ot, LineNumberStyled as lt, EditorScrollerStyled as it, PlaceholderStyled as st, EditorStyled as dt } from "./slots/CodeEditorSlots.js";
|
|
11
|
-
import { CodeEditorSlots as f } from "./slots/CodeEditorEnum.js";
|
|
12
|
-
function ct(o) {
|
|
13
|
-
return o === "dark" ? "dark" : "light";
|
|
14
|
-
}
|
|
15
|
-
function ut(o, L) {
|
|
16
|
-
return o.length !== L.length ? !1 : o.every((O, y) => O === L[y]);
|
|
17
|
-
}
|
|
18
|
-
function Tt(o) {
|
|
19
|
-
const {
|
|
20
|
-
className: L,
|
|
21
|
-
colorMode: O = "light",
|
|
22
|
-
customLanguages: y,
|
|
23
|
-
dataTestId: S,
|
|
24
|
-
defaultValue: te,
|
|
25
|
-
disabled: I = !1,
|
|
26
|
-
editorClassName: ae,
|
|
27
|
-
error: ne = !1,
|
|
28
|
-
highlightTheme: H,
|
|
29
|
-
id: re,
|
|
30
|
-
insertSpaces: oe,
|
|
31
|
-
languageIcon: le,
|
|
32
|
-
languageLabel: ie,
|
|
33
|
-
languageTemplate: n,
|
|
34
|
-
languageText: se,
|
|
35
|
-
maxLines: de = Be,
|
|
36
|
-
minLines: v = He,
|
|
37
|
-
onBlur: ce,
|
|
38
|
-
onChange: R,
|
|
39
|
-
placeholder: N,
|
|
40
|
-
preClassName: ue,
|
|
41
|
-
readOnly: d = !1,
|
|
42
|
-
readOnlyLabel: ge,
|
|
43
|
-
runtimeDependencies: c,
|
|
44
|
-
showLineNumbers: w = !1,
|
|
45
|
-
showPlaceholder: G = !0,
|
|
46
|
-
size: U = "medium",
|
|
47
|
-
syntaxValidator: b,
|
|
48
|
-
skeleton: me = !1,
|
|
49
|
-
textareaClassName: he,
|
|
50
|
-
validateSyntax: Y = !1,
|
|
51
|
-
value: u,
|
|
52
|
-
variant: Ee = "outlined",
|
|
53
|
-
...D
|
|
54
|
-
} = o, Ce = ke(), pe = re || Ce, { getLabel: fe } = Me(), Le = Ve() || me, g = R === void 0, [A, ye] = Q(0), M = Pe([]), [Se, F] = Q(
|
|
55
|
-
u ?? te ?? ""
|
|
56
|
-
), V = ct(O), j = E(() => c ? Array.isArray(c) ? c : [c] : [], [c]);
|
|
57
|
-
ut(
|
|
58
|
-
M.current,
|
|
59
|
-
j
|
|
60
|
-
) || (M.current = j);
|
|
61
|
-
const k = M.current;
|
|
62
|
-
W(() => {
|
|
63
|
-
g && u !== void 0 && F(u);
|
|
64
|
-
}, [g, u]), W(() => {
|
|
65
|
-
if (!k.length)
|
|
66
|
-
return;
|
|
67
|
-
let e = !0;
|
|
68
|
-
return je(k).catch(() => {
|
|
69
|
-
}).then(() => {
|
|
70
|
-
e && ye((s) => s + 1);
|
|
71
|
-
}), () => {
|
|
72
|
-
e = !1;
|
|
73
|
-
};
|
|
74
|
-
}, [k]);
|
|
75
|
-
const r = g ? Se : u ?? "", Ie = G && r.length === 0 && !!N, De = Ge[U], q = qe(r), K = Math.max(q, v), P = Math.max(v, de), Te = Math.min(K, P), _e = q >= P, X = E(
|
|
76
|
-
() => H ?? Ke(V),
|
|
77
|
-
[V, H]
|
|
78
|
-
), l = E(
|
|
79
|
-
() => Xe(n),
|
|
80
|
-
[n, A]
|
|
81
|
-
), m = se ?? l?.languageText ?? we, Z = ie ?? l?.languageLabel, $ = !!Z, xe = Fe(
|
|
82
|
-
le ?? l?.languageIcon
|
|
83
|
-
), z = d ? fe(ee.readOnly) : void 0, Oe = ge ?? (z && z !== ee.readOnly ? z : Ue), h = E(() => {
|
|
84
|
-
if (b)
|
|
85
|
-
return b({
|
|
86
|
-
code: r,
|
|
87
|
-
languageTemplate: l ?? n,
|
|
88
|
-
languageText: m
|
|
89
|
-
});
|
|
90
|
-
if (Y)
|
|
91
|
-
return Ze({
|
|
92
|
-
code: r,
|
|
93
|
-
languageTemplate: l ?? n,
|
|
94
|
-
languageText: m
|
|
95
|
-
});
|
|
96
|
-
}, [
|
|
97
|
-
n,
|
|
98
|
-
l,
|
|
99
|
-
m,
|
|
100
|
-
r,
|
|
101
|
-
A,
|
|
102
|
-
b,
|
|
103
|
-
Y
|
|
104
|
-
]), J = ne || !!h && !h.isValid, i = h && !h.isValid ? h.errorRange : void 0, ve = E(() => {
|
|
105
|
-
if (!i)
|
|
106
|
-
return /* @__PURE__ */ new Set();
|
|
107
|
-
const e = i.start.line, s = i.end?.line ?? e;
|
|
108
|
-
return new Set(
|
|
109
|
-
Array.from(
|
|
110
|
-
{ length: Math.max(s - e + 1, 1) },
|
|
111
|
-
(gt, Ae) => e + Ae
|
|
112
|
-
)
|
|
113
|
-
);
|
|
114
|
-
}, [i]), t = {
|
|
115
|
-
colorMode: V,
|
|
116
|
-
disabled: I,
|
|
117
|
-
error: J,
|
|
118
|
-
isLineCapped: _e,
|
|
119
|
-
isEmpty: r.length === 0,
|
|
120
|
-
isPlaceholderVisible: Ie,
|
|
121
|
-
lineHeight: De,
|
|
122
|
-
maxLines: P,
|
|
123
|
-
minLines: v,
|
|
124
|
-
readOnly: d,
|
|
125
|
-
showLineNumbers: w,
|
|
126
|
-
size: U,
|
|
127
|
-
variant: Ee,
|
|
128
|
-
visibleLineCount: Te
|
|
129
|
-
}, Re = B(
|
|
130
|
-
(e) => $e({
|
|
131
|
-
code: e,
|
|
132
|
-
customLanguages: y,
|
|
133
|
-
languageTemplate: n,
|
|
134
|
-
languageText: m,
|
|
135
|
-
prismTheme: X,
|
|
136
|
-
syntaxErrorRange: i
|
|
137
|
-
}),
|
|
138
|
-
[
|
|
139
|
-
y,
|
|
140
|
-
n,
|
|
141
|
-
X,
|
|
142
|
-
m,
|
|
143
|
-
A,
|
|
144
|
-
i
|
|
145
|
-
]
|
|
146
|
-
), Ne = B(
|
|
147
|
-
(e) => {
|
|
148
|
-
g && F(e), R?.(e);
|
|
149
|
-
},
|
|
150
|
-
[R, g]
|
|
151
|
-
), be = B(
|
|
152
|
-
(e) => {
|
|
153
|
-
if (I || e.target instanceof Element && e.target.closest("textarea"))
|
|
154
|
-
return;
|
|
155
|
-
e.currentTarget.querySelector("textarea")?.focus();
|
|
156
|
-
},
|
|
157
|
-
[I]
|
|
158
|
-
);
|
|
159
|
-
return Le ? /* @__PURE__ */ a(Je, { ownerState: t }) : /* @__PURE__ */ T(
|
|
160
|
-
Qe,
|
|
161
|
-
{
|
|
162
|
-
ownerState: t,
|
|
163
|
-
"aria-disabled": t.disabled || void 0,
|
|
164
|
-
className: _(C.root, L),
|
|
165
|
-
...x(p, f.root, S),
|
|
166
|
-
children: [
|
|
167
|
-
$ || d ? /* @__PURE__ */ T(We, { ownerState: t, className: C.header, children: [
|
|
168
|
-
$ ? /* @__PURE__ */ a(
|
|
169
|
-
et,
|
|
170
|
-
{
|
|
171
|
-
label: Z,
|
|
172
|
-
size: "small",
|
|
173
|
-
variant: "outlined",
|
|
174
|
-
color: "default",
|
|
175
|
-
startIcon: /* @__PURE__ */ a(
|
|
176
|
-
tt,
|
|
177
|
-
{
|
|
178
|
-
...x(
|
|
179
|
-
p,
|
|
180
|
-
f.languageChipIcon,
|
|
181
|
-
Ye
|
|
182
|
-
),
|
|
183
|
-
children: /* @__PURE__ */ a(xe, { fontSize: "small" })
|
|
184
|
-
}
|
|
185
|
-
)
|
|
186
|
-
}
|
|
187
|
-
) : null,
|
|
188
|
-
/* @__PURE__ */ a(at, { ownerState: t, children: d ? /* @__PURE__ */ a(
|
|
189
|
-
nt,
|
|
190
|
-
{
|
|
191
|
-
label: Oe,
|
|
192
|
-
size: "small"
|
|
193
|
-
}
|
|
194
|
-
) : null })
|
|
195
|
-
] }) : null,
|
|
196
|
-
/* @__PURE__ */ T(
|
|
197
|
-
rt,
|
|
198
|
-
{
|
|
199
|
-
ownerState: t,
|
|
200
|
-
onClick: be,
|
|
201
|
-
...x(p, f.body, S),
|
|
202
|
-
children: [
|
|
203
|
-
w ? /* @__PURE__ */ a(ot, { ownerState: t, "aria-hidden": "true", children: Array.from({ length: K }, (e, s) => s + 1).map(
|
|
204
|
-
(e) => /* @__PURE__ */ a(
|
|
205
|
-
lt,
|
|
206
|
-
{
|
|
207
|
-
ownerState: t,
|
|
208
|
-
"data-code-editor-error-line": ve.has(e) || void 0,
|
|
209
|
-
children: e
|
|
210
|
-
},
|
|
211
|
-
`code-editor-line-${e}`
|
|
212
|
-
)
|
|
213
|
-
) }) : null,
|
|
214
|
-
/* @__PURE__ */ T(it, { ownerState: t, children: [
|
|
215
|
-
G && t.isEmpty && N ? /* @__PURE__ */ a(
|
|
216
|
-
st,
|
|
217
|
-
{
|
|
218
|
-
ownerState: t,
|
|
219
|
-
...x(
|
|
220
|
-
p,
|
|
221
|
-
f.placeholder,
|
|
222
|
-
S
|
|
223
|
-
),
|
|
224
|
-
children: N
|
|
225
|
-
}
|
|
226
|
-
) : null,
|
|
227
|
-
/* @__PURE__ */ a(
|
|
228
|
-
dt,
|
|
229
|
-
{
|
|
230
|
-
...D,
|
|
231
|
-
ownerState: t,
|
|
232
|
-
"aria-label": D["aria-label"] ?? "Code editor",
|
|
233
|
-
"aria-invalid": D["aria-invalid"] ?? (J || void 0),
|
|
234
|
-
className: _(C.editor, ae),
|
|
235
|
-
"data-testid": ze(
|
|
236
|
-
p,
|
|
237
|
-
f.textarea,
|
|
238
|
-
S
|
|
239
|
-
),
|
|
240
|
-
disabled: I,
|
|
241
|
-
highlight: Re,
|
|
242
|
-
insertSpaces: oe,
|
|
243
|
-
onBlur: ce,
|
|
244
|
-
onValueChange: Ne,
|
|
245
|
-
preClassName: _(C.pre, ue),
|
|
246
|
-
readOnly: d,
|
|
247
|
-
tabSize: D.tabSize,
|
|
248
|
-
textareaClassName: _(
|
|
249
|
-
C.textarea,
|
|
250
|
-
he
|
|
251
|
-
),
|
|
252
|
-
textareaId: pe,
|
|
253
|
-
value: r
|
|
254
|
-
}
|
|
255
|
-
)
|
|
256
|
-
] })
|
|
257
|
-
]
|
|
258
|
-
}
|
|
259
|
-
)
|
|
260
|
-
]
|
|
261
|
-
}
|
|
262
|
-
);
|
|
263
|
-
}
|
|
264
|
-
export {
|
|
265
|
-
Tt as CodeEditor
|
|
266
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CodeEditor.styles.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAGhD,eAAO,MAAM,gBAAgB,EAAE,gBAyV9B,CAAC"}
|
|
@@ -1,311 +0,0 @@
|
|
|
1
|
-
import { getTypographyStyles as d } from "../../../utils/getTypographyStyles.js";
|
|
2
|
-
import { getCodeEditorVSCodeModernPalette as l, CODE_EDITOR_LINE_HEIGHT_BY_SIZE as n, CODE_EDITOR_MONO_FONT_FAMILY as s, CODE_EDITOR_PADDING_PX as i } from "./constants.js";
|
|
3
|
-
import { getSizeStyles as p } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
4
|
-
const b = {
|
|
5
|
-
/** Resolve the interactive shell colors and focus treatment for the editor root. */
|
|
6
|
-
root: ({ theme: e, ownerState: r }) => {
|
|
7
|
-
const o = !r?.disabled && !r?.readOnly, a = r?.disabled ? e.vars.palette.border.disabled : e.vars.palette.border.secondary;
|
|
8
|
-
return {
|
|
9
|
-
width: "100%",
|
|
10
|
-
display: "flex",
|
|
11
|
-
flexDirection: "column",
|
|
12
|
-
minHeight: 0,
|
|
13
|
-
gap: 0,
|
|
14
|
-
border: e.vars.size.borderStroke.container,
|
|
15
|
-
borderColor: r?.variant === "outlined" || r?.error ? a : "transparent",
|
|
16
|
-
borderRadius: e.vars.size.borderRadius["r1-5"],
|
|
17
|
-
...r?.error && {
|
|
18
|
-
borderColor: e.vars.palette.error.focus
|
|
19
|
-
},
|
|
20
|
-
...r?.variant === "contained" && {
|
|
21
|
-
backgroundColor: e.vars.palette.default.enabledOpacity
|
|
22
|
-
},
|
|
23
|
-
...r?.variant === "outlined" && {
|
|
24
|
-
backgroundColor: e.vars.palette.background.default
|
|
25
|
-
},
|
|
26
|
-
...r?.readOnly && {
|
|
27
|
-
backgroundColor: `${e.vars.palette.default.enabledOpacity}!important`
|
|
28
|
-
},
|
|
29
|
-
overflow: "hidden",
|
|
30
|
-
opacity: r?.disabled ? 0.72 : 1,
|
|
31
|
-
outline: "3px solid",
|
|
32
|
-
outlineColor: "transparent",
|
|
33
|
-
transition: "border-color 120ms ease, outline 120ms ease, opacity 120ms ease, background-color 120ms ease",
|
|
34
|
-
...o && {
|
|
35
|
-
"&:hover": {
|
|
36
|
-
backgroundColor: e.vars.palette.default.hoverOpacity,
|
|
37
|
-
...r?.error && {
|
|
38
|
-
borderColor: e.vars.palette.error.active
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"&:focus-within": {
|
|
42
|
-
borderColor: e.vars.palette.primary.enabled,
|
|
43
|
-
outline: "3px solid",
|
|
44
|
-
outlineColor: r?.error ? e.vars.palette.error.focusOpacity : e.vars.palette.primary.hoverOpacity,
|
|
45
|
-
...r?.error && {
|
|
46
|
-
borderColor: e.vars.palette.error.enabled
|
|
47
|
-
},
|
|
48
|
-
...r?.variant === "contained" && {
|
|
49
|
-
backgroundColor: e.vars.palette.background.default,
|
|
50
|
-
"&&& .M4LCodeEditor-header": {
|
|
51
|
-
backgroundColor: e.vars.palette.default.enabledOpacity
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
/** Layout the language badge row above the editing surface. */
|
|
59
|
-
header: ({ theme: e, ownerState: r }) => {
|
|
60
|
-
const o = l(
|
|
61
|
-
r?.colorMode
|
|
62
|
-
);
|
|
63
|
-
return {
|
|
64
|
-
display: "flex",
|
|
65
|
-
alignItems: "center",
|
|
66
|
-
justifyContent: "space-between",
|
|
67
|
-
padding: e.vars.size.baseSpacings.sp2,
|
|
68
|
-
gap: e.vars.size.baseSpacings.sp2,
|
|
69
|
-
borderBottom: e.vars.size.borderStroke.container,
|
|
70
|
-
borderColor: e.vars.palette.border.secondary,
|
|
71
|
-
...r?.variant === "contained" && {
|
|
72
|
-
backgroundColor: "transparent"
|
|
73
|
-
},
|
|
74
|
-
...r?.variant === "outlined" && {
|
|
75
|
-
backgroundColor: e.vars.palette.background.default
|
|
76
|
-
},
|
|
77
|
-
...r?.readOnly && {
|
|
78
|
-
backgroundColor: `${e.vars.palette.background.default}!important`
|
|
79
|
-
},
|
|
80
|
-
color: o.surface.headerForeground,
|
|
81
|
-
borderTopLeftRadius: e.vars.size.borderRadius.r2,
|
|
82
|
-
borderTopRightRadius: e.vars.size.borderRadius.r2,
|
|
83
|
-
overflow: "hidden",
|
|
84
|
-
minHeight: "33px"
|
|
85
|
-
};
|
|
86
|
-
},
|
|
87
|
-
/** Align any trailing badges rendered in the header row. */
|
|
88
|
-
headerBadges: ({ theme: e }) => ({
|
|
89
|
-
display: "flex",
|
|
90
|
-
alignItems: "center",
|
|
91
|
-
justifyContent: "flex-end",
|
|
92
|
-
gap: e.vars.size.baseSpacings.sp1,
|
|
93
|
-
minWidth: 0,
|
|
94
|
-
// Keep badges right-aligned even when the language chip is absent and the
|
|
95
|
-
// badges container is the only child of the header row.
|
|
96
|
-
marginLeft: "auto"
|
|
97
|
-
}),
|
|
98
|
-
/** Keep the leading language chip aligned with the editor header layout. */
|
|
99
|
-
languageChip: ({ theme: e, ownerState: r }) => {
|
|
100
|
-
const o = l(
|
|
101
|
-
r?.colorMode
|
|
102
|
-
);
|
|
103
|
-
return {
|
|
104
|
-
flexShrink: 0,
|
|
105
|
-
minWidth: 0,
|
|
106
|
-
whiteSpace: "nowrap",
|
|
107
|
-
textTransform: "lowercase",
|
|
108
|
-
paddingTop: 0,
|
|
109
|
-
paddingBottom: 0,
|
|
110
|
-
backgroundColor: "transparent",
|
|
111
|
-
borderColor: e.vars.palette.chips.default.outlined.backgroundActive,
|
|
112
|
-
color: o.surface.languageChipForeground,
|
|
113
|
-
...p(
|
|
114
|
-
e,
|
|
115
|
-
r?.size || "medium",
|
|
116
|
-
"base",
|
|
117
|
-
(a) => ({ height: a })
|
|
118
|
-
),
|
|
119
|
-
"&&& .M4LTypography-root": {
|
|
120
|
-
...d(e.generalSettings.isMobile, r?.size || "medium", "microSlim"),
|
|
121
|
-
color: o.surface.languageChipForeground,
|
|
122
|
-
lineHeight: "normal",
|
|
123
|
-
textTransform: "uppercase"
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
},
|
|
127
|
-
/** Keep the language icon aligned while preserving any intrinsic Seti fill colors. */
|
|
128
|
-
languageChipIcon: () => ({
|
|
129
|
-
display: "inline-flex",
|
|
130
|
-
flexShrink: 0,
|
|
131
|
-
width: "16px",
|
|
132
|
-
height: "16px",
|
|
133
|
-
lineHeight: 0,
|
|
134
|
-
"& .MuiSvgIcon-root": {
|
|
135
|
-
display: "block",
|
|
136
|
-
width: "16px",
|
|
137
|
-
height: "16px",
|
|
138
|
-
fontSize: "16px"
|
|
139
|
-
}
|
|
140
|
-
}),
|
|
141
|
-
/** Keep the read-only chip aligned with the trailing header actions. */
|
|
142
|
-
readOnlyChip: ({ theme: e, ownerState: r }) => ({
|
|
143
|
-
"&&&": {
|
|
144
|
-
flexShrink: 0,
|
|
145
|
-
minWidth: 0,
|
|
146
|
-
whiteSpace: "nowrap",
|
|
147
|
-
...p(
|
|
148
|
-
e,
|
|
149
|
-
r?.size || "medium",
|
|
150
|
-
"base",
|
|
151
|
-
(o) => ({ height: o })
|
|
152
|
-
),
|
|
153
|
-
"&&& .M4LTypography-root": {
|
|
154
|
-
...d(e.generalSettings.isMobile, r?.size || "medium", "microSlim"),
|
|
155
|
-
color: e.vars.palette.chips.info.contained.color
|
|
156
|
-
},
|
|
157
|
-
backgroundColor: e.vars.palette.chips.info.contained.backgroundColor,
|
|
158
|
-
borderColor: "transparent"
|
|
159
|
-
}
|
|
160
|
-
}),
|
|
161
|
-
/** Build the two-column layout used by the gutter and editor scroller. */
|
|
162
|
-
body: ({ theme: e, ownerState: r }) => {
|
|
163
|
-
const o = r?.visibleLineCount || r?.minLines || 1, a = r?.lineHeight || n.medium, t = r?.isLineCapped ? i : i * 2;
|
|
164
|
-
return {
|
|
165
|
-
display: "grid",
|
|
166
|
-
gridTemplateColumns: r?.showLineNumbers ? "auto minmax(0, 1fr)" : "minmax(0, 1fr)",
|
|
167
|
-
width: "100%",
|
|
168
|
-
alignItems: "start",
|
|
169
|
-
columnGap: 0,
|
|
170
|
-
maxHeight: `${o * a + t}px`,
|
|
171
|
-
minHeight: 0,
|
|
172
|
-
overflow: "auto",
|
|
173
|
-
pointerEvents: r?.disabled ? "none" : "auto",
|
|
174
|
-
userSelect: r?.disabled ? "none" : "auto",
|
|
175
|
-
gap: e.vars.size.baseSpacings.sp2
|
|
176
|
-
};
|
|
177
|
-
},
|
|
178
|
-
/** Style the optional line-number gutter. */
|
|
179
|
-
lineNumbers: ({ theme: e, ownerState: r }) => {
|
|
180
|
-
const o = l(
|
|
181
|
-
r?.colorMode
|
|
182
|
-
);
|
|
183
|
-
return {
|
|
184
|
-
display: "flex",
|
|
185
|
-
flexDirection: "column",
|
|
186
|
-
alignItems: "flex-end",
|
|
187
|
-
padding: `${i}px ${e.vars.size.baseSpacings.sp1} ${r?.isLineCapped ? 0 : i}px ${e.vars.size.baseSpacings.sp2}`,
|
|
188
|
-
backgroundColor: "transparent",
|
|
189
|
-
color: r?.disabled ? o.surface.placeholderForeground : o.surface.lineNumberForeground,
|
|
190
|
-
userSelect: "none",
|
|
191
|
-
...d(e.generalSettings.isMobile, r?.size || "medium", "bodyStandard"),
|
|
192
|
-
fontFamily: s,
|
|
193
|
-
lineHeight: `${n[r?.size || "medium"]}px`
|
|
194
|
-
};
|
|
195
|
-
},
|
|
196
|
-
/** Keep each rendered line number aligned with the code line height. */
|
|
197
|
-
lineNumber: ({ theme: e, ownerState: r }) => {
|
|
198
|
-
const o = l(
|
|
199
|
-
r?.colorMode
|
|
200
|
-
);
|
|
201
|
-
return {
|
|
202
|
-
display: "block",
|
|
203
|
-
minWidth: "2ch",
|
|
204
|
-
height: `${r?.lineHeight || n.medium}px`,
|
|
205
|
-
lineHeight: `${r?.lineHeight || n.medium}px`,
|
|
206
|
-
textAlign: "right",
|
|
207
|
-
'&[data-code-editor-error-line="true"]': {
|
|
208
|
-
color: o.surface.errorBorderColor,
|
|
209
|
-
borderLeft: `1px solid ${o.surface.errorBorderColor}`
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
},
|
|
213
|
-
/** Provide horizontal overflow for long code lines without wrapping them. */
|
|
214
|
-
editorScroller: ({ theme: e }) => ({
|
|
215
|
-
position: "relative",
|
|
216
|
-
width: "fit-content",
|
|
217
|
-
minWidth: "100%",
|
|
218
|
-
paddingTop: e.vars.size.baseSpacings.sp3,
|
|
219
|
-
paddingBottom: e.vars.size.baseSpacings.sp3,
|
|
220
|
-
paddingRight: e.vars.size.baseSpacings.sp2,
|
|
221
|
-
paddingLeft: e.vars.size.baseSpacings.sp2,
|
|
222
|
-
backgroundColor: "transparent"
|
|
223
|
-
}),
|
|
224
|
-
/** Style the underlying react-simple-code-editor surface and its inner elements. */
|
|
225
|
-
editor: ({ theme: e, ownerState: r }) => {
|
|
226
|
-
const o = l(
|
|
227
|
-
r?.colorMode
|
|
228
|
-
), a = r?.isLineCapped ? 0 : i, t = i + a;
|
|
229
|
-
return {
|
|
230
|
-
position: "relative",
|
|
231
|
-
zIndex: 0,
|
|
232
|
-
width: "max-content",
|
|
233
|
-
minWidth: "100%",
|
|
234
|
-
minHeight: `calc(${r?.minLines || 1} * ${r?.lineHeight || n.medium}px + ${t}px)`,
|
|
235
|
-
backgroundColor: "transparent",
|
|
236
|
-
fontFamily: s,
|
|
237
|
-
fontSize: "11px",
|
|
238
|
-
lineHeight: `${r?.lineHeight || n.medium}px`,
|
|
239
|
-
fontWeight: 400,
|
|
240
|
-
"& textarea, & pre": {
|
|
241
|
-
...d(e.generalSettings.isMobile, r?.size || "medium", "bodyStandard"),
|
|
242
|
-
fontFamily: s,
|
|
243
|
-
lineHeight: `${r?.lineHeight || n.medium}px`,
|
|
244
|
-
whiteSpace: "pre !important",
|
|
245
|
-
wordBreak: "normal",
|
|
246
|
-
overflowWrap: "normal",
|
|
247
|
-
margin: 0,
|
|
248
|
-
paddingTop: `${i}px`,
|
|
249
|
-
paddingRight: `${i}px`,
|
|
250
|
-
paddingBottom: `${a}px`,
|
|
251
|
-
paddingLeft: `${i}px`,
|
|
252
|
-
tabSize: 2,
|
|
253
|
-
fontVariantLigatures: "none",
|
|
254
|
-
backgroundColor: "transparent"
|
|
255
|
-
},
|
|
256
|
-
"&&& textarea": {
|
|
257
|
-
...d(e.generalSettings.isMobile, r?.size || "medium", "microSlim"),
|
|
258
|
-
outline: "none",
|
|
259
|
-
backgroundColor: "transparent",
|
|
260
|
-
caretColor: r?.disabled ? "transparent" : o.surface.caretForeground,
|
|
261
|
-
cursor: r?.disabled ? "not-allowed" : r?.readOnly ? "default" : "text",
|
|
262
|
-
"&::selection": {
|
|
263
|
-
backgroundColor: o.surface.selectionBackground
|
|
264
|
-
}
|
|
265
|
-
},
|
|
266
|
-
"& pre": {
|
|
267
|
-
color: r?.disabled ? o.surface.placeholderForeground : o.surface.editorForeground
|
|
268
|
-
},
|
|
269
|
-
"& .token-line": {
|
|
270
|
-
display: "block",
|
|
271
|
-
width: "100%"
|
|
272
|
-
},
|
|
273
|
-
'& .token-line[data-code-editor-error-line="true"]': {
|
|
274
|
-
backgroundColor: o.surface.errorLineBackground
|
|
275
|
-
},
|
|
276
|
-
'& [data-code-editor-error-token="true"]': {
|
|
277
|
-
backgroundColor: o.surface.errorRangeBackground,
|
|
278
|
-
boxShadow: `inset 0 -1px 0 ${o.surface.errorRangeShadowColor}`
|
|
279
|
-
}
|
|
280
|
-
};
|
|
281
|
-
},
|
|
282
|
-
/** Position the empty-state placeholder above the editor surface. */
|
|
283
|
-
placeholder: ({ theme: e, ownerState: r }) => {
|
|
284
|
-
const o = l(
|
|
285
|
-
r?.colorMode
|
|
286
|
-
);
|
|
287
|
-
return {
|
|
288
|
-
position: "absolute",
|
|
289
|
-
zIndex: 1,
|
|
290
|
-
top: `${i}px`,
|
|
291
|
-
left: `${i}px`,
|
|
292
|
-
pointerEvents: "none",
|
|
293
|
-
color: o.surface.placeholderForeground,
|
|
294
|
-
...d(e.generalSettings.isMobile, r?.size || "medium", "bodyStandard"),
|
|
295
|
-
fontFamily: s,
|
|
296
|
-
lineHeight: `${r?.lineHeight || n.medium}px`,
|
|
297
|
-
whiteSpace: "pre-wrap"
|
|
298
|
-
};
|
|
299
|
-
},
|
|
300
|
-
/** Size the skeleton block to the same footprint as the live editor. */
|
|
301
|
-
skeleton: ({ theme: e }) => ({
|
|
302
|
-
"&&&": {
|
|
303
|
-
borderRadius: e.vars.size.borderRadius.r1,
|
|
304
|
-
width: "100%",
|
|
305
|
-
height: "100px"
|
|
306
|
-
}
|
|
307
|
-
})
|
|
308
|
-
};
|
|
309
|
-
export {
|
|
310
|
-
b as codeEditorStyles
|
|
311
|
-
};
|