@fluenti/vue 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/NumberFormat-Bxim144o.js +0 -2
  2. package/dist/NumberFormat-CgU3BNm8.cjs +1 -2
  3. package/dist/index.cjs +1 -2
  4. package/dist/index.js +0 -2
  5. package/dist/server.cjs +1 -2
  6. package/dist/server.js +0 -2
  7. package/dist/vite-plugin.cjs +1 -2
  8. package/dist/vite-plugin.js +0 -2
  9. package/dist/vue/src/compile-time-t.d.ts +0 -1
  10. package/dist/vue/src/components/DateTime.d.ts +0 -1
  11. package/dist/vue/src/components/NumberFormat.d.ts +0 -1
  12. package/dist/vue/src/components/Plural.d.ts +0 -1
  13. package/dist/vue/src/components/Select.d.ts +0 -1
  14. package/dist/vue/src/components/Trans.d.ts +0 -1
  15. package/dist/vue/src/components/rich-text.d.ts +0 -1
  16. package/dist/vue/src/components-entry.d.ts +0 -1
  17. package/dist/vue/src/hooks/__useI18n.d.ts +0 -1
  18. package/dist/vue/src/index.d.ts +0 -1
  19. package/dist/vue/src/injection-key.d.ts +0 -1
  20. package/dist/vue/src/msg.d.ts +0 -1
  21. package/dist/vue/src/plugin.d.ts +0 -1
  22. package/dist/vue/src/server.d.ts +0 -1
  23. package/dist/vue/src/use-i18n.d.ts +0 -1
  24. package/dist/vue/src/vite-plugin.d.ts +0 -1
  25. package/dist/vue/src/vue-runtime.d.ts +0 -1
  26. package/package.json +3 -3
  27. package/dist/NumberFormat-Bxim144o.js.map +0 -1
  28. package/dist/NumberFormat-CgU3BNm8.cjs.map +0 -1
  29. package/dist/index.cjs.map +0 -1
  30. package/dist/index.js.map +0 -1
  31. package/dist/server.cjs.map +0 -1
  32. package/dist/server.js.map +0 -1
  33. package/dist/vite-plugin.cjs.map +0 -1
  34. package/dist/vite-plugin.js.map +0 -1
  35. package/dist/vue/src/compile-time-t.d.ts.map +0 -1
  36. package/dist/vue/src/components/DateTime.d.ts.map +0 -1
  37. package/dist/vue/src/components/NumberFormat.d.ts.map +0 -1
  38. package/dist/vue/src/components/Plural.d.ts.map +0 -1
  39. package/dist/vue/src/components/Select.d.ts.map +0 -1
  40. package/dist/vue/src/components/Trans.d.ts.map +0 -1
  41. package/dist/vue/src/components/rich-text.d.ts.map +0 -1
  42. package/dist/vue/src/components-entry.d.ts.map +0 -1
  43. package/dist/vue/src/hooks/__useI18n.d.ts.map +0 -1
  44. package/dist/vue/src/index.d.ts.map +0 -1
  45. package/dist/vue/src/injection-key.d.ts.map +0 -1
  46. package/dist/vue/src/msg.d.ts.map +0 -1
  47. package/dist/vue/src/plugin.d.ts.map +0 -1
  48. package/dist/vue/src/server.d.ts.map +0 -1
  49. package/dist/vue/src/use-i18n.d.ts.map +0 -1
  50. package/dist/vue/src/vite-plugin.d.ts.map +0 -1
  51. package/dist/vue/src/vue-runtime.d.ts.map +0 -1
@@ -235,5 +235,3 @@ var v = /* @__PURE__ */ n({
235
235
  });
236
236
  //#endregion
237
237
  export { v as a, f as c, y as i, x as n, p as o, b as r, m as s, S as t };
