@m4l/graphics 7.1.2 → 7.1.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.
|
@@ -1,44 +1,45 @@
|
|
|
1
|
-
import { createStore as
|
|
1
|
+
import { createStore as S } from "zustand";
|
|
2
2
|
import { devtools as a } from "zustand/middleware";
|
|
3
3
|
import { immer as d } from "zustand/middleware/immer";
|
|
4
|
-
import { getPaletteByPreset as u, createCustomShadows as
|
|
4
|
+
import { getPaletteByPreset as u, createCustomShadows as x, shadows as p, typographyOld as y, getColorPresets as m } from "@m4l/styles";
|
|
5
5
|
import { alpha as s } from "@mui/system";
|
|
6
|
-
import { d as
|
|
7
|
-
function
|
|
8
|
-
const
|
|
9
|
-
|
|
6
|
+
import { d as g } from "./constants.js";
|
|
7
|
+
function l(r, o = "m4l") {
|
|
8
|
+
const n = document.querySelector('[data-mui-color-scheme="light"]');
|
|
9
|
+
n && Object.keys(r).forEach((t) => {
|
|
10
10
|
const e = r[t];
|
|
11
11
|
if (typeof e == "string" || typeof e == "number") {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
} else typeof e == "object" && e !== null &&
|
|
12
|
+
const c = `--${o}-${t}`;
|
|
13
|
+
n.style.setProperty(c, e.toString());
|
|
14
|
+
} else typeof e == "object" && e !== null && l(e, `${o}-${t}`);
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
const
|
|
18
|
-
const o = r.themeUserSettings ||
|
|
17
|
+
const h = (r) => {
|
|
18
|
+
const o = r.themeUserSettings || g, n = o.themeMode === "light", t = u(o.themeColor), e = n ? t.light : t.dark;
|
|
19
19
|
r.themeOptions = {
|
|
20
20
|
...r.themeOptions,
|
|
21
|
-
...
|
|
21
|
+
...y,
|
|
22
22
|
palette: {
|
|
23
23
|
...r.themeOptions?.palette ?? {},
|
|
24
24
|
...e
|
|
25
25
|
},
|
|
26
26
|
shape: { borderRadius: 8 },
|
|
27
27
|
direction: o.themeDirection,
|
|
28
|
-
shadows:
|
|
28
|
+
shadows: n ? p.light : p.dark,
|
|
29
29
|
customShadows: {
|
|
30
|
-
primary:
|
|
30
|
+
primary: n ? `0 4px 8px -4px ${s(m(o.themeColor)?.enabledLight, 0.12)},
|
|
31
31
|
0 2px 27px 2px ${s(m(o.themeColor)?.enabledLight, 0.02)}` : `0 4px 8px -4px ${s(m(o.themeColor)?.enabledDark, 0.12)},
|
|
32
32
|
0 2px 27px 2px ${s(m(o.themeColor)?.enabledDark, 0.02)}`,
|
|
33
|
-
...
|
|
33
|
+
...x(o.themeMode),
|
|
34
|
+
primary2: n ? `0px 2px 3px 0px ${s(m(o.themeColor)?.hoverOpacityLight, 0.2)}` : `0px 2px 3px 0px ${s(m(o.themeColor)?.hoverOpacityDark, 0.2)}`
|
|
34
35
|
},
|
|
35
36
|
stretch: o.themeStretch
|
|
36
|
-
},
|
|
37
|
+
}, l(r.themeOptions);
|
|
37
38
|
}, i = (r) => {
|
|
38
39
|
r.themeSettingsPersistFn && r.themeSettingsPersistFn(r.themeUserSettings);
|
|
39
|
-
},
|
|
40
|
+
}, T = (r) => S(
|
|
40
41
|
a(
|
|
41
|
-
d((o,
|
|
42
|
+
d((o, n) => ({
|
|
42
43
|
...r,
|
|
43
44
|
settingsActions: {
|
|
44
45
|
/**
|
|
@@ -50,7 +51,7 @@ const n = (r) => {
|
|
|
50
51
|
*/
|
|
51
52
|
init: () => {
|
|
52
53
|
o((t) => {
|
|
53
|
-
|
|
54
|
+
h(t);
|
|
54
55
|
});
|
|
55
56
|
},
|
|
56
57
|
/**
|
|
@@ -62,7 +63,7 @@ const n = (r) => {
|
|
|
62
63
|
*/
|
|
63
64
|
setThemeSettings: (t) => {
|
|
64
65
|
o((e) => {
|
|
65
|
-
e.themeUserSettings = { ...e.themeUserSettings, ...t }, i(e),
|
|
66
|
+
e.themeUserSettings = { ...e.themeUserSettings, ...t }, i(e), h(e);
|
|
66
67
|
});
|
|
67
68
|
},
|
|
68
69
|
/**
|
|
@@ -77,7 +78,7 @@ const n = (r) => {
|
|
|
77
78
|
e.themeUserSettings = {
|
|
78
79
|
...e.themeUserSettings,
|
|
79
80
|
themeMode: t.target.value
|
|
80
|
-
}, i(e),
|
|
81
|
+
}, i(e), h(e);
|
|
81
82
|
});
|
|
82
83
|
},
|
|
83
84
|
/**
|
|
@@ -104,7 +105,7 @@ const n = (r) => {
|
|
|
104
105
|
e.themeUserSettings = {
|
|
105
106
|
...e.themeUserSettings,
|
|
106
107
|
themeDirection: t.target.value
|
|
107
|
-
}, i(e),
|
|
108
|
+
}, i(e), h(e);
|
|
108
109
|
});
|
|
109
110
|
},
|
|
110
111
|
/**
|
|
@@ -119,7 +120,7 @@ const n = (r) => {
|
|
|
119
120
|
e.themeUserSettings = {
|
|
120
121
|
...e.themeUserSettings,
|
|
121
122
|
themeColor: t.target.value
|
|
122
|
-
}, i(e),
|
|
123
|
+
}, i(e), h(e);
|
|
123
124
|
});
|
|
124
125
|
},
|
|
125
126
|
/**
|
|
@@ -134,7 +135,7 @@ const n = (r) => {
|
|
|
134
135
|
e.themeUserSettings = {
|
|
135
136
|
...e.themeUserSettings,
|
|
136
137
|
themeLayout: t.target.value
|
|
137
|
-
}, i(e),
|
|
138
|
+
}, i(e), h(e);
|
|
138
139
|
});
|
|
139
140
|
},
|
|
140
141
|
/**
|
|
@@ -149,7 +150,7 @@ const n = (r) => {
|
|
|
149
150
|
t.themeUserSettings = {
|
|
150
151
|
...t.themeUserSettings,
|
|
151
152
|
themeStretch: !t.themeUserSettings.themeStretch
|
|
152
|
-
}, i(t),
|
|
153
|
+
}, i(t), h(t);
|
|
153
154
|
});
|
|
154
155
|
},
|
|
155
156
|
/**
|
|
@@ -162,8 +163,8 @@ const n = (r) => {
|
|
|
162
163
|
onResetSetting: () => {
|
|
163
164
|
o((t) => {
|
|
164
165
|
t.themeUserSettings = {
|
|
165
|
-
...
|
|
166
|
-
}, i(t),
|
|
166
|
+
...g
|
|
167
|
+
}, i(t), h(t);
|
|
167
168
|
});
|
|
168
169
|
}
|
|
169
170
|
}
|
|
@@ -172,5 +173,5 @@ const n = (r) => {
|
|
|
172
173
|
)
|
|
173
174
|
);
|
|
174
175
|
export {
|
|
175
|
-
|
|
176
|
+
T as c
|
|
176
177
|
};
|