@fluenti/vue 0.2.1 → 0.3.1

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.
Files changed (40) hide show
  1. package/README.md +5 -5
  2. package/dist/components/DateTime.d.ts +1 -1
  3. package/dist/components/DateTime.d.ts.map +1 -1
  4. package/dist/components/NumberFormat.d.ts +1 -1
  5. package/dist/components/NumberFormat.d.ts.map +1 -1
  6. package/dist/components/Plural.d.ts +12 -13
  7. package/dist/components/Plural.d.ts.map +1 -1
  8. package/dist/components/Select.d.ts +12 -13
  9. package/dist/components/Select.d.ts.map +1 -1
  10. package/dist/components/Trans.d.ts +7 -7
  11. package/dist/components/Trans.d.ts.map +1 -1
  12. package/dist/components/rich-text.d.ts +0 -6
  13. package/dist/components/rich-text.d.ts.map +1 -1
  14. package/dist/hooks/__useI18n.d.ts +2 -2
  15. package/dist/hooks/__useI18n.d.ts.map +1 -1
  16. package/dist/index.cjs +1 -1
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.ts +7 -7
  19. package/dist/index.d.ts.map +1 -1
  20. package/dist/index.js +155 -169
  21. package/dist/index.js.map +1 -1
  22. package/dist/plugin.d.ts +25 -14
  23. package/dist/plugin.d.ts.map +1 -1
  24. package/dist/server.cjs +2 -0
  25. package/dist/server.cjs.map +1 -0
  26. package/dist/server.d.ts +33 -13
  27. package/dist/server.d.ts.map +1 -1
  28. package/dist/server.js +54 -0
  29. package/dist/server.js.map +1 -0
  30. package/dist/use-i18n.d.ts +3 -3
  31. package/dist/use-i18n.d.ts.map +1 -1
  32. package/dist/vite-plugin.cjs +1 -111
  33. package/dist/vite-plugin.cjs.map +1 -1
  34. package/dist/vite-plugin.js +18 -126
  35. package/dist/vite-plugin.js.map +1 -1
  36. package/dist/vue-runtime.d.ts.map +1 -1
  37. package/llms-full.txt +220 -0
  38. package/llms-migration.txt +199 -0
  39. package/llms.txt +82 -0
  40. 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 { createFluentVue } from '@fluenti/vue'
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 = createFluentVue({
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 = createFluentVue({
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 = createFluentVue({
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
- `createFluentVue()` creates entirely fresh state per call -- no module-level singletons. Call it once per SSR request to avoid locale leaking between users.
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 DateTimeProps = Readonly<ExtractPropTypes<typeof dateTimeProps>>;
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,aAAa,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,aAAa,CAAC,CAAC,CAAA;AAE5E,eAAO,MAAM,QAAQ;;uBAPc,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC;;;;;;;;;;;;;;;uBAAvB,QAAQ,CAAC,IAAI,GAAG,MAAM,CAAC;;;;;;;;;;;;;;4EAcxD,CAAA"}
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 NumberFormatProps = Readonly<ExtractPropTypes<typeof numberFormatProps>>;
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,iBAAiB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,iBAAiB,CAAC,CAAC,CAAA;AAEpF,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4EAOvB,CAAA"}
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 default: undefined;
52
+ readonly required: true;
53
53
  };
54
54
  /** Offset from value before selecting form */
55
55
  readonly offset: NumberConstructor;
56
- /** Wrapper element tag name (default: `span`) */
56
+ /** Wrapper element tag name. Defaults to no wrapper (Fragment). */
57
57
  readonly tag: {
58
58
  readonly type: StringConstructor;
59
- readonly default: "span";
59
+ readonly default: undefined;
60
60
  };
61
61
  };
62
- export type PluralProps = Readonly<ExtractPropTypes<typeof pluralProps>>;
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 default: undefined;
88
+ readonly required: true;
89
89
  };
90
90
  /** Offset from value before selecting form */
91
91
  readonly offset: NumberConstructor;
92
- /** Wrapper element tag name (default: `span`) */
92
+ /** Wrapper element tag name. Defaults to no wrapper (Fragment). */
93
93
  readonly tag: {
94
94
  readonly type: StringConstructor;
95
- readonly default: "span";
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
- }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ExtractPropTypes<{
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 default: undefined;
124
+ readonly required: true;
125
125
  };
126
126
  /** Offset from value before selecting form */
127
127
  readonly offset: NumberConstructor;
128
- /** Wrapper element tag name (default: `span`) */
128
+ /** Wrapper element tag name. Defaults to no wrapper (Fragment). */
129
129
  readonly tag: {
130
130
  readonly type: StringConstructor;
131
- readonly default: "span";
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;AAsCrE;;;;;;;;;;;;;;;;;;;;;;;;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,iDAAiD;;;;;CAEzC,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;AAExE,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,iDAAiD;;;;;;;;IAtBjD,wCAAwC;;;;;IAExC,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,yCAAyC;;IAEzC,wCAAwC;;IAExC,oCAAoC;;IAEpC,mCAAmC;;IAEnC,qCAAqC;;IAErC,0CAA0C;;;;;IAE1C,8CAA8C;;IAE9C,iDAAiD;;;;;;;;4EAuDjD,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 default: undefined;
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 (default: `span`) */
56
+ /** Wrapper element tag name. Defaults to no wrapper (Fragment). */
57
57
  readonly tag: {
58
58
  readonly type: StringConstructor;
59
- readonly default: "span";
59
+ readonly default: undefined;
60
60
  };
61
61
  };
62
- export type SelectProps = Readonly<ExtractPropTypes<typeof selectProps>>;
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 default: undefined;
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 (default: `span`) */
90
+ /** Wrapper element tag name. Defaults to no wrapper (Fragment). */
91
91
  readonly tag: {
92
92
  readonly type: StringConstructor;
93
- readonly default: "span";
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
- }>, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ExtractPropTypes<{
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 default: undefined;
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 (default: `span`) */
124
+ /** Wrapper element tag name. Defaults to no wrapper (Fragment). */
125
125
  readonly tag: {
126
126
  readonly type: StringConstructor;
127
- readonly default: "span";
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,iDAAiD;;;;;CAEzC,CAAA;AAEV,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;AAExE,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,iDAAiD;;;;;;;;IApBjD,yDAAyD;;;;;IAEzD,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mDAAmD;;;;;IAEnD;;;;;OAKG;;uBAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD,iDAAiD;;;;;;;;;4EAwDjD,CAAA"}
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 (default: `span`) */
26
+ /** Wrapper element tag name. Defaults to no wrapper (Fragment). */
27
27
  readonly tag: {
28
28
  readonly type: StringConstructor;
29
- readonly default: "span";
29
+ readonly default: undefined;
30
30
  };
31
31
  };
32
- export type TransProps = Readonly<ExtractPropTypes<typeof transProps>>;
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 (default: `span`) */
40
+ /** Wrapper element tag name. Defaults to no wrapper (Fragment). */
41
41
  readonly tag: {
42
42
  readonly type: StringConstructor;
43
- readonly default: "span";
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 (default: `span`) */
54
+ /** Wrapper element tag name. Defaults to no wrapper (Fragment). */
55
55
  readonly tag: {
56
56
  readonly type: StringConstructor;
57
- readonly default: "span";
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,iDAAiD;;;;;CAEzC,CAAA;AAEV,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,UAAU,CAAC,CAAC,CAAA;AAEtE,eAAO,MAAM,KAAK;IAZhB,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,iDAAiD;;;;;;;;IANjD,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,iDAAiD;;;;;;;4EA6BjD,CAAA"}
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;AAE5E,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAKrE;AAED,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;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAE3E;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG;IACnE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC7B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAqBA"}
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 { FluentVueContext } from '../plugin';
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(): FluentVueContext;
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,gBAAgB,EAAE,MAAM,WAAW,CAAA;AAEjD;;;;;;;;GAQG;AACH,wBAAgB,SAAS,IAAI,gBAAgB,CAE5C"}
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 n(){let t=(0,e.inject)(T);if(!t)throw Error(`[fluenti] useI18n() requires createFluentVue plugin`);return t}function r(e,t){return t===0?e:e.replace(/<(\d+)(\/?>)/g,(e,n,r)=>`<${Number(n)+t}${r}`).replace(/<\/(\d+)>/g,(e,n)=>`</${Number(n)+t}>`)}function i(t){let n=[],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=n.length,c=i(t.children);n.push(t),n.push(...c.components),a+=`<${s}>${r(c.message,s+1)}</${s}>`}return o(t),{message:a,components:n}}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 n={},a=[];for(let o of e){let e=t[o];if(e===void 0)continue;let s=i(e);n[o]=r(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);n[o]=r(t.message,a.length),a.push(...t.components)}return{messages:n,components:a}}function s(e){return`{value, select, ${Object.entries(e).map(([e,t])=>`${e} {${t}}`).join(` `)}}`}function c(e){let t={},n={},r=0;for(let[i,a]of Object.entries(e)){if(i===`other`){t.other=a;continue}let e=/^[A-Za-z0-9_]+$/.test(i)?i:`case_${r++}`;t[e]=a,n[i]=e}return t.other===void 0&&(t.other=``),{forms:t,valueMap:n}}var l={id:String,context:String,comment:String,tag:{type:String,default:`span`}},u=(0,e.defineComponent)({name:`Trans`,props:l,setup(t,{slots:r}){let{t:o}=n();return()=>{let n=r.default?.();if(!n)return null;let{message:s,components:c}=i(n),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]:(0,e.h)(t.tag,null,u):u}}}),d=[`zero`,`one`,`two`,`few`,`many`,`other`];function f(e,t){let n=[];for(let t of d){let r=e[t];if(r!==void 0){let e=t===`zero`?`=0`:t;n.push(`${e} {${r}}`)}}return`{count, plural, ${t?`offset:${t} `:``}${n.join(` `)}}`}var p={value:{type:Number,required:!0},id:String,context:String,comment:String,zero:String,one:String,two:String,few:String,many:String,other:{type:String,default:void 0},offset:Number,tag:{type:String,default:`span`}},m=(0,e.defineComponent)({name:`Plural`,props:p,setup(r,{slots:i}){let{t:s}=n();return()=>{let n={zero:r.zero,one:r.one,two:r.two,few:r.few,many:r.many,other:r.other??``};for(let e of d){let t=i[e];t&&(n[e]=t({count:`#`}))}let{messages:c,components:l}=o(d,n),u=f({...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??``},r.offset),p=s({id:r.id??(r.context===void 0?u:(0,t.hashMessage)(u,r.context)),message:u,...r.context===void 0?{}:{context:r.context},...r.comment===void 0?{}:{comment:r.comment}},{count:r.value}),m=l.length>0?a(p,l):p;return(0,e.h)(r.tag,void 0,m??void 0)}}}),h={value:{type:String,required:!0},id:String,context:String,comment:String,other:{type:String,default:void 0},options:{type:Object,default:void 0},tag:{type:String,default:`span`}},g=(0,e.defineComponent)({name:`Select`,inheritAttrs:!1,props:h,setup(r,{attrs:i,slots:l}){let{t:u}=n();return()=>{let n={};if(r.options!==void 0){for(let[e,t]of Object.entries(r.options))n[e]=t;n.other=r.other??``}else{for(let[e,t]of Object.entries(i))typeof t==`string`&&(n[e]=t);n.other=r.other??``}for(let[e,t]of Object.entries(l))e===`default`||!t||(n[e]=t({value:`{value}`}));let d=[...Object.keys(n).filter(e=>e!==`other`),`other`],{messages:f,components:p}=o(d,n),m=c(Object.fromEntries([...d].map(e=>[e,f[e]??``]))),h=s(m.forms),g=u({id:r.id??(r.context===void 0?h:(0,t.hashMessage)(h,r.context)),message:h,...r.context===void 0?{}:{context:r.context},...r.comment===void 0?{}:{comment:r.comment}},{value:m.valueMap[r.value]??`other`}),_=p.length>0?a(g,p):g;return(0,e.h)(r.tag,void 0,_??void 0)}}}),_={value:{type:[Date,Number],required:!0},style:{type:String,default:void 0},tag:{type:String,default:`span`}},v=(0,e.defineComponent)({name:`DateTime`,props:_,setup(t){let{d:r}=n();return()=>(0,e.h)(t.tag,r(t.value,t.style))}}),y={value:{type:Number,required:!0},style:{type:String,default:void 0},tag:{type:String,default:`span`}},b=(0,e.defineComponent)({name:`NumberFormat`,props:y,setup(t){let{n:r}=n();return()=>(0,e.h)(t.tag,r(t.value,t.style))}});function x(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}var S=Symbol.for(`fluenti.runtime.vue`);function C(){let e=globalThis[S];return typeof e==`object`&&e?e:null}function w(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var T=Symbol(`fluenti`);function E(e,n,r){return typeof e==`function`?e(n):(0,t.interpolate)(e,n,r)}function D(e){let t=Object.keys(e).filter(e=>e!==`plural`);return t.length>0?t[0]:void 0}function O(n){let r=n.lazyLocaleLoading??n.splitting??!1,i=(0,e.ref)(n.locale),a=(0,e.shallowReactive)({...n.messages}),o=(0,e.ref)(!1),s=new Set([n.locale]),c=(0,e.ref)(new Set(s));function l(e,t){let n=a[e];if(n)return n[t]}function d(e,...r){if(Array.isArray(e)&&`raw`in e)return d((0,t.buildICUMessage)(e,r),Object.fromEntries(r.map((e,t)=>[String(t),e])));let a=e,o=r[0],s,c;typeof a==`object`&&a?(s=(0,t.resolveDescriptorId)(a)??``,c=a.message):s=a;let u=i.value,f=[u];if(n.fallbackLocale&&!f.includes(n.fallbackLocale)&&f.push(n.fallbackLocale),n.fallbackChain?.[u])for(let e of n.fallbackChain[u])f.includes(e)||f.push(e);else if(n.fallbackChain?.[`*`])for(let e of n.fallbackChain[`*`])f.includes(e)||f.push(e);for(let e of f){let t=l(e,s);if(t!==void 0)return E(t,o,e)}if(n.missing){let e=n.missing(u,s);if(e!==void 0)return e}return c?(0,t.interpolate)(c,o,u):s.includes(`{`)?(0,t.interpolate)(s,o,u):s}async function f(e){if(!r||!n.chunkLoader){i.value=e;return}let t=C();if(s.has(e)){t?.__switchLocale&&await t.__switchLocale(e),i.value=e;return}o.value=!0;try{let r=w(await n.chunkLoader(e));a[e]={...a[e],...r},s.add(e),c.value=new Set(s),t?.__switchLocale&&await t.__switchLocale(e),i.value=e}finally{o.value=!1}}function p(e,t){a[e]={...a[e],...t},s.add(e),c.value=new Set(s)}function h(e){if(!r||s.has(e)||!n.chunkLoader)return;let t=C();n.chunkLoader(e).then(async n=>{let r=w(n);a[e]={...a[e],...r},s.add(e),c.value=new Set(s),t?.__preloadLocale&&await t.__preloadLocale(e)}).catch(t=>{console.warn(`[fluenti] preload failed:`,e,t)})}function _(){return Object.keys(a)}function y(e,r){let a=i.value;return(0,t.formatDate)(e,a,r,n.dateFormats)}function S(e,r){let a=i.value;return(0,t.formatNumber)(e,a,r,n.numberFormats)}function O(e,t){return E(e,t,i.value)}function k(e,t,n){return x(n?d(e,n):d(e)).replace(/&lt;(\d+)&gt;([\s\S]*?)&lt;\/\1&gt;/g,(e,n,r)=>{let i=t[Number(n)];if(!i)return r;let a=Object.entries(i.attrs).map(([e,t])=>t?`${x(e)}="${x(t)}"`:x(e)).join(` `),o=x(i.tag);return`<${o}${a?` `+a:``}>${r}</${o}>`})}function A(e,t){return l(t??i.value,e)!==void 0}function j(e,t){return l(t??i.value,e)}let M={t:d,locale:i,setLocale:f,loadMessages:p,getLocales:_,d:y,n:S,format:O,isLoading:o,loadedLocales:c,preloadLocale:h,te:A,tm:j};return{install(e){e.provide(T,M);let t=n.componentPrefix??``;e.component(`${t}Trans`,u),e.component(`${t}Plural`,m),e.component(`${t}Select`,g),e.component(`${t}DateTime`,v),e.component(`${t}NumberFormat`,b),e.config.globalProperties.$t=d,e.config.globalProperties.$d=y,e.config.globalProperties.$n=S,e.config.globalProperties.$vtRich=k;let r=new WeakMap;e.directive(`t`,{mounted(e,t){let n=D(t.modifiers);if(n){let t=e.getAttribute(n)??``;r.set(e,t),e.setAttribute(n,d(t))}else{let n=t.arg??e.textContent??``;r.set(e,n.trim()),e.textContent=d(n.trim(),t.value==null?void 0:{...t.value})}},updated(e,t){let n=D(t.modifiers);if(n){let t=r.get(e)??e.getAttribute(n)??``;e.setAttribute(n,d(t))}else e.textContent=d((t.arg??r.get(e)??``).trim(),t.value==null?void 0:{...t.value})}})},global:M}}var k=((...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=v,exports.FLUENTI_KEY=T,exports.NumberFormat=b,exports.Plural=m,exports.Select=g,exports.Trans=u,exports.createFluentVue=O,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return t.msg}}),exports.t=k,exports.useI18n=n;
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,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}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(/&lt;(\d+)\/&gt;/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(/&lt;(\d+)&gt;([\s\S]*?)&lt;\/\1&gt;/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