@fluenti/vue 0.2.0 → 0.3.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/README.md +5 -5
- package/dist/components/DateTime.d.ts +1 -1
- package/dist/components/DateTime.d.ts.map +1 -1
- package/dist/components/NumberFormat.d.ts +1 -1
- package/dist/components/NumberFormat.d.ts.map +1 -1
- package/dist/components/Plural.d.ts +12 -13
- package/dist/components/Plural.d.ts.map +1 -1
- package/dist/components/Select.d.ts +12 -13
- package/dist/components/Select.d.ts.map +1 -1
- package/dist/components/Trans.d.ts +7 -7
- package/dist/components/Trans.d.ts.map +1 -1
- package/dist/components/rich-text.d.ts +0 -6
- package/dist/components/rich-text.d.ts.map +1 -1
- package/dist/hooks/__useI18n.d.ts +2 -2
- package/dist/hooks/__useI18n.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +7 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -169
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +25 -14
- package/dist/plugin.d.ts.map +1 -1
- package/dist/server.cjs +2 -0
- package/dist/server.cjs.map +1 -0
- package/dist/server.d.ts +33 -13
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +54 -0
- package/dist/server.js.map +1 -0
- package/dist/use-i18n.d.ts +3 -3
- package/dist/use-i18n.d.ts.map +1 -1
- package/dist/vite-plugin.cjs +1 -111
- package/dist/vite-plugin.cjs.map +1 -1
- package/dist/vite-plugin.js +18 -126
- package/dist/vite-plugin.js.map +1 -1
- package/dist/vue-runtime.d.ts.map +1 -1
- package/llms-full.txt +220 -0
- package/llms-migration.txt +199 -0
- package/llms.txt +82 -0
- package/package.json +17 -5
package/README.md
CHANGED
|
@@ -80,12 +80,12 @@ export default {
|
|
|
80
80
|
```ts
|
|
81
81
|
// main.ts
|
|
82
82
|
import { createApp } from 'vue'
|
|
83
|
-
import {
|
|
83
|
+
import { createFluenti } from '@fluenti/vue'
|
|
84
84
|
import App from './App.vue'
|
|
85
85
|
import en from './locales/compiled/en'
|
|
86
86
|
import ja from './locales/compiled/ja'
|
|
87
87
|
|
|
88
|
-
const fluent =
|
|
88
|
+
const fluent = createFluenti({
|
|
89
89
|
locale: 'en',
|
|
90
90
|
fallbackLocale: 'en',
|
|
91
91
|
messages: { en, ja },
|
|
@@ -259,7 +259,7 @@ const { t, d, n, locale, setLocale } = useI18n()
|
|
|
259
259
|
## Plugin Options
|
|
260
260
|
|
|
261
261
|
```ts
|
|
262
|
-
const fluent =
|
|
262
|
+
const fluent = createFluenti({
|
|
263
263
|
// Required
|
|
264
264
|
locale: 'en',
|
|
265
265
|
messages: { en, ja, zh },
|
|
@@ -320,7 +320,7 @@ const fluent = createFluentVue({
|
|
|
320
320
|
For large apps, load locale messages on demand instead of bundling everything upfront:
|
|
321
321
|
|
|
322
322
|
```ts
|
|
323
|
-
const fluent =
|
|
323
|
+
const fluent = createFluenti({
|
|
324
324
|
locale: 'en',
|
|
325
325
|
messages: { en }, // only the default locale is bundled
|
|
326
326
|
lazyLocaleLoading: true,
|
|
@@ -349,7 +349,7 @@ const { setLocale, isLoading, preloadLocale } = useI18n()
|
|
|
349
349
|
|
|
350
350
|
## SSR / SSG Support
|
|
351
351
|
|
|
352
|
-
`
|
|
352
|
+
`createFluenti()` creates entirely fresh state per call -- no module-level singletons. Call it once per SSR request to avoid locale leaking between users.
|
|
353
353
|
|
|
354
354
|
For server-side i18n in Nuxt or custom Vue SSR setups, use the dedicated server utilities:
|
|
355
355
|
|
|
@@ -23,7 +23,7 @@ declare const dateTimeProps: {
|
|
|
23
23
|
readonly default: "span";
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
export type
|
|
26
|
+
export type FluentiDateTimeProps = Readonly<ExtractPropTypes<typeof dateTimeProps>>;
|
|
27
27
|
export declare const DateTime: import('vue').DefineComponent<ExtractPropTypes<{
|
|
28
28
|
readonly value: {
|
|
29
29
|
readonly type: PropType<Date | number>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../src/components/DateTime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAGrD;;;;;;;;;GASG;AACH,QAAA,MAAM,aAAa;;uBACgB,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC;;;;;;;;;;;CAGhD,CAAA;AAEV,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"DateTime.d.ts","sourceRoot":"","sources":["../../src/components/DateTime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAA;AAGrD;;;;;;;;;GASG;AACH,QAAA,MAAM,aAAa;;uBACgB,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC;;;;;;;;;;;CAGhD,CAAA;AAEV,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAA;AAEnF,eAAO,MAAM,QAAQ;;uBAPc,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC;;;;;;;;;;;;;;;uBAAvB,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC;;;;;;;;;;;;;;4EAcxD,CAAA"}
|
|
@@ -23,7 +23,7 @@ declare const numberFormatProps: {
|
|
|
23
23
|
readonly default: "span";
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
export type
|
|
26
|
+
export type FluentiNumberFormatProps = Readonly<ExtractPropTypes<typeof numberFormatProps>>;
|
|
27
27
|
export declare const NumberFormat: import('vue').DefineComponent<ExtractPropTypes<{
|
|
28
28
|
readonly value: {
|
|
29
29
|
readonly type: NumberConstructor;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberFormat.d.ts","sourceRoot":"","sources":["../../src/components/NumberFormat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAG3C;;;;;;;;;GASG;AACH,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;CAIb,CAAA;AAEV,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"NumberFormat.d.ts","sourceRoot":"","sources":["../../src/components/NumberFormat.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAG3C;;;;;;;;;GASG;AACH,QAAA,MAAM,iBAAiB;;;;;;;;;;;;;CAIb,CAAA;AAEV,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAA;AAE3F,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAOvB,CAAA"}
|
|
@@ -49,17 +49,17 @@ declare const pluralProps: {
|
|
|
49
49
|
/** Text for the default/other category */
|
|
50
50
|
readonly other: {
|
|
51
51
|
readonly type: StringConstructor;
|
|
52
|
-
readonly
|
|
52
|
+
readonly required: true;
|
|
53
53
|
};
|
|
54
54
|
/** Offset from value before selecting form */
|
|
55
55
|
readonly offset: NumberConstructor;
|
|
56
|
-
/** Wrapper element tag name (
|
|
56
|
+
/** Wrapper element tag name. Defaults to no wrapper (Fragment). */
|
|
57
57
|
readonly tag: {
|
|
58
58
|
readonly type: StringConstructor;
|
|
59
|
-
readonly default:
|
|
59
|
+
readonly default: undefined;
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
|
-
export type
|
|
62
|
+
export type FluentiPluralProps = Readonly<ExtractPropTypes<typeof pluralProps>>;
|
|
63
63
|
export declare const Plural: import('vue').DefineComponent<ExtractPropTypes<{
|
|
64
64
|
/** The numeric value to pluralise on */
|
|
65
65
|
readonly value: {
|
|
@@ -85,18 +85,18 @@ export declare const Plural: import('vue').DefineComponent<ExtractPropTypes<{
|
|
|
85
85
|
/** Text for the default/other category */
|
|
86
86
|
readonly other: {
|
|
87
87
|
readonly type: StringConstructor;
|
|
88
|
-
readonly
|
|
88
|
+
readonly required: true;
|
|
89
89
|
};
|
|
90
90
|
/** Offset from value before selecting form */
|
|
91
91
|
readonly offset: NumberConstructor;
|
|
92
|
-
/** Wrapper element tag name (
|
|
92
|
+
/** Wrapper element tag name. Defaults to no wrapper (Fragment). */
|
|
93
93
|
readonly tag: {
|
|
94
94
|
readonly type: StringConstructor;
|
|
95
|
-
readonly default:
|
|
95
|
+
readonly default: undefined;
|
|
96
96
|
};
|
|
97
|
-
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
97
|
+
}>, () => string | number | boolean | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
98
98
|
[key: string]: any;
|
|
99
|
-
}
|
|
99
|
+
}> | import('vue').VNodeArrayChildren | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ExtractPropTypes<{
|
|
100
100
|
/** The numeric value to pluralise on */
|
|
101
101
|
readonly value: {
|
|
102
102
|
readonly type: NumberConstructor;
|
|
@@ -121,17 +121,16 @@ export declare const Plural: import('vue').DefineComponent<ExtractPropTypes<{
|
|
|
121
121
|
/** Text for the default/other category */
|
|
122
122
|
readonly other: {
|
|
123
123
|
readonly type: StringConstructor;
|
|
124
|
-
readonly
|
|
124
|
+
readonly required: true;
|
|
125
125
|
};
|
|
126
126
|
/** Offset from value before selecting form */
|
|
127
127
|
readonly offset: NumberConstructor;
|
|
128
|
-
/** Wrapper element tag name (
|
|
128
|
+
/** Wrapper element tag name. Defaults to no wrapper (Fragment). */
|
|
129
129
|
readonly tag: {
|
|
130
130
|
readonly type: StringConstructor;
|
|
131
|
-
readonly default:
|
|
131
|
+
readonly default: undefined;
|
|
132
132
|
};
|
|
133
133
|
}>> & Readonly<{}>, {
|
|
134
|
-
readonly other: string;
|
|
135
134
|
readonly tag: string;
|
|
136
135
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
137
136
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Plural.d.ts","sourceRoot":"","sources":["../../src/components/Plural.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAA4B,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"Plural.d.ts","sourceRoot":"","sources":["../../src/components/Plural.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAA4B,MAAM,KAAK,CAAA;AAKrE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,QAAA,MAAM,WAAW;IACf,wCAAwC;;;;;IAExC,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,yCAAyC;;IAEzC,wCAAwC;;IAExC,oCAAoC;;IAEpC,mCAAmC;;IAEnC,qCAAqC;;IAErC,0CAA0C;;;;;IAE1C,8CAA8C;;IAE9C,mEAAmE;;;;;CAE3D,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;AAE/E,eAAO,MAAM,MAAM;IA5BjB,wCAAwC;;;;;IAExC,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,yCAAyC;;IAEzC,wCAAwC;;IAExC,oCAAoC;;IAEpC,mCAAmC;;IAEnC,qCAAqC;;IAErC,0CAA0C;;;;;IAE1C,8CAA8C;;IAE9C,mEAAmE;;;;;;;;IAtBnE,wCAAwC;;;;;IAExC,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,yCAAyC;;IAEzC,wCAAwC;;IAExC,oCAAoC;;IAEpC,mCAAmC;;IAEnC,qCAAqC;;IAErC,0CAA0C;;;;;IAE1C,8CAA8C;;IAE9C,mEAAmE;;;;;;;4EAwDnE,CAAA"}
|
|
@@ -41,7 +41,7 @@ declare const selectProps: {
|
|
|
41
41
|
/** Fallback text when no option matches `value` */
|
|
42
42
|
readonly other: {
|
|
43
43
|
readonly type: StringConstructor;
|
|
44
|
-
readonly
|
|
44
|
+
readonly required: true;
|
|
45
45
|
};
|
|
46
46
|
/**
|
|
47
47
|
* Named options map. Keys are match values, values are display strings.
|
|
@@ -53,13 +53,13 @@ declare const selectProps: {
|
|
|
53
53
|
readonly type: PropType<Record<string, string>>;
|
|
54
54
|
readonly default: undefined;
|
|
55
55
|
};
|
|
56
|
-
/** Wrapper element tag name (
|
|
56
|
+
/** Wrapper element tag name. Defaults to no wrapper (Fragment). */
|
|
57
57
|
readonly tag: {
|
|
58
58
|
readonly type: StringConstructor;
|
|
59
|
-
readonly default:
|
|
59
|
+
readonly default: undefined;
|
|
60
60
|
};
|
|
61
61
|
};
|
|
62
|
-
export type
|
|
62
|
+
export type FluentiSelectProps = Readonly<ExtractPropTypes<typeof selectProps>>;
|
|
63
63
|
export declare const Select: import('vue').DefineComponent<ExtractPropTypes<{
|
|
64
64
|
/** The value to select on (e.g. `"male"`, `"female"`) */
|
|
65
65
|
readonly value: {
|
|
@@ -75,7 +75,7 @@ export declare const Select: import('vue').DefineComponent<ExtractPropTypes<{
|
|
|
75
75
|
/** Fallback text when no option matches `value` */
|
|
76
76
|
readonly other: {
|
|
77
77
|
readonly type: StringConstructor;
|
|
78
|
-
readonly
|
|
78
|
+
readonly required: true;
|
|
79
79
|
};
|
|
80
80
|
/**
|
|
81
81
|
* Named options map. Keys are match values, values are display strings.
|
|
@@ -87,14 +87,14 @@ export declare const Select: import('vue').DefineComponent<ExtractPropTypes<{
|
|
|
87
87
|
readonly type: PropType<Record<string, string>>;
|
|
88
88
|
readonly default: undefined;
|
|
89
89
|
};
|
|
90
|
-
/** Wrapper element tag name (
|
|
90
|
+
/** Wrapper element tag name. Defaults to no wrapper (Fragment). */
|
|
91
91
|
readonly tag: {
|
|
92
92
|
readonly type: StringConstructor;
|
|
93
|
-
readonly default:
|
|
93
|
+
readonly default: undefined;
|
|
94
94
|
};
|
|
95
|
-
}>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
95
|
+
}>, () => string | number | boolean | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
96
96
|
[key: string]: any;
|
|
97
|
-
}
|
|
97
|
+
}> | import('vue').VNodeArrayChildren | null, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ExtractPropTypes<{
|
|
98
98
|
/** The value to select on (e.g. `"male"`, `"female"`) */
|
|
99
99
|
readonly value: {
|
|
100
100
|
readonly type: StringConstructor;
|
|
@@ -109,7 +109,7 @@ export declare const Select: import('vue').DefineComponent<ExtractPropTypes<{
|
|
|
109
109
|
/** Fallback text when no option matches `value` */
|
|
110
110
|
readonly other: {
|
|
111
111
|
readonly type: StringConstructor;
|
|
112
|
-
readonly
|
|
112
|
+
readonly required: true;
|
|
113
113
|
};
|
|
114
114
|
/**
|
|
115
115
|
* Named options map. Keys are match values, values are display strings.
|
|
@@ -121,13 +121,12 @@ export declare const Select: import('vue').DefineComponent<ExtractPropTypes<{
|
|
|
121
121
|
readonly type: PropType<Record<string, string>>;
|
|
122
122
|
readonly default: undefined;
|
|
123
123
|
};
|
|
124
|
-
/** Wrapper element tag name (
|
|
124
|
+
/** Wrapper element tag name. Defaults to no wrapper (Fragment). */
|
|
125
125
|
readonly tag: {
|
|
126
126
|
readonly type: StringConstructor;
|
|
127
|
-
readonly default:
|
|
127
|
+
readonly default: undefined;
|
|
128
128
|
};
|
|
129
129
|
}>> & Readonly<{}>, {
|
|
130
|
-
readonly other: string;
|
|
131
130
|
readonly tag: string;
|
|
132
131
|
readonly options: Record<string, string>;
|
|
133
132
|
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAA4B,MAAM,KAAK,CAAA;AAK/E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,WAAW;IACf,yDAAyD;;;;;IAEzD,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mDAAmD;;;;;IAEnD;;;;;OAKG;;uBAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD,
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../src/components/Select.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAA4B,MAAM,KAAK,CAAA;AAK/E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,WAAW;IACf,yDAAyD;;;;;IAEzD,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mDAAmD;;;;;IAEnD;;;;;OAKG;;uBAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD,mEAAmE;;;;;CAE3D,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;AAE/E,eAAO,MAAM,MAAM;IA1BjB,yDAAyD;;;;;IAEzD,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mDAAmD;;;;;IAEnD;;;;;OAKG;;uBAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD,mEAAmE;;;;;;;;IApBnE,yDAAyD;;;;;IAEzD,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mDAAmD;;;;;IAEnD;;;;;OAKG;;uBAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD,mEAAmE;;;;;;;;4EAyDnE,CAAA"}
|
|
@@ -23,13 +23,13 @@ declare const transProps: {
|
|
|
23
23
|
readonly context: StringConstructor;
|
|
24
24
|
/** Translator-facing note preserved in extraction catalogs */
|
|
25
25
|
readonly comment: StringConstructor;
|
|
26
|
-
/** Wrapper element tag name (
|
|
26
|
+
/** Wrapper element tag name. Defaults to no wrapper (Fragment). */
|
|
27
27
|
readonly tag: {
|
|
28
28
|
readonly type: StringConstructor;
|
|
29
|
-
readonly default:
|
|
29
|
+
readonly default: undefined;
|
|
30
30
|
};
|
|
31
31
|
};
|
|
32
|
-
export type
|
|
32
|
+
export type FluentiTransProps = Readonly<ExtractPropTypes<typeof transProps>>;
|
|
33
33
|
export declare const Trans: import('vue').DefineComponent<ExtractPropTypes<{
|
|
34
34
|
/** Override auto-generated hash ID */
|
|
35
35
|
readonly id: StringConstructor;
|
|
@@ -37,10 +37,10 @@ export declare const Trans: import('vue').DefineComponent<ExtractPropTypes<{
|
|
|
37
37
|
readonly context: StringConstructor;
|
|
38
38
|
/** Translator-facing note preserved in extraction catalogs */
|
|
39
39
|
readonly comment: StringConstructor;
|
|
40
|
-
/** Wrapper element tag name (
|
|
40
|
+
/** Wrapper element tag name. Defaults to no wrapper (Fragment). */
|
|
41
41
|
readonly tag: {
|
|
42
42
|
readonly type: StringConstructor;
|
|
43
|
-
readonly default:
|
|
43
|
+
readonly default: undefined;
|
|
44
44
|
};
|
|
45
45
|
}>, () => string | number | boolean | void | import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
46
46
|
[key: string]: any;
|
|
@@ -51,10 +51,10 @@ export declare const Trans: import('vue').DefineComponent<ExtractPropTypes<{
|
|
|
51
51
|
readonly context: StringConstructor;
|
|
52
52
|
/** Translator-facing note preserved in extraction catalogs */
|
|
53
53
|
readonly comment: StringConstructor;
|
|
54
|
-
/** Wrapper element tag name (
|
|
54
|
+
/** Wrapper element tag name. Defaults to no wrapper (Fragment). */
|
|
55
55
|
readonly tag: {
|
|
56
56
|
readonly type: StringConstructor;
|
|
57
|
-
readonly default:
|
|
57
|
+
readonly default: undefined;
|
|
58
58
|
};
|
|
59
59
|
}>> & Readonly<{}>, {
|
|
60
60
|
readonly tag: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Trans.d.ts","sourceRoot":"","sources":["../../src/components/Trans.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAI3C;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,UAAU;IACd,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,
|
|
1
|
+
{"version":3,"file":"Trans.d.ts","sourceRoot":"","sources":["../../src/components/Trans.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAI3C;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,UAAU;IACd,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mEAAmE;;;;;CAE3D,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,UAAU,CAAC,CAAC,CAAA;AAE7E,eAAO,MAAM,KAAK;IAZhB,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mEAAmE;;;;;;;;IANnE,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mEAAmE;;;;;;;4EA8BnE,CAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { VNode, VNodeChild } from 'vue';
|
|
2
|
-
export declare function offsetIndices(message: string, offset: number): string;
|
|
3
2
|
export declare function extractMessage(children: VNodeChild | VNodeChild[] | undefined): {
|
|
4
3
|
message: string;
|
|
5
4
|
components: VNode[];
|
|
@@ -9,9 +8,4 @@ export declare function serializeRichForms<T extends string>(keys: readonly T[],
|
|
|
9
8
|
messages: Record<string, string>;
|
|
10
9
|
components: VNode[];
|
|
11
10
|
};
|
|
12
|
-
export declare function buildICUSelectMessage(forms: Record<string, string>): string;
|
|
13
|
-
export declare function normalizeSelectForms(forms: Record<string, string>): {
|
|
14
|
-
forms: Record<string, string>;
|
|
15
|
-
valueMap: Record<string, string>;
|
|
16
|
-
};
|
|
17
11
|
//# sourceMappingURL=rich-text.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../../src/components/rich-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"rich-text.d.ts","sourceRoot":"","sources":["../../src/components/rich-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,KAAK,CAAA;AAG5E,wBAAgB,cAAc,CAAC,QAAQ,EAAE,UAAU,GAAG,UAAU,EAAE,GAAG,SAAS,GAAG;IAC/E,OAAO,EAAE,MAAM,CAAA;IACf,UAAU,EAAE,KAAK,EAAE,CAAA;CACpB,CA6BA;AAED,wBAAgB,WAAW,CACzB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,KAAK,EAAE,GAClB,UAAU,CA+BZ;AAED,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACjD,IAAI,EAAE,SAAS,CAAC,EAAE,EAClB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC,GAC7E;IACD,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,UAAU,EAAE,KAAK,EAAE,CAAA;CACpB,CAoBA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FluentiContext } from '../plugin';
|
|
2
2
|
/**
|
|
3
3
|
* Internal hook used by the Vite plugin's compiled output.
|
|
4
4
|
* Returns the i18n context for direct t() calls.
|
|
@@ -8,5 +8,5 @@ import { FluentVueContext } from '../plugin';
|
|
|
8
8
|
*
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
export declare function __useI18n():
|
|
11
|
+
export declare function __useI18n(): FluentiContext;
|
|
12
12
|
//# sourceMappingURL=__useI18n.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"__useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/__useI18n.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"__useI18n.d.ts","sourceRoot":"","sources":["../../src/hooks/__useI18n.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAE/C;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,cAAc,CAE1C"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`vue`),t=require(`@fluenti/core`);function
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`vue`),t=require(`@fluenti/core`),n=require(`@fluenti/core/internal`);function r(){let t=(0,e.inject)(x);if(!t)throw Error(`[fluenti] useI18n() requires createFluenti plugin`);return t}function i(t){let r=[],a=``;function o(t){if(t==null||typeof t==`boolean`)return;if(Array.isArray(t)){for(let e of t)o(e);return}if(typeof t==`string`||typeof t==`number`){a+=String(t);return}if(!(0,e.isVNode)(t)||t.type===e.Comment)return;if(t.type===e.Text){a+=typeof t.children==`string`?t.children:``;return}let s=r.length,c=i(t.children);r.push(t),r.push(...c.components),a+=`<${s}>${(0,n.offsetIndices)(c.message,s+1)}</${s}>`}return o(t),{message:a,components:r}}function a(t,n){let r=/<(\d+)>([\s\S]*?)<\/\1>/g,i=[],o=0,s;for(r.lastIndex=0,s=r.exec(t);s!==null;){s.index>o&&i.push(t.slice(o,s.index));let c=n[Number(s[1])],l=a(s[2],n);c?i.push((0,e.h)(c.type,c.props??{},Array.isArray(l)?l:[l])):i.push(s[2]),o=r.lastIndex,s=r.exec(t)}return o<t.length&&i.push(t.slice(o)),i.length<=1?i[0]??``:i}function o(e,t){let r={},a=[];for(let o of e){let e=t[o];if(e===void 0)continue;let s=i(e);r[o]=(0,n.offsetIndices)(s.message,a.length),a.push(...s.components)}for(let[o,s]of Object.entries(t)){if(e.includes(o)||s===void 0)continue;let t=i(s);r[o]=(0,n.offsetIndices)(t.message,a.length),a.push(...t.components)}return{messages:r,components:a}}var s={id:String,context:String,comment:String,tag:{type:String,default:void 0}},c=(0,e.defineComponent)({name:`Trans`,props:s,setup(t,{slots:n}){let{t:o}=r();return()=>{let r=n.default?.();if(!r)return null;let{message:s,components:c}=i(r),l=o({...t.id===void 0?{}:{id:t.id},message:s,...t.context===void 0?{}:{context:t.context},...t.comment===void 0?{}:{comment:t.comment}}),u=c.length>0?a(l,c):l;return Array.isArray(u)?u.length===1?u[0]:t.tag?(0,e.h)(t.tag,null,u):u:u}}}),l={value:{type:Number,required:!0},id:String,context:String,comment:String,zero:String,one:String,two:String,few:String,many:String,other:{type:String,required:!0},offset:Number,tag:{type:String,default:void 0}},u=(0,e.defineComponent)({name:`Plural`,props:l,setup(t,{slots:i}){let{t:s}=r();return()=>{let r={zero:t.zero,one:t.one,two:t.two,few:t.few,many:t.many,other:t.other};for(let e of n.PLURAL_CATEGORIES){let t=i[e];t&&(r[e]=t({count:`#`}))}let{messages:c,components:l}=o(n.PLURAL_CATEGORIES,r),u=(0,n.buildICUPluralMessage)({...c.zero!==void 0&&{zero:c.zero},...c.one!==void 0&&{one:c.one},...c.two!==void 0&&{two:c.two},...c.few!==void 0&&{few:c.few},...c.many!==void 0&&{many:c.many},other:c.other??``},t.offset),d=s({id:t.id??(t.context===void 0?u:(0,n.hashMessage)(u,t.context)),message:u,...t.context===void 0?{}:{context:t.context},...t.comment===void 0?{}:{comment:t.comment}},{count:t.value}),f=l.length>0?a(d,l):d;return t.tag?(0,e.h)(t.tag,void 0,f??void 0):f??null}}}),d={value:{type:String,required:!0},id:String,context:String,comment:String,other:{type:String,required:!0},options:{type:Object,default:void 0},tag:{type:String,default:void 0}},f=(0,e.defineComponent)({name:`Select`,inheritAttrs:!1,props:d,setup(t,{attrs:i,slots:s}){let{t:c}=r();return()=>{let r={};if(t.options!==void 0){for(let[e,n]of Object.entries(t.options))r[e]=n;r.other=t.other}else{for(let[e,t]of Object.entries(i))typeof t==`string`&&(r[e]=t);r.other=t.other}for(let[e,t]of Object.entries(s))e===`default`||!t||(r[e]=t({value:`{value}`}));let l=[...Object.keys(r).filter(e=>e!==`other`),`other`],{messages:u,components:d}=o(l,r),f=(0,n.normalizeSelectForms)(Object.fromEntries([...l].map(e=>[e,u[e]??``]))),p=(0,n.buildICUSelectMessage)(f.forms),m=c({id:t.id??(t.context===void 0?p:(0,n.hashMessage)(p,t.context)),message:p,...t.context===void 0?{}:{context:t.context},...t.comment===void 0?{}:{comment:t.comment}},{value:f.valueMap[t.value]??`other`}),h=d.length>0?a(m,d):m;return t.tag?(0,e.h)(t.tag,void 0,h??void 0):h??null}}}),p={value:{type:[Date,Number],required:!0},style:{type:String,default:void 0},tag:{type:String,default:`span`}},m=(0,e.defineComponent)({name:`DateTime`,props:p,setup(t){let{d:n}=r();return()=>(0,e.h)(t.tag,n(t.value,t.style))}}),h={value:{type:Number,required:!0},style:{type:String,default:void 0},tag:{type:String,default:`span`}},g=(0,e.defineComponent)({name:`NumberFormat`,props:h,setup(t){let{n}=r();return()=>(0,e.h)(t.tag,n(t.value,t.style))}});function _(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/'/g,`'`).replace(/</g,`<`).replace(/>/g,`>`)}var v=Symbol.for(`fluenti.runtime.vue.v1`);function y(){let e=globalThis[v];return typeof e==`object`&&e?e:null}function b(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var x=Symbol(`fluenti`);function S(e,t,r){return typeof e==`function`?e(t):(0,n.interpolate)(e,t,r)}function C(e){let t=Object.keys(e).filter(e=>e!==`plural`);return t.length>0?t[0]:void 0}function w(r){let i=r.lazyLocaleLoading??r.splitting??!1,a=r.diagnostics?(0,t.createDiagnostics)(r.diagnostics):void 0,o=(0,e.ref)(r.locale),s=(0,e.shallowReactive)({...r.messages}),l=(0,e.ref)(!1),d=new Set([r.locale]),p=(0,e.ref)(new Set(d));function h(e,t){let n=s[e];if(n)return n[t]}function v(e,...t){if(Array.isArray(e)&&`raw`in e)return v((0,n.buildICUMessage)(e,t),Object.fromEntries(t.map((e,t)=>[`arg${t}`,e])));let i=e,s=t[0],c,l;typeof i==`object`&&i?(c=(0,n.resolveDescriptorId)(i)??``,l=i.message):c=i;let u=o.value,d=[u];if(r.fallbackLocale&&!d.includes(r.fallbackLocale)&&d.push(r.fallbackLocale),r.fallbackChain?.[u])for(let e of r.fallbackChain[u])d.includes(e)||d.push(e);else if(r.fallbackChain?.[`*`])for(let e of r.fallbackChain[`*`])d.includes(e)||d.push(e);for(let e of d){let t=h(e,c);if(t!==void 0)return e!==u&&a?.fallbackUsed(u,e,c),S(t,s,e)}if(a?.missingKey(u,c),r.missing){let e=r.missing(u,c);if(e!==void 0)return e}return l?(0,n.interpolate)(l,s,u):c.includes(`{`)?(0,n.interpolate)(c,s,u):c}let w=0;async function T(e){if(!i||!r.chunkLoader){o.value=e;return}let t=y();if(d.has(e)){t?.__switchLocale&&await t.__switchLocale(e),o.value=e;return}let n=++w;l.value=!0;try{let i=b(await r.chunkLoader(e));if(n!==w)return;s[e]={...s[e],...i},d.add(e),p.value=new Set(d),t?.__switchLocale&&await t.__switchLocale(e),o.value=e}finally{n===w&&(l.value=!1)}}function E(e,t){s[e]={...s[e],...t},d.add(e),p.value=new Set(d)}let D=new Set;function O(e){if(!i||d.has(e)||!r.chunkLoader||D.has(e))return;D.add(e);let t=y();r.chunkLoader(e).then(async n=>{let r=b(n);s[e]={...s[e],...r},d.add(e),p.value=new Set(d),t?.__preloadLocale&&await t.__preloadLocale(e)}).catch(t=>{console.warn(`[fluenti] preload failed:`,e,t)}).finally(()=>{D.delete(e)})}function k(){return Object.keys(s)}function A(e,n){let i=o.value;return(0,t.formatDate)(e,i,n,r.dateFormats)}function j(e,n){let i=o.value;return(0,t.formatNumber)(e,i,n,r.numberFormats)}function M(e,t){return S(e,t,o.value)}function N(e,t,n){let r=_(n?v(e,n):v(e));function i(e){if(e.rawAttrs!=null&&e.rawAttrs!==``){let t=[],n=/([\w:@.!-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'))?/g,r;for(;(r=n.exec(e.rawAttrs))!==null;){let e=_(r[1]),n=r[2]??r[3];t.push(n===void 0?e:`${e}="${_(n)}"`)}return t.join(` `)}return e.attrs?Object.entries(e.attrs).map(([e,t])=>t?`${_(e)}="${_(t)}"`:_(e)).join(` `):``}let a=r.replace(/<(\d+)\/>/g,(e,n)=>{let r=t[Number(n)];if(!r)return``;let a=_(r.tag),o=i(r);return`<${a}${o?` `+o:``} />`});return a=a.replace(/<(\d+)>([\s\S]*?)<\/\1>/g,(e,n,r)=>{let a=t[Number(n)];if(!a)return r;let o=_(a.tag),s=i(a);return`<${o}${s?` `+s:``}>${r}</${o}>`}),a}function P(e,t){return h(t??o.value,e)!==void 0}function F(e,t){return h(t??o.value,e)}let I={t:v,locale:o,setLocale:T,loadMessages:E,getLocales:k,d:A,n:j,format:M,isLoading:l,loadedLocales:p,preloadLocale:O,te:P,tm:F};return{install(e){e.provide(x,I);let t=r.componentPrefix??``;e.component(`${t}Trans`,c),e.component(`${t}Plural`,u),e.component(`${t}Select`,f),e.component(`${t}DateTime`,m),e.component(`${t}NumberFormat`,g),r.injectGlobalProperties!==!1&&(e.config.globalProperties.$t=v,e.config.globalProperties.$d=A,e.config.globalProperties.$n=j,e.config.globalProperties.$vtRich=N);let n=new WeakMap;e.directive(`t`,{mounted(e,t){let r=C(t.modifiers);if(r){let t=e.getAttribute(r)??``;n.set(e,t),e.setAttribute(r,v(t))}else{let r=t.arg??e.textContent??``;n.set(e,r.trim()),e.textContent=v(r.trim(),t.value==null?void 0:{...t.value})}},updated(e,t){let r=C(t.modifiers);if(r){let t=n.get(e)??e.getAttribute(r)??``;e.setAttribute(r,v(t))}else e.textContent=v((t.arg??n.get(e)??``).trim(),t.value==null?void 0:{...t.value})}})},global:I}}var T=((...e)=>{throw Error("[fluenti] `t` imported from '@fluenti/vue' is a compile-time API. Use it only with the Fluenti build transform inside <script setup> or setup(). For runtime lookups, use useI18n().t(...).")});exports.DateTime=m,exports.FLUENTI_KEY=x,exports.NumberFormat=g,exports.Plural=u,exports.Select=f,exports.Trans=c,exports.createFluenti=w,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return t.msg}}),exports.t=T,exports.useI18n=r;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|