@m4l/graphics 1.0.5 → 1.0.7

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.
@@ -1,17 +1,17 @@
1
- import { useTheme as e } from "@mui/material/styles";
2
- import { GlobalStyles as o } from "@mui/material";
1
+ import { useTheme as o } from "@mui/material/styles";
2
+ import { GlobalStyles as e } from "@mui/material";
3
3
  import { globalRemSize as r } from "@m4l/styles";
4
4
  import { jsx as a } from "react/jsx-runtime";
5
5
  function s() {
6
- const t = e();
7
- return /* @__PURE__ */ a(o, {
6
+ const t = o();
7
+ return /* @__PURE__ */ a(e, {
8
8
  styles: {
9
9
  body: {
10
10
  textRendering: "geometricPrecision",
11
11
  width: "100%",
12
12
  height: "100vh",
13
13
  "input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus, input:-webkit-autofill:active": {
14
- textFillColor: t.vars.palette.text.primary
14
+ color: t.vars.palette.text.primary
15
15
  },
16
16
  "*::-webkit-scrollbar": {
17
17
  width: "7px",
@@ -1,6 +1,6 @@
1
1
  import { createContext as c, useMemo as a } from "react";
2
2
  import { CssBaseline as h } from "@mui/material";
3
- import { G as d } from "../../components/GlobalStyle/index.f7e6732c.js";
3
+ import { G as d } from "../../components/GlobalStyle/index.b7393a44.js";
4
4
  import { createTheme as p, experimental_extendTheme as f, Experimental_CssVarsProvider as x, StyledEngineProvider as T } from "@mui/material/styles";
5
5
  import { jsxs as m, jsx as o } from "react/jsx-runtime";
6
6
  const u = c(null);
@@ -1,2 +1,2 @@
1
- import { BreakPointsType } from "./types";
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 interface InitialResponsiveContainerProps extends Pick<ResponsiveContainerState, 'breakPoint' | 'isUpSm' | 'isXs'> {
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;
@@ -0,0 +1,73 @@
1
+ import "./FormatterContext/index.92336f4c.js";
2
+ import "./LocalesContext/index.53f0b702.js";
3
+ import { createContext as p, useRef as v, useMemo as f, useLayoutEffect as d } from "react";
4
+ import { c as R, d as u, i as x, l as h } from "../node_modules.9eeccca4.js";
5
+ import { jsx as S } from "react/jsx-runtime";
6
+ import "date-fns/locale/en-US";
7
+ import "./HostThemeContext/index.f53d14b8.js";
8
+ const m = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, b = (c) => {
9
+ const a = {
10
+ ...c
11
+ };
12
+ return R(
13
+ u(
14
+ x((o, n) => ({
15
+ ...a,
16
+ responsiveContainerActions: {
17
+ setBreakpoint: (e) => {
18
+ o((r) => {
19
+ r.breakPoint = e, r.isUpSm = e !== "xs" && e !== "sm", r.isXs = e == "xs";
20
+ });
21
+ }
22
+ }
23
+ })),
24
+ { name: "Responsive Relative Store" }
25
+ )
26
+ );
27
+ }, C = p(null), B = (c) => {
28
+ const {
29
+ children: a,
30
+ observedDivRef: o
31
+ } = c, n = v();
32
+ n.current || (n.current = b({
33
+ breakPoint: "md",
34
+ isUpSm: !1,
35
+ isXs: !1
36
+ }));
37
+ const e = () => {
38
+ const i = o;
39
+ if (i instanceof HTMLElement && i.clientWidth) {
40
+ const t = Object.keys(m);
41
+ for (let s = 0; s < t.length; s++) {
42
+ const l = t[s];
43
+ if (i.clientWidth <= m[l]) {
44
+ n.current?.getState().responsiveContainerActions.setBreakpoint(l);
45
+ break;
46
+ }
47
+ }
48
+ }
49
+ }, r = f(() => h.exports.throttle(e, 200, {
50
+ leading: !1,
51
+ trailing: !0
52
+ }), [e]);
53
+ return d(() => {
54
+ const i = () => {
55
+ r();
56
+ }, t = o;
57
+ if (t && t instanceof Element) {
58
+ const s = new ResizeObserver((l) => {
59
+ i();
60
+ });
61
+ return s.observe(t), () => {
62
+ s.disconnect();
63
+ };
64
+ }
65
+ }, [o]), /* @__PURE__ */ S(C.Provider, {
66
+ value: n.current,
67
+ children: a
68
+ });
69
+ };
70
+ export {
71
+ C as R,
72
+ B as a
73
+ };
@@ -1,8 +1,8 @@
1
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.ba9af8f2.js";
2
+ import { H as m } from "../contexts/HostThemeContext/index.f53d14b8.js";
3
3
  import "../contexts/FormatterContext/index.92336f4c.js";
4
4
  import "../contexts/LocalesContext/index.53f0b702.js";
5
- import "../contexts/index.ec84697f.js";
5
+ import "../contexts/index.68603471.js";
6
6
  import "../node_modules.9eeccca4.js";
7
7
  import "@m4l/styles";
8
8
  function h() {
@@ -3,9 +3,15 @@ import { t as s } from "../../node_modules.9eeccca4.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
- r(t());
8
- }, 200);
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.9eeccca4.js";
3
- import { R as n } from "../../contexts/index.ec84697f.js";
3
+ import { R as n } from "../../contexts/index.68603471.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
- import { G as l } from "./components/GlobalStyle/index.f7e6732c.js";
1
+ import { G as l } from "./components/GlobalStyle/index.b7393a44.js";
2
2
  import { F as C, a as R } from "./contexts/FormatterContext/index.92336f4c.js";
3
3
  import { L as c, a as F, g as L } from "./contexts/LocalesContext/index.53f0b702.js";
4
- import { R as b, a as g } from "./contexts/index.ec84697f.js";
5
- import { H, a as T } from "./contexts/HostThemeContext/index.ba9af8f2.js";
4
+ import { R as b, a as g } from "./contexts/index.68603471.js";
5
+ import { H, a as T } from "./contexts/HostThemeContext/index.f53d14b8.js";
6
6
  import { u as k } from "./hooks/useFirstRender/index.1e9b02fb.js";
7
7
  import { u as z } from "./hooks/useFormatter/index.57ac8cca.js";
8
- import { b as I, u as M, a as O, c as y } from "./hooks/index.587e1f34.js";
8
+ import { b as I, u as M, a as O, c as y } from "./hooks/index.eebf9e43.js";
9
9
  import { u as D } from "./hooks/useLocales/index.d5a80aff.js";
10
- import { u as N, a as W } from "./hooks/useResponsive/index.417449f3.js";
11
- import { u as q } from "./hooks/useIsMobile/index.3de7c47a.js";
10
+ import { u as N, a as W } from "./hooks/useResponsive/index.b336bec4.js";
11
+ import { u as q } from "./hooks/useIsMobile/index.e9f29b1d.js";
12
12
  import { C as J, g as K } from "./utils/index.6909c662.js";
13
13
  import "@mui/material/styles";
14
14
  import "@mui/material";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team*",
6
6
  "dependencies": {
@@ -1,76 +0,0 @@
1
- import "./FormatterContext/index.92336f4c.js";
2
- import "./LocalesContext/index.53f0b702.js";
3
- import { createContext as d, useRef as p, useMemo as v, useLayoutEffect as f } from "react";
4
- import { c as u, d as R, i as g, l as h } 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.ba9af8f2.js";
8
- const m = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, S = (c) => {
9
- const a = {
10
- ...c
11
- };
12
- return u(
13
- R(
14
- g((r, t) => ({
15
- ...a,
16
- responsiveContainerActions: {
17
- setBreakpoint: (e) => {
18
- r(
19
- (i) => {
20
- console.log("current breakpoint", e), i.breakPoint = e, i.isUpSm = e !== "xs" && e !== "sm", i.isXs = e == "xs";
21
- }
22
- );
23
- }
24
- }
25
- })),
26
- { name: "Responsive Relative Store" }
27
- )
28
- );
29
- }, b = d(null), A = (c) => {
30
- const {
31
- children: a,
32
- observedDivRef: r
33
- } = c, t = p();
34
- t.current || (t.current = S({
35
- breakPoint: "md",
36
- isUpSm: !1,
37
- isXs: !1
38
- }));
39
- const e = () => {
40
- const o = r;
41
- if (o instanceof HTMLElement && o.clientWidth) {
42
- const s = Object.keys(m);
43
- for (let n = 0; n < s.length; n++) {
44
- const l = s[n];
45
- if (o.clientWidth <= m[l]) {
46
- t.current?.getState().responsiveContainerActions.setBreakpoint(l);
47
- break;
48
- }
49
- }
50
- console.log("node.clientWidth", o.clientWidth), console.log("onResizeMemo", t.current?.getState().breakPoint);
51
- }
52
- }, i = v(() => h.exports.throttle(e, 200, {
53
- leading: !1,
54
- trailing: !0
55
- }), [e]);
56
- return f(() => {
57
- const o = () => {
58
- i();
59
- }, s = r;
60
- if (s && s instanceof Element) {
61
- const n = new ResizeObserver((l) => {
62
- o();
63
- });
64
- return n.observe(s), () => {
65
- n.disconnect();
66
- };
67
- }
68
- }, [r]), /* @__PURE__ */ x(b.Provider, {
69
- value: t.current,
70
- children: a
71
- });
72
- };
73
- export {
74
- b as R,
75
- A as a
76
- };