@m4l/components 9.24.0 → 9.24.1-beta-feature-731-code-editor.1
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 +11 -0
- package/components/MFIsolationApp/MFIsolationApp.d.ts.map +1 -1
- package/components/MFIsolationApp/MFIsolationApp.js +80 -76
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/ThemeSettingsHostToolsBridge.d.ts +5 -0
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/ThemeSettingsHostToolsBridge.d.ts.map +1 -0
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/ThemeSettingsHostToolsBridge.js +14 -0
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/index.d.ts +2 -0
- package/components/MFIsolationApp/subcomponents/ThemeSettingsHostToolsBridge/index.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.d.ts +6 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.js +405 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.d.ts +3 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/CodeEditor.styles.js +371 -0
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts +83 -0
- package/components/extended/ReactSimpleCodeEditor/constants.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/constants.js +149 -0
- package/components/extended/ReactSimpleCodeEditor/dictionary.d.ts +11 -0
- package/components/extended/ReactSimpleCodeEditor/dictionary.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/dictionary.js +7 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts +58 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/highlighting.js +1063 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.d.ts +6 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/languageIcon.js +7 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/resolveEditorComponent.d.ts +6 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/resolveEditorComponent.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/helpers/resolveEditorComponent.js +9 -0
- package/components/extended/ReactSimpleCodeEditor/index.d.ts +4 -0
- package/components/extended/ReactSimpleCodeEditor/index.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.d.ts +19 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorEnum.js +4 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.d.ts +88 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/slots/CodeEditorSlots.js +70 -0
- package/components/extended/ReactSimpleCodeEditor/slots/index.d.ts +3 -0
- package/components/extended/ReactSimpleCodeEditor/slots/index.d.ts.map +1 -0
- package/components/extended/ReactSimpleCodeEditor/types.d.ts +459 -0
- package/components/extended/ReactSimpleCodeEditor/types.d.ts.map +1 -0
- package/components/extended/index.d.ts +1 -0
- package/components/extended/index.d.ts.map +1 -1
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.d.ts +7 -0
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.d.ts.map +1 -0
- package/components/hook-form/RHFCodeEditor/RHFCodeEditor.js +6 -0
- package/components/hook-form/RHFCodeEditor/index.d.ts +3 -0
- package/components/hook-form/RHFCodeEditor/index.d.ts.map +1 -0
- package/components/hook-form/index.d.ts +1 -0
- package/components/hook-form/index.d.ts.map +1 -1
- package/index.js +572 -559
- package/package.json +9 -6
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import { getTypographyStyles as l } from "../../../utils/getTypographyStyles.js";
|
|
2
|
+
import { getCodeEditorVSCodeModernPalette as d, CODE_EDITOR_LINE_HEIGHT_BY_SIZE as n, CODE_EDITOR_MONO_FONT_FAMILY as s, CODE_EDITOR_PADDING_PX as a, CODE_EDITOR_RESIZE_HANDLE_SIZE_PX as t } from "./constants.js";
|
|
3
|
+
import { getSizeStyles as p } from "../../../utils/getSizeStyles/getSizeStyles.js";
|
|
4
|
+
const f = {
|
|
5
|
+
/** Resolve the interactive shell colors and focus treatment for the editor root. */
|
|
6
|
+
root: ({ theme: r, ownerState: e }) => {
|
|
7
|
+
const o = !e?.disabled && !e?.readOnly, i = e?.disabled ? r.vars.palette.border.disabled : r.vars.palette.border.secondary;
|
|
8
|
+
return {
|
|
9
|
+
boxSizing: "border-box",
|
|
10
|
+
width: "100%",
|
|
11
|
+
display: "flex",
|
|
12
|
+
flexDirection: "column",
|
|
13
|
+
height: e?.resizable ? `calc(100% - ${t}px)` : "100%",
|
|
14
|
+
minHeight: 0,
|
|
15
|
+
gap: 0,
|
|
16
|
+
border: r.vars.size.borderStroke.container,
|
|
17
|
+
borderColor: e?.variant === "outlined" || e?.error ? i : "transparent",
|
|
18
|
+
borderRadius: r.vars.size.borderRadius["r1-5"],
|
|
19
|
+
...e?.error && {
|
|
20
|
+
borderColor: r.vars.palette.error.focus
|
|
21
|
+
},
|
|
22
|
+
...e?.variant === "contained" && {
|
|
23
|
+
backgroundColor: r.vars.palette.default.enabledOpacity
|
|
24
|
+
},
|
|
25
|
+
...e?.variant === "outlined" && {
|
|
26
|
+
backgroundColor: r.vars.palette.background.default
|
|
27
|
+
},
|
|
28
|
+
...e?.readOnly && {
|
|
29
|
+
backgroundColor: `${r.vars.palette.default.enabledOpacity}!important`
|
|
30
|
+
},
|
|
31
|
+
overflow: "hidden",
|
|
32
|
+
opacity: e?.disabled ? 0.72 : 1,
|
|
33
|
+
outline: "3px solid",
|
|
34
|
+
outlineColor: "transparent",
|
|
35
|
+
transition: "border-color 120ms ease, outline 120ms ease, opacity 120ms ease, background-color 120ms ease",
|
|
36
|
+
...o && {
|
|
37
|
+
"&:hover": {
|
|
38
|
+
backgroundColor: r.vars.palette.default.hoverOpacity,
|
|
39
|
+
...e?.error && {
|
|
40
|
+
borderColor: r.vars.palette.error.active
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"&:focus-within": {
|
|
44
|
+
borderColor: r.vars.palette.primary.enabled,
|
|
45
|
+
outline: "3px solid",
|
|
46
|
+
outlineColor: e?.error ? r.vars.palette.error.focusOpacity : r.vars.palette.primary.hoverOpacity,
|
|
47
|
+
...e?.error && {
|
|
48
|
+
borderColor: r.vars.palette.error.enabled
|
|
49
|
+
},
|
|
50
|
+
...e?.variant === "contained" && {
|
|
51
|
+
backgroundColor: r.vars.palette.background.default,
|
|
52
|
+
"&&& .M4LCodeEditor-header": {
|
|
53
|
+
backgroundColor: r.vars.palette.default.enabledOpacity
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
/** Layout the language badge row above the editing surface. */
|
|
61
|
+
header: ({ theme: r, ownerState: e }) => {
|
|
62
|
+
const o = d(
|
|
63
|
+
e?.colorMode
|
|
64
|
+
);
|
|
65
|
+
return {
|
|
66
|
+
display: "flex",
|
|
67
|
+
alignItems: "center",
|
|
68
|
+
justifyContent: "space-between",
|
|
69
|
+
padding: r.vars.size.baseSpacings.sp2,
|
|
70
|
+
gap: r.vars.size.baseSpacings.sp2,
|
|
71
|
+
borderBottom: r.vars.size.borderStroke.container,
|
|
72
|
+
borderColor: r.vars.palette.border.secondary,
|
|
73
|
+
...e?.variant === "contained" && {
|
|
74
|
+
backgroundColor: "transparent"
|
|
75
|
+
},
|
|
76
|
+
...e?.variant === "outlined" && {
|
|
77
|
+
backgroundColor: r.vars.palette.background.default
|
|
78
|
+
},
|
|
79
|
+
...e?.readOnly && {
|
|
80
|
+
backgroundColor: `${r.vars.palette.background.default}!important`
|
|
81
|
+
},
|
|
82
|
+
color: o.surface.headerForeground,
|
|
83
|
+
borderTopLeftRadius: r.vars.size.borderRadius.r2,
|
|
84
|
+
borderTopRightRadius: r.vars.size.borderRadius.r2,
|
|
85
|
+
overflow: "hidden",
|
|
86
|
+
minHeight: "33px"
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
/** Align any trailing badges rendered in the header row. */
|
|
90
|
+
headerBadges: ({ theme: r }) => ({
|
|
91
|
+
display: "flex",
|
|
92
|
+
alignItems: "center",
|
|
93
|
+
justifyContent: "flex-end",
|
|
94
|
+
gap: r.vars.size.baseSpacings.sp1,
|
|
95
|
+
minWidth: 0,
|
|
96
|
+
// Keep badges right-aligned even when the language chip is absent and the
|
|
97
|
+
// badges container is the only child of the header row.
|
|
98
|
+
marginLeft: "auto"
|
|
99
|
+
}),
|
|
100
|
+
/** Keep the leading language chip aligned with the editor header layout. */
|
|
101
|
+
languageChip: ({ theme: r, ownerState: e }) => {
|
|
102
|
+
const o = d(
|
|
103
|
+
e?.colorMode
|
|
104
|
+
);
|
|
105
|
+
return {
|
|
106
|
+
flexShrink: 0,
|
|
107
|
+
minWidth: 0,
|
|
108
|
+
whiteSpace: "nowrap",
|
|
109
|
+
textTransform: "lowercase",
|
|
110
|
+
paddingTop: 0,
|
|
111
|
+
paddingBottom: 0,
|
|
112
|
+
backgroundColor: "transparent",
|
|
113
|
+
borderColor: r.vars.palette.chips.default.outlined.backgroundActive,
|
|
114
|
+
color: o.surface.languageChipForeground,
|
|
115
|
+
...p(
|
|
116
|
+
r,
|
|
117
|
+
e?.size || "medium",
|
|
118
|
+
"base",
|
|
119
|
+
(i) => ({ height: i })
|
|
120
|
+
),
|
|
121
|
+
"&&& .M4LTypography-root": {
|
|
122
|
+
...l(r.generalSettings.isMobile, e?.size || "medium", "microSlim"),
|
|
123
|
+
color: o.surface.languageChipForeground,
|
|
124
|
+
lineHeight: "normal",
|
|
125
|
+
textTransform: "uppercase"
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
/** Keep the language icon aligned while preserving any intrinsic Seti fill colors. */
|
|
130
|
+
languageChipIcon: () => ({
|
|
131
|
+
display: "inline-flex",
|
|
132
|
+
flexShrink: 0,
|
|
133
|
+
width: "16px",
|
|
134
|
+
height: "16px",
|
|
135
|
+
lineHeight: 0,
|
|
136
|
+
"& .MuiSvgIcon-root": {
|
|
137
|
+
display: "block",
|
|
138
|
+
width: "16px",
|
|
139
|
+
height: "16px",
|
|
140
|
+
fontSize: "16px"
|
|
141
|
+
}
|
|
142
|
+
}),
|
|
143
|
+
/** Keep the read-only chip aligned with the trailing header actions. */
|
|
144
|
+
readOnlyChip: ({ theme: r, ownerState: e }) => ({
|
|
145
|
+
"&&&": {
|
|
146
|
+
flexShrink: 0,
|
|
147
|
+
minWidth: 0,
|
|
148
|
+
whiteSpace: "nowrap",
|
|
149
|
+
...p(
|
|
150
|
+
r,
|
|
151
|
+
e?.size || "medium",
|
|
152
|
+
"base",
|
|
153
|
+
(o) => ({ height: o })
|
|
154
|
+
),
|
|
155
|
+
"&&& .M4LTypography-root": {
|
|
156
|
+
...l(r.generalSettings.isMobile, e?.size || "medium", "microSlim"),
|
|
157
|
+
color: r.vars.palette.chips.info.contained.color
|
|
158
|
+
},
|
|
159
|
+
backgroundColor: r.vars.palette.chips.info.contained.backgroundColor,
|
|
160
|
+
borderColor: "transparent"
|
|
161
|
+
}
|
|
162
|
+
}),
|
|
163
|
+
/** Provide the react-rnd resize shell that owns the full-width bottom handle. */
|
|
164
|
+
bodyResizeShell: ({ theme: r, ownerState: e }) => {
|
|
165
|
+
const o = d(
|
|
166
|
+
e?.colorMode
|
|
167
|
+
), i = !e?.disabled && !!e?.isResizeHandleActive;
|
|
168
|
+
return {
|
|
169
|
+
boxSizing: "border-box",
|
|
170
|
+
width: "100%",
|
|
171
|
+
minWidth: 0,
|
|
172
|
+
maxWidth: "100%",
|
|
173
|
+
overflow: "hidden",
|
|
174
|
+
flexShrink: 0,
|
|
175
|
+
pointerEvents: e?.disabled ? "none" : "auto",
|
|
176
|
+
userSelect: e?.disabled ? "none" : "auto",
|
|
177
|
+
"& .resize-handle-bottom": {
|
|
178
|
+
position: "absolute",
|
|
179
|
+
left: 0,
|
|
180
|
+
right: 0,
|
|
181
|
+
bottom: 0,
|
|
182
|
+
height: `${t}px !important`,
|
|
183
|
+
visibility: "visible",
|
|
184
|
+
pointerEvents: i ? "auto" : "none",
|
|
185
|
+
cursor: e?.disabled ? "not-allowed" : "row-resize",
|
|
186
|
+
touchAction: "none"
|
|
187
|
+
},
|
|
188
|
+
"& .resize-handle-bottom::after": {
|
|
189
|
+
content: '""',
|
|
190
|
+
position: "absolute",
|
|
191
|
+
left: 0,
|
|
192
|
+
right: 0,
|
|
193
|
+
bottom: `calc(${t}px / 2 - 1px)`,
|
|
194
|
+
height: "1px",
|
|
195
|
+
borderRadius: "999px",
|
|
196
|
+
backgroundColor: e?.disabled ? r.vars.palette.border.disabled : e?.error ? o.surface.errorBorderColor : r.vars.palette.border.secondary,
|
|
197
|
+
opacity: i ? 1 : 0,
|
|
198
|
+
transition: "opacity 120ms ease"
|
|
199
|
+
},
|
|
200
|
+
"&:hover .resize-handle-bottom": {
|
|
201
|
+
visibility: e?.disabled ? "hidden" : "visible",
|
|
202
|
+
pointerEvents: e?.disabled ? "none" : "auto"
|
|
203
|
+
},
|
|
204
|
+
"&:focus-within .resize-handle-bottom": {
|
|
205
|
+
pointerEvents: e?.disabled ? "none" : "auto"
|
|
206
|
+
},
|
|
207
|
+
"& .resize-handle-bottom:active": {
|
|
208
|
+
pointerEvents: e?.disabled ? "none" : "auto"
|
|
209
|
+
},
|
|
210
|
+
"&:hover .resize-handle-bottom::after": {
|
|
211
|
+
opacity: e?.disabled ? 0 : 1
|
|
212
|
+
},
|
|
213
|
+
"&:focus-within .resize-handle-bottom::after": {
|
|
214
|
+
opacity: e?.disabled ? 0 : 1
|
|
215
|
+
},
|
|
216
|
+
"& .resize-handle-bottom:active::after": {
|
|
217
|
+
opacity: e?.disabled ? 0 : 1
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
},
|
|
221
|
+
/** Build the two-column layout used by the gutter and editor scroller. */
|
|
222
|
+
body: ({ theme: r, ownerState: e }) => ({
|
|
223
|
+
boxSizing: "border-box",
|
|
224
|
+
display: "grid",
|
|
225
|
+
flex: "1 1 auto",
|
|
226
|
+
gridTemplateColumns: e?.showLineNumbers ? "auto minmax(0, 1fr)" : "minmax(0, 1fr)",
|
|
227
|
+
width: "100%",
|
|
228
|
+
maxWidth: "100%",
|
|
229
|
+
alignItems: "start",
|
|
230
|
+
columnGap: 0,
|
|
231
|
+
minHeight: 0,
|
|
232
|
+
overflow: "auto",
|
|
233
|
+
pointerEvents: e?.disabled ? "none" : "auto",
|
|
234
|
+
userSelect: e?.disabled ? "none" : "auto",
|
|
235
|
+
gap: r.vars.size.baseSpacings.sp2
|
|
236
|
+
}),
|
|
237
|
+
/** Style the optional line-number gutter. */
|
|
238
|
+
lineNumbers: ({ theme: r, ownerState: e }) => {
|
|
239
|
+
const o = d(
|
|
240
|
+
e?.colorMode
|
|
241
|
+
);
|
|
242
|
+
return {
|
|
243
|
+
display: "flex",
|
|
244
|
+
flexDirection: "column",
|
|
245
|
+
alignItems: "flex-end",
|
|
246
|
+
padding: `${a}px ${r.vars.size.baseSpacings.sp1} ${e?.isLineCapped ? 0 : a}px ${r.vars.size.baseSpacings.sp2}`,
|
|
247
|
+
backgroundColor: "transparent",
|
|
248
|
+
color: e?.disabled ? o.surface.placeholderForeground : o.surface.lineNumberForeground,
|
|
249
|
+
userSelect: "none",
|
|
250
|
+
...l(r.generalSettings.isMobile, e?.size || "medium", "bodyStandard"),
|
|
251
|
+
fontFamily: s,
|
|
252
|
+
lineHeight: `${n[e?.size || "medium"]}px`
|
|
253
|
+
};
|
|
254
|
+
},
|
|
255
|
+
/** Keep each rendered line number aligned with the code line height. */
|
|
256
|
+
lineNumber: ({ theme: r, ownerState: e }) => {
|
|
257
|
+
const o = d(
|
|
258
|
+
e?.colorMode
|
|
259
|
+
);
|
|
260
|
+
return {
|
|
261
|
+
display: "block",
|
|
262
|
+
minWidth: "2ch",
|
|
263
|
+
height: `${e?.lineHeight || n.medium}px`,
|
|
264
|
+
lineHeight: `${e?.lineHeight || n.medium}px`,
|
|
265
|
+
textAlign: "right",
|
|
266
|
+
color: r.vars.palette.text.disabled,
|
|
267
|
+
'&[data-code-editor-error-line="true"]': {
|
|
268
|
+
color: o.surface.errorBorderColor,
|
|
269
|
+
borderLeft: `1px solid ${o.surface.errorBorderColor}`
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
},
|
|
273
|
+
/** Provide horizontal overflow for long code lines without wrapping them. */
|
|
274
|
+
editorScroller: ({ theme: r }) => ({
|
|
275
|
+
position: "relative",
|
|
276
|
+
width: "fit-content",
|
|
277
|
+
minWidth: "100%",
|
|
278
|
+
paddingTop: r.vars.size.baseSpacings.sp3,
|
|
279
|
+
paddingBottom: r.vars.size.baseSpacings.sp3,
|
|
280
|
+
paddingRight: r.vars.size.baseSpacings.sp2,
|
|
281
|
+
paddingLeft: r.vars.size.baseSpacings.sp2,
|
|
282
|
+
backgroundColor: "transparent"
|
|
283
|
+
}),
|
|
284
|
+
/** Style the underlying react-simple-code-editor surface and its inner elements. */
|
|
285
|
+
editor: ({ theme: r, ownerState: e }) => {
|
|
286
|
+
const o = d(
|
|
287
|
+
e?.colorMode
|
|
288
|
+
), i = e?.isLineCapped ? 0 : a, c = a + i;
|
|
289
|
+
return {
|
|
290
|
+
position: "relative",
|
|
291
|
+
zIndex: 0,
|
|
292
|
+
width: "max-content",
|
|
293
|
+
minWidth: "100%",
|
|
294
|
+
minHeight: `calc(${e?.minLines || 1} * ${e?.lineHeight || n.medium}px + ${c}px)`,
|
|
295
|
+
backgroundColor: "transparent",
|
|
296
|
+
fontFamily: s,
|
|
297
|
+
fontSize: "11px",
|
|
298
|
+
lineHeight: `${e?.lineHeight || n.medium}px`,
|
|
299
|
+
fontWeight: 400,
|
|
300
|
+
"& textarea, & pre": {
|
|
301
|
+
...l(r.generalSettings.isMobile, e?.size || "medium", "bodyStandard"),
|
|
302
|
+
fontFamily: s,
|
|
303
|
+
lineHeight: `${e?.lineHeight || n.medium}px`,
|
|
304
|
+
whiteSpace: "pre !important",
|
|
305
|
+
wordBreak: "normal",
|
|
306
|
+
overflowWrap: "normal",
|
|
307
|
+
margin: 0,
|
|
308
|
+
paddingTop: `${a}px`,
|
|
309
|
+
paddingRight: `${a}px`,
|
|
310
|
+
paddingBottom: `${i}px`,
|
|
311
|
+
paddingLeft: `${a}px`,
|
|
312
|
+
tabSize: 2,
|
|
313
|
+
fontVariantLigatures: "none",
|
|
314
|
+
backgroundColor: "transparent"
|
|
315
|
+
},
|
|
316
|
+
"&&& textarea": {
|
|
317
|
+
...l(r.generalSettings.isMobile, e?.size || "medium", "microSlim"),
|
|
318
|
+
outline: "none",
|
|
319
|
+
backgroundColor: "transparent",
|
|
320
|
+
caretColor: e?.disabled ? "transparent" : o.surface.caretForeground,
|
|
321
|
+
cursor: e?.disabled ? "not-allowed" : e?.readOnly ? "default" : "text",
|
|
322
|
+
"&::selection": {
|
|
323
|
+
backgroundColor: o.surface.selectionBackground
|
|
324
|
+
}
|
|
325
|
+
},
|
|
326
|
+
"& pre": {
|
|
327
|
+
color: e?.disabled ? o.surface.placeholderForeground : o.surface.editorForeground
|
|
328
|
+
},
|
|
329
|
+
"& .token-line": {
|
|
330
|
+
display: "block",
|
|
331
|
+
width: "100%"
|
|
332
|
+
},
|
|
333
|
+
'& .token-line[data-code-editor-error-line="true"]': {
|
|
334
|
+
backgroundColor: o.surface.errorLineBackground
|
|
335
|
+
},
|
|
336
|
+
'& [data-code-editor-error-token="true"]': {
|
|
337
|
+
backgroundColor: o.surface.errorRangeBackground,
|
|
338
|
+
boxShadow: `inset 0 -1px 0 ${o.surface.errorRangeShadowColor}`
|
|
339
|
+
}
|
|
340
|
+
};
|
|
341
|
+
},
|
|
342
|
+
/** Position the empty-state placeholder above the editor surface. */
|
|
343
|
+
placeholder: ({ theme: r, ownerState: e }) => {
|
|
344
|
+
const o = d(
|
|
345
|
+
e?.colorMode
|
|
346
|
+
);
|
|
347
|
+
return {
|
|
348
|
+
position: "absolute",
|
|
349
|
+
zIndex: 1,
|
|
350
|
+
top: `${a}px`,
|
|
351
|
+
left: `${a}px`,
|
|
352
|
+
pointerEvents: "none",
|
|
353
|
+
color: o.surface.placeholderForeground,
|
|
354
|
+
...l(r.generalSettings.isMobile, e?.size || "medium", "bodyStandard"),
|
|
355
|
+
fontFamily: s,
|
|
356
|
+
lineHeight: `${e?.lineHeight || n.medium}px`,
|
|
357
|
+
whiteSpace: "pre-wrap"
|
|
358
|
+
};
|
|
359
|
+
},
|
|
360
|
+
/** Size the skeleton block to the same footprint as the live editor. */
|
|
361
|
+
skeleton: ({ theme: r }) => ({
|
|
362
|
+
"&&&": {
|
|
363
|
+
borderRadius: r.vars.size.borderRadius.r1,
|
|
364
|
+
width: "100%",
|
|
365
|
+
height: "100px"
|
|
366
|
+
}
|
|
367
|
+
})
|
|
368
|
+
};
|
|
369
|
+
export {
|
|
370
|
+
f as codeEditorStyles
|
|
371
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
type CodeEditorVSCodeModernMode = 'dark' | 'light';
|
|
2
|
+
type CodeEditorVSCodeModernSurfacePalette = {
|
|
3
|
+
activeIndentGuideForeground: string;
|
|
4
|
+
borderColor: string;
|
|
5
|
+
bracketMatchBorder: string;
|
|
6
|
+
caretForeground: string;
|
|
7
|
+
dividerColor: string;
|
|
8
|
+
editorBackground: string;
|
|
9
|
+
editorForeground: string;
|
|
10
|
+
errorBorderColor: string;
|
|
11
|
+
errorRangeBackground: string;
|
|
12
|
+
errorRangeShadowColor: string;
|
|
13
|
+
errorLineBackground: string;
|
|
14
|
+
focusBorderColor: string;
|
|
15
|
+
headerBackground: string;
|
|
16
|
+
headerForeground: string;
|
|
17
|
+
inactiveSelectionBackground: string;
|
|
18
|
+
indentGuideForeground: string;
|
|
19
|
+
languageChipBackground: string;
|
|
20
|
+
languageChipBorder: string;
|
|
21
|
+
languageChipForeground: string;
|
|
22
|
+
lineNumberActiveForeground: string;
|
|
23
|
+
lineNumberForeground: string;
|
|
24
|
+
placeholderForeground: string;
|
|
25
|
+
readOnlyChipBackground: string;
|
|
26
|
+
readOnlyChipBorder: string;
|
|
27
|
+
readOnlyChipForeground: string;
|
|
28
|
+
rootBackground: string;
|
|
29
|
+
selectionBackground: string;
|
|
30
|
+
widgetBackground: string;
|
|
31
|
+
};
|
|
32
|
+
type CodeEditorVSCodeModernSyntaxPalette = {
|
|
33
|
+
attributeName: string;
|
|
34
|
+
boolean: string;
|
|
35
|
+
comment: string;
|
|
36
|
+
constant: string;
|
|
37
|
+
escape: string;
|
|
38
|
+
function: string;
|
|
39
|
+
keyword: string;
|
|
40
|
+
number: string;
|
|
41
|
+
operator: string;
|
|
42
|
+
regex: string;
|
|
43
|
+
string: string;
|
|
44
|
+
tag: string;
|
|
45
|
+
type: string;
|
|
46
|
+
variable: string;
|
|
47
|
+
};
|
|
48
|
+
export type CodeEditorVSCodeModernPalette = {
|
|
49
|
+
bracketPalette: readonly string[];
|
|
50
|
+
surface: CodeEditorVSCodeModernSurfacePalette;
|
|
51
|
+
syntax: CodeEditorVSCodeModernSyntaxPalette;
|
|
52
|
+
};
|
|
53
|
+
export declare const CODE_EDITOR_KEY_COMPONENT = "M4LCodeEditor";
|
|
54
|
+
export declare const CODE_EDITOR_DEFAULT_LANGUAGE = "text";
|
|
55
|
+
export declare const CODE_EDITOR_DEFAULT_MIN_LINES = 4;
|
|
56
|
+
export declare const CODE_EDITOR_DEFAULT_MAX_LINES = 10;
|
|
57
|
+
export declare const CODE_EDITOR_PADDING_PX = 12;
|
|
58
|
+
export declare const CODE_EDITOR_RESIZE_HANDLE_SIZE_PX = 10;
|
|
59
|
+
export declare const CODE_EDITOR_LINE_HEIGHT_BY_SIZE: {
|
|
60
|
+
readonly small: 18;
|
|
61
|
+
readonly medium: 20;
|
|
62
|
+
};
|
|
63
|
+
export declare const CODE_EDITOR_MONO_FONT_FAMILY = "\"Geist Mono\", \"JetBrains Mono\", \"Cascadia Code\", \"Liberation Mono\", monospace";
|
|
64
|
+
export declare const CODE_EDITOR_READ_ONLY_LABEL = "Read Only";
|
|
65
|
+
export declare const CODE_EDITOR_AT_LANGUAGE = "at-commands";
|
|
66
|
+
export declare const CODE_EDITOR_AT_TEMPLATE_NAME = "at-basic";
|
|
67
|
+
export declare const CODE_EDITOR_AT_TEMPLATE_LANGUAGE_LABEL = "AT Commands";
|
|
68
|
+
export declare const CODE_EDITOR_LANGUAGE_CHIP_ICON_INSTANCE_ID = "CodeEditorLanguageChipIcon";
|
|
69
|
+
export declare const CODE_EDITOR_AT_TEMPLATE_TOKENS: {
|
|
70
|
+
readonly commandPrefixes: readonly ["AT+", "+"];
|
|
71
|
+
readonly concatenationSeparators: readonly [";"];
|
|
72
|
+
readonly argumentSeparators: readonly [","];
|
|
73
|
+
readonly reservedWords: readonly ["SET", "INFO", "SAVE", "CLEAR"];
|
|
74
|
+
};
|
|
75
|
+
export declare const CODE_EDITOR_LANGUAGE_ALIASES: Record<string, string>;
|
|
76
|
+
export declare const CODE_EDITOR_FALLBACK_LANGUAGE_ICON: import('@mui/material/OverridableComponent').OverridableComponent<import('@mui/material').SvgIconTypeMap<{}, "svg">> & {
|
|
77
|
+
muiName: string;
|
|
78
|
+
};
|
|
79
|
+
/** Resolve the exact VS Code Modern palette for the current light or dark theme mode. */
|
|
80
|
+
export declare function getCodeEditorVSCodeModernPalette(mode?: CodeEditorVSCodeModernMode): CodeEditorVSCodeModernPalette;
|
|
81
|
+
export declare const CODE_EDITOR_CLASSES: Record<"root" | "skeleton" | "body" | "header" | "pre" | "textarea" | "placeholder" | "headerBadges" | "languageChip" | "languageChipIcon" | "readOnlyChip" | "bodyResizeShell" | "lineNumbers" | "lineNumber" | "editorScroller" | "editor", string>;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/extended/ReactSimpleCodeEditor/constants.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { FileFolderFileOutlined as e } from "@m4l/icons";
|
|
2
|
+
import { getComponentClasses as n } from "../../../utils/getComponentSlotRoot.js";
|
|
3
|
+
import { CodeEditorSlots as a } from "./slots/CodeEditorEnum.js";
|
|
4
|
+
const t = {
|
|
5
|
+
dark: {
|
|
6
|
+
bracketPalette: ["#FFD700", "#DA70D6", "#179FFF"],
|
|
7
|
+
surface: {
|
|
8
|
+
activeIndentGuideForeground: "#707070",
|
|
9
|
+
borderColor: "#3C3C3C",
|
|
10
|
+
bracketMatchBorder: "#888888",
|
|
11
|
+
caretForeground: "#AEAFAD",
|
|
12
|
+
dividerColor: "#2B2B2B",
|
|
13
|
+
editorBackground: "#1F1F1F",
|
|
14
|
+
editorForeground: "#CCCCCC",
|
|
15
|
+
errorBorderColor: "#F85149",
|
|
16
|
+
errorRangeBackground: "#F8514926",
|
|
17
|
+
errorRangeShadowColor: "#F85149",
|
|
18
|
+
errorLineBackground: "#F8514914",
|
|
19
|
+
focusBorderColor: "#0078D4",
|
|
20
|
+
headerBackground: "#181818",
|
|
21
|
+
headerForeground: "#CCCCCC",
|
|
22
|
+
inactiveSelectionBackground: "#3A3D41",
|
|
23
|
+
indentGuideForeground: "#404040",
|
|
24
|
+
languageChipBackground: "#313131",
|
|
25
|
+
languageChipBorder: "#3C3C3C",
|
|
26
|
+
languageChipForeground: "#CCCCCC",
|
|
27
|
+
lineNumberActiveForeground: "#CCCCCC",
|
|
28
|
+
lineNumberForeground: "#6E7681",
|
|
29
|
+
placeholderForeground: "#989898",
|
|
30
|
+
readOnlyChipBackground: "#2489DB82",
|
|
31
|
+
readOnlyChipBorder: "#2488DB",
|
|
32
|
+
readOnlyChipForeground: "#FFFFFF",
|
|
33
|
+
rootBackground: "#181818",
|
|
34
|
+
selectionBackground: "#264F78",
|
|
35
|
+
widgetBackground: "#202020"
|
|
36
|
+
},
|
|
37
|
+
syntax: {
|
|
38
|
+
attributeName: "#9CDCFE",
|
|
39
|
+
boolean: "#569CD6",
|
|
40
|
+
comment: "#6A9955",
|
|
41
|
+
constant: "#4FC1FF",
|
|
42
|
+
escape: "#D7BA7D",
|
|
43
|
+
function: "#DCDCAA",
|
|
44
|
+
keyword: "#569CD6",
|
|
45
|
+
number: "#B5CEA8",
|
|
46
|
+
operator: "#CCCCCC",
|
|
47
|
+
regex: "#646695",
|
|
48
|
+
string: "#CE9178",
|
|
49
|
+
tag: "#569CD6",
|
|
50
|
+
type: "#4EC9B0",
|
|
51
|
+
variable: "#9CDCFE"
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
light: {
|
|
55
|
+
bracketPalette: ["#0431FA", "#319331", "#7B3814"],
|
|
56
|
+
surface: {
|
|
57
|
+
activeIndentGuideForeground: "#939393",
|
|
58
|
+
borderColor: "#CECECE",
|
|
59
|
+
bracketMatchBorder: "#B9B9B9",
|
|
60
|
+
caretForeground: "#000000",
|
|
61
|
+
dividerColor: "#E5E5E5",
|
|
62
|
+
editorBackground: "#FFFFFF",
|
|
63
|
+
editorForeground: "#3B3B3B",
|
|
64
|
+
errorBorderColor: "#F85149",
|
|
65
|
+
errorRangeBackground: "#F8514920",
|
|
66
|
+
errorRangeShadowColor: "#F85149",
|
|
67
|
+
errorLineBackground: "#F8514912",
|
|
68
|
+
focusBorderColor: "#005FB8",
|
|
69
|
+
headerBackground: "#F8F8F8",
|
|
70
|
+
headerForeground: "#3B3B3B",
|
|
71
|
+
inactiveSelectionBackground: "#E5EBF1",
|
|
72
|
+
indentGuideForeground: "#D3D3D3",
|
|
73
|
+
languageChipBackground: "#FFFFFF",
|
|
74
|
+
languageChipBorder: "#CECECE",
|
|
75
|
+
languageChipForeground: "#3B3B3B",
|
|
76
|
+
lineNumberActiveForeground: "#171184",
|
|
77
|
+
lineNumberForeground: "#6E7681",
|
|
78
|
+
placeholderForeground: "#767676",
|
|
79
|
+
readOnlyChipBackground: "#BED6ED",
|
|
80
|
+
readOnlyChipBorder: "#005FB8",
|
|
81
|
+
readOnlyChipForeground: "#000000",
|
|
82
|
+
rootBackground: "#F8F8F8",
|
|
83
|
+
selectionBackground: "#ADD6FF",
|
|
84
|
+
widgetBackground: "#F8F8F8"
|
|
85
|
+
},
|
|
86
|
+
syntax: {
|
|
87
|
+
attributeName: "#E50000",
|
|
88
|
+
boolean: "#0000FF",
|
|
89
|
+
comment: "#008000",
|
|
90
|
+
constant: "#0070C1",
|
|
91
|
+
escape: "#EE0000",
|
|
92
|
+
function: "#795E26",
|
|
93
|
+
keyword: "#0000FF",
|
|
94
|
+
number: "#098658",
|
|
95
|
+
operator: "#3B3B3B",
|
|
96
|
+
regex: "#811F3F",
|
|
97
|
+
string: "#A31515",
|
|
98
|
+
tag: "#800000",
|
|
99
|
+
type: "#267F99",
|
|
100
|
+
variable: "#001080"
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}, C = "M4LCodeEditor", c = "text", i = 4, g = 10, u = 12, D = 10, _ = {
|
|
104
|
+
small: 18,
|
|
105
|
+
medium: 20
|
|
106
|
+
}, B = '"Geist Mono", "JetBrains Mono", "Cascadia Code", "Liberation Mono", monospace', s = "Read Only", r = "at-commands", l = "at-basic", A = "AT Commands", O = "CodeEditorLanguageChipIcon", T = {
|
|
107
|
+
commandPrefixes: ["AT+", "+"],
|
|
108
|
+
concatenationSeparators: [";"],
|
|
109
|
+
argumentSeparators: [","],
|
|
110
|
+
reservedWords: ["SET", "INFO", "SAVE", "CLEAR"]
|
|
111
|
+
}, I = {
|
|
112
|
+
js: "javascript",
|
|
113
|
+
jsx: "jsx",
|
|
114
|
+
ts: "typescript",
|
|
115
|
+
tsx: "tsx",
|
|
116
|
+
py: "python",
|
|
117
|
+
sh: "bash",
|
|
118
|
+
shell: "bash",
|
|
119
|
+
yml: "yaml",
|
|
120
|
+
at: r,
|
|
121
|
+
"telemetry-at": r
|
|
122
|
+
}, p = e;
|
|
123
|
+
function m(o = "light") {
|
|
124
|
+
return t[o];
|
|
125
|
+
}
|
|
126
|
+
const L = n(
|
|
127
|
+
C,
|
|
128
|
+
a
|
|
129
|
+
);
|
|
130
|
+
export {
|
|
131
|
+
r as CODE_EDITOR_AT_LANGUAGE,
|
|
132
|
+
A as CODE_EDITOR_AT_TEMPLATE_LANGUAGE_LABEL,
|
|
133
|
+
l as CODE_EDITOR_AT_TEMPLATE_NAME,
|
|
134
|
+
T as CODE_EDITOR_AT_TEMPLATE_TOKENS,
|
|
135
|
+
L as CODE_EDITOR_CLASSES,
|
|
136
|
+
c as CODE_EDITOR_DEFAULT_LANGUAGE,
|
|
137
|
+
g as CODE_EDITOR_DEFAULT_MAX_LINES,
|
|
138
|
+
i as CODE_EDITOR_DEFAULT_MIN_LINES,
|
|
139
|
+
p as CODE_EDITOR_FALLBACK_LANGUAGE_ICON,
|
|
140
|
+
C as CODE_EDITOR_KEY_COMPONENT,
|
|
141
|
+
I as CODE_EDITOR_LANGUAGE_ALIASES,
|
|
142
|
+
O as CODE_EDITOR_LANGUAGE_CHIP_ICON_INSTANCE_ID,
|
|
143
|
+
_ as CODE_EDITOR_LINE_HEIGHT_BY_SIZE,
|
|
144
|
+
B as CODE_EDITOR_MONO_FONT_FAMILY,
|
|
145
|
+
u as CODE_EDITOR_PADDING_PX,
|
|
146
|
+
s as CODE_EDITOR_READ_ONLY_LABEL,
|
|
147
|
+
D as CODE_EDITOR_RESIZE_HANDLE_SIZE_PX,
|
|
148
|
+
m as getCodeEditorVSCodeModernPalette
|
|
149
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Dictionary } from '@m4l/core';
|
|
2
|
+
export declare const CODE_EDITOR_DICTIONARY_KEY = "code_editor";
|
|
3
|
+
/**
|
|
4
|
+
* Return the dictionary namespaces required by the CodeEditor component.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getCodeEditorComponentsDictionary(): string[];
|
|
7
|
+
export declare const defaultCodeEditorDictionary: Dictionary;
|
|
8
|
+
export declare const CODE_EDITOR_DICTIONARY: {
|
|
9
|
+
readonly readOnly: "code_editor.read_only";
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=dictionary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../../../../../packages/components/src/components/extended/ReactSimpleCodeEditor/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAE5C,eAAO,MAAM,0BAA0B,gBAAgB,CAAC;AAExD;;GAEG;AACH,wBAAgB,iCAAiC,aAEhD;AAED,eAAO,MAAM,2BAA2B,EAAE,UAIzC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;CAEzB,CAAC"}
|