@thebuoyant-tsdev/mui-ts-library 3.25.0 → 3.26.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.
@@ -4,8 +4,8 @@ import { clamp as n, hexToRgba as r, hslaToHsva as i, hsvaToHsla as a, hsvaToRgb
4
4
  import { DEFAULT_COLOR_PICKER_TRANSLATION as u } from "./ColorPicker.types.js";
5
5
  import { useEffect as d, useRef as f, useState as p } from "react";
6
6
  import { Box as m, IconButton as ee, MenuItem as h, Select as te, TextField as g, Tooltip as ne, Typography as re, useTheme as ie } from "@mui/material";
7
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
8
7
  import ae from "@mui/icons-material/Colorize";
8
+ import { jsx as _, jsxs as v } from "react/jsx-runtime";
9
9
  //#region src/components/color-picker/ColorPicker.tsx
10
10
  function y(e, t) {
11
11
  let r = n(e, 0, 100);
@@ -31,6 +31,19 @@ export type ColorPickerTranslation = {
31
31
  hueSliderLabel: string;
32
32
  };
33
33
  export declare const DEFAULT_COLOR_PICKER_TRANSLATION: Required<ColorPickerTranslation>;
34
+ export type PopoverColorPickerTranslation = {
35
+ /** aria-label for the swatch trigger button. */
36
+ openLabel: string;
37
+ };
38
+ export declare const DEFAULT_POPOVER_COLOR_PICKER_TRANSLATION: Required<PopoverColorPickerTranslation>;
39
+ export type PopoverColorPickerProps = Omit<ColorPickerProps, "translation"> & {
40
+ /** Size of the swatch trigger button in px (default: 28). */
41
+ swatchSize?: number;
42
+ /** Shape of the swatch button (default: `'square'`). */
43
+ swatchShape?: "square" | "circle";
44
+ /** i18n strings — merged with the inner ColorPicker translation. */
45
+ translation?: Partial<ColorPickerTranslation & PopoverColorPickerTranslation>;
46
+ };
34
47
  export type ColorPickerProps = {
35
48
  /** Current color — accepts hex (#rgb, #rgba, #rrggbb, #rrggbbaa), rgb()/rgba(), or hsl()/hsla(). */
36
49
  value: string;
@@ -13,6 +13,6 @@ var e = {
13
13
  savedColorsLabel: "Saved colors",
14
14
  gradientAreaLabel: "Saturation and brightness",
15
15
  hueSliderLabel: "Hue"
16
- };
16
+ }, t = { openLabel: "Open color picker" };
17
17
  //#endregion
18
- export { e as DEFAULT_COLOR_PICKER_TRANSLATION };
18
+ export { e as DEFAULT_COLOR_PICKER_TRANSLATION, t as DEFAULT_POPOVER_COLOR_PICKER_TRANSLATION };
@@ -0,0 +1,2 @@
1
+ import { type PopoverColorPickerProps } from "./ColorPicker.types";
2
+ export declare function PopoverColorPicker({ value, onChange, onChangeCommitted, swatchSize, swatchShape, disabled, translation, ...colorPickerProps }: PopoverColorPickerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,81 @@
1
+ import { muiTsStateClasses as e } from "../../utils/muiTsClasses.js";
2
+ import { popoverColorPickerClasses as t } from "./popoverColorPickerClasses.js";
3
+ import { DEFAULT_POPOVER_COLOR_PICKER_TRANSLATION as n } from "./ColorPicker.types.js";
4
+ import { ColorPicker as r } from "./ColorPicker.js";
5
+ import { useState as i } from "react";
6
+ import { Box as a, Popover as o, useTheme as s } from "@mui/material";
7
+ import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
8
+ //#region src/components/color-picker/PopoverColorPicker.tsx
9
+ var d = {
10
+ backgroundImage: "linear-gradient(45deg, #ccc 25%, transparent 25%), linear-gradient(-45deg, #ccc 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #ccc 75%), linear-gradient(-45deg, transparent 75%, #ccc 75%)",
11
+ backgroundSize: "8px 8px",
12
+ backgroundPosition: "0 0, 0 4px, 4px -4px, -4px 0px"
13
+ };
14
+ function f({ value: f, onChange: p, onChangeCommitted: m, swatchSize: h = 28, swatchShape: g = "square", disabled: _ = !1, translation: v, ...y }) {
15
+ let b = s(), x = {
16
+ ...n,
17
+ ...v
18
+ }, [S, C] = i(null), w = !!S, T = g === "circle" ? "50%" : `${b.shape.borderRadius}px`;
19
+ return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(a, {
20
+ component: "button",
21
+ type: "button",
22
+ disabled: _,
23
+ "aria-label": x.openLabel,
24
+ "aria-expanded": w,
25
+ "aria-haspopup": "dialog",
26
+ onClick: (e) => C(e.currentTarget),
27
+ className: [t.root, _ ? e.disabled : void 0].filter(Boolean).join(" "),
28
+ sx: {
29
+ width: h,
30
+ height: h,
31
+ minWidth: h,
32
+ p: 0,
33
+ borderRadius: T,
34
+ border: `1px solid ${b.palette.divider}`,
35
+ cursor: _ ? "default" : "pointer",
36
+ overflow: "hidden",
37
+ flexShrink: 0,
38
+ ...d,
39
+ "&:hover:not(:disabled)": { borderColor: b.palette.primary.main },
40
+ "&:focus-visible": {
41
+ outline: `2px solid ${b.palette.primary.main}`,
42
+ outlineOffset: 2
43
+ }
44
+ },
45
+ children: /* @__PURE__ */ l(a, {
46
+ className: t.swatch,
47
+ sx: {
48
+ width: "100%",
49
+ height: "100%",
50
+ borderRadius: "inherit",
51
+ backgroundColor: f
52
+ }
53
+ })
54
+ }), /* @__PURE__ */ l(o, {
55
+ open: w,
56
+ anchorEl: S,
57
+ onClose: () => C(null),
58
+ anchorOrigin: {
59
+ vertical: "bottom",
60
+ horizontal: "left"
61
+ },
62
+ transformOrigin: {
63
+ vertical: "top",
64
+ horizontal: "left"
65
+ },
66
+ slotProps: { paper: {
67
+ sx: { p: 1.5 },
68
+ "data-testid": "popover-color-picker"
69
+ } },
70
+ children: /* @__PURE__ */ l(r, {
71
+ value: f,
72
+ onChange: p,
73
+ onChangeCommitted: m,
74
+ disabled: _,
75
+ translation: v,
76
+ ...y
77
+ })
78
+ })] });
79
+ }
80
+ //#endregion
81
+ export { f as PopoverColorPicker };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * CSS class names for every named slot in the PopoverColorPicker component.
3
+ *
4
+ * @example
5
+ * ```css
6
+ * .MuiTsPopoverColorPicker-root { border-radius: 50%; }
7
+ * .MuiTsPopoverColorPicker-root.MuiTs-disabled { opacity: 0.4; pointer-events: none; }
8
+ * ```
9
+ */
10
+ export declare const popoverColorPickerClasses: {
11
+ /** The swatch button that triggers the popover. Also receives `MuiTs-disabled` when `disabled={true}`. */
12
+ readonly root: "MuiTsPopoverColorPicker-root";
13
+ /** The inner colored box inside the swatch button. */
14
+ readonly swatch: "MuiTsPopoverColorPicker-swatch";
15
+ };
@@ -0,0 +1,7 @@
1
+ //#region src/components/color-picker/popoverColorPickerClasses.ts
2
+ var e = {
3
+ root: "MuiTsPopoverColorPicker-root",
4
+ swatch: "MuiTsPopoverColorPicker-swatch"
5
+ };
6
+ //#endregion
7
+ export { e as popoverColorPickerClasses };
@@ -2,30 +2,30 @@ import { computeJsonPath as e } from "./util/jsonPathFinder.js";
2
2
  import { findRangeForPath as t, validateAgainstSchema as n } from "./util/jsonSchemaValidator.js";
