@m4l/graphics 3.0.1 → 3.0.2
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/contexts/HostThemeContext/{index-L-9XyXob.js → index-B8iD1cO8.js} +21 -18
- package/contexts/{index-B5tlaHe1.js → index-DqxwPAZr.js} +25 -28
- package/hooks/{index-Ds71tnc2.js → index-jy_ocazP.js} +2 -2
- package/hooks/useResponsive/{index-2q6r6mFX.js → index-P9e5eab1.js} +1 -1
- package/index.js +4 -4
- package/package.json +1 -1
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
import { createContext as
|
|
1
|
+
import { createContext as c, useMemo as h } from "react";
|
|
2
2
|
import { CssBaseline as d } from "@mui/material";
|
|
3
3
|
import { G as p } from "../../components/GlobalStyle/index-BwMNLyTC.js";
|
|
4
4
|
import { createTheme as x, experimental_extendTheme as f, Experimental_CssVarsProvider as u, StyledEngineProvider as T } from "@mui/material/styles";
|
|
5
|
-
import { jsxs as
|
|
6
|
-
const v =
|
|
7
|
-
function
|
|
5
|
+
import { jsxs as i, jsx as t } from "react/jsx-runtime";
|
|
6
|
+
const v = c(null);
|
|
7
|
+
function j(m) {
|
|
8
8
|
const {
|
|
9
|
-
children:
|
|
10
|
-
hostThemeOptions:
|
|
9
|
+
children: l,
|
|
10
|
+
hostThemeOptions: o,
|
|
11
11
|
fnComponentsOverrides: n,
|
|
12
|
-
isMobile:
|
|
13
|
-
} =
|
|
12
|
+
isMobile: s
|
|
13
|
+
} = m, a = h(() => {
|
|
14
14
|
const e = x({
|
|
15
|
-
...
|
|
15
|
+
...o
|
|
16
16
|
}), r = f({
|
|
17
17
|
cssVarPrefix: "m4l",
|
|
18
18
|
colorSchemes: {
|
|
19
19
|
light: e,
|
|
20
20
|
finalTheme: e,
|
|
21
21
|
dark: e
|
|
22
|
+
},
|
|
23
|
+
generalSettings: {
|
|
24
|
+
isMobile: s
|
|
22
25
|
}
|
|
23
26
|
});
|
|
24
27
|
return r.components = n(r), r;
|
|
25
|
-
}, [
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
theme:
|
|
28
|
-
children: [/* @__PURE__ */
|
|
28
|
+
}, [s]);
|
|
29
|
+
return /* @__PURE__ */ i(u, {
|
|
30
|
+
theme: a,
|
|
31
|
+
children: [/* @__PURE__ */ t(p, {}), /* @__PURE__ */ t(v.Provider, {
|
|
29
32
|
value: {
|
|
30
|
-
hostThemeOptions:
|
|
33
|
+
hostThemeOptions: o,
|
|
31
34
|
fnComponentsOverrides: n
|
|
32
35
|
},
|
|
33
|
-
children: /* @__PURE__ */
|
|
36
|
+
children: /* @__PURE__ */ i(T, {
|
|
34
37
|
injectFirst: !0,
|
|
35
|
-
children: [/* @__PURE__ */
|
|
38
|
+
children: [/* @__PURE__ */ t(d, {
|
|
36
39
|
enableColorScheme: !0
|
|
37
|
-
}),
|
|
40
|
+
}), l]
|
|
38
41
|
})
|
|
39
42
|
})]
|
|
40
43
|
});
|
|
41
44
|
}
|
|
42
45
|
export {
|
|
43
46
|
v as H,
|
|
44
|
-
|
|
47
|
+
j as a
|
|
45
48
|
};
|
|
@@ -37,13 +37,13 @@ const g = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, j = (r) => {
|
|
|
37
37
|
const e = () => {
|
|
38
38
|
const s = o;
|
|
39
39
|
if (s instanceof HTMLElement && s.clientWidth) {
|
|
40
|
-
const
|
|
41
|
-
for (let
|
|
42
|
-
const u = a
|
|
40
|
+
const h = Object.keys(g);
|
|
41
|
+
for (let a = 0; a < h.length; a++) {
|
|
42
|
+
const u = h[a];
|
|
43
43
|
if (s.clientWidth <= g[u]) {
|
|
44
44
|
t.current?.getState().responsiveContainerActions.setBreakpoint(u);
|
|
45
45
|
break;
|
|
46
|
-
} else
|
|
46
|
+
} else a === h.length - 1 && s.clientWidth >= g[u] && t.current?.getState().responsiveContainerActions.setBreakpoint(u);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
}, i = R(() => O.throttle(e, 200, {
|
|
@@ -53,13 +53,13 @@ const g = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, j = (r) => {
|
|
|
53
53
|
return k(() => {
|
|
54
54
|
const s = () => {
|
|
55
55
|
i();
|
|
56
|
-
},
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
56
|
+
}, h = o;
|
|
57
|
+
if (h && h instanceof Element) {
|
|
58
|
+
const a = new ResizeObserver((u) => {
|
|
59
59
|
s();
|
|
60
60
|
});
|
|
61
|
-
return
|
|
62
|
-
|
|
61
|
+
return a.observe(h), () => {
|
|
62
|
+
a.disconnect();
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
}, [o]), /* @__PURE__ */ y(W.Provider, {
|
|
@@ -88,45 +88,42 @@ function b(r, n = "m4l") {
|
|
|
88
88
|
} else typeof e == "object" && e !== null && b(e, `${n}-${t}`);
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
-
const
|
|
91
|
+
const l = {
|
|
92
92
|
mainChannel: "",
|
|
93
93
|
lightChannel: "",
|
|
94
94
|
darkChannel: "",
|
|
95
95
|
contrastTextChannel: ""
|
|
96
96
|
}, c = (r) => {
|
|
97
|
-
const n = r.currentThemeSettings || p, o = n.themeMode === "light", t = w(n.themeColorPresets), e = o ? t.light : t.dark
|
|
97
|
+
const n = r.currentThemeSettings || p, o = n.themeMode === "light", t = w(n.themeColorPresets), e = o ? t.light : t.dark;
|
|
98
98
|
r.themeOptions = {
|
|
99
99
|
...r.themeOptions,
|
|
100
100
|
typography: E,
|
|
101
|
-
generalSettings: {
|
|
102
|
-
isMobile: i
|
|
103
|
-
},
|
|
104
101
|
palette: {
|
|
105
102
|
...r.themeOptions?.palette ?? {},
|
|
106
103
|
...e,
|
|
107
104
|
primary: {
|
|
108
105
|
...e.primary,
|
|
109
|
-
...
|
|
106
|
+
...l
|
|
110
107
|
},
|
|
111
108
|
secondary: {
|
|
112
109
|
...e.secondary,
|
|
113
|
-
...
|
|
110
|
+
...l
|
|
114
111
|
},
|
|
115
112
|
info: {
|
|
116
113
|
...e.info,
|
|
117
|
-
...
|
|
114
|
+
...l
|
|
118
115
|
},
|
|
119
116
|
error: {
|
|
120
117
|
...e.error,
|
|
121
|
-
...
|
|
118
|
+
...l
|
|
122
119
|
},
|
|
123
120
|
success: {
|
|
124
121
|
...e.success,
|
|
125
|
-
...
|
|
122
|
+
...l
|
|
126
123
|
},
|
|
127
124
|
warning: {
|
|
128
125
|
...e.warning,
|
|
129
|
-
...
|
|
126
|
+
...l
|
|
130
127
|
},
|
|
131
128
|
text: {
|
|
132
129
|
...e.text,
|
|
@@ -163,7 +160,7 @@ const m = {
|
|
|
163
160
|
},
|
|
164
161
|
stretch: n.themeStretch
|
|
165
162
|
}, b(r.themeOptions);
|
|
166
|
-
},
|
|
163
|
+
}, m = (r) => {
|
|
167
164
|
r.setterThemeSettings && r.setterThemeSettings(r.currentThemeSettings);
|
|
168
165
|
}, _ = (r) => T(
|
|
169
166
|
C(
|
|
@@ -177,7 +174,7 @@ const m = {
|
|
|
177
174
|
},
|
|
178
175
|
setThemeSettings: (t) => {
|
|
179
176
|
n((e) => {
|
|
180
|
-
e.currentThemeSettings = { ...e.currentThemeSettings, ...t },
|
|
177
|
+
e.currentThemeSettings = { ...e.currentThemeSettings, ...t }, m(e), c(e);
|
|
181
178
|
});
|
|
182
179
|
},
|
|
183
180
|
onChangeMode: (t) => {
|
|
@@ -185,7 +182,7 @@ const m = {
|
|
|
185
182
|
e.currentThemeSettings = {
|
|
186
183
|
...e.currentThemeSettings,
|
|
187
184
|
themeMode: t.target.value
|
|
188
|
-
},
|
|
185
|
+
}, m(e), c(e);
|
|
189
186
|
});
|
|
190
187
|
},
|
|
191
188
|
handleOpen: () => {
|
|
@@ -198,7 +195,7 @@ const m = {
|
|
|
198
195
|
e.currentThemeSettings = {
|
|
199
196
|
...e.currentThemeSettings,
|
|
200
197
|
themeDirection: t.target.value
|
|
201
|
-
},
|
|
198
|
+
}, m(e), c(e);
|
|
202
199
|
});
|
|
203
200
|
},
|
|
204
201
|
onChangeColor: (t) => {
|
|
@@ -206,7 +203,7 @@ const m = {
|
|
|
206
203
|
e.currentThemeSettings = {
|
|
207
204
|
...e.currentThemeSettings,
|
|
208
205
|
themeColorPresets: t.target.value
|
|
209
|
-
},
|
|
206
|
+
}, m(e), c(e);
|
|
210
207
|
});
|
|
211
208
|
},
|
|
212
209
|
onChangeLayout: (t) => {
|
|
@@ -214,7 +211,7 @@ const m = {
|
|
|
214
211
|
e.currentThemeSettings = {
|
|
215
212
|
...e.currentThemeSettings,
|
|
216
213
|
themeLayout: t.target.value
|
|
217
|
-
},
|
|
214
|
+
}, m(e), c(e);
|
|
218
215
|
});
|
|
219
216
|
},
|
|
220
217
|
onToggleStretch: () => {
|
|
@@ -222,14 +219,14 @@ const m = {
|
|
|
222
219
|
t.currentThemeSettings = {
|
|
223
220
|
...t.currentThemeSettings,
|
|
224
221
|
themeStretch: !t.currentThemeSettings.themeStretch
|
|
225
|
-
},
|
|
222
|
+
}, m(t), c(t);
|
|
226
223
|
});
|
|
227
224
|
},
|
|
228
225
|
onResetSetting: () => {
|
|
229
226
|
n((t) => {
|
|
230
227
|
t.currentThemeSettings = {
|
|
231
228
|
...p
|
|
232
|
-
},
|
|
229
|
+
}, m(t), c(t);
|
|
233
230
|
});
|
|
234
231
|
}
|
|
235
232
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef as n, useEffect as r, useState as i, useContext as u, useLayoutEffect as c } from "react";
|
|
2
|
-
import { H as m } from "../contexts/HostThemeContext/index-
|
|
2
|
+
import { H as m } from "../contexts/HostThemeContext/index-B8iD1cO8.js";
|
|
3
3
|
import { u as a } from "../node_modules-BHhXVwYT.js";
|
|
4
|
-
import { T as l } from "../contexts/index-
|
|
4
|
+
import { T as l } from "../contexts/index-DqxwPAZr.js";
|
|
5
5
|
function S() {
|
|
6
6
|
const e = n(!0);
|
|
7
7
|
return r(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext as t } from "react";
|
|
2
2
|
import { u as r } from "../../node_modules-BHhXVwYT.js";
|
|
3
|
-
import { R as n } from "../../contexts/index-
|
|
3
|
+
import { R as n } from "../../contexts/index-DqxwPAZr.js";
|
|
4
4
|
import { useResponsive as i } from "@m4l/styles";
|
|
5
5
|
function f(e, s) {
|
|
6
6
|
const o = t(n);
|
package/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { G as s } from "./components/GlobalStyle/index-BwMNLyTC.js";
|
|
2
2
|
import { L as r, a, g as i } from "./contexts/LocalesContext/index--VwMF60R.js";
|
|
3
3
|
import { F as m, a as p } from "./contexts/FormatterContext/index-BHG3bJJo.js";
|
|
4
|
-
import { R as x, a as f, T as d, b as l, d as v } from "./contexts/index-
|
|
5
|
-
import { H as T, a as g } from "./contexts/HostThemeContext/index-
|
|
4
|
+
import { R as x, a as f, T as d, b as l, d as v } from "./contexts/index-DqxwPAZr.js";
|
|
5
|
+
import { H as T, a as g } from "./contexts/HostThemeContext/index-B8iD1cO8.js";
|
|
6
6
|
import { u as R } from "./hooks/useFirstRender/index-B-Q0TTn0.js";
|
|
7
7
|
import { u as c } from "./hooks/useFormatter/index-DfdAcbzw.js";
|
|
8
|
-
import { b as P, u as b, a as L, c as H, d as k } from "./hooks/index-
|
|
8
|
+
import { b as P, u as b, a as L, c as H, d as k } from "./hooks/index-jy_ocazP.js";
|
|
9
9
|
import { u as z } from "./hooks/useLocales/index-mTHn9nqY.js";
|
|
10
|
-
import { u as I, a as M } from "./hooks/useResponsive/index-
|
|
10
|
+
import { u as I, a as M } from "./hooks/useResponsive/index-P9e5eab1.js";
|
|
11
11
|
import { u as y } from "./hooks/useIsMobile/index-Bro0dV28.js";
|
|
12
12
|
import { C as D, g as E } from "./utils/index-DZG6QXjf.js";
|
|
13
13
|
export {
|