@m4l/graphics 0.1.42 → 0.1.44
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/GlobalStyle/index.fff91e86.js +63 -0
- package/components/index.8083534b.js +4 -0
- package/contexts/HostThemeContext/{index.a6a62c70.js → index.4291ba89.js} +18 -14
- package/contexts/index.8396304d.js +4 -0
- package/hooks/index.0b942257.js +48 -0
- package/index.js +11 -11
- package/m4l_graphics/src/vite-env.d.ts +1 -0
- package/package.json +1 -1
- package/components/GlobalStyle/index.2c5d07c1.js +0 -46
- package/components/index.d8d41b1b.js +0 -1
- package/contexts/index.ee173661.js +0 -1
- package/hooks/index.6d70bb97.js +0 -45
- /package/{components → m4l_graphics/src/components}/GlobalStyles/index.d.ts +0 -0
- /package/{components → m4l_graphics/src/components}/index.d.ts +0 -0
- /package/{contexts → m4l_graphics/src/contexts}/FormatterContext/index.d.ts +0 -0
- /package/{contexts → m4l_graphics/src/contexts}/FormatterContext/types.d.ts +0 -0
- /package/{contexts → m4l_graphics/src/contexts}/HostThemeContext/index.d.ts +0 -0
- /package/{contexts → m4l_graphics/src/contexts}/HostThemeContext/types.d.ts +0 -0
- /package/{contexts → m4l_graphics/src/contexts}/LocalesContext/helper.d.ts +0 -0
- /package/{contexts → m4l_graphics/src/contexts}/LocalesContext/index.d.ts +0 -0
- /package/{contexts → m4l_graphics/src/contexts}/LocalesContext/types.d.ts +0 -0
- /package/{contexts → m4l_graphics/src/contexts}/index.d.ts +0 -0
- /package/{hooks → m4l_graphics/src/hooks}/index.d.ts +0 -0
- /package/{hooks → m4l_graphics/src/hooks}/useFirstRender/index.d.ts +0 -0
- /package/{hooks → m4l_graphics/src/hooks}/useFormatter/index.d.ts +0 -0
- /package/{hooks → m4l_graphics/src/hooks}/useHostTheme/index.d.ts +0 -0
- /package/{hooks → m4l_graphics/src/hooks}/useIsMountedRef/index.d.ts +0 -0
- /package/{hooks → m4l_graphics/src/hooks}/useLocales/index.d.ts +0 -0
- /package/{hooks → m4l_graphics/src/hooks}/useOffSetTop.d.ts +0 -0
- /package/{hooks → m4l_graphics/src/hooks}/useResizeObserver/index.d.ts +0 -0
- /package/{hooks → m4l_graphics/src/hooks}/useResponsive/index.d.ts +0 -0
- /package/{index.d.ts → m4l_graphics/src/index.d.ts} +0 -0
- /package/{utils → m4l_graphics/src/utils}/anchorEl.d.ts +0 -0
- /package/{utils → m4l_graphics/src/utils}/index.d.ts +0 -0
- /package/{utils → m4l_graphics/src/utils}/strings.d.ts +0 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useTheme as o } from "@mui/material/styles";
|
|
2
|
+
import { GlobalStyles as a } from "@mui/material";
|
|
3
|
+
import { globalRemSize as t } from "@m4l/styles";
|
|
4
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
5
|
+
function s() {
|
|
6
|
+
const r = o();
|
|
7
|
+
return /* @__PURE__ */ e(a, {
|
|
8
|
+
styles: {
|
|
9
|
+
body: {
|
|
10
|
+
backgroundColor: `${r.palette.background.background}!important`,
|
|
11
|
+
"*::-webkit-scrollbar": {
|
|
12
|
+
width: "7px",
|
|
13
|
+
height: "7px",
|
|
14
|
+
borderRadius: "3px",
|
|
15
|
+
backgroundColor: "transparent"
|
|
16
|
+
},
|
|
17
|
+
"*::-webkit-scrollbar-track": {
|
|
18
|
+
backgroundColor: "transparent",
|
|
19
|
+
border: "0px solid transparent"
|
|
20
|
+
},
|
|
21
|
+
"*::-webkit-scrollbar-corner": {
|
|
22
|
+
backgroundColor: "transparent"
|
|
23
|
+
},
|
|
24
|
+
"*::-webkit-scrollbar-thumb": {
|
|
25
|
+
background: r.palette.state.scrollBar,
|
|
26
|
+
borderRadius: "2px!important"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"#nprogress": {
|
|
30
|
+
pointerEvents: "none",
|
|
31
|
+
"& .bar": {
|
|
32
|
+
top: 0,
|
|
33
|
+
left: 0,
|
|
34
|
+
height: 2,
|
|
35
|
+
width: "100%",
|
|
36
|
+
position: "fixed",
|
|
37
|
+
zIndex: r.zIndex.snackbar,
|
|
38
|
+
backgroundColor: r.palette.primary.main,
|
|
39
|
+
boxShadow: `0 0 2px ${r.palette.primary.main}`
|
|
40
|
+
},
|
|
41
|
+
"& .peg": {
|
|
42
|
+
right: 0,
|
|
43
|
+
opacity: 1,
|
|
44
|
+
width: 100,
|
|
45
|
+
height: "100%",
|
|
46
|
+
display: "block",
|
|
47
|
+
position: "absolute",
|
|
48
|
+
transform: "rotate(3deg) translate(0px, -4px)",
|
|
49
|
+
boxShadow: `0 0 10px ${r.palette.primary.main}, 0 0 5px ${r.palette.primary.main}`
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
"& html": {
|
|
53
|
+
fontSize: t.desktop,
|
|
54
|
+
[r.breakpoints.down("sm")]: {
|
|
55
|
+
fontSize: t.mobile
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
export {
|
|
62
|
+
s as G
|
|
63
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext as H, useState as E, useMemo as v, useCallback as M, useEffect as c } from "react";
|
|
2
2
|
import { CssBaseline as C } from "@mui/material";
|
|
3
3
|
import { createTheme as O, StyledEngineProvider as N, ThemeProvider as S } from "@mui/material/styles";
|
|
4
|
-
import { useHostTools as x, EmitEvents as
|
|
4
|
+
import { useHostTools as x, EmitEvents as r } from "@m4l/core";
|
|
5
5
|
import { jsx as n, jsxs as F } from "react/jsx-runtime";
|
|
6
6
|
const I = H(null);
|
|
7
7
|
function b(l) {
|
|
@@ -10,27 +10,31 @@ function b(l) {
|
|
|
10
10
|
hostThemeOptions: t,
|
|
11
11
|
fnComponentsOverrides: i,
|
|
12
12
|
isMicroFrontEnd: s
|
|
13
|
-
} = l, [
|
|
13
|
+
} = l, [o, m] = E(t), {
|
|
14
14
|
events_add_listener: a,
|
|
15
|
-
events_remove_listener:
|
|
16
|
-
events_emit:
|
|
17
|
-
} = x(), [
|
|
18
|
-
const e = O(
|
|
15
|
+
events_remove_listener: u,
|
|
16
|
+
events_emit: _
|
|
17
|
+
} = x(), [f, d] = E(!0), p = v(() => {
|
|
18
|
+
const e = O(o);
|
|
19
19
|
return e.components = i(e), e;
|
|
20
|
-
}, [
|
|
21
|
-
|
|
20
|
+
}, [o]), T = M((e) => {
|
|
21
|
+
setTimeout(() => {
|
|
22
|
+
m(e);
|
|
23
|
+
}, 0);
|
|
22
24
|
}, []);
|
|
23
|
-
return c(() => (s && a(
|
|
24
|
-
s &&
|
|
25
|
+
return c(() => (s && a(r.EMMIT_EVENT_HOST_THEME_CHANGE, T), () => {
|
|
26
|
+
s && u(r.EMMIT_EVENT_HOST_THEME_CHANGE, T);
|
|
25
27
|
}), []), c(() => {
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
+
if (f) {
|
|
29
|
+
d(!1);
|
|
28
30
|
return;
|
|
29
31
|
}
|
|
30
|
-
s || (
|
|
32
|
+
s || (setTimeout(() => {
|
|
33
|
+
m(t);
|
|
34
|
+
}, 0), _(r.EMMIT_EVENT_HOST_THEME_CHANGE, t));
|
|
31
35
|
}, [t]), /* @__PURE__ */ n(I.Provider, {
|
|
32
36
|
value: {
|
|
33
|
-
hostThemeOptions:
|
|
37
|
+
hostThemeOptions: o,
|
|
34
38
|
fnComponentsOverrides: i
|
|
35
39
|
},
|
|
36
40
|
children: /* @__PURE__ */ n(N, {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useRef as r, useEffect as n, useState as f, useContext as i, useLayoutEffect as c } from "react";
|
|
2
|
+
import { H as m } from "../contexts/HostThemeContext/index.4291ba89.js";
|
|
3
|
+
import "../contexts/FormatterContext/index.92336f4c.js";
|
|
4
|
+
import "../contexts/LocalesContext/index.53f0b702.js";
|
|
5
|
+
import "@m4l/styles";
|
|
6
|
+
function T() {
|
|
7
|
+
const e = r(!0);
|
|
8
|
+
return n(
|
|
9
|
+
() => () => {
|
|
10
|
+
e.current = !1;
|
|
11
|
+
},
|
|
12
|
+
[]
|
|
13
|
+
), e;
|
|
14
|
+
}
|
|
15
|
+
function b(e) {
|
|
16
|
+
const [s, t] = f(!1), o = e || 100;
|
|
17
|
+
return n(() => (window.onscroll = () => {
|
|
18
|
+
window.pageYOffset > o ? t(!0) : t(!1);
|
|
19
|
+
}, () => {
|
|
20
|
+
window.onscroll = null;
|
|
21
|
+
}), [o]), s;
|
|
22
|
+
}
|
|
23
|
+
const h = () => {
|
|
24
|
+
const e = i(m);
|
|
25
|
+
if (!e)
|
|
26
|
+
throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
27
|
+
return e;
|
|
28
|
+
};
|
|
29
|
+
function v(e) {
|
|
30
|
+
const s = r(null);
|
|
31
|
+
return c(() => {
|
|
32
|
+
const t = s?.current;
|
|
33
|
+
if (!t)
|
|
34
|
+
return;
|
|
35
|
+
const o = new ResizeObserver((u) => {
|
|
36
|
+
e(t, u[0]);
|
|
37
|
+
});
|
|
38
|
+
return o.observe(t), () => {
|
|
39
|
+
o.disconnect();
|
|
40
|
+
};
|
|
41
|
+
}, [e, s.current]), s;
|
|
42
|
+
}
|
|
43
|
+
export {
|
|
44
|
+
b as a,
|
|
45
|
+
h as b,
|
|
46
|
+
v as c,
|
|
47
|
+
T as u
|
|
48
|
+
};
|
package/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { G as x } from "./components/GlobalStyle/index.
|
|
2
|
-
import {
|
|
3
|
-
import { F as v,
|
|
4
|
-
import { H as g, a as h } from "./contexts/HostThemeContext/index.
|
|
1
|
+
import { G as x } from "./components/GlobalStyle/index.fff91e86.js";
|
|
2
|
+
import { F as n, a as c } from "./contexts/FormatterContext/index.92336f4c.js";
|
|
3
|
+
import { L as F, a as v, g as C } from "./contexts/LocalesContext/index.53f0b702.js";
|
|
4
|
+
import { H as g, a as h } from "./contexts/HostThemeContext/index.4291ba89.js";
|
|
5
5
|
import { u as P } from "./hooks/useFirstRender/index.1e9b02fb.js";
|
|
6
6
|
import { u as T } from "./hooks/useFormatter/index.57ac8cca.js";
|
|
7
|
-
import { b as k, u as w, a as z, c as G } from "./hooks/index.
|
|
7
|
+
import { b as k, u as w, a as z, c as G } from "./hooks/index.0b942257.js";
|
|
8
8
|
import { u as S } from "./hooks/useLocales/index.d5a80aff.js";
|
|
9
9
|
import { u as A } from "./hooks/useResponsive/index.1409e387.js";
|
|
10
10
|
import { C as E, g as I } from "./utils/index.6909c662.js";
|
|
@@ -13,21 +13,21 @@ import "@mui/material";
|
|
|
13
13
|
import "@m4l/styles";
|
|
14
14
|
import "react/jsx-runtime";
|
|
15
15
|
import "react";
|
|
16
|
+
import "@m4l/core";
|
|
16
17
|
import "@mui/x-date-pickers/AdapterDateFns";
|
|
17
18
|
import "@mui/x-date-pickers";
|
|
18
|
-
import "@m4l/core";
|
|
19
19
|
import "date-fns/locale/en-US";
|
|
20
20
|
export {
|
|
21
21
|
E as Capitalize,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
n as FormatterContext,
|
|
23
|
+
c as FormatterProvider,
|
|
24
24
|
x as GlobalStyles,
|
|
25
25
|
g as HostThemeContext,
|
|
26
26
|
h as HostThemeProvider,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
F as LocalesContext,
|
|
28
|
+
v as LocalesProvider,
|
|
29
29
|
I as getAnchorElPositionWindow,
|
|
30
|
-
|
|
30
|
+
C as getLocaleFromNetwork,
|
|
31
31
|
P as useFirstRender,
|
|
32
32
|
T as useFormatter,
|
|
33
33
|
k as useHostTheme,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
package/package.json
CHANGED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { useTheme as e } from "@mui/material/styles";
|
|
2
|
-
import { GlobalStyles as a } from "@mui/material";
|
|
3
|
-
import { globalRemSize as t } from "@m4l/styles";
|
|
4
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
5
|
-
function s() {
|
|
6
|
-
const o = e();
|
|
7
|
-
return console.log("test spacing formula ", o.spacing(1)), /* @__PURE__ */ r(a, {
|
|
8
|
-
styles: {
|
|
9
|
-
body: {
|
|
10
|
-
backgroundColor: `${o.palette.background.background}!important`
|
|
11
|
-
},
|
|
12
|
-
"#nprogress": {
|
|
13
|
-
pointerEvents: "none",
|
|
14
|
-
"& .bar": {
|
|
15
|
-
top: 0,
|
|
16
|
-
left: 0,
|
|
17
|
-
height: 2,
|
|
18
|
-
width: "100%",
|
|
19
|
-
position: "fixed",
|
|
20
|
-
zIndex: o.zIndex.snackbar,
|
|
21
|
-
backgroundColor: o.palette.primary.main,
|
|
22
|
-
boxShadow: `0 0 2px ${o.palette.primary.main}`
|
|
23
|
-
},
|
|
24
|
-
"& .peg": {
|
|
25
|
-
right: 0,
|
|
26
|
-
opacity: 1,
|
|
27
|
-
width: 100,
|
|
28
|
-
height: "100%",
|
|
29
|
-
display: "block",
|
|
30
|
-
position: "absolute",
|
|
31
|
-
transform: "rotate(3deg) translate(0px, -4px)",
|
|
32
|
-
boxShadow: `0 0 10px ${o.palette.primary.main}, 0 0 5px ${o.palette.primary.main}`
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
"& html": {
|
|
36
|
-
fontSize: t.desktop,
|
|
37
|
-
[o.breakpoints.down("sm")]: {
|
|
38
|
-
fontSize: t.mobile
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
export {
|
|
45
|
-
s as G
|
|
46
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
package/hooks/index.6d70bb97.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useRef as n, useEffect as r, useState as f, useContext as c, useLayoutEffect as i } from "react";
|
|
2
|
-
import { H as l } from "../contexts/HostThemeContext/index.a6a62c70.js";
|
|
3
|
-
function w() {
|
|
4
|
-
const e = n(!0);
|
|
5
|
-
return r(
|
|
6
|
-
() => () => {
|
|
7
|
-
e.current = !1;
|
|
8
|
-
},
|
|
9
|
-
[]
|
|
10
|
-
), e;
|
|
11
|
-
}
|
|
12
|
-
function d(e) {
|
|
13
|
-
const [s, t] = f(!1), o = e || 100;
|
|
14
|
-
return r(() => (window.onscroll = () => {
|
|
15
|
-
window.pageYOffset > o ? t(!0) : t(!1);
|
|
16
|
-
}, () => {
|
|
17
|
-
window.onscroll = null;
|
|
18
|
-
}), [o]), s;
|
|
19
|
-
}
|
|
20
|
-
const p = () => {
|
|
21
|
-
const e = c(l);
|
|
22
|
-
if (!e)
|
|
23
|
-
throw new Error("useHostTheme context must be use inside HostThemeProvider");
|
|
24
|
-
return e;
|
|
25
|
-
};
|
|
26
|
-
function T(e) {
|
|
27
|
-
const s = n(null);
|
|
28
|
-
return i(() => {
|
|
29
|
-
const t = s?.current;
|
|
30
|
-
if (!t)
|
|
31
|
-
return;
|
|
32
|
-
const o = new ResizeObserver((u) => {
|
|
33
|
-
e(t, u[0]);
|
|
34
|
-
});
|
|
35
|
-
return o.observe(t), () => {
|
|
36
|
-
o.disconnect();
|
|
37
|
-
};
|
|
38
|
-
}, [e, s.current]), s;
|
|
39
|
-
}
|
|
40
|
-
export {
|
|
41
|
-
d as a,
|
|
42
|
-
p as b,
|
|
43
|
-
T as c,
|
|
44
|
-
w as u
|
|
45
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|