@overgaming/valiform 0.4.5 → 0.4.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.
@@ -7,6 +7,13 @@ interface NuxtModuleOptions {
7
7
  * external variables all work normally — no serialization limitations.
8
8
  */
9
9
  config?: string;
10
+ /**
11
+ * When true, the active locale is automatically synced with @nuxtjs/i18n.
12
+ * Valiform will use `nuxtApp.$i18n.locale` (a Ref<string>) at runtime,
13
+ * so changing the i18n language also changes the validation messages language.
14
+ * The `locale` option is used as fallback if $i18n is not available.
15
+ */
16
+ syncI18n?: boolean;
10
17
  }
11
18
  declare const _default: NuxtModule<TOptions, TOptions, false>;
12
19
  export default _default;
@@ -1 +1 @@
1
- "use strict";const n=require("#app"),l=require("@overgaming/valiform"),i=require("#build/valiform/options.mjs"),u=n.defineNuxtPlugin(r=>{var s,e;const o={...i.pluginOptions};(s=i.valiformConfig)!=null&&s.locales&&(o.locales=i.valiformConfig.locales),r.vueApp.use(l.FormsPlugin,o),(e=i.valiformConfig)!=null&&e.rules&&l.registerRules(i.valiformConfig.rules)});module.exports=u;
1
+ "use strict";const u=require("#app"),t=require("@overgaming/valiform"),o=require("#build/valiform/options.mjs"),a=u.defineNuxtPlugin({enforce:"post",setup(i){var e,l,n;const{syncI18n:c,...f}=o.pluginOptions,s={...f};if((e=o.valiformConfig)!=null&&e.locales&&(s.locales=o.valiformConfig.locales),c){const r=(l=i.$i18n)==null?void 0:l.locale;r&&(s.locale=r)}i.vueApp.use(t.FormsPlugin,s),(n=o.valiformConfig)!=null&&n.rules&&t.registerRules(o.valiformConfig.rules)}});module.exports=a;
@@ -1,11 +1,18 @@
1
- import { defineNuxtPlugin as r } from "#app";
2
- import { FormsPlugin as t, registerRules as u } from "@overgaming/valiform";
3
- import { pluginOptions as p, valiformConfig as o } from "#build/valiform/options.mjs";
4
- const a = r((s) => {
5
- var e, i;
6
- const l = { ...p };
7
- (e = o) != null && e.locales && (l.locales = o.locales), s.vueApp.use(t, l), (i = o) != null && i.rules && u(o.rules);
1
+ import { defineNuxtPlugin as c } from "#app";
2
+ import { FormsPlugin as p, registerRules as u } from "@overgaming/valiform";
3
+ import { pluginOptions as a, valiformConfig as o } from "#build/valiform/options.mjs";
4
+ const v = c({
5
+ enforce: "post",
6
+ setup(e) {
7
+ var l, i, n;
8
+ const { syncI18n: t, ...f } = a, s = { ...f };
9
+ if ((l = o) != null && l.locales && (s.locales = o.locales), t) {
10
+ const r = (i = e.$i18n) == null ? void 0 : i.locale;
11
+ r && (s.locale = r);
12
+ }
13
+ e.vueApp.use(p, s), (n = o) != null && n.rules && u(o.rules);
14
+ }
8
15
  });
9
16
  export {
10
- a as default
17
+ v as default
11
18
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@overgaming/valiform",
3
- "version": "0.4.5",
3
+ "version": "0.4.7",
4
4
  "description": "Vue 3 form validation library",
5
5
  "keywords": [
6
6
  "form",