@vinayakkulkarni/v-intl 2.1.0 → 2.2.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/dist/v-intl.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /*!
3
- * @vinayakkulkarni/v-intl v2.1.0
3
+ * @vinayakkulkarni/v-intl v2.2.0
4
4
  * (c) 2023 Vinayak Kulkarni
5
5
  * @license MIT
6
6
  */ Object.defineProperties(exports, {
@@ -152,7 +152,7 @@ const c = l($, [['render', _]]),
152
152
  };
153
153
  },
154
154
  });
155
- function b(e, a, r, n, o, i) {
155
+ function V(e, a, r, n, o, i) {
156
156
  return (
157
157
  t.openBlock(),
158
158
  t.createElementBlock(
@@ -163,8 +163,8 @@ function b(e, a, r, n, o, i) {
163
163
  )
164
164
  );
165
165
  }
166
- const f = l(D, [['render', b]]),
167
- T = t.defineComponent({
166
+ const f = l(D, [['render', V]]),
167
+ b = t.defineComponent({
168
168
  name: 'VIntlRelativeTimeFormat',
169
169
  props: {
170
170
  wrapper: { type: String, required: !1, default: '' },
@@ -190,7 +190,7 @@ const f = l(D, [['render', b]]),
190
190
  };
191
191
  },
192
192
  });
193
- function V(e, a, r, n, o, i) {
193
+ function T(e, a, r, n, o, i) {
194
194
  return (
195
195
  t.openBlock(),
196
196
  t.createElementBlock(
@@ -201,12 +201,15 @@ function V(e, a, r, n, o, i) {
201
201
  )
202
202
  );
203
203
  }
204
- const d = l(T, [['render', V]]),
205
- N = (e) => {};
206
- let s = !1;
204
+ const d = l(b, [['render', T]]);
205
+ let N;
207
206
  const q = (e) => {
207
+ N = e;
208
+ };
209
+ let s = !1;
210
+ const v = (e) => {
208
211
  s ||
209
- (N(),
212
+ (q(e),
210
213
  e.component('VIntlNumberFormat', m),
211
214
  e.component('VIntlListFormat', u),
212
215
  e.component('VIntlDateTimeFormat', c),
@@ -214,11 +217,11 @@ const q = (e) => {
214
217
  e.component('VIntlRelativeTimeFormat', d),
215
218
  (s = !0));
216
219
  },
217
- v = q;
220
+ w = v;
218
221
  exports.VIntlDateTimeFormat = c;
219
222
  exports.VIntlDisplayNames = f;
220
223
  exports.VIntlListFormat = u;
221
224
  exports.VIntlNumberFormat = m;
222
225
  exports.VIntlRelativeTimeFormat = d;
223
- exports.default = v;
226
+ exports.default = w;
224
227
  //# sourceMappingURL=v-intl.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"v-intl.cjs","sources":["../src/components/VIntlNumberFormat.vue","../src/components/VIntlListFormat.vue","../src/components/VIntlDateTimeFormat.vue","../src/components/VIntlDisplayNames.vue","../src/components/VIntlRelativeTimeFormat.vue","../src/utils/config/index.ts","../src/install.ts"],"sourcesContent":["<template>\n <div :class=\"wrapper\">\n {{ intlNumberFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlNumberFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Number,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with NumberFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlNumberFormat = computed(() => {\n if (props.toParts) {\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlNumberFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlListFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlListFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Array as PropType<Iterable<string>>,\n required: true,\n },\n format: {\n type: Object,\n required: true,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlListFormat = computed(() => {\n if (props.toParts) {\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlListFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDateTime }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlDateTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object as PropType<number | Date | undefined>,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlDateTime = computed(() => {\n if (props.toParts) {\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlDateTime,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDisplayNames }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlDisplayNames',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n /**\n * When format.options.type is \"region\", code must be either an ISO-3166 2-letter country code or a UN M49 3-digit region code.\n * When format.options.type is \"language\", code must be conform to Unicode's language identifier grammar.\n * When format.options.type is \"currency\", code must be a ISO-4217 3-letter currency code.\n * When format.options.type is \"script\", code must be a ISO-15924 4-letter script code.\n */\n type: String,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DisplayNames options\n * read more: https://v8.dev/features/intl-displaynames#full-api\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlDisplayNames = computed(() => {\n const intlNames = new Intl.DisplayNames(\n [props.format.locales],\n props.format.options,\n );\n return intlNames.of(props.payload);\n });\n return {\n intlDisplayNames,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlRelativeTimeFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlRelativeTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object,\n required: true,\n default: () => ({\n number: 1,\n time: 'days',\n }),\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlRelativeTimeFormat = computed(() => {\n return new Intl.RelativeTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload.number, props.payload.time);\n });\n return {\n intlRelativeTimeFormat,\n };\n },\n });\n</script>\n","import { App as Application } from 'vue';\n\nconst config = {};\n\nexport let VueInstance: Application;\n\nexport { config as default };\n\nexport const setVueInstance = (instance: Application) => {\n VueInstance = instance;\n};\n","import { App as Application, Plugin } from 'vue';\nimport VIntlNumberFormat from './components/VIntlNumberFormat.vue';\nimport VIntlListFormat from './components/VIntlListFormat.vue';\nimport VIntlDateTimeFormat from './components/VIntlDateTimeFormat.vue';\nimport VIntlDisplayNames from './components/VIntlDisplayNames.vue';\nimport VIntlRelativeTimeFormat from './components/VIntlRelativeTimeFormat.vue';\nimport { setVueInstance } from './utils/config';\n\nlet installed = false;\n\nconst install: Exclude<Plugin['install'], undefined> = (app: Application) => {\n if (!installed) {\n setVueInstance(app);\n app.component('VIntlNumberFormat', VIntlNumberFormat);\n app.component('VIntlListFormat', VIntlListFormat);\n app.component('VIntlDateTimeFormat', VIntlDateTimeFormat);\n app.component('VIntlDisplayNames', VIntlDisplayNames);\n app.component('VIntlRelativeTimeFormat', VIntlRelativeTimeFormat);\n installed = true;\n }\n};\n\nexport default install;\n"],"names":["_sfc_main$4","defineComponent","props","computed","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_createElementBlock","_normalizeClass","_sfc_main$3","_sfc_main$2","_sfc_main$1","_sfc_main","setVueInstance","instance","installed","install","app","VIntlNumberFormat","VIntlListFormat","VIntlDateTimeFormat","VIntlDisplayNames","VIntlRelativeTimeFormat","install$1"],"mappings":";;;;wHAQEA,EAAeC,kBAAgB,CAC7B,KAAM,oBACN,MAAO,CACL,QAAS,CACP,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,QAAS,CACP,KAAM,OACN,SAAU,EACZ,EACA,OAAQ,CACN,KAAM,OACN,SAAU,GACV,QAAS,KAAO,CAKd,QAAS,QAKT,QAAS,CAAC,CAAA,EAEd,EACA,QAAS,CACP,KAAM,QACN,SAAU,GACV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AAS,KAAO,CACd,OAAQ,EACR,KAAM,MAAA,EAEV,EACA,OAAQ,CACN,KAAM,OACN,SAAU,GACV,QAAS,KAAO,CAKd,QAAS,QAKT,QAAS,CAAC,CAAA,EAEd,CACF,EACA,MAAMC,EAAO,CAOJ,MAAA,CACL,uBAP6BC,EAAAA,SAAS,IAC/B,IAAI,KAAK,mBACdD,EAAM,OAAO,QACbA,EAAM,OAAO,OAAA,EACb,OAAOA,EAAM,QAAQ,OAAQA,EAAM,QAAQ,IAAI,CAClD,CAEC,CAEJ,CACF,CAAC,EAnDU,SAAAE,EAAAC,EAAEC,EAAOC,EAAAC,EAAAC,EAAAC,EAAA,sBACfC,EAAsB,mBAAA,MAAA,CAAA,MAAAC,EAAAA,eAAAP,EAAA,OAAA,8ECMhBY,EAAkBC,GAA0B,CAEzD,ECFA,IAAIC,EAAY,GAEhB,MAAMC,EAAkDC,GAAqB,CACtEF,IACHF,EAAkB,EACdI,EAAA,UAAU,oBAAqBC,CAAiB,EAChDD,EAAA,UAAU,kBAAmBE,CAAe,EAC5CF,EAAA,UAAU,sBAAuBG,CAAmB,EACpDH,EAAA,UAAU,oBAAqBI,CAAiB,EAChDJ,EAAA,UAAU,0BAA2BK,CAAuB,EACpDP,EAAA,GAEhB,EAEAQ,EAAeP"}
1
+ {"version":3,"file":"v-intl.cjs","sources":["../src/components/VIntlNumberFormat.vue","../src/components/VIntlListFormat.vue","../src/components/VIntlDateTimeFormat.vue","../src/components/VIntlDisplayNames.vue","../src/components/VIntlRelativeTimeFormat.vue","../src/utils/config/index.ts","../src/install.ts"],"sourcesContent":["<template>\n <div :class=\"wrapper\">\n {{ intlNumberFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlNumberFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Number,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with NumberFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlNumberFormat = computed(() => {\n if (props.toParts) {\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlNumberFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlListFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlListFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Array as PropType<Iterable<string>>,\n required: true,\n },\n format: {\n type: Object,\n required: true,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlListFormat = computed(() => {\n if (props.toParts) {\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlListFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDateTime }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlDateTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object as PropType<number | Date | undefined>,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlDateTime = computed(() => {\n if (props.toParts) {\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlDateTime,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDisplayNames }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlDisplayNames',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n /**\n * When format.options.type is \"region\", code must be either an ISO-3166 2-letter country code or a UN M49 3-digit region code.\n * When format.options.type is \"language\", code must be conform to Unicode's language identifier grammar.\n * When format.options.type is \"currency\", code must be a ISO-4217 3-letter currency code.\n * When format.options.type is \"script\", code must be a ISO-15924 4-letter script code.\n */\n type: String,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DisplayNames options\n * read more: https://v8.dev/features/intl-displaynames#full-api\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlDisplayNames = computed(() => {\n const intlNames = new Intl.DisplayNames(\n [props.format.locales],\n props.format.options,\n );\n return intlNames.of(props.payload);\n });\n return {\n intlDisplayNames,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlRelativeTimeFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlRelativeTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object,\n required: true,\n default: () => ({\n number: 1,\n time: 'days',\n }),\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlRelativeTimeFormat = computed(() => {\n return new Intl.RelativeTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload.number, props.payload.time);\n });\n return {\n intlRelativeTimeFormat,\n };\n },\n });\n</script>\n","import { App as Application } from 'vue';\n\nconst config = {};\n\nexport let VueInstance: Application;\n\nexport { config as default };\n\nexport const setVueInstance = (instance: Application) => {\n VueInstance = instance;\n};\n","import { App as Application, Plugin } from 'vue';\nimport VIntlNumberFormat from './components/VIntlNumberFormat.vue';\nimport VIntlListFormat from './components/VIntlListFormat.vue';\nimport VIntlDateTimeFormat from './components/VIntlDateTimeFormat.vue';\nimport VIntlDisplayNames from './components/VIntlDisplayNames.vue';\nimport VIntlRelativeTimeFormat from './components/VIntlRelativeTimeFormat.vue';\nimport { setVueInstance } from './utils/config';\n\nlet installed = false;\n\nconst install: Exclude<Plugin['install'], undefined> = (app: Application) => {\n if (!installed) {\n setVueInstance(app);\n app.component('VIntlNumberFormat', VIntlNumberFormat);\n app.component('VIntlListFormat', VIntlListFormat);\n app.component('VIntlDateTimeFormat', VIntlDateTimeFormat);\n app.component('VIntlDisplayNames', VIntlDisplayNames);\n app.component('VIntlRelativeTimeFormat', VIntlRelativeTimeFormat);\n installed = true;\n }\n};\n\nexport default install;\n"],"names":["_sfc_main$4","defineComponent","props","computed","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_createElementBlock","_normalizeClass","_sfc_main$3","_sfc_main$2","_sfc_main$1","_sfc_main","VueInstance","setVueInstance","instance","installed","install","app","VIntlNumberFormat","VIntlListFormat","VIntlDateTimeFormat","VIntlDisplayNames","VIntlRelativeTimeFormat","install$1"],"mappings":";;;;wHAQEA,EAAeC,kBAAgB,CAC7B,KAAM,oBACN,MAAO,CACL,QAAS,CACP,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,QAAS,CACP,KAAM,OACN,SAAU,EACZ,EACA,OAAQ,CACN,KAAM,OACN,SAAU,GACV,QAAS,KAAO,CAKd,QAAS,QAKT,QAAS,CAAC,CAAA,EAEd,EACA,QAAS,CACP,KAAM,QACN,SAAU,GACV,QAAS,EACX,CACF,EACA,MAAMC,EAAO,CAaJ,MAAA,CACL,iBAbuBC,EAAAA,SAAS,IAC5BD,EAAM,QACD,IAAI,KAAK,aACdA,EAAM,OAAO,QACbA,EAAM,OAAO,OAAA,EACb,cAAcA,EAAM,OAAO,EAExB,IAAI,KAAK,aACdA,EAAM,OAAO,QACbA,EAAM,OAAO,OAAA,EACb,OAAOA,EAAM,OAAO,CACvB,CAEC,CAEJ,CACF,CAAC,uEA1DU,SAAAE,EAAAC,EAAEC,EAAOC,EAAAC,EAAAC,EAAAC,EAAA,sBACfC,EAAgB,mBAAA,MAAA,CAAA,MAAAC,EAAAA,eAAAP,EAAA,OAAA,wECQrBQ,EAAeZ,kBAAgB,CAC7B,KAAM,kBACN,MAAO,CACL,QAAS,CACP,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,QAAS,CACP,KAAM,MACN,SAAU,EACZ,EACA,OAAQ,CACN,KAAM,OACN,SAAU,GACV,QAAS,KAAO,CACd,QAAS,QACT,QAAS,CAAC,CAAA,EAEd,EACA,QAAS,CACP,KAAM,QACN,SAAU,GACV,QAA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C5CF,EAAA,UAAU,sBAAuBG,CAAmB,EACpDH,EAAA,UAAU,oBAAqBI,CAAiB,EAChDJ,EAAA,UAAU,0BAA2BK,CAAuB,EACpDP,EAAA,GAEhB,EAEAQ,EAAeP"}
package/dist/v-intl.js CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  toDisplayString as u,
8
8
  } from 'vue';
9
9
  /*!
10
- * @vinayakkulkarni/v-intl v2.1.0
10
+ * @vinayakkulkarni/v-intl v2.2.0
11
11
  * (c) 2023 Vinayak Kulkarni
12
12
  * @license MIT
13
13
  */
@@ -27,7 +27,15 @@ const p = o({
27
27
  type: Object,
28
28
  required: !1,
29
29
  default: () => ({
30
+ /**
31
+ * Can be string or array with fallback
32
+ * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
33
+ */
30
34
  locales: 'en-US',
35
+ /**
36
+ * Has to be a object with NumberFormat options
37
+ * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
38
+ */
31
39
  options: {},
32
40
  }),
33
41
  },
@@ -142,7 +150,15 @@ const _ = /* @__PURE__ */ f(F, [['render', I]]),
142
150
  type: Object,
143
151
  required: !1,
144
152
  default: () => ({
153
+ /**
154
+ * Can be string or array with fallback
155
+ * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
156
+ */
145
157
  locales: 'en-US',
158
+ /**
159
+ * Has to be a object with DateTimeFormat options
160
+ * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
161
+ */
146
162
  options: {},
147
163
  }),
148
164
  },
@@ -191,6 +207,12 @@ const w = /* @__PURE__ */ f(b, [['render', q]]),
191
207
  default: '',
192
208
  },
193
209
  payload: {
210
+ /**
211
+ * When format.options.type is "region", code must be either an ISO-3166 2-letter country code or a UN M49 3-digit region code.
212
+ * When format.options.type is "language", code must be conform to Unicode's language identifier grammar.
213
+ * When format.options.type is "currency", code must be a ISO-4217 3-letter currency code.
214
+ * When format.options.type is "script", code must be a ISO-15924 4-letter script code.
215
+ */
194
216
  type: String,
195
217
  required: !0,
196
218
  },
@@ -198,7 +220,15 @@ const w = /* @__PURE__ */ f(b, [['render', q]]),
198
220
  type: Object,
199
221
  required: !1,
200
222
  default: () => ({
223
+ /**
224
+ * Can be string or array with fallback
225
+ * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
226
+ */
201
227
  locales: 'en-US',
228
+ /**
229
+ * Has to be a object with DisplayNames options
230
+ * read more: https://v8.dev/features/intl-displaynames#full-api
231
+ */
202
232
  options: {},
203
233
  }),
204
234
  },
@@ -226,8 +256,8 @@ function T(t, e, a, r, n, c) {
226
256
  )
227
257
  );
228
258
  }
229
- const D = /* @__PURE__ */ f(N, [['render', T]]),
230
- V = o({
259
+ const V = /* @__PURE__ */ f(N, [['render', T]]),
260
+ D = o({
231
261
  name: 'VIntlRelativeTimeFormat',
232
262
  props: {
233
263
  wrapper: {
@@ -247,7 +277,15 @@ const D = /* @__PURE__ */ f(N, [['render', T]]),
247
277
  type: Object,
248
278
  required: !1,
249
279
  default: () => ({
280
+ /**
281
+ * Can be string or array with fallback
282
+ * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation
283
+ */
250
284
  locales: 'en-US',
285
+ /**
286
+ * Has to be a object with DateTimeFormat options
287
+ * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat
288
+ */
251
289
  options: {},
252
290
  }),
253
291
  },
@@ -276,26 +314,29 @@ function v(t, e, a, r, n, c) {
276
314
  )
277
315
  );
278
316
  }
279
- const S = /* @__PURE__ */ f(V, [['render', v]]),
280
- P = (t) => {};
281
- let d = !1;
317
+ const S = /* @__PURE__ */ f(D, [['render', v]]);
318
+ let P;
282
319
  const g = (t) => {
320
+ P = t;
321
+ };
322
+ let d = !1;
323
+ const L = (t) => {
283
324
  d ||
284
- (P(),
325
+ (g(t),
285
326
  t.component('VIntlNumberFormat', $),
286
327
  t.component('VIntlListFormat', _),
287
328
  t.component('VIntlDateTimeFormat', w),
288
- t.component('VIntlDisplayNames', D),
329
+ t.component('VIntlDisplayNames', V),
289
330
  t.component('VIntlRelativeTimeFormat', S),
290
331
  (d = !0));
291
332
  },
292
- O = g;
333
+ j = L;
293
334
  export {
294
335
  w as VIntlDateTimeFormat,
295
- D as VIntlDisplayNames,
336
+ V as VIntlDisplayNames,
296
337
  _ as VIntlListFormat,
297
338
  $ as VIntlNumberFormat,
298
339
  S as VIntlRelativeTimeFormat,
299
- O as default,
340
+ j as default,
300
341
  };
301
342
  //# sourceMappingURL=v-intl.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"v-intl.js","sources":["../src/components/VIntlNumberFormat.vue","../src/components/VIntlListFormat.vue","../src/components/VIntlDateTimeFormat.vue","../src/components/VIntlDisplayNames.vue","../src/components/VIntlRelativeTimeFormat.vue","../src/utils/config/index.ts","../src/install.ts"],"sourcesContent":["<template>\n <div :class=\"wrapper\">\n {{ intlNumberFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlNumberFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Number,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with NumberFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlNumberFormat = computed(() => {\n if (props.toParts) {\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlNumberFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlListFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlListFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Array as PropType<Iterable<string>>,\n required: true,\n },\n format: {\n type: Object,\n required: true,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlListFormat = computed(() => {\n if (props.toParts) {\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlListFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDateTime }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlDateTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object as PropType<number | Date | undefined>,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlDateTime = computed(() => {\n if (props.toParts) {\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlDateTime,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDisplayNames }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlDisplayNames',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n /**\n * When format.options.type is \"region\", code must be either an ISO-3166 2-letter country code or a UN M49 3-digit region code.\n * When format.options.type is \"language\", code must be conform to Unicode's language identifier grammar.\n * When format.options.type is \"currency\", code must be a ISO-4217 3-letter currency code.\n * When format.options.type is \"script\", code must be a ISO-15924 4-letter script code.\n */\n type: String,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DisplayNames options\n * read more: https://v8.dev/features/intl-displaynames#full-api\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlDisplayNames = computed(() => {\n const intlNames = new Intl.DisplayNames(\n [props.format.locales],\n props.format.options,\n );\n return intlNames.of(props.payload);\n });\n return {\n intlDisplayNames,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlRelativeTimeFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlRelativeTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object,\n required: true,\n default: () => ({\n number: 1,\n time: 'days',\n }),\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlRelativeTimeFormat = computed(() => {\n return new Intl.RelativeTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload.number, props.payload.time);\n });\n return {\n intlRelativeTimeFormat,\n };\n },\n });\n</script>\n","import { App as Application } from 'vue';\n\nconst config = {};\n\nexport let VueInstance: Application;\n\nexport { config as default };\n\nexport const setVueInstance = (instance: Application) => {\n VueInstance = instance;\n};\n","import { App as Application, Plugin } from 'vue';\nimport VIntlNumberFormat from './components/VIntlNumberFormat.vue';\nimport VIntlListFormat from './components/VIntlListFormat.vue';\nimport VIntlDateTimeFormat from './components/VIntlDateTimeFormat.vue';\nimport VIntlDisplayNames from './components/VIntlDisplayNames.vue';\nimport VIntlRelativeTimeFormat from './components/VIntlRelativeTimeFormat.vue';\nimport { setVueInstance } from './utils/config';\n\nlet installed = false;\n\nconst install: Exclude<Plugin['install'], undefined> = (app: Application) => {\n if (!installed) {\n setVueInstance(app);\n app.component('VIntlNumberFormat', VIntlNumberFormat);\n app.component('VIntlListFormat', VIntlListFormat);\n app.component('VIntlDateTimeFormat', VIntlDateTimeFormat);\n app.component('VIntlDisplayNames', VIntlDisplayNames);\n app.component('VIntlRelativeTimeFormat', VIntlRelativeTimeFormat);\n installed = true;\n }\n};\n\nexport default install;\n"],"names":["_sfc_main$4","defineComponent","props","computed","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_createElementBlock","_normalizeClass","_sfc_main$3","_sfc_main$2","_sfc_main$1","_sfc_main","setVueInstance","instance","installed","install","app","VIntlNumberFormat","VIntlListFormat","VIntlDateTimeFormat","VIntlDisplayNames","VIntlRelativeTimeFormat","install$1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,MACV,SAAS,OAAO;AAAA,QAKd,SAAS;AAAA,QAKT,SAAS,CAAC;AAAA,MAAA;AAAA,IAEd;AAAA,EACF;AAAA,EACA,MAAMC,GAAO;AAOJ,WAAA;AAAA,MACL,wBAP6BC,EAAS,MAC/B,IAAI,KAAK;AAAA,QACdD,EAAM,OAAO;AAAA,QACbA,EAAM,OAAO;AAAA,MAAA,EACb,OAAOA,EAAM,QAAQ,QAAQA,EAAM,QAAQ,IAAI,CAClD;AAAA,IAEC;AAAA,EAEJ;AACF,CAAC;AAnDU,SAAAE,EAAAC,GAAEC,GAAOC,GAAAC,GAAAC,GAAAC,GAAA;cACfC,EAAsB,OAAA;AAAA,IAAA,OAAAC,EAAAP,EAAA,OAAA;AAAA;;iDCMhBY,IAAiB,CAACC,MAA0B;AAEzD;ACFA,IAAIC,IAAY;AAEhB,MAAMC,IAAiD,CAACC,MAAqB;AAC3E,EAAKF,MACHF,EAAkB,GACdI,EAAA,UAAU,qBAAqBC,CAAiB,GAChDD,EAAA,UAAU,mBAAmBE,CAAe,GAC5CF,EAAA,UAAU,uBAAuBG,CAAmB,GACpDH,EAAA,UAAU,qBAAqBI,CAAiB,GAChDJ,EAAA,UAAU,2BAA2BK,CAAuB,GACpDP,IAAA;AAEhB,GAEAQ,IAAeP;"}
1
+ {"version":3,"file":"v-intl.js","sources":["../src/components/VIntlNumberFormat.vue","../src/components/VIntlListFormat.vue","../src/components/VIntlDateTimeFormat.vue","../src/components/VIntlDisplayNames.vue","../src/components/VIntlRelativeTimeFormat.vue","../src/utils/config/index.ts","../src/install.ts"],"sourcesContent":["<template>\n <div :class=\"wrapper\">\n {{ intlNumberFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlNumberFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Number,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with NumberFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlNumberFormat = computed(() => {\n if (props.toParts) {\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlNumberFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlListFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlListFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Array as PropType<Iterable<string>>,\n required: true,\n },\n format: {\n type: Object,\n required: true,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlListFormat = computed(() => {\n if (props.toParts) {\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlListFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDateTime }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlDateTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object as PropType<number | Date | undefined>,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlDateTime = computed(() => {\n if (props.toParts) {\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlDateTime,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDisplayNames }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlDisplayNames',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n /**\n * When format.options.type is \"region\", code must be either an ISO-3166 2-letter country code or a UN M49 3-digit region code.\n * When format.options.type is \"language\", code must be conform to Unicode's language identifier grammar.\n * When format.options.type is \"currency\", code must be a ISO-4217 3-letter currency code.\n * When format.options.type is \"script\", code must be a ISO-15924 4-letter script code.\n */\n type: String,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DisplayNames options\n * read more: https://v8.dev/features/intl-displaynames#full-api\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlDisplayNames = computed(() => {\n const intlNames = new Intl.DisplayNames(\n [props.format.locales],\n props.format.options,\n );\n return intlNames.of(props.payload);\n });\n return {\n intlDisplayNames,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlRelativeTimeFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlRelativeTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object,\n required: true,\n default: () => ({\n number: 1,\n time: 'days',\n }),\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlRelativeTimeFormat = computed(() => {\n return new Intl.RelativeTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload.number, props.payload.time);\n });\n return {\n intlRelativeTimeFormat,\n };\n },\n });\n</script>\n","import { App as Application } from 'vue';\n\nconst config = {};\n\nexport let VueInstance: Application;\n\nexport { config as default };\n\nexport const setVueInstance = (instance: Application) => {\n VueInstance = instance;\n};\n","import { App as Application, Plugin } from 'vue';\nimport VIntlNumberFormat from './components/VIntlNumberFormat.vue';\nimport VIntlListFormat from './components/VIntlListFormat.vue';\nimport VIntlDateTimeFormat from './components/VIntlDateTimeFormat.vue';\nimport VIntlDisplayNames from './components/VIntlDisplayNames.vue';\nimport VIntlRelativeTimeFormat from './components/VIntlRelativeTimeFormat.vue';\nimport { setVueInstance } from './utils/config';\n\nlet installed = false;\n\nconst install: Exclude<Plugin['install'], undefined> = (app: Application) => {\n if (!installed) {\n setVueInstance(app);\n app.component('VIntlNumberFormat', VIntlNumberFormat);\n app.component('VIntlListFormat', VIntlListFormat);\n app.component('VIntlDateTimeFormat', VIntlDateTimeFormat);\n app.component('VIntlDisplayNames', VIntlDisplayNames);\n app.component('VIntlRelativeTimeFormat', VIntlRelativeTimeFormat);\n installed = true;\n }\n};\n\nexport default install;\n"],"names":["_sfc_main$4","defineComponent","props","computed","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_createElementBlock","_normalizeClass","_sfc_main$3","_sfc_main$2","_sfc_main$1","_sfc_main","VueInstance","setVueInstance","instance","installed","install","app","VIntlNumberFormat","VIntlListFormat","VIntlDateTimeFormat","VIntlDisplayNames","VIntlRelativeTimeFormat","install$1"],"mappings":";;;;;;AAQE,MAAAA,IAAeC,EAAgB;AAAA,EAC7B,MAAM;AAAA,EACN,OAAO;AAAA,IACL,SAAS;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,IACZ;AAAA,IACA,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,QAKd,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA,QAKT,SAAS,CAAC;AAAA,MAAA;AAAA,IAEd;AAAA,IACA,SAAS;AAAA,MACP,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACX;AAAA,EACF;AAAA,EACA,MAAMC,GAAO;AAaJ,WAAA;AAAA,MACL,kBAbuBC,EAAS,MAC5BD,EAAM,UACD,IAAI,KAAK;AAAA,QACdA,EAAM,OAAO;AAAA,QACbA,EAAM,OAAO;AAAA,MAAA,EACb,cAAcA,EAAM,OAAO,IAExB,IAAI,KAAK;AAAA,QACdA,EAAM,OAAO;AAAA,QACbA,EAAM,OAAO;AAAA,MAAA,EACb,OAAOA,EAAM,OAAO,CACvB;AAAA,IAEC;AAAA,EAEJ;AACF,CAAC;;;;;;AA1DU,SAAAE,EAAAC,GAAEC,GAAOC,GAAAC,GAAAC,GAAAC,GAAA;cACfC,EAAgB,OAAA;AAAA,IAAA,OAAAC,EAAAP,EAAA,OAAA;AAAA;;iDCQrBQ,I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AA,UAAU,qBAAqBI,CAAiB,GAChDJ,EAAA,UAAU,2BAA2BK,CAAuB,GACpDP,IAAA;AAEhB,GAEAQ,IAAeP;"}
@@ -8,7 +8,7 @@
8
8
  })(this, function (a, e) {
9
9
  'use strict';
10
10
  /*!
11
- * @vinayakkulkarni/v-intl v2.1.0
11
+ * @vinayakkulkarni/v-intl v2.2.0
12
12
  * (c) 2023 Vinayak Kulkarni
13
13
  * @license MIT
14
14
  */ const y = e.defineComponent({
@@ -135,7 +135,7 @@
135
135
  );
136
136
  }
137
137
  const f = i(_, [['render', T]]),
138
- D = e.defineComponent({
138
+ V = e.defineComponent({
139
139
  name: 'VIntlDisplayNames',
140
140
  props: {
141
141
  wrapper: { type: String, required: !1, default: '' },
@@ -156,7 +156,7 @@
156
156
  };
157
157
  },
158
158
  });
159
- function V(t, n, r, o, l, s) {
159
+ function D(t, n, r, o, l, s) {
160
160
  return (
161
161
  e.openBlock(),
162
162
  e.createElementBlock(
@@ -167,7 +167,7 @@
167
167
  )
168
168
  );
169
169
  }
170
- const d = i(D, [['render', V]]),
170
+ const d = i(V, [['render', D]]),
171
171
  b = e.defineComponent({
172
172
  name: 'VIntlRelativeTimeFormat',
173
173
  props: {
@@ -205,12 +205,15 @@
205
205
  )
206
206
  );
207
207
  }
208
- const p = i(b, [['render', N]]),
209
- q = (t) => {};
210
- let u = !1;
208
+ const p = i(b, [['render', N]]);
209
+ let q;
211
210
  const w = (t) => {
211
+ q = t;
212
+ };
213
+ let u = !1;
214
+ const S = (t) => {
212
215
  u ||
213
- (q(),
216
+ (w(t),
214
217
  t.component('VIntlNumberFormat', m),
215
218
  t.component('VIntlListFormat', c),
216
219
  t.component('VIntlDateTimeFormat', f),
@@ -223,7 +226,7 @@
223
226
  (a.VIntlListFormat = c),
224
227
  (a.VIntlNumberFormat = m),
225
228
  (a.VIntlRelativeTimeFormat = p),
226
- (a.default = w),
229
+ (a.default = S),
227
230
  Object.defineProperties(a, {
228
231
  __esModule: { value: !0 },
229
232
  [Symbol.toStringTag]: { value: 'Module' },
@@ -1 +1 @@
1
- {"version":3,"file":"v-intl.umd.cjs","sources":["../src/components/VIntlNumberFormat.vue","../src/components/VIntlListFormat.vue","../src/components/VIntlDateTimeFormat.vue","../src/components/VIntlDisplayNames.vue","../src/components/VIntlRelativeTimeFormat.vue","../src/utils/config/index.ts","../src/install.ts"],"sourcesContent":["<template>\n <div :class=\"wrapper\">\n {{ intlNumberFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlNumberFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Number,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with NumberFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlNumberFormat = computed(() => {\n if (props.toParts) {\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlNumberFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlListFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlListFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Array as PropType<Iterable<string>>,\n required: true,\n },\n format: {\n type: Object,\n required: true,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlListFormat = computed(() => {\n if (props.toParts) {\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlListFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDateTime }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlDateTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object as PropType<number | Date | undefined>,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlDateTime = computed(() => {\n if (props.toParts) {\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlDateTime,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDisplayNames }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlDisplayNames',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n /**\n * When format.options.type is \"region\", code must be either an ISO-3166 2-letter country code or a UN M49 3-digit region code.\n * When format.options.type is \"language\", code must be conform to Unicode's language identifier grammar.\n * When format.options.type is \"currency\", code must be a ISO-4217 3-letter currency code.\n * When format.options.type is \"script\", code must be a ISO-15924 4-letter script code.\n */\n type: String,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DisplayNames options\n * read more: https://v8.dev/features/intl-displaynames#full-api\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlDisplayNames = computed(() => {\n const intlNames = new Intl.DisplayNames(\n [props.format.locales],\n props.format.options,\n );\n return intlNames.of(props.payload);\n });\n return {\n intlDisplayNames,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlRelativeTimeFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlRelativeTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object,\n required: true,\n default: () => ({\n number: 1,\n time: 'days',\n }),\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlRelativeTimeFormat = computed(() => {\n return new Intl.RelativeTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload.number, props.payload.time);\n });\n return {\n intlRelativeTimeFormat,\n };\n },\n });\n</script>\n","import { App as Application } from 'vue';\n\nconst config = {};\n\nexport let VueInstance: Application;\n\nexport { config as default };\n\nexport const setVueInstance = (instance: Application) => {\n VueInstance = instance;\n};\n","import { App as Application, Plugin } from 'vue';\nimport VIntlNumberFormat from './components/VIntlNumberFormat.vue';\nimport VIntlListFormat from './components/VIntlListFormat.vue';\nimport VIntlDateTimeFormat from './components/VIntlDateTimeFormat.vue';\nimport VIntlDisplayNames from './components/VIntlDisplayNames.vue';\nimport VIntlRelativeTimeFormat from './components/VIntlRelativeTimeFormat.vue';\nimport { setVueInstance } from './utils/config';\n\nlet installed = false;\n\nconst install: Exclude<Plugin['install'], undefined> = (app: Application) => {\n if (!installed) {\n setVueInstance(app);\n app.component('VIntlNumberFormat', VIntlNumberFormat);\n app.component('VIntlListFormat', VIntlListFormat);\n app.component('VIntlDateTimeFormat', VIntlDateTimeFormat);\n app.component('VIntlDisplayNames', VIntlDisplayNames);\n app.component('VIntlRelativeTimeFormat', VIntlRelativeTimeFormat);\n installed = true;\n }\n};\n\nexport default install;\n"],"names":["_sfc_main$4","defineComponent","props","computed","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_createElementBlock","_normalizeClass","_sfc_main$3","_sfc_main$2","_sfc_main$1","_sfc_main","setVueInstance","instance","installed","install$1","app","VIntlNumberFormat","VIntlListFormat","VIntlDateTimeFormat","VIntlDisplayNames","VIntlRelativeTimeFormat"],"mappings":";;;;4PAQE,MAAAA,EAAeC,kBAAgB,CAC7B,KAAM,oBACN,MAAO,CACL,QAAS,CACP,KAAM,OACN,SAAU,GACV,QAAS,EACX,EACA,QAAS,CACP,KAAM,OACN,SAAU,EACZ,EACA,OAAQ,CACN,KAAM,OACN,SAAU,GACV,QAAS,KAAO,CAKd,QAAS,QAKT,QAAS,CAAC,CAAA,EAEd,EACA,QAAS,CACP,KAAM,QACN,SAAU,GACV,QAAS,EACX,CACF,EACA,MAAMC,EAAO,CAaJ,MAAA,CACL,iBAbuBC,EAAAA,SAAS,IAC5BD,EAAM,QACD,IAAI,KAAK,aACdA,EAAM,OAAO,QACbA,EAAM,OAAO,OAAA,EACb,cAAcA,EAAM,OAAO,EAExB,IAAI,KAAK,aACdA,EAAM,OAAO,Q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AAI,KAAK,mBACdD,EAAM,OAAO,QACbA,EAAM,OAAO,OAAA,EACb,OAAOA,EAAM,QAAQ,OAAQA,EAAM,QAAQ,IAAI,CAClD,CAEC,CAEJ,CACF,CAAC,EAnDU,SAAAE,EAAAC,EAAEC,EAAOC,EAAAC,EAAAC,EAAAC,EAAA,sBACfC,EAAsB,mBAAA,MAAA,CAAA,MAAAC,EAAAA,eAAAP,EAAA,OAAA,8ECMhBY,EAAkBC,GAA0B,CAEzD,ECFA,IAAIC,EAAY,GAchB,MAAAC,EAZwDC,GAAqB,CACtEF,IACHF,EAAkB,EACdI,EAAA,UAAU,oBAAqBC,CAAiB,EAChDD,EAAA,UAAU,kBAAmBE,CAAe,EAC5CF,EAAA,UAAU,sBAAuBG,CAAmB,EACpDH,EAAA,UAAU,oBAAqBI,CAAiB,EAChDJ,EAAA,UAAU,0BAA2BK,CAAuB,EACpDP,EAAA,GAEhB"}
1
+ {"version":3,"file":"v-intl.umd.cjs","sources":["../src/components/VIntlNumberFormat.vue","../src/components/VIntlListFormat.vue","../src/components/VIntlDateTimeFormat.vue","../src/components/VIntlDisplayNames.vue","../src/components/VIntlRelativeTimeFormat.vue","../src/utils/config/index.ts","../src/install.ts"],"sourcesContent":["<template>\n <div :class=\"wrapper\">\n {{ intlNumberFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlNumberFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Number,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with NumberFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlNumberFormat = computed(() => {\n if (props.toParts) {\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.NumberFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlNumberFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlListFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlListFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Array as PropType<Iterable<string>>,\n required: true,\n },\n format: {\n type: Object,\n required: true,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlListFormat = computed(() => {\n if (props.toParts) {\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.ListFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlListFormat,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDateTime }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n import type { PropType } from 'vue';\n\n export default defineComponent({\n name: 'VIntlDateTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object as PropType<number | Date | undefined>,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat\n */\n options: {},\n }),\n },\n toParts: {\n type: Boolean,\n required: false,\n default: false,\n },\n },\n setup(props) {\n const intlDateTime = computed(() => {\n if (props.toParts) {\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).formatToParts(props.payload);\n }\n return new Intl.DateTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload);\n });\n return {\n intlDateTime,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlDisplayNames }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlDisplayNames',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n /**\n * When format.options.type is \"region\", code must be either an ISO-3166 2-letter country code or a UN M49 3-digit region code.\n * When format.options.type is \"language\", code must be conform to Unicode's language identifier grammar.\n * When format.options.type is \"currency\", code must be a ISO-4217 3-letter currency code.\n * When format.options.type is \"script\", code must be a ISO-15924 4-letter script code.\n */\n type: String,\n required: true,\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DisplayNames options\n * read more: https://v8.dev/features/intl-displaynames#full-api\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlDisplayNames = computed(() => {\n const intlNames = new Intl.DisplayNames(\n [props.format.locales],\n props.format.options,\n );\n return intlNames.of(props.payload);\n });\n return {\n intlDisplayNames,\n };\n },\n });\n</script>\n","<template>\n <div :class=\"wrapper\">\n {{ intlRelativeTimeFormat }}\n </div>\n</template>\n\n<script lang=\"ts\">\n import { computed, defineComponent } from 'vue';\n export default defineComponent({\n name: 'VIntlRelativeTimeFormat',\n props: {\n wrapper: {\n type: String,\n required: false,\n default: '',\n },\n payload: {\n type: Object,\n required: true,\n default: () => ({\n number: 1,\n time: 'days',\n }),\n },\n format: {\n type: Object,\n required: false,\n default: () => ({\n /**\n * Can be string or array with fallback\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl#Locale_identification_and_negotiation\n */\n locales: 'en-US',\n /**\n * Has to be a object with DateTimeFormat options\n * read more: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat/RelativeTimeFormat\n */\n options: {},\n }),\n },\n },\n setup(props) {\n const intlRelativeTimeFormat = computed(() => {\n return new Intl.RelativeTimeFormat(\n props.format.locales,\n props.format.options,\n ).format(props.payload.number, props.payload.time);\n });\n return {\n intlRelativeTimeFormat,\n };\n },\n });\n</script>\n","import { App as Application } from 'vue';\n\nconst config = {};\n\nexport let VueInstance: Application;\n\nexport { config as default };\n\nexport const setVueInstance = (instance: Application) => {\n VueInstance = instance;\n};\n","import { App as Application, Plugin } from 'vue';\nimport VIntlNumberFormat from './components/VIntlNumberFormat.vue';\nimport VIntlListFormat from './components/VIntlListFormat.vue';\nimport VIntlDateTimeFormat from './components/VIntlDateTimeFormat.vue';\nimport VIntlDisplayNames from './components/VIntlDisplayNames.vue';\nimport VIntlRelativeTimeFormat from './components/VIntlRelativeTimeFormat.vue';\nimport { setVueInstance } from './utils/config';\n\nlet installed = false;\n\nconst install: Exclude<Plugin['install'], undefined> = (app: Application) => {\n if (!installed) {\n setVueInstance(app);\n app.component('VIntlNumberFormat', VIntlNumberFormat);\n app.component('VIntlListFormat', VIntlListFormat);\n app.component('VIntlDateTimeFormat', VIntlDateTimeFormat);\n app.component('VIntlDisplayNames', VIntlDisplayNames);\n app.component('VIntlRelativeTimeFormat', VIntlRelativeTimeFormat);\n installed = true;\n }\n};\n\nexport default install;\n"],"names":["_sfc_main$4","defineComponent","props","computed","_sfc_render","_ctx","_cache","$props","$setup","$data","$options","_createElementBlock","_normalizeClass","_sfc_main$3","_sfc_main$2","_sfc_main$1","_sfc_main","VueInstance","setVueInstance","instance","installed","install$1","app","VIntlNumberFormat","VIntlListFormat","VIntlDate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
+ "version": "2.2.0",
4
4
  "description": "Native i18n components for your shiny Vue 3 apps",
5
5
  "main": "./dist/v-intl.js",
6
6
  "module": "./dist/v-intl.js",
@@ -46,7 +46,7 @@
46
46
  "@typescript-eslint/eslint-plugin": "^5.57.0",
47
47
  "@typescript-eslint/parser": "^5.57.0",
48
48
  "@vinayakkulkarni/prettier-config-vue": "^1.0.0",
49
- "@vitejs/plugin-vue": "^3.2.0",
49
+ "@vitejs/plugin-vue": "^4.1.0",
50
50
  "@vue/runtime-dom": "^3.2.45",
51
51
  "@vue/test-utils": "^2.3.2",
52
52
  "eslint": "^8.37.0",
@@ -66,7 +66,7 @@
66
66
  "stylelint-config-recommended-vue": "^1.4.0",
67
67
  "stylelint-prettier": "^3.0.0",
68
68
  "typescript": "^5.0.3",
69
- "vite": "^3.2.4",
69
+ "vite": "^4.2.1",
70
70
  "vitepress": "^1.0.0-alpha.64",
71
71
  "vue": "^3.2.47",
72
72
  "vue-tsc": "^1.2.0"