@fluenti/vue 0.3.3 → 0.4.0-rc.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.
@@ -5,8 +5,8 @@ import { ExtractPropTypes, PropType } from 'vue';
5
5
  * @example
6
6
  * ```vue
7
7
  * <DateTime :value="new Date()" />
8
- * <DateTime :value="Date.now()" style="short" />
9
- * <DateTime :value="event.date" style="long" tag="time" />
8
+ * <DateTime :value="Date.now()" format="short" />
9
+ * <DateTime :value="event.date" format="long" tag="time" />
10
10
  * ```
11
11
  */
12
12
  declare const dateTimeProps: {
@@ -14,7 +14,7 @@ declare const dateTimeProps: {
14
14
  readonly type: PropType<Date | number>;
15
15
  readonly required: true;
16
16
  };
17
- readonly style: {
17
+ readonly format: {
18
18
  readonly type: StringConstructor;
19
19
  readonly default: undefined;
20
20
  };
@@ -29,7 +29,7 @@ export declare const DateTime: import('vue').DefineComponent<ExtractPropTypes<{
29
29
  readonly type: PropType<Date | number>;
30
30
  readonly required: true;
31
31
  };
32
- readonly style: {
32
+ readonly format: {
33
33
  readonly type: StringConstructor;
34
34
  readonly default: undefined;
35
35
  };
@@ -44,7 +44,7 @@ export declare const DateTime: import('vue').DefineComponent<ExtractPropTypes<{
44
44
  readonly type: PropType<Date | number>;
45
45
  readonly required: true;
46
46
  };
47
- readonly style: {
47
+ readonly format: {
48
48
  readonly type: StringConstructor;
49
49
  readonly default: undefined;
50
50
  };
@@ -53,8 +53,8 @@ export declare const DateTime: import('vue').DefineComponent<ExtractPropTypes<{
53
53
  readonly default: "span";
54
54
  };
55
55
  }>> & Readonly<{}>, {
56
- readonly style: string;
57
56
  readonly tag: string;
57
+ readonly format: string;
58
58
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
59
59
  export {};
60
60
  //# sourceMappingURL=DateTime.d.ts.map
@@ -5,8 +5,8 @@ import { ExtractPropTypes } from 'vue';
5
5
  * @example
6
6
  * ```vue
7
7
  * <NumberFormat :value="1234.56" />
8
- * <NumberFormat :value="0.75" style="percent" />
9
- * <NumberFormat :value="99.99" style="currency" tag="strong" />
8
+ * <NumberFormat :value="0.75" format="percent" />
9
+ * <NumberFormat :value="99.99" format="currency" tag="strong" />
10
10
  * ```
11
11
  */
12
12
  declare const numberFormatProps: {
@@ -14,7 +14,7 @@ declare const numberFormatProps: {
14
14
  readonly type: NumberConstructor;
15
15
  readonly required: true;
16
16
  };
17
- readonly style: {
17
+ readonly format: {
18
18
  readonly type: StringConstructor;
19
19
  readonly default: undefined;
20
20
  };
@@ -29,7 +29,7 @@ export declare const NumberFormat: import('vue').DefineComponent<ExtractPropType
29
29
  readonly type: NumberConstructor;
30
30
  readonly required: true;
31
31
  };
32
- readonly style: {
32
+ readonly format: {
33
33
  readonly type: StringConstructor;
34
34
  readonly default: undefined;
35
35
  };
@@ -44,7 +44,7 @@ export declare const NumberFormat: import('vue').DefineComponent<ExtractPropType
44
44
  readonly type: NumberConstructor;
45
45
  readonly required: true;
46
46
  };
47
- readonly style: {
47
+ readonly format: {
48
48
  readonly type: StringConstructor;
49
49
  readonly default: undefined;
50
50
  };
@@ -53,8 +53,8 @@ export declare const NumberFormat: import('vue').DefineComponent<ExtractPropType
53
53
  readonly default: "span";
54
54
  };
55
55
  }>> & Readonly<{}>, {
56
- readonly style: string;
57
56
  readonly tag: string;
57
+ readonly format: string;
58
58
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
59
59
  export {};
60
60
  //# sourceMappingURL=NumberFormat.d.ts.map
@@ -23,6 +23,17 @@ import { ExtractPropTypes } from 'vue';
23
23
  * ```vue
24
24
  * <Plural :value="count" zero="No items" one="# item" other="# items" />
25
25
  * ```
26
+ *
27
+ * @example
28
+ * ```vue
29
+ * <template>
30
+ * <!-- Preferred: v-t.plural (compile-time) -->
31
+ * <p v-t.plural="count">one item | {count} items</p>
32
+ *
33
+ * <!-- Alternative: Plural component (runtime) -->
34
+ * <Plural :value="count" one="# item in cart" other="# items in cart" />
35
+ * </template>
36
+ * ```
26
37
  */
27
38
  declare const pluralProps: {
28
39
  /** The numeric value to pluralise on */
@@ -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;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"}
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"}
@@ -0,0 +1,2 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./use-i18n-CQQp9bxG.cjs`);let t=require(`vue`),n=require(`@fluenti/core/internal`);function r(e){let i=[],a=``;function o(e){if(e==null||typeof e==`boolean`)return;if(Array.isArray(e)){for(let t of e)o(t);return}if(typeof e==`string`||typeof e==`number`){a+=String(e);return}if(!(0,t.isVNode)(e)||e.type===t.Comment)return;if(e.type===t.Text){a+=typeof e.children==`string`?e.children:``;return}let s=i.length,c=r(e.children);i.push(e),i.push(...c.components),a+=`<${s}>${(0,n.offsetIndices)(c.message,s+1)}</${s}>`}return o(e),{message:a,components:i}}function i(e,n){let r=/<(\d+)>([\s\S]*?)<\/\1>/g,a=[],o=0,s;for(r.lastIndex=0,s=r.exec(e);s!==null;){s.index>o&&a.push(e.slice(o,s.index));let c=n[Number(s[1])],l=i(s[2],n);c?a.push((0,t.h)(c.type,c.props??{},Array.isArray(l)?l:[l])):a.push(s[2]),o=r.lastIndex,s=r.exec(e)}return o<e.length&&a.push(e.slice(o)),a.length<=1?a[0]??``:a}function a(e,t){let i={},a=[];for(let o of e){let e=t[o];if(e===void 0)continue;let s=r(e);i[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=r(s);i[o]=(0,n.offsetIndices)(t.message,a.length),a.push(...t.components)}return{messages:i,components:a}}var o={id:String,context:String,comment:String,tag:{type:String,default:void 0}},s=(0,t.defineComponent)({name:`Trans`,props:o,setup(n,{slots:a}){let{t:o}=e.t();return()=>{let e=a.default?.();if(!e)return null;let{message:s,components:c}=r(e),l=o({...n.id===void 0?{}:{id:n.id},message:s,...n.context===void 0?{}:{context:n.context},...n.comment===void 0?{}:{comment:n.comment}}),u=c.length>0?i(l,c):l;return Array.isArray(u)?u.length===1?u[0]:n.tag?(0,t.h)(n.tag,null,u):u:u}}}),c={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}},l=(0,t.defineComponent)({name:`Plural`,props:c,setup(r,{slots:o}){let{t:s}=e.t();return()=>{let e={zero:r.zero,one:r.one,two:r.two,few:r.few,many:r.many,other:r.other};for(let t of n.PLURAL_CATEGORIES){let n=o[t];n&&(e[t]=n({count:`#`}))}let{messages:c,components:l}=a(n.PLURAL_CATEGORIES,e),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??``},r.offset),d=s({id:r.id??(r.context===void 0?u:(0,n.hashMessage)(u,r.context)),message:u,...r.context===void 0?{}:{context:r.context},...r.comment===void 0?{}:{comment:r.comment}},{count:r.value}),f=l.length>0?i(d,l):d;return r.tag?(0,t.h)(r.tag,void 0,f??void 0):f??null}}}),u={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}},d=(0,t.defineComponent)({name:`Select`,inheritAttrs:!1,props:u,setup(r,{attrs:o,slots:s}){let{t:c}=e.t();return()=>{let e={};if(r.options!==void 0){for(let[t,n]of Object.entries(r.options))e[t]=n;e.other=r.other}else{for(let[t,n]of Object.entries(o))typeof n==`string`&&(e[t]=n);e.other=r.other}for(let[t,n]of Object.entries(s))t===`default`||!n||(e[t]=n({value:`{value}`}));let l=[...Object.keys(e).filter(e=>e!==`other`),`other`],{messages:u,components:d}=a(l,e),f=(0,n.normalizeSelectForms)(Object.fromEntries([...l].map(e=>[e,u[e]??``]))),p=(0,n.buildICUSelectMessage)(f.forms),m=c({id:r.id??(r.context===void 0?p:(0,n.hashMessage)(p,r.context)),message:p,...r.context===void 0?{}:{context:r.context},...r.comment===void 0?{}:{comment:r.comment}},{value:f.valueMap[r.value]??`other`}),h=d.length>0?i(m,d):m;return r.tag?(0,t.h)(r.tag,void 0,h??void 0):h??null}}}),f={value:{type:[Date,Number],required:!0},format:{type:String,default:void 0},tag:{type:String,default:`span`}},p=(0,t.defineComponent)({name:`DateTime`,props:f,setup(n){let{d:r}=e.t();return()=>(0,t.h)(n.tag,r(n.value,n.format))}}),m={value:{type:Number,required:!0},format:{type:String,default:void 0},tag:{type:String,default:`span`}},h=(0,t.defineComponent)({name:`NumberFormat`,props:m,setup(n){let{n:r}=e.t();return()=>(0,t.h)(n.tag,r(n.value,n.format))}});exports.DateTime=p,exports.NumberFormat=h,exports.Plural=l,exports.Select=d,exports.Trans=s,Object.defineProperty(exports,`interpolate`,{enumerable:!0,get:function(){return n.interpolate}});
2
+ //# sourceMappingURL=components-entry.cjs.map
@@ -0,0 +1 @@
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,IAAM,KAAS,EAAM,EAAM,EAAM,CACtC,OAEF,GAAI,OAAO,GAAS,UAAY,OAAO,GAAS,SAAU,CACxD,GAAW,OAAO,EAAK,CACvB,OAEF,GAAI,EAAA,EAAA,EAAA,SAAS,EAAK,EAAI,EAAK,OAAS,EAAA,QAAS,OAC7C,GAAI,EAAK,OAAS,EAAA,KAAM,CACtB,GAAW,OAAO,EAAK,UAAa,SAAW,EAAK,SAAW,GAC/D,OAGF,IAAM,EAAM,EAAW,OACjB,EAAQ,EAAe,EAAK,SAAkD,CACpF,EAAW,KAAK,EAAK,CACrB,EAAW,KAAK,GAAG,EAAM,WAAW,CACpC,GAAW,IAAI,EAAI,IAAA,EAAA,EAAA,eAAiB,EAAM,QAAS,EAAM,EAAE,CAAC,IAAI,EAAI,GAItE,OADA,EAAM,EAAS,CACR,CAAE,UAAS,aAAY,CAGhC,SAAgB,EACd,EACA,EACY,CACZ,IAAM,EAAQ,2BACR,EAAuB,EAAE,CAC3B,EAAY,EACZ,EAIJ,IAFA,EAAM,UAAY,EAClB,EAAQ,EAAM,KAAK,EAAW,CACvB,IAAU,MAAM,CACjB,EAAM,MAAQ,GAChB,EAAO,KAAK,EAAW,MAAM,EAAW,EAAM,MAAM,CAAC,CAIvD,IAAM,EAAY,EADN,OAAO,EAAM,GAAG,EAEtB,EAAe,EAAY,EAAM,GAAK,EAAW,CACnD,EACF,EAAO,MAAA,EAAA,EAAA,GAAO,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AAE,KAAM,OAAQ,QAAS,IAAA,GAAW,CAC5C,IAAK,CAAE,KAAM,OAAQ,QAAS,OAAQ,CACvC,CAIY,GAAA,EAAA,EAAA,iBAA2B,CACtC,KAAM,WACN,MAAO,EACP,MAAM,EAAO,CACX,GAAM,CAAE,KAAM,EAAA,GAAS,CACvB,WAAA,EAAA,EAAA,GAAe,EAAM,IAAK,EAAE,EAAM,MAAwB,EAAM,OAAO,CAAC,EAE3E,CAAC,CCfI,EAAoB,CACxB,MAAO,CAAE,KAAM,OAAQ,SAAU,GAAM,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"}
@@ -0,0 +1,12 @@
1
+ export { Trans } from './components/Trans';
2
+ export type { FluentiTransProps } from './components/Trans';
3
+ export { Plural } from './components/Plural';
4
+ export type { FluentiPluralProps } from './components/Plural';
5
+ export { Select } from './components/Select';
6
+ export type { FluentiSelectProps } from './components/Select';
7
+ export { DateTime } from './components/DateTime';
8
+ export type { FluentiDateTimeProps } from './components/DateTime';
9
+ export { NumberFormat } from './components/NumberFormat';
10
+ export type { FluentiNumberFormatProps } from './components/NumberFormat';
11
+ export { interpolate } from '@fluenti/core/internal';
12
+ //# sourceMappingURL=components-entry.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,227 @@
1
+ import { t as e } from "./use-i18n-DrhdlExQ.js";
2
+ import { Comment as t, Text as n, defineComponent as r, h as i, isVNode as a } from "vue";
3
+ import { PLURAL_CATEGORIES as o, buildICUPluralMessage as s, buildICUSelectMessage as c, hashMessage as l, interpolate as u, normalizeSelectForms as d, offsetIndices as f } from "@fluenti/core/internal";
4
+ //#region src/components/rich-text.ts
5
+ function p(e) {
6
+ let r = [], i = "";
7
+ function o(e) {
8
+ if (e == null || typeof e == "boolean") return;
9
+ if (Array.isArray(e)) {
10
+ for (let t of e) o(t);
11
+ return;
12
+ }
13
+ if (typeof e == "string" || typeof e == "number") {
14
+ i += String(e);
15
+ return;
16
+ }
17
+ if (!a(e) || e.type === t) return;
18
+ if (e.type === n) {
19
+ i += typeof e.children == "string" ? e.children : "";
20
+ return;
21
+ }
22
+ let s = r.length, c = p(e.children);
23
+ r.push(e), r.push(...c.components), i += `<${s}>${f(c.message, s + 1)}</${s}>`;
24
+ }
25
+ return o(e), {
26
+ message: i,
27
+ components: r
28
+ };
29
+ }
30
+ function m(e, t) {
31
+ let n = /<(\d+)>([\s\S]*?)<\/\1>/g, r = [], a = 0, o;
32
+ for (n.lastIndex = 0, o = n.exec(e); o !== null;) {
33
+ o.index > a && r.push(e.slice(a, o.index));
34
+ let s = t[Number(o[1])], c = m(o[2], t);
35
+ s ? r.push(i(s.type, s.props ?? {}, Array.isArray(c) ? c : [c])) : r.push(o[2]), a = n.lastIndex, o = n.exec(e);
36
+ }
37
+ return a < e.length && r.push(e.slice(a)), r.length <= 1 ? r[0] ?? "" : r;
38
+ }
39
+ function h(e, t) {
40
+ let n = {}, r = [];
41
+ for (let i of e) {
42
+ let e = t[i];
43
+ if (e === void 0) continue;
44
+ let a = p(e);
45
+ n[i] = f(a.message, r.length), r.push(...a.components);
46
+ }
47
+ for (let [i, a] of Object.entries(t)) {
48
+ if (e.includes(i) || a === void 0) continue;
49
+ let t = p(a);
50
+ n[i] = f(t.message, r.length), r.push(...t.components);
51
+ }
52
+ return {
53
+ messages: n,
54
+ components: r
55
+ };
56
+ }
57
+ var g = r({
58
+ name: "Trans",
59
+ props: {
60
+ id: String,
61
+ context: String,
62
+ comment: String,
63
+ tag: {
64
+ type: String,
65
+ default: void 0
66
+ }
67
+ },
68
+ setup(t, { slots: n }) {
69
+ let { t: r } = e();
70
+ return () => {
71
+ let e = n.default?.();
72
+ if (!e) return null;
73
+ let { message: a, components: o } = p(e), s = r({
74
+ ...t.id === void 0 ? {} : { id: t.id },
75
+ message: a,
76
+ ...t.context === void 0 ? {} : { context: t.context },
77
+ ...t.comment === void 0 ? {} : { comment: t.comment }
78
+ }), c = o.length > 0 ? m(s, o) : s;
79
+ return Array.isArray(c) ? c.length === 1 ? c[0] : t.tag ? i(t.tag, null, c) : c : c;
80
+ };
81
+ }
82
+ }), _ = r({
83
+ name: "Plural",
84
+ props: {
85
+ value: {
86
+ type: Number,
87
+ required: !0
88
+ },
89
+ id: String,
90
+ context: String,
91
+ comment: String,
92
+ zero: String,
93
+ one: String,
94
+ two: String,
95
+ few: String,
96
+ many: String,
97
+ other: {
98
+ type: String,
99
+ required: !0
100
+ },
101
+ offset: Number,
102
+ tag: {
103
+ type: String,
104
+ default: void 0
105
+ }
106
+ },
107
+ setup(t, { slots: n }) {
108
+ let { t: r } = e();
109
+ return () => {
110
+ let e = {
111
+ zero: t.zero,
112
+ one: t.one,
113
+ two: t.two,
114
+ few: t.few,
115
+ many: t.many,
116
+ other: t.other
117
+ };
118
+ for (let t of o) {
119
+ let r = n[t];
120
+ r && (e[t] = r({ count: "#" }));
121
+ }
122
+ let { messages: a, components: c } = h(o, e), u = s({
123
+ ...a.zero !== void 0 && { zero: a.zero },
124
+ ...a.one !== void 0 && { one: a.one },
125
+ ...a.two !== void 0 && { two: a.two },
126
+ ...a.few !== void 0 && { few: a.few },
127
+ ...a.many !== void 0 && { many: a.many },
128
+ other: a.other ?? ""
129
+ }, t.offset), d = r({
130
+ id: t.id ?? (t.context === void 0 ? u : l(u, t.context)),
131
+ message: u,
132
+ ...t.context === void 0 ? {} : { context: t.context },
133
+ ...t.comment === void 0 ? {} : { comment: t.comment }
134
+ }, { count: t.value }), f = c.length > 0 ? m(d, c) : d;
135
+ return t.tag ? i(t.tag, void 0, f ?? void 0) : f ?? null;
136
+ };
137
+ }
138
+ }), v = r({
139
+ name: "Select",
140
+ inheritAttrs: !1,
141
+ props: {
142
+ value: {
143
+ type: String,
144
+ required: !0
145
+ },
146
+ id: String,
147
+ context: String,
148
+ comment: String,
149
+ other: {
150
+ type: String,
151
+ required: !0
152
+ },
153
+ options: {
154
+ type: Object,
155
+ default: void 0
156
+ },
157
+ tag: {
158
+ type: String,
159
+ default: void 0
160
+ }
161
+ },
162
+ setup(t, { attrs: n, slots: r }) {
163
+ let { t: a } = e();
164
+ return () => {
165
+ let e = {};
166
+ if (t.options !== void 0) {
167
+ for (let [n, r] of Object.entries(t.options)) e[n] = r;
168
+ e.other = t.other;
169
+ } else {
170
+ for (let [t, r] of Object.entries(n)) typeof r == "string" && (e[t] = r);
171
+ e.other = t.other;
172
+ }
173
+ for (let [t, n] of Object.entries(r)) t === "default" || !n || (e[t] = n({ value: "{value}" }));
174
+ let o = [...Object.keys(e).filter((e) => e !== "other"), "other"], { messages: s, components: u } = h(o, e), f = d(Object.fromEntries([...o].map((e) => [e, s[e] ?? ""]))), p = c(f.forms), g = a({
175
+ id: t.id ?? (t.context === void 0 ? p : l(p, t.context)),
176
+ message: p,
177
+ ...t.context === void 0 ? {} : { context: t.context },
178
+ ...t.comment === void 0 ? {} : { comment: t.comment }
179
+ }, { value: f.valueMap[t.value] ?? "other" }), _ = u.length > 0 ? m(g, u) : g;
180
+ return t.tag ? i(t.tag, void 0, _ ?? void 0) : _ ?? null;
181
+ };
182
+ }
183
+ }), y = r({
184
+ name: "DateTime",
185
+ props: {
186
+ value: {
187
+ type: [Date, Number],
188
+ required: !0
189
+ },
190
+ format: {
191
+ type: String,
192
+ default: void 0
193
+ },
194
+ tag: {
195
+ type: String,
196
+ default: "span"
197
+ }
198
+ },
199
+ setup(t) {
200
+ let { d: n } = e();
201
+ return () => i(t.tag, n(t.value, t.format));
202
+ }
203
+ }), b = r({
204
+ name: "NumberFormat",
205
+ props: {
206
+ value: {
207
+ type: Number,
208
+ required: !0
209
+ },
210
+ format: {
211
+ type: String,
212
+ default: void 0
213
+ },
214
+ tag: {
215
+ type: String,
216
+ default: "span"
217
+ }
218
+ },
219
+ setup(t) {
220
+ let { n } = e();
221
+ return () => i(t.tag, n(t.value, t.format));
222
+ }
223
+ });
224
+ //#endregion
225
+ export { y as DateTime, b as NumberFormat, _ as Plural, v as Select, g as Trans, u as interpolate };
226
+
227
+ //# sourceMappingURL=components-entry.js.map
@@ -0,0 +1 @@
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,QAA8B,OAAO,KAAS,UAAW;AACtE,MAAI,MAAM,QAAQ,EAAK,EAAE;AACvB,QAAK,IAAM,KAAS,EAAM,GAAM,E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cjs CHANGED
@@ -1,2 +1,2 @@
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;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./use-i18n-CQQp9bxG.cjs`);let t=require(`vue`),n=require(`@fluenti/core`);function r(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}var i=Symbol.for(`fluenti.runtime.vue.v1`);function a(){let e=globalThis[i];return typeof e==`object`&&e?e:null}function o(e){return typeof e==`object`&&e&&`default`in e?e.default:e}function s(e){let t=Object.keys(e).filter(e=>e!==`plural`);return t.length>0?t[0]:void 0}function c(i){let c=i.lazyLocaleLoading??i.splitting??!1,l={locale:i.locale,messages:i.messages??{}};i.fallbackLocale!==void 0&&(l.fallbackLocale=i.fallbackLocale),i.fallbackChain!==void 0&&(l.fallbackChain=i.fallbackChain),i.dateFormats!==void 0&&(l.dateFormats=i.dateFormats),i.numberFormats!==void 0&&(l.numberFormats=i.numberFormats),i.missing!==void 0&&(l.missing=i.missing),i.diagnostics!==void 0&&(l.diagnostics=i.diagnostics),i.interpolate!==void 0&&(l.interpolate=i.interpolate);let u=(0,n.createFluentiCore)(l),d=(0,t.ref)(i.locale),f=(0,t.shallowReactive)({...i.messages}),p=(0,t.ref)(!1),m=new Set([i.locale]),h=(0,t.ref)(new Set(m));function g(e,t){let n=f[e];if(n)return n[t]}function _(){u.locale!==d.value&&(u.locale=d.value)}function v(e,...t){return f[d.value],_(),Array.isArray(e)&&`raw`in e?u.t(e,...t):u.t(e,t[0])}let y=0;async function b(e){if(!c||!i.chunkLoader){u.locale=e,d.value=e;return}let t=a();if(m.has(e)){t?.__switchLocale&&await t.__switchLocale(e),u.locale=e,d.value=e;return}let n=++y;p.value=!0;try{let r=o(await i.chunkLoader(e));if(n!==y||(f[e]={...f[e],...r},u.loadMessages(e,r),m.add(e),h.value=new Set(m),t?.__switchLocale&&await t.__switchLocale(e),n!==y))return;u.locale=e,d.value=e}finally{n===y&&(p.value=!1)}}function x(e,t){f[e]={...f[e],...t},u.loadMessages(e,t),m.add(e),h.value=new Set(m)}let S=new Set;function C(e){if(!c||m.has(e)||!i.chunkLoader||S.has(e))return;S.add(e);let t=a();i.chunkLoader(e).then(async n=>{let r=o(n);f[e]={...f[e],...r},u.loadMessages(e,r),m.add(e),h.value=new Set(m),t?.__preloadLocale&&await t.__preloadLocale(e)}).catch(t=>{console.warn(`[fluenti] preload failed:`,e,t)}).finally(()=>{S.delete(e)})}function w(){return _(),u.getLocales()}function T(e,t){return d.value,_(),u.d(e,t)}function E(e,t){return d.value,_(),u.n(e,t)}function D(e,t){return d.value,_(),u.format(e,t)}function O(e,t,n){let i=r(n?v(e,n):v(e));function a(e){if(e.rawAttrs!=null&&e.rawAttrs!==``){let t=[],n=/([\w:@.!-]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'))?/g,i;for(;(i=n.exec(e.rawAttrs))!==null;){let e=r(i[1]),n=i[2]??i[3];t.push(n===void 0?e:`${e}="${r(n)}"`)}return t.join(` `)}return e.attrs?Object.entries(e.attrs).map(([e,t])=>t?`${r(e)}="${r(t)}"`:r(e)).join(` `):``}let o=i.replace(/&lt;(\d+)\/&gt;/g,(e,n)=>{let i=t[Number(n)];if(!i)return``;let o=r(i.tag),s=a(i);return`<${o}${s?` `+s:``} />`});return o=o.replace(/&lt;(\d+)&gt;([\s\S]*?)&lt;\/\1&gt;/g,(e,n,i)=>{let o=t[Number(n)];if(!o)return i;let s=r(o.tag),c=a(o);return`<${s}${c?` `+c:``}>${i}</${s}>`}),o}function k(e,t){return g(t??d.value,e)!==void 0}function A(e,t){return g(t??d.value,e)}let j={t:v,locale:d,setLocale:b,loadMessages:x,getLocales:w,d:T,n:E,format:D,isLoading:p,loadedLocales:h,preloadLocale:C,te:k,tm:A};return{install(t){if(t.provide(e.n,j),i.components){let e=i.componentPrefix??``,n=i.components;n.Trans&&t.component(`${e}Trans`,n.Trans),n.Plural&&t.component(`${e}Plural`,n.Plural),n.Select&&t.component(`${e}Select`,n.Select),n.DateTime&&t.component(`${e}DateTime`,n.DateTime),n.NumberFormat&&t.component(`${e}NumberFormat`,n.NumberFormat)}i.injectGlobalProperties!==!1&&(t.config.globalProperties.$t=v,t.config.globalProperties.$d=T,t.config.globalProperties.$n=E,t.config.globalProperties.$vtRich=O);let n=new WeakMap;t.directive(`t`,{mounted(e,t){let r=s(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=s(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:j}}var l=((...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.FLUENTI_KEY=e.n,exports.createFluenti=c,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return n.msg}}),exports.t=l,exports.useI18n=e.t;
2
2
  //# sourceMappingURL=index.cjs.map