@maz-ui/nuxt 5.0.0-beta.50 → 5.0.0-beta.51
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
CHANGED
|
@@ -69,6 +69,18 @@ interface MazUiNuxtOptions {
|
|
|
69
69
|
* }
|
|
70
70
|
*/
|
|
71
71
|
defaults?: MazUiDefaultsOptions;
|
|
72
|
+
/**
|
|
73
|
+
* Source of the country flags of `MazSelectCountry` and `MazInputPhoneNumber`
|
|
74
|
+
* @description
|
|
75
|
+
* - `'cdn'`: images of the flagcdn.com CDN
|
|
76
|
+
* - `'local'`: square flags of `@maz-ui/icons`, one chunk per flag, loaded only when visible, without any request to a third party (works offline)
|
|
77
|
+
* - a URL template of your own files, with `{code}` (lowercase) or `{CODE}` (uppercase): `'/flags/{code}.svg'`
|
|
78
|
+
*
|
|
79
|
+
* Sets the default of the `flag-src` prop (`defaults.global.flagSrc`): a `flag-src` set on a component wins.
|
|
80
|
+
* Nothing is added to the build of the app unless this option is `'local'`.
|
|
81
|
+
* @default 'cdn'
|
|
82
|
+
*/
|
|
83
|
+
flags?: 'cdn' | 'local' | (string & {});
|
|
72
84
|
/**
|
|
73
85
|
* CSS and styles configuration
|
|
74
86
|
*/
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -134,6 +134,7 @@ const defaults = {
|
|
|
134
134
|
preloadFallback: true
|
|
135
135
|
},
|
|
136
136
|
defaults: {},
|
|
137
|
+
flags: "cdn",
|
|
137
138
|
components: {
|
|
138
139
|
autoImport: true
|
|
139
140
|
},
|
|
@@ -198,7 +199,16 @@ const module$1 = defineNuxtModule({
|
|
|
198
199
|
addPlugin(resolve(_dirname, "./runtime/plugins/theme"));
|
|
199
200
|
addPlugin(resolve(_dirname, "./runtime/plugins/translations"));
|
|
200
201
|
addPlugin(resolve(_dirname, "./runtime/plugins/maz-link-component"));
|
|
201
|
-
|
|
202
|
+
const flags = moduleOptions.flags;
|
|
203
|
+
if (flags && flags !== "cdn" && flags !== "local") {
|
|
204
|
+
moduleOptions.defaults = {
|
|
205
|
+
...moduleOptions.defaults,
|
|
206
|
+
global: { flagSrc: flags, ...moduleOptions.defaults.global }
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
if (flags === "local") {
|
|
210
|
+
addPlugin(resolve(_dirname, "./runtime/plugins/local-flags"));
|
|
211
|
+
} else if (Object.keys(moduleOptions.defaults).length > 0) {
|
|
202
212
|
addPlugin(resolve(_dirname, "./runtime/plugins/defaults"));
|
|
203
213
|
}
|
|
204
214
|
if (moduleOptions.components.autoImport) {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GLOBAL_CONFIG_INJECTION_KEY } from "maz-ui/composables/useGlobalConfig";
|
|
2
|
+
import { defineNuxtPlugin } from "nuxt/app";
|
|
3
|
+
async function loadCountryFlag(code) {
|
|
4
|
+
const { loadCountryFlag: loadCountryFlag2 } = await import("maz-ui/country-flags");
|
|
5
|
+
return loadCountryFlag2(code);
|
|
6
|
+
}
|
|
7
|
+
export default defineNuxtPlugin(({ vueApp, $config }) => {
|
|
8
|
+
const defaults = $config.public.mazUi?.defaults ?? {};
|
|
9
|
+
vueApp.provide(GLOBAL_CONFIG_INJECTION_KEY, {
|
|
10
|
+
...defaults,
|
|
11
|
+
global: { flagSrc: loadCountryFlag, ...defaults.global }
|
|
12
|
+
});
|
|
13
|
+
});
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maz-ui/nuxt",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.0-beta.
|
|
4
|
+
"version": "5.0.0-beta.51",
|
|
5
5
|
"description": "Nuxt module for Maz-UI",
|
|
6
6
|
"author": "Louis Mazel <me@loicmazuel.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@nuxt/devtools-kit": "^3.2.3",
|
|
55
55
|
"@nuxt/kit": "^4.5.2",
|
|
56
56
|
"defu": "^6.1.7",
|
|
57
|
-
"maz-ui": "5.0.0-beta.
|
|
57
|
+
"maz-ui": "5.0.0-beta.51"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@maz-ui/eslint-config": "5.0.0-beta.47",
|