@maz-ui/themes 4.1.7-beta.0 → 4.1.7-beta.5
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/README.md +19 -15
- package/dist/build/index.js +48 -46
- package/dist/chunks/isServer.BAlEcRRr.js +6 -0
- package/dist/composables/index.js +3 -4
- package/dist/composables/useTheme.js +89 -147
- package/dist/define-preset.js +7 -7
- package/dist/index.js +33 -35
- package/dist/plugin/index.js +4 -2
- package/dist/plugin.js +114 -37
- package/dist/presets/index.js +8 -8
- package/dist/presets/mazUi.js +2 -2
- package/dist/presets/obsidian.js +2 -2
- package/dist/presets/ocean.js +2 -2
- package/dist/presets/pristine.js +2 -2
- package/dist/types/build/index.d.ts +7 -4
- package/dist/types/build/index.d.ts.map +1 -1
- package/dist/types/composables/useTheme.d.ts +49 -8
- package/dist/types/composables/useTheme.d.ts.map +1 -1
- package/dist/types/plugin.d.ts +7 -6
- package/dist/types/plugin.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +41 -3
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/utils/cookie-storage.d.ts.map +1 -1
- package/dist/types/utils/css-generator.d.ts +12 -22
- package/dist/types/utils/css-generator.d.ts.map +1 -1
- package/dist/types/utils/get-color-mode.d.ts +2 -1
- package/dist/types/utils/get-color-mode.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +2 -0
- package/dist/types/utils/index.d.ts.map +1 -1
- package/dist/types/utils/no-transition.d.ts +2 -0
- package/dist/types/utils/no-transition.d.ts.map +1 -0
- package/dist/types/utils/update-document-class.d.ts +3 -0
- package/dist/types/utils/update-document-class.d.ts.map +1 -0
- package/dist/utils/color-utils.js +41 -41
- package/dist/utils/cookie-storage.js +9 -8
- package/dist/utils/css-generator.js +120 -143
- package/dist/utils/get-color-mode.js +17 -10
- package/dist/utils/get-preset.js +20 -20
- package/dist/utils/index.js +24 -21
- package/dist/utils/no-transition.js +18 -0
- package/dist/utils/preset-merger.js +21 -21
- package/dist/utils/update-document-class.js +9 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -23,14 +23,15 @@ npm install @maz-ui/themes
|
|
|
23
23
|
### 1. Plugin installation
|
|
24
24
|
|
|
25
25
|
```typescript
|
|
26
|
-
import { MazUiTheme } from '@maz-ui/themes'
|
|
27
26
|
// main.ts
|
|
27
|
+
import { MazUiTheme } from '@maz-ui/themes/plugin'
|
|
28
|
+
import { mazUi } from '@maz-ui/themes/presets/mazUi'
|
|
28
29
|
import { createApp } from 'vue'
|
|
29
30
|
|
|
30
31
|
const app = createApp(App)
|
|
31
32
|
|
|
32
33
|
app.use(MazUiTheme, {
|
|
33
|
-
preset:
|
|
34
|
+
preset: mazUi,
|
|
34
35
|
strategy: 'hybrid',
|
|
35
36
|
darkModeStrategy: 'class'
|
|
36
37
|
})
|
|
@@ -40,9 +41,9 @@ app.use(MazUiTheme, {
|
|
|
40
41
|
|
|
41
42
|
```vue
|
|
42
43
|
<script setup>
|
|
43
|
-
import {
|
|
44
|
+
import { useTheme } from '@maz-ui/themes'
|
|
44
45
|
|
|
45
|
-
const { toggleDarkMode, isDark } =
|
|
46
|
+
const { toggleDarkMode, isDark } = useTheme()
|
|
46
47
|
</script>
|
|
47
48
|
|
|
48
49
|
<template>
|
|
@@ -59,28 +60,28 @@ const { toggleDarkMode, isDark } = useMazTheme()
|
|
|
59
60
|
|
|
60
61
|
## Available presets
|
|
61
62
|
|
|
62
|
-
### Default
|
|
63
|
+
### Default
|
|
63
64
|
|
|
64
65
|
```typescript
|
|
65
|
-
import { mazUi } from '@maz-ui/themes'
|
|
66
|
+
import { mazUi } from '@maz-ui/themes/presets/mazUi'
|
|
66
67
|
```
|
|
67
68
|
|
|
68
|
-
###
|
|
69
|
+
### Pristine
|
|
69
70
|
|
|
70
71
|
```typescript
|
|
71
|
-
import {
|
|
72
|
+
import { pristine } from '@maz-ui/themes/presets/pristine'
|
|
72
73
|
```
|
|
73
74
|
|
|
74
75
|
### Ocean
|
|
75
76
|
|
|
76
77
|
```typescript
|
|
77
|
-
import { ocean } from '@maz-ui/themes'
|
|
78
|
+
import { ocean } from '@maz-ui/themes/presets/ocean'
|
|
78
79
|
```
|
|
79
80
|
|
|
80
81
|
### Obsidian
|
|
81
82
|
|
|
82
83
|
```typescript
|
|
83
|
-
import { obsidian } from '@maz-ui/themes'
|
|
84
|
+
import { obsidian } from '@maz-ui/themes/presets/obsidian'
|
|
84
85
|
```
|
|
85
86
|
|
|
86
87
|
## Creating custom presets
|
|
@@ -110,15 +111,18 @@ const myPreset = definePreset({
|
|
|
110
111
|
## Composable API
|
|
111
112
|
|
|
112
113
|
```typescript
|
|
114
|
+
import { useTheme } from '@maz-ui/themes'
|
|
115
|
+
|
|
113
116
|
const {
|
|
114
|
-
|
|
117
|
+
preset, // ComputedRef<ThemePreset>
|
|
118
|
+
presetName, // ComputedRef<string>
|
|
115
119
|
colorMode, // Ref<'light' | 'dark' | 'auto'>
|
|
116
|
-
isDark, //
|
|
117
|
-
strategy, //
|
|
120
|
+
isDark, // ComputedRef<boolean>
|
|
121
|
+
strategy, // ComputedRef<'runtime' | 'build' | 'hybrid'>
|
|
118
122
|
updateTheme, // (preset: ThemePreset | ThemePresetName | ThemePresetOverrides) => void
|
|
119
123
|
setColorMode, // (mode: 'light' | 'dark' | 'auto') => void
|
|
120
|
-
toggleDarkMode // () => void
|
|
121
|
-
} =
|
|
124
|
+
toggleDarkMode, // () => void
|
|
125
|
+
} = useTheme()
|
|
122
126
|
```
|
|
123
127
|
|
|
124
128
|
## Strategies
|
package/dist/build/index.js
CHANGED
|
@@ -1,56 +1,58 @@
|
|
|
1
|
-
import {
|
|
2
|
-
function
|
|
1
|
+
import { generateCSS } from "../utils/css-generator.js";
|
|
2
|
+
function buildThemeCSS(options) {
|
|
3
3
|
const {
|
|
4
|
-
preset
|
|
5
|
-
mode
|
|
6
|
-
darkSelector
|
|
7
|
-
prefix
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
4
|
+
preset,
|
|
5
|
+
mode = "both",
|
|
6
|
+
darkSelector = "class",
|
|
7
|
+
prefix = "maz",
|
|
8
|
+
darkClass = "dark",
|
|
9
|
+
criticalOnly = !1
|
|
10
|
+
} = options, cssOptions = {
|
|
11
|
+
mode,
|
|
12
|
+
darkSelectorStrategy: darkSelector,
|
|
13
|
+
prefix,
|
|
14
|
+
darkClass
|
|
15
|
+
}, criticalCSS = generateCSS(preset, { ...cssOptions, onlyCritical: !0 });
|
|
16
|
+
if (criticalOnly)
|
|
17
|
+
return criticalCSS;
|
|
18
|
+
const fullCSS = generateCSS(preset, cssOptions);
|
|
19
|
+
return `${criticalCSS}
|
|
20
|
+
${fullCSS}`;
|
|
19
21
|
}
|
|
20
|
-
function
|
|
22
|
+
function generateThemeBundle(presets, options = {}) {
|
|
21
23
|
const {
|
|
22
|
-
mode
|
|
23
|
-
darkSelector
|
|
24
|
-
prefix
|
|
25
|
-
criticalOnly
|
|
26
|
-
} =
|
|
27
|
-
return
|
|
28
|
-
preset
|
|
29
|
-
mode
|
|
30
|
-
darkSelector
|
|
31
|
-
prefix
|
|
32
|
-
criticalOnly
|
|
33
|
-
}),
|
|
24
|
+
mode = "both",
|
|
25
|
+
darkSelector = "class",
|
|
26
|
+
prefix = "maz",
|
|
27
|
+
criticalOnly = !1
|
|
28
|
+
} = options;
|
|
29
|
+
return presets.reduce((bundle, preset) => (bundle[preset.name] = buildThemeCSS({
|
|
30
|
+
preset,
|
|
31
|
+
mode,
|
|
32
|
+
darkSelector,
|
|
33
|
+
prefix,
|
|
34
|
+
criticalOnly
|
|
35
|
+
}), bundle), {});
|
|
34
36
|
}
|
|
35
|
-
function
|
|
36
|
-
const { id
|
|
37
|
-
let
|
|
38
|
-
return
|
|
39
|
-
${
|
|
40
|
-
</style>`,
|
|
37
|
+
function createThemeStylesheet(css, options = {}) {
|
|
38
|
+
const { id = "maz-theme", media } = options;
|
|
39
|
+
let styleTag = `<style id="${id}"`;
|
|
40
|
+
return media && (styleTag += ` media="${media}"`), styleTag += `>
|
|
41
|
+
${css}
|
|
42
|
+
</style>`, styleTag;
|
|
41
43
|
}
|
|
42
|
-
function
|
|
43
|
-
const { prefix
|
|
44
|
+
function buildSeparateThemeFiles(preset, options = {}) {
|
|
45
|
+
const { prefix = "maz", darkSelector = "class", darkClass = "dark" } = options, baseOptions = { prefix, darkSelectorStrategy: darkSelector, darkClass };
|
|
44
46
|
return {
|
|
45
|
-
critical:
|
|
46
|
-
full:
|
|
47
|
-
lightOnly:
|
|
48
|
-
darkOnly:
|
|
47
|
+
critical: generateCSS(preset, { ...baseOptions, mode: "both", onlyCritical: !0 }),
|
|
48
|
+
full: generateCSS(preset, { ...baseOptions, mode: "both" }),
|
|
49
|
+
lightOnly: buildThemeCSS({ preset, mode: "light", ...options }),
|
|
50
|
+
darkOnly: buildThemeCSS({ preset, mode: "dark", ...options })
|
|
49
51
|
};
|
|
50
52
|
}
|
|
51
53
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
buildSeparateThemeFiles,
|
|
55
|
+
buildThemeCSS,
|
|
56
|
+
createThemeStylesheet,
|
|
57
|
+
generateThemeBundle
|
|
56
58
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "../chunks/isServer.BAlEcRRr.js";
|
|
2
2
|
import "vue";
|
|
3
3
|
import "../utils/cookie-storage.js";
|
|
4
4
|
import "../utils/css-generator.js";
|
|
5
|
-
import "../utils/get-color-mode.js";
|
|
6
5
|
import "../utils/get-preset.js";
|
|
7
6
|
import "../utils/preset-merger.js";
|
|
7
|
+
import { useTheme } from "./useTheme.js";
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
a as useTheme
|
|
9
|
+
useTheme
|
|
11
10
|
};
|
|
@@ -1,165 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { getPreset
|
|
6
|
-
import { mergePresets
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function R(e) {
|
|
14
|
-
return !!e;
|
|
15
|
-
}
|
|
16
|
-
function U(e, o, r = {}) {
|
|
17
|
-
const {
|
|
18
|
-
internalWindow: u = F() ? globalThis : void 0,
|
|
19
|
-
...c
|
|
20
|
-
} = r;
|
|
21
|
-
let n;
|
|
22
|
-
const d = f(!1);
|
|
23
|
-
k(() => {
|
|
24
|
-
d.value = (u && "MutationObserver" in u) ?? !1;
|
|
25
|
-
});
|
|
26
|
-
const m = () => {
|
|
27
|
-
n && (n.disconnect(), n = void 0);
|
|
28
|
-
}, b = s(() => {
|
|
29
|
-
const a = w(e);
|
|
30
|
-
let i;
|
|
31
|
-
return a && "$el" in a ? i = a.$el : a && (i = a), new Set([i].filter(R));
|
|
32
|
-
}), P = y(
|
|
33
|
-
b,
|
|
34
|
-
(a) => {
|
|
35
|
-
m(), d.value && a.size && (n = new MutationObserver(o), a.forEach((i) => n.observe(i, c)));
|
|
36
|
-
},
|
|
37
|
-
{ immediate: !0, flush: "post" }
|
|
38
|
-
);
|
|
39
|
-
return {
|
|
40
|
-
isSupported: d,
|
|
41
|
-
stop: () => {
|
|
42
|
-
P(), m();
|
|
43
|
-
},
|
|
44
|
-
takeRecords: () => n?.takeRecords()
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const t = f();
|
|
48
|
-
function S(e) {
|
|
49
|
-
typeof document > "u" || !e || e.darkModeStrategy === "media" || e.mode === "light" || (e.isDark ? document.documentElement.classList.add("dark") : document.documentElement.classList.remove("dark"));
|
|
50
|
-
}
|
|
51
|
-
function j() {
|
|
52
|
-
const e = M()?.appContext.app;
|
|
53
|
-
e && t.value && (e.config.globalProperties.$mazThemeState = t.value);
|
|
54
|
-
}
|
|
55
|
-
function N(e) {
|
|
56
|
-
if (e.currentPreset && e.colorMode !== void 0) {
|
|
57
|
-
g({
|
|
58
|
-
currentPreset: e.currentPreset,
|
|
59
|
-
colorMode: e.colorMode,
|
|
60
|
-
mode: e.mode,
|
|
61
|
-
isDark: e.isDark,
|
|
62
|
-
strategy: e.strategy,
|
|
63
|
-
darkModeStrategy: e.darkModeStrategy
|
|
64
|
-
});
|
|
1
|
+
import { i as isServer } from "../chunks/isServer.BAlEcRRr.js";
|
|
2
|
+
import { ref, computed, inject, getCurrentInstance } from "vue";
|
|
3
|
+
import { setCookie } from "../utils/cookie-storage.js";
|
|
4
|
+
import { generateCSS, injectCSS, CSS_ID } from "../utils/css-generator.js";
|
|
5
|
+
import { getPreset } from "../utils/get-preset.js";
|
|
6
|
+
import { mergePresets } from "../utils/preset-merger.js";
|
|
7
|
+
const themeState = ref(), colorMode = computed({
|
|
8
|
+
get: () => themeState.value?.colorMode,
|
|
9
|
+
set: (mode2) => setColorMode(mode2)
|
|
10
|
+
}), isDark = computed(() => themeState.value?.isDark || !1), strategy = computed(() => themeState.value?.strategy), mode = computed(() => themeState.value?.mode), darkModeStrategy = computed(() => themeState.value?.darkModeStrategy), preset = computed(() => themeState.value?.preset), presetName = computed(() => preset.value?.name);
|
|
11
|
+
async function updateTheme(preset2) {
|
|
12
|
+
if (!themeState.value)
|
|
65
13
|
return;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
g({
|
|
69
|
-
currentPreset: e.currentPreset,
|
|
70
|
-
colorMode: o,
|
|
71
|
-
mode: e.mode,
|
|
72
|
-
isDark: r,
|
|
73
|
-
strategy: e.strategy,
|
|
74
|
-
darkModeStrategy: e.darkModeStrategy
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
function g(e) {
|
|
78
|
-
if (t.value = e, typeof globalThis.window < "u" && t.value.colorMode === "auto") {
|
|
79
|
-
const o = globalThis.matchMedia("(prefers-color-scheme: dark)"), r = () => {
|
|
80
|
-
t.value && t.value.colorMode === "auto" && (t.value.isDark = o.matches);
|
|
81
|
-
};
|
|
82
|
-
o.addEventListener("change", r), r();
|
|
83
|
-
}
|
|
84
|
-
T(() => {
|
|
85
|
-
t.value && (S(t.value), j());
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
const W = s({
|
|
89
|
-
get: () => t.value?.colorMode,
|
|
90
|
-
set: (e) => l(e)
|
|
91
|
-
}), _ = s(() => t.value?.isDark ?? !1), A = s(() => t.value?.strategy), G = s(() => t.value?.mode), Q = s(() => t.value?.darkModeStrategy), h = s(() => t.value?.currentPreset), V = s(() => h.value?.name);
|
|
92
|
-
async function Y(e) {
|
|
93
|
-
if (!t.value)
|
|
94
|
-
return;
|
|
95
|
-
const o = typeof e == "string" ? await O(e) : e;
|
|
96
|
-
if (!o || !t.value.currentPreset) {
|
|
14
|
+
const _preset = typeof preset2 == "string" ? await getPreset(preset2) : preset2;
|
|
15
|
+
if (!_preset || !themeState.value.preset) {
|
|
97
16
|
console.error("[@maz-ui/themes] No preset found - If you are using the buildtime strategy, you must provide a complete preset");
|
|
98
17
|
return;
|
|
99
18
|
}
|
|
100
|
-
const
|
|
101
|
-
if (
|
|
102
|
-
const
|
|
103
|
-
mode:
|
|
104
|
-
darkSelectorStrategy:
|
|
105
|
-
prefix: "maz"
|
|
106
|
-
|
|
107
|
-
|
|
19
|
+
const newPreset = "name" in _preset && _preset.name !== themeState.value.preset.name ? _preset : mergePresets(themeState.value.preset, _preset);
|
|
20
|
+
if (themeState.value.preset = newPreset, themeState.value.strategy === "runtime" || themeState.value.strategy === "hybrid") {
|
|
21
|
+
const cssOptions = {
|
|
22
|
+
mode: themeState.value.mode,
|
|
23
|
+
darkSelectorStrategy: themeState.value.darkModeStrategy,
|
|
24
|
+
prefix: "maz",
|
|
25
|
+
darkClass: themeState.value.darkClass
|
|
26
|
+
}, fullCSS = generateCSS(newPreset, cssOptions);
|
|
27
|
+
injectCSS(CSS_ID, fullCSS);
|
|
108
28
|
}
|
|
109
29
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
30
|
+
function setColorMode(colorMode2) {
|
|
31
|
+
themeState.value && (themeState.value.colorMode = colorMode2, setCookie("maz-color-mode", colorMode2));
|
|
112
32
|
}
|
|
113
|
-
function
|
|
114
|
-
|
|
33
|
+
function toggleDarkMode() {
|
|
34
|
+
setColorMode(isDark.value ? "light" : "dark");
|
|
115
35
|
}
|
|
116
|
-
function
|
|
117
|
-
|
|
118
|
-
k(() => {
|
|
119
|
-
e.value = document.documentElement;
|
|
120
|
-
}), U(
|
|
121
|
-
e,
|
|
122
|
-
() => {
|
|
123
|
-
if (D() || !t.value)
|
|
124
|
-
return;
|
|
125
|
-
const r = document.documentElement.classList.contains("dark") ? "dark" : "light";
|
|
126
|
-
t.value.colorMode !== r && l(r, !1);
|
|
127
|
-
},
|
|
128
|
-
{
|
|
129
|
-
attributes: !0
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
let o;
|
|
36
|
+
function setThemeStateFromGlobalProperties() {
|
|
37
|
+
themeState.value = void 0;
|
|
133
38
|
try {
|
|
134
|
-
|
|
39
|
+
const injectedState = inject("mazThemeState", void 0);
|
|
40
|
+
if (themeState.value = injectedState?.value, !themeState.value)
|
|
135
41
|
throw new Error("mazThemeState not found");
|
|
136
42
|
} catch {
|
|
137
|
-
const
|
|
138
|
-
|
|
43
|
+
const instance = getCurrentInstance();
|
|
44
|
+
instance?.appContext?.app?.config?.globalProperties && (themeState.value = instance.appContext.app.config.globalProperties.$mazThemeState.value);
|
|
139
45
|
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}) : N(o)), y(() => o?.currentPreset, (r) => {
|
|
144
|
-
t.value && r && (t.value.currentPreset = r);
|
|
145
|
-
}, {
|
|
146
|
-
once: !0
|
|
147
|
-
}), !t.value)
|
|
46
|
+
}
|
|
47
|
+
function useTheme() {
|
|
48
|
+
if (isServer() && (themeState.value = void 0), themeState.value || setThemeStateFromGlobalProperties(), !themeState.value)
|
|
148
49
|
throw new Error("[@maz-ui/themes] You must install the MazUi or MazUiTheme plugin before using useTheme composable");
|
|
149
50
|
return {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
51
|
+
/**
|
|
52
|
+
* Current theme preset
|
|
53
|
+
*/
|
|
54
|
+
preset,
|
|
55
|
+
/**
|
|
56
|
+
* Current theme name
|
|
57
|
+
*/
|
|
58
|
+
presetName,
|
|
59
|
+
/**
|
|
60
|
+
* Current color mode
|
|
61
|
+
* @description The color mode - Can be 'auto', 'dark' or 'light'
|
|
62
|
+
*/
|
|
63
|
+
colorMode,
|
|
64
|
+
/**
|
|
65
|
+
* Whether the current color mode is dark
|
|
66
|
+
*/
|
|
67
|
+
isDark,
|
|
68
|
+
/**
|
|
69
|
+
* Strategy used to apply the theme
|
|
70
|
+
*/
|
|
71
|
+
strategy,
|
|
72
|
+
/**
|
|
73
|
+
* Update the theme
|
|
74
|
+
* @param preset The new theme preset
|
|
75
|
+
* @description Update the theme with a new preset or override some tokens
|
|
76
|
+
*/
|
|
77
|
+
updateTheme,
|
|
78
|
+
/**
|
|
79
|
+
* Set the color mode
|
|
80
|
+
* @description Set the color mode - Can be 'auto', 'dark' or 'light'
|
|
81
|
+
* @param colorMode The new color mode
|
|
82
|
+
*/
|
|
83
|
+
setColorMode,
|
|
84
|
+
/**
|
|
85
|
+
* Toggle the dark mode
|
|
86
|
+
* @description Toggle the dark mode
|
|
87
|
+
*/
|
|
88
|
+
toggleDarkMode,
|
|
89
|
+
/**
|
|
90
|
+
* Mode
|
|
91
|
+
* @description Supported themes - Can be 'both', 'light' or 'dark'
|
|
92
|
+
*/
|
|
93
|
+
mode,
|
|
94
|
+
/**
|
|
95
|
+
* Dark mode strategy
|
|
96
|
+
* @description Strategy used to apply the dark mode - Can be 'class' or 'media'
|
|
97
|
+
*/
|
|
98
|
+
darkModeStrategy,
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated use `preset` instead
|
|
101
|
+
*/
|
|
102
|
+
currentPreset: preset
|
|
160
103
|
};
|
|
161
104
|
}
|
|
162
105
|
export {
|
|
163
|
-
|
|
164
|
-
oe as useTheme
|
|
106
|
+
useTheme
|
|
165
107
|
};
|
package/dist/define-preset.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { mergePresets
|
|
2
|
-
import { getPreset
|
|
3
|
-
function
|
|
4
|
-
base
|
|
5
|
-
overrides
|
|
1
|
+
import { mergePresets } from "./utils/preset-merger.js";
|
|
2
|
+
import { getPreset } from "./utils/get-preset.js";
|
|
3
|
+
function definePreset({
|
|
4
|
+
base = "maz-ui",
|
|
5
|
+
overrides = {}
|
|
6
6
|
}) {
|
|
7
|
-
return typeof
|
|
7
|
+
return typeof base == "string" ? getPreset(base).then((basePreset) => mergePresets(basePreset, overrides)) : mergePresets(base, overrides);
|
|
8
8
|
}
|
|
9
9
|
export {
|
|
10
|
-
|
|
10
|
+
definePreset
|
|
11
11
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
|
-
import { buildSeparateThemeFiles
|
|
2
|
-
import {
|
|
3
|
-
import { definePreset
|
|
4
|
-
import { MazUiTheme
|
|
5
|
-
import { adjustColorLightness
|
|
6
|
-
import {
|
|
7
|
-
import { deepMerge
|
|
8
|
-
import { mazUi
|
|
9
|
-
import { obsidian
|
|
10
|
-
import { ocean
|
|
11
|
-
import { pristine
|
|
1
|
+
import { buildSeparateThemeFiles, buildThemeCSS, createThemeStylesheet, generateThemeBundle } from "./build/index.js";
|
|
2
|
+
import { useTheme } from "./composables/useTheme.js";
|
|
3
|
+
import { definePreset } from "./define-preset.js";
|
|
4
|
+
import { MazUiTheme } from "./plugin.js";
|
|
5
|
+
import { adjustColorLightness, formatHSL, generateColorScale, getContrastColor, parseHSL } from "./utils/color-utils.js";
|
|
6
|
+
import { CSS_ID, generateCSS, injectCSS, removeCSS } from "./utils/css-generator.js";
|
|
7
|
+
import { deepMerge, mergePresets } from "./utils/preset-merger.js";
|
|
8
|
+
import { mazUi } from "./presets/mazUi.js";
|
|
9
|
+
import { obsidian } from "./presets/obsidian.js";
|
|
10
|
+
import { ocean } from "./presets/ocean.js";
|
|
11
|
+
import { pristine } from "./presets/pristine.js";
|
|
12
12
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
z as removeCSS,
|
|
36
|
-
p as useTheme
|
|
13
|
+
CSS_ID,
|
|
14
|
+
MazUiTheme,
|
|
15
|
+
adjustColorLightness,
|
|
16
|
+
buildSeparateThemeFiles,
|
|
17
|
+
buildThemeCSS,
|
|
18
|
+
createThemeStylesheet,
|
|
19
|
+
deepMerge,
|
|
20
|
+
definePreset,
|
|
21
|
+
formatHSL,
|
|
22
|
+
generateCSS,
|
|
23
|
+
generateColorScale,
|
|
24
|
+
generateThemeBundle,
|
|
25
|
+
getContrastColor,
|
|
26
|
+
injectCSS,
|
|
27
|
+
mazUi,
|
|
28
|
+
mergePresets,
|
|
29
|
+
obsidian,
|
|
30
|
+
ocean,
|
|
31
|
+
parseHSL,
|
|
32
|
+
pristine,
|
|
33
|
+
removeCSS,
|
|
34
|
+
useTheme
|
|
37
35
|
};
|
package/dist/plugin/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import "../chunks/isServer.BAlEcRRr.js";
|
|
1
2
|
import "vue";
|
|
3
|
+
import { MazUiTheme } from "../plugin.js";
|
|
2
4
|
import "../utils/css-generator.js";
|
|
3
5
|
import "../utils/get-color-mode.js";
|
|
6
|
+
import "../utils/update-document-class.js";
|
|
4
7
|
import "../utils/get-preset.js";
|
|
5
8
|
import "../utils/preset-merger.js";
|
|
6
|
-
import { MazUiTheme as a } from "../plugin.js";
|
|
7
9
|
export {
|
|
8
|
-
|
|
10
|
+
MazUiTheme
|
|
9
11
|
};
|