@thebuoyant-tsdev/mui-ts-library 3.24.1 → 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.
@@ -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,
@@ -2,8 +2,8 @@ import { ToolbarButton as e } from "../shared/ToolbarButton.js";
2
2
  import { SqlEditorHistoryMenu as t } from "./SqlEditorHistoryMenu.js";
3
3
  import { useState as n } from "react";
4
4
  import { Box as r, Divider as i } from "@mui/material";
5
- import { redo as a, undo as o } from "@codemirror/commands";
6
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
5
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ import { redo as c, undo as l } from "@codemirror/commands";
7
7
  import u from "@mui/icons-material/ContentCopy";
8
8
  import d from "@mui/icons-material/Check";
9
9
  import f from "@mui/icons-material/Delete";
@@ -38,11 +38,11 @@ function y({ editorView: y, toolbarConfig: b, translation: x, dialect: S, disabl
38
38
  }
39
39
  function N() {
40
40
  let e = y;
41
- e && (o(e), e.focus());
41
+ e && (l(e), e.focus());
42
42
  }
43
43
  function P() {
44
44
  let e = y;
45
- e && (a(e), e.focus());
45
+ e && (c(e), e.focus());
46
46
  }
47
47
  function F() {
48
48
  let e = y;
@@ -63,7 +63,7 @@ function y({ editorView: y, toolbarConfig: b, translation: x, dialect: S, disabl
63
63
  !e || !w || w(e.state.doc.toString());
64
64
  }
65
65
  let L = b.showFormat, R = b.showCopy || b.showClear, z = b.showUndoRedo, B = b.showExecute && !!w, V = b.showHistory && !!w && !!E && !!D;
66
- return /* @__PURE__ */ l(r, {
66
+ return /* @__PURE__ */ s(r, {
67
67
  sx: {
68
68
  display: "flex",
69
69
  flexWrap: "wrap",
@@ -75,87 +75,87 @@ function y({ editorView: y, toolbarConfig: b, translation: x, dialect: S, disabl
75
75
  role: "toolbar",
76
76
  "aria-label": "SQL editor actions",
77
77
  children: [
78
- L && /* @__PURE__ */ c(r, {
78
+ L && /* @__PURE__ */ o(r, {
79
79
  sx: {
80
80
  display: "flex",
81
81
  gap: .25
82
82
  },
83
- children: /* @__PURE__ */ c(e, {
83
+ children: /* @__PURE__ */ o(e, {
84
84
  label: x.format,
85
- icon: /* @__PURE__ */ c(h, { fontSize: "small" }),
85
+ icon: /* @__PURE__ */ o(h, { fontSize: "small" }),
86
86
  onClick: F,
87
87
  disabled: A
88
88
  })
89
89
  }),
90
- L && (R || z) && /* @__PURE__ */ c(i, {
90
+ L && (R || z) && /* @__PURE__ */ o(i, {
91
91
  orientation: "vertical",
92
92
  flexItem: !0,
93
93
  sx: { mx: .5 }
94
94
  }),
95
- R && /* @__PURE__ */ l(r, {
95
+ R && /* @__PURE__ */ s(r, {
96
96
  sx: {
97
97
  display: "flex",
98
98
  gap: .25
99
99
  },
100
- children: [b.showCopy && /* @__PURE__ */ c(e, {
100
+ children: [b.showCopy && /* @__PURE__ */ o(e, {
101
101
  label: O ? x.copySuccess : x.copy,
102
- icon: O ? /* @__PURE__ */ c(d, {
102
+ icon: O ? /* @__PURE__ */ o(d, {
103
103
  fontSize: "small",
104
104
  color: "success"
105
- }) : /* @__PURE__ */ c(u, { fontSize: "small" }),
105
+ }) : /* @__PURE__ */ o(u, { fontSize: "small" }),
106
106
  onClick: j,
107
107
  disabled: A
108
- }), b.showClear && /* @__PURE__ */ c(e, {
108
+ }), b.showClear && /* @__PURE__ */ o(e, {
109
109
  label: x.clear,
110
- icon: /* @__PURE__ */ c(f, { fontSize: "small" }),
110
+ icon: /* @__PURE__ */ o(f, { fontSize: "small" }),
111
111
  onClick: M,
112
112
  disabled: A
113
113
  })]
114
114
  }),
115
- R && z && /* @__PURE__ */ c(i, {
115
+ R && z && /* @__PURE__ */ o(i, {
116
116
  orientation: "vertical",
117
117
  flexItem: !0,
118
118
  sx: { mx: .5 }
119
119
  }),
120
- z && /* @__PURE__ */ l(r, {
120
+ z && /* @__PURE__ */ s(r, {
121
121
  sx: {
122
122
  display: "flex",
123
123
  gap: .25
124
124
  },
125
- children: [/* @__PURE__ */ c(e, {
125
+ children: [/* @__PURE__ */ o(e, {
126
126
  label: x.undo,
127
- icon: /* @__PURE__ */ c(p, { fontSize: "small" }),
127
+ icon: /* @__PURE__ */ o(p, { fontSize: "small" }),
128
128
  onClick: N,
129
129
  disabled: A
130
- }), /* @__PURE__ */ c(e, {
130
+ }), /* @__PURE__ */ o(e, {
131
131
  label: x.redo,
132
- icon: /* @__PURE__ */ c(m, { fontSize: "small" }),
132
+ icon: /* @__PURE__ */ o(m, { fontSize: "small" }),
133
133
  onClick: P,
134
134
  disabled: A
135
135
  })]
136
136
  }),
137
- V && /* @__PURE__ */ l(s, { children: [(R || z) && /* @__PURE__ */ c(i, {
137
+ V && /* @__PURE__ */ s(a, { children: [(R || z) && /* @__PURE__ */ o(i, {
138
138
  orientation: "vertical",
139
139
  flexItem: !0,
140
140
  sx: { mx: .5 }
141
- }), /* @__PURE__ */ c(t, {
141
+ }), /* @__PURE__ */ o(t, {
142
142
  history: T,
143
143
  onSelect: E,
144
144
  onClear: D,
145
145
  translation: x,
146
146
  disabled: C
147
147
  })] }),
148
- B && /* @__PURE__ */ l(s, { children: [(R || z || V) && /* @__PURE__ */ c(i, {
148
+ B && /* @__PURE__ */ s(a, { children: [(R || z || V) && /* @__PURE__ */ o(i, {
149
149
  orientation: "vertical",
150
150
  flexItem: !0,
151
151
  sx: { mx: .5 }
152
- }), /* @__PURE__ */ c(e, {
152
+ }), /* @__PURE__ */ o(e, {
153
153
  label: x.execute,
154
- icon: /* @__PURE__ */ c(g, { fontSize: "small" }),
154
+ icon: /* @__PURE__ */ o(g, { fontSize: "small" }),
155
155
  onClick: I,
156
156
  disabled: A
157
157
  })] }),
158
- !L && !R && !z && !V && !B && /* @__PURE__ */ c(r, { sx: { height: 32 } })
158
+ !L && !R && !z && !V && !B && /* @__PURE__ */ o(r, { sx: { height: 32 } })
159
159
  ]
160
160
  });
161
161
  }