@fluenti/vue 0.5.0 → 0.6.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/NumberFormat-Bxim144o.js +239 -0
- package/dist/NumberFormat-Bxim144o.js.map +1 -0
- package/dist/NumberFormat-CgU3BNm8.cjs +2 -0
- package/dist/NumberFormat-CgU3BNm8.cjs.map +1 -0
- package/dist/components-entry.cjs +1 -2
- package/dist/components-entry.js +2 -227
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +59 -59
- package/dist/index.js.map +1 -1
- package/dist/vite-plugin.cjs +1 -1
- package/dist/vite-plugin.cjs.map +1 -1
- package/dist/vite-plugin.js +1 -1
- package/dist/vite-plugin.js.map +1 -1
- package/dist/vue/src/compile-time-t.d.ts +3 -0
- package/dist/vue/src/compile-time-t.d.ts.map +1 -0
- package/dist/vue/src/components/DateTime.d.ts.map +1 -0
- package/dist/vue/src/components/NumberFormat.d.ts.map +1 -0
- package/dist/vue/src/components/Plural.d.ts.map +1 -0
- package/dist/vue/src/components/Select.d.ts.map +1 -0
- package/dist/vue/src/components/Trans.d.ts.map +1 -0
- package/dist/vue/src/components/rich-text.d.ts.map +1 -0
- package/dist/{components-entry.d.ts → vue/src/components-entry.d.ts} +0 -1
- package/dist/vue/src/components-entry.d.ts.map +1 -0
- package/dist/vue/src/hooks/__useI18n.d.ts.map +1 -0
- package/dist/{index.d.ts → vue/src/index.d.ts} +6 -1
- package/dist/vue/src/index.d.ts.map +1 -0
- package/dist/vue/src/injection-key.d.ts.map +1 -0
- package/dist/vue/src/msg.d.ts +2 -0
- package/dist/vue/src/msg.d.ts.map +1 -0
- package/dist/{plugin.d.ts → vue/src/plugin.d.ts} +5 -5
- package/dist/vue/src/plugin.d.ts.map +1 -0
- package/dist/{server.d.ts → vue/src/server.d.ts} +3 -3
- package/dist/vue/src/server.d.ts.map +1 -0
- package/dist/vue/src/use-i18n.d.ts.map +1 -0
- package/dist/{vite-plugin.d.ts → vue/src/vite-plugin.d.ts} +2 -2
- package/dist/vue/src/vite-plugin.d.ts.map +1 -0
- package/dist/vue/src/vue-runtime.d.ts +3 -0
- package/dist/vue/src/vue-runtime.d.ts.map +1 -0
- package/package.json +18 -18
- package/dist/compile-time-t.d.ts +0 -3
- package/dist/compile-time-t.d.ts.map +0 -1
- package/dist/components/DateTime.d.ts.map +0 -1
- package/dist/components/NumberFormat.d.ts.map +0 -1
- package/dist/components/Plural.d.ts.map +0 -1
- package/dist/components/Select.d.ts.map +0 -1
- package/dist/components/Trans.d.ts.map +0 -1
- package/dist/components/rich-text.d.ts.map +0 -1
- package/dist/components-entry.cjs.map +0 -1
- package/dist/components-entry.d.ts.map +0 -1
- package/dist/components-entry.js.map +0 -1
- package/dist/hooks/__useI18n.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/injection-key.d.ts.map +0 -1
- package/dist/msg.d.ts +0 -2
- package/dist/msg.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/use-i18n-D6iu0pGX.cjs +0 -2
- package/dist/use-i18n-D6iu0pGX.cjs.map +0 -1
- package/dist/use-i18n-DV-MXUZc.js +0 -17
- package/dist/use-i18n-DV-MXUZc.js.map +0 -1
- package/dist/use-i18n.d.ts.map +0 -1
- package/dist/vite-plugin.d.ts.map +0 -1
- package/dist/vue-runtime.d.ts +0 -3
- package/dist/vue-runtime.d.ts.map +0 -1
- /package/dist/{components → vue/src/components}/DateTime.d.ts +0 -0
- /package/dist/{components → vue/src/components}/NumberFormat.d.ts +0 -0
- /package/dist/{components → vue/src/components}/Plural.d.ts +0 -0
- /package/dist/{components → vue/src/components}/Select.d.ts +0 -0
- /package/dist/{components → vue/src/components}/Trans.d.ts +0 -0
- /package/dist/{components → vue/src/components}/rich-text.d.ts +0 -0
- /package/dist/{hooks → vue/src/hooks}/__useI18n.d.ts +0 -0
- /package/dist/{injection-key.d.ts → vue/src/injection-key.d.ts} +0 -0
- /package/dist/{use-i18n.d.ts → vue/src/use-i18n.d.ts} +0 -0
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -2,10 +2,15 @@ export { createFluenti, FLUENTI_KEY } from './plugin';
|
|
|
2
2
|
export type { FluentiConfig, FluentiPlugin, FluentiContext } from './plugin';
|
|
3
3
|
export { useI18n, useLocale } from './use-i18n';
|
|
4
4
|
export { t } from './compile-time-t';
|
|
5
|
-
export {
|
|
5
|
+
export { Trans } from './components/Trans';
|
|
6
6
|
export type { FluentiTransProps } from './components/Trans';
|
|
7
|
+
export { Plural } from './components/Plural';
|
|
7
8
|
export type { FluentiPluralProps } from './components/Plural';
|
|
9
|
+
export { Select } from './components/Select';
|
|
8
10
|
export type { FluentiSelectProps } from './components/Select';
|
|
11
|
+
export { DateTime } from './components/DateTime';
|
|
9
12
|
export type { FluentiDateTimeProps } from './components/DateTime';
|
|
13
|
+
export { NumberFormat } from './components/NumberFormat';
|
|
10
14
|
export type { FluentiNumberFormatProps } from './components/NumberFormat';
|
|
15
|
+
export { msg } from './msg';
|
|
11
16
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AACzE,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injection-key.d.ts","sourceRoot":"","sources":["../../../src/injection-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,4DAA4D;AAC5D,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,cAAc,CAAqC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"msg.d.ts","sourceRoot":"","sources":["../../../src/msg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { App, Ref } from 'vue';
|
|
2
|
-
import { AllMessages, Locale, LocalizedString, Messages, CompiledMessage, MessageDescriptor, DiagnosticsConfig, CustomFormatter } from '
|
|
2
|
+
import { AllMessages, Locale, LocalizedString, Messages, CompiledMessage, MessageDescriptor, DiagnosticsConfig, CustomFormatter } from '../../core/src/index.ts';
|
|
3
3
|
/** Compiled message chunk loader for lazy locale loading */
|
|
4
4
|
export type ChunkLoader = (locale: string) => Promise<Record<string, CompiledMessage> | {
|
|
5
5
|
default: Record<string, CompiledMessage>;
|
|
@@ -85,12 +85,12 @@ export interface FluentiConfig {
|
|
|
85
85
|
* Custom message interpolation function.
|
|
86
86
|
*
|
|
87
87
|
* By default, the runtime uses a lightweight `{key}` replacer.
|
|
88
|
-
* Pass the full `interpolate` from `@fluenti/core/
|
|
88
|
+
* Pass the full `interpolate` from `@fluenti/core/runtime` for
|
|
89
89
|
* runtime ICU MessageFormat parsing (adds ~2.5 KB gzip).
|
|
90
90
|
*
|
|
91
91
|
* @example
|
|
92
92
|
* ```ts
|
|
93
|
-
* import { interpolate } from '@fluenti/core/
|
|
93
|
+
* import { interpolate } from '@fluenti/core/runtime'
|
|
94
94
|
* createFluenti({ interpolate, ... })
|
|
95
95
|
* ```
|
|
96
96
|
*/
|
|
@@ -98,12 +98,12 @@ export interface FluentiConfig {
|
|
|
98
98
|
/**
|
|
99
99
|
* Components to register globally via `app.component()`.
|
|
100
100
|
*
|
|
101
|
-
* Import from `@fluenti/vue
|
|
101
|
+
* Import from `@fluenti/vue` and pass here to enable global
|
|
102
102
|
* component registration without bloating the default bundle.
|
|
103
103
|
*
|
|
104
104
|
* @example
|
|
105
105
|
* ```ts
|
|
106
|
-
* import * as components from '@fluenti/vue
|
|
106
|
+
* import * as components from '@fluenti/vue'
|
|
107
107
|
* app.use(createFluenti({ components, ... }))
|
|
108
108
|
* ```
|
|
109
109
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,E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;IAC3B;;;;;;;;;;;;;;OAcG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;;;;;;OAOG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,gEAAgE;IAChE,WAAW,CAAC,EAAE,iBAAiB,GAAG;QAAE,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;QAAC,OAAO,EAAE,OAAO,CAAA;KAAE,CAAA;IACpL;;;;;;;;;;;;OAYG;IACH,WAAW,CAAC,EAAE,CACZ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC3C,MAAM,EAAE,MAAM,EACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,KACzC,MAAM,CAAA;IACX;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACrC;AAED,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CAAA;IACvB,gEAAgE;IAChE,MAAM,EAAE,cAAc,CAAA;CACvB;AAQD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,aAAa,CAuTnE"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { FluentiCoreInstanceFull, Locale, Messages, DateFormatOptions, NumberFormatOptions } from '
|
|
2
|
-
export { detectLocale, getSSRLocaleScript, getHydratedLocale, isRTL, getDirection } from '
|
|
3
|
-
export type { DetectLocaleOptions } from '
|
|
1
|
+
import { FluentiCoreInstanceFull, Locale, Messages, DateFormatOptions, NumberFormatOptions } from '../../core/src/index.ts';
|
|
2
|
+
export { detectLocale, getSSRLocaleScript, getHydratedLocale, isRTL, getDirection } from '../../core/src/index.ts';
|
|
3
|
+
export type { DetectLocaleOptions } from '../../core/src/index.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Configuration for `createServerI18n`.
|
|
6
6
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/server.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,uBAAuB,EAEvB,MAAM,EACN,QAAQ,EACR,iBAAiB,EACjB,mBAAmB,EACpB,MAAM,eAAe,CAAA;AAGtB,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AACxG,YAAY,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAExD;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4EAA4E;IAC5E,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,QAAQ,GAAG;QAAE,OAAO,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAA;IAC3E,oDAAoD;IACpD,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC9C,wCAAwC;IACxC,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAA;IACxC,gCAAgC;IAChC,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,kCAAkC;IAClC,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,2CAA2C;IAC3C,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAEnC;;;OAGG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,uBAAuB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAEpE;;;;;;;;;;;;;;OAcG;IACH,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CACxE;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAyFrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-i18n.d.ts","sourceRoot":"","sources":["../../../src/use-i18n.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,OAAO,IAAI,cAAc,CAMxC;AAED,sEAAsE;AACtE,wBAAgB,SAAS,gDAExB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Plugin } from 'vite';
|
|
2
|
-
import { FluentiPluginOptions } from '
|
|
3
|
-
export type { FluentiPluginOptions as FluentiVueOptions } from '
|
|
2
|
+
import { FluentiPluginOptions } from '../../vite-plugin/src/index.ts';
|
|
3
|
+
export type { FluentiPluginOptions as FluentiVueOptions } from '../../vite-plugin/src/index.ts';
|
|
4
4
|
/**
|
|
5
5
|
* Fluenti Vue 3 Vite plugin.
|
|
6
6
|
*
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../../../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAKhE,YAAY,EAAE,oBAAoB,IAAI,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAErF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAoB3E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vue-runtime.d.ts","sourceRoot":"","sources":["../../../src/vue-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,eAAO,MAAM,mBAAmB,EAAE,gBAUhC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluenti/vue",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Vue 3 compile-time i18n — v-t directive, Trans/Plural/Select components, useI18n composable",
|
|
6
6
|
"homepage": "https://fluenti.dev",
|
|
@@ -30,45 +30,45 @@
|
|
|
30
30
|
],
|
|
31
31
|
"main": "./dist/index.cjs",
|
|
32
32
|
"module": "./dist/index.js",
|
|
33
|
-
"types": "./dist/index.d.ts",
|
|
33
|
+
"types": "./dist/vue/src/index.d.ts",
|
|
34
34
|
"exports": {
|
|
35
35
|
".": {
|
|
36
36
|
"import": {
|
|
37
|
-
"types": "./dist/index.d.ts",
|
|
37
|
+
"types": "./dist/vue/src/index.d.ts",
|
|
38
38
|
"default": "./dist/index.js"
|
|
39
39
|
},
|
|
40
40
|
"require": {
|
|
41
|
-
"types": "./dist/index.d.ts",
|
|
41
|
+
"types": "./dist/vue/src/index.d.ts",
|
|
42
42
|
"default": "./dist/index.cjs"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
"./
|
|
45
|
+
"./server": {
|
|
46
46
|
"import": {
|
|
47
|
-
"types": "./dist/
|
|
48
|
-
"default": "./dist/
|
|
47
|
+
"types": "./dist/vue/src/server.d.ts",
|
|
48
|
+
"default": "./dist/server.js"
|
|
49
49
|
},
|
|
50
50
|
"require": {
|
|
51
|
-
"types": "./dist/
|
|
52
|
-
"default": "./dist/
|
|
51
|
+
"types": "./dist/vue/src/server.d.ts",
|
|
52
|
+
"default": "./dist/server.cjs"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
|
-
"./
|
|
55
|
+
"./components": {
|
|
56
56
|
"import": {
|
|
57
|
-
"types": "./dist/
|
|
58
|
-
"default": "./dist/
|
|
57
|
+
"types": "./dist/vue/src/components-entry.d.ts",
|
|
58
|
+
"default": "./dist/components-entry.js"
|
|
59
59
|
},
|
|
60
60
|
"require": {
|
|
61
|
-
"types": "./dist/
|
|
62
|
-
"default": "./dist/
|
|
61
|
+
"types": "./dist/vue/src/components-entry.d.ts",
|
|
62
|
+
"default": "./dist/components-entry.cjs"
|
|
63
63
|
}
|
|
64
64
|
},
|
|
65
65
|
"./vite-plugin": {
|
|
66
66
|
"import": {
|
|
67
|
-
"types": "./dist/vite-plugin.d.ts",
|
|
67
|
+
"types": "./dist/vue/src/vite-plugin.d.ts",
|
|
68
68
|
"default": "./dist/vite-plugin.js"
|
|
69
69
|
},
|
|
70
70
|
"require": {
|
|
71
|
-
"types": "./dist/vite-plugin.d.ts",
|
|
71
|
+
"types": "./dist/vue/src/vite-plugin.d.ts",
|
|
72
72
|
"default": "./dist/vite-plugin.cjs"
|
|
73
73
|
}
|
|
74
74
|
}
|
|
@@ -87,8 +87,8 @@
|
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@fluenti/core": "0.
|
|
91
|
-
"@fluenti/vite-plugin": "0.
|
|
90
|
+
"@fluenti/core": "0.6.0",
|
|
91
|
+
"@fluenti/vite-plugin": "0.6.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
94
|
"typescript": "^5.9",
|
package/dist/compile-time-t.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile-time-t.d.ts","sourceRoot":"","sources":["../src/compile-time-t.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,eAAO,MAAM,CAAC,EAAE,YAME,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1 +0,0 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;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"}
|
|
@@ -1 +0,0 @@
|
|
|
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,CAA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CAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mEAAmE;;;;;;;;IANnE,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mEAAmE;;;;;;;4EA8BnE,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components-entry.cjs","names":[],"sources":["../src/components/rich-text.ts","../src/components/Trans.ts","../src/components/Plural.ts","../src/components/Select.ts","../src/components/DateTime.ts","../src/components/NumberFormat.ts"],"sourcesContent":["import { Comment, Text, h, isVNode, type VNode, type VNodeChild } from 'vue'\nimport { offsetIndices } from '@fluenti/core/internal'\n\nexport function extractMessage(children: VNodeChild | VNodeChild[] | undefined): {\n message: string\n components: VNode[]\n} {\n const components: VNode[] = []\n let message = ''\n\n function visit(node: VNodeChild | VNodeChild[] | undefined): void {\n if (node === null || node === undefined || typeof node === 'boolean') return\n if (Array.isArray(node)) {\n for (const child of node) visit(child)\n return\n }\n if (typeof node === 'string' || typeof node === 'number') {\n message += String(node)\n return\n }\n if (!isVNode(node) || node.type === Comment) return\n if (node.type === Text) {\n message += typeof node.children === 'string' ? node.children : ''\n return\n }\n\n const idx = components.length\n const inner = extractMessage(node.children as VNodeChild | VNodeChild[] | undefined)\n components.push(node)\n components.push(...inner.components)\n message += `<${idx}>${offsetIndices(inner.message, idx + 1)}</${idx}>`\n }\n\n visit(children)\n return { message, components }\n}\n\nexport function reconstruct(\n translated: string,\n components: VNode[],\n): VNodeChild {\n const tagRe = /<(\\d+)>([\\s\\S]*?)<\\/\\1>/g\n const result: VNodeChild[] = []\n let lastIndex = 0\n let match: RegExpExecArray | null\n\n tagRe.lastIndex = 0\n match = tagRe.exec(translated)\n while (match !== null) {\n if (match.index > lastIndex) {\n result.push(translated.slice(lastIndex, match.index))\n }\n\n const idx = Number(match[1])\n const component = components[idx]\n const innerContent = reconstruct(match[2]!, components)\n if (component) {\n result.push(h(component.type as never, component.props ?? {}, Array.isArray(innerContent) ? innerContent : [innerContent]))\n } else {\n result.push(match[2]!)\n }\n\n lastIndex = tagRe.lastIndex\n match = tagRe.exec(translated)\n }\n\n if (lastIndex < translated.length) {\n result.push(translated.slice(lastIndex))\n }\n\n return result.length <= 1 ? (result[0] ?? '') : result\n}\n\nexport function serializeRichForms<T extends string>(\n keys: readonly T[],\n forms: Partial<Record<T, VNodeChild>> & Record<string, VNodeChild | undefined>,\n): {\n messages: Record<string, string>\n components: VNode[]\n} {\n const messages: Record<string, string> = {}\n const components: VNode[] = []\n\n for (const key of keys) {\n const value = forms[key]\n if (value === undefined) continue\n const extracted = extractMessage(value)\n messages[key] = offsetIndices(extracted.message, components.length)\n components.push(...extracted.components)\n }\n\n for (const [key, value] of Object.entries(forms)) {\n if (keys.includes(key as T) || value === undefined) continue\n const extracted = extractMessage(value)\n messages[key] = offsetIndices(extracted.message, components.length)\n components.push(...extracted.components)\n }\n\n return { messages, components }\n}\n\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes } from 'vue'\nimport { useI18n } from '../use-i18n'\nimport { extractMessage, reconstruct } from './rich-text'\n\n/**\n * `<Trans>` component for rich text with Vue components.\n *\n * @example\n * ```vue\n * <Trans>\n * Visit our <a href=\"/docs\">documentation</a> to learn more.\n * </Trans>\n * ```\n *\n * @example\n * ```vue\n * <Trans>\n * Click <RouterLink to=\"/next\">here</RouterLink> to continue.\n * </Trans>\n * ```\n */\nconst transProps = {\n /** Override auto-generated hash ID */\n id: String,\n /** Message context used for identity and translator disambiguation */\n context: String,\n /** Translator-facing note preserved in extraction catalogs */\n comment: String,\n /** Wrapper element tag name. Defaults to no wrapper (Fragment). */\n tag: { type: String, default: undefined },\n} as const\n\nexport type FluentiTransProps = Readonly<ExtractPropTypes<typeof transProps>>\n\nexport const Trans = defineComponent({\n name: 'Trans',\n props: transProps,\n setup(props, { slots }) {\n const { t } = useI18n()\n\n return () => {\n const defaultSlot = slots['default']?.()\n if (!defaultSlot) return null\n const { message, components } = extractMessage(defaultSlot)\n const translated = t({\n ...(props.id !== undefined ? { id: props.id } : {}),\n message,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n })\n const result = components.length > 0 ? reconstruct(translated, components) : translated\n if (Array.isArray(result)) {\n if (result.length === 1) return result[0]!\n return props.tag ? h(props.tag, null, result) : result\n }\n return result\n }\n },\n})\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes, SetupContext, VNodeChild } from 'vue'\nimport { hashMessage, buildICUPluralMessage, PLURAL_CATEGORIES, type PluralCategory } from '@fluenti/core/internal'\nimport { useI18n } from '../use-i18n'\nimport { reconstruct, serializeRichForms } from './rich-text'\n\n/**\n * `<Plural>` component — shorthand for ICU plural patterns.\n *\n * Plural form props (`zero`, `one`, `two`, `few`, `many`, `other`) are treated\n * as source-language messages. The component builds an ICU plural message,\n * looks it up via `t()` in the catalog, and interpolates the translated result.\n *\n * When no catalog translation exists, the component falls back to interpolating\n * the source-language ICU message directly via the `message` field of the\n * MessageDescriptor.\n *\n * Rich text is supported via named slots:\n * ```vue\n * <Plural :value=\"count\">\n * <template #zero>No <strong>items</strong></template>\n * <template #one><em>1</em> item</template>\n * <template #other><strong>{{ count }}</strong> items</template>\n * </Plural>\n * ```\n *\n * String props still work (backward compatible):\n * ```vue\n * <Plural :value=\"count\" zero=\"No items\" one=\"# item\" other=\"# items\" />\n * ```\n *\n * @example\n * ```vue\n * <template>\n * <!-- Preferred: v-t.plural (compile-time) -->\n * <p v-t.plural=\"count\">one item | {count} items</p>\n *\n * <!-- Alternative: Plural component (runtime) -->\n * <Plural :value=\"count\" one=\"# item in cart\" other=\"# items in cart\" />\n * </template>\n * ```\n */\nconst pluralProps = {\n /** The numeric value to pluralise on */\n value: { type: Number, required: true },\n /** Override the auto-generated synthetic ICU message id */\n id: String,\n /** Message context used for identity and translator disambiguation */\n context: String,\n /** Translator-facing note preserved in extraction catalogs */\n comment: String,\n /** Text for zero items (maps to `=0`) */\n zero: String,\n /** Text for singular (maps to `one`) */\n one: String,\n /** Text for dual (maps to `two`) */\n two: String,\n /** Text for few (maps to `few`) */\n few: String,\n /** Text for many (maps to `many`) */\n many: String,\n /** Text for the default/other category */\n other: { type: String, required: true },\n /** Offset from value before selecting form */\n offset: Number,\n /** Wrapper element tag name. Defaults to no wrapper (Fragment). */\n tag: { type: String, default: undefined },\n} as const\n\nexport type FluentiPluralProps = Readonly<ExtractPropTypes<typeof pluralProps>>\n\nexport const Plural = defineComponent({\n name: 'Plural',\n props: pluralProps,\n setup(props, { slots }: SetupContext) {\n const { t } = useI18n()\n\n return () => {\n const forms: Partial<Record<PluralCategory, VNodeChild>> & Record<string, VNodeChild | undefined> = {\n zero: props.zero,\n one: props.one,\n two: props.two,\n few: props.few,\n many: props.many,\n other: props.other,\n }\n\n for (const cat of PLURAL_CATEGORIES) {\n const slot = slots[cat]\n if (slot) {\n forms[cat] = slot({ count: '#' })\n }\n }\n\n const { messages, components } = serializeRichForms(PLURAL_CATEGORIES, forms)\n const icuMessage = buildICUPluralMessage(\n {\n ...(messages['zero'] !== undefined && { zero: messages['zero'] }),\n ...(messages['one'] !== undefined && { one: messages['one'] }),\n ...(messages['two'] !== undefined && { two: messages['two'] }),\n ...(messages['few'] !== undefined && { few: messages['few'] }),\n ...(messages['many'] !== undefined && { many: messages['many'] }),\n other: messages['other'] ?? '',\n },\n props.offset,\n )\n const translated = t(\n {\n id: props.id ?? (props.context === undefined ? icuMessage : hashMessage(icuMessage, props.context)),\n message: icuMessage,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n },\n { count: props.value },\n )\n\n const result = components.length > 0 ? reconstruct(translated, components) : translated\n if (props.tag) return h(props.tag, undefined, result ?? undefined)\n return result ?? null\n }\n },\n})\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes, PropType, SetupContext, VNodeChild } from 'vue'\nimport { hashMessage, buildICUSelectMessage, normalizeSelectForms } from '@fluenti/core/internal'\nimport { useI18n } from '../use-i18n'\nimport { reconstruct, serializeRichForms } from './rich-text'\n\n/**\n * `<Select>` component — shorthand for ICU select patterns.\n *\n * Accepts a `value` string that selects among named options. Options can be\n * provided via the type-safe `options` prop (recommended), as direct attrs\n * (convenience), or as named slots (rich text).\n *\n * Falls back to `other` when no match is found.\n *\n * @example Type-safe usage (recommended):\n * ```vue\n * <Select\n * :value=\"gender\"\n * :options=\"{ male: 'He liked it', female: 'She liked it' }\"\n * other=\"They liked it\"\n * />\n * ```\n *\n * @example Rich text via named slots:\n * ```vue\n * <Select :value=\"gender\">\n * <template #male><strong>He</strong> liked this</template>\n * <template #female><strong>She</strong> liked this</template>\n * <template #other><em>They</em> liked this</template>\n * </Select>\n * ```\n */\nconst selectProps = {\n /** The value to select on (e.g. `\"male\"`, `\"female\"`) */\n value: { type: String, required: true },\n /** Override the auto-generated synthetic ICU message id */\n id: String,\n /** Message context used for identity and translator disambiguation */\n context: String,\n /** Translator-facing note preserved in extraction catalogs */\n comment: String,\n /** Fallback text when no option matches `value` */\n other: { type: String, required: true },\n /**\n * Named options map. Keys are match values, values are display strings.\n * Takes precedence over attrs when both are provided.\n *\n * @example `{ male: 'He', female: 'She' }`\n */\n options: {\n type: Object as PropType<Record<string, string>>,\n default: undefined,\n },\n /** Wrapper element tag name. Defaults to no wrapper (Fragment). */\n tag: { type: String, default: undefined },\n} as const\n\nexport type FluentiSelectProps = Readonly<ExtractPropTypes<typeof selectProps>>\n\nexport const Select = defineComponent({\n name: 'Select',\n inheritAttrs: false,\n props: selectProps,\n setup(props, { attrs, slots }: SetupContext) {\n const { t } = useI18n()\n\n return () => {\n const forms: Record<string, VNodeChild | undefined> = {}\n\n if (props.options !== undefined) {\n for (const [key, value] of Object.entries(props.options)) {\n forms[key] = value\n }\n forms['other'] = props.other\n } else {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'string') {\n forms[key] = value\n }\n }\n forms['other'] = props.other\n }\n\n for (const [key, slot] of Object.entries(slots)) {\n if (key === 'default' || !slot) continue\n forms[key] = slot({ value: '{value}' })\n }\n\n const orderedKeys = [...Object.keys(forms).filter(key => key !== 'other'), 'other'] as const\n const { messages, components } = serializeRichForms(orderedKeys, forms)\n const normalized = normalizeSelectForms(\n Object.fromEntries(\n [...orderedKeys].map((key) => [key, messages[key] ?? '']),\n ),\n )\n const icuMessage = buildICUSelectMessage(normalized.forms)\n const translated = t(\n {\n id: props.id ?? (props.context === undefined ? icuMessage : hashMessage(icuMessage, props.context)),\n message: icuMessage,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n },\n { value: normalized.valueMap[props.value] ?? 'other' },\n )\n const result = components.length > 0 ? reconstruct(translated, components) : translated\n if (props.tag) return h(props.tag, undefined, result ?? undefined)\n return result ?? null\n }\n },\n})\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes, PropType } from 'vue'\nimport { useI18n } from '../use-i18n'\n\n/**\n * `<DateTime>` component for formatting dates according to locale.\n *\n * @example\n * ```vue\n * <DateTime :value=\"new Date()\" />\n * <DateTime :value=\"Date.now()\" format=\"short\" />\n * <DateTime :value=\"event.date\" format=\"long\" tag=\"time\" />\n * ```\n */\nconst dateTimeProps = {\n value: { type: [Date, Number] as PropType<Date | number>, required: true },\n format: { type: String, default: undefined },\n tag: { type: String, default: 'span' },\n} as const\n\nexport type FluentiDateTimeProps = Readonly<ExtractPropTypes<typeof dateTimeProps>>\n\nexport const DateTime = defineComponent({\n name: 'DateTime',\n props: dateTimeProps,\n setup(props) {\n const { d } = useI18n()\n return () => h(props.tag, d(props.value as Date | number, props.format))\n },\n})\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes } from 'vue'\nimport { useI18n } from '../use-i18n'\n\n/**\n * `<NumberFormat>` component for formatting numbers according to locale.\n *\n * @example\n * ```vue\n * <NumberFormat :value=\"1234.56\" />\n * <NumberFormat :value=\"0.75\" format=\"percent\" />\n * <NumberFormat :value=\"99.99\" format=\"currency\" tag=\"strong\" />\n * ```\n */\nconst numberFormatProps = {\n value: { type: Number, required: true },\n format: { type: String, default: undefined },\n tag: { type: String, default: 'span' },\n} as const\n\nexport type FluentiNumberFormatProps = Readonly<ExtractPropTypes<typeof numberFormatProps>>\n\nexport const NumberFormat = defineComponent({\n name: 'NumberFormat',\n props: numberFormatProps,\n setup(props) {\n const { n } = useI18n()\n return () => h(props.tag, n(props.value, props.format))\n },\n})\n"],"mappings":"uKAGA,SAAgB,EAAe,EAG7B,CACA,IAAM,EAAsB,EAAE,CAC1B,EAAU,GAEd,SAAS,EAAM,EAAmD,CAChE,GAAI,GAAS,MAA8B,OAAO,GAAS,UAAW,OACtE,GAAI,MAAM,QAAQ,EAAK,CAAE,CACvB,IAAK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,CACvC,OAAQ,CAAE,KAAM,OAAQ,QAAS,IAAA,GAAW,CAC5C,IAAK,CAAE,KAAM,OAAQ,QAAS,OAAQ,CACvC,CAIY,GAAA,EAAA,EAAA,iBAA+B,CAC1C,KAAM,eACN,MAAO,EACP,MAAM,EAAO,CACX,GAAM,CAAE,KAAM,EAAA,GAAS,CACvB,WAAA,EAAA,EAAA,GAAe,EAAM,IAAK,EAAE,EAAM,MAAO,EAAM,OAAO,CAAC,EAE1D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components-entry.d.ts","sourceRoot":"","sources":["../src/components-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AAC5C,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA;AAGzE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components-entry.js","names":[],"sources":["../src/components/rich-text.ts","../src/components/Trans.ts","../src/components/Plural.ts","../src/components/Select.ts","../src/components/DateTime.ts","../src/components/NumberFormat.ts"],"sourcesContent":["import { Comment, Text, h, isVNode, type VNode, type VNodeChild } from 'vue'\nimport { offsetIndices } from '@fluenti/core/internal'\n\nexport function extractMessage(children: VNodeChild | VNodeChild[] | undefined): {\n message: string\n components: VNode[]\n} {\n const components: VNode[] = []\n let message = ''\n\n function visit(node: VNodeChild | VNodeChild[] | undefined): void {\n if (node === null || node === undefined || typeof node === 'boolean') return\n if (Array.isArray(node)) {\n for (const child of node) visit(child)\n return\n }\n if (typeof node === 'string' || typeof node === 'number') {\n message += String(node)\n return\n }\n if (!isVNode(node) || node.type === Comment) return\n if (node.type === Text) {\n message += typeof node.children === 'string' ? node.children : ''\n return\n }\n\n const idx = components.length\n const inner = extractMessage(node.children as VNodeChild | VNodeChild[] | undefined)\n components.push(node)\n components.push(...inner.components)\n message += `<${idx}>${offsetIndices(inner.message, idx + 1)}</${idx}>`\n }\n\n visit(children)\n return { message, components }\n}\n\nexport function reconstruct(\n translated: string,\n components: VNode[],\n): VNodeChild {\n const tagRe = /<(\\d+)>([\\s\\S]*?)<\\/\\1>/g\n const result: VNodeChild[] = []\n let lastIndex = 0\n let match: RegExpExecArray | null\n\n tagRe.lastIndex = 0\n match = tagRe.exec(translated)\n while (match !== null) {\n if (match.index > lastIndex) {\n result.push(translated.slice(lastIndex, match.index))\n }\n\n const idx = Number(match[1])\n const component = components[idx]\n const innerContent = reconstruct(match[2]!, components)\n if (component) {\n result.push(h(component.type as never, component.props ?? {}, Array.isArray(innerContent) ? innerContent : [innerContent]))\n } else {\n result.push(match[2]!)\n }\n\n lastIndex = tagRe.lastIndex\n match = tagRe.exec(translated)\n }\n\n if (lastIndex < translated.length) {\n result.push(translated.slice(lastIndex))\n }\n\n return result.length <= 1 ? (result[0] ?? '') : result\n}\n\nexport function serializeRichForms<T extends string>(\n keys: readonly T[],\n forms: Partial<Record<T, VNodeChild>> & Record<string, VNodeChild | undefined>,\n): {\n messages: Record<string, string>\n components: VNode[]\n} {\n const messages: Record<string, string> = {}\n const components: VNode[] = []\n\n for (const key of keys) {\n const value = forms[key]\n if (value === undefined) continue\n const extracted = extractMessage(value)\n messages[key] = offsetIndices(extracted.message, components.length)\n components.push(...extracted.components)\n }\n\n for (const [key, value] of Object.entries(forms)) {\n if (keys.includes(key as T) || value === undefined) continue\n const extracted = extractMessage(value)\n messages[key] = offsetIndices(extracted.message, components.length)\n components.push(...extracted.components)\n }\n\n return { messages, components }\n}\n\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes } from 'vue'\nimport { useI18n } from '../use-i18n'\nimport { extractMessage, reconstruct } from './rich-text'\n\n/**\n * `<Trans>` component for rich text with Vue components.\n *\n * @example\n * ```vue\n * <Trans>\n * Visit our <a href=\"/docs\">documentation</a> to learn more.\n * </Trans>\n * ```\n *\n * @example\n * ```vue\n * <Trans>\n * Click <RouterLink to=\"/next\">here</RouterLink> to continue.\n * </Trans>\n * ```\n */\nconst transProps = {\n /** Override auto-generated hash ID */\n id: String,\n /** Message context used for identity and translator disambiguation */\n context: String,\n /** Translator-facing note preserved in extraction catalogs */\n comment: String,\n /** Wrapper element tag name. Defaults to no wrapper (Fragment). */\n tag: { type: String, default: undefined },\n} as const\n\nexport type FluentiTransProps = Readonly<ExtractPropTypes<typeof transProps>>\n\nexport const Trans = defineComponent({\n name: 'Trans',\n props: transProps,\n setup(props, { slots }) {\n const { t } = useI18n()\n\n return () => {\n const defaultSlot = slots['default']?.()\n if (!defaultSlot) return null\n const { message, components } = extractMessage(defaultSlot)\n const translated = t({\n ...(props.id !== undefined ? { id: props.id } : {}),\n message,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n })\n const result = components.length > 0 ? reconstruct(translated, components) : translated\n if (Array.isArray(result)) {\n if (result.length === 1) return result[0]!\n return props.tag ? h(props.tag, null, result) : result\n }\n return result\n }\n },\n})\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes, SetupContext, VNodeChild } from 'vue'\nimport { hashMessage, buildICUPluralMessage, PLURAL_CATEGORIES, type PluralCategory } from '@fluenti/core/internal'\nimport { useI18n } from '../use-i18n'\nimport { reconstruct, serializeRichForms } from './rich-text'\n\n/**\n * `<Plural>` component — shorthand for ICU plural patterns.\n *\n * Plural form props (`zero`, `one`, `two`, `few`, `many`, `other`) are treated\n * as source-language messages. The component builds an ICU plural message,\n * looks it up via `t()` in the catalog, and interpolates the translated result.\n *\n * When no catalog translation exists, the component falls back to interpolating\n * the source-language ICU message directly via the `message` field of the\n * MessageDescriptor.\n *\n * Rich text is supported via named slots:\n * ```vue\n * <Plural :value=\"count\">\n * <template #zero>No <strong>items</strong></template>\n * <template #one><em>1</em> item</template>\n * <template #other><strong>{{ count }}</strong> items</template>\n * </Plural>\n * ```\n *\n * String props still work (backward compatible):\n * ```vue\n * <Plural :value=\"count\" zero=\"No items\" one=\"# item\" other=\"# items\" />\n * ```\n *\n * @example\n * ```vue\n * <template>\n * <!-- Preferred: v-t.plural (compile-time) -->\n * <p v-t.plural=\"count\">one item | {count} items</p>\n *\n * <!-- Alternative: Plural component (runtime) -->\n * <Plural :value=\"count\" one=\"# item in cart\" other=\"# items in cart\" />\n * </template>\n * ```\n */\nconst pluralProps = {\n /** The numeric value to pluralise on */\n value: { type: Number, required: true },\n /** Override the auto-generated synthetic ICU message id */\n id: String,\n /** Message context used for identity and translator disambiguation */\n context: String,\n /** Translator-facing note preserved in extraction catalogs */\n comment: String,\n /** Text for zero items (maps to `=0`) */\n zero: String,\n /** Text for singular (maps to `one`) */\n one: String,\n /** Text for dual (maps to `two`) */\n two: String,\n /** Text for few (maps to `few`) */\n few: String,\n /** Text for many (maps to `many`) */\n many: String,\n /** Text for the default/other category */\n other: { type: String, required: true },\n /** Offset from value before selecting form */\n offset: Number,\n /** Wrapper element tag name. Defaults to no wrapper (Fragment). */\n tag: { type: String, default: undefined },\n} as const\n\nexport type FluentiPluralProps = Readonly<ExtractPropTypes<typeof pluralProps>>\n\nexport const Plural = defineComponent({\n name: 'Plural',\n props: pluralProps,\n setup(props, { slots }: SetupContext) {\n const { t } = useI18n()\n\n return () => {\n const forms: Partial<Record<PluralCategory, VNodeChild>> & Record<string, VNodeChild | undefined> = {\n zero: props.zero,\n one: props.one,\n two: props.two,\n few: props.few,\n many: props.many,\n other: props.other,\n }\n\n for (const cat of PLURAL_CATEGORIES) {\n const slot = slots[cat]\n if (slot) {\n forms[cat] = slot({ count: '#' })\n }\n }\n\n const { messages, components } = serializeRichForms(PLURAL_CATEGORIES, forms)\n const icuMessage = buildICUPluralMessage(\n {\n ...(messages['zero'] !== undefined && { zero: messages['zero'] }),\n ...(messages['one'] !== undefined && { one: messages['one'] }),\n ...(messages['two'] !== undefined && { two: messages['two'] }),\n ...(messages['few'] !== undefined && { few: messages['few'] }),\n ...(messages['many'] !== undefined && { many: messages['many'] }),\n other: messages['other'] ?? '',\n },\n props.offset,\n )\n const translated = t(\n {\n id: props.id ?? (props.context === undefined ? icuMessage : hashMessage(icuMessage, props.context)),\n message: icuMessage,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n },\n { count: props.value },\n )\n\n const result = components.length > 0 ? reconstruct(translated, components) : translated\n if (props.tag) return h(props.tag, undefined, result ?? undefined)\n return result ?? null\n }\n },\n})\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes, PropType, SetupContext, VNodeChild } from 'vue'\nimport { hashMessage, buildICUSelectMessage, normalizeSelectForms } from '@fluenti/core/internal'\nimport { useI18n } from '../use-i18n'\nimport { reconstruct, serializeRichForms } from './rich-text'\n\n/**\n * `<Select>` component — shorthand for ICU select patterns.\n *\n * Accepts a `value` string that selects among named options. Options can be\n * provided via the type-safe `options` prop (recommended), as direct attrs\n * (convenience), or as named slots (rich text).\n *\n * Falls back to `other` when no match is found.\n *\n * @example Type-safe usage (recommended):\n * ```vue\n * <Select\n * :value=\"gender\"\n * :options=\"{ male: 'He liked it', female: 'She liked it' }\"\n * other=\"They liked it\"\n * />\n * ```\n *\n * @example Rich text via named slots:\n * ```vue\n * <Select :value=\"gender\">\n * <template #male><strong>He</strong> liked this</template>\n * <template #female><strong>She</strong> liked this</template>\n * <template #other><em>They</em> liked this</template>\n * </Select>\n * ```\n */\nconst selectProps = {\n /** The value to select on (e.g. `\"male\"`, `\"female\"`) */\n value: { type: String, required: true },\n /** Override the auto-generated synthetic ICU message id */\n id: String,\n /** Message context used for identity and translator disambiguation */\n context: String,\n /** Translator-facing note preserved in extraction catalogs */\n comment: String,\n /** Fallback text when no option matches `value` */\n other: { type: String, required: true },\n /**\n * Named options map. Keys are match values, values are display strings.\n * Takes precedence over attrs when both are provided.\n *\n * @example `{ male: 'He', female: 'She' }`\n */\n options: {\n type: Object as PropType<Record<string, string>>,\n default: undefined,\n },\n /** Wrapper element tag name. Defaults to no wrapper (Fragment). */\n tag: { type: String, default: undefined },\n} as const\n\nexport type FluentiSelectProps = Readonly<ExtractPropTypes<typeof selectProps>>\n\nexport const Select = defineComponent({\n name: 'Select',\n inheritAttrs: false,\n props: selectProps,\n setup(props, { attrs, slots }: SetupContext) {\n const { t } = useI18n()\n\n return () => {\n const forms: Record<string, VNodeChild | undefined> = {}\n\n if (props.options !== undefined) {\n for (const [key, value] of Object.entries(props.options)) {\n forms[key] = value\n }\n forms['other'] = props.other\n } else {\n for (const [key, value] of Object.entries(attrs)) {\n if (typeof value === 'string') {\n forms[key] = value\n }\n }\n forms['other'] = props.other\n }\n\n for (const [key, slot] of Object.entries(slots)) {\n if (key === 'default' || !slot) continue\n forms[key] = slot({ value: '{value}' })\n }\n\n const orderedKeys = [...Object.keys(forms).filter(key => key !== 'other'), 'other'] as const\n const { messages, components } = serializeRichForms(orderedKeys, forms)\n const normalized = normalizeSelectForms(\n Object.fromEntries(\n [...orderedKeys].map((key) => [key, messages[key] ?? '']),\n ),\n )\n const icuMessage = buildICUSelectMessage(normalized.forms)\n const translated = t(\n {\n id: props.id ?? (props.context === undefined ? icuMessage : hashMessage(icuMessage, props.context)),\n message: icuMessage,\n ...(props.context !== undefined ? { context: props.context } : {}),\n ...(props.comment !== undefined ? { comment: props.comment } : {}),\n },\n { value: normalized.valueMap[props.value] ?? 'other' },\n )\n const result = components.length > 0 ? reconstruct(translated, components) : translated\n if (props.tag) return h(props.tag, undefined, result ?? undefined)\n return result ?? null\n }\n },\n})\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes, PropType } from 'vue'\nimport { useI18n } from '../use-i18n'\n\n/**\n * `<DateTime>` component for formatting dates according to locale.\n *\n * @example\n * ```vue\n * <DateTime :value=\"new Date()\" />\n * <DateTime :value=\"Date.now()\" format=\"short\" />\n * <DateTime :value=\"event.date\" format=\"long\" tag=\"time\" />\n * ```\n */\nconst dateTimeProps = {\n value: { type: [Date, Number] as PropType<Date | number>, required: true },\n format: { type: String, default: undefined },\n tag: { type: String, default: 'span' },\n} as const\n\nexport type FluentiDateTimeProps = Readonly<ExtractPropTypes<typeof dateTimeProps>>\n\nexport const DateTime = defineComponent({\n name: 'DateTime',\n props: dateTimeProps,\n setup(props) {\n const { d } = useI18n()\n return () => h(props.tag, d(props.value as Date | number, props.format))\n },\n})\n","import { defineComponent, h } from 'vue'\nimport type { ExtractPropTypes } from 'vue'\nimport { useI18n } from '../use-i18n'\n\n/**\n * `<NumberFormat>` component for formatting numbers according to locale.\n *\n * @example\n * ```vue\n * <NumberFormat :value=\"1234.56\" />\n * <NumberFormat :value=\"0.75\" format=\"percent\" />\n * <NumberFormat :value=\"99.99\" format=\"currency\" tag=\"strong\" />\n * ```\n */\nconst numberFormatProps = {\n value: { type: Number, required: true },\n format: { type: String, default: undefined },\n tag: { type: String, default: 'span' },\n} as const\n\nexport type FluentiNumberFormatProps = Readonly<ExtractPropTypes<typeof numberFormatProps>>\n\nexport const NumberFormat = defineComponent({\n name: 'NumberFormat',\n props: numberFormatProps,\n setup(props) {\n const { n } = useI18n()\n return () => h(props.tag, n(props.value, props.format))\n },\n})\n"],"mappings":";;;;AAGA,SAAgB,EAAe,GAG7B;CACA,IAAM,IAAsB,EAAE,EAC1B,IAAU;CAEd,SAAS,EAAM,GAAmD;AAChE,MAAI,KAAS,QAA8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AS;AACvB,eAAa,EAAE,EAAM,KAAK,EAAE,EAAM,OAAO,EAAM,OAAO,CAAC;;CAE1D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACrD,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAC5E,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAI3B,YAAY,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,YAAY,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAC7D,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAA;AACjE,YAAY,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"injection-key.d.ts","sourceRoot":"","sources":["../src/injection-key.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AACvC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C,4DAA4D;AAC5D,eAAO,MAAM,WAAW,EAAE,YAAY,CAAC,cAAc,CAAqB,CAAA"}
|
package/dist/msg.d.ts
DELETED
package/dist/msg.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msg.d.ts","sourceRoot":"","sources":["../src/msg.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAA"}
|
package/dist/plugin.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAW3J,4DAA4D;AAC5D,MAAM,MAAM,WAAW,GAAG,CACxB,MAAM,EAAE,MAAM,KACX,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAAE,CAAC,CAAA;AAwB5F,4FAA4F;AAC5F,MAAM,WAAW,cAAc;IAC7B,yFAAyF;IACzF,CAAC,CAAC,EAAE,EAAE,MAAM,GAAG,iBAAiB,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,eAAe,CAAA;IACpF,6CAA6C;IAC7C,CAAC,CAAC,OAAO,EAAE,oBAAoB,EAAE,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,eAAe,CAAA;IACtE,sCAAsC;IACtC,MAAM,EAAE,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAA;IAC7B,2EAA2E;IAC3E,SAAS,CAAC,MAAM,EAAE,M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MAAM,KAAK,MAAM,GAAG,SAAS,CAAA;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB;;;OAGG;IACH,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAA;IAEnC;;;OAGG;IACH,OAAO,EAAE,MAAM,OAAO,CAAC,uBAAuB,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAEpE;;;;;;;;;;;;;;OAcG;IACH,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,CAAA;CACxE;AAQD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAyFrE"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
let e=require(`vue`);var t=Symbol(`fluenti`);function n(){let n=(0,e.inject)(t);if(!n)throw Error(`[fluenti] useI18n() requires createFluenti plugin`);return n}function r(){return n().locale}Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return n}});
|
|
2
|
-
//# sourceMappingURL=use-i18n-D6iu0pGX.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-i18n-D6iu0pGX.cjs","names":[],"sources":["../src/injection-key.ts","../src/use-i18n.ts"],"sourcesContent":["import type { InjectionKey } from 'vue'\nimport type { FluentiContext } from './plugin'\n\n/** Injection key for the Fluenti i18n context. @internal */\nexport const FLUENTI_KEY: InjectionKey<FluentiContext> = Symbol('fluenti')\n","import { inject } from 'vue'\nimport { FLUENTI_KEY } from './injection-key'\nimport type { FluentiContext } from './plugin'\n\n/**\n * Composable that returns the Fluenti i18n context.\n *\n * Must be called inside a component whose ancestor app has installed the\n * `createFluenti()` plugin.\n *\n * @throws If the plugin has not been installed\n *\n * @example\n * ```vue\n * <template>\n * <!-- Preferred: v-t directive (compile-time, zero runtime cost) -->\n * <h1 v-t>Welcome to our app</h1>\n * <p v-t>Hello, {name}!</p>\n *\n * <!-- Alternative: tagged template in script -->\n * <p>{{ greeting }}</p>\n * </template>\n *\n * <script setup>\n * import { useI18n } from '@fluenti/vue'\n * const { t, locale, setLocale } = useI18n()\n * const greeting = t`Hello, {name}!`\n * </script>\n * ```\n */\nexport function useI18n(): FluentiContext {\n const ctx = inject(FLUENTI_KEY)\n if (!ctx) {\n throw new Error('[fluenti] useI18n() requires createFluenti plugin')\n }\n return ctx\n}\n\n/** Shorthand composable that returns only the reactive locale ref. */\nexport function useLocale() {\n return useI18n().locale\n}\n"],"mappings":"qBAIA,IAAa,EAA4C,OAAO,UAAU,CC0B1E,SAAgB,GAA0B,CACxC,IAAM,GAAA,EAAA,EAAA,QAAa,EAAY,CAC/B,GAAI,CAAC,EACH,MAAU,MAAM,oDAAoD,CAEtE,OAAO,EAIT,SAAgB,GAAY,CAC1B,OAAO,GAAS,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { inject as e } from "vue";
|
|
2
|
-
//#region src/injection-key.ts
|
|
3
|
-
var t = Symbol("fluenti");
|
|
4
|
-
//#endregion
|
|
5
|
-
//#region src/use-i18n.ts
|
|
6
|
-
function n() {
|
|
7
|
-
let n = e(t);
|
|
8
|
-
if (!n) throw Error("[fluenti] useI18n() requires createFluenti plugin");
|
|
9
|
-
return n;
|
|
10
|
-
}
|
|
11
|
-
function r() {
|
|
12
|
-
return n().locale;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
export { r as n, t as r, n as t };
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=use-i18n-DV-MXUZc.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-i18n-DV-MXUZc.js","names":[],"sources":["../src/injection-key.ts","../src/use-i18n.ts"],"sourcesContent":["import type { InjectionKey } from 'vue'\nimport type { FluentiContext } from './plugin'\n\n/** Injection key for the Fluenti i18n context. @internal */\nexport const FLUENTI_KEY: InjectionKey<FluentiContext> = Symbol('fluenti')\n","import { inject } from 'vue'\nimport { FLUENTI_KEY } from './injection-key'\nimport type { FluentiContext } from './plugin'\n\n/**\n * Composable that returns the Fluenti i18n context.\n *\n * Must be called inside a component whose ancestor app has installed the\n * `createFluenti()` plugin.\n *\n * @throws If the plugin has not been installed\n *\n * @example\n * ```vue\n * <template>\n * <!-- Preferred: v-t directive (compile-time, zero runtime cost) -->\n * <h1 v-t>Welcome to our app</h1>\n * <p v-t>Hello, {name}!</p>\n *\n * <!-- Alternative: tagged template in script -->\n * <p>{{ greeting }}</p>\n * </template>\n *\n * <script setup>\n * import { useI18n } from '@fluenti/vue'\n * const { t, locale, setLocale } = useI18n()\n * const greeting = t`Hello, {name}!`\n * </script>\n * ```\n */\nexport function useI18n(): FluentiContext {\n const ctx = inject(FLUENTI_KEY)\n if (!ctx) {\n throw new Error('[fluenti] useI18n() requires createFluenti plugin')\n }\n return ctx\n}\n\n/** Shorthand composable that returns only the reactive locale ref. */\nexport function useLocale() {\n return useI18n().locale\n}\n"],"mappings":";;AAIA,IAAa,IAA4C,OAAO,UAAU;;;AC0B1E,SAAgB,IAA0B;CACxC,IAAM,IAAM,EAAO,EAAY;AAC/B,KAAI,CAAC,EACH,OAAU,MAAM,oDAAoD;AAEtE,QAAO;;AAIT,SAAgB,IAAY;AAC1B,QAAO,GAAS,CAAC"}
|
package/dist/use-i18n.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-i18n.d.ts","sourceRoot":"","sources":["../src/use-i18n.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,OAAO,IAAI,cAAc,CAMxC;AAED,sEAAsE;AACtE,wBAAgB,SAAS,gDAExB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAClC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAKhE,YAAY,EAAE,oBAAoB,IAAI,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAErF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM,EAAE,CAoB3E"}
|
package/dist/vue-runtime.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vue-runtime.d.ts","sourceRoot":"","sources":["../src/vue-runtime.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,eAAO,MAAM,mBAAmB,EAAE,gBAUhC,CAAA"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|