@m4l/graphics 7.1.3 → 7.1.4
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,3 +1,3 @@
|
|
|
1
1
|
export * from './ThemeSettingsContext';
|
|
2
|
-
export type { ThemeUserSettings as ThemeSettingsType, ThemeUserMode as ThemeMode } from './types';
|
|
2
|
+
export type { ThemeUserSettings as ThemeSettingsType, ThemeUserMode as ThemeMode, ThemeUserDirection as ThemeDirection, ThemeUserLayout as ThemeLayout, ThemeUserStretch as ThemeStretch, ThemeSettingsStore, ThemeSettingsStateWithActions, } from './types';
|
|
3
3
|
export { defaultThemeSettings } from './constants';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { createStore as
|
|
2
|
-
import { devtools as
|
|
3
|
-
import { immer as
|
|
4
|
-
import { getPaletteByPreset as u, createCustomShadows as x, shadows as p, typographyOld as
|
|
1
|
+
import { createStore as c } from "zustand";
|
|
2
|
+
import { devtools as d } from "zustand/middleware";
|
|
3
|
+
import { immer as a } from "zustand/middleware/immer";
|
|
4
|
+
import { getPaletteByPreset as u, createCustomShadows as x, shadows as p, typographyOld as U, getColorPresets as m } from "@m4l/styles";
|
|
5
5
|
import { alpha as s } from "@mui/system";
|
|
6
6
|
import { d as g } from "./constants.js";
|
|
7
7
|
function l(r, o = "m4l") {
|
|
@@ -9,8 +9,8 @@ function l(r, o = "m4l") {
|
|
|
9
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
|
-
n.style.setProperty(
|
|
12
|
+
const S = `--${o}-${t}`;
|
|
13
|
+
n.style.setProperty(S, e.toString());
|
|
14
14
|
} else typeof e == "object" && e !== null && l(e, `${o}-${t}`);
|
|
15
15
|
});
|
|
16
16
|
}
|
|
@@ -18,7 +18,7 @@ const h = (r) => {
|
|
|
18
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
|
+
...U,
|
|
22
22
|
palette: {
|
|
23
23
|
...r.themeOptions?.palette ?? {},
|
|
24
24
|
...e
|
|
@@ -37,9 +37,9 @@ const h = (r) => {
|
|
|
37
37
|
}, l(r.themeOptions);
|
|
38
38
|
}, i = (r) => {
|
|
39
39
|
r.themeSettingsPersistFn && r.themeSettingsPersistFn(r.themeUserSettings);
|
|
40
|
-
}, T = (r) =>
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
}, T = (r) => c(
|
|
41
|
+
d(
|
|
42
|
+
a((o, n) => ({
|
|
43
43
|
...r,
|
|
44
44
|
settingsActions: {
|
|
45
45
|
/**
|
|
@@ -75,10 +75,10 @@ const h = (r) => {
|
|
|
75
75
|
*/
|
|
76
76
|
onChangeMode: (t) => {
|
|
77
77
|
o((e) => {
|
|
78
|
-
e.themeUserSettings = {
|
|
78
|
+
t !== e.themeUserSettings.themeMode && (e.themeUserSettings = {
|
|
79
79
|
...e.themeUserSettings,
|
|
80
|
-
themeMode: t
|
|
81
|
-
}, i(e), h(e);
|
|
80
|
+
themeMode: t
|
|
81
|
+
}, i(e), h(e));
|
|
82
82
|
});
|
|
83
83
|
},
|
|
84
84
|
/**
|
|
@@ -102,10 +102,10 @@ const h = (r) => {
|
|
|
102
102
|
*/
|
|
103
103
|
onChangeDirection: (t) => {
|
|
104
104
|
o((e) => {
|
|
105
|
-
e.themeUserSettings = {
|
|
105
|
+
t !== e.themeUserSettings.themeDirection && (e.themeUserSettings = {
|
|
106
106
|
...e.themeUserSettings,
|
|
107
|
-
themeDirection: t
|
|
108
|
-
}, i(e), h(e);
|
|
107
|
+
themeDirection: t
|
|
108
|
+
}, i(e), h(e));
|
|
109
109
|
});
|
|
110
110
|
},
|
|
111
111
|
/**
|
|
@@ -117,10 +117,10 @@ const h = (r) => {
|
|
|
117
117
|
*/
|
|
118
118
|
onChangeColor: (t) => {
|
|
119
119
|
o((e) => {
|
|
120
|
-
e.themeUserSettings = {
|
|
120
|
+
t !== e.themeUserSettings.themeColor && (e.themeUserSettings = {
|
|
121
121
|
...e.themeUserSettings,
|
|
122
|
-
themeColor: t
|
|
123
|
-
}, i(e), h(e);
|
|
122
|
+
themeColor: t
|
|
123
|
+
}, i(e), h(e));
|
|
124
124
|
});
|
|
125
125
|
},
|
|
126
126
|
/**
|
|
@@ -54,9 +54,9 @@ export interface ThemeSettingsStateWithActions extends ThemeSettingsStore {
|
|
|
54
54
|
init: () => void;
|
|
55
55
|
onToggleStretch: VoidFunction;
|
|
56
56
|
onResetSetting: VoidFunction;
|
|
57
|
-
onChangeMode: (
|
|
58
|
-
onChangeDirection: (
|
|
59
|
-
onChangeColor: (
|
|
57
|
+
onChangeMode: (mode: ThemeUserMode) => void;
|
|
58
|
+
onChangeDirection: (direction: ThemeUserDirection) => void;
|
|
59
|
+
onChangeColor: (color: ThemeUserColor) => void;
|
|
60
60
|
onChangeLayout: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
61
61
|
handleOpen: () => void;
|
|
62
62
|
setThemeSettings: (newValue: Partial<ThemeUserSettings>) => void;
|