@m4l/graphics 1.0.7 → 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.
- package/contexts/HostThemeContext/types.d.ts +1 -1
- package/contexts/ThemeSettingsContext/ThemeSettingsContext.d.ts +13 -0
- package/contexts/ThemeSettingsContext/constants.d.ts +2 -0
- package/contexts/ThemeSettingsContext/index.d.ts +2 -0
- package/contexts/ThemeSettingsContext/store.d.ts +12 -0
- package/contexts/ThemeSettingsContext/types.d.ts +47 -0
- package/contexts/index.acf54acf.js +283 -0
- package/contexts/index.d.ts +1 -0
- package/hooks/{index.eebf9e43.js → index.315d954d.js} +19 -12
- package/hooks/index.d.ts +1 -0
- package/hooks/useResponsive/{index.b336bec4.js → index.f415f47d.js} +1 -1
- package/hooks/useThemSettingsStore/index.d.ts +2 -0
- package/index.js +37 -33
- package/package.json +1 -1
- package/contexts/index.68603471.js +0 -73
|
@@ -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,
|
|
6
|
+
fnComponentsOverrides: (theme: Omit<Theme, 'palette' | 'applyStyles'> & CssVarsTheme) => any;
|
|
7
7
|
}
|
|
8
8
|
export interface HostThemeProviderProps extends HostThemeType {
|
|
9
9
|
isMicroFrontEnd: boolean;
|
|
@@ -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,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
|
+
};
|
package/contexts/index.d.ts
CHANGED
|
@@ -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
|
|
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.68603471.js";
|
|
6
|
-
import "../node_modules.9eeccca4.js";
|
|
7
7
|
import "@m4l/styles";
|
|
8
|
-
function
|
|
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
|
|
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
|
|
26
|
-
const e =
|
|
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((
|
|
38
|
-
e(t,
|
|
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
|
-
|
|
47
|
-
|
|
52
|
+
g as a,
|
|
53
|
+
v as b,
|
|
48
54
|
H as c,
|
|
49
|
-
|
|
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';
|
|
@@ -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.
|
|
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);
|
package/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { G as
|
|
2
|
-
import { F as
|
|
3
|
-
import { L as
|
|
4
|
-
import { R as
|
|
5
|
-
import { H, a 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 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
|
-
|
|
26
|
-
|
|
26
|
+
V as Capitalize,
|
|
27
|
+
d as FormatterContext,
|
|
27
28
|
R as FormatterProvider,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
L as
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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,73 +0,0 @@
|
|
|
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
|
-
};
|