@maz-ui/nuxt 4.0.0-beta.25 → 4.0.0-beta.27
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/theme.js +22 -15
- package/package.json +8 -5
package/dist/module.json
CHANGED
|
@@ -31,25 +31,29 @@ function injectThemeCSS({
|
|
|
31
31
|
darkSelectorStrategy: config.darkModeStrategy ?? "class",
|
|
32
32
|
prefix: "maz"
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
const criticalCSSAlreadyInjected = import.meta.client && document.getElementById(CSS_IDS.CRITICAL);
|
|
36
|
-
const shouldInjectCriticalCSSOnClient = config.injectCriticalCSS && import.meta.client && !criticalCSSAlreadyInjected;
|
|
37
|
-
if (shouldInjectCriticalCSSOnServer || shouldInjectCriticalCSSOnClient) {
|
|
34
|
+
if (config.injectCriticalCSS) {
|
|
38
35
|
const criticalCSS = generateCriticalCSS(preset, cssOptions);
|
|
39
36
|
useHead({
|
|
40
37
|
style: [{ innerHTML: criticalCSS, id: CSS_IDS.CRITICAL }]
|
|
41
38
|
});
|
|
42
39
|
}
|
|
43
|
-
|
|
44
|
-
const fullCSSAlreadyInjected = import.meta.client && document.getElementById(CSS_IDS.FULL);
|
|
45
|
-
const shouldInjectFullCSSOnClient = config.injectFullCSS && import.meta.client && !fullCSSAlreadyInjected;
|
|
46
|
-
if (shouldInjectFullCSSOnServer || shouldInjectFullCSSOnClient) {
|
|
40
|
+
if (config.injectAllCSSOnServer) {
|
|
47
41
|
const fullCSS = generateFullCSS(preset, cssOptions);
|
|
48
42
|
useHead({
|
|
49
43
|
style: [{ innerHTML: fullCSS, id: CSS_IDS.FULL }]
|
|
50
44
|
});
|
|
51
45
|
}
|
|
52
46
|
}
|
|
47
|
+
function getInjectCSSStates(config) {
|
|
48
|
+
const criticalCSSAlreadyInjected = import.meta.client && !!document.getElementById(CSS_IDS.CRITICAL);
|
|
49
|
+
const shouldInjectCriticalCSSOnClient = !!config.injectCriticalCSS && import.meta.client && !criticalCSSAlreadyInjected;
|
|
50
|
+
const fullCSSAlreadyInjected = import.meta.client && !!document.getElementById(CSS_IDS.FULL);
|
|
51
|
+
const shouldInjectFullCSSOnClient = !!config.injectFullCSS && import.meta.client && !fullCSSAlreadyInjected;
|
|
52
|
+
return {
|
|
53
|
+
shouldInjectCriticalCSSOnClient,
|
|
54
|
+
shouldInjectFullCSSOnClient
|
|
55
|
+
};
|
|
56
|
+
}
|
|
53
57
|
export default defineNuxtPlugin(async ({ vueApp, $config }) => {
|
|
54
58
|
const options = $config.public.mazUi.theme;
|
|
55
59
|
let preset = await getPreset(options?.preset);
|
|
@@ -77,18 +81,21 @@ export default defineNuxtPlugin(async ({ vueApp, $config }) => {
|
|
|
77
81
|
}
|
|
78
82
|
});
|
|
79
83
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
const { shouldInjectCriticalCSSOnClient, shouldInjectFullCSSOnClient } = getInjectCSSStates(config);
|
|
85
|
+
if (import.meta.server) {
|
|
86
|
+
injectThemeCSS({
|
|
87
|
+
mode: config.mode,
|
|
88
|
+
preset: config.preset,
|
|
89
|
+
config
|
|
90
|
+
});
|
|
91
|
+
}
|
|
85
92
|
MazUiTheme.install(vueApp, {
|
|
86
93
|
colorMode,
|
|
87
94
|
preset: config.preset,
|
|
88
95
|
strategy: config.strategy,
|
|
89
96
|
darkModeStrategy: config.darkModeStrategy,
|
|
90
97
|
mode: config.mode,
|
|
91
|
-
injectFullCSS:
|
|
92
|
-
injectCriticalCSS:
|
|
98
|
+
injectFullCSS: shouldInjectFullCSSOnClient,
|
|
99
|
+
injectCriticalCSS: shouldInjectCriticalCSSOnClient
|
|
93
100
|
});
|
|
94
101
|
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maz-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "4.0.0-beta.
|
|
4
|
+
"version": "4.0.0-beta.27",
|
|
5
5
|
"description": "Nuxt module for Maz-UI",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -52,12 +52,15 @@
|
|
|
52
52
|
"lint:fix": "pnpm lint --fix",
|
|
53
53
|
"typecheck": "nuxi typecheck"
|
|
54
54
|
},
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"nuxt": ">=3.4.0 <5.0.0"
|
|
57
|
+
},
|
|
55
58
|
"dependencies": {
|
|
56
|
-
"@maz-ui/themes": "4.0.0-beta.
|
|
57
|
-
"@maz-ui/translations": "4.0.0-beta.
|
|
59
|
+
"@maz-ui/themes": "4.0.0-beta.27",
|
|
60
|
+
"@maz-ui/translations": "4.0.0-beta.27",
|
|
58
61
|
"@nuxt/kit": "^4.0.3",
|
|
59
62
|
"defu": "^6.1.4",
|
|
60
|
-
"maz-ui": "4.0.0-beta.
|
|
63
|
+
"maz-ui": "4.0.0-beta.27"
|
|
61
64
|
},
|
|
62
65
|
"devDependencies": {
|
|
63
66
|
"@nuxt/devtools": "^2.6.2",
|
|
@@ -72,5 +75,5 @@
|
|
|
72
75
|
"lint-staged": {
|
|
73
76
|
"*.{js,ts,mjs,mts,cjs,md,yml,json}": "cross-env NODE_ENV=production eslint --fix"
|
|
74
77
|
},
|
|
75
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "fc5b5e42f115cc8b7fe4d6436defb078e3f36662"
|
|
76
79
|
}
|