@maz-ui/nuxt 4.9.1-beta.2 → 4.9.1-beta.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.
- package/dist/module.json +1 -1
- package/dist/runtime/plugins/aos.d.ts +1 -1
- package/dist/runtime/plugins/aos.js +2 -2
- package/dist/runtime/plugins/dialog.d.ts +1 -1
- package/dist/runtime/plugins/dialog.js +21 -15
- package/dist/runtime/plugins/theme.js +3 -10
- package/dist/runtime/plugins/toast.d.ts +1 -1
- package/dist/runtime/plugins/toast.js +24 -18
- package/dist/runtime/plugins/wait.d.ts +1 -1
- package/dist/runtime/plugins/wait.js +19 -12
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { AosHandler, AosPlugin } from "maz-ui/plugins/aos";
|
|
2
1
|
import { defineNuxtPlugin, useRouter } from "nuxt/app";
|
|
3
|
-
export default defineNuxtPlugin(({ $config, vueApp }) => {
|
|
2
|
+
export default defineNuxtPlugin(async ({ $config, vueApp }) => {
|
|
3
|
+
const { AosHandler, AosPlugin } = await import("maz-ui/plugins/aos");
|
|
4
4
|
const aosOptions = $config.public.mazUi?.plugins?.aos;
|
|
5
5
|
const options = typeof aosOptions === "object" ? { ...aosOptions, router: aosOptions.router ? useRouter() : void 0 } : {};
|
|
6
6
|
vueApp.use(AosPlugin, options);
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
import { DialogHandler } from "maz-ui/plugins/dialog";
|
|
2
1
|
import { defineNuxtPlugin } from "nuxt/app";
|
|
3
|
-
|
|
2
|
+
const dialogServer = {
|
|
3
|
+
open: () => {
|
|
4
|
+
return {
|
|
5
|
+
promise: Promise.resolve(),
|
|
6
|
+
destroy: () => {
|
|
7
|
+
},
|
|
8
|
+
close: () => {
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
export default defineNuxtPlugin(async ({ vueApp, $config }) => {
|
|
14
|
+
if (import.meta.server) {
|
|
15
|
+
return {
|
|
16
|
+
provide: {
|
|
17
|
+
mazDialog: dialogServer
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
const { DialogHandler } = await import("maz-ui/plugins/dialog");
|
|
4
22
|
const dialogOptions = $config.public.mazUi?.plugins?.dialog;
|
|
5
23
|
const options = typeof dialogOptions === "object" ? dialogOptions : void 0;
|
|
6
|
-
const instance = new DialogHandler(vueApp, options);
|
|
7
|
-
const dialogServer = {
|
|
8
|
-
open: () => {
|
|
9
|
-
return {
|
|
10
|
-
promise: Promise.resolve(),
|
|
11
|
-
destroy: () => {
|
|
12
|
-
},
|
|
13
|
-
close: () => {
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
24
|
return {
|
|
19
25
|
provide: {
|
|
20
|
-
mazDialog:
|
|
26
|
+
mazDialog: new DialogHandler(vueApp, options)
|
|
21
27
|
}
|
|
22
28
|
};
|
|
23
29
|
});
|
|
@@ -16,14 +16,7 @@ function getSavedResolvedColorMode() {
|
|
|
16
16
|
}
|
|
17
17
|
return void 0;
|
|
18
18
|
}
|
|
19
|
-
function getInitialColorMode(
|
|
20
|
-
if (colorMode && ["light", "dark"].includes(colorMode)) {
|
|
21
|
-
return colorMode;
|
|
22
|
-
}
|
|
23
|
-
const savedColorMode = getSavedColorMode();
|
|
24
|
-
if (savedColorMode && ["light", "dark"].includes(savedColorMode)) {
|
|
25
|
-
return savedColorMode;
|
|
26
|
-
}
|
|
19
|
+
function getInitialColorMode() {
|
|
27
20
|
const resolvedColorMode = getSavedResolvedColorMode();
|
|
28
21
|
if (resolvedColorMode) {
|
|
29
22
|
return resolvedColorMode;
|
|
@@ -83,16 +76,16 @@ export default defineNuxtPlugin(async ({ vueApp, $config }) => {
|
|
|
83
76
|
strategy: "hybrid",
|
|
84
77
|
darkClass: "dark",
|
|
85
78
|
darkModeStrategy: "class",
|
|
86
|
-
colorMode: getSavedColorMode() ?? options.colorMode ?? "auto",
|
|
87
79
|
mode: "both",
|
|
88
80
|
injectAllCSSOnServer: false,
|
|
89
81
|
injectCriticalCSS: true,
|
|
90
82
|
injectFullCSS: true,
|
|
91
83
|
overrides: {},
|
|
92
84
|
...options,
|
|
85
|
+
colorMode: getSavedColorMode() ?? options?.colorMode ?? "auto",
|
|
93
86
|
preset
|
|
94
87
|
};
|
|
95
|
-
const isDark = config.colorMode === "auto" && config.mode === "both" ? getInitialColorMode(
|
|
88
|
+
const isDark = config.colorMode === "auto" && config.mode === "both" ? getInitialColorMode() === "dark" : config.colorMode === "dark" || config.mode === "dark";
|
|
96
89
|
if (isDark && config.darkModeStrategy === "class") {
|
|
97
90
|
useHead({
|
|
98
91
|
htmlAttrs: {
|
|
@@ -1,26 +1,32 @@
|
|
|
1
|
-
import { ToastHandler } from "maz-ui/plugins/toast";
|
|
2
1
|
import { defineNuxtPlugin } from "nuxt/app";
|
|
3
|
-
|
|
2
|
+
const toastServer = {
|
|
3
|
+
show: (_message) => {
|
|
4
|
+
},
|
|
5
|
+
success: (_message) => {
|
|
6
|
+
},
|
|
7
|
+
error: (_message) => {
|
|
8
|
+
},
|
|
9
|
+
warning: (_message) => {
|
|
10
|
+
},
|
|
11
|
+
info: (_message) => {
|
|
12
|
+
},
|
|
13
|
+
message: (_message) => {
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
export default defineNuxtPlugin(async ({ vueApp, $config }) => {
|
|
17
|
+
if (import.meta.server) {
|
|
18
|
+
return {
|
|
19
|
+
provide: {
|
|
20
|
+
mazToast: toastServer
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const { ToastHandler } = await import("maz-ui/plugins/toast");
|
|
4
25
|
const toastOptions = $config.public.mazUi?.plugins?.toast;
|
|
5
26
|
const options = typeof toastOptions === "object" ? toastOptions : void 0;
|
|
6
|
-
const instance = new ToastHandler(vueApp, options);
|
|
7
|
-
const toastServer = {
|
|
8
|
-
show: (_message) => {
|
|
9
|
-
},
|
|
10
|
-
success: (_message) => {
|
|
11
|
-
},
|
|
12
|
-
error: (_message) => {
|
|
13
|
-
},
|
|
14
|
-
warning: (_message) => {
|
|
15
|
-
},
|
|
16
|
-
info: (_message) => {
|
|
17
|
-
},
|
|
18
|
-
message: (_message) => {
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
27
|
return {
|
|
22
28
|
provide: {
|
|
23
|
-
mazToast:
|
|
29
|
+
mazToast: new ToastHandler(vueApp, options)
|
|
24
30
|
}
|
|
25
31
|
};
|
|
26
32
|
});
|
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import { WaitHandler } from "maz-ui/plugins/wait";
|
|
2
1
|
import { defineNuxtPlugin } from "nuxt/app";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
2
|
+
const waitServer = {
|
|
3
|
+
loaders: { value: [] },
|
|
4
|
+
anyLoading: { value: false },
|
|
5
|
+
isLoading: () => false,
|
|
6
|
+
stop: () => {
|
|
7
|
+
},
|
|
8
|
+
start: () => {
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export default defineNuxtPlugin(async () => {
|
|
12
|
+
if (import.meta.server) {
|
|
13
|
+
return {
|
|
14
|
+
provide: {
|
|
15
|
+
mazWait: waitServer
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
const { WaitHandler } = await import("maz-ui/plugins/wait");
|
|
13
20
|
return {
|
|
14
21
|
provide: {
|
|
15
|
-
mazWait:
|
|
22
|
+
mazWait: new WaitHandler()
|
|
16
23
|
}
|
|
17
24
|
};
|
|
18
25
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maz-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.9.1-beta.
|
|
4
|
+
"version": "4.9.1-beta.4",
|
|
5
5
|
"description": "Nuxt module for Maz-UI",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"@nuxt/devtools-kit": "^3.2.3",
|
|
51
51
|
"@nuxt/kit": "^4.4.2",
|
|
52
52
|
"defu": "^6.1.4",
|
|
53
|
-
"@maz-ui/utils": "4.7.6",
|
|
54
53
|
"@maz-ui/themes": "4.9.0",
|
|
55
54
|
"@maz-ui/translations": "4.8.0",
|
|
55
|
+
"@maz-ui/utils": "4.7.6",
|
|
56
56
|
"maz-ui": "4.9.1-beta.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|