3
3
  import { useEffect as r, useRef as i, useState as a } from "react";
4
4
  import { Box as o, Fade as s, Paper as c, Typography as ee, useTheme as te } from "@mui/material";
5
- import { EditorView as l, highlightActiveLine as ne, highlightActiveLineGutter as u, keymap as re, lineNumbers as d, placeholder as f } from "@codemirror/view";
6
- import { Compartment as p, EditorState as m } from "@codemirror/state";
5
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
6
+ import { EditorView as d, highlightActiveLine as ne, highlightActiveLineGutter as f, keymap as re, lineNumbers as p, placeholder as m } from "@codemirror/view";
7
+ import { Compartment as h, EditorState as g } from "@codemirror/state";
7
8
  import { json as ie, jsonParseLinter as ae } from "@codemirror/lang-json";
8
9
  import { defaultKeymap as oe, history as se, historyKeymap as ce } from "@codemirror/commands";
9
- import { HighlightStyle as le, foldGutter as h, foldKeymap as ue, syntaxHighlighting as de } from "@codemirror/language";
10
- import { forceLinting as fe, lintGutter as pe, linter as g } from "@codemirror/lint";
11
- import { tags as _ } from "@lezer/highlight";
10
+ import { HighlightStyle as le, foldGutter as _, foldKeymap as ue, syntaxHighlighting as de } from "@codemirror/language";
11
+ import { forceLinting as fe, lintGutter as pe, linter as v } from "@codemirror/lint";
12
+ import { tags as y } from "@lezer/highlight";
12
13
  import { showMinimap as me } from "@replit/codemirror-minimap";
