@m4l/graphics 1.0.9 → 1.0.10
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/ResponsiveContainerContext/constants.d.ts +1 -1
- package/contexts/ResponsiveContainerContext/types.d.ts +1 -2
- package/contexts/{index.1d935da9.js → index.955e2da6.js} +30 -33
- package/hooks/{index.e4fb3c4e.js → index.91cf59db.js} +1 -1
- package/hooks/useIsMobile/{index.1afbcd66.js → index.028b5710.js} +9 -3
- package/hooks/useResponsive/{index.0881f166.js → index.d09000d7.js} +1 -1
- package/index.js +4 -4
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { BreakPointsType } from
|
|
1
|
+
import { BreakPointsType } from './types';
|
|
2
2
|
export declare const BREAKPOINTS: BreakPointsType;
|
|
@@ -19,8 +19,7 @@ export interface ResponsiveContainerState {
|
|
|
19
19
|
isUpSm: boolean;
|
|
20
20
|
isXs: boolean;
|
|
21
21
|
}
|
|
22
|
-
export
|
|
23
|
-
}
|
|
22
|
+
export declare type InitialResponsiveContainerProps = Pick<ResponsiveContainerState, 'breakPoint' | 'isUpSm' | 'isXs'>;
|
|
24
23
|
export interface ResponsiveContainerStateWithActions extends ResponsiveContainerState {
|
|
25
24
|
responsiveContainerActions: {
|
|
26
25
|
setBreakpoint: (breakPoint: BreakpointType) => void;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createContext as f, useRef as T, useMemo as k, useLayoutEffect as y, useEffect as b } from "react";
|
|
2
|
-
import { c as v, d as R, i as P, l as
|
|
2
|
+
import { c as v, d as R, i as P, l as E } from "../node_modules.7cdb697c.js";
|
|
3
3
|
import { jsx as x } from "react/jsx-runtime";
|
|
4
|
-
import { useNetwork as
|
|
5
|
-
import { getColorPresets as m, getColorState as d, typography as L, palette as S, SECONDARY as A, COMMON as N, ERROR as D, WARNING as z, INFO as
|
|
4
|
+
import { useNetwork as M, useLocalStorageWithListener as w } from "@m4l/core";
|
|
5
|
+
import { getColorPresets as m, getColorState as d, typography as L, palette as S, SECONDARY as A, COMMON as N, ERROR as D, WARNING as z, INFO as B, SUCCESS as $, shadows as p, createCustomShadows as j, defaultThemeOptions as W, defaultPreset as _, colorPresets as F } from "@m4l/styles";
|
|
6
6
|
import { alpha as I } from "@mui/system";
|
|
7
7
|
import { u as U } from "../hooks/useFirstRender/index.1e9b02fb.js";
|
|
8
8
|
const C = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, K = (r) => {
|
|
@@ -15,11 +15,9 @@ const C = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, K = (r) => {
|
|
|
15
15
|
...t,
|
|
16
16
|
responsiveContainerActions: {
|
|
17
17
|
setBreakpoint: (e) => {
|
|
18
|
-
o(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
);
|
|
18
|
+
o((i) => {
|
|
19
|
+
i.breakPoint = e, i.isUpSm = e !== "xs" && e !== "sm", i.isXs = e == "xs";
|
|
20
|
+
});
|
|
23
21
|
}
|
|
24
22
|
}
|
|
25
23
|
})),
|
|
@@ -39,29 +37,28 @@ const C = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, K = (r) => {
|
|
|
39
37
|
const e = () => {
|
|
40
38
|
const s = o;
|
|
41
39
|
if (s instanceof HTMLElement && s.clientWidth) {
|
|
42
|
-
const
|
|
43
|
-
for (let l = 0; l <
|
|
44
|
-
const g =
|
|
40
|
+
const a = Object.keys(C);
|
|
41
|
+
for (let l = 0; l < a.length; l++) {
|
|
42
|
+
const g = a[l];
|
|
45
43
|
if (s.clientWidth <= C[g]) {
|
|
46
44
|
n.current?.getState().responsiveContainerActions.setBreakpoint(g);
|
|
47
45
|
break;
|
|
48
46
|
}
|
|
49
47
|
}
|
|
50
|
-
console.log("node.clientWidth", s.clientWidth), console.log("onResizeMemo", n.current?.getState().breakPoint);
|
|
51
48
|
}
|
|
52
|
-
}, i = k(() =>
|
|
49
|
+
}, i = k(() => E.exports.throttle(e, 200, {
|
|
53
50
|
leading: !1,
|
|
54
51
|
trailing: !0
|
|
55
52
|
}), [e]);
|
|
56
53
|
return y(() => {
|
|
57
54
|
const s = () => {
|
|
58
55
|
i();
|
|
59
|
-
},
|
|
60
|
-
if (
|
|
56
|
+
}, a = o;
|
|
57
|
+
if (a && a instanceof Element) {
|
|
61
58
|
const l = new ResizeObserver((g) => {
|
|
62
59
|
s();
|
|
63
60
|
});
|
|
64
|
-
return l.observe(
|
|
61
|
+
return l.observe(a), () => {
|
|
65
62
|
l.disconnect();
|
|
66
63
|
};
|
|
67
64
|
}
|
|
@@ -91,7 +88,7 @@ function O(r, t = "m4l") {
|
|
|
91
88
|
typeof e == "object" && e !== null && O(e, `${t}-${n}`);
|
|
92
89
|
});
|
|
93
90
|
}
|
|
94
|
-
const
|
|
91
|
+
const c = (r) => {
|
|
95
92
|
const t = r.currentThemeSettings || u;
|
|
96
93
|
console.log("getColorPresets", m(t.themeColorPresets)), console.log(
|
|
97
94
|
"getColorState",
|
|
@@ -141,7 +138,7 @@ const a = (r) => {
|
|
|
141
138
|
contrastTextChannel: ""
|
|
142
139
|
},
|
|
143
140
|
info: {
|
|
144
|
-
...
|
|
141
|
+
...B,
|
|
145
142
|
contrastText: "",
|
|
146
143
|
mainChannel: "",
|
|
147
144
|
lightChannel: "",
|
|
@@ -149,7 +146,7 @@ const a = (r) => {
|
|
|
149
146
|
contrastTextChannel: ""
|
|
150
147
|
},
|
|
151
148
|
success: {
|
|
152
|
-
|
|
149
|
+
...$,
|
|
153
150
|
contrastText: "",
|
|
154
151
|
mainChannel: "",
|
|
155
152
|
lightChannel: "",
|
|
@@ -165,7 +162,7 @@ const a = (r) => {
|
|
|
165
162
|
m(t.themeColorPresets)?.main || "#fff",
|
|
166
163
|
0.2
|
|
167
164
|
)}`,
|
|
168
|
-
|
|
165
|
+
...j(t.themeMode)
|
|
169
166
|
},
|
|
170
167
|
stretch: t.themeStretch
|
|
171
168
|
}, console.log("state.themeOptions", r.themeOptions), O(r.themeOptions);
|
|
@@ -178,12 +175,12 @@ const a = (r) => {
|
|
|
178
175
|
settingsActions: {
|
|
179
176
|
init: () => {
|
|
180
177
|
t((n) => {
|
|
181
|
-
|
|
178
|
+
c(n);
|
|
182
179
|
});
|
|
183
180
|
},
|
|
184
181
|
setThemeSettings: (n) => {
|
|
185
182
|
t((e) => {
|
|
186
|
-
e.currentThemeSettings = { ...e.currentThemeSettings, ...n }, h(e),
|
|
183
|
+
e.currentThemeSettings = { ...e.currentThemeSettings, ...n }, h(e), c(e);
|
|
187
184
|
});
|
|
188
185
|
},
|
|
189
186
|
onChangeMode: (n) => {
|
|
@@ -191,7 +188,7 @@ const a = (r) => {
|
|
|
191
188
|
e.currentThemeSettings = {
|
|
192
189
|
...e.currentThemeSettings,
|
|
193
190
|
themeMode: n.target.value
|
|
194
|
-
}, h(e),
|
|
191
|
+
}, h(e), c(e);
|
|
195
192
|
});
|
|
196
193
|
},
|
|
197
194
|
handleOpen: () => {
|
|
@@ -204,7 +201,7 @@ const a = (r) => {
|
|
|
204
201
|
e.currentThemeSettings = {
|
|
205
202
|
...e.currentThemeSettings,
|
|
206
203
|
themeDirection: n.target.value
|
|
207
|
-
}, h(e),
|
|
204
|
+
}, h(e), c(e);
|
|
208
205
|
});
|
|
209
206
|
},
|
|
210
207
|
onChangeColor: (n) => {
|
|
@@ -212,7 +209,7 @@ const a = (r) => {
|
|
|
212
209
|
e.currentThemeSettings = {
|
|
213
210
|
...e.currentThemeSettings,
|
|
214
211
|
themeColorPresets: n.target.value
|
|
215
|
-
}, h(e),
|
|
212
|
+
}, h(e), c(e);
|
|
216
213
|
});
|
|
217
214
|
},
|
|
218
215
|
onChangeLayout: (n) => {
|
|
@@ -220,7 +217,7 @@ const a = (r) => {
|
|
|
220
217
|
e.currentThemeSettings = {
|
|
221
218
|
...e.currentThemeSettings,
|
|
222
219
|
themeLayout: n.target.value
|
|
223
|
-
}, h(e),
|
|
220
|
+
}, h(e), c(e);
|
|
224
221
|
});
|
|
225
222
|
},
|
|
226
223
|
onToggleStretch: () => {
|
|
@@ -228,14 +225,14 @@ const a = (r) => {
|
|
|
228
225
|
n.currentThemeSettings = {
|
|
229
226
|
...n.currentThemeSettings,
|
|
230
227
|
themeStretch: !n.currentThemeSettings.themeStretch
|
|
231
|
-
}, h(n),
|
|
228
|
+
}, h(n), c(n);
|
|
232
229
|
});
|
|
233
230
|
},
|
|
234
231
|
onResetSetting: () => {
|
|
235
232
|
t((n) => {
|
|
236
233
|
n.currentThemeSettings = {
|
|
237
234
|
...u
|
|
238
|
-
}, h(n),
|
|
235
|
+
}, h(n), c(n);
|
|
239
236
|
});
|
|
240
237
|
}
|
|
241
238
|
}
|
|
@@ -249,17 +246,17 @@ function ne({
|
|
|
249
246
|
}) {
|
|
250
247
|
const {
|
|
251
248
|
networkOperation: o
|
|
252
|
-
} =
|
|
249
|
+
} = M(), [n, e] = w("theme_setting", u), i = U([t]), s = T();
|
|
253
250
|
return s.current || (s.current = q({
|
|
254
251
|
networkOperation: o,
|
|
255
252
|
currentThemeSettings: {
|
|
256
253
|
...t ?? n
|
|
257
254
|
},
|
|
258
|
-
themeOptions:
|
|
255
|
+
themeOptions: W,
|
|
259
256
|
currentPreset: _,
|
|
260
|
-
colorOption: F.map((
|
|
261
|
-
name:
|
|
262
|
-
value:
|
|
257
|
+
colorOption: F.map((a) => ({
|
|
258
|
+
name: a.name,
|
|
259
|
+
value: a.main
|
|
263
260
|
})),
|
|
264
261
|
open: !1,
|
|
265
262
|
setterThemeSettings: t ? void 0 : e
|
|
@@ -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
2
|
import { H as m } from "../contexts/HostThemeContext/index.02e36f38.js";
|
|
3
3
|
import { u as a } from "../node_modules.7cdb697c.js";
|
|
4
|
-
import { T as l } from "../contexts/index.
|
|
4
|
+
import { T as l } from "../contexts/index.955e2da6.js";
|
|
5
5
|
function S() {
|
|
6
6
|
const e = n(!0);
|
|
7
7
|
return r(
|
|
@@ -3,9 +3,15 @@ import { t as s } from "../../node_modules.7cdb697c.js";
|
|
|
3
3
|
const t = () => typeof navigator > "u" ? !1 : /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), l = () => {
|
|
4
4
|
const [i, r] = n(t());
|
|
5
5
|
return o(() => {
|
|
6
|
-
const e = s(
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const e = s(
|
|
7
|
+
() => {
|
|
8
|
+
r(t());
|
|
9
|
+
},
|
|
10
|
+
200,
|
|
11
|
+
{
|
|
12
|
+
trailing: !0
|
|
13
|
+
}
|
|
14
|
+
);
|
|
9
15
|
return window.addEventListener("resize", e), e(), () => {
|
|
10
16
|
window.removeEventListener("resize", e), e.cancel();
|
|
11
17
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext as t } from "react";
|
|
2
2
|
import { u as r } from "../../node_modules.7cdb697c.js";
|
|
3
|
-
import { R as n } from "../../contexts/index.
|
|
3
|
+
import { R as n } from "../../contexts/index.955e2da6.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,14 +1,14 @@
|
|
|
1
1
|
import { G as l } from "./components/GlobalStyle/index.b7393a44.js";
|
|
2
2
|
import { L as C, a as T, g } from "./contexts/LocalesContext/index.53f0b702.js";
|
|
3
3
|
import { F as R, a as S } from "./contexts/FormatterContext/index.92336f4c.js";
|
|
4
|
-
import { R as F, a as P, T as b, b as L, d as H } from "./contexts/index.
|
|
4
|
+
import { R as F, a as P, T as b, b as L, d as H } from "./contexts/index.955e2da6.js";
|
|
5
5
|
import { H as w, a as z } from "./contexts/HostThemeContext/index.02e36f38.js";
|
|
6
6
|
import { u as I } from "./hooks/useFirstRender/index.1e9b02fb.js";
|
|
7
7
|
import { u as O } from "./hooks/useFormatter/index.57ac8cca.js";
|
|
8
|
-
import { b as A, u as D, a as E, c as N, d as W } from "./hooks/index.
|
|
8
|
+
import { b as A, u as D, a as E, c as N, d as W } from "./hooks/index.91cf59db.js";
|
|
9
9
|
import { u as q } from "./hooks/useLocales/index.d5a80aff.js";
|
|
10
|
-
import { u as J, a as K } from "./hooks/useResponsive/index.
|
|
11
|
-
import { u as U } from "./hooks/useIsMobile/index.
|
|
10
|
+
import { u as J, a as K } from "./hooks/useResponsive/index.d09000d7.js";
|
|
11
|
+
import { u as U } from "./hooks/useIsMobile/index.028b5710.js";
|
|
12
12
|
import { C as X, g as Y } from "./utils/index.6909c662.js";
|
|
13
13
|
import "@mui/material/styles";
|
|
14
14
|
import "@mui/material";
|