@m4l/graphics 1.0.6 → 1.0.8

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.
@@ -3,7 +3,7 @@ import type { ReactNode } from 'react';
3
3
  export declare type EventFunListener = (...args: any[]) => void;
4
4
  export interface HostThemeType {
5
5
  hostThemeOptions: Theme;
6
- fnComponentsOverrides: (theme: Omit<Theme, "palette" | "applyStyles"> & CssVarsTheme) => any;
6
+ fnComponentsOverrides: (theme: Omit<Theme, 'palette' | 'applyStyles'> & CssVarsTheme) => any;
7
7
  }
8
8
  export interface HostThemeProviderProps extends HostThemeType {
9
9
  isMicroFrontEnd: boolean;
@@ -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,13 @@
1
+ /// <reference types="react" />
2
+ import { ThemeSettingsProviderProps } from './types';
3
+ declare const ThemeSettingsContext: import("react").Context<(Omit<Omit<import("zustand").StoreApi<import("./types").ThemeSettingsStateWithActions>, "setState"> & {
4
+ setState<A extends string | {
5
+ type: unknown;
6
+ }>(partial: import("./types").ThemeSettingsStateWithActions | Partial<import("./types").ThemeSettingsStateWithActions> | ((state: import("./types").ThemeSettingsStateWithActions) => import("./types").ThemeSettingsStateWithActions | Partial<import("./types").ThemeSettingsStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
7
+ }, "setState"> & {
8
+ setState(nextStateOrUpdater: import("./types").ThemeSettingsStateWithActions | Partial<import("./types").ThemeSettingsStateWithActions> | ((state: import("immer/dist/internal").WritableDraft<import("./types").ThemeSettingsStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
9
+ type: unknown;
10
+ } | undefined): void;
11
+ }) | null>;
12
+ declare function ThemeSettingsProvider({ children, themeSettings }: ThemeSettingsProviderProps): import("react").JSX.Element;
13
+ export { ThemeSettingsProvider, ThemeSettingsContext };
@@ -0,0 +1,2 @@
1
+ import { ThemeSettingsType } from './types';
2
+ export declare const defaultThemeSettings: ThemeSettingsType;
@@ -0,0 +1,2 @@
1
+ export * from './ThemeSettingsContext';
2
+ export type {} from './SettingsContext/types';
@@ -0,0 +1,12 @@
1
+ import { InitialThemeSettingsStoreProps, ThemeSettingsStateWithActions } from './types';
2
+ import { WritableDraft } from 'immer/dist/internal';
3
+ export declare const createThemeSettingsStore: (initialState: InitialThemeSettingsStoreProps) => Omit<Omit<import("zustand").StoreApi<ThemeSettingsStateWithActions>, "setState"> & {
4
+ setState<A extends string | {
5
+ type: unknown;
6
+ }>(partial: ThemeSettingsStateWithActions | Partial<ThemeSettingsStateWithActions> | ((state: ThemeSettingsStateWithActions) => ThemeSettingsStateWithActions | Partial<ThemeSettingsStateWithActions>), replace?: boolean | undefined, action?: A | undefined): void;
7
+ }, "setState"> & {
8
+ setState(nextStateOrUpdater: ThemeSettingsStateWithActions | Partial<ThemeSettingsStateWithActions> | ((state: WritableDraft<ThemeSettingsStateWithActions>) => void), shouldReplace?: boolean | undefined, action?: string | {
9
+ type: unknown;
10
+ } | undefined): void;
11
+ };
12
+ export declare type ThemeSettingsStore = ReturnType<typeof createThemeSettingsStore>;
@@ -0,0 +1,47 @@
1
+ import { NetworkProps } from '@m4l/core';
2
+ import { ThemeColorPresets } from '@m4l/styles';
3
+ import { CssVarsTheme, Theme, PaletteColor } from '@mui/material/styles';
4
+ import { ReactNode } from 'react';
5
+ export declare type ThemeMode = 'light' | 'dark';
6
+ export declare type ThemeDirection = 'rtl' | 'ltr';
7
+ export declare type ThemeLayout = 'vertical' | 'horizontal';
8
+ export declare type ThemeStretch = boolean;
9
+ export declare type ThemeSettingsType = {
10
+ themeMode: ThemeMode;
11
+ themeDirection: ThemeDirection;
12
+ themeColorPresets: ThemeColorPresets;
13
+ themeStretch: ThemeStretch;
14
+ themeLayout: ThemeLayout;
15
+ };
16
+ export interface ThemeSettingsStore {
17
+ networkOperation: (props: NetworkProps) => Promise<any>;
18
+ currentThemeSettings: ThemeSettingsType;
19
+ currentPreset: PaletteColor;
20
+ themeOptions: Omit<Theme, 'palette' | 'applyStyles'> & CssVarsTheme;
21
+ colorOption: {
22
+ name: string | undefined;
23
+ value: string;
24
+ }[];
25
+ setThemeSettings?: (newValue: ThemeSettingsType) => void;
26
+ open: boolean;
27
+ }
28
+ export declare type DefaultThemeSettingsStoreProps = ThemeSettingsStore;
29
+ export declare type InitialThemeSettingsStoreProps = DefaultThemeSettingsStoreProps;
30
+ export interface ThemeSettingsStateWithActions extends ThemeSettingsStore {
31
+ settingsActions: {
32
+ init: () => void;
33
+ onToggleStretch: VoidFunction;
34
+ onResetSetting: VoidFunction;
35
+ onChangeMode: (event: React.ChangeEvent<HTMLInputElement>) => void;
36
+ onChangeDirection: (event: React.ChangeEvent<HTMLInputElement>) => void;
37
+ onChangeColor: (event: React.ChangeEvent<HTMLInputElement>) => void;
38
+ onChangeLayout: (event: React.ChangeEvent<HTMLInputElement>) => void;
39
+ handleOpen: () => void;
40
+ setThemeOptions: (obj: any) => void;
41
+ setSettings: (newValue: any) => void;
42
+ };
43
+ }
44
+ export declare type ThemeSettingsProviderProps = {
45
+ themeSettings?: ThemeSettingsType;
46
+ children: ReactNode;
47
+ };
@@ -0,0 +1,283 @@
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
+ };
@@ -6,4 +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/ThemeSettingsContext';
9
10
  export type { HostThemeType } from './HostThemeContext/types';
@@ -1,11 +1,11 @@
1
- import { useRef as r, useEffect as n, useState as f, useContext as i, useLayoutEffect as c } from "react";
1
+ import { useRef as r, useEffect as n, useState as f, useContext as u, useLayoutEffect as c } from "react";
2
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";
3
5
  import "../contexts/FormatterContext/index.92336f4c.js";
4
6
  import "../contexts/LocalesContext/index.53f0b702.js";
5
- import "../contexts/index.5db85b6b.js";
6
- import "../node_modules.9eeccca4.js";
7
7
  import "@m4l/styles";
8
- function h() {
8
+ function b() {
9
9
  const e = r(!0);
10
10
  return n(
11
11
  () => () => {
@@ -14,7 +14,7 @@ function h() {
14
14
  []
15
15
  ), e;
16
16
  }
17
- function v(e) {
17
+ function g(e) {
18
18
  const [o, t] = f(!1), s = e || 100;
19
19
  return n(() => (window.onscroll = () => {
20
20
  window.pageYOffset > s ? t(!0) : t(!1);
@@ -22,8 +22,8 @@ function v(e) {
22
22
  window.onscroll = null;
23
23
  }), [s]), o;
24
24
  }
25
- const x = () => {
26
- const e = i(m);
25
+ const v = () => {
26
+ const e = u(m);
27
27
  if (!e)
28
28
  throw new Error("useHostTheme context must be use inside HostThemeProvider");
29
29
  return e;
@@ -34,17 +34,24 @@ function H(e) {
34
34
  const t = o?.current;
35
35
  if (!t)
36
36
  return;
37
- const s = new ResizeObserver((u) => {
38
- e(t, u[0]);
37
+ const s = new ResizeObserver((i) => {
38
+ e(t, i[0]);
39
39
  });
40
40
  return s.observe(t), () => {
41
41
  s.disconnect();
42
42
  };
43
43
  }, [e, o.current]), o;
44
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
+ }
45
51
  export {
46
- v as a,
47
- x as b,
52
+ g as a,
53
+ v as b,
48
54
  H as c,
49
- h as u
55
+ O as d,
56
+ b as u
50
57
  };
package/hooks/index.d.ts CHANGED
@@ -8,3 +8,4 @@ export { useOffSetTop } from './useOffSetTop';
8
8
  export { useHostTheme } from './useHostTheme';
9
9
  export { useResizeObserver } from './useResizeObserver';
10
10
  export { useResponsiveDesktop } from './useResponsive';
11
+ export { useThemeSettingsStore } from './useThemSettingsStore';
@@ -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.5db85b6b.js";
3
+ import { R as n } from "../../contexts/index.acf54acf.js";
4
4
  import { useResponsive as i } from "@m4l/styles";
5
5
  function f(e, s) {
6
6
  const o = t(n);
@@ -0,0 +1,2 @@
1
+ import { ThemeSettingsStateWithActions } from '../../contexts/ThemeSettingsContext/types';
2
+ export declare function useThemeSettingsStore<T>(selector: (state: ThemeSettingsStateWithActions) => T, equalityFn?: (left: T, right: T) => boolean): T;
package/index.js CHANGED
@@ -1,15 +1,15 @@
1
- import { G as l } from "./components/GlobalStyle/index.b7393a44.js";
2
- import { F as C, a as R } from "./contexts/FormatterContext/index.92336f4c.js";
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.5db85b6b.js";
5
- import { H, a as T } from "./contexts/HostThemeContext/index.f53d14b8.js";
6
- import { u as k } from "./hooks/useFirstRender/index.1e9b02fb.js";
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.2b8a1712.js";
9
- import { u as D } from "./hooks/useLocales/index.d5a80aff.js";
10
- import { u as N, a as W } from "./hooks/useResponsive/index.073ed72d.js";
11
- import { u as q } from "./hooks/useIsMobile/index.3de7c47a.js";
12
- import { C as J, g as K } from "./utils/index.6909c662.js";
1
+ import { G as v } from "./components/GlobalStyle/index.b7393a44.js";
2
+ import { F as d, a as R } from "./contexts/FormatterContext/index.92336f4c.js";
3
+ import { L as g, a as h, g as S } from "./contexts/LocalesContext/index.53f0b702.js";
4
+ import { R as F, a as P, T as b, b as L } from "./contexts/index.acf54acf.js";
5
+ import { H as k, a as w } from "./contexts/HostThemeContext/index.f53d14b8.js";
6
+ import { u as G } from "./hooks/useFirstRender/index.1e9b02fb.js";
7
+ import { u as M } from "./hooks/useFormatter/index.57ac8cca.js";
8
+ import { b as y, u as A, a as D, c as E, d as N } from "./hooks/index.315d954d.js";
9
+ import { u as j } from "./hooks/useLocales/index.d5a80aff.js";
10
+ import { u as B, a as J } from "./hooks/useResponsive/index.f415f47d.js";
11
+ import { u as Q } from "./hooks/useIsMobile/index.e9f29b1d.js";
12
+ import { C as V, g as X } from "./utils/index.6909c662.js";
13
13
  import "@mui/material/styles";
14
14
  import "@mui/material";
15
15
  import "@m4l/styles";
@@ -21,27 +21,31 @@ import "@mui/x-date-pickers";
21
21
  import "date-fns/locale/en-US";
22
22
  import "./node_modules.9eeccca4.js";
23
23
  import "./commonjs.e3daa2e5.js";
24
+ import "@mui/system";
24
25
  export {
25
- J as Capitalize,
26
- C as FormatterContext,
26
+ V as Capitalize,
27
+ d as FormatterContext,
27
28
  R as FormatterProvider,
28
- l as GlobalStyles,
29
- H as HostThemeContext,
30
- T as HostThemeProvider,
31
- c as LocalesContext,
32
- F as LocalesProvider,
33
- b as ResponsiveContainerContext,
34
- g as ResponsiveContainerProvider,
35
- K as getAnchorElPositionWindow,
36
- L as getLocaleFromNetwork,
37
- k as useFirstRender,
38
- z as useFormatter,
39
- I as useHostTheme,
40
- q as useIsMobile,
41
- M as useIsMountedRef,
42
- D as useLocales,
43
- O as useOffSetTop,
44
- y as useResizeObserver,
45
- N as useResponsiveContainerStore,
46
- W as useResponsiveDesktop
29
+ v as GlobalStyles,
30
+ k as HostThemeContext,
31
+ w as HostThemeProvider,
32
+ g as LocalesContext,
33
+ h as LocalesProvider,
34
+ F as ResponsiveContainerContext,
35
+ P as ResponsiveContainerProvider,
36
+ b as ThemeSettingsContext,
37
+ L as ThemeSettingsProvider,
38
+ X as getAnchorElPositionWindow,
39
+ S as getLocaleFromNetwork,
40
+ G as useFirstRender,
41
+ M as useFormatter,
42
+ y as useHostTheme,
43
+ Q as useIsMobile,
44
+ A as useIsMountedRef,
45
+ j as useLocales,
46
+ D as useOffSetTop,
47
+ E as useResizeObserver,
48
+ B as useResponsiveContainerStore,
49
+ J as useResponsiveDesktop,
50
+ N as useThemeSettingsStore
47
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m4l/graphics",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
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.f53d14b8.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
- };