vue-intl 7.2.2 → 7.2.3

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/index.d.ts CHANGED
@@ -1,14 +1,36 @@
1
- import { type IntlFormatters as CoreIntlFormatters, type MessageDescriptor } from "@formatjs/intl";
2
- export * from "./plugin.js";
3
- export * from "./provider.js";
4
- export { intlKey } from "./injection-key.js";
5
- export { type IntlShape, type IntlConfig, type ResolvedIntlConfig, createIntlCache, type MessageDescriptor, type IntlCache, type Formatters, type FormatDisplayNameOptions, type FormatListOptions, type FormatPluralOptions, type FormatRelativeTimeOptions, type FormatNumberOptions, type FormatDateOptions, type CustomFormatConfig, type CustomFormats, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode, IntlError } from "@formatjs/intl";
6
- import { type VNode } from "vue";
7
- export type IntlFormatters = CoreIntlFormatters<VNode>;
8
- export declare function defineMessages<
9
- K extends keyof any,
10
- T = MessageDescriptor,
11
- U extends Record<K, T> = Record<K, T>
12
- >(msgs: U): U;
13
- export declare function defineMessage<T>(msg: T): T;
14
- export type { MessageFormatElement } from "@formatjs/icu-messageformat-parser";
1
+ import { CustomFormatConfig, CustomFormats, FormatDateOptions, FormatDisplayNameOptions, FormatListOptions, FormatNumberOptions, FormatPluralOptions, FormatRelativeTimeOptions, Formatters, IntlCache, IntlConfig, IntlConfig as IntlConfig$1, IntlError, IntlErrorCode, IntlFormatters as IntlFormatters$1, IntlShape, IntlShape as IntlShape$1, InvalidConfigError, MessageDescriptor, MessageDescriptor as MessageDescriptor$1, MessageFormatError, MissingDataError, MissingTranslationError, ResolvedIntlConfig, UnsupportedFormatterError, createIntlCache } from "@formatjs/intl";
2
+ import { Plugin, RendererElement, RendererNode, VNode } from "vue";
3
+ import { MessageFormatElement } from "@formatjs/icu-messageformat-parser";
4
+
5
+ //#region packages/vue-intl/plugin.d.ts
6
+ declare module "vue" {
7
+ interface ComponentCustomProperties {
8
+ $intl: IntlShape$1;
9
+ $formatMessage: IntlFormatters$1["formatMessage"];
10
+ $formatDate: IntlFormatters$1["formatDate"];
11
+ $formatTime: IntlFormatters$1["formatTime"];
12
+ $formatDateTimeRange: IntlFormatters$1["formatDateTimeRange"];
13
+ $formatRelativeTime: IntlFormatters$1["formatRelativeTime"];
14
+ $formatDisplayName: IntlFormatters$1["formatDisplayName"];
15
+ $formatNumber: IntlFormatters$1["formatNumber"];
16
+ $formatList: IntlFormatters$1["formatList"];
17
+ }
18
+ }
19
+ declare const createIntl: (options: IntlConfig$1) => Plugin;
20
+ //#endregion
21
+ //#region packages/vue-intl/provider.d.ts
22
+ declare function provideIntl(intl: IntlShape$1<VNode>): void;
23
+ declare function useIntl(): IntlShape$1<VNode<RendererNode, RendererElement, {
24
+ [key: string]: any;
25
+ }>>;
26
+ //#endregion
27
+ //#region packages/vue-intl/injection-key.d.ts
28
+ declare const intlKey: unique symbol;
29
+ //#endregion
30
+ //#region packages/vue-intl/index.d.ts
31
+ type IntlFormatters = IntlFormatters$1<VNode>;
32
+ declare function defineMessages<K extends keyof any, T = MessageDescriptor$1, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
33
+ declare function defineMessage<T>(msg: T): T;
34
+ //#endregion
35
+ export { type CustomFormatConfig, type CustomFormats, type FormatDateOptions, type FormatDisplayNameOptions, type FormatListOptions, type FormatNumberOptions, type FormatPluralOptions, type FormatRelativeTimeOptions, type Formatters, type IntlCache, type IntlConfig, IntlError, IntlErrorCode, IntlFormatters, type IntlShape, InvalidConfigError, type MessageDescriptor, type MessageFormatElement, MessageFormatError, MissingDataError, MissingTranslationError, type ResolvedIntlConfig, UnsupportedFormatterError, createIntl, createIntlCache, defineMessage, defineMessages, intlKey, provideIntl, useIntl };
36
+ //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -1,12 +1,42 @@
1
- import "@formatjs/intl";
2
- export * from "./plugin.js";
3
- export * from "./provider.js";
4
- export { intlKey } from "./injection-key.js";
5
- export { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode, IntlError } from "@formatjs/intl";
6
- import "vue";
7
- export function defineMessages(msgs) {
1
+ import { IntlError, IntlErrorCode, InvalidConfigError, MessageFormatError, MissingDataError, MissingTranslationError, UnsupportedFormatterError, createIntl as createIntl$1, createIntlCache } from "@formatjs/intl";
2
+ import { inject, provide } from "vue";
3
+ //#region packages/vue-intl/injection-key.ts
4
+ const intlKey = Symbol();
5
+ //#endregion
6
+ //#region packages/vue-intl/plugin.ts
7
+ const createIntl = (options) => ({ install(app) {
8
+ if (!options) throw new Error("Missing `options` for vue-intl plugin");
9
+ const intl = createIntl$1(options);
10
+ app.config.globalProperties.$intl = intl;
11
+ app.config.globalProperties.$formatMessage = intl.formatMessage;
12
+ app.config.globalProperties.$formatDate = intl.formatDate;
13
+ app.config.globalProperties.$formatTime = intl.formatTime;
14
+ app.config.globalProperties.$formatDateTimeRange = intl.formatDateTimeRange;
15
+ app.config.globalProperties.$formatRelativeTime = intl.formatRelativeTime;
16
+ app.config.globalProperties.$formatDisplayName = intl.formatDisplayName;
17
+ app.config.globalProperties.$formatNumber = intl.formatNumber;
18
+ app.config.globalProperties.$formatList = intl.formatList;
19
+ app.provide(intlKey, intl);
20
+ } });
21
+ //#endregion
22
+ //#region packages/vue-intl/provider.ts
23
+ function provideIntl(intl) {
24
+ provide(intlKey, intl);
25
+ }
26
+ function useIntl() {
27
+ const intl = inject(intlKey);
28
+ if (!intl) throw new Error(`An intl object was not injected. Install the plugin or use provideIntl.`);
29
+ return intl;
30
+ }
31
+ //#endregion
32
+ //#region packages/vue-intl/index.ts
33
+ function defineMessages(msgs) {
8
34
  return msgs;
9
35
  }
10
- export function defineMessage(msg) {
36
+ function defineMessage(msg) {
11
37
  return msg;
12
38
  }
39
+ //#endregion
40
+ export { IntlError, IntlErrorCode, InvalidConfigError, MessageFormatError, MissingDataError, MissingTranslationError, UnsupportedFormatterError, createIntl, createIntlCache, defineMessage, defineMessages, intlKey, provideIntl, useIntl };
41
+
42
+ //# sourceMappingURL=index.js.map
package/index.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["_createIntl"],"sources":["../injection-key.ts","../plugin.ts","../provider.ts","../index.ts"],"sourcesContent":["export const intlKey: unique symbol = Symbol()\n","import {\n createIntl as _createIntl,\n type IntlConfig,\n type IntlFormatters,\n type IntlShape,\n} from '@formatjs/intl'\nimport type {Plugin} from 'vue'\nimport {intlKey} from '#packages/vue-intl/injection-key.js'\n\ndeclare module 'vue' {\n interface ComponentCustomProperties {\n $intl: IntlShape\n $formatMessage: IntlFormatters['formatMessage']\n $formatDate: IntlFormatters['formatDate']\n $formatTime: IntlFormatters['formatTime']\n $formatDateTimeRange: IntlFormatters['formatDateTimeRange']\n $formatRelativeTime: IntlFormatters['formatRelativeTime']\n $formatDisplayName: IntlFormatters['formatDisplayName']\n $formatNumber: IntlFormatters['formatNumber']\n $formatList: IntlFormatters['formatList']\n }\n}\n\nexport const createIntl = (options: IntlConfig): Plugin => ({\n install(app) {\n if (!options) {\n throw new Error('Missing `options` for vue-intl plugin')\n }\n const intl = _createIntl(options)\n\n app.config.globalProperties.$intl = intl\n app.config.globalProperties.$formatMessage = intl.formatMessage\n app.config.globalProperties.$formatDate = intl.formatDate\n app.config.globalProperties.$formatTime = intl.formatTime\n app.config.globalProperties.$formatDateTimeRange = intl.formatDateTimeRange\n app.config.globalProperties.$formatRelativeTime = intl.formatRelativeTime\n app.config.globalProperties.$formatDisplayName = intl.formatDisplayName\n app.config.globalProperties.$formatNumber = intl.formatNumber\n app.config.globalProperties.$formatList = intl.formatList\n\n app.provide(intlKey, intl)\n },\n})\n","import {type IntlShape} from '@formatjs/intl'\nimport {\n inject,\n provide,\n type RendererElement,\n type RendererNode,\n type VNode,\n} from 'vue'\nimport {intlKey} from '#packages/vue-intl/injection-key.js'\n\nexport function provideIntl(intl: IntlShape<VNode>): void {\n provide(intlKey, intl)\n}\n\nexport function useIntl(): IntlShape<\n VNode<\n RendererNode,\n RendererElement,\n {\n [key: string]: any\n }\n >\n> {\n const intl = inject<IntlShape<VNode>>(intlKey)\n if (!intl) {\n throw new Error(\n `An intl object was not injected. Install the plugin or use provideIntl.`\n )\n }\n return intl\n}\n","import {\n type IntlFormatters as CoreIntlFormatters,\n type MessageDescriptor,\n} from '@formatjs/intl'\nexport * from '#packages/vue-intl/plugin.js'\nexport * from '#packages/vue-intl/provider.js'\nexport {intlKey} from '#packages/vue-intl/injection-key.js'\nexport {\n type IntlShape,\n type IntlConfig,\n type ResolvedIntlConfig,\n createIntlCache,\n type MessageDescriptor,\n type IntlCache,\n type Formatters,\n type FormatDisplayNameOptions,\n type FormatListOptions,\n type FormatPluralOptions,\n type FormatRelativeTimeOptions,\n type FormatNumberOptions,\n type FormatDateOptions,\n type CustomFormatConfig,\n type CustomFormats,\n UnsupportedFormatterError,\n InvalidConfigError,\n MissingDataError,\n MessageFormatError,\n MissingTranslationError,\n IntlErrorCode,\n IntlError,\n} from '@formatjs/intl'\nimport {type VNode} from 'vue'\n\nexport type IntlFormatters = CoreIntlFormatters<VNode>\n\nexport function defineMessages<\n K extends keyof any,\n T = MessageDescriptor,\n U extends Record<K, T> = Record<K, T>,\n>(msgs: U): U {\n return msgs\n}\n\nexport function defineMessage<T>(msg: T): T {\n return msg\n}\nexport type {MessageFormatElement} from '@formatjs/icu-messageformat-parser'\n"],"mappings":";;;AAAA,MAAa,UAAyB,QAAQ;;;ACuB9C,MAAa,cAAc,aAAiC,EAC1D,QAAQ,KAAK;AACX,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,wCAAwC;CAE1D,MAAM,OAAOA,aAAY,QAAQ;AAEjC,KAAI,OAAO,iBAAiB,QAAQ;AACpC,KAAI,OAAO,iBAAiB,iBAAiB,KAAK;AAClD,KAAI,OAAO,iBAAiB,cAAc,KAAK;AAC/C,KAAI,OAAO,iBAAiB,cAAc,KAAK;AAC/C,KAAI,OAAO,iBAAiB,uBAAuB,KAAK;AACxD,KAAI,OAAO,iBAAiB,sBAAsB,KAAK;AACvD,KAAI,OAAO,iBAAiB,qBAAqB,KAAK;AACtD,KAAI,OAAO,iBAAiB,gBAAgB,KAAK;AACjD,KAAI,OAAO,iBAAiB,cAAc,KAAK;AAE/C,KAAI,QAAQ,SAAS,KAAK;GAE7B;;;AChCD,SAAgB,YAAY,MAA8B;AACxD,SAAQ,SAAS,KAAK;;AAGxB,SAAgB,UAQd;CACA,MAAM,OAAO,OAAyB,QAAQ;AAC9C,KAAI,CAAC,KACH,OAAM,IAAI,MACR,0EACD;AAEH,QAAO;;;;ACMT,SAAgB,eAId,MAAY;AACZ,QAAO;;AAGT,SAAgB,cAAiB,KAAW;AAC1C,QAAO"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vue-intl",
3
3
  "description": "formatjs intl binding for vue",
4
- "version": "7.2.2",
4
+ "version": "7.2.3",
5
5
  "license": "ISC",
6
6
  "author": "Long Ho <holevietlong@gmail.com>",
7
7
  "type": "module",
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "dependencies": {
13
13
  "@babel/types": "^7.29.0",
14
- "@formatjs/intl": "4.1.5",
15
- "@formatjs/icu-messageformat-parser": "3.5.3"
14
+ "@formatjs/intl": "4.1.6",
15
+ "@formatjs/icu-messageformat-parser": "3.5.4"
16
16
  },
17
17
  "peerDependencies": {
18
18
  "vue": "^3.5.0"
@@ -1 +0,0 @@
1
- export declare const intlKey: unique symbol;
package/injection-key.js DELETED
@@ -1 +0,0 @@
1
- export const intlKey = Symbol();
package/plugin.d.ts DELETED
@@ -1,16 +0,0 @@
1
- import { type IntlConfig, type IntlFormatters, type IntlShape } from "@formatjs/intl";
2
- import type { Plugin } from "vue";
3
- declare module "vue" {
4
- interface ComponentCustomProperties {
5
- $intl: IntlShape;
6
- $formatMessage: IntlFormatters["formatMessage"];
7
- $formatDate: IntlFormatters["formatDate"];
8
- $formatTime: IntlFormatters["formatTime"];
9
- $formatDateTimeRange: IntlFormatters["formatDateTimeRange"];
10
- $formatRelativeTime: IntlFormatters["formatRelativeTime"];
11
- $formatDisplayName: IntlFormatters["formatDisplayName"];
12
- $formatNumber: IntlFormatters["formatNumber"];
13
- $formatList: IntlFormatters["formatList"];
14
- }
15
- }
16
- export declare const createIntl: (options: IntlConfig) => Plugin;
package/plugin.js DELETED
@@ -1,18 +0,0 @@
1
- import { createIntl as _createIntl } from "@formatjs/intl";
2
- import { intlKey } from "./injection-key.js";
3
- export const createIntl = (options) => ({ install(app) {
4
- if (!options) {
5
- throw new Error("Missing `options` for vue-intl plugin");
6
- }
7
- const intl = _createIntl(options);
8
- app.config.globalProperties.$intl = intl;
9
- app.config.globalProperties.$formatMessage = intl.formatMessage;
10
- app.config.globalProperties.$formatDate = intl.formatDate;
11
- app.config.globalProperties.$formatTime = intl.formatTime;
12
- app.config.globalProperties.$formatDateTimeRange = intl.formatDateTimeRange;
13
- app.config.globalProperties.$formatRelativeTime = intl.formatRelativeTime;
14
- app.config.globalProperties.$formatDisplayName = intl.formatDisplayName;
15
- app.config.globalProperties.$formatNumber = intl.formatNumber;
16
- app.config.globalProperties.$formatList = intl.formatList;
17
- app.provide(intlKey, intl);
18
- } });
package/provider.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { type IntlShape } from "@formatjs/intl";
2
- import { type RendererElement, type RendererNode, type VNode } from "vue";
3
- export declare function provideIntl(intl: IntlShape<VNode>): void;
4
- export declare function useIntl(): IntlShape<VNode<RendererNode, RendererElement, {
5
- [key: string]: any;
6
- }>>;
package/provider.js DELETED
@@ -1,13 +0,0 @@
1
- import "@formatjs/intl";
2
- import { inject, provide } from "vue";
3
- import { intlKey } from "./injection-key.js";
4
- export function provideIntl(intl) {
5
- provide(intlKey, intl);
6
- }
7
- export function useIntl() {
8
- const intl = inject(intlKey);
9
- if (!intl) {
10
- throw new Error(`An intl object was not injected. Install the plugin or use provideIntl.`);
11
- }
12
- return intl;
13
- }