238
-
239
- //# sourceMappingURL=NumberFormat-Bxim144o.js.map
@@ -1,2 +1 @@
1
- let e=require(`vue`),t=require(`@fluenti/core/runtime`);var n=Symbol(`fluenti`);function r(){let t=(0,e.inject)(n);if(!t)throw Error(`[fluenti] useI18n() requires createFluenti plugin`);return t}function i(){return r().locale}function a(n){let r=[],i=``;function o(n){if(n==null||typeof n==`boolean`)return;if(Array.isArray(n)){for(let e of n)o(e);return}if(typeof n==`string`||typeof n==`number`){i+=String(n);return}if(!(0,e.isVNode)(n)||n.type===e.Comment)return;if(n.type===e.Text){i+=typeof n.children==`string`?n.children:``;return}let s=r.length,c=a(n.children);r.push(n),r.push(...c.components),i+=`<${s}>${(0,t.offsetIndices)(c.message,s+1)}</${s}>`}return o(n),{message:i,components:r}}function o(t,n){let r=/<(\d+)>([\s\S]*?)<\/\1>/g,i=[],a=0,s;for(r.lastIndex=0,s=r.exec(t);s!==null;){s.index>a&&i.push(t.slice(a,s.index));let c=n[Number(s[1])],l=o(s[2],n);c?i.push((0,e.h)(c.type,c.props??{},Array.isArray(l)?l:[l])):i.push(s[2]),a=r.lastIndex,s=r.exec(t)}return a<t.length&&i.push(t.slice(a)),i.length<=1?i[0]??``:i}function s(e,n){let r={},i=[];for(let o of e){let e=n[o];if(e===void 0)continue;let s=a(e);r[o]=(0,t.offsetIndices)(s.message,i.length),i.push(...s.components)}for(let[o,s]of Object.entries(n)){if(e.includes(o)||s===void 0)continue;let n=a(s);r[o]=(0,t.offsetIndices)(n.message,i.length),i.push(...n.components)}return{messages:r,components:i}}var c={id:String,context:String,comment:String,tag:{type:String,default:void 0}},l=(0,e.defineComponent)({name:`Trans`,props:c,setup(t,{slots:n}){let{t:i}=r();return()=>{let r=n.default?.();if(!r)return null;let{message:s,components:c}=a(r),l=i({...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?o(l,c):l;return Array.isArray(u)?u.length===1?u[0]:t.tag?(0,e.h)(t.tag,null,u):u:u}}}),u={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}},d=(0,e.defineComponent)({name:`Plural`,props:u,setup(n,{slots:i}){let{t:a}=r();return()=>{let r={zero:n.zero,one:n.one,two:n.two,few:n.few,many:n.many,other:n.other};for(let e of t.PLURAL_CATEGORIES){let t=i[e];t&&(r[e]=t({count:`#`}))}let{messages:c,components:l}=s(t.PLURAL_CATEGORIES,r),u=(0,t.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??``},n.offset),d=a({id:n.id??(n.context===void 0?u:(0,t.hashMessage)(u,n.context)),message:u,...n.context===void 0?{}:{context:n.context},...n.comment===void 0?{}:{comment:n.comment}},{count:n.value}),f=l.length>0?o(d,l):d;return n.tag?(0,e.h)(n.tag,void 0,f??void 0):f??null}}}),f={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}},p=(0,e.defineComponent)({name:`Select`,inheritAttrs:!1,props:f,setup(n,{attrs:i,slots:a}){let{t:c}=r();return()=>{let r={};if(n.options!==void 0){for(let[e,t]of Object.entries(n.options))r[e]=t;r.other=n.other}else{for(let[e,t]of Object.entries(i))typeof t==`string`&&(r[e]=t);r.other=n.other}for(let[e,t]of Object.entries(a))e===`default`||!t||(r[e]=t({value:`{value}`}));let l=[...Object.keys(r).filter(e=>e!==`other`),`other`],{messages:u,components:d}=s(l,r),f=(0,t.normalizeSelectForms)(Object.fromEntries([...l].map(e=>[e,u[e]??``]))),p=(0,t.buildICUSelectMessage)(f.forms),m=c({id:n.id??(n.context===void 0?p:(0,t.hashMessage)(p,n.context)),message:p,...n.context===void 0?{}:{context:n.context},...n.comment===void 0?{}:{comment:n.comment}},{value:f.valueMap[n.value]??`other`}),h=d.length>0?o(m,d):m;return n.tag?(0,e.h)(n.tag,void 0,h??void 0):h??null}}}),m={value:{type:[Date,Number],required:!0},format:{type:String,default:void 0},tag:{type:String,default:`span`}},h=(0,e.defineComponent)({name:`DateTime`,props:m,setup(t){let{d:n}=r();return()=>(0,e.h)(t.tag,n(t.value,t.format))}}),g={value:{type:Number,required:!0},format:{type:String,default:void 0},tag:{type:String,default:`span`}},_=(0,e.defineComponent)({name:`NumberFormat`,props:g,setup(t){let{n}=r();return()=>(0,e.h)(t.tag,n(t.value,t.format))}});Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
2
- //# sourceMappingURL=NumberFormat-CgU3BNm8.cjs.map
1
+ let e=require(`vue`),t=require(`@fluenti/core/runtime`);var n=Symbol(`fluenti`);function r(){let t=(0,e.inject)(n);if(!t)throw Error(`[fluenti] useI18n() requires createFluenti plugin`);return t}function i(){return r().locale}function a(n){let r=[],i=``;function o(n){if(n==null||typeof n==`boolean`)return;if(Array.isArray(n)){for(let e of n)o(e);return}if(typeof n==`string`||typeof n==`number`){i+=String(n);return}if(!(0,e.isVNode)(n)||n.type===e.Comment)return;if(n.type===e.Text){i+=typeof n.children==`string`?n.children:``;return}let s=r.length,c=a(n.children);r.push(n),r.push(...c.components),i+=`<${s}>${(0,t.offsetIndices)(c.message,s+1)}</${s}>`}return o(n),{message:i,components:r}}function o(t,n){let r=/<(\d+)>([\s\S]*?)<\/\1>/g,i=[],a=0,s;for(r.lastIndex=0,s=r.exec(t);s!==null;){s.index>a&&i.push(t.slice(a,s.index));let c=n[Number(s[1])],l=o(s[2],n);c?i.push((0,e.h)(c.type,c.props??{},Array.isArray(l)?l:[l])):i.push(s[2]),a=r.lastIndex,s=r.exec(t)}return a<t.length&&i.push(t.slice(a)),i.length<=1?i[0]??``:i}function s(e,n){let r={},i=[];for(let o of e){let e=n[o];if(e===void 0)continue;let s=a(e);r[o]=(0,t.offsetIndices)(s.message,i.length),i.push(...s.components)}for(let[o,s]of Object.entries(n)){if(e.includes(o)||s===void 0)continue;let n=a(s);r[o]=(0,t.offsetIndices)(n.message,i.length),i.push(...n.components)}return{messages:r,components:i}}var c={id:String,context:String,comment:String,tag:{type:String,default:void 0}},l=(0,e.defineComponent)({name:`Trans`,props:c,setup(t,{slots:n}){let{t:i}=r();return()=>{let r=n.default?.();if(!r)return null;let{message:s,components:c}=a(r),l=i({...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?o(l,c):l;return Array.isArray(u)?u.length===1?u[0]:t.tag?(0,e.h)(t.tag,null,u):u:u}}}),u={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}},d=(0,e.defineComponent)({name:`Plural`,props:u,setup(n,{slots:i}){let{t:a}=r();return()=>{let r={zero:n.zero,one:n.one,two:n.two,few:n.few,many:n.many,other:n.other};for(let e of t.PLURAL_CATEGORIES){let t=i[e];t&&(r[e]=t({count:`#`}))}let{messages:c,components:l}=s(t.PLURAL_CATEGORIES,r),u=(0,t.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??``},n.offset),d=a({id:n.id??(n.context===void 0?u:(0,t.hashMessage)(u,n.context)),message:u,...n.context===void 0?{}:{context:n.context},...n.comment===void 0?{}:{comment:n.comment}},{count:n.value}),f=l.length>0?o(d,l):d;return n.tag?(0,e.h)(n.tag,void 0,f??void 0):f??null}}}),f={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}},p=(0,e.defineComponent)({name:`Select`,inheritAttrs:!1,props:f,setup(n,{attrs:i,slots:a}){let{t:c}=r();return()=>{let r={};if(n.options!==void 0){for(let[e,t]of Object.entries(n.options))r[e]=t;r.other=n.other}else{for(let[e,t]of Object.entries(i))typeof t==`string`&&(r[e]=t);r.other=n.other}for(let[e,t]of Object.entries(a))e===`default`||!t||(r[e]=t({value:`{value}`}));let l=[...Object.keys(r).filter(e=>e!==`other`),`other`],{messages:u,components:d}=s(l,r),f=(0,t.normalizeSelectForms)(Object.fromEntries([...l].map(e=>[e,u[e]??``]))),p=(0,t.buildICUSelectMessage)(f.forms),m=c({id:n.id??(n.context===void 0?p:(0,t.hashMessage)(p,n.context)),message:p,...n.context===void 0?{}:{context:n.context},...n.comment===void 0?{}:{comment:n.comment}},{value:f.valueMap[n.value]??`other`}),h=d.length>0?o(m,d):m;return n.tag?(0,e.h)(n.tag,void 0,h??void 0):h??null}}}),m={value:{type:[Date,Number],required:!0},format:{type:String,default:void 0},tag:{type:String,default:`span`}},h=(0,e.defineComponent)({name:`DateTime`,props:m,setup(t){let{d:n}=r();return()=>(0,e.h)(t.tag,n(t.value,t.format))}}),g={value:{type:Number,required:!0},format:{type:String,default:void 0},tag:{type:String,default:`span`}},_=(0,e.defineComponent)({name:`NumberFormat`,props:g,setup(t){let{n}=r();return()=>(0,e.h)(t.tag,n(t.value,t.format))}});Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return p}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return _}});
package/dist/index.cjs CHANGED
@@ -1,2 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./NumberFormat-CgU3BNm8.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),l.devWarnings=l.devWarnings??(typeof process<`u`&&process.env.NODE_ENV===`development`);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)){try{t?.__switchLocale&&await t.__switchLocale(e)}catch(t){console.warn(`[fluenti] split runtime switch failed for locale "${e}"`,t)}u.locale=e,d.value=e;return}let n=++y;p.value=!0;try{let r=o(await i.chunkLoader(e));if(n!==y)return;f[e]={...f[e],...r},u.loadMessages(e,r),m.add(e),h.value=new Set(m);try{t?.__switchLocale&&await t.__switchLocale(e)}catch(t){console.warn(`[fluenti] split runtime switch failed for locale "${e}"`,t)}if(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.c,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.DateTime=e.n,exports.FLUENTI_KEY=e.c,exports.NumberFormat=e.t,exports.Plural=e.i,exports.Select=e.r,exports.Trans=e.a,exports.createFluenti=c,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return n.msg}}),exports.t=l,exports.useI18n=e.o,exports.useLocale=e.s;
2
- //# sourceMappingURL=index.cjs.map
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./NumberFormat-CgU3BNm8.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),l.devWarnings=l.devWarnings??(typeof process<`u`&&process.env.NODE_ENV===`development`);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)){try{t?.__switchLocale&&await t.__switchLocale(e)}catch(t){console.warn(`[fluenti] split runtime switch failed for locale "${e}"`,t)}u.locale=e,d.value=e;return}let n=++y;p.value=!0;try{let r=o(await i.chunkLoader(e));if(n!==y)return;f[e]={...f[e],...r},u.loadMessages(e,r),m.add(e),h.value=new Set(m);try{t?.__switchLocale&&await t.__switchLocale(e)}catch(t){console.warn(`[fluenti] split runtime switch failed for locale "${e}"`,t)}if(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.c,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.DateTime=e.n,exports.FLUENTI_KEY=e.c,exports.NumberFormat=e.t,exports.Plural=e.i,exports.Select=e.r,exports.Trans=e.a,exports.createFluenti=c,Object.defineProperty(exports,`msg`,{enumerable:!0,get:function(){return n.msg}}),exports.t=l,exports.useI18n=e.o,exports.useLocale=e.s;
package/dist/index.js CHANGED
@@ -190,5 +190,3 @@ var v = ((...e) => {
190
190
  });
191
191
  //#endregion
192
192
  export { r as DateTime, t as FLUENTI_KEY, s as NumberFormat, n as Plural, a as Select, e as Trans, _ as createFluenti, d as msg, v as t, i as useI18n, o as useLocale };
193
-
194
- //# sourceMappingURL=index.js.map
package/dist/server.cjs CHANGED
@@ -1,2 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@fluenti/core`),t=require(`node:async_hooks`);function n(n){let r=new t.AsyncLocalStorage,i=new Map,a={locale:null,instance:null};function o(){return r.getStore()??a}function s(e){let t=o();t.locale=e,t.instance=null}async function c(e){let t=i.get(e);if(t)return t;let r=await n.loadMessages(e),a=typeof r==`object`&&r&&`default`in r?r.default:r;return i.set(e,a),a}async function l(t){let r={};r[t]=await c(t),n.fallbackLocale&&n.fallbackLocale!==t&&(r[n.fallbackLocale]=await c(n.fallbackLocale));let i={locale:t,messages:r};return n.fallbackLocale!==void 0&&(i.fallbackLocale=n.fallbackLocale),n.fallbackChain!==void 0&&(i.fallbackChain=n.fallbackChain),n.dateFormats!==void 0&&(i.dateFormats=n.dateFormats),n.numberFormats!==void 0&&(i.numberFormats=n.numberFormats),n.missing!==void 0&&(i.missing=n.missing),(0,e.createFluentiCore)(i)}async function u(){let e=o();!e.locale&&n.resolveLocale&&(e.locale=await n.resolveLocale());let t=e.locale;if(!t)throw Error(`[fluenti] No locale set. Call setLocale(locale) in your server plugin or middleware before using getI18n(), or provide a resolveLocale function in createServerI18n config to auto-detect locale in server functions and other contexts where the layout does not run.`);return e.instance&&e.instance.locale===t||(e.instance=await l(t)),e.instance}async function d(e,t){let n={locale:e,instance:null};return r.run(n,async()=>t())}return{setLocale:s,getI18n:u,withLocale:d}}exports.createServerI18n=n,Object.defineProperty(exports,`detectLocale`,{enumerable:!0,get:function(){return e.detectLocale}}),Object.defineProperty(exports,`getDirection`,{enumerable:!0,get:function(){return e.getDirection}}),Object.defineProperty(exports,`getHydratedLocale`,{enumerable:!0,get:function(){return e.getHydratedLocale}}),Object.defineProperty(exports,`getSSRLocaleScript`,{enumerable:!0,get:function(){return e.getSSRLocaleScript}}),Object.defineProperty(exports,`isRTL`,{enumerable:!0,get:function(){return e.isRTL}});
2
- //# sourceMappingURL=server.cjs.map
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require(`@fluenti/core`),t=require(`node:async_hooks`);function n(n){let r=new t.AsyncLocalStorage,i=new Map,a={locale:null,instance:null};function o(){return r.getStore()??a}function s(e){let t=o();t.locale=e,t.instance=null}async function c(e){let t=i.get(e);if(t)return t;let r=await n.loadMessages(e),a=typeof r==`object`&&r&&`default`in r?r.default:r;return i.set(e,a),a}async function l(t){let r={};r[t]=await c(t),n.fallbackLocale&&n.fallbackLocale!==t&&(r[n.fallbackLocale]=await c(n.fallbackLocale));let i={locale:t,messages:r};return n.fallbackLocale!==void 0&&(i.fallbackLocale=n.fallbackLocale),n.fallbackChain!==void 0&&(i.fallbackChain=n.fallbackChain),n.dateFormats!==void 0&&(i.dateFormats=n.dateFormats),n.numberFormats!==void 0&&(i.numberFormats=n.numberFormats),n.missing!==void 0&&(i.missing=n.missing),(0,e.createFluentiCore)(i)}async function u(){let e=o();!e.locale&&n.resolveLocale&&(e.locale=await n.resolveLocale());let t=e.locale;if(!t)throw Error(`[fluenti] No locale set. Call setLocale(locale) in your server plugin or middleware before using getI18n(), or provide a resolveLocale function in createServerI18n config to auto-detect locale in server functions and other contexts where the layout does not run.`);return e.instance&&e.instance.locale===t||(e.instance=await l(t)),e.instance}async function d(e,t){let n={locale:e,instance:null};return r.run(n,async()=>t())}return{setLocale:s,getI18n:u,withLocale:d}}exports.createServerI18n=n,Object.defineProperty(exports,`detectLocale`,{enumerable:!0,get:function(){return e.detectLocale}}),Object.defineProperty(exports,`getDirection`,{enumerable:!0,get:function(){return e.getDirection}}),Object.defineProperty(exports,`getHydratedLocale`,{enumerable:!0,get:function(){return e.getHydratedLocale}}),Object.defineProperty(exports,`getSSRLocaleScript`,{enumerable:!0,get:function(){return e.getSSRLocaleScript}}),Object.defineProperty(exports,`isRTL`,{enumerable:!0,get:function(){return e.isRTL}});
package/dist/server.js CHANGED
@@ -50,5 +50,3 @@ function s(t) {
50
50
  }
51
51
  //#endregion
52
52
  export { s as createServerI18n, t as detectLocale, n as getDirection, r as getHydratedLocale, i as getSSRLocaleScript, a as isRTL };
53
-
54
- //# sourceMappingURL=server.js.map
@@ -1,2 +1 @@
1
- let e=require(`@fluenti/vite-plugin`),t=require(`@fluenti/vite-plugin/sfc-transform`);var n=(0,e.createRuntimeGenerator)({imports:`import { shallowReactive, ref } from 'vue'`,catalogInit:`const __catalog = shallowReactive({ ...__defaultMsgs })`,localeInit:e=>`const __currentLocale = ref(${JSON.stringify(e)})`,loadingInit:`const __loading = ref(false)`,catalogUpdate:e=>`Object.assign(__catalog, ${e})`,localeUpdate:e=>`__currentLocale.value = ${e}`,loadingUpdate:e=>`__loading.value = ${e}`,localeRead:`__currentLocale.value`,runtimeKey:`fluenti.runtime.vue.v1`});function r(r){let i={name:`fluenti:vue-template`,enforce:`pre`,transform(e,n){if(!n.endsWith(`.vue`)||!/\bv-t\b/.test(e)&&!/<Trans[\s>]/.test(e)&&!/<Plural[\s/>]/.test(e))return;let r=(0,t.transformVtDirectives)(e);if(r!==e)return{code:r,map:null}}};return(0,e.createFluentiPlugins)({...r?.config===void 0?{}:{config:r.config},framework:`vue`},[i],n)}module.exports=r;
2
- //# sourceMappingURL=vite-plugin.cjs.map
1
+ let e=require(`@fluenti/vite-plugin`),t=require(`@fluenti/vite-plugin/sfc-transform`);var n=(0,e.createRuntimeGenerator)({imports:`import { shallowReactive, ref } from 'vue'`,catalogInit:`const __catalog = shallowReactive({ ...__defaultMsgs })`,localeInit:e=>`const __currentLocale = ref(${JSON.stringify(e)})`,loadingInit:`const __loading = ref(false)`,catalogUpdate:e=>`Object.assign(__catalog, ${e})`,localeUpdate:e=>`__currentLocale.value = ${e}`,loadingUpdate:e=>`__loading.value = ${e}`,localeRead:`__currentLocale.value`,runtimeKey:`fluenti.runtime.vue.v1`});function r(r){let i={name:`fluenti:vue-template`,enforce:`pre`,transform(e,n){if(!n.endsWith(`.vue`)||!/\bv-t\b/.test(e)&&!/<Trans[\s>]/.test(e)&&!/<Plural[\s/>]/.test(e))return;let r=(0,t.transformVtDirectives)(e);if(r!==e)return{code:r,map:null}}};return(0,e.createFluentiPlugins)({...r?.config===void 0?{}:{config:r.config},framework:`vue`},[i],n)}module.exports=r;
@@ -34,5 +34,3 @@ function i(t) {
34
34
  }
35
35
  //#endregion
36
36
  export { i as default };
37
-
38
- //# sourceMappingURL=vite-plugin.js.map
@@ -1,3 +1,2 @@
1
1
  import { CompileTimeT } from '@fluenti/core';
2
2
  export declare const t: CompileTimeT;
3
- //# sourceMappingURL=compile-time-t.d.ts.map
@@ -57,4 +57,3 @@ export declare const DateTime: import('vue').DefineComponent<ExtractPropTypes<{
57
57
  readonly format: string;
58
58
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
59
59
  export {};
60
- //# sourceMappingURL=DateTime.d.ts.map
@@ -57,4 +57,3 @@ export declare const NumberFormat: import('vue').DefineComponent<ExtractPropType
57
57
  readonly format: string;
58
58
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
59
59
  export {};
60
- //# sourceMappingURL=NumberFormat.d.ts.map
@@ -145,4 +145,3 @@ export declare const Plural: import('vue').DefineComponent<ExtractPropTypes<{
145
145
  readonly tag: string;
146
146
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
147
147
  export {};
148
- //# sourceMappingURL=Plural.d.ts.map
@@ -131,4 +131,3 @@ export declare const Select: import('vue').DefineComponent<ExtractPropTypes<{
131
131
  readonly options: Record<string, string>;
132
132
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
133
133
  export {};
134
- //# sourceMappingURL=Select.d.ts.map
@@ -60,4 +60,3 @@ export declare const Trans: import('vue').DefineComponent<ExtractPropTypes<{
60
60
  readonly tag: string;
61
61
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
62
62
  export {};
63
- //# sourceMappingURL=Trans.d.ts.map
@@ -8,4 +8,3 @@ export declare function serializeRichForms<T extends string>(keys: readonly T[],
8
8
  messages: Record<string, string>;
9
9
  components: VNode[];
10
10
  };
11
- //# sourceMappingURL=rich-text.d.ts.map
@@ -8,4 +8,3 @@ export { DateTime } from './components/DateTime';
8
8
  export type { FluentiDateTimeProps } from './components/DateTime';
9
9
  export { NumberFormat } from './components/NumberFormat';
10
10
  export type { FluentiNumberFormatProps } from './components/NumberFormat';
11
- //# sourceMappingURL=components-entry.d.ts.map
@@ -9,4 +9,3 @@ import { FluentiContext } from '../plugin';
9
9
  * @internal
10
10
  */
11
11
  export declare function __useI18n(): FluentiContext;
12
- //# sourceMappingURL=__useI18n.d.ts.map
@@ -13,4 +13,3 @@ export type { FluentiDateTimeProps } from './components/DateTime';
13
13
  export { NumberFormat } from './components/NumberFormat';
14
14
  export type { FluentiNumberFormatProps } from './components/NumberFormat';
15
15
  export { msg } from './msg';
16
- //# sourceMappingURL=index.d.ts.map
@@ -2,4 +2,3 @@ import { InjectionKey } from 'vue';
2
2
  import { FluentiContext } from './plugin';
3
3
  /** Injection key for the Fluenti i18n context. @internal */
4
4
  export declare const FLUENTI_KEY: InjectionKey<FluentiContext>;
5
- //# sourceMappingURL=injection-key.d.ts.map
@@ -1,2 +1 @@
1
1
  export { msg } from '@fluenti/core';
2
- //# sourceMappingURL=msg.d.ts.map
@@ -136,4 +136,3 @@ export interface FluentiPlugin {
136
136
  * ```
137
137
  */
138
138
  export declare function createFluenti(options: FluentiConfig): FluentiPlugin;
139
- //# sourceMappingURL=plugin.d.ts.map
@@ -93,4 +93,3 @@ export interface ServerI18n {
93
93
  * ```
94
94
  */
95
95
  export declare function createServerI18n(config: ServerI18nConfig): ServerI18n;
96
- //# sourceMappingURL=server.d.ts.map
@@ -28,4 +28,3 @@ import { FluentiContext } from './plugin';
28
28
  export declare function useI18n(): FluentiContext;
29
29
  /** Shorthand composable that returns only the reactive locale ref. */
30
30
  export declare function useLocale(): Readonly<import('vue').Ref<string, string>>;
31
- //# sourceMappingURL=use-i18n.d.ts.map
@@ -22,4 +22,3 @@ export type { FluentiPluginOptions as FluentiVueOptions } from '@fluenti/vite-pl
22
22
  * ```
23
23
  */
24
24
  export default function fluentiVue(options?: FluentiPluginOptions): Plugin[];
25
- //# sourceMappingURL=vite-plugin.d.ts.map
@@ -1,3 +1,2 @@
1
1
  import { RuntimeGenerator } from '@fluenti/vite-plugin';
2
2
  export declare const vueRuntimeGenerator: RuntimeGenerator;
3
- //# sourceMappingURL=vue-runtime.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluenti/vue",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
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",
@@ -87,8 +87,8 @@
87
87
  }
88
88
  },
89
89
  "dependencies": {
90
- "@fluenti/core": "0.6.1",
91
- "@fluenti/vite-plugin": "0.6.1"
90
+ "@fluenti/core": "0.6.2",
91
+ "@fluenti/vite-plugin": "0.6.2"
92
92
  },
93
93
  "devDependencies": {
94
94
  "typescript": "^5.9",
@@ -1 +0,0 @@
1
- {"version":3,"file":"NumberFormat-Bxim144o.js","names":[],"sources":["../src/injection-key.ts","../src/use-i18n.ts","../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 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> = /* @__PURE__ */ 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","import { Comment, Text, h, isVNode, type VNode, type VNodeChild } from 'vue'\nimport { offsetIndices } from '@fluenti/core/runtime'\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","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 = /* @__PURE__ */ 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/runtime'\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 = /* @__PURE__ */ 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/runtime'\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 = /* @__PURE__ */ 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 = /* @__PURE__ */ 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 = /* @__PURE__ */ 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":";;;AAIA,IAAa,IAA4D,uBAAO,UAAU;;;AC0B1F,SAAgB,IAA0B;CACxC,IAAM,IAAM,EAAO,EAAY;AAC/B,KAAI,CAAC,EACH,OAAU,MAAM,oDAAoD;AAEtE,QAAO;;AAIT,SAAgB,IAAY;AAC1B,QAAO,GAAS,CAAC;;;;ACrCnB,SAAgB,EAAe,GAG7B;CACA,IAAM,IAAsB,EAAE,EAC1B,IAAU;CAEd,SAAS,EAAM,GAAmD;AAChE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AO;EACX,IAAM,EAAE,SAAM,GAAS;AACvB,eAAa,EAAE,EAAM,KAAK,EAAE,EAAM,OAAO,EAAM,OAAO,CAAC;;CAE1D,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NumberFormat-CgU3BNm8.cjs","names":[],"sources":["../src/injection-key.ts","../src/use-i18n.ts","../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 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> = /* @__PURE__ */ 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","import { Comment, Text, h, isVNode, type VNode, type VNodeChild } from 'vue'\nimport { offsetIndices } from '@fluenti/core/runtime'\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","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 = /* @__PURE__ */ 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/runtime'\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 = /* @__PURE__ */ 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/runtime'\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 = /* @__PURE__ */ 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 = /* @__PURE__ */ 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 = /* @__PURE__ */ 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":"wDAIA,IAAa,EAA4D,OAAO,UAAU,CC0B1F,SAAgB,GAA0B,CACxC,IAAM,GAAA,EAAA,EAAA,QAAa,EAAY,CAC/B,GAAI,CAAC,EACH,MAAU,MAAM,oDAAo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BAAgB,CACtD,KAAM,WACN,MAAO,EACP,MAAM,EAAO,CACX,GAAM,CAAE,KAAM,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,GAA+B,EAAA,EAAA,iBAAgB,CAC1D,KAAM,eACN,MAAO,EACP,MAAM,EAAO,CACX,GAAM,CAAE,GAAM,GAAS,CACvB,WAAA,EAAA,EAAA,GAAe,EAAM,IAAK,EAAE,EAAM,MAAO,EAAM,OAAO,CAAC,EAE1D,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":[],"sources":["../src/plugin.ts","../src/compile-time-t.ts"],"sourcesContent":["import { type App, type Ref, ref, shallowReactive } from 'vue'\nimport type { AllMessages, Locale, LocalizedString, Messages, CompiledMessage, MessageDescriptor, DiagnosticsConfig, CustomFormatter } from '@fluenti/core'\nimport { createFluentiCore } from '@fluenti/core'\nimport { FLUENTI_KEY } from './injection-key'\n// Components are in @fluenti/vue subpath.\n// Global component registration is opt-in via `components` config option.\n\n/** Escape HTML special characters to prevent XSS. @internal */\nfunction escapeHtml(str: string): string {\n return str.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n}\n\n/** Compiled message chunk loader for lazy locale loading */\nexport type ChunkLoader = (\n locale: string,\n) => Promise<Record<string, CompiledMessage> | { default: Record<string, CompiledMessage> }>\n\ninterface SplitRuntimeModule {\n __switchLocale?: (locale: string) => Promise<void>\n __preloadLocale?: (locale: string) => Promise<void>\n}\n\nconst SPLIT_RUNTIME_KEY = Symbol.for('fluenti.runtime.vue.v1')\n\nfunction getSplitRuntimeModule(): SplitRuntimeModule | null {\n const runtime = (globalThis as Record<PropertyKey, unknown>)[SPLIT_RUNTIME_KEY]\n return typeof runtime === 'object' && runtime !== null\n ? runtime as SplitRuntimeModule\n : null\n}\n\nfunction resolveChunkMessages(\n loaded: Record<string, CompiledMessage> | { default: Record<string, CompiledMessage> },\n): Record<string, CompiledMessage> {\n return typeof loaded === 'object' && loaded !== null && 'default' in loaded\n ? (loaded as { default: Record<string, CompiledMessage> }).default\n : loaded\n}\n\n/** Context object returned by `useI18n()` and available as `$t` etc. on globalProperties */\nexport interface FluentiContext {\n /** Translate a message by id or MessageDescriptor, with optional interpolation values */\n t(id: string | MessageDescriptor, values?: Record<string, unknown>): LocalizedString\n /** Tagged template form: t`Hello ${name}` */\n t(strings: TemplateStringsArray, ...exprs: unknown[]): LocalizedString\n /** Reactive ref for current locale */\n locale: Readonly<Ref<Locale>>\n /** Change the active locale (async when lazy locale loading is enabled) */\n setLocale(locale: Locale): Promise<void>\n /** Dynamically load messages for a locale */\n loadMessages(locale: Locale, messages: Messages): void\n /** Get all locales that have loaded messages */\n getLocales(): Locale[]\n /** Format a date value according to locale */\n d(value: Date | number, style?: string): LocalizedString\n /** Format a number according to locale */\n n(value: number, style?: string): LocalizedString\n /** Format an ICU message string directly (no catalog lookup) */\n format(message: string, values?: Record<string, unknown>): LocalizedString\n /** Whether a locale chunk is currently being loaded */\n isLoading: Readonly<Ref<boolean>>\n /** Set of locales whose messages have been loaded */\n loadedLocales: Readonly<Ref<ReadonlySet<string>>>\n /** Preload a locale in the background without switching to it */\n preloadLocale(locale: string): void\n /** Check if a translation key exists in the catalog */\n te(key: string, locale?: string): boolean\n /** Get the raw compiled message without interpolation */\n tm(key: string, locale?: string): CompiledMessage | undefined\n}\n\n/** Injection key for providing/injecting fluenti context */\nexport { FLUENTI_KEY } from './injection-key'\n\n/** Options for creating the Fluenti Vue plugin */\nexport interface FluentiConfig {\n locale: string\n fallbackLocale?: string\n messages: AllMessages\n missing?: (locale: string, id: string) => string | undefined\n dateFormats?: Record<string, Intl.DateTimeFormatOptions | 'relative'>\n numberFormats?: Record<string, Intl.NumberFormatOptions | ((locale: string) => Intl.NumberFormatOptions)>\n fallbackChain?: Record<string, string[]>\n /** Async chunk loader for lazy locale loading */\n chunkLoader?: ChunkLoader\n /** Enable lazy locale loading through chunkLoader */\n lazyLocaleLoading?: boolean\n /**\n * Prefix for globally registered components (Trans, Plural, Select).\n *\n * Set this to avoid naming conflicts with other libraries.\n *\n * @example\n * componentPrefix: 'I18n'\n * // Registers: I18nTrans, I18nPlural, I18nSelect\n *\n * @example\n * componentPrefix: 'Fluenti'\n * // Registers: FluentiTrans, FluentiPlural, FluentiSelect\n *\n * @default '' (no prefix — Trans, Plural, Select)\n */\n componentPrefix?: string\n /**\n * Whether to inject `$t`, `$d`, `$n`, `$vtRich` onto `app.config.globalProperties`.\n *\n * Set to `false` to avoid polluting the global namespace (e.g. when migrating from vue-i18n\n * or when using composition API exclusively via `useI18n()`).\n *\n * @default true\n */\n injectGlobalProperties?: boolean\n /** Runtime diagnostics configuration or pre-created instance */\n diagnostics?: DiagnosticsConfig | { missingKey: (locale: string, id: string) => void; fallbackUsed: (locale: string, fallbackLocale: string, id: string) => void; enabled: boolean }\n /**\n * Custom message interpolation function.\n *\n * By default, the runtime uses a lightweight `{key}` replacer.\n * Pass the full `interpolate` from `@fluenti/core/runtime` for\n * runtime ICU MessageFormat parsing (adds ~2.5 KB gzip).\n *\n * @example\n * ```ts\n * import { interpolate } from '@fluenti/core/runtime'\n * createFluenti({ interpolate, ... })\n * ```\n */\n interpolate?: (\n message: string,\n values: Record<string, unknown> | undefined,\n locale: string,\n formatters?: Record<string, CustomFormatter>,\n ) => string\n /**\n * Components to register globally via `app.component()`.\n *\n * Import from `@fluenti/vue` and pass here to enable global\n * component registration without bloating the default bundle.\n *\n * @example\n * ```ts\n * import * as components from '@fluenti/vue'\n * app.use(createFluenti({ components, ... }))\n * ```\n */\n components?: Record<string, unknown>\n}\n\n/** Return value of `createFluenti()` */\nexport interface FluentiPlugin {\n /** Vue plugin install method */\n install(app: App): void\n /** The global fluenti context (same as what useI18n returns) */\n global: FluentiContext\n}\n\n/** Extract the attribute name from v-t modifiers (e.g., v-t.alt → 'alt') */\nfunction getModifierAttr(modifiers: Partial<Record<string, boolean>>): string | undefined {\n const keys = Object.keys(modifiers).filter((k) => k !== 'plural')\n return keys.length > 0 ? keys[0] : undefined\n}\n\n/**\n * Create a Fluenti Vue plugin (SSR-safe, per-request instance).\n *\n * Each invocation creates entirely fresh state — no module-level singletons —\n * so it is safe to call once per SSR request.\n *\n * @example\n * ```ts\n * import { createFluenti } from '@fluenti/vue'\n * import messages from './locales/compiled/en.js'\n *\n * const fluenti = createFluenti({\n * locale: 'en',\n * messages: { en: messages },\n * })\n *\n * app.use(fluenti)\n * ```\n */\nexport function createFluenti(options: FluentiConfig): FluentiPlugin {\n const lazyLocaleLoading = options.lazyLocaleLoading\n ?? (options as FluentiConfig & { splitting?: boolean }).splitting\n ?? false\n\n // Create the core i18n instance — delegates t/d/n/format/loadMessages/getLocales\n // Build config incrementally to satisfy exactOptionalPropertyTypes —\n // optional properties must not receive `undefined` as a value.\n const coreConfig: Parameters<typeof createFluentiCore>[0] = {\n locale: options.locale,\n messages: options.messages ?? {},\n }\n if (options.fallbackLocale !== undefined) coreConfig.fallbackLocale = options.fallbackLocale\n if (options.fallbackChain !== undefined) coreConfig.fallbackChain = options.fallbackChain\n if (options.dateFormats !== undefined) coreConfig.dateFormats = options.dateFormats\n if (options.numberFormats !== undefined) coreConfig.numberFormats = options.numberFormats\n if (options.missing !== undefined) coreConfig.missing = options.missing\n if (options.diagnostics !== undefined) coreConfig.diagnostics = options.diagnostics as Parameters<typeof createFluentiCore>[0]['diagnostics']\n if (options.interpolate !== undefined) coreConfig.interpolate = options.interpolate\n coreConfig.devWarnings = coreConfig.devWarnings ?? (typeof process !== 'undefined' && process.env?.['NODE_ENV'] === 'development')\n const i18n = createFluentiCore(coreConfig)\n\n const locale = ref(options.locale)\n // Intentional mutation: Vue's shallowReactive API requires in-place property assignment for reactivity\n const catalogs = shallowReactive<AllMessages>({ ...options.messages })\n const isLoading = ref(false)\n const loadedLocalesSet = new Set<string>([options.locale])\n const loadedLocales = ref<ReadonlySet<string>>(new Set(loadedLocalesSet))\n\n /** Local catalog lookup for te/tm (core doesn't expose raw catalog access) */\n function lookup(\n loc: Locale,\n id: string,\n ): CompiledMessage | undefined {\n const msgs = catalogs[loc]\n if (!msgs) return undefined\n return msgs[id]\n }\n\n /** Sync Vue reactive locale to core before delegation */\n function syncLocale(): void {\n if (i18n.locale !== locale.value) {\n i18n.locale = locale.value\n }\n }\n\n function t(strings: TemplateStringsArray, ...exprs: unknown[]): LocalizedString\n function t(id: string | MessageDescriptor, values?: Record<string, unknown>): LocalizedString\n function t(idOrStrings: string | MessageDescriptor | TemplateStringsArray, ...rest: unknown[]): LocalizedString {\n // Read locale.value and catalogs to register Vue reactive dependencies\n // so components re-render when locale or messages change\n const currentLocale = locale.value\n void catalogs[currentLocale]\n syncLocale()\n // Dispatch to the correct overload based on input type\n if (Array.isArray(idOrStrings) && 'raw' in idOrStrings) {\n return i18n.t(idOrStrings as TemplateStringsArray, ...rest)\n }\n return i18n.t(idOrStrings as string | MessageDescriptor, rest[0] as Record<string, unknown> | undefined)\n }\n\n let _localeRequestId = 0\n\n async function setLocale(newLocale: Locale): Promise<void> {\n if (!lazyLocaleLoading || !options.chunkLoader) {\n i18n.locale = newLocale\n locale.value = newLocale\n return\n }\n\n const splitRuntime = getSplitRuntimeModule()\n\n if (loadedLocalesSet.has(newLocale)) {\n // Already loaded, instant switch\n try {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n } catch (e) {\n console.warn(`[fluenti] split runtime switch failed for locale \"${newLocale}\"`, e)\n }\n i18n.locale = newLocale\n locale.value = newLocale\n return\n }\n\n // Race-condition protection: track request ID\n const thisRequest = ++_localeRequestId\n isLoading.value = true\n try {\n const messages = resolveChunkMessages(await options.chunkLoader(newLocale))\n // Stale request — a newer setLocale call superseded this one\n if (thisRequest !== _localeRequestId) return\n // Intentional mutation: Vue's shallowReactive API requires in-place property assignment for reactivity\n catalogs[newLocale] = { ...catalogs[newLocale], ...messages }\n i18n.loadMessages(newLocale, messages)\n loadedLocalesSet.add(newLocale)\n loadedLocales.value = new Set(loadedLocalesSet)\n try {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n } catch (e) {\n console.warn(`[fluenti] split runtime switch failed for locale \"${newLocale}\"`, e)\n }\n // Re-check after async __switchLocale — a newer setLocale() may have superseded this one\n if (thisRequest !== _localeRequestId) return\n i18n.locale = newLocale\n locale.value = newLocale\n } finally {\n if (thisRequest === _localeRequestId) {\n isLoading.value = false\n }\n }\n }\n\n function loadMessages(loc: Locale, messages: Messages): void {\n // Intentional mutation: Vue's shallowReactive API requires in-place property assignment for reactivity\n catalogs[loc] = { ...catalogs[loc], ...messages }\n i18n.loadMessages(loc, messages)\n loadedLocalesSet.add(loc)\n loadedLocales.value = new Set(loadedLocalesSet)\n }\n\n const _preloadInFlight = new Set<string>()\n\n function preloadLocale(loc: string): void {\n if (!lazyLocaleLoading || loadedLocalesSet.has(loc) || !options.chunkLoader || _preloadInFlight.has(loc)) return\n _preloadInFlight.add(loc)\n const splitRuntime = getSplitRuntimeModule()\n options.chunkLoader(loc).then(async (loaded) => {\n const messages = resolveChunkMessages(loaded)\n // Intentional mutation: Vue's shallowReactive API requires in-place property assignment for reactivity\n catalogs[loc] = { ...catalogs[loc], ...messages }\n i18n.loadMessages(loc, messages)\n loadedLocalesSet.add(loc)\n loadedLocales.value = new Set(loadedLocalesSet)\n if (splitRuntime?.__preloadLocale) {\n await splitRuntime.__preloadLocale(loc)\n }\n }).catch((e: unknown) => {\n console.warn('[fluenti] preload failed:', loc, e)\n }).finally(() => {\n _preloadInFlight.delete(loc)\n })\n }\n\n function getLocales(): Locale[] {\n syncLocale()\n return i18n.getLocales()\n }\n\n function d(value: Date | number, style?: string): LocalizedString {\n // Read locale.value to register a Vue reactive dependency\n void locale.value\n syncLocale()\n return i18n.d(value, style)\n }\n\n function n(value: number, style?: string): LocalizedString {\n // Read locale.value to register a Vue reactive dependency\n void locale.value\n syncLocale()\n return i18n.n(value, style)\n }\n\n function format(message: string, values?: Record<string, unknown>): LocalizedString {\n // Read locale.value to register a Vue reactive dependency\n void locale.value\n syncLocale()\n return i18n.format(message, values)\n }\n\n /**\n * Rich text helper for v-t with child elements.\n * Translates the message (which contains `<0>content</0>` placeholders),\n * then replaces each placeholder with the original HTML element.\n * Used via `v-html=\"$vtRich('msg', elements)\"` in compile-time transforms.\n * @internal\n */\n function vtRich(\n message: string | MessageDescriptor,\n elements: Array<{ tag: string; attrs?: Record<string, string>; rawAttrs?: string }>,\n values?: Record<string, unknown>,\n ): string {\n const translated = values ? t(message, values) : t(message)\n // Escape the entire translated string first to neutralise any injected HTML\n const escaped = escapeHtml(translated)\n\n // Helper to build attribute string from element.\n // Both rawAttrs and attrs are escaped to prevent XSS — even though rawAttrs\n // originates from compile-time transforms, $vtRich is exposed on globalProperties\n // so we apply defence-in-depth.\n function buildAttrs(el: { attrs?: Record<string, string>; rawAttrs?: string }): string {\n if (el.rawAttrs != null && el.rawAttrs !== '') {\n // Parse rawAttrs back into key/value pairs and escape each one.\n // Handles: key=\"val\", key='val', and bare key (boolean attribute).\n const parts: string[] = []\n const attrRe = /([\\w:@.!-]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'))?/g\n let m: RegExpExecArray | null\n while ((m = attrRe.exec(el.rawAttrs)) !== null) {\n const key = escapeHtml(m[1]!)\n const val = m[2] ?? m[3]\n parts.push(val !== undefined ? `${key}=\"${escapeHtml(val)}\"` : key)\n }\n return parts.join(' ')\n }\n if (!el.attrs) return ''\n return Object.entries(el.attrs)\n .map(([k, v]) => v ? `${escapeHtml(k)}=\"${escapeHtml(v)}\"` : escapeHtml(k))\n .join(' ')\n }\n\n // First: handle self-closing <idx/> (escaped as &lt;idx/&gt;)\n let result = escaped.replace(/&lt;(\\d+)\\/&gt;/g, (_match, idxStr: string) => {\n const el = elements[Number(idxStr)]\n if (!el) return ''\n const tag = escapeHtml(el.tag)\n const attrs = buildAttrs(el)\n return `<${tag}${attrs ? ' ' + attrs : ''} />`\n })\n\n // Then: handle paired <idx>content</idx>\n result = result.replace(/&lt;(\\d+)&gt;([\\s\\S]*?)&lt;\\/\\1&gt;/g, (_match, idxStr: string, content: string) => {\n const el = elements[Number(idxStr)]\n if (!el) return content\n const tag = escapeHtml(el.tag)\n const attrs = buildAttrs(el)\n return `<${tag}${attrs ? ' ' + attrs : ''}>${content}</${tag}>`\n })\n\n return result\n }\n\n function te(key: string, loc?: string): boolean {\n const targetLocale = loc ?? locale.value\n return lookup(targetLocale, key) !== undefined\n }\n\n function tm(key: string, loc?: string): CompiledMessage | undefined {\n const targetLocale = loc ?? locale.value\n return lookup(targetLocale, key)\n }\n\n const context: FluentiContext = {\n t,\n locale,\n setLocale,\n loadMessages,\n getLocales,\n d,\n n,\n format,\n isLoading,\n loadedLocales,\n preloadLocale,\n te,\n tm,\n }\n\n return {\n install(app: App) {\n app.provide(FLUENTI_KEY, context)\n // Register components globally if provided via config\n if (options.components) {\n const prefix = options.componentPrefix ?? ''\n const comps = options.components as Record<string, unknown>\n if (comps['Trans']) app.component(`${prefix}Trans`, comps['Trans'] as any)\n if (comps['Plural']) app.component(`${prefix}Plural`, comps['Plural'] as any)\n if (comps['Select']) app.component(`${prefix}Select`, comps['Select'] as any)\n if (comps['DateTime']) app.component(`${prefix}DateTime`, comps['DateTime'] as any)\n if (comps['NumberFormat']) app.component(`${prefix}NumberFormat`, comps['NumberFormat'] as any)\n }\n if (options.injectGlobalProperties !== false) {\n app.config.globalProperties['$t'] = t\n app.config.globalProperties['$d'] = d\n app.config.globalProperties['$n'] = n\n app.config.globalProperties['$vtRich'] = vtRich\n }\n\n // Runtime v-t directive (fallback when compile-time transform is not used)\n const vtOriginalIds = new WeakMap<HTMLElement, string>()\n app.directive('t', {\n mounted(el, binding) {\n const attrName = getModifierAttr(binding.modifiers)\n if (attrName) {\n // v-t.alt, v-t.placeholder, etc. — translate the attribute\n const original = el.getAttribute(attrName) ?? ''\n vtOriginalIds.set(el, original)\n el.setAttribute(attrName, t(original))\n } else {\n // v-t or v-t:id — translate text content\n const id = binding.arg ?? el.textContent ?? ''\n vtOriginalIds.set(el, id.trim())\n el.textContent = t(id.trim(), binding.value != null ? { ...binding.value } : undefined)\n }\n },\n updated(el, binding) {\n const attrName = getModifierAttr(binding.modifiers)\n if (attrName) {\n const original = vtOriginalIds.get(el) ?? el.getAttribute(attrName) ?? ''\n el.setAttribute(attrName, t(original))\n } else {\n const id = binding.arg ?? vtOriginalIds.get(el) ?? ''\n el.textContent = t(id.trim(), binding.value != null ? { ...binding.value } : undefined)\n }\n },\n })\n },\n global: context,\n }\n}\n","import type { CompileTimeT } from '@fluenti/core'\n\nexport const t: CompileTimeT = ((..._args: unknown[]) => {\n throw new Error(\n \"[fluenti] `t` imported from '@fluenti/vue' is a compile-time API. \" +\n 'Use it only with the Fluenti build transform inside <script setup> or setup(). ' +\n 'For runtime lookups, use useI18n().t(...).',\n )\n}) as CompileTimeT\n"],"mappings":"kKAQA,SAAS,EAAW,EAAqB,CACvC,OAAO,EAAI,QAAQ,KAAM,QAAQ,CAAC,QAAQ,KAAM,SAAS,CAAC,QAAQ,KAAM,QAAQ,CAAC,QAAQ,KAAM,OAAO,CAAC,QAAQ,KAAM,OAAO,CAa9H,IAAM,EAAoB,OAAO,IAAI,yBAAyB,CAE9D,SAAS,GAAmD,CAC1D,IAAM,EAAW,WAA4C,GAC7D,OAAO,OAAO,GAAY,UAAY,EAClC,EACA,KAGN,SAAS,EACP,EACiC,CACjC,OAAO,OAAO,GAAW,UAAY,GAAmB,YAAa,EAChE,EAAwD,QACzD,EAyHN,SAAS,EAAgB,EAAiE,CACxF,IAAM,EAAO,OAAO,KAAK,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IAAqB,CACvD,MAAU,MACR,8LAGD"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/plugin.ts","../src/compile-time-t.ts"],"sourcesContent":["import { type App, type Ref, ref, shallowReactive } from 'vue'\nimport type { AllMessages, Locale, LocalizedString, Messages, CompiledMessage, MessageDescriptor, DiagnosticsConfig, CustomFormatter } from '@fluenti/core'\nimport { createFluentiCore } from '@fluenti/core'\nimport { FLUENTI_KEY } from './injection-key'\n// Components are in @fluenti/vue subpath.\n// Global component registration is opt-in via `components` config option.\n\n/** Escape HTML special characters to prevent XSS. @internal */\nfunction escapeHtml(str: string): string {\n return str.replace(/&/g, '&amp;').replace(/\"/g, '&quot;').replace(/'/g, '&#39;').replace(/</g, '&lt;').replace(/>/g, '&gt;')\n}\n\n/** Compiled message chunk loader for lazy locale loading */\nexport type ChunkLoader = (\n locale: string,\n) => Promise<Record<string, CompiledMessage> | { default: Record<string, CompiledMessage> }>\n\ninterface SplitRuntimeModule {\n __switchLocale?: (locale: string) => Promise<void>\n __preloadLocale?: (locale: string) => Promise<void>\n}\n\nconst SPLIT_RUNTIME_KEY = Symbol.for('fluenti.runtime.vue.v1')\n\nfunction getSplitRuntimeModule(): SplitRuntimeModule | null {\n const runtime = (globalThis as Record<PropertyKey, unknown>)[SPLIT_RUNTIME_KEY]\n return typeof runtime === 'object' && runtime !== null\n ? runtime as SplitRuntimeModule\n : null\n}\n\nfunction resolveChunkMessages(\n loaded: Record<string, CompiledMessage> | { default: Record<string, CompiledMessage> },\n): Record<string, CompiledMessage> {\n return typeof loaded === 'object' && loaded !== null && 'default' in loaded\n ? (loaded as { default: Record<string, CompiledMessage> }).default\n : loaded\n}\n\n/** Context object returned by `useI18n()` and available as `$t` etc. on globalProperties */\nexport interface FluentiContext {\n /** Translate a message by id or MessageDescriptor, with optional interpolation values */\n t(id: string | MessageDescriptor, values?: Record<string, unknown>): LocalizedString\n /** Tagged template form: t`Hello ${name}` */\n t(strings: TemplateStringsArray, ...exprs: unknown[]): LocalizedString\n /** Reactive ref for current locale */\n locale: Readonly<Ref<Locale>>\n /** Change the active locale (async when lazy locale loading is enabled) */\n setLocale(locale: Locale): Promise<void>\n /** Dynamically load messages for a locale */\n loadMessages(locale: Locale, messages: Messages): void\n /** Get all locales that have loaded messages */\n getLocales(): Locale[]\n /** Format a date value according to locale */\n d(value: Date | number, style?: string): LocalizedString\n /** Format a number according to locale */\n n(value: number, style?: string): LocalizedString\n /** Format an ICU message string directly (no catalog lookup) */\n format(message: string, values?: Record<string, unknown>): LocalizedString\n /** Whether a locale chunk is currently being loaded */\n isLoading: Readonly<Ref<boolean>>\n /** Set of locales whose messages have been loaded */\n loadedLocales: Readonly<Ref<ReadonlySet<string>>>\n /** Preload a locale in the background without switching to it */\n preloadLocale(locale: string): void\n /** Check if a translation key exists in the catalog */\n te(key: string, locale?: string): boolean\n /** Get the raw compiled message without interpolation */\n tm(key: string, locale?: string): CompiledMessage | undefined\n}\n\n/** Injection key for providing/injecting fluenti context */\nexport { FLUENTI_KEY } from './injection-key'\n\n/** Options for creating the Fluenti Vue plugin */\nexport interface FluentiConfig {\n locale: string\n fallbackLocale?: string\n messages: AllMessages\n missing?: (locale: string, id: string) => string | undefined\n dateFormats?: Record<string, Intl.DateTimeFormatOptions | 'relative'>\n numberFormats?: Record<string, Intl.NumberFormatOptions | ((locale: string) => Intl.NumberFormatOptions)>\n fallbackChain?: Record<string, string[]>\n /** Async chunk loader for lazy locale loading */\n chunkLoader?: ChunkLoader\n /** Enable lazy locale loading through chunkLoader */\n lazyLocaleLoading?: boolean\n /**\n * Prefix for globally registered components (Trans, Plural, Select).\n *\n * Set this to avoid naming conflicts with other libraries.\n *\n * @example\n * componentPrefix: 'I18n'\n * // Registers: I18nTrans, I18nPlural, I18nSelect\n *\n * @example\n * componentPrefix: 'Fluenti'\n * // Registers: FluentiTrans, FluentiPlural, FluentiSelect\n *\n * @default '' (no prefix — Trans, Plural, Select)\n */\n componentPrefix?: string\n /**\n * Whether to inject `$t`, `$d`, `$n`, `$vtRich` onto `app.config.globalProperties`.\n *\n * Set to `false` to avoid polluting the global namespace (e.g. when migrating from vue-i18n\n * or when using composition API exclusively via `useI18n()`).\n *\n * @default true\n */\n injectGlobalProperties?: boolean\n /** Runtime diagnostics configuration or pre-created instance */\n diagnostics?: DiagnosticsConfig | { missingKey: (locale: string, id: string) => void; fallbackUsed: (locale: string, fallbackLocale: string, id: string) => void; enabled: boolean }\n /**\n * Custom message interpolation function.\n *\n * By default, the runtime uses a lightweight `{key}` replacer.\n * Pass the full `interpolate` from `@fluenti/core/runtime` for\n * runtime ICU MessageFormat parsing (adds ~2.5 KB gzip).\n *\n * @example\n * ```ts\n * import { interpolate } from '@fluenti/core/runtime'\n * createFluenti({ interpolate, ... })\n * ```\n */\n interpolate?: (\n message: string,\n values: Record<string, unknown> | undefined,\n locale: string,\n formatters?: Record<string, CustomFormatter>,\n ) => string\n /**\n * Components to register globally via `app.component()`.\n *\n * Import from `@fluenti/vue` and pass here to enable global\n * component registration without bloating the default bundle.\n *\n * @example\n * ```ts\n * import * as components from '@fluenti/vue'\n * app.use(createFluenti({ components, ... }))\n * ```\n */\n components?: Record<string, unknown>\n}\n\n/** Return value of `createFluenti()` */\nexport interface FluentiPlugin {\n /** Vue plugin install method */\n install(app: App): void\n /** The global fluenti context (same as what useI18n returns) */\n global: FluentiContext\n}\n\n/** Extract the attribute name from v-t modifiers (e.g., v-t.alt → 'alt') */\nfunction getModifierAttr(modifiers: Partial<Record<string, boolean>>): string | undefined {\n const keys = Object.keys(modifiers).filter((k) => k !== 'plural')\n return keys.length > 0 ? keys[0] : undefined\n}\n\n/**\n * Create a Fluenti Vue plugin (SSR-safe, per-request instance).\n *\n * Each invocation creates entirely fresh state — no module-level singletons —\n * so it is safe to call once per SSR request.\n *\n * @example\n * ```ts\n * import { createFluenti } from '@fluenti/vue'\n * import messages from './locales/compiled/en.js'\n *\n * const fluenti = createFluenti({\n * locale: 'en',\n * messages: { en: messages },\n * })\n *\n * app.use(fluenti)\n * ```\n */\nexport function createFluenti(options: FluentiConfig): FluentiPlugin {\n const lazyLocaleLoading = options.lazyLocaleLoading\n ?? (options as FluentiConfig & { splitting?: boolean }).splitting\n ?? false\n\n // Create the core i18n instance — delegates t/d/n/format/loadMessages/getLocales\n // Build config incrementally to satisfy exactOptionalPropertyTypes —\n // optional properties must not receive `undefined` as a value.\n const coreConfig: Parameters<typeof createFluentiCore>[0] = {\n locale: options.locale,\n messages: options.messages ?? {},\n }\n if (options.fallbackLocale !== undefined) coreConfig.fallbackLocale = options.fallbackLocale\n if (options.fallbackChain !== undefined) coreConfig.fallbackChain = options.fallbackChain\n if (options.dateFormats !== undefined) coreConfig.dateFormats = options.dateFormats\n if (options.numberFormats !== undefined) coreConfig.numberFormats = options.numberFormats\n if (options.missing !== undefined) coreConfig.missing = options.missing\n if (options.diagnostics !== undefined) coreConfig.diagnostics = options.diagnostics as Parameters<typeof createFluentiCore>[0]['diagnostics']\n if (options.interpolate !== undefined) coreConfig.interpolate = options.interpolate\n coreConfig.devWarnings = coreConfig.devWarnings ?? (typeof process !== 'undefined' && process.env?.['NODE_ENV'] === 'development')\n const i18n = createFluentiCore(coreConfig)\n\n const locale = ref(options.locale)\n // Intentional mutation: Vue's shallowReactive API requires in-place property assignment for reactivity\n const catalogs = shallowReactive<AllMessages>({ ...options.messages })\n const isLoading = ref(false)\n const loadedLocalesSet = new Set<string>([options.locale])\n const loadedLocales = ref<ReadonlySet<string>>(new Set(loadedLocalesSet))\n\n /** Local catalog lookup for te/tm (core doesn't expose raw catalog access) */\n function lookup(\n loc: Locale,\n id: string,\n ): CompiledMessage | undefined {\n const msgs = catalogs[loc]\n if (!msgs) return undefined\n return msgs[id]\n }\n\n /** Sync Vue reactive locale to core before delegation */\n function syncLocale(): void {\n if (i18n.locale !== locale.value) {\n i18n.locale = locale.value\n }\n }\n\n function t(strings: TemplateStringsArray, ...exprs: unknown[]): LocalizedString\n function t(id: string | MessageDescriptor, values?: Record<string, unknown>): LocalizedString\n function t(idOrStrings: string | MessageDescriptor | TemplateStringsArray, ...rest: unknown[]): LocalizedString {\n // Read locale.value and catalogs to register Vue reactive dependencies\n // so components re-render when locale or messages change\n const currentLocale = locale.value\n void catalogs[currentLocale]\n syncLocale()\n // Dispatch to the correct overload based on input type\n if (Array.isArray(idOrStrings) && 'raw' in idOrStrings) {\n return i18n.t(idOrStrings as TemplateStringsArray, ...rest)\n }\n return i18n.t(idOrStrings as string | MessageDescriptor, rest[0] as Record<string, unknown> | undefined)\n }\n\n let _localeRequestId = 0\n\n async function setLocale(newLocale: Locale): Promise<void> {\n if (!lazyLocaleLoading || !options.chunkLoader) {\n i18n.locale = newLocale\n locale.value = newLocale\n return\n }\n\n const splitRuntime = getSplitRuntimeModule()\n\n if (loadedLocalesSet.has(newLocale)) {\n // Already loaded, instant switch\n try {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n } catch (e) {\n console.warn(`[fluenti] split runtime switch failed for locale \"${newLocale}\"`, e)\n }\n i18n.locale = newLocale\n locale.value = newLocale\n return\n }\n\n // Race-condition protection: track request ID\n const thisRequest = ++_localeRequestId\n isLoading.value = true\n try {\n const messages = resolveChunkMessages(await options.chunkLoader(newLocale))\n // Stale request — a newer setLocale call superseded this one\n if (thisRequest !== _localeRequestId) return\n // Intentional mutation: Vue's shallowReactive API requires in-place property assignment for reactivity\n catalogs[newLocale] = { ...catalogs[newLocale], ...messages }\n i18n.loadMessages(newLocale, messages)\n loadedLocalesSet.add(newLocale)\n loadedLocales.value = new Set(loadedLocalesSet)\n try {\n if (splitRuntime?.__switchLocale) {\n await splitRuntime.__switchLocale(newLocale)\n }\n } catch (e) {\n console.warn(`[fluenti] split runtime switch failed for locale \"${newLocale}\"`, e)\n }\n // Re-check after async __switchLocale — a newer setLocale() may have superseded this one\n if (thisRequest !== _localeRequestId) return\n i18n.locale = newLocale\n locale.value = newLocale\n } finally {\n if (thisRequest === _localeRequestId) {\n isLoading.value = false\n }\n }\n }\n\n function loadMessages(loc: Locale, messages: Messages): void {\n // Intentional mutation: Vue's shallowReactive API requires in-place property assignment for reactivity\n catalogs[loc] = { ...catalogs[loc], ...messages }\n i18n.loadMessages(loc, messages)\n loadedLocalesSet.add(loc)\n loadedLocales.value = new Set(loadedLocalesSet)\n }\n\n const _preloadInFlight = new Set<string>()\n\n function preloadLocale(loc: string): void {\n if (!lazyLocaleLoading || loadedLocalesSet.has(loc) || !options.chunkLoader || _preloadInFlight.has(loc)) return\n _preloadInFlight.add(loc)\n const splitRuntime = getSplitRuntimeModule()\n options.chunkLoader(loc).then(async (loaded) => {\n const messages = resolveChunkMessages(loaded)\n // Intentional mutation: Vue's shallowReactive API requires in-place property assignment for reactivity\n catalogs[loc] = { ...catalogs[loc], ...messages }\n i18n.loadMessages(loc, messages)\n loadedLocalesSet.add(loc)\n loadedLocales.value = new Set(loadedLocalesSet)\n if (splitRuntime?.__preloadLocale) {\n await splitRuntime.__preloadLocale(loc)\n }\n }).catch((e: unknown) => {\n console.warn('[fluenti] preload failed:', loc, e)\n }).finally(() => {\n _preloadInFlight.delete(loc)\n })\n }\n\n function getLocales(): Locale[] {\n syncLocale()\n return i18n.getLocales()\n }\n\n function d(value: Date | number, style?: string): LocalizedString {\n // Read locale.value to register a Vue reactive dependency\n void locale.value\n syncLocale()\n return i18n.d(value, style)\n }\n\n function n(value: number, style?: string): LocalizedString {\n // Read locale.value to register a Vue reactive dependency\n void locale.value\n syncLocale()\n return i18n.n(value, style)\n }\n\n function format(message: string, values?: Record<string, unknown>): LocalizedString {\n // Read locale.value to register a Vue reactive dependency\n void locale.value\n syncLocale()\n return i18n.format(message, values)\n }\n\n /**\n * Rich text helper for v-t with child elements.\n * Translates the message (which contains `<0>content</0>` placeholders),\n * then replaces each placeholder with the original HTML element.\n * Used via `v-html=\"$vtRich('msg', elements)\"` in compile-time transforms.\n * @internal\n */\n function vtRich(\n message: string | MessageDescriptor,\n elements: Array<{ tag: string; attrs?: Record<string, string>; rawAttrs?: string }>,\n values?: Record<string, unknown>,\n ): string {\n const translated = values ? t(message, values) : t(message)\n // Escape the entire translated string first to neutralise any injected HTML\n const escaped = escapeHtml(translated)\n\n // Helper to build attribute string from element.\n // Both rawAttrs and attrs are escaped to prevent XSS — even though rawAttrs\n // originates from compile-time transforms, $vtRich is exposed on globalProperties\n // so we apply defence-in-depth.\n function buildAttrs(el: { attrs?: Record<string, string>; rawAttrs?: string }): string {\n if (el.rawAttrs != null && el.rawAttrs !== '') {\n // Parse rawAttrs back into key/value pairs and escape each one.\n // Handles: key=\"val\", key='val', and bare key (boolean attribute).\n const parts: string[] = []\n const attrRe = /([\\w:@.!-]+)(?:\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)'))?/g\n let m: RegExpExecArray | null\n while ((m = attrRe.exec(el.rawAttrs)) !== null) {\n const key = escapeHtml(m[1]!)\n const val = m[2] ?? m[3]\n parts.push(val !== undefined ? `${key}=\"${escapeHtml(val)}\"` : key)\n }\n return parts.join(' ')\n }\n if (!el.attrs) return ''\n return Object.entries(el.attrs)\n .map(([k, v]) => v ? `${escapeHtml(k)}=\"${escapeHtml(v)}\"` : escapeHtml(k))\n .join(' ')\n }\n\n // First: handle self-closing <idx/> (escaped as &lt;idx/&gt;)\n let result = escaped.replace(/&lt;(\\d+)\\/&gt;/g, (_match, idxStr: string) => {\n const el = elements[Number(idxStr)]\n if (!el) return ''\n const tag = escapeHtml(el.tag)\n const attrs = buildAttrs(el)\n return `<${tag}${attrs ? ' ' + attrs : ''} />`\n })\n\n // Then: handle paired <idx>content</idx>\n result = result.replace(/&lt;(\\d+)&gt;([\\s\\S]*?)&lt;\\/\\1&gt;/g, (_match, idxStr: string, content: string) => {\n const el = elements[Number(idxStr)]\n if (!el) return content\n const tag = escapeHtml(el.tag)\n const attrs = buildAttrs(el)\n return `<${tag}${attrs ? ' ' + attrs : ''}>${content}</${tag}>`\n })\n\n return result\n }\n\n function te(key: string, loc?: string): boolean {\n const targetLocale = loc ?? locale.value\n return lookup(targetLocale, key) !== undefined\n }\n\n function tm(key: string, loc?: string): CompiledMessage | undefined {\n const targetLocale = loc ?? locale.value\n return lookup(targetLocale, key)\n }\n\n const context: FluentiContext = {\n t,\n locale,\n setLocale,\n loadMessages,\n getLocales,\n d,\n n,\n format,\n isLoading,\n loadedLocales,\n preloadLocale,\n te,\n tm,\n }\n\n return {\n install(app: App) {\n app.provide(FLUENTI_KEY, context)\n // Register components globally if provided via config\n if (options.components) {\n const prefix = options.componentPrefix ?? ''\n const comps = options.components as Record<string, unknown>\n if (comps['Trans']) app.component(`${prefix}Trans`, comps['Trans'] as any)\n if (comps['Plural']) app.component(`${prefix}Plural`, comps['Plural'] as any)\n if (comps['Select']) app.component(`${prefix}Select`, comps['Select'] as any)\n if (comps['DateTime']) app.component(`${prefix}DateTime`, comps['DateTime'] as any)\n if (comps['NumberFormat']) app.component(`${prefix}NumberFormat`, comps['NumberFormat'] as any)\n }\n if (options.injectGlobalProperties !== false) {\n app.config.globalProperties['$t'] = t\n app.config.globalProperties['$d'] = d\n app.config.globalProperties['$n'] = n\n app.config.globalProperties['$vtRich'] = vtRich\n }\n\n // Runtime v-t directive (fallback when compile-time transform is not used)\n const vtOriginalIds = new WeakMap<HTMLElement, string>()\n app.directive('t', {\n mounted(el, binding) {\n const attrName = getModifierAttr(binding.modifiers)\n if (attrName) {\n // v-t.alt, v-t.placeholder, etc. — translate the attribute\n const original = el.getAttribute(attrName) ?? ''\n vtOriginalIds.set(el, original)\n el.setAttribute(attrName, t(original))\n } else {\n // v-t or v-t:id — translate text content\n const id = binding.arg ?? el.textContent ?? ''\n vtOriginalIds.set(el, id.trim())\n el.textContent = t(id.trim(), binding.value != null ? { ...binding.value } : undefined)\n }\n },\n updated(el, binding) {\n const attrName = getModifierAttr(binding.modifiers)\n if (attrName) {\n const original = vtOriginalIds.get(el) ?? el.getAttribute(attrName) ?? ''\n el.setAttribute(attrName, t(original))\n } else {\n const id = binding.arg ?? vtOriginalIds.get(el) ?? ''\n el.textContent = t(id.trim(), binding.value != null ? { ...binding.value } : undefined)\n }\n },\n })\n },\n global: context,\n }\n}\n","import type { CompileTimeT } from '@fluenti/core'\n\nexport const t: CompileTimeT = ((..._args: unknown[]) => {\n throw new Error(\n \"[fluenti] `t` imported from '@fluenti/vue' is a compile-time API. \" +\n 'Use it only with the Fluenti build transform inside <script setup> or setup(). ' +\n 'For runtime lookups, use useI18n().t(...).',\n )\n}) as CompileTimeT\n"],"mappings":";;;;AAQA,SAAS,EAAW,GAAqB;AACvC,QAAO,EAAI,QAAQ,MAAM,QAAQ,CAAC,QAAQ,MAAM,SAAS,CAAC,QAAQ,MAAM,QAAQ,CAAC,QAAQ,MAAM,OAAO,CAAC,QAAQ,MAAM,OAAO;;AAa9H,IAAM,IAAoB,OAAO,IAAI,yBAAyB;AAE9D,SAAS,IAAmD;CAC1D,IAAM,IAAW,WAA4C;AAC7D,QAAO,OAAO,KAAY,YAAY,IAClC,IACA;;AAGN,SAAS,EACP,GACiC;AACjC,QAAO,OAAO,KAAW,YAAY,KAAmB,aAAa,IAChE,EAAwD,UACzD;;AAyHN,SAAS,EAAgB,GAAiE;CACxF,IAAM,IAAO,OAAO,KAAK,EAAU,CAAC,QAAQ,MAAM,MAAM,SAAS;AACjE,QAAO,EAAK,SAAS,IAAI,EAAK,KAAK,KAAA;;AAsBrC,SAAgB,EAAc,GAAuC;CACnE,IAAM,IAAoB,EAAQ,qBAC5B,EAAoD,aACrD,IAKC,IAAsD;EAC1D,QAAQ,EAAQ;EAChB,UAAU,EAAQ,YAAY,EAAE;EACjC;AAQD,CAPI,EAAQ,mBAAmB,KAAA,MAAW,EAAW,iBAAiB,EAAQ,iBAC1E,EAAQ,kBAAkB,KAAA,MAAW,EAAW,gBAAgB,EAAQ,gBACxE,EAAQ,gBAAgB,KAAA,MAAW,EAAW,cAAc,EAAQ,cACpE,EAAQ,kBAAkB,KAAA,MAAW,EAAW,gBAAgB,EAAQ,gBACx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A8B;AACxD,KAAI,UAAU,KAAK;IACjB,QAAQ,GAAI,GAAS;KACnB,IAAM,IAAW,EAAgB,EAAQ,UAAU;AACnD,SAAI,GAAU;MAEZ,IAAM,IAAW,EAAG,aAAa,EAAS,IAAI;AAE9C,MADA,EAAc,IAAI,GAAI,EAAS,EAC/B,EAAG,aAAa,GAAU,EAAE,EAAS,CAAC;YACjC;MAEL,IAAM,IAAK,EAAQ,OAAO,EAAG,eAAe;AAE5C,MADA,EAAc,IAAI,GAAI,EAAG,MAAM,CAAC,EAChC,EAAG,cAAc,EAAE,EAAG,MAAM,EAAE,EAAQ,SAAS,OAA8B,KAAA,IAAvB,EAAE,GAAG,EAAQ,OAAO,CAAa;;;IAG3F,QAAQ,GAAI,GAAS;KACnB,IAAM,IAAW,EAAgB,EAAQ,UAAU;AACnD,SAAI,GAAU;MACZ,IAAM,IAAW,EAAc,IAAI,EAAG,IAAI,EAAG,aAAa,EAAS,IAAI;AACvE,QAAG,aAAa,GAAU,EAAE,EAAS,CAAC;WAGtC,GAAG,cAAc,GADN,EAAQ,OAAO,EAAc,IAAI,EAAG,IAAI,IAC7B,MAAM,EAAE,EAAQ,SAAS,OAA8B,KAAA,IAAvB,EAAE,GAAG,EAAQ,OAAO,CAAa;;IAG5F,CAAC;;EAEJ,QAAQ;EACT;;;;ACzeH,IAAa,MAAoB,GAAG,MAAqB;AACvD,OAAU,MACR,8LAGD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.cjs","names":[],"sources":["../src/server.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport { createFluentiCore } from '@fluenti/core'\nimport type {\n FluentiCoreInstanceFull,\n FluentiCoreConfigFull,\n Locale,\n Messages,\n DateFormatOptions,\n NumberFormatOptions,\n} from '@fluenti/core'\n\n// Re-export SSR utilities from core for convenience\nexport { detectLocale, getSSRLocaleScript, getHydratedLocale, isRTL, getDirection } from '@fluenti/core'\nexport type { DetectLocaleOptions } from '@fluenti/core'\n\n/**\n * Configuration for `createServerI18n`.\n */\nexport interface ServerI18nConfig {\n /** Load messages for a given locale. Called once per locale per request. */\n loadMessages: (locale: string) => Promise<Messages | { default: Messages }>\n /** Fallback locale when a translation is missing */\n fallbackLocale?: string\n /**\n * Auto-resolve locale when `setLocale()` was not called.\n *\n * Common patterns for Vue/Nuxt SSR:\n * - Read from a cookie via `useCookie()` or `useRequestEvent()`\n * - Read from a request header set by middleware\n *\n * If omitted and `setLocale()` was not called, `getI18n()` will throw.\n */\n resolveLocale?: () => string | Promise<string>\n /** Custom fallback chains per locale */\n fallbackChain?: Record<string, Locale[]>\n /** Custom date format styles */\n dateFormats?: DateFormatOptions\n /** Custom number format styles */\n numberFormats?: NumberFormatOptions\n /** Handler for missing translation keys */\n missing?: (locale: Locale, id: string) => string | undefined\n}\n\n/**\n * The object returned by `createServerI18n`.\n */\nexport interface ServerI18n {\n /**\n * Set the locale for the current server request.\n * Call this once in your server plugin or middleware before any `getI18n()` calls.\n */\n setLocale: (locale: string) => void\n\n /**\n * Get a fully configured i18n instance for the current request.\n * Messages are loaded lazily and cached.\n */\n getI18n: () => Promise<FluentiCoreInstanceFull & { locale: string }>\n\n /**\n * Run a callback with per-request locale isolation.\n *\n * Uses `AsyncLocalStorage` to scope locale and instance to the callback,\n * preventing cross-request locale leakage in concurrent SSR environments.\n *\n * @example\n * ```ts\n * // In your server middleware\n * app.use(async (req, res, next) => {\n * const locale = detectLocale({ headers: req.headers, available: ['en', 'de'], fallback: 'en' })\n * await withLocale(locale, () => next())\n * })\n * ```\n */\n withLocale: <T>(locale: string, fn: () => T | Promise<T>) => Promise<T>\n}\n\n/** Per-request store shape */\ninterface RequestStore {\n locale: string | null\n instance: (FluentiCoreInstanceFull & { locale: string }) | null\n}\n\n/**\n * Create server-side i18n utilities for Vue SSR / Nuxt.\n *\n * Uses `AsyncLocalStorage` for per-request isolation of locale state.\n * Wrap each request in `withLocale(locale, fn)` for safe concurrent SSR,\n * or use `setLocale()` / `getI18n()` directly if concurrency is not a concern.\n *\n * @example\n * ```ts\n * // server/i18n.ts\n * import { createServerI18n } from '@fluenti/vue/server'\n *\n * export const { setLocale, getI18n, withLocale } = createServerI18n({\n * loadMessages: (locale) => import(`../locales/compiled/${locale}.ts`),\n * fallbackLocale: 'en',\n * })\n * ```\n *\n * @example Per-request isolation (recommended for concurrent SSR):\n * ```ts\n * // server/middleware/i18n.ts\n * import { withLocale } from './i18n'\n *\n * export default defineEventHandler(async (event) => {\n * const locale = detectLocaleFromEvent(event)\n * return withLocale(locale, () => handleRequest(event))\n * })\n * ```\n */\nexport function createServerI18n(config: ServerI18nConfig): ServerI18n {\n const als = new AsyncLocalStorage<RequestStore>()\n\n // Module-level message cache — safe to share across requests (keyed by locale)\n const messageCache = new Map<string, Messages>()\n\n // Module-level fallback store for when ALS context is not active\n let fallbackStore: RequestStore = { locale: null, instance: null }\n\n function getStore(): RequestStore {\n return als.getStore() ?? fallbackStore\n }\n\n function setLocale(locale: string): void {\n const store = getStore()\n store.locale = locale\n store.instance = null\n }\n\n async function loadLocaleMessages(locale: string): Promise<Messages> {\n const cached = messageCache.get(locale)\n if (cached) return cached\n\n const raw = await config.loadMessages(locale)\n const messages: Messages =\n typeof raw === 'object' && raw !== null && 'default' in raw\n ? (raw as { default: Messages }).default\n : (raw as Messages)\n\n messageCache.set(locale, messages)\n return messages\n }\n\n async function buildInstance(locale: string): Promise<FluentiCoreInstanceFull & { locale: string }> {\n const allMessages: Record<string, Messages> = {}\n allMessages[locale] = await loadLocaleMessages(locale)\n\n if (config.fallbackLocale && config.fallbackLocale !== locale) {\n allMessages[config.fallbackLocale] = await loadLocaleMessages(config.fallbackLocale)\n }\n\n const fluentConfig: FluentiCoreConfigFull = {\n locale,\n messages: allMessages,\n }\n if (config.fallbackLocale !== undefined) fluentConfig.fallbackLocale = config.fallbackLocale\n if (config.fallbackChain !== undefined) fluentConfig.fallbackChain = config.fallbackChain\n if (config.dateFormats !== undefined) fluentConfig.dateFormats = config.dateFormats\n if (config.numberFormats !== undefined) fluentConfig.numberFormats = config.numberFormats\n if (config.missing !== undefined) fluentConfig.missing = config.missing\n\n return createFluentiCore(fluentConfig)\n }\n\n async function getI18n(): Promise<FluentiCoreInstanceFull & { locale: string }> {\n const store = getStore()\n\n // If setLocale() was never called, try the resolveLocale fallback.\n if (!store.locale && config.resolveLocale) {\n store.locale = await config.resolveLocale()\n }\n\n const locale = store.locale\n\n if (!locale) {\n throw new Error(\n '[fluenti] No locale set. Call setLocale(locale) in your server plugin or middleware before using getI18n(), ' +\n 'or provide a resolveLocale function in createServerI18n config to auto-detect locale ' +\n 'in server functions and other contexts where the layout does not run.',\n )\n }\n\n // Return cached instance if locale hasn't changed\n if (store.instance && store.instance.locale === locale) {\n return store.instance\n }\n\n store.instance = await buildInstance(locale)\n return store.instance\n }\n\n async function withLocale<T>(locale: string, fn: () => T | Promise<T>): Promise<T> {\n const store: RequestStore = { locale, instance: null }\n return als.run(store, async () => {\n return fn()\n })\n }\n\n return { setLocale, getI18n, withLocale }\n}\n"],"mappings":"gIAgHA,SAAgB,EAAiB,EAAsC,CACrE,IAAM,EAAM,IAAI,EAAA,kBAGV,EAAe,IAAI,IAGrB,EAA8B,CAAE,OAAQ,KAAM,SAAU,KAAM,CAElE,SAAS,GAAyB,CAChC,OAAO,EAAI,UAAU,EAAI,EAG3B,SAAS,EAAU,EAAsB,CACvC,IAAM,EAAQ,GAAU,CACxB,EAAM,OAAS,EACf,EAAM,SAAW,KAGnB,eAAe,EAAmB,EAAmC,CACnE,IAAM,EAAS,EAAa,IAAI,EAAO,CACvC,GAAI,EAAQ,OAAO,EAEnB,IAAM,EAAM,MAAM,EAAO,aAAa,EAAO,CACvC,EACJ,OAAO,GAAQ,UAAY,GAAgB,YAAa,EACnD,EAA8B,QAC9B,EAGP,OADA,EAAa,IAAI,EAAQ,EAAS,CAC3B,EAGT,eAAe,EAAc,EAAuE,CAClG,IAAM,EAAwC,EAAE,CAChD,EAAY,GAAU,MAAM,EAAmB,EAAO,CAElD,EAAO,gBAAkB,EAAO,iBAAmB,IACrD,EAAY,EAAO,gBAAkB,MAAM,EAAmB,EAAO,eAAe,EAGtF,IAAM,EAAsC,CAC1C,SACA,SAAU,EACX,CAOD,OANI,EAAO,iBAAmB,IAAA,KAAW,EAAa,eAAiB,EAAO,gBAC1E,EAAO,gBAAkB,IAAA,KAAW,EAAa,cAAgB,EAAO,eACxE,EAAO,cAAgB,IAAA,KAAW,EAAa,YAAc,EAAO,aACpE,EAAO,gBAAkB,IAAA,KAAW,EAAa,cAAgB,EAAO,eACxE,EAAO,UAAY,IAAA,KAAW,EAAa,QAAU,EAAO,UAEhE,EAAA,EAAA,mBAAyB,EAAa,CAGxC,eAAe,GAAiE,CAC9E,IAAM,EAAQ,GAAU,CAGpB,CAAC,EAAM,QAAU,EAAO,gBAC1B,EAAM,OAAS,MAAM,EAAO,eAAe,EAG7C,IAAM,EAAS,EAAM,OAErB,GAAI,CAAC,EACH,MAAU,MACR,yQAGD,CASH,OALI,EAAM,UAAY,EAAM,SAAS,SAAW,IAIhD,EAAM,SAAW,MAAM,EAAc,EAAO,EAHnC,EAAM,SAOjB,eAAe,EAAc,EAAgB,EAAsC,CACjF,IAAM,EAAsB,CAAE,SAAQ,SAAU,KAAM,CACtD,OAAO,EAAI,IAAI,EAAO,SACb,GAAI,CACX,CAGJ,MAAO,CAAE,YAAW,UAAS,aAAY"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","names":[],"sources":["../src/server.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport { createFluentiCore } from '@fluenti/core'\nimport type {\n FluentiCoreInstanceFull,\n FluentiCoreConfigFull,\n Locale,\n Messages,\n DateFormatOptions,\n NumberFormatOptions,\n} from '@fluenti/core'\n\n// Re-export SSR utilities from core for convenience\nexport { detectLocale, getSSRLocaleScript, getHydratedLocale, isRTL, getDirection } from '@fluenti/core'\nexport type { DetectLocaleOptions } from '@fluenti/core'\n\n/**\n * Configuration for `createServerI18n`.\n */\nexport interface ServerI18nConfig {\n /** Load messages for a given locale. Called once per locale per request. */\n loadMessages: (locale: string) => Promise<Messages | { default: Messages }>\n /** Fallback locale when a translation is missing */\n fallbackLocale?: string\n /**\n * Auto-resolve locale when `setLocale()` was not called.\n *\n * Common patterns for Vue/Nuxt SSR:\n * - Read from a cookie via `useCookie()` or `useRequestEvent()`\n * - Read from a request header set by middleware\n *\n * If omitted and `setLocale()` was not called, `getI18n()` will throw.\n */\n resolveLocale?: () => string | Promise<string>\n /** Custom fallback chains per locale */\n fallbackChain?: Record<string, Locale[]>\n /** Custom date format styles */\n dateFormats?: DateFormatOptions\n /** Custom number format styles */\n numberFormats?: NumberFormatOptions\n /** Handler for missing translation keys */\n missing?: (locale: Locale, id: string) => string | undefined\n}\n\n/**\n * The object returned by `createServerI18n`.\n */\nexport interface ServerI18n {\n /**\n * Set the locale for the current server request.\n * Call this once in your server plugin or middleware before any `getI18n()` calls.\n */\n setLocale: (locale: string) => void\n\n /**\n * Get a fully configured i18n instance for the current request.\n * Messages are loaded lazily and cached.\n */\n getI18n: () => Promise<FluentiCoreInstanceFull & { locale: string }>\n\n /**\n * Run a callback with per-request locale isolation.\n *\n * Uses `AsyncLocalStorage` to scope locale and instance to the callback,\n * preventing cross-request locale leakage in concurrent SSR environments.\n *\n * @example\n * ```ts\n * // In your server middleware\n * app.use(async (req, res, next) => {\n * const locale = detectLocale({ headers: req.headers, available: ['en', 'de'], fallback: 'en' })\n * await withLocale(locale, () => next())\n * })\n * ```\n */\n withLocale: <T>(locale: string, fn: () => T | Promise<T>) => Promise<T>\n}\n\n/** Per-request store shape */\ninterface RequestStore {\n locale: string | null\n instance: (FluentiCoreInstanceFull & { locale: string }) | null\n}\n\n/**\n * Create server-side i18n utilities for Vue SSR / Nuxt.\n *\n * Uses `AsyncLocalStorage` for per-request isolation of locale state.\n * Wrap each request in `withLocale(locale, fn)` for safe concurrent SSR,\n * or use `setLocale()` / `getI18n()` directly if concurrency is not a concern.\n *\n * @example\n * ```ts\n * // server/i18n.ts\n * import { createServerI18n } from '@fluenti/vue/server'\n *\n * export const { setLocale, getI18n, withLocale } = createServerI18n({\n * loadMessages: (locale) => import(`../locales/compiled/${locale}.ts`),\n * fallbackLocale: 'en',\n * })\n * ```\n *\n * @example Per-request isolation (recommended for concurrent SSR):\n * ```ts\n * // server/middleware/i18n.ts\n * import { withLocale } from './i18n'\n *\n * export default defineEventHandler(async (event) => {\n * const locale = detectLocaleFromEvent(event)\n * return withLocale(locale, () => handleRequest(event))\n * })\n * ```\n */\nexport function createServerI18n(config: ServerI18nConfig): ServerI18n {\n const als = new AsyncLocalStorage<RequestStore>()\n\n // Module-level message cache — safe to share across requests (keyed by locale)\n const messageCache = new Map<string, Messages>()\n\n // Module-level fallback store for when ALS context is not active\n let fallbackStore: RequestStore = { locale: null, instance: null }\n\n function getStore(): RequestStore {\n return als.getStore() ?? fallbackStore\n }\n\n function setLocale(locale: string): void {\n const store = getStore()\n store.locale = locale\n store.instance = null\n }\n\n async function loadLocaleMessages(locale: string): Promise<Messages> {\n const cached = messageCache.get(locale)\n if (cached) return cached\n\n const raw = await config.loadMessages(locale)\n const messages: Messages =\n typeof raw === 'object' && raw !== null && 'default' in raw\n ? (raw as { default: Messages }).default\n : (raw as Messages)\n\n messageCache.set(locale, messages)\n return messages\n }\n\n async function buildInstance(locale: string): Promise<FluentiCoreInstanceFull & { locale: string }> {\n const allMessages: Record<string, Messages> = {}\n allMessages[locale] = await loadLocaleMessages(locale)\n\n if (config.fallbackLocale && config.fallbackLocale !== locale) {\n allMessages[config.fallbackLocale] = await loadLocaleMessages(config.fallbackLocale)\n }\n\n const fluentConfig: FluentiCoreConfigFull = {\n locale,\n messages: allMessages,\n }\n if (config.fallbackLocale !== undefined) fluentConfig.fallbackLocale = config.fallbackLocale\n if (config.fallbackChain !== undefined) fluentConfig.fallbackChain = config.fallbackChain\n if (config.dateFormats !== undefined) fluentConfig.dateFormats = config.dateFormats\n if (config.numberFormats !== undefined) fluentConfig.numberFormats = config.numberFormats\n if (config.missing !== undefined) fluentConfig.missing = config.missing\n\n return createFluentiCore(fluentConfig)\n }\n\n async function getI18n(): Promise<FluentiCoreInstanceFull & { locale: string }> {\n const store = getStore()\n\n // If setLocale() was never called, try the resolveLocale fallback.\n if (!store.locale && config.resolveLocale) {\n store.locale = await config.resolveLocale()\n }\n\n const locale = store.locale\n\n if (!locale) {\n throw new Error(\n '[fluenti] No locale set. Call setLocale(locale) in your server plugin or middleware before using getI18n(), ' +\n 'or provide a resolveLocale function in createServerI18n config to auto-detect locale ' +\n 'in server functions and other contexts where the layout does not run.',\n )\n }\n\n // Return cached instance if locale hasn't changed\n if (store.instance && store.instance.locale === locale) {\n return store.instance\n }\n\n store.instance = await buildInstance(locale)\n return store.instance\n }\n\n async function withLocale<T>(locale: string, fn: () => T | Promise<T>): Promise<T> {\n const store: RequestStore = { locale, instance: null }\n return als.run(store, async () => {\n return fn()\n })\n }\n\n return { setLocale, getI18n, withLocale }\n}\n"],"mappings":";;;AAgHA,SAAgB,EAAiB,GAAsC;CACrE,IAAM,IAAM,IAAI,GAAiC,EAG3C,oBAAe,IAAI,KAAuB,EAG5C,IAA8B;EAAE,QAAQ;EAAM,UAAU;EAAM;CAElE,SAAS,IAAyB;AAChC,SAAO,EAAI,UAAU,IAAI;;CAG3B,SAAS,EAAU,GAAsB;EACvC,IAAM,IAAQ,GAAU;AAExB,EADA,EAAM,SAAS,GACf,EAAM,WAAW;;CAGnB,eAAe,EAAmB,GAAmC;EACnE,IAAM,IAAS,EAAa,IAAI,EAAO;AACvC,MAAI,EAAQ,QAAO;EAEnB,IAAM,IAAM,MAAM,EAAO,aAAa,EAAO,EACvC,IACJ,OAAO,KAAQ,YAAY,KAAgB,aAAa,IACnD,EAA8B,UAC9B;AAGP,SADA,EAAa,IAAI,GAAQ,EAAS,EAC3B;;CAGT,eAAe,EAAc,GAAuE;EAClG,IAAM,IAAwC,EAAE;AAGhD,EAFA,EAAY,KAAU,MAAM,EAAmB,EAAO,EAElD,EAAO,kBAAkB,EAAO,mBAAmB,MACrD,EAAY,EAAO,kBAAkB,MAAM,EAAmB,EAAO,eAAe;EAGtF,IAAM,IAAsC;GAC1C;GACA,UAAU;GACX;AAOD,SANI,EAAO,mBAAmB,KAAA,MAAW,EAAa,iBAAiB,EAAO,iBAC1E,EAAO,kBAAkB,KAAA,MAAW,EAAa,gBAAgB,EAAO,gBACxE,EAAO,gBAAgB,KAAA,MAAW,EAAa,cAAc,EAAO,cACpE,EAAO,kBAAkB,KAAA,MAAW,EAAa,gBAAgB,EAAO,gBACxE,EAAO,YAAY,KAAA,MAAW,EAAa,UAAU,EAAO,UAEzD,EAAkB,EAAa;;CAGxC,eAAe,IAAiE;EAC9E,IAAM,IAAQ,GAAU;AAGxB,EAAI,CAAC,EAAM,UAAU,EAAO,kBAC1B,EAAM,SAAS,MAAM,EAAO,eAAe;EAG7C,IAAM,IAAS,EAAM;AAErB,MAAI,CAAC,EACH,OAAU,MACR,yQAGD;AASH,SALI,EAAM,YAAY,EAAM,SAAS,WAAW,MAIhD,EAAM,WAAW,MAAM,EAAc,EAAO,GAHnC,EAAM;;CAOjB,eAAe,EAAc,GAAgB,GAAsC;EACjF,IAAM,IAAsB;GAAE;GAAQ,UAAU;GAAM;AACtD,SAAO,EAAI,IAAI,GAAO,YACb,GAAI,CACX;;AAGJ,QAAO;EAAE;EAAW;EAAS;EAAY"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-plugin.cjs","names":[],"sources":["../src/vue-runtime.ts","../src/vite-plugin.ts"],"sourcesContent":["import { createRuntimeGenerator } from '@fluenti/vite-plugin'\nimport type { RuntimeGenerator } from '@fluenti/vite-plugin'\n\nexport const vueRuntimeGenerator: RuntimeGenerator = createRuntimeGenerator({\n imports: `import { shallowReactive, ref } from 'vue'`,\n catalogInit: 'const __catalog = shallowReactive({ ...__defaultMsgs })',\n localeInit: (defaultLocale) => `const __currentLocale = ref(${JSON.stringify(defaultLocale)})`,\n loadingInit: 'const __loading = ref(false)',\n catalogUpdate: (msgs) => `Object.assign(__catalog, ${msgs})`,\n localeUpdate: (locale) => `__currentLocale.value = ${locale}`,\n loadingUpdate: (value) => `__loading.value = ${value}`,\n localeRead: '__currentLocale.value',\n runtimeKey: 'fluenti.runtime.vue.v1',\n})\n","import type { Plugin } from 'vite'\nimport type { FluentiPluginOptions } from '@fluenti/vite-plugin'\nimport { createFluentiPlugins } from '@fluenti/vite-plugin'\nimport { transformVtDirectives } from '@fluenti/vite-plugin/sfc-transform'\nimport { vueRuntimeGenerator } from './vue-runtime'\n\nexport type { FluentiPluginOptions as FluentiVueOptions } from '@fluenti/vite-plugin'\n\n/**\n * Fluenti Vue 3 Vite plugin.\n *\n * @example Minimal — no fluenti.config.ts needed\n * ```ts\n * // vite.config.ts\n * import fluentiVue from '@fluenti/vue/vite-plugin'\n *\n * export default defineConfig({\n * plugins: [fluentiVue({ config: { locales: ['en', 'ja'] } })],\n * })\n * ```\n *\n * @example With fluenti.config.ts (for advanced options)\n * ```ts\n * export default defineConfig({\n * plugins: [fluentiVue()], // auto-reads fluenti.config.ts\n * })\n * ```\n */\nexport default function fluentiVue(options?: FluentiPluginOptions): Plugin[] {\n const vueTemplatePlugin: Plugin = {\n name: 'fluenti:vue-template',\n enforce: 'pre',\n transform(code, id) {\n if (!id.endsWith('.vue')) return undefined\n if (!/\\bv-t\\b/.test(code) && !/<Trans[\\s>]/.test(code) && !/<Plural[\\s/>]/.test(code)) return undefined\n\n const transformed = transformVtDirectives(code)\n if (transformed === code) return undefined\n\n return { code: transformed, map: null }\n },\n }\n\n return createFluentiPlugins(\n { ...(options?.config !== undefined ? { config: options.config } : {}), framework: 'vue' },\n [vueTemplatePlugin],\n vueRuntimeGenerator,\n )\n}\n"],"mappings":"sFAGA,IAAa,GAAA,EAAA,EAAA,wBAA+D,CAC1E,QAAS,6CACT,YAAa,0DACb,WAAa,GAAkB,+BAA+B,KAAK,UAAU,EAAc,CAAC,GAC5F,YAAa,+BACb,cAAgB,GAAS,4BAA4B,EAAK,GAC1D,aAAe,GAAW,2BAA2B,IACrD,cAAgB,GAAU,qBAAqB,IAC/C,WAAY,wBACZ,WAAY,yBACb,CAAC,CCeF,SAAwB,EAAW,EAA0C,CAC3E,IAAM,EAA4B,CAChC,KAAM,uBACN,QAAS,MACT,UAAU,EAAM,EAAI,CAElB,GADI,CAAC,EAAG,SAAS,OAAO,EACpB,CAAC,UAAU,KAAK,EAAK,EAAI,CAAC,cAAc,KAAK,EAAK,EAAI,CAAC,gBAAgB,KAAK,EAAK,CAAE,OAEvF,IAAM,GAAA,EAAA,EAAA,uBAAoC,EAAK,CAC3C,OAAgB,EAEpB,MAAO,CAAE,KAAM,EAAa,IAAK,KAAM,EAE1C,CAED,OAAA,EAAA,EAAA,sBACE,CAAE,GAAI,GAAS,SAAW,IAAA,GAAyC,EAAE,CAA/B,CAAE,OAAQ,EAAQ,OAAQ,CAAQ,UAAW,MAAO,CAC1F,CAAC,EAAkB,CACnB,EACD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite-plugin.js","names":[],"sources":["../src/vue-runtime.ts","../src/vite-plugin.ts"],"sourcesContent":["import { createRuntimeGenerator } from '@fluenti/vite-plugin'\nimport type { RuntimeGenerator } from '@fluenti/vite-plugin'\n\nexport const vueRuntimeGenerator: RuntimeGenerator = createRuntimeGenerator({\n imports: `import { shallowReactive, ref } from 'vue'`,\n catalogInit: 'const __catalog = shallowReactive({ ...__defaultMsgs })',\n localeInit: (defaultLocale) => `const __currentLocale = ref(${JSON.stringify(defaultLocale)})`,\n loadingInit: 'const __loading = ref(false)',\n catalogUpdate: (msgs) => `Object.assign(__catalog, ${msgs})`,\n localeUpdate: (locale) => `__currentLocale.value = ${locale}`,\n loadingUpdate: (value) => `__loading.value = ${value}`,\n localeRead: '__currentLocale.value',\n runtimeKey: 'fluenti.runtime.vue.v1',\n})\n","import type { Plugin } from 'vite'\nimport type { FluentiPluginOptions } from '@fluenti/vite-plugin'\nimport { createFluentiPlugins } from '@fluenti/vite-plugin'\nimport { transformVtDirectives } from '@fluenti/vite-plugin/sfc-transform'\nimport { vueRuntimeGenerator } from './vue-runtime'\n\nexport type { FluentiPluginOptions as FluentiVueOptions } from '@fluenti/vite-plugin'\n\n/**\n * Fluenti Vue 3 Vite plugin.\n *\n * @example Minimal — no fluenti.config.ts needed\n * ```ts\n * // vite.config.ts\n * import fluentiVue from '@fluenti/vue/vite-plugin'\n *\n * export default defineConfig({\n * plugins: [fluentiVue({ config: { locales: ['en', 'ja'] } })],\n * })\n * ```\n *\n * @example With fluenti.config.ts (for advanced options)\n * ```ts\n * export default defineConfig({\n * plugins: [fluentiVue()], // auto-reads fluenti.config.ts\n * })\n * ```\n */\nexport default function fluentiVue(options?: FluentiPluginOptions): Plugin[] {\n const vueTemplatePlugin: Plugin = {\n name: 'fluenti:vue-template',\n enforce: 'pre',\n transform(code, id) {\n if (!id.endsWith('.vue')) return undefined\n if (!/\\bv-t\\b/.test(code) && !/<Trans[\\s>]/.test(code) && !/<Plural[\\s/>]/.test(code)) return undefined\n\n const transformed = transformVtDirectives(code)\n if (transformed === code) return undefined\n\n return { code: transformed, map: null }\n },\n }\n\n return createFluentiPlugins(\n { ...(options?.config !== undefined ? { config: options.config } : {}), framework: 'vue' },\n [vueTemplatePlugin],\n vueRuntimeGenerator,\n )\n}\n"],"mappings":";;;AAGA,IAAa,IAAwC,EAAuB;CAC1E,SAAS;CACT,aAAa;CACb,aAAa,MAAkB,+BAA+B,KAAK,UAAU,EAAc,CAAC;CAC5F,aAAa;CACb,gBAAgB,MAAS,4BAA4B,EAAK;CAC1D,eAAe,MAAW,2BAA2B;CACrD,gBAAgB,MAAU,qBAAqB;CAC/C,YAAY;CACZ,YAAY;CACb,CAAC;;;ACeF,SAAwB,EAAW,GAA0C;CAC3E,IAAM,IAA4B;EAChC,MAAM;EACN,SAAS;EACT,UAAU,GAAM,GAAI;AAElB,OADI,CAAC,EAAG,SAAS,OAAO,IACpB,CAAC,UAAU,KAAK,EAAK,IAAI,CAAC,cAAc,KAAK,EAAK,IAAI,CAAC,gBAAgB,KAAK,EAAK,CAAE;GAEvF,IAAM,IAAc,EAAsB,EAAK;AAC3C,aAAgB,EAEpB,QAAO;IAAE,MAAM;IAAa,KAAK;IAAM;;EAE1C;AAED,QAAO,EACL;EAAE,GAAI,GAAS,WAAW,KAAA,IAAyC,EAAE,GAA/B,EAAE,QAAQ,EAAQ,QAAQ;EAAQ,WAAW;EAAO,EAC1F,CAAC,EAAkB,EACnB,EACD"}
@@ -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,Q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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,CAAA;AAK/E;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,QAAA,MAAM,WAAW;IACf,yDAAyD;;;;;IAEzD,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mDAAmD;;;;;IAEnD;;;;;OAKG;;uBAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD,mEAAmE;;;;;CAE3D,CAAA;AAEV,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;AAE/E,eAAO,MAAM,MAAM;IA1BjB,yDAAyD;;;;;IAEzD,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mDAAmD;;;;;IAEnD;;;;;OAKG;;uBAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD,mEAAmE;;;;;;;;IApBnE,yDAAyD;;;;;IAEzD,2DAA2D;;IAE3D,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mDAAmD;;;;;IAEnD;;;;;OAKG;;uBAEe,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;IAGlD,mEAAmE;;;;;;;;4EAyDnE,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Trans.d.ts","sourceRoot":"","sources":["../../../../src/components/Trans.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAI3C;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,UAAU;IACd,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mEAAmE;;;;;CAE3D,CAAA;AAEV,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC,gBAAgB,CAAC,OAAO,UAAU,CAAC,CAAC,CAAA;AAE7E,eAAO,MAAM,KAAK;IAZhB,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mEAAmE;;;;;;;;IANnE,sCAAsC;;IAEtC,sEAAsE;;IAEtE,8DAA8D;;IAE9D,mEAAmE;;;;;;;4EA8BnE,CAAA"}
@@ -1 +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.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"}
@@ -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"}
@@ -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,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"}
@@ -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,CAAqC,CAAA"}
@@ -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"}
@@ -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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AExB"}
@@ -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"}
@@ -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"}