@m4l/graphics 1.0.8 → 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/components/index.d8d41b1b.js +1 -0
- package/contexts/HostThemeContext/index.02e36f38.js +44 -0
- package/contexts/ThemeSettingsContext/index.d.ts +2 -1
- package/contexts/ThemeSettingsContext/types.d.ts +6 -3
- package/contexts/index.955e2da6.js +276 -0
- package/contexts/index.d.ts +1 -1
- package/hooks/index.91cf59db.js +54 -0
- package/hooks/useIsMobile/{index.e9f29b1d.js → index.028b5710.js} +1 -1
- package/hooks/useResponsive/{index.f415f47d.js → index.d09000d7.js} +2 -2
- package/index.js +36 -35
- package/package.json +1 -1
- package/vite-env.d.ts +1 -1
- package/components/index.8083534b.js +0 -4
- package/contexts/HostThemeContext/index.f53d14b8.js +0 -44
- package/contexts/index.acf54acf.js +0 -283
- package/hooks/index.315d954d.js +0 -57
- /package/{node_modules.9eeccca4.js → node_modules.7cdb697c.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { createContext as c, useMemo as h } from "react";
|
|
2
|
+
import { CssBaseline as a } from "@mui/material";
|
|
3
|
+
import { G as d } from "../../components/GlobalStyle/index.b7393a44.js";
|
|
4
|
+
import { createTheme as p, experimental_extendTheme as x, Experimental_CssVarsProvider as f, StyledEngineProvider as T } from "@mui/material/styles";
|
|
5
|
+
import { jsxs as s, jsx as t } from "react/jsx-runtime";
|
|
6
|
+
const u = c(null);
|
|
7
|
+
function H(m) {
|
|
8
|
+
const {
|
|
9
|
+
children: i,
|
|
10
|
+
hostThemeOptions: l,
|
|
11
|
+
fnComponentsOverrides: o
|
|
12
|
+
} = m, n = h(() => {
|
|
13
|
+
const e = p({
|
|
14
|
+
...l
|
|
15
|
+
}), r = x({
|
|
16
|
+
cssVarPrefix: "m4l",
|
|
17
|
+
colorSchemes: {
|
|
18
|
+
light: e,
|
|
19
|
+
finalTheme: e,
|
|
20
|
+
dark: e
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
return r.components = o(r), r;
|
|
24
|
+
}, []);
|
|
25
|
+
return /* @__PURE__ */ s(f, {
|
|
26
|
+
theme: n,
|
|
27
|
+
children: [/* @__PURE__ */ t(d, {}), /* @__PURE__ */ t(u.Provider, {
|
|
28
|
+
value: {
|
|
29
|
+
hostThemeOptions: n,
|
|
30
|
+
fnComponentsOverrides: o
|
|
31
|
+
},
|
|
32
|
+
children: /* @__PURE__ */ s(T, {
|
|
33
|
+
injectFirst: !0,
|
|
34
|
+
children: [/* @__PURE__ */ t(a, {
|
|
35
|
+
enableColorScheme: !0
|
|
36
|
+
}), i]
|
|
37
|
+
})
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export {
|
|
42
|
+
u as H,
|
|
43
|
+
H as a
|
|
44
|
+
};
|
|
@@ -22,7 +22,11 @@ export interface ThemeSettingsStore {
|
|
|
22
22
|
name: string | undefined;
|
|
23
23
|
value: string;
|
|
24
24
|
}[];
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* "setterThemeSettings" es una función que se encarga de persistir en local storage los cambios de los settings
|
|
27
|
+
* Solo se instancia cuando esta en host, cuando esta storybook no se instancia
|
|
28
|
+
*/
|
|
29
|
+
setterThemeSettings?: (newValue: ThemeSettingsType) => void;
|
|
26
30
|
open: boolean;
|
|
27
31
|
}
|
|
28
32
|
export declare type DefaultThemeSettingsStoreProps = ThemeSettingsStore;
|
|
@@ -37,8 +41,7 @@ export interface ThemeSettingsStateWithActions extends ThemeSettingsStore {
|
|
|
37
41
|
onChangeColor: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
38
42
|
onChangeLayout: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
39
43
|
handleOpen: () => void;
|
|
40
|
-
|
|
41
|
-
setSettings: (newValue: any) => void;
|
|
44
|
+
setThemeSettings: (newValue: Partial<ThemeSettingsType>) => void;
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
47
|
export declare type ThemeSettingsProviderProps = {
|
|
@@ -0,0 +1,276 @@
|
|
|
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 E } from "../node_modules.7cdb697c.js";
|
|
3
|
+
import { jsx as x } from "react/jsx-runtime";
|
|
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
|
+
import { alpha as I } from "@mui/system";
|
|
7
|
+
import { u as U } from "../hooks/useFirstRender/index.1e9b02fb.js";
|
|
8
|
+
const C = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, K = (r) => {
|
|
9
|
+
const t = {
|
|
10
|
+
...r
|
|
11
|
+
};
|
|
12
|
+
return v(
|
|
13
|
+
R(
|
|
14
|
+
P((o, n) => ({
|
|
15
|
+
...t,
|
|
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
|
+
}, X = f(null), te = (r) => {
|
|
28
|
+
const {
|
|
29
|
+
children: t,
|
|
30
|
+
observedDivRef: o
|
|
31
|
+
} = r, n = T();
|
|
32
|
+
n.current || (n.current = K({
|
|
33
|
+
breakPoint: "md",
|
|
34
|
+
isUpSm: !1,
|
|
35
|
+
isXs: !1
|
|
36
|
+
}));
|
|
37
|
+
const e = () => {
|
|
38
|
+
const s = o;
|
|
39
|
+
if (s instanceof HTMLElement && s.clientWidth) {
|
|
40
|
+
const a = Object.keys(C);
|
|
41
|
+
for (let l = 0; l < a.length; l++) {
|
|
42
|
+
const g = a[l];
|
|
43
|
+
if (s.clientWidth <= C[g]) {
|
|
44
|
+
n.current?.getState().responsiveContainerActions.setBreakpoint(g);
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}, i = k(() => E.exports.throttle(e, 200, {
|
|
50
|
+
leading: !1,
|
|
51
|
+
trailing: !0
|
|
52
|
+
}), [e]);
|
|
53
|
+
return y(() => {
|
|
54
|
+
const s = () => {
|
|
55
|
+
i();
|
|
56
|
+
}, a = o;
|
|
57
|
+
if (a && a instanceof Element) {
|
|
58
|
+
const l = new ResizeObserver((g) => {
|
|
59
|
+
s();
|
|
60
|
+
});
|
|
61
|
+
return l.observe(a), () => {
|
|
62
|
+
l.disconnect();
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
}, [o]), /* @__PURE__ */ x(X.Provider, {
|
|
66
|
+
value: n.current,
|
|
67
|
+
children: t
|
|
68
|
+
});
|
|
69
|
+
}, u = {
|
|
70
|
+
themeMode: "light",
|
|
71
|
+
themeDirection: "ltr",
|
|
72
|
+
themeColorPresets: "patronus",
|
|
73
|
+
themeLayout: "horizontal",
|
|
74
|
+
themeStretch: !1
|
|
75
|
+
};
|
|
76
|
+
function O(r, t = "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((n) => {
|
|
83
|
+
const e = r[n];
|
|
84
|
+
if (typeof e == "string" || typeof e == "number") {
|
|
85
|
+
const i = `--${t}-${n}`;
|
|
86
|
+
o.style.setProperty(i, e.toString());
|
|
87
|
+
} else
|
|
88
|
+
typeof e == "object" && e !== null && O(e, `${t}-${n}`);
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const c = (r) => {
|
|
92
|
+
const t = r.currentThemeSettings || u;
|
|
93
|
+
console.log("getColorPresets", m(t.themeColorPresets)), console.log(
|
|
94
|
+
"getColorState",
|
|
95
|
+
d(t.themeColorPresets, t.themeMode)
|
|
96
|
+
);
|
|
97
|
+
const o = t.themeMode === "light";
|
|
98
|
+
r.themeOptions = {
|
|
99
|
+
...r.themeOptions,
|
|
100
|
+
typography: L,
|
|
101
|
+
palette: {
|
|
102
|
+
...r.themeOptions.palette,
|
|
103
|
+
...o ? S.light : S.dark,
|
|
104
|
+
primary: m(t.themeColorPresets),
|
|
105
|
+
state: d(t.themeColorPresets, t.themeMode),
|
|
106
|
+
representative: t.themeMode === "light" ? m(t.themeColorPresets)?.light : m(t.themeColorPresets)?.darker,
|
|
107
|
+
secondary: {
|
|
108
|
+
...A,
|
|
109
|
+
contrastText: "",
|
|
110
|
+
mainChannel: "",
|
|
111
|
+
lightChannel: "",
|
|
112
|
+
darkChannel: "",
|
|
113
|
+
contrastTextChannel: ""
|
|
114
|
+
},
|
|
115
|
+
common: {
|
|
116
|
+
...N,
|
|
117
|
+
black: "#000",
|
|
118
|
+
white: "#fff",
|
|
119
|
+
background: "",
|
|
120
|
+
backgroundChannel: "",
|
|
121
|
+
onBackground: "",
|
|
122
|
+
onBackgroundChannel: ""
|
|
123
|
+
},
|
|
124
|
+
error: {
|
|
125
|
+
...D,
|
|
126
|
+
contrastText: "",
|
|
127
|
+
mainChannel: "",
|
|
128
|
+
lightChannel: "",
|
|
129
|
+
darkChannel: "",
|
|
130
|
+
contrastTextChannel: ""
|
|
131
|
+
},
|
|
132
|
+
warning: {
|
|
133
|
+
...z,
|
|
134
|
+
contrastText: "",
|
|
135
|
+
mainChannel: "",
|
|
136
|
+
lightChannel: "",
|
|
137
|
+
darkChannel: "",
|
|
138
|
+
contrastTextChannel: ""
|
|
139
|
+
},
|
|
140
|
+
info: {
|
|
141
|
+
...B,
|
|
142
|
+
contrastText: "",
|
|
143
|
+
mainChannel: "",
|
|
144
|
+
lightChannel: "",
|
|
145
|
+
darkChannel: "",
|
|
146
|
+
contrastTextChannel: ""
|
|
147
|
+
},
|
|
148
|
+
success: {
|
|
149
|
+
...$,
|
|
150
|
+
contrastText: "",
|
|
151
|
+
mainChannel: "",
|
|
152
|
+
lightChannel: "",
|
|
153
|
+
darkChannel: "",
|
|
154
|
+
contrastTextChannel: ""
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
shape: { borderRadius: 8 },
|
|
158
|
+
direction: t.themeDirection,
|
|
159
|
+
shadows: o ? p.light : p.dark,
|
|
160
|
+
customShadows: {
|
|
161
|
+
primary: `0 8px 16px 0 ${I(
|
|
162
|
+
m(t.themeColorPresets)?.main || "#fff",
|
|
163
|
+
0.2
|
|
164
|
+
)}`,
|
|
165
|
+
...j(t.themeMode)
|
|
166
|
+
},
|
|
167
|
+
stretch: t.themeStretch
|
|
168
|
+
}, console.log("state.themeOptions", r.themeOptions), O(r.themeOptions);
|
|
169
|
+
}, h = (r) => {
|
|
170
|
+
r.setterThemeSettings && r.setterThemeSettings(r.currentThemeSettings);
|
|
171
|
+
}, q = (r) => v(
|
|
172
|
+
R(
|
|
173
|
+
P((t, o) => ({
|
|
174
|
+
...r,
|
|
175
|
+
settingsActions: {
|
|
176
|
+
init: () => {
|
|
177
|
+
t((n) => {
|
|
178
|
+
c(n);
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
setThemeSettings: (n) => {
|
|
182
|
+
t((e) => {
|
|
183
|
+
e.currentThemeSettings = { ...e.currentThemeSettings, ...n }, h(e), c(e);
|
|
184
|
+
});
|
|
185
|
+
},
|
|
186
|
+
onChangeMode: (n) => {
|
|
187
|
+
t((e) => {
|
|
188
|
+
e.currentThemeSettings = {
|
|
189
|
+
...e.currentThemeSettings,
|
|
190
|
+
themeMode: n.target.value
|
|
191
|
+
}, h(e), c(e);
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
handleOpen: () => {
|
|
195
|
+
t((n) => {
|
|
196
|
+
n.open = !n.open;
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
onChangeDirection: (n) => {
|
|
200
|
+
t((e) => {
|
|
201
|
+
e.currentThemeSettings = {
|
|
202
|
+
...e.currentThemeSettings,
|
|
203
|
+
themeDirection: n.target.value
|
|
204
|
+
}, h(e), c(e);
|
|
205
|
+
});
|
|
206
|
+
},
|
|
207
|
+
onChangeColor: (n) => {
|
|
208
|
+
t((e) => {
|
|
209
|
+
e.currentThemeSettings = {
|
|
210
|
+
...e.currentThemeSettings,
|
|
211
|
+
themeColorPresets: n.target.value
|
|
212
|
+
}, h(e), c(e);
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
onChangeLayout: (n) => {
|
|
216
|
+
t((e) => {
|
|
217
|
+
e.currentThemeSettings = {
|
|
218
|
+
...e.currentThemeSettings,
|
|
219
|
+
themeLayout: n.target.value
|
|
220
|
+
}, h(e), c(e);
|
|
221
|
+
});
|
|
222
|
+
},
|
|
223
|
+
onToggleStretch: () => {
|
|
224
|
+
t((n) => {
|
|
225
|
+
n.currentThemeSettings = {
|
|
226
|
+
...n.currentThemeSettings,
|
|
227
|
+
themeStretch: !n.currentThemeSettings.themeStretch
|
|
228
|
+
}, h(n), c(n);
|
|
229
|
+
});
|
|
230
|
+
},
|
|
231
|
+
onResetSetting: () => {
|
|
232
|
+
t((n) => {
|
|
233
|
+
n.currentThemeSettings = {
|
|
234
|
+
...u
|
|
235
|
+
}, h(n), c(n);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
})),
|
|
240
|
+
{ name: "ExampleStore" }
|
|
241
|
+
)
|
|
242
|
+
), G = f(null);
|
|
243
|
+
function ne({
|
|
244
|
+
children: r,
|
|
245
|
+
themeSettings: t
|
|
246
|
+
}) {
|
|
247
|
+
const {
|
|
248
|
+
networkOperation: o
|
|
249
|
+
} = M(), [n, e] = w("theme_setting", u), i = U([t]), s = T();
|
|
250
|
+
return s.current || (s.current = q({
|
|
251
|
+
networkOperation: o,
|
|
252
|
+
currentThemeSettings: {
|
|
253
|
+
...t ?? n
|
|
254
|
+
},
|
|
255
|
+
themeOptions: W,
|
|
256
|
+
currentPreset: _,
|
|
257
|
+
colorOption: F.map((a) => ({
|
|
258
|
+
name: a.name,
|
|
259
|
+
value: a.main
|
|
260
|
+
})),
|
|
261
|
+
open: !1,
|
|
262
|
+
setterThemeSettings: t ? void 0 : e
|
|
263
|
+
}), s.current.getState().settingsActions.init()), b(() => {
|
|
264
|
+
!i && s.current && t && s.current.getState().settingsActions.setThemeSettings(t);
|
|
265
|
+
}, [t]), /* @__PURE__ */ x(G.Provider, {
|
|
266
|
+
value: s.current,
|
|
267
|
+
children: r
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
export {
|
|
271
|
+
X as R,
|
|
272
|
+
G as T,
|
|
273
|
+
te as a,
|
|
274
|
+
ne as b,
|
|
275
|
+
u as d
|
|
276
|
+
};
|
package/contexts/index.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ export type { BreakpointType } from './ResponsiveContainerContext/types';
|
|
|
6
6
|
export type { NetworkLocaleType, LocaleType } from './LocalesContext/types';
|
|
7
7
|
export { getLocaleFromNetwork } from './LocalesContext/helper';
|
|
8
8
|
export * from './HostThemeContext';
|
|
9
|
-
export * from './ThemeSettingsContext
|
|
9
|
+
export * from './ThemeSettingsContext';
|
|
10
10
|
export type { HostThemeType } from './HostThemeContext/types';
|
|
@@ -0,0 +1,54 @@
|
|
|
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.02e36f38.js";
|
|
3
|
+
import { u as a } from "../node_modules.7cdb697c.js";
|
|
4
|
+
import { T as l } from "../contexts/index.955e2da6.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)
|
|
25
|
+
throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
26
|
+
return e;
|
|
27
|
+
};
|
|
28
|
+
function b(e) {
|
|
29
|
+
const s = n(null);
|
|
30
|
+
return c(() => {
|
|
31
|
+
const t = s?.current;
|
|
32
|
+
if (!t)
|
|
33
|
+
return;
|
|
34
|
+
const o = new ResizeObserver((f) => {
|
|
35
|
+
e(t, f[0]);
|
|
36
|
+
});
|
|
37
|
+
return o.observe(t), () => {
|
|
38
|
+
o.disconnect();
|
|
39
|
+
};
|
|
40
|
+
}, [e, s.current]), s;
|
|
41
|
+
}
|
|
42
|
+
function g(e, s) {
|
|
43
|
+
const t = u(l);
|
|
44
|
+
if (!t)
|
|
45
|
+
throw new Error("useSettingsStore context must be use inside SettignsContext");
|
|
46
|
+
return a(t, e, s);
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
x as a,
|
|
50
|
+
h as b,
|
|
51
|
+
b as c,
|
|
52
|
+
g as d,
|
|
53
|
+
S as u
|
|
54
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState as n, useEffect as o } from "react";
|
|
2
|
-
import { t as s } from "../../node_modules.
|
|
2
|
+
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(() => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext as t } from "react";
|
|
2
|
-
import { u as r } from "../../node_modules.
|
|
3
|
-
import { R as n } from "../../contexts/index.
|
|
2
|
+
import { u as r } from "../../node_modules.7cdb697c.js";
|
|
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,51 +1,52 @@
|
|
|
1
|
-
import { G as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { R as F, a as P, T as b, b as L } from "./contexts/index.
|
|
5
|
-
import { H as
|
|
6
|
-
import { u as
|
|
7
|
-
import { u as
|
|
8
|
-
import { b as
|
|
9
|
-
import { u as
|
|
10
|
-
import { u as
|
|
11
|
-
import { u as
|
|
12
|
-
import { C as
|
|
1
|
+
import { G as l } from "./components/GlobalStyle/index.b7393a44.js";
|
|
2
|
+
import { L as C, a as T, g } from "./contexts/LocalesContext/index.53f0b702.js";
|
|
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.955e2da6.js";
|
|
5
|
+
import { H as w, a as z } from "./contexts/HostThemeContext/index.02e36f38.js";
|
|
6
|
+
import { u as I } from "./hooks/useFirstRender/index.1e9b02fb.js";
|
|
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.91cf59db.js";
|
|
9
|
+
import { u as q } from "./hooks/useLocales/index.d5a80aff.js";
|
|
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
|
+
import { C as X, g as Y } from "./utils/index.6909c662.js";
|
|
13
13
|
import "@mui/material/styles";
|
|
14
14
|
import "@mui/material";
|
|
15
15
|
import "@m4l/styles";
|
|
16
16
|
import "react/jsx-runtime";
|
|
17
17
|
import "react";
|
|
18
|
-
import "@m4l/core";
|
|
19
18
|
import "@mui/x-date-pickers/AdapterDateFns";
|
|
20
19
|
import "@mui/x-date-pickers";
|
|
20
|
+
import "@m4l/core";
|
|
21
21
|
import "date-fns/locale/en-US";
|
|
22
|
-
import "./node_modules.
|
|
22
|
+
import "./node_modules.7cdb697c.js";
|
|
23
23
|
import "./commonjs.e3daa2e5.js";
|
|
24
24
|
import "@mui/system";
|
|
25
25
|
export {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
X as Capitalize,
|
|
27
|
+
R as FormatterContext,
|
|
28
|
+
S as FormatterProvider,
|
|
29
|
+
l as GlobalStyles,
|
|
30
|
+
w as HostThemeContext,
|
|
31
|
+
z as HostThemeProvider,
|
|
32
|
+
C as LocalesContext,
|
|
33
|
+
T as LocalesProvider,
|
|
34
34
|
F as ResponsiveContainerContext,
|
|
35
35
|
P as ResponsiveContainerProvider,
|
|
36
36
|
b as ThemeSettingsContext,
|
|
37
37
|
L as ThemeSettingsProvider,
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
E as
|
|
48
|
-
|
|
49
|
-
J as
|
|
50
|
-
|
|
38
|
+
H as defaultThemeSettings,
|
|
39
|
+
Y as getAnchorElPositionWindow,
|
|
40
|
+
g as getLocaleFromNetwork,
|
|
41
|
+
I as useFirstRender,
|
|
42
|
+
O as useFormatter,
|
|
43
|
+
A as useHostTheme,
|
|
44
|
+
U as useIsMobile,
|
|
45
|
+
D as useIsMountedRef,
|
|
46
|
+
q as useLocales,
|
|
47
|
+
E as useOffSetTop,
|
|
48
|
+
N as useResizeObserver,
|
|
49
|
+
J as useResponsiveContainerStore,
|
|
50
|
+
K as useResponsiveDesktop,
|
|
51
|
+
W as useThemeSettingsStore
|
|
51
52
|
};
|
package/package.json
CHANGED
package/vite-env.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { createContext as c, useMemo as a } from "react";
|
|
2
|
-
import { CssBaseline as h } from "@mui/material";
|
|
3
|
-
import { G as d } from "../../components/GlobalStyle/index.b7393a44.js";
|
|
4
|
-
import { createTheme as p, experimental_extendTheme as f, Experimental_CssVarsProvider as x, StyledEngineProvider as T } from "@mui/material/styles";
|
|
5
|
-
import { jsxs as m, jsx as o } from "react/jsx-runtime";
|
|
6
|
-
const u = c(null);
|
|
7
|
-
function j(i) {
|
|
8
|
-
const {
|
|
9
|
-
children: l,
|
|
10
|
-
hostThemeOptions: t,
|
|
11
|
-
fnComponentsOverrides: n
|
|
12
|
-
} = i, e = p({
|
|
13
|
-
...t
|
|
14
|
-
}), s = a(() => {
|
|
15
|
-
const r = f({
|
|
16
|
-
cssVarPrefix: "m4l",
|
|
17
|
-
colorSchemes: {
|
|
18
|
-
light: e,
|
|
19
|
-
finalTheme: e,
|
|
20
|
-
dark: e
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return r.components = n(r), r;
|
|
24
|
-
}, []);
|
|
25
|
-
return console.log("finalTheme", s), /* @__PURE__ */ m(x, {
|
|
26
|
-
theme: s,
|
|
27
|
-
children: [/* @__PURE__ */ o(d, {}), /* @__PURE__ */ o(u.Provider, {
|
|
28
|
-
value: {
|
|
29
|
-
hostThemeOptions: t,
|
|
30
|
-
fnComponentsOverrides: n
|
|
31
|
-
},
|
|
32
|
-
children: /* @__PURE__ */ m(T, {
|
|
33
|
-
injectFirst: !0,
|
|
34
|
-
children: [/* @__PURE__ */ o(h, {
|
|
35
|
-
enableColorScheme: !0
|
|
36
|
-
}), l]
|
|
37
|
-
})
|
|
38
|
-
})]
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
export {
|
|
42
|
-
u as H,
|
|
43
|
-
j as a
|
|
44
|
-
};
|
|
@@ -1,283 +0,0 @@
|
|
|
1
|
-
import "./FormatterContext/index.92336f4c.js";
|
|
2
|
-
import "./LocalesContext/index.53f0b702.js";
|
|
3
|
-
import { createContext as T, useRef as v, useMemo as y, useLayoutEffect as b } from "react";
|
|
4
|
-
import { c as O, d as P, i as R, l as M } from "../node_modules.9eeccca4.js";
|
|
5
|
-
import { jsx as x } from "react/jsx-runtime";
|
|
6
|
-
import "date-fns/locale/en-US";
|
|
7
|
-
import "./HostThemeContext/index.f53d14b8.js";
|
|
8
|
-
import { useNetwork as E, useLocalStorageWithListener as w } from "@m4l/core";
|
|
9
|
-
import { getColorPresets as m, getColorState as p, typography as L, palette as d, SECONDARY as N, COMMON as A, ERROR as D, WARNING as z, INFO as B, SUCCESS as $, shadows as S, createCustomShadows as j, defaultThemeOptions as C, defaultPreset as W, colorPresets as _ } from "@m4l/styles";
|
|
10
|
-
import { alpha as I } from "@mui/system";
|
|
11
|
-
const f = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, U = (o) => {
|
|
12
|
-
const n = {
|
|
13
|
-
...o
|
|
14
|
-
};
|
|
15
|
-
return O(
|
|
16
|
-
P(
|
|
17
|
-
R((r, t) => ({
|
|
18
|
-
...n,
|
|
19
|
-
responsiveContainerActions: {
|
|
20
|
-
setBreakpoint: (e) => {
|
|
21
|
-
r((s) => {
|
|
22
|
-
s.breakPoint = e, s.isUpSm = e !== "xs" && e !== "sm", s.isXs = e == "xs";
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
})),
|
|
27
|
-
{ name: "Responsive Relative Store" }
|
|
28
|
-
)
|
|
29
|
-
);
|
|
30
|
-
}, K = T(null), ne = (o) => {
|
|
31
|
-
const {
|
|
32
|
-
children: n,
|
|
33
|
-
observedDivRef: r
|
|
34
|
-
} = o, t = v();
|
|
35
|
-
t.current || (t.current = U({
|
|
36
|
-
breakPoint: "md",
|
|
37
|
-
isUpSm: !1,
|
|
38
|
-
isXs: !1
|
|
39
|
-
}));
|
|
40
|
-
const e = () => {
|
|
41
|
-
const i = r;
|
|
42
|
-
if (i instanceof HTMLElement && i.clientWidth) {
|
|
43
|
-
const l = Object.keys(f);
|
|
44
|
-
for (let c = 0; c < l.length; c++) {
|
|
45
|
-
const g = l[c];
|
|
46
|
-
if (i.clientWidth <= f[g]) {
|
|
47
|
-
t.current?.getState().responsiveContainerActions.setBreakpoint(g);
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, s = y(() => M.exports.throttle(e, 200, {
|
|
53
|
-
leading: !1,
|
|
54
|
-
trailing: !0
|
|
55
|
-
}), [e]);
|
|
56
|
-
return b(() => {
|
|
57
|
-
const i = () => {
|
|
58
|
-
s();
|
|
59
|
-
}, l = r;
|
|
60
|
-
if (l && l instanceof Element) {
|
|
61
|
-
const c = new ResizeObserver((g) => {
|
|
62
|
-
i();
|
|
63
|
-
});
|
|
64
|
-
return c.observe(l), () => {
|
|
65
|
-
c.disconnect();
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
}, [r]), /* @__PURE__ */ x(K.Provider, {
|
|
69
|
-
value: t.current,
|
|
70
|
-
children: n
|
|
71
|
-
});
|
|
72
|
-
}, u = {
|
|
73
|
-
themeMode: "light",
|
|
74
|
-
themeDirection: "ltr",
|
|
75
|
-
themeColorPresets: "patronus",
|
|
76
|
-
themeStretch: !1,
|
|
77
|
-
themeLayout: "horizontal"
|
|
78
|
-
};
|
|
79
|
-
function k(o, n = "m4l") {
|
|
80
|
-
const r = document.querySelector('[data-mui-color-scheme="light"]');
|
|
81
|
-
if (!r) {
|
|
82
|
-
console.error('Element with data-mui-color-scheme="light" not found.');
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
Object.keys(o).forEach((t) => {
|
|
86
|
-
const e = o[t];
|
|
87
|
-
if (typeof e == "string" || typeof e == "number") {
|
|
88
|
-
const s = `--${n}-${t}`;
|
|
89
|
-
r.style.setProperty(s, e.toString());
|
|
90
|
-
} else
|
|
91
|
-
typeof e == "object" && e !== null && k(e, `${n}-${t}`);
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
const h = (o) => {
|
|
95
|
-
const n = o.currentThemeSettings || u;
|
|
96
|
-
console.log("getColorPresets", m(n.themeColorPresets)), console.log(
|
|
97
|
-
"getColorState",
|
|
98
|
-
p(n.themeColorPresets, n.themeMode)
|
|
99
|
-
);
|
|
100
|
-
const r = n.themeMode === "light";
|
|
101
|
-
o.themeOptions = {
|
|
102
|
-
...o.themeOptions,
|
|
103
|
-
typography: L,
|
|
104
|
-
palette: {
|
|
105
|
-
...o.themeOptions.palette,
|
|
106
|
-
...r ? d.light : d.dark,
|
|
107
|
-
primary: m(n.themeColorPresets),
|
|
108
|
-
state: p(n.themeColorPresets, n.themeMode),
|
|
109
|
-
representative: n.themeMode === "light" ? m(n.themeColorPresets)?.light : m(n.themeColorPresets)?.darker,
|
|
110
|
-
secondary: {
|
|
111
|
-
...N,
|
|
112
|
-
contrastText: "",
|
|
113
|
-
mainChannel: "",
|
|
114
|
-
lightChannel: "",
|
|
115
|
-
darkChannel: "",
|
|
116
|
-
contrastTextChannel: ""
|
|
117
|
-
},
|
|
118
|
-
common: {
|
|
119
|
-
...A,
|
|
120
|
-
black: "#000",
|
|
121
|
-
white: "#fff",
|
|
122
|
-
background: "",
|
|
123
|
-
backgroundChannel: "",
|
|
124
|
-
onBackground: "",
|
|
125
|
-
onBackgroundChannel: ""
|
|
126
|
-
},
|
|
127
|
-
error: {
|
|
128
|
-
...D,
|
|
129
|
-
contrastText: "",
|
|
130
|
-
mainChannel: "",
|
|
131
|
-
lightChannel: "",
|
|
132
|
-
darkChannel: "",
|
|
133
|
-
contrastTextChannel: ""
|
|
134
|
-
},
|
|
135
|
-
warning: {
|
|
136
|
-
...z,
|
|
137
|
-
contrastText: "",
|
|
138
|
-
mainChannel: "",
|
|
139
|
-
lightChannel: "",
|
|
140
|
-
darkChannel: "",
|
|
141
|
-
contrastTextChannel: ""
|
|
142
|
-
},
|
|
143
|
-
info: {
|
|
144
|
-
...B,
|
|
145
|
-
contrastText: "",
|
|
146
|
-
mainChannel: "",
|
|
147
|
-
lightChannel: "",
|
|
148
|
-
darkChannel: "",
|
|
149
|
-
contrastTextChannel: ""
|
|
150
|
-
},
|
|
151
|
-
success: {
|
|
152
|
-
...$,
|
|
153
|
-
contrastText: "",
|
|
154
|
-
mainChannel: "",
|
|
155
|
-
lightChannel: "",
|
|
156
|
-
darkChannel: "",
|
|
157
|
-
contrastTextChannel: ""
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
shape: { borderRadius: 8 },
|
|
161
|
-
direction: n.themeDirection,
|
|
162
|
-
shadows: r ? S.light : S.dark,
|
|
163
|
-
customShadows: {
|
|
164
|
-
primary: `0 8px 16px 0 ${I(
|
|
165
|
-
m(n.themeColorPresets)?.main || "#fff",
|
|
166
|
-
0.2
|
|
167
|
-
)}`,
|
|
168
|
-
...j(n.themeMode)
|
|
169
|
-
},
|
|
170
|
-
stretch: n.themeStretch
|
|
171
|
-
}, console.log("state.themeOptions", o.themeOptions), k(o.themeOptions);
|
|
172
|
-
}, a = (o) => {
|
|
173
|
-
o.setThemeSettings && o.setThemeSettings(o.currentThemeSettings);
|
|
174
|
-
}, X = (o) => O(
|
|
175
|
-
P(
|
|
176
|
-
R((n, r) => ({
|
|
177
|
-
...o,
|
|
178
|
-
settingsActions: {
|
|
179
|
-
init: () => {
|
|
180
|
-
n((t) => {
|
|
181
|
-
h(t);
|
|
182
|
-
});
|
|
183
|
-
},
|
|
184
|
-
setThemeOptions: (t) => {
|
|
185
|
-
n((e) => {
|
|
186
|
-
e.themeOptions = { ...e.themeOptions, ...t };
|
|
187
|
-
});
|
|
188
|
-
},
|
|
189
|
-
setSettings: (t) => {
|
|
190
|
-
n((e) => {
|
|
191
|
-
e.currentThemeSettings = { ...t }, a(e), h(e);
|
|
192
|
-
});
|
|
193
|
-
},
|
|
194
|
-
onChangeMode: (t) => {
|
|
195
|
-
n((e) => {
|
|
196
|
-
e.currentThemeSettings = {
|
|
197
|
-
...e.currentThemeSettings,
|
|
198
|
-
themeMode: t.target.value
|
|
199
|
-
}, a(e), h(e);
|
|
200
|
-
});
|
|
201
|
-
},
|
|
202
|
-
handleOpen: () => {
|
|
203
|
-
n((t) => {
|
|
204
|
-
t.open = !t.open;
|
|
205
|
-
});
|
|
206
|
-
},
|
|
207
|
-
onChangeDirection: (t) => {
|
|
208
|
-
n((e) => {
|
|
209
|
-
e.currentThemeSettings = {
|
|
210
|
-
...e.currentThemeSettings,
|
|
211
|
-
themeDirection: t.target.value
|
|
212
|
-
}, a(e), h(e);
|
|
213
|
-
});
|
|
214
|
-
},
|
|
215
|
-
onChangeColor: (t) => {
|
|
216
|
-
n((e) => {
|
|
217
|
-
e.currentThemeSettings = {
|
|
218
|
-
...e.currentThemeSettings,
|
|
219
|
-
themeColorPresets: t.target.value
|
|
220
|
-
}, a(e), h(e);
|
|
221
|
-
});
|
|
222
|
-
},
|
|
223
|
-
onChangeLayout: (t) => {
|
|
224
|
-
n((e) => {
|
|
225
|
-
e.currentThemeSettings = {
|
|
226
|
-
...e.currentThemeSettings,
|
|
227
|
-
themeLayout: t.target.value
|
|
228
|
-
}, a(e), h(e);
|
|
229
|
-
});
|
|
230
|
-
},
|
|
231
|
-
onToggleStretch: () => {
|
|
232
|
-
n((t) => {
|
|
233
|
-
t.currentThemeSettings = {
|
|
234
|
-
...t.currentThemeSettings,
|
|
235
|
-
themeStretch: !t.currentThemeSettings.themeStretch
|
|
236
|
-
}, a(t), h(t);
|
|
237
|
-
});
|
|
238
|
-
},
|
|
239
|
-
onResetSetting: () => {
|
|
240
|
-
n((t) => {
|
|
241
|
-
t.currentThemeSettings = {
|
|
242
|
-
...u
|
|
243
|
-
}, a(t), h(t);
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
})),
|
|
248
|
-
{ name: "ExampleStore" }
|
|
249
|
-
)
|
|
250
|
-
), q = T(null);
|
|
251
|
-
function oe({
|
|
252
|
-
children: o,
|
|
253
|
-
themeSettings: n
|
|
254
|
-
}) {
|
|
255
|
-
const {
|
|
256
|
-
networkOperation: r
|
|
257
|
-
} = E(), [t, e] = w("theme_setting", u);
|
|
258
|
-
console.log("defaultThemeOptions", C);
|
|
259
|
-
const s = v();
|
|
260
|
-
return s.current || (s.current = X({
|
|
261
|
-
networkOperation: r,
|
|
262
|
-
currentThemeSettings: {
|
|
263
|
-
...n ?? t
|
|
264
|
-
},
|
|
265
|
-
themeOptions: C,
|
|
266
|
-
currentPreset: W,
|
|
267
|
-
colorOption: _.map((i) => ({
|
|
268
|
-
name: i.name,
|
|
269
|
-
value: i.main
|
|
270
|
-
})),
|
|
271
|
-
open: !1,
|
|
272
|
-
setThemeSettings: n ? void 0 : e
|
|
273
|
-
}), s.current.getState().settingsActions.init()), /* @__PURE__ */ x(q.Provider, {
|
|
274
|
-
value: s.current,
|
|
275
|
-
children: o
|
|
276
|
-
});
|
|
277
|
-
}
|
|
278
|
-
export {
|
|
279
|
-
K as R,
|
|
280
|
-
q as T,
|
|
281
|
-
ne as a,
|
|
282
|
-
oe as b
|
|
283
|
-
};
|
package/hooks/index.315d954d.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { useRef as r, useEffect as n, useState as f, useContext as u, useLayoutEffect as c } from "react";
|
|
2
|
-
import { H as m } from "../contexts/HostThemeContext/index.f53d14b8.js";
|
|
3
|
-
import { u as a } from "../node_modules.9eeccca4.js";
|
|
4
|
-
import { T as p } from "../contexts/index.acf54acf.js";
|
|
5
|
-
import "../contexts/FormatterContext/index.92336f4c.js";
|
|
6
|
-
import "../contexts/LocalesContext/index.53f0b702.js";
|
|
7
|
-
import "@m4l/styles";
|
|
8
|
-
function b() {
|
|
9
|
-
const e = r(!0);
|
|
10
|
-
return n(
|
|
11
|
-
() => () => {
|
|
12
|
-
e.current = !1;
|
|
13
|
-
},
|
|
14
|
-
[]
|
|
15
|
-
), e;
|
|
16
|
-
}
|
|
17
|
-
function g(e) {
|
|
18
|
-
const [o, t] = f(!1), s = e || 100;
|
|
19
|
-
return n(() => (window.onscroll = () => {
|
|
20
|
-
window.pageYOffset > s ? t(!0) : t(!1);
|
|
21
|
-
}, () => {
|
|
22
|
-
window.onscroll = null;
|
|
23
|
-
}), [s]), o;
|
|
24
|
-
}
|
|
25
|
-
const v = () => {
|
|
26
|
-
const e = u(m);
|
|
27
|
-
if (!e)
|
|
28
|
-
throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
29
|
-
return e;
|
|
30
|
-
};
|
|
31
|
-
function H(e) {
|
|
32
|
-
const o = r(null);
|
|
33
|
-
return c(() => {
|
|
34
|
-
const t = o?.current;
|
|
35
|
-
if (!t)
|
|
36
|
-
return;
|
|
37
|
-
const s = new ResizeObserver((i) => {
|
|
38
|
-
e(t, i[0]);
|
|
39
|
-
});
|
|
40
|
-
return s.observe(t), () => {
|
|
41
|
-
s.disconnect();
|
|
42
|
-
};
|
|
43
|
-
}, [e, o.current]), o;
|
|
44
|
-
}
|
|
45
|
-
function O(e, o) {
|
|
46
|
-
const t = u(p);
|
|
47
|
-
if (!t)
|
|
48
|
-
throw new Error("useSettingsStore context must be use inside SettignsContext");
|
|
49
|
-
return a(t, e, o);
|
|
50
|
-
}
|
|
51
|
-
export {
|
|
52
|
-
g as a,
|
|
53
|
-
v as b,
|
|
54
|
-
H as c,
|
|
55
|
-
O as d,
|
|
56
|
-
b as u
|
|
57
|
-
};
|
|
File without changes
|