@m4l/graphics 1.0.9 → 1.0.11

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.
@@ -0,0 +1,4 @@
1
+ import "@mui/material/styles";
2
+ import "@mui/material";
3
+ import "@m4l/styles";
4
+ import "react/jsx-runtime";
@@ -1,17 +1,17 @@
1
- import { createContext as c, useMemo as h } from "react";
2
- import { CssBaseline as a } from "@mui/material";
1
+ import { createContext as c, useMemo as a } from "react";
2
+ import { CssBaseline as h } from "@mui/material";
3
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";
4
+ import { createTheme as p, experimental_extendTheme as x, Experimental_CssVarsProvider as f, StyledEngineProvider as u } from "@mui/material/styles";
5
5
  import { jsxs as s, jsx as t } from "react/jsx-runtime";
6
- const u = c(null);
6
+ const T = c(null);
7
7
  function H(m) {
8
8
  const {
9
9
  children: i,
10
- hostThemeOptions: l,
11
- fnComponentsOverrides: o
12
- } = m, n = h(() => {
10
+ hostThemeOptions: o,
11
+ fnComponentsOverrides: n
12
+ } = m, l = a(() => {
13
13
  const e = p({
14
- ...l
14
+ ...o
15
15
  }), r = x({
16
16
  cssVarPrefix: "m4l",
17
17
  colorSchemes: {
@@ -20,18 +20,18 @@ function H(m) {
20
20
  dark: e
21
21
  }
22
22
  });
23
- return r.components = o(r), r;
23
+ return r.components = n(r), r;
24
24
  }, []);
25
25
  return /* @__PURE__ */ s(f, {
26
- theme: n,
27
- children: [/* @__PURE__ */ t(d, {}), /* @__PURE__ */ t(u.Provider, {
26
+ theme: l,
27
+ children: [/* @__PURE__ */ t(d, {}), /* @__PURE__ */ t(T.Provider, {
28
28
  value: {
29
- hostThemeOptions: n,
30
- fnComponentsOverrides: o
29
+ hostThemeOptions: o,
30
+ fnComponentsOverrides: n
31
31
  },
32
- children: /* @__PURE__ */ s(T, {
32
+ children: /* @__PURE__ */ s(u, {
33
33
  injectFirst: !0,
34
- children: [/* @__PURE__ */ t(a, {
34
+ children: [/* @__PURE__ */ t(h, {
35
35
  enableColorScheme: !0
36
36
  }), i]
37
37
  })
@@ -39,6 +39,6 @@ function H(m) {
39
39
  });
40
40
  }
41
41
  export {
42
- u as H,
42
+ T as H,
43
43
  H as a
44
44
  };
@@ -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;
@@ -1,8 +1,12 @@
1
+ import "./FormatterContext/index.92336f4c.js";
2
+ import "./LocalesContext/index.53f0b702.js";
1
3
  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 M } from "../node_modules.7cdb697c.js";
4
+ import { c as v, d as R, i as P, l as E } from "../node_modules.9690bbee.js";
3
5
  import { jsx as x } from "react/jsx-runtime";
4
- import { useNetwork as E, 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 W, SUCCESS as B, shadows as p, createCustomShadows as $, defaultThemeOptions as j, defaultPreset as _, colorPresets as F } from "@m4l/styles";
6
+ import "date-fns/locale/en-US";
7
+ import "./HostThemeContext/index.89c85eb6.js";
8
+ import { useNetwork as M, useLocalStorageWithListener as w } from "@m4l/core";
9
+ import { getColorPresets as m, getColorState as d, typography as L, palette as p, SECONDARY as A, COMMON as N, ERROR as D, WARNING as z, INFO as B, SUCCESS as $, shadows as S, createCustomShadows as j, defaultThemeOptions as W, defaultPreset as _, colorPresets as F } from "@m4l/styles";
6
10
  import { alpha as I } from "@mui/system";
7
11
  import { u as U } from "../hooks/useFirstRender/index.1e9b02fb.js";
8
12
  const C = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, K = (r) => {
@@ -15,18 +19,16 @@ const C = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, K = (r) => {
15
19
  ...t,
16
20
  responsiveContainerActions: {
17
21
  setBreakpoint: (e) => {
18
- o(
19
- (i) => {
20
- console.log("current breakpoint", e), i.breakPoint = e, i.isUpSm = e !== "xs" && e !== "sm", i.isXs = e == "xs";
21
- }
22
- );
22
+ o((i) => {
23
+ i.breakPoint = e, i.isUpSm = e !== "xs" && e !== "sm", i.isXs = e == "xs";
24
+ });
23
25
  }
24
26
  }
25
27
  })),
26
28
  { name: "Responsive Relative Store" }
27
29
  )
28
30
  );
29
- }, X = f(null), te = (r) => {
31
+ }, X = f(null), se = (r) => {
30
32
  const {
31
33
  children: t,
32
34
  observedDivRef: o
@@ -39,29 +41,28 @@ const C = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, K = (r) => {
39
41
  const e = () => {
40
42
  const s = o;
41
43
  if (s instanceof HTMLElement && s.clientWidth) {
42
- const c = Object.keys(C);
43
- for (let l = 0; l < c.length; l++) {
44
- const g = c[l];
44
+ const a = Object.keys(C);
45
+ for (let l = 0; l < a.length; l++) {
46
+ const g = a[l];
45
47
  if (s.clientWidth <= C[g]) {
46
48
  n.current?.getState().responsiveContainerActions.setBreakpoint(g);
47
49
  break;
48
50
  }
49
51
  }
50
- console.log("node.clientWidth", s.clientWidth), console.log("onResizeMemo", n.current?.getState().breakPoint);
51
52
  }
52
- }, i = k(() => M.exports.throttle(e, 200, {
53
+ }, i = k(() => E.exports.throttle(e, 200, {
53
54
  leading: !1,
54
55
  trailing: !0
55
56
  }), [e]);
56
57
  return y(() => {
57
58
  const s = () => {
58
59
  i();
59
- }, c = o;
60
- if (c && c instanceof Element) {
60
+ }, a = o;
61
+ if (a && a instanceof Element) {
61
62
  const l = new ResizeObserver((g) => {
62
63
  s();
63
64
  });
64
- return l.observe(c), () => {
65
+ return l.observe(a), () => {
65
66
  l.disconnect();
66
67
  };
67
68
  }
@@ -91,7 +92,7 @@ function O(r, t = "m4l") {
91
92
  typeof e == "object" && e !== null && O(e, `${t}-${n}`);
92
93
  });
93
94
  }
94
- const a = (r) => {
95
+ const c = (r) => {
95
96
  const t = r.currentThemeSettings || u;
96
97
  console.log("getColorPresets", m(t.themeColorPresets)), console.log(
97
98
  "getColorState",
@@ -103,7 +104,7 @@ const a = (r) => {
103
104
  typography: L,
104
105
  palette: {
105
106
  ...r.themeOptions.palette,
106
- ...o ? S.light : S.dark,
107
+ ...o ? p.light : p.dark,
107
108
  primary: m(t.themeColorPresets),
108
109
  state: d(t.themeColorPresets, t.themeMode),
109
110
  representative: t.themeMode === "light" ? m(t.themeColorPresets)?.light : m(t.themeColorPresets)?.darker,
@@ -141,7 +142,7 @@ const a = (r) => {
141
142
  contrastTextChannel: ""
142
143
  },
143
144
  info: {
144
- ...W,
145
+ ...B,
145
146
  contrastText: "",
146
147
  mainChannel: "",
147
148
  lightChannel: "",
@@ -149,7 +150,7 @@ const a = (r) => {
149
150
  contrastTextChannel: ""
150
151
  },
151
152
  success: {
152
- ...B,
153
+ ...$,
153
154
  contrastText: "",
154
155
  mainChannel: "",
155
156
  lightChannel: "",
@@ -159,13 +160,13 @@ const a = (r) => {
159
160
  },
160
161
  shape: { borderRadius: 8 },
161
162
  direction: t.themeDirection,
162
- shadows: o ? p.light : p.dark,
163
+ shadows: o ? S.light : S.dark,
163
164
  customShadows: {
164
165
  primary: `0 8px 16px 0 ${I(
165
166
  m(t.themeColorPresets)?.main || "#fff",
166
167
  0.2
167
168
  )}`,
168
- ...$(t.themeMode)
169
+ ...j(t.themeMode)
169
170
  },
170
171
  stretch: t.themeStretch
171
172
  }, console.log("state.themeOptions", r.themeOptions), O(r.themeOptions);
@@ -178,12 +179,12 @@ const a = (r) => {
178
179
  settingsActions: {
179
180
  init: () => {
180
181
  t((n) => {
181
- a(n);
182
+ c(n);
182
183
  });
183
184
  },
184
185
  setThemeSettings: (n) => {
185
186
  t((e) => {
186
- e.currentThemeSettings = { ...e.currentThemeSettings, ...n }, h(e), a(e);
187
+ e.currentThemeSettings = { ...e.currentThemeSettings, ...n }, h(e), c(e);
187
188
  });
188
189
  },
189
190
  onChangeMode: (n) => {
@@ -191,7 +192,7 @@ const a = (r) => {
191
192
  e.currentThemeSettings = {
192
193
  ...e.currentThemeSettings,
193
194
  themeMode: n.target.value
194
- }, h(e), a(e);
195
+ }, h(e), c(e);
195
196
  });
196
197
  },
197
198
  handleOpen: () => {
@@ -204,7 +205,7 @@ const a = (r) => {
204
205
  e.currentThemeSettings = {
205
206
  ...e.currentThemeSettings,
206
207
  themeDirection: n.target.value
207
- }, h(e), a(e);
208
+ }, h(e), c(e);
208
209
  });
209
210
  },
210
211
  onChangeColor: (n) => {
@@ -212,7 +213,7 @@ const a = (r) => {
212
213
  e.currentThemeSettings = {
213
214
  ...e.currentThemeSettings,
214
215
  themeColorPresets: n.target.value
215
- }, h(e), a(e);
216
+ }, h(e), c(e);
216
217
  });
217
218
  },
218
219
  onChangeLayout: (n) => {
@@ -220,7 +221,7 @@ const a = (r) => {
220
221
  e.currentThemeSettings = {
221
222
  ...e.currentThemeSettings,
222
223
  themeLayout: n.target.value
223
- }, h(e), a(e);
224
+ }, h(e), c(e);
224
225
  });
225
226
  },
226
227
  onToggleStretch: () => {
@@ -228,14 +229,14 @@ const a = (r) => {
228
229
  n.currentThemeSettings = {
229
230
  ...n.currentThemeSettings,
230
231
  themeStretch: !n.currentThemeSettings.themeStretch
231
- }, h(n), a(n);
232
+ }, h(n), c(n);
232
233
  });
233
234
  },
234
235
  onResetSetting: () => {
235
236
  t((n) => {
236
237
  n.currentThemeSettings = {
237
238
  ...u
238
- }, h(n), a(n);
239
+ }, h(n), c(n);
239
240
  });
240
241
  }
241
242
  }
@@ -243,23 +244,23 @@ const a = (r) => {
243
244
  { name: "ExampleStore" }
244
245
  )
245
246
  ), G = f(null);
246
- function ne({
247
+ function ie({
247
248
  children: r,
248
249
  themeSettings: t
249
250
  }) {
250
251
  const {
251
252
  networkOperation: o
252
- } = E(), [n, e] = w("theme_setting", u), i = U([t]), s = T();
253
+ } = M(), [n, e] = w("theme_setting", u), i = U([t]), s = T();
253
254
  return s.current || (s.current = q({
254
255
  networkOperation: o,
255
256
  currentThemeSettings: {
256
257
  ...t ?? n
257
258
  },
258
- themeOptions: j,
259
+ themeOptions: W,
259
260
  currentPreset: _,
260
- colorOption: F.map((c) => ({
261
- name: c.name,
262
- value: c.main
261
+ colorOption: F.map((a) => ({
262
+ name: a.name,
263
+ value: a.main
263
264
  })),
264
265
  open: !1,
265
266
  setterThemeSettings: t ? void 0 : e
@@ -273,7 +274,7 @@ function ne({
273
274
  export {
274
275
  X as R,
275
276
  G as T,
276
- te as a,
277
- ne as b,
277
+ se as a,
278
+ ie as b,
278
279
  u as d
279
280
  };
@@ -0,0 +1,57 @@
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.89c85eb6.js";
3
+ import { u as a } from "../node_modules.9690bbee.js";
4
+ import { T as p } from "../contexts/index.9a0fbc7c.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
+ };
@@ -1,11 +1,17 @@
1
1
  import { useState as n, useEffect as o } from "react";
2
- import { t as s } from "../../node_modules.7cdb697c.js";
2
+ import { t as s } from "../../node_modules.9690bbee.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
- import { u as r } from "../../node_modules.7cdb697c.js";
3
- import { R as n } from "../../contexts/index.1d935da9.js";
2
+ import { u as r } from "../../node_modules.9690bbee.js";
3
+ import { R as n } from "../../contexts/index.9a0fbc7c.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,43 +1,43 @@
1
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.1d935da9.js";
5
- import { H as w, a as z } from "./contexts/HostThemeContext/index.02e36f38.js";
2
+ import { F as C, a as T } from "./contexts/FormatterContext/index.92336f4c.js";
3
+ import { L as h, a as R, g as S } from "./contexts/LocalesContext/index.53f0b702.js";
4
+ import { R as F, a as P, T as b, b as L, d as H } from "./contexts/index.9a0fbc7c.js";
5
+ import { H as w, a as z } from "./contexts/HostThemeContext/index.89c85eb6.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.e4fb3c4e.js";
8
+ import { b as A, u as D, a as E, c as N, d as W } from "./hooks/index.ff8c4415.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.0881f166.js";
11
- import { u as U } from "./hooks/useIsMobile/index.1afbcd66.js";
10
+ import { u as J, a as K } from "./hooks/useResponsive/index.ea7ff1dc.js";
11
+ import { u as U } from "./hooks/useIsMobile/index.54bf37f7.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";
15
15
  import "@m4l/styles";
16
16
  import "react/jsx-runtime";
17
17
  import "react";
18
+ import "@m4l/core";
18
19
  import "@mui/x-date-pickers/AdapterDateFns";
19
20
  import "@mui/x-date-pickers";
20
- import "@m4l/core";
21
21
  import "date-fns/locale/en-US";
22
- import "./node_modules.7cdb697c.js";
22
+ import "./node_modules.9690bbee.js";
23
23
  import "./commonjs.e3daa2e5.js";
24
24
  import "@mui/system";
25
25
  export {
26
26
  X as Capitalize,
27
- R as FormatterContext,
28
- S as FormatterProvider,
27
+ C as FormatterContext,
28
+ T as FormatterProvider,
29
29
  l as GlobalStyles,
30
30
  w as HostThemeContext,
31
31
  z as HostThemeProvider,
32
- C as LocalesContext,
33
- T as LocalesProvider,
32
+ h as LocalesContext,
33
+ R as LocalesProvider,
34
34
  F as ResponsiveContainerContext,
35
35
  P as ResponsiveContainerProvider,
36
36
  b as ThemeSettingsContext,
37
37
  L as ThemeSettingsProvider,
38
38
  H as defaultThemeSettings,
39
39
  Y as getAnchorElPositionWindow,
40
- g as getLocaleFromNetwork,
40
+ S as getLocaleFromNetwork,
41
41
  I as useFirstRender,
42
42
  O as useFormatter,
43
43
  A as useHostTheme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "1.0.9",
3
+ "version": "1.0.11",
4
4
  "license": "UNLICENSED",
5
5
  "author": "M4L Team*",
6
6
  "dependencies": {
package/vite-env.d.ts CHANGED
@@ -1 +1 @@
1
- /// <reference types="vite/client" />
1
+ /// <reference types="vite/client" />
@@ -1 +0,0 @@
1
-
@@ -1,54 +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.02e36f38.js";
3
- import { u as a } from "../node_modules.7cdb697c.js";
4
- import { T as l } from "../contexts/index.1d935da9.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
- };