@m4l/graphics 2.0.1 → 2.0.3
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/ThemeSettingsContext/ThemeSettingsContext.d.ts +1 -1
- package/contexts/ThemeSettingsContext/types.d.ts +1 -2
- package/contexts/index-CvzLutB3.js +278 -0
- package/hooks/{index-c14LV1FI.js → index-Cg3zl6cl.js} +1 -1
- package/hooks/useResponsive/{index-DOGfC2H7.js → index-Cq8kt3PV.js} +1 -1
- package/index.js +3 -3
- package/package.json +1 -1
- package/vite-env.d.ts +1 -1
- package/contexts/index-BB_hmi4E.js +0 -280
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { ThemeSettingsProviderProps } from './types';
|
|
2
|
+
import type { ThemeSettingsProviderProps } from './types';
|
|
3
3
|
declare const ThemeSettingsContext: import("react").Context<(Omit<Omit<import("zustand").StoreApi<import("./types").ThemeSettingsStateWithActions>, "setState"> & {
|
|
4
4
|
setState<A extends string | {
|
|
5
5
|
type: unknown;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NetworkProps } from '@m4l/core';
|
|
2
2
|
import { ThemeColorPresets } from '@m4l/styles';
|
|
3
|
-
import { CssVarsTheme, Theme
|
|
3
|
+
import { CssVarsTheme, Theme } from '@mui/material/styles';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
export declare type ThemeMode = 'light' | 'dark';
|
|
6
6
|
export declare type ThemeDirection = 'rtl' | 'ltr';
|
|
@@ -16,7 +16,6 @@ export declare type ThemeSettingsType = {
|
|
|
16
16
|
export interface ThemeSettingsStore {
|
|
17
17
|
networkOperation: (props: NetworkProps) => Promise<any>;
|
|
18
18
|
currentThemeSettings: ThemeSettingsType;
|
|
19
|
-
currentPreset: PaletteColor;
|
|
20
19
|
themeOptions: Omit<Theme, 'palette' | 'applyStyles'> & CssVarsTheme;
|
|
21
20
|
colorOption: {
|
|
22
21
|
name: string | undefined;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { createContext as f, useRef as T, useMemo as O, useLayoutEffect as y } from "react";
|
|
2
|
+
import { c as v, d as R, i as x, l as b } from "../node_modules-BHhXVwYT.js";
|
|
3
|
+
import { jsx as P } from "react/jsx-runtime";
|
|
4
|
+
import { useNetwork as E, useLocalStorageWithListener as M } from "@m4l/core";
|
|
5
|
+
import { getColorPresets as g, getColorState as d, typography as w, palette as C, SECONDARY as L, COMMON as A, ERROR as N, WARNING as D, INFO as B, SUCCESS as z, shadows as p, createCustomShadows as W, defaultThemeOptions as $, colorPresets as j } from "@m4l/styles";
|
|
6
|
+
import { alpha as _ } from "@mui/system";
|
|
7
|
+
const u = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, I = (r) => {
|
|
8
|
+
const n = {
|
|
9
|
+
...r
|
|
10
|
+
};
|
|
11
|
+
return v(
|
|
12
|
+
R(
|
|
13
|
+
x((o, t) => ({
|
|
14
|
+
...n,
|
|
15
|
+
responsiveContainerActions: {
|
|
16
|
+
setBreakpoint: (e) => {
|
|
17
|
+
o((s) => {
|
|
18
|
+
s.breakPoint = e, s.isUpSm = e !== "xs" && e !== "sm", s.isXs = e == "xs";
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
})),
|
|
23
|
+
{ name: "Responsive Relative Store" }
|
|
24
|
+
)
|
|
25
|
+
);
|
|
26
|
+
}, U = f(null), J = (r) => {
|
|
27
|
+
const {
|
|
28
|
+
children: n,
|
|
29
|
+
observedDivRef: o
|
|
30
|
+
} = r, t = T();
|
|
31
|
+
t.current || (t.current = I({
|
|
32
|
+
breakPoint: "md",
|
|
33
|
+
isUpSm: !1,
|
|
34
|
+
isXs: !1
|
|
35
|
+
}));
|
|
36
|
+
const e = () => {
|
|
37
|
+
const i = o;
|
|
38
|
+
if (i instanceof HTMLElement && i.clientWidth) {
|
|
39
|
+
const a = Object.keys(u);
|
|
40
|
+
for (let c = 0; c < a.length; c++) {
|
|
41
|
+
const m = a[c];
|
|
42
|
+
if (i.clientWidth <= u[m]) {
|
|
43
|
+
t.current?.getState().responsiveContainerActions.setBreakpoint(m);
|
|
44
|
+
break;
|
|
45
|
+
} else c === a.length - 1 && i.clientWidth >= u[m] && t.current?.getState().responsiveContainerActions.setBreakpoint(m);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}, s = O(() => b.throttle(e, 200, {
|
|
49
|
+
leading: !1,
|
|
50
|
+
trailing: !0
|
|
51
|
+
}), [e]);
|
|
52
|
+
return y(() => {
|
|
53
|
+
const i = () => {
|
|
54
|
+
s();
|
|
55
|
+
}, a = o;
|
|
56
|
+
if (a && a instanceof Element) {
|
|
57
|
+
const c = new ResizeObserver((m) => {
|
|
58
|
+
i();
|
|
59
|
+
});
|
|
60
|
+
return c.observe(a), () => {
|
|
61
|
+
c.disconnect();
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}, [o]), /* @__PURE__ */ P(U.Provider, {
|
|
65
|
+
value: t.current,
|
|
66
|
+
children: n
|
|
67
|
+
});
|
|
68
|
+
}, S = {
|
|
69
|
+
themeMode: "light",
|
|
70
|
+
themeDirection: "ltr",
|
|
71
|
+
themeColorPresets: "patronus",
|
|
72
|
+
themeLayout: "horizontal",
|
|
73
|
+
themeStretch: !1
|
|
74
|
+
};
|
|
75
|
+
function k(r, n = "m4l") {
|
|
76
|
+
const o = document.querySelector('[data-mui-color-scheme="light"]');
|
|
77
|
+
if (!o) {
|
|
78
|
+
console.error('Element with data-mui-color-scheme="light" not found.');
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
Object.keys(r).forEach((t) => {
|
|
82
|
+
const e = r[t];
|
|
83
|
+
if (typeof e == "string" || typeof e == "number") {
|
|
84
|
+
const s = `--${n}-${t}`;
|
|
85
|
+
o.style.setProperty(s, e.toString());
|
|
86
|
+
} else typeof e == "object" && e !== null && k(e, `${n}-${t}`);
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
const h = (r) => {
|
|
90
|
+
const n = r.currentThemeSettings || S;
|
|
91
|
+
console.log("getColorPresets", g(n.themeColorPresets)), console.log(
|
|
92
|
+
"getColorState",
|
|
93
|
+
d(n.themeColorPresets, n.themeMode)
|
|
94
|
+
);
|
|
95
|
+
const o = n.themeMode === "light";
|
|
96
|
+
r.themeOptions = {
|
|
97
|
+
...r.themeOptions,
|
|
98
|
+
typography: w,
|
|
99
|
+
palette: {
|
|
100
|
+
...r.themeOptions?.palette ?? {},
|
|
101
|
+
...o ? C.light : C.dark,
|
|
102
|
+
primary: g(n.themeColorPresets),
|
|
103
|
+
state: d(n.themeColorPresets, n.themeMode),
|
|
104
|
+
representative: n.themeMode === "light" ? g(n.themeColorPresets)?.light : g(n.themeColorPresets)?.darker,
|
|
105
|
+
secondary: {
|
|
106
|
+
...L,
|
|
107
|
+
contrastText: "",
|
|
108
|
+
mainChannel: "",
|
|
109
|
+
lightChannel: "",
|
|
110
|
+
darkChannel: "",
|
|
111
|
+
contrastTextChannel: ""
|
|
112
|
+
},
|
|
113
|
+
common: {
|
|
114
|
+
...A,
|
|
115
|
+
black: "#000",
|
|
116
|
+
white: "#fff",
|
|
117
|
+
background: "",
|
|
118
|
+
backgroundChannel: "",
|
|
119
|
+
onBackground: "",
|
|
120
|
+
onBackgroundChannel: ""
|
|
121
|
+
},
|
|
122
|
+
error: {
|
|
123
|
+
...N,
|
|
124
|
+
contrastText: "",
|
|
125
|
+
mainChannel: "",
|
|
126
|
+
lightChannel: "",
|
|
127
|
+
darkChannel: "",
|
|
128
|
+
contrastTextChannel: ""
|
|
129
|
+
},
|
|
130
|
+
warning: {
|
|
131
|
+
...D,
|
|
132
|
+
contrastText: "",
|
|
133
|
+
mainChannel: "",
|
|
134
|
+
lightChannel: "",
|
|
135
|
+
darkChannel: "",
|
|
136
|
+
contrastTextChannel: ""
|
|
137
|
+
},
|
|
138
|
+
info: {
|
|
139
|
+
...B,
|
|
140
|
+
contrastText: "",
|
|
141
|
+
mainChannel: "",
|
|
142
|
+
lightChannel: "",
|
|
143
|
+
darkChannel: "",
|
|
144
|
+
contrastTextChannel: ""
|
|
145
|
+
},
|
|
146
|
+
success: {
|
|
147
|
+
...z,
|
|
148
|
+
contrastText: "",
|
|
149
|
+
mainChannel: "",
|
|
150
|
+
lightChannel: "",
|
|
151
|
+
darkChannel: "",
|
|
152
|
+
contrastTextChannel: ""
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
shape: { borderRadius: 8 },
|
|
156
|
+
direction: n.themeDirection,
|
|
157
|
+
shadows: o ? p.light : p.dark,
|
|
158
|
+
customShadows: {
|
|
159
|
+
primary: `0 8px 16px 0 ${_(
|
|
160
|
+
g(n.themeColorPresets)?.main || "#fff",
|
|
161
|
+
0.2
|
|
162
|
+
)}`,
|
|
163
|
+
...W(n.themeMode)
|
|
164
|
+
},
|
|
165
|
+
stretch: n.themeStretch
|
|
166
|
+
}, k(r.themeOptions);
|
|
167
|
+
}, l = (r) => {
|
|
168
|
+
r.setterThemeSettings && r.setterThemeSettings(r.currentThemeSettings);
|
|
169
|
+
}, K = (r) => v(
|
|
170
|
+
R(
|
|
171
|
+
x((n, o) => ({
|
|
172
|
+
...r,
|
|
173
|
+
settingsActions: {
|
|
174
|
+
init: () => {
|
|
175
|
+
n((t) => {
|
|
176
|
+
h(t);
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
// setThemeOptions: newObj => {
|
|
180
|
+
// set(state => {
|
|
181
|
+
// state.themeOptions = { ...state.themeOptions, ...newObj };
|
|
182
|
+
// });
|
|
183
|
+
// },
|
|
184
|
+
setThemeSettings: (t) => {
|
|
185
|
+
n((e) => {
|
|
186
|
+
e.currentThemeSettings = { ...e.currentThemeSettings, ...t }, l(e), h(e);
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
onChangeMode: (t) => {
|
|
190
|
+
n((e) => {
|
|
191
|
+
e.currentThemeSettings = {
|
|
192
|
+
...e.currentThemeSettings,
|
|
193
|
+
themeMode: t.target.value
|
|
194
|
+
}, l(e), h(e);
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
handleOpen: () => {
|
|
198
|
+
n((t) => {
|
|
199
|
+
t.open = !t.open;
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
onChangeDirection: (t) => {
|
|
203
|
+
n((e) => {
|
|
204
|
+
e.currentThemeSettings = {
|
|
205
|
+
...e.currentThemeSettings,
|
|
206
|
+
themeDirection: t.target.value
|
|
207
|
+
}, l(e), h(e);
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
onChangeColor: (t) => {
|
|
211
|
+
n((e) => {
|
|
212
|
+
e.currentThemeSettings = {
|
|
213
|
+
...e.currentThemeSettings,
|
|
214
|
+
themeColorPresets: t.target.value
|
|
215
|
+
}, l(e), h(e);
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
onChangeLayout: (t) => {
|
|
219
|
+
n((e) => {
|
|
220
|
+
e.currentThemeSettings = {
|
|
221
|
+
...e.currentThemeSettings,
|
|
222
|
+
themeLayout: t.target.value
|
|
223
|
+
}, l(e), h(e);
|
|
224
|
+
});
|
|
225
|
+
},
|
|
226
|
+
onToggleStretch: () => {
|
|
227
|
+
n((t) => {
|
|
228
|
+
t.currentThemeSettings = {
|
|
229
|
+
...t.currentThemeSettings,
|
|
230
|
+
themeStretch: !t.currentThemeSettings.themeStretch
|
|
231
|
+
}, l(t), h(t);
|
|
232
|
+
});
|
|
233
|
+
},
|
|
234
|
+
onResetSetting: () => {
|
|
235
|
+
n((t) => {
|
|
236
|
+
t.currentThemeSettings = {
|
|
237
|
+
...S
|
|
238
|
+
}, l(t), h(t);
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
})),
|
|
243
|
+
{ name: "ExampleStore" }
|
|
244
|
+
)
|
|
245
|
+
), X = f(null);
|
|
246
|
+
function Q({
|
|
247
|
+
children: r,
|
|
248
|
+
themeSettings: n
|
|
249
|
+
}) {
|
|
250
|
+
const {
|
|
251
|
+
networkOperation: o
|
|
252
|
+
} = E(), [t, e] = M("theme_setting", {}), s = T();
|
|
253
|
+
return s.current || (s.current = K({
|
|
254
|
+
networkOperation: o,
|
|
255
|
+
currentThemeSettings: {
|
|
256
|
+
...S,
|
|
257
|
+
...n,
|
|
258
|
+
...t
|
|
259
|
+
},
|
|
260
|
+
themeOptions: $,
|
|
261
|
+
colorOption: j.map((i) => ({
|
|
262
|
+
name: i.name,
|
|
263
|
+
value: i.main
|
|
264
|
+
})),
|
|
265
|
+
open: !1,
|
|
266
|
+
setterThemeSettings: n ? void 0 : e
|
|
267
|
+
}), s.current.getState().settingsActions.init()), /* @__PURE__ */ P(X.Provider, {
|
|
268
|
+
value: s.current,
|
|
269
|
+
children: r
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
export {
|
|
273
|
+
U as R,
|
|
274
|
+
X as T,
|
|
275
|
+
J as a,
|
|
276
|
+
Q as b,
|
|
277
|
+
S as d
|
|
278
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRef as n, useEffect as r, useState as i, useContext as u, useLayoutEffect as c } from "react";
|
|
2
2
|
import { H as m } from "../contexts/HostThemeContext/index-C5Z07fH1.js";
|
|
3
3
|
import { u as a } from "../node_modules-BHhXVwYT.js";
|
|
4
|
-
import { T as l } from "../contexts/index-
|
|
4
|
+
import { T as l } from "../contexts/index-CvzLutB3.js";
|
|
5
5
|
function S() {
|
|
6
6
|
const e = n(!0);
|
|
7
7
|
return r(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useContext as t } from "react";
|
|
2
2
|
import { u as r } from "../../node_modules-BHhXVwYT.js";
|
|
3
|
-
import { R as n } from "../../contexts/index-
|
|
3
|
+
import { R as n } from "../../contexts/index-CvzLutB3.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,13 +1,13 @@
|
|
|
1
1
|
import { G as s } from "./components/GlobalStyle/index-DHBkshRk.js";
|
|
2
2
|
import { L as r, a, g as i } from "./contexts/LocalesContext/index--VwMF60R.js";
|
|
3
3
|
import { F as m, a as p } from "./contexts/FormatterContext/index-BHG3bJJo.js";
|
|
4
|
-
import { R as x, a as f, T as d, b as l, d as v } from "./contexts/index-
|
|
4
|
+
import { R as x, a as f, T as d, b as l, d as v } from "./contexts/index-CvzLutB3.js";
|
|
5
5
|
import { H as T, a as g } from "./contexts/HostThemeContext/index-C5Z07fH1.js";
|
|
6
6
|
import { u as R } from "./hooks/useFirstRender/index-B-Q0TTn0.js";
|
|
7
7
|
import { u as c } from "./hooks/useFormatter/index-DfdAcbzw.js";
|
|
8
|
-
import { b as P, u as b, a as L, c as H, d as k } from "./hooks/index-
|
|
8
|
+
import { b as P, u as b, a as L, c as H, d as k } from "./hooks/index-Cg3zl6cl.js";
|
|
9
9
|
import { u as z } from "./hooks/useLocales/index-mTHn9nqY.js";
|
|
10
|
-
import { u as I, a as M } from "./hooks/useResponsive/index-
|
|
10
|
+
import { u as I, a as M } from "./hooks/useResponsive/index-Cq8kt3PV.js";
|
|
11
11
|
import { u as y } from "./hooks/useIsMobile/index-Bro0dV28.js";
|
|
12
12
|
import { C as D, g as E } from "./utils/index-DZG6QXjf.js";
|
|
13
13
|
export {
|
package/package.json
CHANGED
package/vite-env.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -1,280 +0,0 @@
|
|
|
1
|
-
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 E } from "../node_modules-BHhXVwYT.js";
|
|
3
|
-
import { jsx as x } from "react/jsx-runtime";
|
|
4
|
-
import { useNetwork as M, 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 B, SUCCESS as $, shadows as p, createCustomShadows as j, defaultThemeOptions as W, defaultPreset as _, colorPresets as F } from "@m4l/styles";
|
|
6
|
-
import { alpha as I } from "@mui/system";
|
|
7
|
-
import { u as U } from "../hooks/useFirstRender/index-B-Q0TTn0.js";
|
|
8
|
-
const C = { xs: 600, sm: 900, md: 1200, lg: 1536, xl: 1920 }, K = (r) => {
|
|
9
|
-
const t = {
|
|
10
|
-
...r
|
|
11
|
-
};
|
|
12
|
-
return v(
|
|
13
|
-
R(
|
|
14
|
-
P((o, n) => ({
|
|
15
|
-
...t,
|
|
16
|
-
responsiveContainerActions: {
|
|
17
|
-
setBreakpoint: (e) => {
|
|
18
|
-
o((i) => {
|
|
19
|
-
i.breakPoint = e, i.isUpSm = e !== "xs" && e !== "sm", i.isXs = e == "xs";
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
})),
|
|
24
|
-
{ name: "Responsive Relative Store" }
|
|
25
|
-
)
|
|
26
|
-
);
|
|
27
|
-
}, X = f(null), te = (r) => {
|
|
28
|
-
const {
|
|
29
|
-
children: t,
|
|
30
|
-
observedDivRef: o
|
|
31
|
-
} = r, n = T();
|
|
32
|
-
n.current || (n.current = K({
|
|
33
|
-
breakPoint: "md",
|
|
34
|
-
isUpSm: !1,
|
|
35
|
-
isXs: !1
|
|
36
|
-
}));
|
|
37
|
-
const e = () => {
|
|
38
|
-
const s = o;
|
|
39
|
-
if (s instanceof HTMLElement && s.clientWidth) {
|
|
40
|
-
const a = Object.keys(C);
|
|
41
|
-
for (let l = 0; l < a.length; l++) {
|
|
42
|
-
const g = a[l];
|
|
43
|
-
if (s.clientWidth <= C[g]) {
|
|
44
|
-
n.current?.getState().responsiveContainerActions.setBreakpoint(g);
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}, i = k(() => E.throttle(e, 200, {
|
|
50
|
-
leading: !1,
|
|
51
|
-
trailing: !0
|
|
52
|
-
}), [e]);
|
|
53
|
-
return y(() => {
|
|
54
|
-
const s = () => {
|
|
55
|
-
i();
|
|
56
|
-
}, a = o;
|
|
57
|
-
if (a && a instanceof Element) {
|
|
58
|
-
const l = new ResizeObserver((g) => {
|
|
59
|
-
s();
|
|
60
|
-
});
|
|
61
|
-
return l.observe(a), () => {
|
|
62
|
-
l.disconnect();
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
}, [o]), /* @__PURE__ */ x(X.Provider, {
|
|
66
|
-
value: n.current,
|
|
67
|
-
children: t
|
|
68
|
-
});
|
|
69
|
-
}, u = {
|
|
70
|
-
themeMode: "light",
|
|
71
|
-
themeDirection: "ltr",
|
|
72
|
-
themeColorPresets: "patronus",
|
|
73
|
-
themeLayout: "horizontal",
|
|
74
|
-
themeStretch: !1
|
|
75
|
-
};
|
|
76
|
-
function O(r, t = "m4l") {
|
|
77
|
-
const o = document.querySelector('[data-mui-color-scheme="light"]');
|
|
78
|
-
if (!o) {
|
|
79
|
-
console.error('Element with data-mui-color-scheme="light" not found.');
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
Object.keys(r).forEach((n) => {
|
|
83
|
-
const e = r[n];
|
|
84
|
-
if (typeof e == "string" || typeof e == "number") {
|
|
85
|
-
const i = `--${t}-${n}`;
|
|
86
|
-
o.style.setProperty(i, e.toString());
|
|
87
|
-
} else typeof e == "object" && e !== null && O(e, `${t}-${n}`);
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
const c = (r) => {
|
|
91
|
-
const t = r.currentThemeSettings || u;
|
|
92
|
-
console.log("getColorPresets", m(t.themeColorPresets)), console.log(
|
|
93
|
-
"getColorState",
|
|
94
|
-
d(t.themeColorPresets, t.themeMode)
|
|
95
|
-
);
|
|
96
|
-
const o = t.themeMode === "light";
|
|
97
|
-
r.themeOptions = {
|
|
98
|
-
...r.themeOptions,
|
|
99
|
-
typography: L,
|
|
100
|
-
palette: {
|
|
101
|
-
...r.themeOptions.palette,
|
|
102
|
-
...o ? S.light : S.dark,
|
|
103
|
-
primary: m(t.themeColorPresets),
|
|
104
|
-
state: d(t.themeColorPresets, t.themeMode),
|
|
105
|
-
representative: t.themeMode === "light" ? m(t.themeColorPresets)?.light : m(t.themeColorPresets)?.darker,
|
|
106
|
-
secondary: {
|
|
107
|
-
...A,
|
|
108
|
-
contrastText: "",
|
|
109
|
-
mainChannel: "",
|
|
110
|
-
lightChannel: "",
|
|
111
|
-
darkChannel: "",
|
|
112
|
-
contrastTextChannel: ""
|
|
113
|
-
},
|
|
114
|
-
common: {
|
|
115
|
-
...N,
|
|
116
|
-
black: "#000",
|
|
117
|
-
white: "#fff",
|
|
118
|
-
background: "",
|
|
119
|
-
backgroundChannel: "",
|
|
120
|
-
onBackground: "",
|
|
121
|
-
onBackgroundChannel: ""
|
|
122
|
-
},
|
|
123
|
-
error: {
|
|
124
|
-
...D,
|
|
125
|
-
contrastText: "",
|
|
126
|
-
mainChannel: "",
|
|
127
|
-
lightChannel: "",
|
|
128
|
-
darkChannel: "",
|
|
129
|
-
contrastTextChannel: ""
|
|
130
|
-
},
|
|
131
|
-
warning: {
|
|
132
|
-
...z,
|
|
133
|
-
contrastText: "",
|
|
134
|
-
mainChannel: "",
|
|
135
|
-
lightChannel: "",
|
|
136
|
-
darkChannel: "",
|
|
137
|
-
contrastTextChannel: ""
|
|
138
|
-
},
|
|
139
|
-
info: {
|
|
140
|
-
...B,
|
|
141
|
-
contrastText: "",
|
|
142
|
-
mainChannel: "",
|
|
143
|
-
lightChannel: "",
|
|
144
|
-
darkChannel: "",
|
|
145
|
-
contrastTextChannel: ""
|
|
146
|
-
},
|
|
147
|
-
success: {
|
|
148
|
-
...$,
|
|
149
|
-
contrastText: "",
|
|
150
|
-
mainChannel: "",
|
|
151
|
-
lightChannel: "",
|
|
152
|
-
darkChannel: "",
|
|
153
|
-
contrastTextChannel: ""
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
shape: { borderRadius: 8 },
|
|
157
|
-
direction: t.themeDirection,
|
|
158
|
-
shadows: o ? p.light : p.dark,
|
|
159
|
-
customShadows: {
|
|
160
|
-
primary: `0 8px 16px 0 ${I(
|
|
161
|
-
m(t.themeColorPresets)?.main || "#fff",
|
|
162
|
-
0.2
|
|
163
|
-
)}`,
|
|
164
|
-
...j(t.themeMode)
|
|
165
|
-
},
|
|
166
|
-
stretch: t.themeStretch
|
|
167
|
-
}, console.log("state.themeOptions", r.themeOptions), O(r.themeOptions);
|
|
168
|
-
}, h = (r) => {
|
|
169
|
-
r.setterThemeSettings && r.setterThemeSettings(r.currentThemeSettings);
|
|
170
|
-
}, q = (r) => v(
|
|
171
|
-
R(
|
|
172
|
-
P((t, o) => ({
|
|
173
|
-
...r,
|
|
174
|
-
settingsActions: {
|
|
175
|
-
init: () => {
|
|
176
|
-
t((n) => {
|
|
177
|
-
c(n);
|
|
178
|
-
});
|
|
179
|
-
},
|
|
180
|
-
// setThemeOptions: newObj => {
|
|
181
|
-
// set(state => {
|
|
182
|
-
// state.themeOptions = { ...state.themeOptions, ...newObj };
|
|
183
|
-
// });
|
|
184
|
-
// },
|
|
185
|
-
setThemeSettings: (n) => {
|
|
186
|
-
t((e) => {
|
|
187
|
-
e.currentThemeSettings = { ...e.currentThemeSettings, ...n }, h(e), c(e);
|
|
188
|
-
});
|
|
189
|
-
},
|
|
190
|
-
onChangeMode: (n) => {
|
|
191
|
-
t((e) => {
|
|
192
|
-
e.currentThemeSettings = {
|
|
193
|
-
...e.currentThemeSettings,
|
|
194
|
-
themeMode: n.target.value
|
|
195
|
-
}, h(e), c(e);
|
|
196
|
-
});
|
|
197
|
-
},
|
|
198
|
-
handleOpen: () => {
|
|
199
|
-
t((n) => {
|
|
200
|
-
n.open = !n.open;
|
|
201
|
-
});
|
|
202
|
-
},
|
|
203
|
-
onChangeDirection: (n) => {
|
|
204
|
-
t((e) => {
|
|
205
|
-
e.currentThemeSettings = {
|
|
206
|
-
...e.currentThemeSettings,
|
|
207
|
-
themeDirection: n.target.value
|
|
208
|
-
}, h(e), c(e);
|
|
209
|
-
});
|
|
210
|
-
},
|
|
211
|
-
onChangeColor: (n) => {
|
|
212
|
-
t((e) => {
|
|
213
|
-
e.currentThemeSettings = {
|
|
214
|
-
...e.currentThemeSettings,
|
|
215
|
-
themeColorPresets: n.target.value
|
|
216
|
-
}, h(e), c(e);
|
|
217
|
-
});
|
|
218
|
-
},
|
|
219
|
-
onChangeLayout: (n) => {
|
|
220
|
-
t((e) => {
|
|
221
|
-
e.currentThemeSettings = {
|
|
222
|
-
...e.currentThemeSettings,
|
|
223
|
-
themeLayout: n.target.value
|
|
224
|
-
}, h(e), c(e);
|
|
225
|
-
});
|
|
226
|
-
},
|
|
227
|
-
onToggleStretch: () => {
|
|
228
|
-
t((n) => {
|
|
229
|
-
n.currentThemeSettings = {
|
|
230
|
-
...n.currentThemeSettings,
|
|
231
|
-
themeStretch: !n.currentThemeSettings.themeStretch
|
|
232
|
-
}, h(n), c(n);
|
|
233
|
-
});
|
|
234
|
-
},
|
|
235
|
-
onResetSetting: () => {
|
|
236
|
-
t((n) => {
|
|
237
|
-
n.currentThemeSettings = {
|
|
238
|
-
...u
|
|
239
|
-
}, h(n), c(n);
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
})),
|
|
244
|
-
{ name: "ExampleStore" }
|
|
245
|
-
)
|
|
246
|
-
), G = f(null);
|
|
247
|
-
function ne({
|
|
248
|
-
children: r,
|
|
249
|
-
themeSettings: t
|
|
250
|
-
}) {
|
|
251
|
-
const {
|
|
252
|
-
networkOperation: o
|
|
253
|
-
} = M(), [n, e] = w("theme_setting", u), i = U([t]), s = T();
|
|
254
|
-
return s.current || (s.current = q({
|
|
255
|
-
networkOperation: o,
|
|
256
|
-
currentThemeSettings: {
|
|
257
|
-
...t ?? n
|
|
258
|
-
},
|
|
259
|
-
themeOptions: W,
|
|
260
|
-
currentPreset: _,
|
|
261
|
-
colorOption: F.map((a) => ({
|
|
262
|
-
name: a.name,
|
|
263
|
-
value: a.main
|
|
264
|
-
})),
|
|
265
|
-
open: !1,
|
|
266
|
-
setterThemeSettings: t ? void 0 : e
|
|
267
|
-
}), s.current.getState().settingsActions.init()), b(() => {
|
|
268
|
-
!i && s.current && t && s.current.getState().settingsActions.setThemeSettings(t);
|
|
269
|
-
}, [t]), /* @__PURE__ */ x(G.Provider, {
|
|
270
|
-
value: s.current,
|
|
271
|
-
children: r
|
|
272
|
-
});
|
|
273
|
-
}
|
|
274
|
-
export {
|
|
275
|
-
X as R,
|
|
276
|
-
G as T,
|
|
277
|
-
te as a,
|
|
278
|
-
ne as b,
|
|
279
|
-
u as d
|
|
280
|
-
};
|