vue-intl 6.5.15 → 6.5.17

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.
@@ -0,0 +1,10 @@
1
+ import { IntlFormatters as CoreIntlFormatters, MessageDescriptor } from '@formatjs/intl';
2
+ export * from './plugin';
3
+ export * from './provider';
4
+ export { intlKey } from './injection-key';
5
+ export { IntlShape, IntlConfig, ResolvedIntlConfig, createIntlCache, MessageDescriptor, IntlCache, Formatters, FormatDisplayNameOptions, FormatListOptions, FormatPluralOptions, FormatRelativeTimeOptions, FormatNumberOptions, FormatDateOptions, CustomFormatConfig, CustomFormats, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode, IntlError, } from '@formatjs/intl';
6
+ import { VNode } from 'vue';
7
+ export type IntlFormatters = CoreIntlFormatters<VNode>;
8
+ export declare function defineMessages<K extends keyof any, T = MessageDescriptor, U extends Record<K, T> = Record<K, T>>(msgs: U): U;
9
+ export declare function defineMessage<T>(msg: T): T;
10
+ export type { MessageFormatElement } from '@formatjs/icu-messageformat-parser';
@@ -0,0 +1,10 @@
1
+ export * from './plugin';
2
+ export * from './provider';
3
+ export { intlKey } from './injection-key';
4
+ export { createIntlCache, UnsupportedFormatterError, InvalidConfigError, MissingDataError, MessageFormatError, MissingTranslationError, IntlErrorCode, IntlError, } from '@formatjs/intl';
5
+ export function defineMessages(msgs) {
6
+ return msgs;
7
+ }
8
+ export function defineMessage(msg) {
9
+ return msg;
10
+ }
@@ -0,0 +1 @@
1
+ export declare const intlKey: unique symbol;
@@ -0,0 +1 @@
1
+ export const intlKey = Symbol();
@@ -0,0 +1,16 @@
1
+ import { IntlConfig, IntlFormatters, 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;
@@ -0,0 +1,20 @@
1
+ import { createIntl as _createIntl, } from '@formatjs/intl';
2
+ import { intlKey } from './injection-key';
3
+ export const createIntl = (options) => ({
4
+ install(app) {
5
+ if (!options) {
6
+ throw new Error('Missing `options` for vue-intl plugin');
7
+ }
8
+ const intl = _createIntl(options);
9
+ app.config.globalProperties.$intl = intl;
10
+ app.config.globalProperties.$formatMessage = intl.formatMessage;
11
+ app.config.globalProperties.$formatDate = intl.formatDate;
12
+ app.config.globalProperties.$formatTime = intl.formatTime;
13
+ app.config.globalProperties.$formatDateTimeRange = intl.formatDateTimeRange;
14
+ app.config.globalProperties.$formatRelativeTime = intl.formatRelativeTime;
15
+ app.config.globalProperties.$formatDisplayName = intl.formatDisplayName;
16
+ app.config.globalProperties.$formatNumber = intl.formatNumber;
17
+ app.config.globalProperties.$formatList = intl.formatList;
18
+ app.provide(intlKey, intl);
19
+ },
20
+ });
@@ -0,0 +1,6 @@
1
+ import { IntlShape } from '@formatjs/intl';
2
+ import { RendererElement, RendererNode, 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
+ }>>;
@@ -0,0 +1,12 @@
1
+ import { inject, provide } from 'vue';
2
+ import { intlKey } from './injection-key';
3
+ export function provideIntl(intl) {
4
+ provide(intlKey, intl);
5
+ }
6
+ export function useIntl() {
7
+ const intl = inject(intlKey);
8
+ if (!intl) {
9
+ throw new Error(`An intl object was not injected. Install the plugin or use provideIntl.`);
10
+ }
11
+ return intl;
12
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-intl",
3
- "version": "6.5.15",
3
+ "version": "6.5.17",
4
4
  "description": "formatjs intl binding for vue",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -19,8 +19,8 @@
19
19
  "dependencies": {
20
20
  "@babel/types": "^7.12.11",
21
21
  "tslib": "2",
22
- "@formatjs/intl": "3.0.1",
23
- "@formatjs/icu-messageformat-parser": "2.9.4"
22
+ "@formatjs/icu-messageformat-parser": "2.9.6",
23
+ "@formatjs/intl": "3.0.3"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "vue": "^3.4.0"
package/plugin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IntlConfig, IntlFormatters, IntlShape } from '@formatjs/intl';
2
- import Vue from 'vue';
2
+ import type { Plugin } from 'vue';
3
3
  declare module 'vue' {
4
4
  interface ComponentCustomProperties {
5
5
  $intl: IntlShape;
@@ -13,4 +13,4 @@ declare module 'vue' {
13
13
  $formatList: IntlFormatters['formatList'];
14
14
  }
15
15
  }
16
- export declare const createIntl: (options: IntlConfig) => Vue.Plugin;
16
+ export declare const createIntl: (options: IntlConfig) => Plugin;
package/provider.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IntlShape } from '@formatjs/intl';
2
- import { VNode } from 'vue';
2
+ import { RendererElement, RendererNode, VNode } from 'vue';
3
3
  export declare function provideIntl(intl: IntlShape<VNode>): void;
4
- export declare function useIntl(): IntlShape<VNode<import("vue").RendererNode, import("vue").RendererElement, {
4
+ export declare function useIntl(): IntlShape<VNode<RendererNode, RendererElement, {
5
5
  [key: string]: any;
6
6
  }>>;
package/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;AAmCA,wCAMC;AAED,sCAEC;;AAzCD,mDAAwB;AACxB,qDAA0B;AAC1B,iDAAuC;AAA/B,wGAAA,OAAO,OAAA;AACf,uCAuBuB;AAnBrB,uGAAA,eAAe,OAAA;AAYf,iHAAA,yBAAyB,OAAA;AACzB,0GAAA,kBAAkB,OAAA;AAClB,wGAAA,gBAAgB,OAAA;AAChB,0GAAA,kBAAkB,OAAA;AAClB,+GAAA,uBAAuB,OAAA;AACvB,qGAAA,aAAa,OAAA;AACb,iGAAA,SAAS,OAAA;AAMX,SAAgB,cAAc,CAI5B,IAAO;IACP,OAAO,IAAI,CAAA;AACb,CAAC;AAED,SAAgB,aAAa,CAAI,GAAM;IACrC,OAAO,GAAG,CAAA;AACZ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"injection-key.js","sourceRoot":"","sources":["injection-key.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,MAAM,EAAE,CAAA"}
package/plugin.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["plugin.ts"],"names":[],"mappings":";;;AAAA,yCAKuB;AAEvB,mDAAuC;AAgBhC,MAAM,UAAU,GAAG,CAAC,OAAmB,EAAc,EAAE,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG;QACT,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAA;QAC1D,CAAC;QACD,MAAM,IAAI,GAAG,IAAA,iBAAW,EAAC,OAAO,CAAC,CAAA;QAEjC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,KAAK,GAAG,IAAI,CAAA;QACxC,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,aAAa,CAAA;QAC/D,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAA;QACzD,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,WAAW,GAAG,IAAI,CAAC,UAAU,CAAA;QACzD,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,oBAAoB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