@maz-ui/nuxt 4.0.0-beta.9 → 4.0.0
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 +30 -42
- package/dist/module.d.mts +7 -5
- package/dist/module.json +3 -3
- package/dist/module.mjs +13 -16
- package/dist/runtime/plugins/theme.js +70 -60
- package/dist/runtime/plugins/translations.js +3 -5
- package/package.json +18 -17
package/README.md
CHANGED
|
@@ -16,20 +16,20 @@ Transform your Nuxt application with **Maz-UI** - a comprehensive Vue.js compone
|
|
|
16
16
|
[](https://badge.fury.io/js/%40maz-ui%2Fnuxt)
|
|
17
17
|
[](https://opensource.org/licenses/MIT)
|
|
18
18
|
|
|
19
|
-
##
|
|
19
|
+
## What is Maz-UI?
|
|
20
20
|
|
|
21
21
|
**Maz-UI** is a powerful Vue.js component library with **50+ beautiful components**, **20+ useful composables**, and **smart directives** that work perfectly with Nuxt. Think of it as your design system in a box!
|
|
22
22
|
|
|
23
|
-
###
|
|
23
|
+
### Why Choose Maz-UI for Your Nuxt App?
|
|
24
24
|
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
25
|
+
- **Zero Configuration** - Works instantly with sensible defaults
|
|
26
|
+
- **Beautiful by Default** - Professional design with dark mode included
|
|
27
|
+
- **Everything Auto-Imported** - No more import statements needed
|
|
28
|
+
- **Super Fast** - Optimized for performance with tree-shaking
|
|
29
|
+
- **Developer Friendly** - TypeScript support and great DevTools
|
|
30
|
+
- **Production Ready** - Perfect SSR/SSG support
|
|
31
31
|
|
|
32
|
-
##
|
|
32
|
+
## Quick Start (2 minutes!)
|
|
33
33
|
|
|
34
34
|
### Step 1: Install the module
|
|
35
35
|
|
|
@@ -87,9 +87,9 @@ function showMessage() {
|
|
|
87
87
|
</template>
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
##
|
|
90
|
+
## What You Get Out of the Box
|
|
91
91
|
|
|
92
|
-
###
|
|
92
|
+
### 50+ Beautiful Components
|
|
93
93
|
|
|
94
94
|
- **Buttons**: `MazBtn`,
|
|
95
95
|
- **Forms**: `MazInput`, `MazSelect`, `MazCheckbox`, `MazRadio`, `MazTextarea`, `MazInputPhoneNumber`
|
|
@@ -101,7 +101,7 @@ function showMessage() {
|
|
|
101
101
|
- **Charts**: `MazChart` (with Chart.js integration)
|
|
102
102
|
- **And 30+ more!**
|
|
103
103
|
|
|
104
|
-
###
|
|
104
|
+
### 20+ Powerful Composables
|
|
105
105
|
|
|
106
106
|
- **`useTheme()`** - Theme management and dark mode
|
|
107
107
|
- **`useToast()`** - Beautiful toast notifications
|
|
@@ -112,7 +112,7 @@ function showMessage() {
|
|
|
112
112
|
- **`useBreakpoints()`** - Responsive design helpers
|
|
113
113
|
- **And many more!**
|
|
114
114
|
|
|
115
|
-
###
|
|
115
|
+
### Smart Directives
|
|
116
116
|
|
|
117
117
|
- **`v-tooltip`** - Beautiful tooltips anywhere
|
|
118
118
|
- **`v-lazy-img`** - Lazy load images automatically
|
|
@@ -120,7 +120,7 @@ function showMessage() {
|
|
|
120
120
|
- **`v-click-outside`** - Detect outside clicks
|
|
121
121
|
- **`v-fullscreen-img`** - Fullscreen image viewer
|
|
122
122
|
|
|
123
|
-
##
|
|
123
|
+
## Theming Made Simple
|
|
124
124
|
|
|
125
125
|
Maz-UI comes with a powerful theming system that makes your app look professional instantly:
|
|
126
126
|
|
|
@@ -150,51 +150,39 @@ async function changeToOceanTheme() {
|
|
|
150
150
|
|
|
151
151
|
**Built-in themes**: `mazUi`, `ocean`, `pristine`, `obsidian` + create your own!
|
|
152
152
|
|
|
153
|
-
##
|
|
154
|
-
|
|
155
|
-
### Minimal Setup (Recommended)
|
|
156
|
-
|
|
157
|
-
```ts
|
|
158
|
-
// nuxt.config.ts
|
|
159
|
-
export default defineNuxtConfig({
|
|
160
|
-
modules: ['@maz-ui/nuxt'],
|
|
161
|
-
// That's all you need! 🎉
|
|
162
|
-
})
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
### Full Configuration Example
|
|
153
|
+
## Configuration Options
|
|
166
154
|
|
|
167
155
|
```ts
|
|
168
156
|
// nuxt.config.ts
|
|
169
157
|
export default defineNuxtConfig({
|
|
170
158
|
modules: ['@maz-ui/nuxt'],
|
|
171
159
|
mazUi: {
|
|
172
|
-
//
|
|
160
|
+
// General Settings
|
|
173
161
|
general: {
|
|
174
162
|
autoImportPrefix: 'Maz', // useMazToast instead of useToast
|
|
175
163
|
defaultMazIconPath: '/icons', // Path to your SVG icons
|
|
176
164
|
devtools: true, // Enable DevTools integration
|
|
177
165
|
},
|
|
178
166
|
|
|
179
|
-
//
|
|
167
|
+
// Theme System
|
|
180
168
|
theme: {
|
|
181
169
|
preset: 'ocean', // Choose: 'mazUi', 'ocean', 'pristine', 'obsidian'
|
|
182
170
|
strategy: 'hybrid', // 'runtime' | 'buildtime' | 'hybrid'
|
|
183
171
|
darkModeStrategy: 'class', // 'class' | 'media' | 'auto'
|
|
184
172
|
},
|
|
185
173
|
|
|
186
|
-
//
|
|
174
|
+
// Translations
|
|
187
175
|
translations: {
|
|
188
176
|
locale: 'fr', // Default language
|
|
189
177
|
fallbackLocale: 'en',
|
|
190
178
|
},
|
|
191
179
|
|
|
192
|
-
//
|
|
180
|
+
// Components (all enabled by default)
|
|
193
181
|
components: {
|
|
194
182
|
autoImport: true, // Auto-import all components globally
|
|
195
183
|
},
|
|
196
184
|
|
|
197
|
-
//
|
|
185
|
+
// Composables (customize what you need)
|
|
198
186
|
composables: {
|
|
199
187
|
useTheme: true,
|
|
200
188
|
useToast: true,
|
|
@@ -206,7 +194,7 @@ export default defineNuxtConfig({
|
|
|
206
194
|
// ... all others enabled by default
|
|
207
195
|
},
|
|
208
196
|
|
|
209
|
-
//
|
|
197
|
+
// Directives
|
|
210
198
|
directives: {
|
|
211
199
|
vTooltip: true,
|
|
212
200
|
vLazyImg: { threshold: 0.1 }, // Custom intersection threshold
|
|
@@ -218,7 +206,7 @@ export default defineNuxtConfig({
|
|
|
218
206
|
})
|
|
219
207
|
```
|
|
220
208
|
|
|
221
|
-
##
|
|
209
|
+
## Advanced Features
|
|
222
210
|
|
|
223
211
|
### Custom Theme Creation
|
|
224
212
|
|
|
@@ -252,7 +240,7 @@ export default defineNuxtConfig({
|
|
|
252
240
|
})
|
|
253
241
|
```
|
|
254
242
|
|
|
255
|
-
##
|
|
243
|
+
## SSR/SSG Support
|
|
256
244
|
|
|
257
245
|
This module is built specifically for Nuxt with perfect SSR and SSG support:
|
|
258
246
|
|
|
@@ -262,7 +250,7 @@ This module is built specifically for Nuxt with perfect SSR and SSG support:
|
|
|
262
250
|
- ✅ **Theme Persistence** - Dark mode preference remembered
|
|
263
251
|
- ✅ **No FOUC** - Flash of unstyled content prevented
|
|
264
252
|
|
|
265
|
-
##
|
|
253
|
+
## Why This Module vs Manual Setup?
|
|
266
254
|
|
|
267
255
|
| Feature | Manual Setup | @maz-ui/nuxt Module |
|
|
268
256
|
| ---------------- | --------------------- | ----------------------------- |
|
|
@@ -274,17 +262,17 @@ This module is built specifically for Nuxt with perfect SSR and SSG support:
|
|
|
274
262
|
| **DevTools** | No integration | ✅ Nuxt DevTools support |
|
|
275
263
|
| **TypeScript** | Manual type setup | ✅ Perfect TypeScript support |
|
|
276
264
|
|
|
277
|
-
##
|
|
265
|
+
## Learn More
|
|
278
266
|
|
|
279
|
-
-
|
|
280
|
-
-
|
|
281
|
-
-
|
|
267
|
+
- **[Full Documentation](https://maz-ui.com/guide/nuxt)**
|
|
268
|
+
- **[Report Issues](https://github.com/LouisMazel/maz-ui/issues)**
|
|
269
|
+
- **[Discussions](https://github.com/LouisMazel/maz-ui/discussions)**
|
|
282
270
|
|
|
283
|
-
##
|
|
271
|
+
## Contributing
|
|
284
272
|
|
|
285
273
|
We love contributions! Check out our [Contributing Guide](https://github.com/LouisMazel/maz-ui/blob/main/CONTRIBUTING.md).
|
|
286
274
|
|
|
287
|
-
##
|
|
275
|
+
## License
|
|
288
276
|
|
|
289
277
|
MIT License © 2025 [LouisMazel](https://github.com/LouisMazel)
|
|
290
278
|
|
package/dist/module.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
-
import { MazUiThemeOptions } from '@maz-ui/themes';
|
|
3
|
-
import {
|
|
2
|
+
import { MazUiThemeOptions, ThemePreset, ThemePresetName } from '@maz-ui/themes';
|
|
3
|
+
import { MazUiTranslationsOptions } from '@maz-ui/translations';
|
|
4
4
|
import { VLazyImgOptions, VFullscreenImgOptions, VTooltipOptions } from 'maz-ui/directives';
|
|
5
5
|
import { AosOptions, DialogOptions, ToastOptions } from 'maz-ui/plugins';
|
|
6
6
|
|
|
@@ -10,7 +10,7 @@ interface MazUiNuxtThemeOptions extends MazUiThemeOptions {
|
|
|
10
10
|
* @description Inject full CSS on server-side to prevent FOUC on client-side
|
|
11
11
|
* @default true
|
|
12
12
|
*/
|
|
13
|
-
|
|
13
|
+
injectAllCSSOnServer?: boolean;
|
|
14
14
|
}
|
|
15
15
|
interface MazUiNuxtOptions {
|
|
16
16
|
/**
|
|
@@ -49,7 +49,9 @@ interface MazUiNuxtOptions {
|
|
|
49
49
|
* colorMode: 'auto',
|
|
50
50
|
* }
|
|
51
51
|
*/
|
|
52
|
-
theme?: MazUiNuxtThemeOptions
|
|
52
|
+
theme?: Omit<MazUiNuxtThemeOptions, 'preset'> & {
|
|
53
|
+
preset?: ThemePreset | ThemePresetName;
|
|
54
|
+
};
|
|
53
55
|
/**
|
|
54
56
|
* Translations configuration
|
|
55
57
|
* @description If false, the translations system will be completely disabled
|
|
@@ -57,7 +59,7 @@ interface MazUiNuxtOptions {
|
|
|
57
59
|
* locale: 'en',
|
|
58
60
|
* }
|
|
59
61
|
*/
|
|
60
|
-
translations?:
|
|
62
|
+
translations?: MazUiTranslationsOptions;
|
|
61
63
|
/**
|
|
62
64
|
* CSS and styles configuration
|
|
63
65
|
*/
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -80,6 +80,7 @@ const mazUiComposables = {
|
|
|
80
80
|
useDisplayNames: true,
|
|
81
81
|
useFreezeValue: true,
|
|
82
82
|
useInjectStrict: true,
|
|
83
|
+
useDropzone: true,
|
|
83
84
|
useInstanceUniqId: true,
|
|
84
85
|
useMountComponent: true,
|
|
85
86
|
useSwipe: true
|
|
@@ -97,7 +98,8 @@ const defaults = {
|
|
|
97
98
|
preset: "maz-ui",
|
|
98
99
|
strategy: "hybrid",
|
|
99
100
|
darkModeStrategy: "class",
|
|
100
|
-
colorMode: "auto"
|
|
101
|
+
colorMode: "auto",
|
|
102
|
+
mode: "both"
|
|
101
103
|
},
|
|
102
104
|
translations: {
|
|
103
105
|
locale: "en",
|
|
@@ -133,7 +135,6 @@ function addMazUiComposableImport({
|
|
|
133
135
|
addImports({
|
|
134
136
|
from,
|
|
135
137
|
name,
|
|
136
|
-
typeFrom: "maz-ui/dist/types/composables/index.d.ts",
|
|
137
138
|
as: `use${capitalize(prefix)}${name.replace("use", "")}`
|
|
138
139
|
});
|
|
139
140
|
}
|
|
@@ -149,11 +150,7 @@ const module = defineNuxtModule({
|
|
|
149
150
|
/* eslint-disable complexity, sonarjs/cognitive-complexity */
|
|
150
151
|
setup(options, nuxt) {
|
|
151
152
|
const { resolve } = createResolver(import.meta.url);
|
|
152
|
-
nuxt.options.build.transpile
|
|
153
|
-
"maz-ui",
|
|
154
|
-
"@maz-ui/themes",
|
|
155
|
-
...nuxt.options.build.transpile
|
|
156
|
-
];
|
|
153
|
+
nuxt.options.build.transpile.push("maz-ui", "@maz-ui/themes", "@maz-ui/translations");
|
|
157
154
|
const moduleOptions = defu(
|
|
158
155
|
nuxt.options.runtimeConfig.public.mazUi,
|
|
159
156
|
options,
|
|
@@ -176,10 +173,10 @@ const module = defineNuxtModule({
|
|
|
176
173
|
const autoImportPrefix = moduleOptions.general.autoImportPrefix;
|
|
177
174
|
if (moduleOptions.plugins.aos) {
|
|
178
175
|
addPlugin(resolve(_dirname, "./runtime/plugins/aos"));
|
|
179
|
-
|
|
176
|
+
addImports({
|
|
180
177
|
name: "useAos",
|
|
181
178
|
from: resolve(_dirname, "./runtime/composables/useAos"),
|
|
182
|
-
|
|
179
|
+
as: `use${capitalize(autoImportPrefix)}Aos`
|
|
183
180
|
});
|
|
184
181
|
const injectAosCSS = typeof moduleOptions.plugins.aos === "object" && typeof moduleOptions.plugins.aos.injectCss === "boolean" ? moduleOptions.plugins.aos.injectCss : true;
|
|
185
182
|
if (injectAosCSS) {
|
|
@@ -188,26 +185,26 @@ const module = defineNuxtModule({
|
|
|
188
185
|
}
|
|
189
186
|
if (moduleOptions.plugins.toast) {
|
|
190
187
|
addPlugin(resolve(_dirname, "./runtime/plugins/toast"));
|
|
191
|
-
|
|
188
|
+
addImports({
|
|
192
189
|
name: "useToast",
|
|
193
190
|
from: resolve(_dirname, "./runtime/composables/useToast"),
|
|
194
|
-
|
|
191
|
+
as: `use${capitalize(autoImportPrefix)}Toast`
|
|
195
192
|
});
|
|
196
193
|
}
|
|
197
194
|
if (moduleOptions.plugins.dialog) {
|
|
198
195
|
addPlugin(resolve(_dirname, "./runtime/plugins/dialog"));
|
|
199
|
-
|
|
196
|
+
addImports({
|
|
200
197
|
name: "useDialog",
|
|
201
198
|
from: resolve(_dirname, "./runtime/composables/useDialog"),
|
|
202
|
-
|
|
199
|
+
as: `use${capitalize(autoImportPrefix)}Dialog`
|
|
203
200
|
});
|
|
204
201
|
}
|
|
205
202
|
if (moduleOptions.plugins.wait) {
|
|
206
203
|
addPlugin(resolve(_dirname, "./runtime/plugins/wait"));
|
|
207
|
-
|
|
204
|
+
addImports({
|
|
208
205
|
name: "useWait",
|
|
209
206
|
from: resolve(_dirname, "./runtime/composables/useWait"),
|
|
210
|
-
|
|
207
|
+
as: `use${capitalize(autoImportPrefix)}Wait`
|
|
211
208
|
});
|
|
212
209
|
}
|
|
213
210
|
if (moduleOptions.directives.vZoomImg) {
|
|
@@ -229,7 +226,7 @@ const module = defineNuxtModule({
|
|
|
229
226
|
for (const composable of allowedMazUiComposables) {
|
|
230
227
|
addMazUiComposableImport({
|
|
231
228
|
name: composable,
|
|
232
|
-
from: `maz-ui/composables`,
|
|
229
|
+
from: `maz-ui/composables/${composable}`,
|
|
233
230
|
prefix: autoImportPrefix
|
|
234
231
|
});
|
|
235
232
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
generateFullCSS,
|
|
3
|
-
mergePresets
|
|
4
|
-
} from "@maz-ui/themes";
|
|
5
1
|
import { MazUiTheme } from "@maz-ui/themes/plugin";
|
|
6
|
-
import { getPreset } from "@maz-ui/themes/utils";
|
|
7
|
-
import { generateCriticalCSS } from "@maz-ui/themes/utils/css-generator";
|
|
2
|
+
import { CSS_IDS, generateCriticalCSS, generateFullCSS, getPreset, mergePresets } from "@maz-ui/themes/utils";
|
|
8
3
|
import { defineNuxtPlugin, useCookie, useHead, useRequestHeaders } from "nuxt/app";
|
|
9
|
-
function getServerInitialColorMode() {
|
|
4
|
+
function getServerInitialColorMode(colorMode) {
|
|
5
|
+
if (colorMode !== "auto") {
|
|
6
|
+
return colorMode;
|
|
7
|
+
}
|
|
10
8
|
const colorModeCookie = useCookie("maz-color-mode");
|
|
11
9
|
if (colorModeCookie.value && ["light", "dark", "auto"].includes(colorModeCookie.value)) {
|
|
12
10
|
return colorModeCookie.value;
|
|
@@ -23,69 +21,81 @@ function getServerInitialColorMode() {
|
|
|
23
21
|
}
|
|
24
22
|
return "auto";
|
|
25
23
|
}
|
|
26
|
-
function
|
|
27
|
-
|
|
24
|
+
function injectThemeCSS({
|
|
25
|
+
mode,
|
|
26
|
+
preset,
|
|
27
|
+
config
|
|
28
|
+
}) {
|
|
29
|
+
const cssOptions = {
|
|
30
|
+
mode,
|
|
31
|
+
darkSelectorStrategy: config.darkModeStrategy ?? "class",
|
|
32
|
+
prefix: "maz"
|
|
33
|
+
};
|
|
34
|
+
if (config.injectCriticalCSS) {
|
|
35
|
+
const criticalCSS = generateCriticalCSS(preset, cssOptions);
|
|
36
|
+
useHead({
|
|
37
|
+
style: [{ innerHTML: criticalCSS, id: CSS_IDS.CRITICAL }]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (config.injectAllCSSOnServer) {
|
|
41
|
+
const fullCSS = generateFullCSS(preset, cssOptions);
|
|
42
|
+
useHead({
|
|
43
|
+
style: [{ innerHTML: fullCSS, id: CSS_IDS.FULL }]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
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
|
+
};
|
|
28
56
|
}
|
|
29
57
|
export default defineNuxtPlugin(async ({ vueApp, $config }) => {
|
|
30
|
-
const
|
|
31
|
-
let preset = await getPreset(
|
|
32
|
-
if (
|
|
33
|
-
preset = mergePresets(preset,
|
|
58
|
+
const options = $config.public.mazUi.theme;
|
|
59
|
+
let preset = await getPreset(options?.preset);
|
|
60
|
+
if (options?.overrides) {
|
|
61
|
+
preset = mergePresets(preset, options.overrides);
|
|
34
62
|
}
|
|
35
63
|
const config = {
|
|
36
64
|
strategy: "hybrid",
|
|
37
65
|
darkModeStrategy: "class",
|
|
38
|
-
colorMode: "auto",
|
|
39
|
-
|
|
40
|
-
|
|
66
|
+
colorMode: options.mode && options.mode !== "both" ? options.mode : options.colorMode ?? "auto",
|
|
67
|
+
mode: "both",
|
|
68
|
+
injectAllCSSOnServer: false,
|
|
69
|
+
injectCriticalCSS: true,
|
|
70
|
+
injectFullCSS: true,
|
|
71
|
+
overrides: {},
|
|
72
|
+
...options,
|
|
41
73
|
preset
|
|
42
74
|
};
|
|
43
|
-
const
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
const themeState = {
|
|
47
|
-
currentPreset: config.preset,
|
|
48
|
-
colorMode: initialColorMode,
|
|
49
|
-
isDark: initialIsDark,
|
|
50
|
-
strategy: config.strategy,
|
|
51
|
-
darkModeStrategy: config.darkModeStrategy
|
|
52
|
-
};
|
|
53
|
-
if (import.meta.server) {
|
|
54
|
-
const cssOptions = {
|
|
55
|
-
mode: config.colorMode === "auto" ? "both" : config.colorMode,
|
|
56
|
-
darkSelectorStrategy: config.darkModeStrategy ?? "class",
|
|
57
|
-
prefix: "maz"
|
|
58
|
-
};
|
|
59
|
-
const criticalCSS = generateCriticalCSS(themeState.currentPreset, cssOptions);
|
|
75
|
+
const colorMode = config.mode !== "both" ? config.mode : getServerInitialColorMode(config.colorMode);
|
|
76
|
+
const isDark = colorMode === "auto" && config.mode === "both" ? getServerInitialColorMode(config.colorMode) === "dark" : colorMode === "dark" || config.mode === "dark";
|
|
77
|
+
if (isDark && config.darkModeStrategy === "class") {
|
|
60
78
|
useHead({
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
id: "maz-theme-critical"
|
|
65
|
-
}
|
|
66
|
-
]
|
|
79
|
+
htmlAttrs: {
|
|
80
|
+
class: "dark"
|
|
81
|
+
}
|
|
67
82
|
});
|
|
68
|
-
if (config.injectFullCSSOnServer) {
|
|
69
|
-
const fullCSS = generateFullCSS(themeState.currentPreset, cssOptions);
|
|
70
|
-
useHead({
|
|
71
|
-
style: [{ innerHTML: fullCSS, id: "maz-theme-full" }]
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
if (initialIsDark && config.darkModeStrategy === "class") {
|
|
75
|
-
useHead({
|
|
76
|
-
htmlAttrs: {
|
|
77
|
-
class: "dark"
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
83
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
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
|
+
}
|
|
92
|
+
MazUiTheme.install?.(vueApp, {
|
|
93
|
+
colorMode,
|
|
94
|
+
preset: config.preset,
|
|
95
|
+
strategy: config.strategy,
|
|
96
|
+
darkModeStrategy: config.darkModeStrategy,
|
|
97
|
+
mode: config.mode,
|
|
98
|
+
injectFullCSS: shouldInjectFullCSSOnClient,
|
|
99
|
+
injectCriticalCSS: shouldInjectCriticalCSSOnClient
|
|
90
100
|
});
|
|
91
101
|
});
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
MazTranslations
|
|
3
|
-
} from "@maz-ui/translations";
|
|
1
|
+
import { MazUiTranslations } from "@maz-ui/translations";
|
|
4
2
|
import { defineNuxtPlugin } from "nuxt/app";
|
|
5
3
|
export default defineNuxtPlugin(async ({ vueApp, $config }) => {
|
|
6
4
|
const translationsOptions = $config.public.mazUi.translations || {};
|
|
7
|
-
const i18n =
|
|
8
|
-
if (
|
|
5
|
+
const i18n = MazUiTranslations.install?.(vueApp, translationsOptions);
|
|
6
|
+
if (import.meta.server) {
|
|
9
7
|
const locale = translationsOptions.locale || "en";
|
|
10
8
|
const fallbackLocale = translationsOptions.fallbackLocale || "en";
|
|
11
9
|
try {
|
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
|
|
4
|
+
"version": "4.0.0",
|
|
5
5
|
"description": "Nuxt module for Maz-UI",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -34,8 +34,7 @@
|
|
|
34
34
|
".": {
|
|
35
35
|
"types": "./dist/types.d.mts",
|
|
36
36
|
"import": "./dist/module.mjs"
|
|
37
|
-
}
|
|
38
|
-
"./*": "./*"
|
|
37
|
+
}
|
|
39
38
|
},
|
|
40
39
|
"main": "./dist/module.mjs",
|
|
41
40
|
"types": "./dist/types.d.mts",
|
|
@@ -50,27 +49,29 @@
|
|
|
50
49
|
"dev": "nuxt-module-build build --stub && nuxt-module-build prepare",
|
|
51
50
|
"lint": "cross-env NODE_ENV=production eslint .",
|
|
52
51
|
"lint:fix": "pnpm lint --fix",
|
|
53
|
-
"typecheck": "
|
|
52
|
+
"typecheck": "nuxi typecheck"
|
|
53
|
+
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"nuxt": ">=3.4.0 <5.0.0"
|
|
54
56
|
},
|
|
55
57
|
"dependencies": {
|
|
56
|
-
"@maz-ui/themes": "4.0.0
|
|
57
|
-
"@maz-ui/translations": "4.0.0
|
|
58
|
-
"@nuxt/kit": "^
|
|
58
|
+
"@maz-ui/themes": "4.0.0",
|
|
59
|
+
"@maz-ui/translations": "4.0.0",
|
|
60
|
+
"@nuxt/kit": "^4.0.3",
|
|
59
61
|
"defu": "^6.1.4",
|
|
60
|
-
"maz-ui": "4.0.0
|
|
62
|
+
"maz-ui": "4.0.0"
|
|
61
63
|
},
|
|
62
64
|
"devDependencies": {
|
|
63
|
-
"@nuxt/devtools": "^2.
|
|
64
|
-
"@nuxt/
|
|
65
|
-
"@nuxt/
|
|
66
|
-
"@nuxt/
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"typescript": "~5.8.3",
|
|
65
|
+
"@nuxt/devtools": "^2.6.2",
|
|
66
|
+
"@nuxt/module-builder": "^1.0.2",
|
|
67
|
+
"@nuxt/schema": "^4.0.3",
|
|
68
|
+
"@nuxt/test-utils": "^3.19.2",
|
|
69
|
+
"nuxt": "^4.0.3",
|
|
70
|
+
"typescript": "~5.9.2",
|
|
70
71
|
"vitest": "^3.2.4"
|
|
71
72
|
},
|
|
72
73
|
"lint-staged": {
|
|
73
|
-
"*.{js,ts,mjs,mts,cjs,md}": "cross-env NODE_ENV=production eslint --fix"
|
|
74
|
+
"*.{js,ts,mjs,mts,cjs,md,yml,json}": "cross-env NODE_ENV=production eslint --fix"
|
|
74
75
|
},
|
|
75
|
-
"gitHead": "
|
|
76
|
+
"gitHead": "b2e03a043ad3334ed5ce456c7f0e67c728c09524"
|
|
76
77
|
}
|