@vinayakkulkarni/v-intl 2.3.2 → 4.0.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/components/VIntlDateTimeFormat.vue.d.ts +13 -21
- package/dist/components/VIntlDisplayNames.vue.d.ts +11 -19
- package/dist/components/VIntlDurationFormat.vue.d.ts +13 -21
- package/dist/components/VIntlListFormat.vue.d.ts +13 -21
- package/dist/components/VIntlNumberFormat.vue.d.ts +13 -22
- package/dist/components/VIntlRelativeTimeFormat.vue.d.ts +12 -20
- package/dist/v-intl.js +3 -8
- package/dist/v-intl.js.map +1 -1
- package/package.json +28 -60
- package/dist/v-intl.cjs +0 -6
- package/dist/v-intl.cjs.map +0 -1
- package/dist/v-intl.umd.cjs +0 -6
- package/dist/v-intl.umd.cjs.map +0 -1
|
@@ -2,30 +2,22 @@ import type { RequiredOptions } from '../types';
|
|
|
2
2
|
type FormatOptions = RequiredOptions & {
|
|
3
3
|
options: Intl.DateTimeFormatOptions;
|
|
4
4
|
};
|
|
5
|
-
type
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
6
|
'payload': number | Date | undefined;
|
|
7
7
|
'format'?: FormatOptions;
|
|
8
8
|
'wrapper'?: string;
|
|
9
9
|
'toParts'?: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare const
|
|
12
|
-
"update:payload": (
|
|
13
|
-
"update:format": (
|
|
14
|
-
"update:wrapper": (
|
|
15
|
-
"update:toParts": (
|
|
16
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
17
|
-
"onUpdate:payload"?: ((
|
|
18
|
-
"onUpdate:format"?: ((
|
|
19
|
-
"onUpdate:wrapper"?: ((
|
|
20
|
-
"onUpdate:toParts"?: ((
|
|
21
|
-
}, {}, {}>;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:payload": (value: number | Date | undefined) => any;
|
|
13
|
+
"update:format": (value: FormatOptions) => any;
|
|
14
|
+
"update:wrapper": (value: string) => any;
|
|
15
|
+
"update:toParts": (value: boolean) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
17
|
+
"onUpdate:payload"?: ((value: number | Date | undefined) => any) | undefined;
|
|
18
|
+
"onUpdate:format"?: ((value: FormatOptions) => any) | undefined;
|
|
19
|
+
"onUpdate:wrapper"?: ((value: string) => any) | undefined;
|
|
20
|
+
"onUpdate:toParts"?: ((value: boolean) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
22
23
|
export default _default;
|
|
23
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
24
|
-
type __VLS_TypePropsToOption<T> = {
|
|
25
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
26
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
27
|
-
} : {
|
|
28
|
-
type: import('vue').PropType<T[K]>;
|
|
29
|
-
required: true;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
@@ -2,27 +2,19 @@ import type { RequiredOptions } from '../types';
|
|
|
2
2
|
type FormatOptions = RequiredOptions & {
|
|
3
3
|
options: Intl.DisplayNamesOptions;
|
|
4
4
|
};
|
|
5
|
-
type
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
6
|
'payload': string;
|
|
7
7
|
'format'?: FormatOptions;
|
|
8
8
|
'wrapper'?: string;
|
|
9
9
|
};
|
|
10
|
-
declare const
|
|
11
|
-
"update:payload": (
|
|
12
|
-
"update:format": (
|
|
13
|
-
"update:wrapper": (
|
|
14
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
15
|
-
"onUpdate:payload"?: ((
|
|
16
|
-
"onUpdate:format"?: ((
|
|
17
|
-
"onUpdate:wrapper"?: ((
|
|
18
|
-
}, {}, {}>;
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
11
|
+
"update:payload": (value: string) => any;
|
|
12
|
+
"update:format": (value: FormatOptions) => any;
|
|
13
|
+
"update:wrapper": (value: string) => any;
|
|
14
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
15
|
+
"onUpdate:payload"?: ((value: string) => any) | undefined;
|
|
16
|
+
"onUpdate:format"?: ((value: FormatOptions) => any) | undefined;
|
|
17
|
+
"onUpdate:wrapper"?: ((value: string) => any) | undefined;
|
|
18
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: typeof __VLS_export;
|
|
19
20
|
export default _default;
|
|
20
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
21
|
-
type __VLS_TypePropsToOption<T> = {
|
|
22
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
23
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
24
|
-
} : {
|
|
25
|
-
type: import('vue').PropType<T[K]>;
|
|
26
|
-
required: true;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
@@ -3,30 +3,22 @@ type FormatOptions = {
|
|
|
3
3
|
locales?: string | string[];
|
|
4
4
|
options?: DurationFormatOptions;
|
|
5
5
|
};
|
|
6
|
-
type
|
|
6
|
+
type __VLS_ModelProps = {
|
|
7
7
|
'payload': DurationInput;
|
|
8
8
|
'format'?: FormatOptions;
|
|
9
9
|
'wrapper'?: string;
|
|
10
10
|
'toParts'?: boolean;
|
|
11
11
|
};
|
|
12
|
-
declare const
|
|
13
|
-
"update:payload": (
|
|
14
|
-
"update:format": (
|
|
15
|
-
"update:wrapper": (
|
|
16
|
-
"update:toParts": (
|
|
17
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
18
|
-
"onUpdate:payload"?: ((
|
|
19
|
-
"onUpdate:format"?: ((
|
|
20
|
-
"onUpdate:wrapper"?: ((
|
|
21
|
-
"onUpdate:toParts"?: ((
|
|
22
|
-
}, {}, {}>;
|
|
12
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
13
|
+
"update:payload": (value: DurationInput) => any;
|
|
14
|
+
"update:format": (value: FormatOptions) => any;
|
|
15
|
+
"update:wrapper": (value: string) => any;
|
|
16
|
+
"update:toParts": (value: boolean) => any;
|
|
17
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
18
|
+
"onUpdate:payload"?: ((value: DurationInput) => any) | undefined;
|
|
19
|
+
"onUpdate:format"?: ((value: FormatOptions) => any) | undefined;
|
|
20
|
+
"onUpdate:wrapper"?: ((value: string) => any) | undefined;
|
|
21
|
+
"onUpdate:toParts"?: ((value: boolean) => any) | undefined;
|
|
22
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
23
24
|
export default _default;
|
|
24
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
25
|
-
type __VLS_TypePropsToOption<T> = {
|
|
26
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
27
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
28
|
-
} : {
|
|
29
|
-
type: import('vue').PropType<T[K]>;
|
|
30
|
-
required: true;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -2,30 +2,22 @@ import type { RequiredOptions } from '../types';
|
|
|
2
2
|
type FormatOptions = RequiredOptions & {
|
|
3
3
|
options: Intl.ListFormatOptions;
|
|
4
4
|
};
|
|
5
|
-
type
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
6
|
'payload': string;
|
|
7
7
|
'format'?: FormatOptions;
|
|
8
8
|
'wrapper'?: string;
|
|
9
9
|
'toParts'?: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare const
|
|
12
|
-
"update:payload": (
|
|
13
|
-
"update:format": (
|
|
14
|
-
"update:wrapper": (
|
|
15
|
-
"update:toParts": (
|
|
16
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
17
|
-
"onUpdate:payload"?: ((
|
|
18
|
-
"onUpdate:format"?: ((
|
|
19
|
-
"onUpdate:wrapper"?: ((
|
|
20
|
-
"onUpdate:toParts"?: ((
|
|
21
|
-
}, {}, {}>;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:payload": (value: string) => any;
|
|
13
|
+
"update:format": (value: FormatOptions) => any;
|
|
14
|
+
"update:wrapper": (value: string) => any;
|
|
15
|
+
"update:toParts": (value: boolean) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
17
|
+
"onUpdate:payload"?: ((value: string) => any) | undefined;
|
|
18
|
+
"onUpdate:format"?: ((value: FormatOptions) => any) | undefined;
|
|
19
|
+
"onUpdate:wrapper"?: ((value: string) => any) | undefined;
|
|
20
|
+
"onUpdate:toParts"?: ((value: boolean) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
22
23
|
export default _default;
|
|
23
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
24
|
-
type __VLS_TypePropsToOption<T> = {
|
|
25
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
26
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
27
|
-
} : {
|
|
28
|
-
type: import('vue').PropType<T[K]>;
|
|
29
|
-
required: true;
|
|
30
|
-
};
|
|
31
|
-
};
|
|
@@ -2,31 +2,22 @@ import type { RequiredOptions } from '../types';
|
|
|
2
2
|
type FormatOptions = RequiredOptions & {
|
|
3
3
|
options: Intl.NumberFormatOptions;
|
|
4
4
|
};
|
|
5
|
-
type
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
6
|
'payload': number;
|
|
7
7
|
'format'?: FormatOptions;
|
|
8
8
|
'wrapper'?: string;
|
|
9
9
|
'toParts'?: boolean;
|
|
10
10
|
};
|
|
11
|
-
declare const
|
|
12
|
-
"update:payload": (
|
|
13
|
-
"update:format": (
|
|
14
|
-
"update:wrapper": (
|
|
15
|
-
"update:toParts": (
|
|
16
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
17
|
-
"onUpdate:payload"?: ((
|
|
18
|
-
"onUpdate:format"?: ((
|
|
19
|
-
"onUpdate:wrapper"?: ((
|
|
20
|
-
"onUpdate:toParts"?: ((
|
|
21
|
-
}, {}, {}>;
|
|
11
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
12
|
+
"update:payload": (value: number) => any;
|
|
13
|
+
"update:format": (value: FormatOptions) => any;
|
|
14
|
+
"update:wrapper": (value: string) => any;
|
|
15
|
+
"update:toParts": (value: boolean) => any;
|
|
16
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
17
|
+
"onUpdate:payload"?: ((value: number) => any) | undefined;
|
|
18
|
+
"onUpdate:format"?: ((value: FormatOptions) => any) | undefined;
|
|
19
|
+
"onUpdate:wrapper"?: ((value: string) => any) | undefined;
|
|
20
|
+
"onUpdate:toParts"?: ((value: boolean) => any) | undefined;
|
|
21
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
22
|
+
declare const _default: typeof __VLS_export;
|
|
22
23
|
export default _default;
|
|
23
|
-
|
|
24
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
25
|
-
type __VLS_TypePropsToOption<T> = {
|
|
26
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
27
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
28
|
-
} : {
|
|
29
|
-
type: import('vue').PropType<T[K]>;
|
|
30
|
-
required: true;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -2,7 +2,7 @@ import type { RequiredOptions } from '../types';
|
|
|
2
2
|
type FormatOptions = RequiredOptions & {
|
|
3
3
|
options: Intl.RelativeTimeFormatOptions;
|
|
4
4
|
};
|
|
5
|
-
type
|
|
5
|
+
type __VLS_ModelProps = {
|
|
6
6
|
'payload': {
|
|
7
7
|
number: 1;
|
|
8
8
|
time: 'days';
|
|
@@ -10,28 +10,20 @@ type __VLS_PublicProps = {
|
|
|
10
10
|
'format'?: FormatOptions;
|
|
11
11
|
'wrapper'?: string;
|
|
12
12
|
};
|
|
13
|
-
declare const
|
|
14
|
-
"update:payload": (
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
14
|
+
"update:payload": (value: {
|
|
15
15
|
number: 1;
|
|
16
16
|
time: "days";
|
|
17
|
-
}) =>
|
|
18
|
-
"update:format": (
|
|
19
|
-
"update:wrapper": (
|
|
20
|
-
}, string, import("vue").PublicProps, Readonly<
|
|
21
|
-
"onUpdate:payload"?: ((
|
|
17
|
+
}) => any;
|
|
18
|
+
"update:format": (value: FormatOptions) => any;
|
|
19
|
+
"update:wrapper": (value: string) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
21
|
+
"onUpdate:payload"?: ((value: {
|
|
22
22
|
number: 1;
|
|
23
23
|
time: "days";
|
|
24
24
|
}) => any) | undefined;
|
|
25
|
-
"onUpdate:format"?: ((
|
|
26
|
-
"onUpdate:wrapper"?: ((
|
|
27
|
-
}, {}, {}>;
|
|
25
|
+
"onUpdate:format"?: ((value: FormatOptions) => any) | undefined;
|
|
26
|
+
"onUpdate:wrapper"?: ((value: string) => any) | undefined;
|
|
27
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
28
|
+
declare const _default: typeof __VLS_export;
|
|
28
29
|
export default _default;
|
|
29
|
-
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
30
|
-
type __VLS_TypePropsToOption<T> = {
|
|
31
|
-
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
32
|
-
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
33
|
-
} : {
|
|
34
|
-
type: import('vue').PropType<T[K]>;
|
|
35
|
-
required: true;
|
|
36
|
-
};
|
|
37
|
-
};
|
package/dist/v-intl.js
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
1
|
import { defineComponent as i, useModel as a, computed as u, openBlock as d, createElementBlock as m, normalizeClass as p, toDisplayString as f } from "vue";
|
|
2
|
-
/*!
|
|
3
|
-
* @vinayakkulkarni/v-intl v2.3.2
|
|
4
|
-
* (c) 2024 Vinayak Kulkarni
|
|
5
|
-
* @license MIT
|
|
6
|
-
*/
|
|
7
2
|
const y = /* @__PURE__ */ i({
|
|
8
3
|
__name: "VIntlNumberFormat",
|
|
9
4
|
props: {
|
|
@@ -176,15 +171,15 @@ const y = /* @__PURE__ */ i({
|
|
|
176
171
|
}
|
|
177
172
|
});
|
|
178
173
|
let v = !1;
|
|
179
|
-
const
|
|
174
|
+
const F = (e) => {
|
|
180
175
|
v || (e.component("VIntlNumberFormat", y), e.component("VIntlListFormat", w), e.component("VIntlDateTimeFormat", I), e.component("VIntlDisplayNames", M), e.component("VIntlRelativeTimeFormat", q), v = !0);
|
|
181
|
-
}
|
|
176
|
+
};
|
|
182
177
|
export {
|
|
183
178
|
I as VIntlDateTimeFormat,
|
|
184
179
|
M as VIntlDisplayNames,
|
|
185
180
|
w as VIntlListFormat,
|
|
186
181
|
y as VIntlNumberFormat,
|
|
187
182
|
q as VIntlRelativeTimeFormat,
|
|
188
|
-
|
|
183
|
+
F as default
|
|
189
184
|
};
|
|
190
185
|
//# sourceMappingURL=v-intl.js.map
|
package/dist/v-intl.js.map
CHANGED
|
@@ -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/install.ts"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed
|
|
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/install.ts"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.NumberFormatOptions;\n };\n\n const payload = defineModel<number>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n const toParts = defineModel<boolean>('toParts', {\n required: false,\n default: false,\n });\n\n const formattedNumbers = computed(() => {\n const numbers = new Intl.NumberFormat(\n format.value.locales,\n format.value.options,\n );\n return toParts.value\n ? numbers.formatToParts(payload.value)\n : numbers.format(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedNumbers }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.ListFormatOptions;\n };\n\n const payload = defineModel<string>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n const toParts = defineModel<boolean>('toParts', {\n required: false,\n default: false,\n });\n\n const formattedList = computed(() => {\n const list = new Intl.ListFormat(\n format.value.locales,\n format.value.options,\n );\n return toParts.value\n ? list.formatToParts(payload.value)\n : list.format(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedList }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.DateTimeFormatOptions;\n };\n\n const payload = defineModel<number | Date | undefined>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n const toParts = defineModel<boolean>('toParts', {\n required: false,\n default: false,\n });\n\n const formattedDateTime = computed(() => {\n const dateTime = new Intl.DateTimeFormat(\n format.value.locales,\n format.value.options,\n );\n return toParts.value\n ? dateTime.formatToParts(payload.value)\n : dateTime.format(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedDateTime }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.DisplayNamesOptions;\n };\n\n const payload = defineModel<string>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n\n const intlDisplayNames = computed(() => {\n const intlNames = new Intl.DisplayNames(\n format.value.locales,\n format.value.options,\n );\n return intlNames.of(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ intlDisplayNames }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.RelativeTimeFormatOptions;\n };\n\n const payload = defineModel<{\n number: 1;\n time: 'days';\n }>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n\n const formattedRelativeTime = computed(() => {\n return new Intl.RelativeTimeFormat(\n format.value.locales,\n format.value.options,\n ).format(payload.value.number, payload.value.time);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedRelativeTime }}\n </div>\n</template>\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":["payload","_useModel","__props","format","wrapper","toParts","formattedNumbers","computed","numbers","_createElementBlock","formattedList","list","formattedDateTime","dateTime","intlDisplayNames","formattedRelativeTime","installed","install","app","VIntlNumberFormat","VIntlListFormat","VIntlDateTimeFormat","VIntlDisplayNames","VIntlRelativeTimeFormat"],"mappings":";;;;;;;;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,CAAmB,GACxDH,EAAI,UAAU,qBAAqBI,CAAiB,GACpDJ,EAAI,UAAU,2BAA2BK,CAAuB,GAChEP,IAAY;AAEhB;"}
|
package/package.json
CHANGED
|
@@ -1,78 +1,46 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vinayakkulkarni/v-intl",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Native i18n components for your shiny Vue 3 apps",
|
|
5
|
-
"main": "./dist/v-intl.js",
|
|
6
|
-
"module": "./dist/v-intl.js",
|
|
7
|
-
"umd": "./dist/v-intl.umd.cjs",
|
|
8
|
-
"unpkg": "./dist/v-intl.cjs",
|
|
9
|
-
"jsdelivr": "./dist/v-intl.cjs",
|
|
10
|
-
"cdn": "./dist/v-intl.min.js",
|
|
11
5
|
"exports": {
|
|
12
6
|
".": {
|
|
13
|
-
"import": "./dist/v-
|
|
14
|
-
"
|
|
7
|
+
"import": "./dist/v-intl.js",
|
|
8
|
+
"types": "./dist/index.d.ts"
|
|
15
9
|
}
|
|
16
10
|
},
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"type": "module",
|
|
17
13
|
"files": [
|
|
18
14
|
"dist"
|
|
19
15
|
],
|
|
20
|
-
"types": "./dist/index.d.ts",
|
|
21
|
-
"type": "module",
|
|
22
16
|
"scripts": {
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
"lint:css:fix": "stylelint --fix \"{,!(node_modules|dist)/**/}*.{css,scss,vue}\" --ignore-path .gitignore",
|
|
34
|
-
"prepare": "is-ci || husky",
|
|
35
|
-
"release": "shipjs prepare",
|
|
36
|
-
"release:dry": "shipjs prepare --dry-run",
|
|
37
|
-
"release:auto": "shipjs prepare --yes",
|
|
38
|
-
"docs:dev": "vitepress dev docs",
|
|
39
|
-
"docs:build": "vitepress build docs",
|
|
40
|
-
"docs:serve": "vitepress serve docs"
|
|
17
|
+
"lint": "oxlint --config .oxlintrc.jsonc",
|
|
18
|
+
"lint:fix": "oxlint --fix --config .oxlintrc.jsonc",
|
|
19
|
+
"format": "oxfmt --config .oxfmtrc.jsonc .",
|
|
20
|
+
"format:check": "oxfmt --check --config .oxfmtrc.jsonc .",
|
|
21
|
+
"build": "vite build && vue-tsc --declaration --emitDeclarationOnly",
|
|
22
|
+
"test": "echo 'test!'",
|
|
23
|
+
"prepare": "is-ci || husky"
|
|
24
|
+
},
|
|
25
|
+
"peerDependencies": {
|
|
26
|
+
"vue": "^3.5.27"
|
|
41
27
|
},
|
|
42
28
|
"dependencies": {
|
|
43
|
-
"@formatjs/intl-durationformat": "^0.
|
|
29
|
+
"@formatjs/intl-durationformat": "^0.7.1",
|
|
30
|
+
"vue": "^3.5.27"
|
|
44
31
|
},
|
|
45
32
|
"devDependencies": {
|
|
46
|
-
"@commitlint/cli": "
|
|
47
|
-
"@commitlint/config-conventional": "
|
|
48
|
-
"@types/node": "^
|
|
49
|
-
"@
|
|
50
|
-
"
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"eslint-plugin-jsdoc": "^48.2.5",
|
|
58
|
-
"eslint-plugin-prettier": "^5.1.3",
|
|
59
|
-
"eslint-plugin-security": "^1.7.1",
|
|
60
|
-
"eslint-plugin-vue": "^9.26.0",
|
|
61
|
-
"husky": "^9.0.11",
|
|
62
|
-
"is-ci": "^3.0.1",
|
|
63
|
-
"lint-staged": "^15.2.2",
|
|
64
|
-
"postcss-html": "^1.7.0",
|
|
65
|
-
"prettier": "^3.2.5",
|
|
66
|
-
"sass": "^1.77.2",
|
|
67
|
-
"shipjs": "^0.26.3",
|
|
68
|
-
"stylelint": "^16.5.0",
|
|
69
|
-
"stylelint-config-recommended-vue": "^1.5.0",
|
|
70
|
-
"stylelint-prettier": "^5.0.0",
|
|
71
|
-
"typescript": "^5.4.5",
|
|
72
|
-
"vite": "^5.2.11",
|
|
73
|
-
"vitepress": "^1.2.0",
|
|
74
|
-
"vue": "^3.4.27",
|
|
75
|
-
"vue-tsc": "^2.0.19"
|
|
33
|
+
"@commitlint/cli": "latest",
|
|
34
|
+
"@commitlint/config-conventional": "latest",
|
|
35
|
+
"@types/node": "^25.2.1",
|
|
36
|
+
"@vitejs/plugin-vue": "^6.0.4",
|
|
37
|
+
"husky": "latest",
|
|
38
|
+
"is-ci": "latest",
|
|
39
|
+
"lint-staged": "latest",
|
|
40
|
+
"oxlint": "latest",
|
|
41
|
+
"typescript": "^5.9.3",
|
|
42
|
+
"vite": "^7.3.1",
|
|
43
|
+
"vue-tsc": "^3.2.4"
|
|
76
44
|
},
|
|
77
45
|
"keywords": [
|
|
78
46
|
"v-intl",
|
package/dist/v-intl.cjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
"use strict";/*!
|
|
2
|
-
* @vinayakkulkarni/v-intl v2.3.2
|
|
3
|
-
* (c) 2024 Vinayak Kulkarni
|
|
4
|
-
* @license MIT
|
|
5
|
-
*/Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue"),d=e.defineComponent({__name:"VIntlNumberFormat",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{},toParts:{type:Boolean,required:!1,default:!1},toPartsModifiers:{}},emits:["update:payload","update:format","update:wrapper","update:toParts"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),l=e.useModel(a,"wrapper"),s=e.useModel(a,"toParts"),n=e.computed(()=>{const r=new Intl.NumberFormat(t.value.locales,t.value.options);return s.value?r.formatToParts(o.value):r.format(o.value)});return(r,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value)},e.toDisplayString(n.value),3))}}),m=e.defineComponent({__name:"VIntlListFormat",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{},toParts:{type:Boolean,required:!1,default:!1},toPartsModifiers:{}},emits:["update:payload","update:format","update:wrapper","update:toParts"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),l=e.useModel(a,"wrapper"),s=e.useModel(a,"toParts"),n=e.computed(()=>{const r=new Intl.ListFormat(t.value.locales,t.value.options);return s.value?r.formatToParts(o.value):r.format(o.value)});return(r,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value)},e.toDisplayString(n.value),3))}}),p=e.defineComponent({__name:"VIntlDateTimeFormat",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{},toParts:{type:Boolean,required:!1,default:!1},toPartsModifiers:{}},emits:["update:payload","update:format","update:wrapper","update:toParts"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),l=e.useModel(a,"wrapper"),s=e.useModel(a,"toParts"),n=e.computed(()=>{const r=new Intl.DateTimeFormat(t.value.locales,t.value.options);return s.value?r.formatToParts(o.value):r.format(o.value)});return(r,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value)},e.toDisplayString(n.value),3))}}),f=e.defineComponent({__name:"VIntlDisplayNames",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{}},emits:["update:payload","update:format","update:wrapper"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),l=e.useModel(a,"wrapper"),s=e.computed(()=>new Intl.DisplayNames(t.value.locales,t.value.options).of(o.value));return(n,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value)},e.toDisplayString(s.value),3))}}),c=e.defineComponent({__name:"VIntlRelativeTimeFormat",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{}},emits:["update:payload","update:format","update:wrapper"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),l=e.useModel(a,"wrapper"),s=e.computed(()=>new Intl.RelativeTimeFormat(t.value.locales,t.value.options).format(o.value.number,o.value.time));return(n,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(l.value)},e.toDisplayString(s.value),3))}});let i=!1;const v=a=>{i||(a.component("VIntlNumberFormat",d),a.component("VIntlListFormat",m),a.component("VIntlDateTimeFormat",p),a.component("VIntlDisplayNames",f),a.component("VIntlRelativeTimeFormat",c),i=!0)},y=v;exports.VIntlDateTimeFormat=p;exports.VIntlDisplayNames=f;exports.VIntlListFormat=m;exports.VIntlNumberFormat=d;exports.VIntlRelativeTimeFormat=c;exports.default=y;
|
|
6
|
-
//# sourceMappingURL=v-intl.cjs.map
|
package/dist/v-intl.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/install.ts"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.NumberFormatOptions;\n };\n\n const payload = defineModel<number>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n const toParts = defineModel<boolean>('toParts', {\n required: false,\n default: false,\n });\n\n const formattedNumbers = computed(() => {\n const numbers = new Intl.NumberFormat(\n format.value.locales,\n format.value.options,\n );\n return toParts.value\n ? numbers.formatToParts(payload.value)\n : numbers.format(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedNumbers }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.ListFormatOptions;\n };\n\n const payload = defineModel<string>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n const toParts = defineModel<boolean>('toParts', {\n required: false,\n default: false,\n });\n\n const formattedList = computed(() => {\n const list = new Intl.ListFormat(\n format.value.locales,\n format.value.options,\n );\n return toParts.value\n ? list.formatToParts(payload.value)\n : list.format(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedList }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.DateTimeFormatOptions;\n };\n\n const payload = defineModel<number | Date | undefined>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n const toParts = defineModel<boolean>('toParts', {\n required: false,\n default: false,\n });\n\n const formattedDateTime = computed(() => {\n const dateTime = new Intl.DateTimeFormat(\n format.value.locales,\n format.value.options,\n );\n return toParts.value\n ? dateTime.formatToParts(payload.value)\n : dateTime.format(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedDateTime }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.DisplayNamesOptions;\n };\n\n const payload = defineModel<string>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n\n const intlDisplayNames = computed(() => {\n const intlNames = new Intl.DisplayNames(\n format.value.locales,\n format.value.options,\n );\n return intlNames.of(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ intlDisplayNames }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.RelativeTimeFormatOptions;\n };\n\n const payload = defineModel<{\n number: 1;\n time: 'days';\n }>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n\n const formattedRelativeTime = computed(() => {\n return new Intl.RelativeTimeFormat(\n format.value.locales,\n format.value.options,\n ).format(payload.value.number, payload.value.time);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedRelativeTime }}\n </div>\n</template>\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":["payload","_useModel","__props","format","wrapper","toParts","formattedNumbers","computed","numbers","formattedList","list","formattedDateTime","dateTime","intlDisplayNames","formattedRelativeTime","installed","install","app","VIntlNumberFormat","VIntlListFormat","VIntlDateTimeFormat","VIntlDisplayNames","VIntlRelativeTimeFormat","install$1"],"mappings":";;;;wfAQQ,MAAAA,EAAUC,EAAAA,SAAoBC,EAAA,SAEnC,EAEKC,EAASF,EAAAA,WAA2B,QAMzC,EACKG,EAAUH,EAAAA,SAAoBC,EAAA,SAGnC,EACKG,EAAUJ,EAAAA,SAAqBC,EAAA,SAGpC,EAEKI,EAAmBC,EAAAA,SAAS,IAAM,CAChC,MAAAC,EAAU,IAAI,KAAK,aACvBL,EAAO,MAAM,QACbA,EAAO,MAAM,OAAA,EAER,OAAAE,EAAQ,MACXG,EAAQ,cAAcR,EAAQ,KAAK,EACnCQ,EAAQ,OAAOR,EAAQ,KAAK,CAAA,CACjC,2fC5BK,MAAAA,EAAUC,EAAAA,SAAoBC,EAAA,SAEnC,EAEKC,EAASF,EAAAA,WAA2B,QAMzC,EACKG,EAAUH,EAAAA,SAAoBC,EAAA,SAGnC,EACKG,EAAUJ,EAAAA,SAAqBC,EAAA,SAGpC,EAEKO,EAAgBF,EAAAA,SAAS,IAAM,CAC7B,MAAAG,EAAO,IAAI,KAAK,WACpBP,EAAO,MAAM,QACbA,EAAO,MAAM,OAAA,EAER,OAAAE,EAAQ,MACXK,EAAK,cAAcV,EAAQ,KAAK,EAChCU,EAAK,OAAOV,EAAQ,KAAK,CAAA,CAC9B,+fC5BK,MAAAA,EAAUC,EAAAA,SAAsCC,EAAC,SAEtD,EAEKC,EAASF,EAAAA,WAA2B,QAMzC,EACKG,EAAUH,EAAAA,SAAoBC,EAAA,SAGnC,EACKG,EAAUJ,EAAAA,SAAqBC,EAAA,SAGpC,EAEKS,EAAoBJ,EAAAA,SAAS,IAAM,CACjC,MAAAK,EAAW,IAAI,KAAK,eACxBT,EAAO,MAAM,QACbA,EAAO,MAAM,OAAA,EAER,OAAAE,EAAQ,MACXO,EAAS,cAAcZ,EAAQ,KAAK,EACpCY,EAAS,OAAOZ,EAAQ,KAAK,CAAA,CAClC,0aC5BK,MAAAA,EAAUC,EAAAA,SAAoBC,EAAA,SAEnC,EAEKC,EAASF,EAAAA,WAA2B,QAMzC,EACKG,EAAUH,EAAAA,SAAoBC,EAAA,SAGnC,EAEKW,EAAmBN,EAAAA,SAAS,IACd,IAAI,KAAK,aACzBJ,EAAO,MAAM,QACbA,EAAO,MAAM,OAAA,EAEE,GAAGH,EAAQ,KAAK,CAClC,gbCtBK,MAAAA,EAAUC,EAAAA,SAGdC,EAAC,SAEF,EAEKC,EAASF,EAAAA,WAA2B,QAMzC,EACKG,EAAUH,EAAAA,SAAoBC,EAAA,SAGnC,EAEKY,EAAwBP,EAAAA,SAAS,IAC9B,IAAI,KAAK,mBACdJ,EAAO,MAAM,QACbA,EAAO,MAAM,OAAA,EACb,OAAOH,EAAQ,MAAM,OAAQA,EAAQ,MAAM,IAAI,CAClD,6HCxBH,IAAIe,EAAY,GAEhB,MAAMC,EAAkDC,GAAqB,CACtEF,IAECE,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"}
|
package/dist/v-intl.umd.cjs
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
(function(l,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],e):(l=typeof globalThis<"u"?globalThis:l||self,e(l.VIntl={},l.vue))})(this,function(l,e){"use strict";/*!
|
|
2
|
-
* @vinayakkulkarni/v-intl v2.3.2
|
|
3
|
-
* (c) 2024 Vinayak Kulkarni
|
|
4
|
-
* @license MIT
|
|
5
|
-
*/const d=e.defineComponent({__name:"VIntlNumberFormat",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{},toParts:{type:Boolean,required:!1,default:!1},toPartsModifiers:{}},emits:["update:payload","update:format","update:wrapper","update:toParts"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),s=e.useModel(a,"wrapper"),n=e.useModel(a,"toParts"),i=e.computed(()=>{const r=new Intl.NumberFormat(t.value.locales,t.value.options);return n.value?r.formatToParts(o.value):r.format(o.value)});return(r,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(s.value)},e.toDisplayString(i.value),3))}}),m=e.defineComponent({__name:"VIntlListFormat",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{},toParts:{type:Boolean,required:!1,default:!1},toPartsModifiers:{}},emits:["update:payload","update:format","update:wrapper","update:toParts"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),s=e.useModel(a,"wrapper"),n=e.useModel(a,"toParts"),i=e.computed(()=>{const r=new Intl.ListFormat(t.value.locales,t.value.options);return n.value?r.formatToParts(o.value):r.format(o.value)});return(r,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(s.value)},e.toDisplayString(i.value),3))}}),p=e.defineComponent({__name:"VIntlDateTimeFormat",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{},toParts:{type:Boolean,required:!1,default:!1},toPartsModifiers:{}},emits:["update:payload","update:format","update:wrapper","update:toParts"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),s=e.useModel(a,"wrapper"),n=e.useModel(a,"toParts"),i=e.computed(()=>{const r=new Intl.DateTimeFormat(t.value.locales,t.value.options);return n.value?r.formatToParts(o.value):r.format(o.value)});return(r,y)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(s.value)},e.toDisplayString(i.value),3))}}),f=e.defineComponent({__name:"VIntlDisplayNames",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{}},emits:["update:payload","update:format","update:wrapper"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),s=e.useModel(a,"wrapper"),n=e.computed(()=>new Intl.DisplayNames(t.value.locales,t.value.options).of(o.value));return(i,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(s.value)},e.toDisplayString(n.value),3))}}),u=e.defineComponent({__name:"VIntlRelativeTimeFormat",props:{payload:{required:!0},payloadModifiers:{},format:{required:!1,default:()=>({locales:"en-US",options:{}})},formatModifiers:{},wrapper:{required:!1,default:""},wrapperModifiers:{}},emits:["update:payload","update:format","update:wrapper"],setup(a){const o=e.useModel(a,"payload"),t=e.useModel(a,"format"),s=e.useModel(a,"wrapper"),n=e.computed(()=>new Intl.RelativeTimeFormat(t.value.locales,t.value.options).format(o.value.number,o.value.time));return(i,r)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(s.value)},e.toDisplayString(n.value),3))}});let c=!1;const M=a=>{c||(a.component("VIntlNumberFormat",d),a.component("VIntlListFormat",m),a.component("VIntlDateTimeFormat",p),a.component("VIntlDisplayNames",f),a.component("VIntlRelativeTimeFormat",u),c=!0)};l.VIntlDateTimeFormat=p,l.VIntlDisplayNames=f,l.VIntlListFormat=m,l.VIntlNumberFormat=d,l.VIntlRelativeTimeFormat=u,l.default=M,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
6
|
-
//# sourceMappingURL=v-intl.umd.cjs.map
|
package/dist/v-intl.umd.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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/install.ts"],"sourcesContent":["<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.NumberFormatOptions;\n };\n\n const payload = defineModel<number>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n const toParts = defineModel<boolean>('toParts', {\n required: false,\n default: false,\n });\n\n const formattedNumbers = computed(() => {\n const numbers = new Intl.NumberFormat(\n format.value.locales,\n format.value.options,\n );\n return toParts.value\n ? numbers.formatToParts(payload.value)\n : numbers.format(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedNumbers }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.ListFormatOptions;\n };\n\n const payload = defineModel<string>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n const toParts = defineModel<boolean>('toParts', {\n required: false,\n default: false,\n });\n\n const formattedList = computed(() => {\n const list = new Intl.ListFormat(\n format.value.locales,\n format.value.options,\n );\n return toParts.value\n ? list.formatToParts(payload.value)\n : list.format(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedList }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.DateTimeFormatOptions;\n };\n\n const payload = defineModel<number | Date | undefined>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n const toParts = defineModel<boolean>('toParts', {\n required: false,\n default: false,\n });\n\n const formattedDateTime = computed(() => {\n const dateTime = new Intl.DateTimeFormat(\n format.value.locales,\n format.value.options,\n );\n return toParts.value\n ? dateTime.formatToParts(payload.value)\n : dateTime.format(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedDateTime }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.DisplayNamesOptions;\n };\n\n const payload = defineModel<string>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n\n const intlDisplayNames = computed(() => {\n const intlNames = new Intl.DisplayNames(\n format.value.locales,\n format.value.options,\n );\n return intlNames.of(payload.value);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ intlDisplayNames }}\n </div>\n</template>\n","<script setup lang=\"ts\">\n import { computed, defineModel } from 'vue';\n import type { RequiredOptions } from '../types';\n\n type FormatOptions = RequiredOptions & {\n options: Intl.RelativeTimeFormatOptions;\n };\n\n const payload = defineModel<{\n number: 1;\n time: 'days';\n }>('payload', {\n required: true,\n });\n\n const format = defineModel<FormatOptions>('format', {\n required: false,\n default: () => ({\n locales: 'en-US',\n options: {},\n }),\n });\n const wrapper = defineModel<string>('wrapper', {\n required: false,\n default: '',\n });\n\n const formattedRelativeTime = computed(() => {\n return new Intl.RelativeTimeFormat(\n format.value.locales,\n format.value.options,\n ).format(payload.value.number, payload.value.time);\n });\n</script>\n\n<template>\n <div :class=\"wrapper\">\n {{ formattedRelativeTime }}\n </div>\n</template>\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":["payload","_useModel","__props","format","wrapper","toParts","formattedNumbers","computed","numbers","formattedList","list","formattedDateTime","dateTime","intlDisplayNames","formattedRelativeTime","installed","install$1","app","VIntlNumberFormat","VIntlListFormat","VIntlDateTimeFormat","VIntlDisplayNames","VIntlRelativeTimeFormat"],"mappings":";;;;koBAQQ,MAAAA,EAAUC,EAAAA,SAAoBC,EAAA,SAEnC,EAEKC,EAASF,EAAAA,WAA2B,QAMzC,EACKG,EAAUH,EAAAA,SAAoBC,EAAA,SAGnC,EACKG,EAAUJ,EAAAA,SAAqBC,EAAA,SAGpC,EAEKI,EAAmBC,EAAAA,SAAS,IAAM,CAChC,MAAAC,EAAU,IAAI,KAAK,aACvBL,EAAO,MAAM,QACbA,EAAO,MAAM,OAAA,EAER,OAAAE,EAAQ,MACXG,EAAQ,cAAcR,EAAQ,KAAK,EACnCQ,EAAQ,OAAOR,EAAQ,KAAK,CAA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