@maz-ui/nuxt 4.0.0-beta.6 → 4.0.0-beta.7
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.d.mts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +14 -4
- package/dist/runtime/plugins/translations.js +19 -4
- package/package.json +5 -5
package/dist/module.d.mts
CHANGED
|
@@ -272,7 +272,7 @@ declare module '@nuxt/schema' {
|
|
|
272
272
|
mazUi: MazUiNuxtOptions;
|
|
273
273
|
}
|
|
274
274
|
interface PublicRuntimeConfig {
|
|
275
|
-
mazUi: MazUiNuxtOptions
|
|
275
|
+
mazUi: Required<MazUiNuxtOptions>;
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
declare const _default: _nuxt_schema.NuxtModule<MazUiNuxtOptions, MazUiNuxtOptions, false>;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -22,7 +22,7 @@ const COMPONENT_NAMES = {
|
|
|
22
22
|
MazChecklist: true,
|
|
23
23
|
MazCircularProgressBar: true,
|
|
24
24
|
MazDialog: true,
|
|
25
|
-
|
|
25
|
+
MazDialogConfirm: true,
|
|
26
26
|
MazDrawer: true,
|
|
27
27
|
MazDropdown: true,
|
|
28
28
|
MazDropzone: true,
|
|
@@ -79,7 +79,9 @@ const defaults = {
|
|
|
79
79
|
colorMode: "auto"
|
|
80
80
|
},
|
|
81
81
|
translations: {
|
|
82
|
-
locale: "en"
|
|
82
|
+
locale: "en",
|
|
83
|
+
fallbackLocale: "en",
|
|
84
|
+
preloadFallback: true
|
|
83
85
|
},
|
|
84
86
|
components: {
|
|
85
87
|
autoImport: true
|
|
@@ -142,8 +144,16 @@ const module = defineNuxtModule({
|
|
|
142
144
|
/* eslint-disable complexity, sonarjs/cognitive-complexity */
|
|
143
145
|
setup(options, nuxt) {
|
|
144
146
|
const { resolve } = createResolver(import.meta.url);
|
|
145
|
-
nuxt.options.build.transpile = [
|
|
146
|
-
|
|
147
|
+
nuxt.options.build.transpile = [
|
|
148
|
+
"maz-ui",
|
|
149
|
+
"@maz-ui/themes",
|
|
150
|
+
...nuxt.options.build.transpile
|
|
151
|
+
];
|
|
152
|
+
const moduleOptions = defu(
|
|
153
|
+
nuxt.options.runtimeConfig.public.mazUi,
|
|
154
|
+
options,
|
|
155
|
+
defaults
|
|
156
|
+
);
|
|
147
157
|
nuxt.options.runtimeConfig.public.mazUi = moduleOptions;
|
|
148
158
|
if (moduleOptions.css.injectMainCss) {
|
|
149
159
|
nuxt.options.css = ["maz-ui/dist/css/main.css", ...nuxt.options.css];
|
|
@@ -1,6 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
MazTranslations
|
|
3
|
+
} from "@maz-ui/translations";
|
|
2
4
|
import { defineNuxtPlugin } from "nuxt/app";
|
|
3
|
-
export default defineNuxtPlugin(({ vueApp, $config }) => {
|
|
4
|
-
const translationsOptions = $config.public.mazUi
|
|
5
|
-
|
|
5
|
+
export default defineNuxtPlugin(async ({ vueApp, $config }) => {
|
|
6
|
+
const translationsOptions = $config.public.mazUi.translations || {};
|
|
7
|
+
const i18n = MazTranslations.install(vueApp, translationsOptions);
|
|
8
|
+
if (process.server) {
|
|
9
|
+
const locale = translationsOptions.locale || "en";
|
|
10
|
+
const fallbackLocale = translationsOptions.fallbackLocale || "en";
|
|
11
|
+
try {
|
|
12
|
+
await i18n.setLocale(locale);
|
|
13
|
+
if (locale !== fallbackLocale && translationsOptions.preloadFallback !== false) {
|
|
14
|
+
await i18n.setLocale(fallbackLocale);
|
|
15
|
+
await i18n.setLocale(locale);
|
|
16
|
+
}
|
|
17
|
+
} catch (error) {
|
|
18
|
+
console.warn("Failed to preload locale:", error);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
6
21
|
});
|
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.7",
|
|
5
5
|
"description": "Nuxt module for Maz-UI",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
"release": "npm run lint && npm run prepack && changelogen --release && npm publish && git push --follow-tags"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@maz-ui/themes": "4.0.0-beta.
|
|
60
|
-
"@maz-ui/translations": "4.0.0-beta.
|
|
59
|
+
"@maz-ui/themes": "4.0.0-beta.7",
|
|
60
|
+
"@maz-ui/translations": "4.0.0-beta.7",
|
|
61
61
|
"@nuxt/kit": "^3.17.4",
|
|
62
62
|
"defu": "^6.1.4",
|
|
63
|
-
"maz-ui": "4.0.0-beta.
|
|
63
|
+
"maz-ui": "4.0.0-beta.7"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"@nuxt/devtools": "^2.4.1",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"*": "prettier -w -u",
|
|
77
77
|
"*.{js,ts,mjs,mts,cjs,md}": "cross-env NODE_ENV=production eslint --fix"
|
|
78
78
|
},
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "b64fa54fbf3c645a1f2009f44c50da350bd8461e"
|
|
80
80
|
}
|