13
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
14
14
  //#region src/components/json-editor/JsonEditorContent.tsx
15
15
  function b(e) {
16
- return e ? [d(), u()] : [];
16
+ return e ? [p(), f()] : [];
17
17
  }
18
18
  function x(e) {
19
- return e ? [h()] : [];
19
+ return e ? [_()] : [];
20
20
  }
21
21
  function S(e) {
22
- return e ? [f(e)] : [];
22
+ return e ? [m(e)] : [];
23
23
  }
24
- function C({ value: u, onChange: d, placeholder: f, disabled: h = !1, readonly: C = !1, schema: w, showLineNumbers: T = !0, showMinimap: E = !1, showFolding: D = !0, enablePathFinder: O = !0, highlightColors: k, onViewReady: A, onCursorChange: j, onBlur: M, onFocus: N, onPathCopy: P }) {
25
- let F = i(null), I = i(null), L = i(null), R = i(d), z = i(j), he = i(M), B = i(N), V = i(A), H = i(P), U = i(O), W = i(w), [G, K] = a(null), q = i(new p()), J = i(new p()), Y = i(new p()), X = i(new p()), Z = i(new p()), Q = te(), $ = Q.palette.mode === "dark", ge = k?.propertyName ?? Q.palette.primary.main, _e = k?.string ?? Q.palette.success.main, ve = k?.number ?? Q.palette.warning.main, ye = k?.boolean ?? Q.palette.info.main, be = k?.null ?? Q.palette.text.secondary;
24
+ function C({ value: f, onChange: p, placeholder: m, disabled: _ = !1, readonly: C = !1, schema: w, showLineNumbers: T = !0, showMinimap: E = !1, showFolding: D = !0, enablePathFinder: O = !0, highlightColors: k, onViewReady: A, onCursorChange: j, onBlur: M, onFocus: N, onPathCopy: P }) {
25
+ let F = i(null), I = i(null), L = i(null), R = i(p), z = i(j), he = i(M), B = i(N), V = i(A), H = i(P), U = i(O), W = i(w), [G, K] = a(null), q = i(new h()), J = i(new h()), Y = i(new h()), X = i(new h()), Z = i(new h()), Q = te(), $ = Q.palette.mode === "dark", ge = k?.propertyName ?? Q.palette.primary.main, _e = k?.string ?? Q.palette.success.main, ve = k?.number ?? Q.palette.warning.main, ye = k?.boolean ?? Q.palette.info.main, be = k?.null ?? Q.palette.text.secondary;
26
26
  return r(() => {
27
- R.current = d;
28
- }, [d]), r(() => {
27
+ R.current = p;
28
+ }, [p]), r(() => {
29
29
  z.current = j;
30
30
  }, [j]), r(() => {
31
31
  he.current = M;
@@ -41,44 +41,44 @@ function C({ value: u, onChange: d, placeholder: f, disabled: h = !1, readonly:
41
41
  W.current = w, L.current && fe(L.current);
42
42
  }, [w]), r(() => {
43
43
  if (!I.current) return;
44
- let r = L.current?.state.doc.toString() ?? u ?? "", i = le.define([
44
+ let r = L.current?.state.doc.toString() ?? f ?? "", i = le.define([
45
45
  {
46
- tag: _.propertyName,
46
+ tag: y.propertyName,
47
47
  color: ge,
48
48
  fontWeight: "bold"
49
49
  },
50
50
  {
51
- tag: _.string,
51
+ tag: y.string,
52
52
  color: _e
53
53
  },
54
54
  {
55
- tag: _.number,
55
+ tag: y.number,
56
56
  color: ve
57
57
  },
58
58
  {
59
- tag: _.bool,
59
+ tag: y.bool,
60
60
  color: ye,
61
61
  fontWeight: "bold"
62
62
  },
63
63
  {
64
- tag: _.null,
64
+ tag: y.null,
65
65
  color: be,
66
66
  fontStyle: "italic"
67
67
  },
68
68
  {
69
- tag: _.bracket,
69
+ tag: y.bracket,
70
70
  color: Q.palette.text.secondary
71
71
  },
72
72
  {
73
- tag: _.punctuation,
73
+ tag: y.punctuation,
74
74
  color: Q.palette.text.disabled
75
75
  },
76
76
  {
77
- tag: _.invalid,
77
+ tag: y.invalid,
78
78
  color: Q.palette.error.main,
79
79
  textDecoration: "underline wavy"
80
80
  }
81
- ]), a = l.theme({
81
+ ]), a = d.theme({
82
82
  "&": {
83
83
  height: "100%",
84
84
  fontFamily: "'Fira Code', 'JetBrains Mono', 'Consolas', monospace",
@@ -141,8 +141,8 @@ function C({ value: u, onChange: d, placeholder: f, disabled: h = !1, readonly:
141
141
  de(i),
142
142
  ie(),
143
143
  pe(),
144
- g(ae()),
145
- g((e) => {
144
+ v(ae()),
145
+ v((e) => {
146
146
  let r = W.current;
147
147
  if (!r) return [];
148
148
  let i;
@@ -169,19 +169,19 @@ function C({ value: u, onChange: d, placeholder: f, disabled: h = !1, readonly:
169
169
  ...ce,
170
170
  ...ue
171
171
  ]),
172
- q.current.of(l.editable.of(!h && !C)),
173
- J.current.of(m.readOnly.of(C)),
172
+ q.current.of(d.editable.of(!_ && !C)),
173
+ J.current.of(g.readOnly.of(C)),
174
174
  ne(),
175
175
  X.current.of(b(T)),
176
176
  Y.current.of(x(D)),
177
- Z.current.of(S(f)),
177
+ Z.current.of(S(m)),
178
178
  ...o,
179
- l.updateListener.of((e) => {
179
+ d.updateListener.of((e) => {
180
180
  e.docChanged && R.current?.(e.state.doc.toString());
181
181
  let t = e.state.selection.main.head, n = e.state.doc.lineAt(t);
182
182
  z.current(n.number, t - n.from + 1);
183
183
  }),
184
- l.domEventHandlers({
184
+ d.domEventHandlers({
185
185
  blur: () => {
186
186
  he.current?.();
187
187
  },
@@ -211,8 +211,8 @@ function C({ value: u, onChange: d, placeholder: f, disabled: h = !1, readonly:
211
211
  }), !0) : !1;
212
212
  }
213
213
  })
214
- ], c = new l({
215
- state: m.create({
214
+ ], c = new d({
215
+ state: g.create({
216
216
  doc: r,
217
217
  extensions: s
218
218
  }),
@@ -233,24 +233,24 @@ function C({ value: u, onChange: d, placeholder: f, disabled: h = !1, readonly:
233
233
  let e = L.current;
234
234
  if (!e) return;
235
235
  let t = e.state.doc.toString();
236
- t !== (u ?? "") && e.dispatch({ changes: {
236
+ t !== (f ?? "") && e.dispatch({ changes: {
237
237
  from: 0,
238
238
  to: t.length,
239
- insert: u ?? ""
239
+ insert: f ?? ""
240
240
  } });
241
- }, [u]), r(() => {
242
- L.current?.dispatch({ effects: [q.current.reconfigure(l.editable.of(!h && !C)), J.current.reconfigure(m.readOnly.of(C))] });
243
- }, [h, C]), r(() => {
241
+ }, [f]), r(() => {
242
+ L.current?.dispatch({ effects: [q.current.reconfigure(d.editable.of(!_ && !C)), J.current.reconfigure(g.readOnly.of(C))] });
243
+ }, [_, C]), r(() => {
244
244
  L.current?.dispatch({ effects: X.current.reconfigure(b(T)) });
245
245
  }, [T]), r(() => {
246
246
  L.current?.dispatch({ effects: Y.current.reconfigure(x(D)) });
247
247
  }, [D]), r(() => {
248
- L.current?.dispatch({ effects: Z.current.reconfigure(S(f)) });
249
- }, [f]), r(() => {
248
+ L.current?.dispatch({ effects: Z.current.reconfigure(S(m)) });
249
+ }, [m]), r(() => {
250
250
  if (!G) return;
251
251
  let e = setTimeout(() => K(null), 1500);
252
252
  return () => clearTimeout(e);
253
- }, [G]), /* @__PURE__ */ y(o, {
253
+ }, [G]), /* @__PURE__ */ u(o, {
254
254
  ref: F,
255
255
  sx: {
256
256
  position: "relative",
@@ -258,14 +258,14 @@ function C({ value: u, onChange: d, placeholder: f, disabled: h = !1, readonly:
258
258
  overflow: "hidden",
259
259
  display: "flex"
260
260
  },
261
- children: [/* @__PURE__ */ v(o, {
261
+ children: [/* @__PURE__ */ l(o, {
262
262
  ref: I,
263
263
  sx: {
264
264
  flex: 1,
265
265
  overflow: "hidden",
266
266
  display: "flex",
267
267
  flexDirection: "column",
268
- opacity: h ? .5 : 1,
268
+ opacity: _ ? .5 : 1,
269
269
  backgroundColor: Q.palette.background.paper,
270
270
  "& .cm-editor": {
271
271
  flex: 1,
@@ -273,9 +273,9 @@ function C({ value: u, onChange: d, placeholder: f, disabled: h = !1, readonly:
273
273
  flexDirection: "column"
274
274
  }
275
275
  }
276
- }), G && /* @__PURE__ */ v(s, {
276
+ }), G && /* @__PURE__ */ l(s, {
277
277
  in: !0,
278
- children: /* @__PURE__ */ v(c, {
278
+ children: /* @__PURE__ */ l(c, {
279
279
  elevation: 3,
280
280
  sx: {
281
281
  position: "absolute",
@@ -289,7 +289,7 @@ function C({ value: u, onChange: d, placeholder: f, disabled: h = !1, readonly:
289
289
  bgcolor: "grey.900",
290
290
  color: "common.white"
291
291
  },
292
- children: /* @__PURE__ */ y(ee, {
292
+ children: /* @__PURE__ */ u(ee, {
293
293
  variant: "caption",
294
294
  sx: { fontFamily: "monospace" },
295
295
  children: ["Copied: ", G.path]
@@ -1,8 +1,8 @@
1
1
  import { ToolbarButton as e } from "../shared/ToolbarButton.js";
2
2
  import { useTimedFlag as t } from "../shared/useTimedFlag.js";
3
3
  import { Box as n, Divider as r } from "@mui/material";
4
- import { redo as i, undo as a } from "@codemirror/commands";
5
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
+ import { redo as o, undo as s } from "@codemirror/commands";
6
6
  import c from "@mui/icons-material/ContentCopy";
7
7
  import l from "@mui/icons-material/Download";
8
8
  import u from "@mui/icons-material/Check";
@@ -62,14 +62,14 @@ function g({ editorView: g, toolbarConfig: _, translation: v, indent: y, downloa
62
62
  }
63
63
  function M() {
64
64
  let e = g;
65
- e && (a(e), e.focus());
65
+ e && (s(e), e.focus());
66
66
  }
67
67
  function N() {
68
68
  let e = g;
69
- e && (i(e), e.focus());
69
+ e && (o(e), e.focus());
70
70
  }
71
71
  let P = _.showFormat || _.showCompact, F = _.showCopy || _.showDownload || _.showClear, I = _.showUndoRedo;
72
- return /* @__PURE__ */ s(n, {
72
+ return /* @__PURE__ */ a(n, {
73
73
  sx: {
74
74
  display: "flex",
75
75
  flexWrap: "wrap",
@@ -81,83 +81,83 @@ function g({ editorView: g, toolbarConfig: _, translation: v, indent: y, downloa
81
81
  role: "toolbar",
82
82
  "aria-label": "JSON editor actions",
83
83
  children: [
84
- P && /* @__PURE__ */ s(n, {
84
+ P && /* @__PURE__ */ a(n, {
85
85
  sx: {
86
86
  display: "flex",
87
87
  gap: .25
88
88
  },
89
- children: [_.showFormat && /* @__PURE__ */ o(e, {
89
+ children: [_.showFormat && /* @__PURE__ */ i(e, {
90
90
  label: v.format,
91
- icon: /* @__PURE__ */ o(m, { fontSize: "small" }),
91
+ icon: /* @__PURE__ */ i(m, { fontSize: "small" }),
92
92
  onClick: D,
93
93
  disabled: E
94
- }), _.showCompact && /* @__PURE__ */ o(e, {
94
+ }), _.showCompact && /* @__PURE__ */ i(e, {
95
95
  label: v.compact,
96
- icon: /* @__PURE__ */ o(h, { fontSize: "small" }),
96
+ icon: /* @__PURE__ */ i(h, { fontSize: "small" }),
97
97
  onClick: O,
98
98
  disabled: E
99
99
  })]
100
100
  }),
101
- P && (F || I) && /* @__PURE__ */ o(r, {
101
+ P && (F || I) && /* @__PURE__ */ i(r, {
102
102
  orientation: "vertical",
103
103
  flexItem: !0,
104
104
  sx: { mx: .5 }
105
105
  }),
106
- F && /* @__PURE__ */ s(n, {
106
+ F && /* @__PURE__ */ a(n, {
107
107
  sx: {
108
108
  display: "flex",
109
109
  gap: .25
110
110
  },
111
111
  children: [
112
- _.showCopy && /* @__PURE__ */ o(e, {
112
+ _.showCopy && /* @__PURE__ */ i(e, {
113
113
  label: S ? v.copySuccess : v.copy,
114
- icon: S ? /* @__PURE__ */ o(u, {
114
+ icon: S ? /* @__PURE__ */ i(u, {
115
115
  fontSize: "small",
116
116
  color: "success"
117
- }) : /* @__PURE__ */ o(c, { fontSize: "small" }),
117
+ }) : /* @__PURE__ */ i(c, { fontSize: "small" }),
118
118
  onClick: k,
119
119
  disabled: E
120
120
  }),
121
- _.showDownload && /* @__PURE__ */ o(e, {
121
+ _.showDownload && /* @__PURE__ */ i(e, {
122
122
  label: w ? v.downloadSuccess : v.download,
123
- icon: w ? /* @__PURE__ */ o(u, {
123
+ icon: w ? /* @__PURE__ */ i(u, {
124
124
  fontSize: "small",
125
125
  color: "success"
126
- }) : /* @__PURE__ */ o(l, { fontSize: "small" }),
126
+ }) : /* @__PURE__ */ i(l, { fontSize: "small" }),
127
127
  onClick: A,
128
128
  disabled: E
129
129
  }),
130
- _.showClear && /* @__PURE__ */ o(e, {
130
+ _.showClear && /* @__PURE__ */ i(e, {
131
131
  label: v.clear,
132
- icon: /* @__PURE__ */ o(d, { fontSize: "small" }),
132
+ icon: /* @__PURE__ */ i(d, { fontSize: "small" }),
133
133
  onClick: j,
134
134
  disabled: E
135
135
  })
136
136
  ]
137
137
  }),
138
- F && I && /* @__PURE__ */ o(r, {
138
+ F && I && /* @__PURE__ */ i(r, {
139
139
  orientation: "vertical",
140
140
  flexItem: !0,
141
141
  sx: { mx: .5 }
142
142
  }),
143
- I && /* @__PURE__ */ s(n, {
143
+ I && /* @__PURE__ */ a(n, {
144
144
  sx: {
145
145
  display: "flex",
146
146
  gap: .25
147
147
  },
148
- children: [/* @__PURE__ */ o(e, {
148
+ children: [/* @__PURE__ */ i(e, {
149
149
  label: v.undo,
150
- icon: /* @__PURE__ */ o(f, { fontSize: "small" }),
150
+ icon: /* @__PURE__ */ i(f, { fontSize: "small" }),
151
151
  onClick: M,
152
152
  disabled: E
153
- }), /* @__PURE__ */ o(e, {
153
+ }), /* @__PURE__ */ i(e, {
154
154
  label: v.redo,
155
- icon: /* @__PURE__ */ o(p, { fontSize: "small" }),
155
+ icon: /* @__PURE__ */ i(p, { fontSize: "small" }),
156
156
  onClick: N,
157
157
  disabled: E
158
158
  })]
159
159
  }),
160
- !P && !F && !I && /* @__PURE__ */ o(n, { sx: { height: 32 } })
160
+ !P && !F && !I && /* @__PURE__ */ i(n, { sx: { height: 32 } })
161
161
  ]
162
162
  });
163
163
  }
@@ -1,12 +1,12 @@
1
1
  import { useEffect as e, useRef as t } from "react";
2
2
  import { Box as n, useTheme as r } from "@mui/material";
3
- import { EditorView as i, highlightActiveLine as a, highlightActiveLineGutter as o, keymap as s, lineNumbers as c, placeholder as l } from "@codemirror/view";
4
- import { Compartment as u, EditorState as d } from "@codemirror/state";
5
- import { defaultKeymap as f, history as p, historyKeymap as m } from "@codemirror/commands";
6
- import { HighlightStyle as ee, syntaxHighlighting as te } from "@codemirror/language";
7
- import { lintGutter as ne, linter as h } from "@codemirror/lint";
8
- import { tags as g } from "@lezer/highlight";
9
- import { jsx as _ } from "react/jsx-runtime";
3
+ import { jsx as i } from "react/jsx-runtime";
4
+ import { EditorView as a, highlightActiveLine as o, highlightActiveLineGutter as s, keymap as c, lineNumbers as l, placeholder as u } from "@codemirror/view";
5
+ import { Compartment as d, EditorState as f } from "@codemirror/state";
6
+ import { defaultKeymap as p, history as m, historyKeymap as ee } from "@codemirror/commands";
7
+ import { HighlightStyle as te, syntaxHighlighting as ne } from "@codemirror/language";
8
+ import { lintGutter as h, linter as g } from "@codemirror/lint";
9
+ import { tags as _ } from "@lezer/highlight";
10
10
  import { MSSQL as v, MySQL as y, PostgreSQL as b, SQLite as x, StandardSQL as S, sql as C } from "@codemirror/lang-sql";
11
11
  import { autocompletion as re, completionKeymap as w } from "@codemirror/autocomplete";
12
12
  //#region src/components/sql-editor/SqlEditorContent.tsx
@@ -18,7 +18,7 @@ var T = {
18
18
  mssql: v
19
19
  };
20
20
  function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly: S = !1, showLineNumbers: E = !0, dialect: D = "standard", keywordColor: O, stringColor: k, identifierColor: A, schema: j, onExecute: M, onLint: N, onDiagnosticsChange: P, onViewReady: F, onCursorChange: I, onBlur: L, onFocus: R }) {
21
- let z = t(null), B = t(null), V = t(y), H = t(I), U = t(L), W = t(R), G = t(F), K = t(M), q = t(N), J = t(P), Y = t(new u()), X = t(new u()), Z = r(), Q = Z.palette.mode === "dark", $ = !!N, ie = JSON.stringify(j);
21
+ let z = t(null), B = t(null), V = t(y), H = t(I), U = t(L), W = t(R), G = t(F), K = t(M), q = t(N), J = t(P), Y = t(new d()), X = t(new d()), Z = r(), Q = Z.palette.mode === "dark", $ = !!N, ie = JSON.stringify(j);
22
22
  return e(() => {
23
23
  V.current = y;
24
24
  }, [y]), e(() => {
@@ -37,48 +37,48 @@ function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
37
37
  J.current = P;
38
38
  }, [P]), e(() => {
39
39
  if (!z.current) return;
40
- let e = B.current?.state.doc.toString() ?? v ?? "", t = O ?? Z.palette.primary.main, n = k ?? Z.palette.success.main, r = A ?? Z.palette.info.main, u = ee.define([
40
+ let e = B.current?.state.doc.toString() ?? v ?? "", t = O ?? Z.palette.primary.main, n = k ?? Z.palette.success.main, r = A ?? Z.palette.info.main, i = te.define([
41
41
  {
42
- tag: g.keyword,
42
+ tag: _.keyword,
43
43
  color: t,
44
44
  fontWeight: "bold"
45
45
  },
46
46
  {
47
- tag: g.name,
47
+ tag: _.name,
48
48
  color: r
49
49
  },
50
50
  {
51
- tag: [g.string, g.special(g.string)],
51
+ tag: [_.string, _.special(_.string)],
52
52
  color: n,
53
53
  fontWeight: "bold"
54
54
  },
55
55
  {
56
- tag: g.number,
56
+ tag: _.number,
57
57
  color: Z.palette.warning.main
58
58
  },
59
59
  {
60
- tag: [g.lineComment, g.blockComment],
60
+ tag: [_.lineComment, _.blockComment],
61
61
  color: Z.palette.text.disabled,
62
62
  fontStyle: "italic"
63
63
  },
64
64
  {
65
- tag: g.operator,
65
+ tag: _.operator,
66
66
  color: Z.palette.text.secondary
67
67
  },
68
68
  {
69
- tag: [g.function(g.variableName), g.function(g.name)],
69
+ tag: [_.function(_.variableName), _.function(_.name)],
70
70
  color: Z.palette.secondary.main
71
71
  },
72
72
  {
73
- tag: g.typeName,
73
+ tag: _.typeName,
74
74
  color: Z.palette.info.main
75
75
  },
76
76
  {
77
- tag: g.invalid,
77
+ tag: _.invalid,
78
78
  color: Z.palette.error.main,
79
79
  textDecoration: "underline wavy"
80
80
  }
81
- ]), _ = i.theme({
81
+ ]), d = a.theme({
82
82
  "&": {
83
83
  height: "100%",
84
84
  fontFamily: "'Fira Code', 'JetBrains Mono', 'Consolas', monospace",
@@ -161,36 +161,36 @@ function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
161
161
  } catch {
162
162
  return [];
163
163
  }
164
- }, N = s.of([{
164
+ }, N = c.of([{
165
165
  key: "Mod-Enter",
166
166
  run: (e) => (K.current?.(e.state.doc.toString()), !0)
167
167
  }]), P = [
168
- _,
169
- te(u),
168
+ d,
169
+ ne(i),
170
170
  C({
171
171
  dialect: T[D],
172
172
  schema: y
173
173
  }),
174
- p(),
174
+ m(),
175
175
  re(),
176
176
  N,
177
- s.of([
178
- ...f,
179
- ...m,
177
+ c.of([
178
+ ...p,
179
+ ...ee,
180
180
  ...w
181
181
  ]),
182
- Y.current.of(i.editable.of(!x && !S)),
183
- X.current.of(d.readOnly.of(S)),
184
- a(),
185
- ...E ? [c(), o()] : [],
186
- ...b ? [l(b)] : [],
187
- ...$ ? [ne(), h(M, { delay: 600 })] : [],
188
- i.updateListener.of((e) => {
182
+ Y.current.of(a.editable.of(!x && !S)),
183
+ X.current.of(f.readOnly.of(S)),
184
+ o(),
185
+ ...E ? [l(), s()] : [],
186
+ ...b ? [u(b)] : [],
187
+ ...$ ? [h(), g(M, { delay: 600 })] : [],
188
+ a.updateListener.of((e) => {
189
189
  e.docChanged && V.current?.(e.state.doc.toString());
190
190
  let t = e.state.selection.main.head, n = e.state.doc.lineAt(t);
191
191
  H.current(n.number, t - n.from + 1);
192
192
  }),
193
- i.domEventHandlers({
193
+ a.domEventHandlers({
194
194
  blur: () => {
195
195
  U.current?.();
196
196
  },
@@ -198,8 +198,8 @@ function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
198
198
  W.current?.();
199
199
  }
200
200
  })
201
- ], F = new i({
202
- state: d.create({
201
+ ], F = new a({
202
+ state: f.create({
203
203
  doc: e,
204
204
  extensions: P
205
205
  }),
@@ -226,8 +226,8 @@ function E({ value: v, onChange: y, placeholder: b, disabled: x = !1, readonly:
226
226
  insert: v ?? ""
227
227
  } });
228
228
  }, [v]), e(() => {
229
- B.current?.dispatch({ effects: [Y.current.reconfigure(i.editable.of(!x && !S)), X.current.reconfigure(d.readOnly.of(S))] });
230
- }, [x, S]), /* @__PURE__ */ _(n, {
229
+ B.current?.dispatch({ effects: [Y.current.reconfigure(a.editable.of(!x && !S)), X.current.reconfigure(f.readOnly.of(S))] });
230
+ }, [x, S]), /* @__PURE__ */ i(n, {
231
231
  ref: z,
232
232
  sx: {
233
233
  flex: 1,