@m4l/graphics 6.0.0 → 6.0.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/components/GlobalStyles/index.d.ts +0 -1
- package/contexts/FormatterContext/index.d.ts +1 -2
- package/contexts/FormatterContext/{index-Ch6IW7j8.js → index.js} +1 -1
- package/contexts/FormatterContext/types.d.ts +2 -2
- package/contexts/HostThemeContext/index.d.ts +1 -2
- package/contexts/HostThemeContext/{index-CcHelA1w.js → index.js} +1 -1
- package/contexts/HostThemeContext/types.d.ts +4 -4
- package/contexts/LocalesContext/helper.js +35 -0
- package/contexts/LocalesContext/index.d.ts +1 -2
- package/contexts/LocalesContext/index.js +69 -0
- package/contexts/LocalesContext/types.d.ts +4 -4
- package/contexts/ResponsiveContainerContext/constants.js +4 -0
- package/contexts/ResponsiveContainerContext/index.d.ts +3 -4
- package/contexts/ResponsiveContainerContext/index.js +51 -0
- package/contexts/ResponsiveContainerContext/store.d.ts +3 -3
- package/contexts/ResponsiveContainerContext/store.js +26 -0
- package/contexts/ResponsiveContainerContext/types.d.ts +4 -5
- package/contexts/ThemeSettingsContext/ThemeSettingsContext.d.ts +4 -5
- package/contexts/ThemeSettingsContext/ThemeSettingsContext.js +32 -0
- package/contexts/ThemeSettingsContext/constants.js +11 -0
- package/contexts/ThemeSettingsContext/index.js +1 -0
- package/contexts/ThemeSettingsContext/store.d.ts +2 -2
- package/contexts/ThemeSettingsContext/store.js +118 -0
- package/contexts/ThemeSettingsContext/types.d.ts +10 -10
- package/contexts/index.js +1 -0
- package/hooks/index.js +1 -0
- package/hooks/useFormatter/index.d.ts +1 -1
- package/hooks/useFormatter/index.js +11 -0
- package/hooks/useHostTheme/index.d.ts +1 -1
- package/hooks/useHostTheme/index.js +11 -0
- package/hooks/useIsMobile/{index-Bro0dV28.js → index.js} +5 -5
- package/hooks/useIsMountedRef/index.d.ts +1 -2
- package/hooks/useIsMountedRef/index.js +13 -0
- package/hooks/useLocales/index.d.ts +1 -1
- package/hooks/useLocales/index.js +11 -0
- package/hooks/useOffSetTop.js +12 -0
- package/hooks/useResizeObserver/index.d.ts +1 -2
- package/hooks/useResizeObserver/index.js +18 -0
- package/hooks/useResponsive/index.js +7 -0
- package/hooks/useResponsiveContainer/index.js +12 -0
- package/hooks/useThemSettingsStore/index.js +12 -0
- package/index.js +44 -35
- package/package.json +55 -11
- package/utils/anchorEl.d.ts +2 -2
- package/utils/anchorEl.js +49 -0
- package/utils/index.js +1 -0
- package/utils/strings.js +4 -0
- package/vite-env.d.ts +1 -1
- package/commonjs-BCz0-aDl.js +0 -9
- package/contexts/LocalesContext/index-C89UlO0s.js +0 -101
- package/contexts/index-DypyrDjq.js +0 -211
- package/hooks/index-DrIHt-va.js +0 -52
- package/hooks/useFormatter/index-BBgQ4lJL.js +0 -10
- package/hooks/useLocales/index-_thMBNE7.js +0 -10
- package/hooks/useResponsive/index-BEcgN5as.js +0 -16
- package/node_modules-BHhXVwYT.js +0 -4569
- package/utils/index-DZG6QXjf.js +0 -51
- /package/components/{GlobalStyle/index-C3p7OfnO.js → GlobalStyles/index.js} +0 -0
- /package/components/{index-l0sNRNKZ.js → index.js} +0 -0
- /package/hooks/useFirstRender/{index-B-Q0TTn0.js → index.js} +0 -0
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
-
import { createContext as f, useRef as d, useMemo as y, useLayoutEffect as b, useEffect as P } from "react";
|
|
3
|
-
import { c as T, d as v, i as C, l as O } from "../node_modules-BHhXVwYT.js";
|
|
4
|
-
import { useNetwork as M, useLocalStorageWithListener as E } from "@m4l/core";
|
|
5
|
-
import { getPaletteByPreset as x, typography as k, shadows as S, getColorPresets as L, createCustomShadows as w, OUR_THEME as A, presetsOptions as B } from "@m4l/styles";
|
|
6
|
-
import { alpha as D } from "@mui/system";
|
|
7
|
-
import { u as z } from "../hooks/useIsMobile/index-Bro0dV28.js";
|
|
8
|
-
const u = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, _ = (r) => {
|
|
9
|
-
const n = {
|
|
10
|
-
...r
|
|
11
|
-
};
|
|
12
|
-
return T(
|
|
13
|
-
v(
|
|
14
|
-
C((o, t) => ({
|
|
15
|
-
...n,
|
|
16
|
-
responsiveContainerActions: {
|
|
17
|
-
setBreakpoint: (e) => {
|
|
18
|
-
o((i) => {
|
|
19
|
-
i.breakPoint = e, i.isUpSm = e !== "xs" && e !== "sm", i.isXs = e == "xs";
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
})),
|
|
24
|
-
{ name: "Responsive Relative Store" }
|
|
25
|
-
)
|
|
26
|
-
);
|
|
27
|
-
}, $ = f(null), V = (r) => {
|
|
28
|
-
const { children: n, observedDivRef: o } = r, t = d();
|
|
29
|
-
t.current || (t.current = _({
|
|
30
|
-
breakPoint: "md",
|
|
31
|
-
isUpSm: !1,
|
|
32
|
-
isXs: !1
|
|
33
|
-
}));
|
|
34
|
-
const e = () => {
|
|
35
|
-
const s = o;
|
|
36
|
-
if (s instanceof HTMLElement && s.clientWidth) {
|
|
37
|
-
const m = Object.keys(
|
|
38
|
-
u
|
|
39
|
-
);
|
|
40
|
-
for (let h = 0; h < m.length; h++) {
|
|
41
|
-
const a = m[h];
|
|
42
|
-
if (s.clientWidth <= u[a]) {
|
|
43
|
-
t.current?.getState().responsiveContainerActions.setBreakpoint(a);
|
|
44
|
-
break;
|
|
45
|
-
} else h === m.length - 1 && s.clientWidth >= u[a] && t.current?.getState().responsiveContainerActions.setBreakpoint(a);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, i = y(
|
|
49
|
-
() => O.throttle(e, 200, {
|
|
50
|
-
leading: !1,
|
|
51
|
-
trailing: !0
|
|
52
|
-
}),
|
|
53
|
-
[e]
|
|
54
|
-
);
|
|
55
|
-
return b(() => {
|
|
56
|
-
const s = () => {
|
|
57
|
-
i();
|
|
58
|
-
}, m = o;
|
|
59
|
-
if (m && m instanceof Element) {
|
|
60
|
-
const h = new ResizeObserver((a) => {
|
|
61
|
-
s();
|
|
62
|
-
});
|
|
63
|
-
return h.observe(m), () => {
|
|
64
|
-
h.disconnect();
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
}, [o]), /* @__PURE__ */ p($.Provider, { value: t.current, children: n });
|
|
68
|
-
}, g = {
|
|
69
|
-
themeMode: "light",
|
|
70
|
-
themeDirection: "ltr",
|
|
71
|
-
themeColorPresets: "patronus",
|
|
72
|
-
themeLayout: "horizontal",
|
|
73
|
-
themeStretch: !1,
|
|
74
|
-
isMobile: !1
|
|
75
|
-
};
|
|
76
|
-
function R(r, n = "m4l") {
|
|
77
|
-
const o = document.querySelector('[data-mui-color-scheme="light"]');
|
|
78
|
-
if (!o) {
|
|
79
|
-
console.error('Element with data-mui-color-scheme="light" not found.');
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
Object.keys(r).forEach((t) => {
|
|
83
|
-
const e = r[t];
|
|
84
|
-
if (typeof e == "string" || typeof e == "number") {
|
|
85
|
-
const i = `--${n}-${t}`;
|
|
86
|
-
o.style.setProperty(i, e.toString());
|
|
87
|
-
} else typeof e == "object" && e !== null && R(e, `${n}-${t}`);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const c = (r) => {
|
|
91
|
-
const n = r.currentThemeSettings || g, o = n.themeMode === "light", t = x(n.themeColorPresets), e = o ? t.light : t.dark;
|
|
92
|
-
r.themeOptions = {
|
|
93
|
-
...r.themeOptions,
|
|
94
|
-
typography: k,
|
|
95
|
-
palette: {
|
|
96
|
-
...r.themeOptions?.palette ?? {},
|
|
97
|
-
...e
|
|
98
|
-
},
|
|
99
|
-
shape: { borderRadius: 8 },
|
|
100
|
-
direction: n.themeDirection,
|
|
101
|
-
shadows: o ? S.light : S.dark,
|
|
102
|
-
customShadows: {
|
|
103
|
-
primary: `0 8px 16px 0 ${D(
|
|
104
|
-
L(n.themeColorPresets)?.main || "#fff",
|
|
105
|
-
0.2
|
|
106
|
-
)}`,
|
|
107
|
-
...w(n.themeMode)
|
|
108
|
-
},
|
|
109
|
-
stretch: n.themeStretch
|
|
110
|
-
}, R(r.themeOptions);
|
|
111
|
-
}, l = (r) => {
|
|
112
|
-
r.setterThemeSettings && r.setterThemeSettings(r.currentThemeSettings);
|
|
113
|
-
}, j = (r) => T(
|
|
114
|
-
v(
|
|
115
|
-
C((n, o) => ({
|
|
116
|
-
...r,
|
|
117
|
-
settingsActions: {
|
|
118
|
-
init: () => {
|
|
119
|
-
n((t) => {
|
|
120
|
-
c(t);
|
|
121
|
-
});
|
|
122
|
-
},
|
|
123
|
-
setThemeSettings: (t) => {
|
|
124
|
-
n((e) => {
|
|
125
|
-
e.currentThemeSettings = { ...e.currentThemeSettings, ...t }, l(e), c(e);
|
|
126
|
-
});
|
|
127
|
-
},
|
|
128
|
-
onChangeMode: (t) => {
|
|
129
|
-
n((e) => {
|
|
130
|
-
e.currentThemeSettings = {
|
|
131
|
-
...e.currentThemeSettings,
|
|
132
|
-
themeMode: t.target.value
|
|
133
|
-
}, l(e), c(e);
|
|
134
|
-
});
|
|
135
|
-
},
|
|
136
|
-
handleOpen: () => {
|
|
137
|
-
n((t) => {
|
|
138
|
-
t.open = !t.open;
|
|
139
|
-
});
|
|
140
|
-
},
|
|
141
|
-
onChangeDirection: (t) => {
|
|
142
|
-
n((e) => {
|
|
143
|
-
e.currentThemeSettings = {
|
|
144
|
-
...e.currentThemeSettings,
|
|
145
|
-
themeDirection: t.target.value
|
|
146
|
-
}, l(e), c(e);
|
|
147
|
-
});
|
|
148
|
-
},
|
|
149
|
-
onChangeColor: (t) => {
|
|
150
|
-
n((e) => {
|
|
151
|
-
e.currentThemeSettings = {
|
|
152
|
-
...e.currentThemeSettings,
|
|
153
|
-
themeColorPresets: t.target.value
|
|
154
|
-
}, l(e), c(e);
|
|
155
|
-
});
|
|
156
|
-
},
|
|
157
|
-
onChangeLayout: (t) => {
|
|
158
|
-
n((e) => {
|
|
159
|
-
e.currentThemeSettings = {
|
|
160
|
-
...e.currentThemeSettings,
|
|
161
|
-
themeLayout: t.target.value
|
|
162
|
-
}, l(e), c(e);
|
|
163
|
-
});
|
|
164
|
-
},
|
|
165
|
-
onToggleStretch: () => {
|
|
166
|
-
n((t) => {
|
|
167
|
-
t.currentThemeSettings = {
|
|
168
|
-
...t.currentThemeSettings,
|
|
169
|
-
themeStretch: !t.currentThemeSettings.themeStretch
|
|
170
|
-
}, l(t), c(t);
|
|
171
|
-
});
|
|
172
|
-
},
|
|
173
|
-
onResetSetting: () => {
|
|
174
|
-
n((t) => {
|
|
175
|
-
t.currentThemeSettings = {
|
|
176
|
-
...g
|
|
177
|
-
}, l(t), c(t);
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
})),
|
|
182
|
-
{ name: "ThemeSettingsStore" }
|
|
183
|
-
)
|
|
184
|
-
), W = f(null);
|
|
185
|
-
function F({ children: r, themeSettings: n }) {
|
|
186
|
-
const { networkOperation: o } = M(), t = z(), [e, i] = E(
|
|
187
|
-
"theme_setting",
|
|
188
|
-
{}
|
|
189
|
-
), s = d();
|
|
190
|
-
return s.current || (s.current = j({
|
|
191
|
-
networkOperation: o,
|
|
192
|
-
currentThemeSettings: {
|
|
193
|
-
...g,
|
|
194
|
-
...n,
|
|
195
|
-
...e
|
|
196
|
-
},
|
|
197
|
-
themeOptions: A,
|
|
198
|
-
colorOption: B,
|
|
199
|
-
open: !1,
|
|
200
|
-
setterThemeSettings: n ? void 0 : i
|
|
201
|
-
}), s.current.getState().settingsActions.init()), P(() => {
|
|
202
|
-
s.current?.getState().settingsActions.setThemeSettings({ isMobile: t });
|
|
203
|
-
}, [t]), /* @__PURE__ */ p(W.Provider, { value: s.current, children: r });
|
|
204
|
-
}
|
|
205
|
-
export {
|
|
206
|
-
$ as R,
|
|
207
|
-
W as T,
|
|
208
|
-
V as a,
|
|
209
|
-
F as b,
|
|
210
|
-
g as d
|
|
211
|
-
};
|
package/hooks/index-DrIHt-va.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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-CcHelA1w.js";
|
|
3
|
-
import { u as a } from "../node_modules-BHhXVwYT.js";
|
|
4
|
-
import { T as l } from "../contexts/index-DypyrDjq.js";
|
|
5
|
-
function S() {
|
|
6
|
-
const e = n(!0);
|
|
7
|
-
return r(
|
|
8
|
-
() => () => {
|
|
9
|
-
e.current = !1;
|
|
10
|
-
},
|
|
11
|
-
[]
|
|
12
|
-
), e;
|
|
13
|
-
}
|
|
14
|
-
function x(e) {
|
|
15
|
-
const [s, t] = i(!1), o = e || 100;
|
|
16
|
-
return r(() => (window.onscroll = () => {
|
|
17
|
-
window.pageYOffset > o ? t(!0) : t(!1);
|
|
18
|
-
}, () => {
|
|
19
|
-
window.onscroll = null;
|
|
20
|
-
}), [o]), s;
|
|
21
|
-
}
|
|
22
|
-
const h = () => {
|
|
23
|
-
const e = u(m);
|
|
24
|
-
if (!e) throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
25
|
-
return e;
|
|
26
|
-
};
|
|
27
|
-
function b(e) {
|
|
28
|
-
const s = n(null);
|
|
29
|
-
return c(() => {
|
|
30
|
-
const t = s?.current;
|
|
31
|
-
if (!t)
|
|
32
|
-
return;
|
|
33
|
-
const o = new ResizeObserver((f) => {
|
|
34
|
-
e(t, f[0]);
|
|
35
|
-
});
|
|
36
|
-
return o.observe(t), () => {
|
|
37
|
-
o.disconnect();
|
|
38
|
-
};
|
|
39
|
-
}, [e, s.current]), s;
|
|
40
|
-
}
|
|
41
|
-
function g(e, s) {
|
|
42
|
-
const t = u(l);
|
|
43
|
-
if (!t) throw new Error("useSettingsStore context must be use inside SettignsContext");
|
|
44
|
-
return a(t, e, s);
|
|
45
|
-
}
|
|
46
|
-
export {
|
|
47
|
-
x as a,
|
|
48
|
-
h as b,
|
|
49
|
-
b as c,
|
|
50
|
-
g as d,
|
|
51
|
-
S as u
|
|
52
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useContext as r } from "react";
|
|
2
|
-
import { F as e } from "../../contexts/FormatterContext/index-Ch6IW7j8.js";
|
|
3
|
-
const m = () => {
|
|
4
|
-
const t = r(e);
|
|
5
|
-
if (!t) throw new Error("useFormatter context must be use inside FormatterProvider");
|
|
6
|
-
return t;
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
m as u
|
|
10
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useContext as o } from "react";
|
|
2
|
-
import { L as t } from "../../contexts/LocalesContext/index-C89UlO0s.js";
|
|
3
|
-
const n = () => {
|
|
4
|
-
const e = o(t);
|
|
5
|
-
if (!e) throw new Error("useLocales context must be use inside LocalesProvider");
|
|
6
|
-
return e;
|
|
7
|
-
};
|
|
8
|
-
export {
|
|
9
|
-
n as u
|
|
10
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { useContext as t } from "react";
|
|
2
|
-
import { u as r } from "../../node_modules-BHhXVwYT.js";
|
|
3
|
-
import { R as n } from "../../contexts/index-DypyrDjq.js";
|
|
4
|
-
import { useResponsive as i } from "@m4l/styles";
|
|
5
|
-
function f(e, s) {
|
|
6
|
-
const o = t(n);
|
|
7
|
-
if (!o) throw new Error("useAreasStore context must be use inside AreasContext");
|
|
8
|
-
return r(o, e, s);
|
|
9
|
-
}
|
|
10
|
-
function c() {
|
|
11
|
-
return i("up", "sm");
|
|
12
|
-
}
|
|
13
|
-
export {
|
|
14
|
-
c as a,
|
|
15
|
-
f as u
|
|
16
|
-
};
|