vue-intlayer 9.8.4 → 9.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -190,6 +190,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
190
190
  <li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React using Compiler</a></li>
191
191
  <li><a href="https://intlayer.org/doc/environment/vite-and-react/react-router-v7" rel=''>React-router-v7</a></li>
192
192
  <li><a href="https://intlayer.org/doc/environment/remix-3" rel=''>Remix 3</a></li>
193
+ <li><a href="https://intlayer.org/doc/environment/vinext" rel=''>vinext (Next.js on Vite)</a></li>
193
194
  <li><a href="https://intlayer.org/doc/environment/tanstack-start" rel=''>Tanstack start</a>
194
195
  <ul>
195
196
  <li><a href="https://intlayer.org/doc/environment/tanstack-start/solid" rel=''>Solid</a></li>
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./installIntlayer.cjs"),t=require("./useDictionary.cjs"),n=require("./useDictionaryAsync.cjs"),r=require("./useDictionaryDynamic.cjs"),i=require("./useIntlayer.cjs"),a=require("./useLoadDynamic.cjs"),o=require("./useLocale.cjs"),s=require("./usePathname.cjs"),c=require("./useRewriteURL.cjs");exports.INTLAYER_SYMBOL=e.INTLAYER_SYMBOL,exports.atPath=t.atPath,exports.createIntlayerClient=e.createIntlayerClient,exports.createIntlayerLeafProxy=t.createIntlayerLeafProxy,exports.installIntlayer=e.installIntlayer,exports.intlayer=e.intlayer,exports.isComponentLike=t.isComponentLike,exports.isIntlayerNode=t.isIntlayerNode,exports.isObjectLike=t.isObjectLike,exports.toComponent=t.toComponent,exports.useDictionary=t.useDictionary,exports.useDictionaryAsync=n.useDictionaryAsync,exports.useDictionaryDynamic=r.useDictionaryDynamic,exports.useIntlayer=i.useIntlayer,exports.useLoadDynamic=a.useLoadDynamic,exports.useLocale=o.useLocale,exports.usePathname=s.usePathname,exports.useRewriteURL=c.useRewriteURL;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./installIntlayer.cjs"),t=require("./useDictionary.cjs"),n=require("./useDictionaryAsync.cjs"),r=require("./useDictionaryDynamic.cjs"),i=require("./useIntlayer.cjs"),a=require("./useLoadDynamic.cjs"),o=require("./useLocale.cjs"),s=require("./usePathname.cjs"),c=require("./useRewriteURL.cjs");exports.INTLAYER_SYMBOL=e.INTLAYER_SYMBOL,exports.atPath=t.atPath,exports.createContentProxy=t.createContentProxy,exports.createIntlayerClient=e.createIntlayerClient,exports.createIntlayerLeafProxy=t.createIntlayerLeafProxy,exports.injectIntlayerProvider=t.injectIntlayerProvider,exports.installIntlayer=e.installIntlayer,exports.intlayer=e.intlayer,exports.isComponentLike=t.isComponentLike,exports.isIntlayerNode=t.isIntlayerNode,exports.isObjectLike=t.isObjectLike,exports.toComponent=t.toComponent,exports.useDictionary=t.useDictionary,exports.useDictionaryAsync=n.useDictionaryAsync,exports.useDictionaryDynamic=r.useDictionaryDynamic,exports.useDynamicContent=r.useDynamicContent,exports.useIntlayer=i.useIntlayer,exports.useLoadDynamic=a.useLoadDynamic,exports.useLocale=o.useLocale,exports.usePathname=s.usePathname,exports.useResolvedContent=t.useResolvedContent,exports.useRewriteURL=c.useRewriteURL;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./installIntlayer.cjs");let n=require("@intlayer/core/interpreter"),r=require("vue"),i=require("@intlayer/core/dictionaryManipulator");var a=(e,t)=>t.reduce((e,t)=>e?.[t],e),o=e=>typeof e==`object`&&!!e,s=e=>typeof e==`function`||o(e)&&(`render`in e||`setup`in e),c=e=>e!=null&&(typeof e==`object`||typeof e==`function`)&&`__update`in e&&`render`in e&&`raw`in e,l=e=>(0,r.markRaw)((0,r.defineComponent)({name:`IntlayerLeaf`,setup(){return()=>{let t=e();return t==null?null:s(t)?(0,r.h)(t):Array.isArray(t)?(0,r.h)(`span`,t):t}}})),u=e=>new Proxy({},{get(t,n){let r=e.value;if(n===`__v_isRef`)return!0;if(n===`value`)return r??``;if(n===`$raw`)return e;if(n===`__v_skip`)return!0;if(n===`c`||n===`asComponent`)return l(()=>e.value);if(r==null)return n===Symbol.toPrimitive||n===`toString`?()=>``:void 0;let i=r[n];return typeof i==`function`?i.bind(r):i},ownKeys(){let t=e.value;return typeof t==`object`&&t?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}}),d=(d,f)=>{let p=(0,r.getCurrentInstance)()?(0,r.inject)(t.INTLAYER_SYMBOL):void 0,m=(0,r.isRef)(p?.locale)?p.locale:(0,r.ref)(p?.locale??(0,n.resolveInterpreterLocale)()),h=(0,r.computed)(()=>{let e=f===void 0?void 0:(0,r.toValue)(f);if(process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`){let t=(0,i.resolveDictionaryArgument)({localeOrSelector:e,contextLocale:m.value,contextVariant:p?.variant?.value,dictionaryKey:(0,r.toValue)(d).key});return(0,i.parseDictionarySelector)(t)}return{selector:void 0,locale:e}}),g=(0,r.computed)(()=>h.value.locale??m.value),_=(0,r.shallowRef)({});(0,r.watch)([()=>(0,r.toValue)(d),()=>g.value,()=>h.value.selector],([t,n,r])=>{_.value=r?e.getDictionary(t,{...r,locale:n}):e.getDictionary(t,n)},{immediate:!0,flush:`sync`});let v=e=>new Proxy({},{get(t,n,i){let d=(0,r.computed)(()=>a(_.value,e));if(typeof n==`symbol`||typeof n==`string`&&(n.startsWith(`__`)||n.startsWith(`$`)))return n===`__v_isRef`?!0:n===`$raw`?d:n===Symbol.toPrimitive?()=>String(d.value??``):Reflect.get(t,n,i);if(n===`value`)return d.value??``;if(n===`then`)return;if(n===`c`||n===`asComponent`)return l(()=>d.value);let f=e.concat(n),p=a(_.value,f);if(p===void 0||o(p)&&!s(p))return v(f);if(c(p))return u((0,r.computed)(()=>a(_.value,f)));if(typeof p==`function`){let t=a(_.value,e);return t!=null&&!Object.hasOwn(t,n)?p.bind(t):(...e)=>a(_.value,f)?.(...e)}let m=(0,r.computed)(()=>a(_.value,f));return new Proxy(m,{get(e,t,n){return t===`value`?e.value??``:Reflect.get(e,t,n)}})},ownKeys(){let t=a(_.value,e);return o(t)?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return v([])};exports.atPath=a,exports.createIntlayerLeafProxy=u,exports.isComponentLike=s,exports.isIntlayerNode=c,exports.isObjectLike=o,exports.toComponent=l,exports.useDictionary=d;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./installIntlayer.cjs");let n=require("vue"),r=require("@intlayer/core/dictionaryManipulator");var i=(e,t)=>t.reduce((e,t)=>e?.[t],e),a=e=>typeof e==`object`&&!!e,o=e=>typeof e==`function`||a(e)&&(`render`in e||`setup`in e),s=e=>e!=null&&(typeof e==`object`||typeof e==`function`)&&`__update`in e&&`render`in e&&`raw`in e,c=e=>(0,n.markRaw)((0,n.defineComponent)({name:`IntlayerLeaf`,setup(){return()=>{let t=e();return t==null?null:o(t)?(0,n.h)(t):Array.isArray(t)?(0,n.h)(`span`,t):t}}})),l=e=>new Proxy({},{get(t,n){let r=e.value;if(n===`__v_isRef`)return!0;if(n===`value`)return r??``;if(n===`$raw`)return e;if(n===`__v_skip`)return!0;if(n===`c`||n===`asComponent`)return c(()=>e.value);if(r==null)return n===Symbol.toPrimitive||n===`toString`?()=>``:void 0;let i=r[n];return typeof i==`function`?i.bind(r):i},ownKeys(){let t=e.value;return typeof t==`object`&&t?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}}),u=()=>(0,n.hasInjectionContext)()?(0,n.inject)(t.INTLAYER_SYMBOL,void 0):void 0,d=e=>{let t=new Map,r=u=>{let d=u.join(`\0`),f=t.get(d);if(f)return f;let p=(0,n.computed)(()=>i(e.value,u)),m=new Proxy({},{get(t,d,f){if(typeof d==`symbol`||typeof d==`string`&&(d.startsWith(`__`)||d.startsWith(`$`)))return d===`__v_isRef`?!0:d===`$raw`?p:d===Symbol.toPrimitive?()=>String(p.value??``):Reflect.get(t,d,f);if(d===`value`)return p.value??``;if(d===`then`)return;if(d===`c`||d===`asComponent`)return c(()=>p.value);let m=u.concat(d),h=i(e.value,m);if(h===void 0||a(h)&&!o(h))return r(m);if(s(h))return l((0,n.computed)(()=>i(e.value,m)));if(typeof h==`function`){let t=i(e.value,u);return t!=null&&!Object.hasOwn(t,d)?h.bind(t):(...t)=>i(e.value,m)?.(...t)}let g=(0,n.computed)(()=>i(e.value,m));return new Proxy(g,{get(e,t,n){return t===`value`?e.value??``:t===`__v_isRef`||Reflect.get(e,t,n)}})},ownKeys(){let t=i(e.value,u);return a(t)?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(t,n){let r=i(e.value,u),o=a(r)?Reflect.getOwnPropertyDescriptor(r,n):void 0;return o?{enumerable:o.enumerable,configurable:!0}:void 0}});return t.set(d,m),m};return r([])},f=e=>{let t=u(),i=(0,n.shallowRef)({});return(0,n.watch)(()=>{let i=e.getSource(),a=(0,n.toValue)(e.localeOrSelector)??void 0,o=(0,n.toValue)(t?.locale);return[i,process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?a??o:(0,r.resolveDictionaryArgument)({localeOrSelector:a,contextLocale:o,contextVariant:(0,n.toValue)(t?.variant),dictionaryKey:e.getDictionaryKey(i)})]},([t,n])=>{i.value=e.readContent(t,n)},{immediate:!0,flush:`sync`}),d(i)},p=(t,r)=>f({getSource:()=>(0,n.toValue)(t),getDictionaryKey:e=>e.key,readContent:(t,n)=>e.getDictionary(t,n),localeOrSelector:r});exports.atPath=i,exports.createContentProxy=d,exports.createIntlayerLeafProxy=l,exports.injectIntlayerProvider=u,exports.isComponentLike=o,exports.isIntlayerNode=s,exports.isObjectLike=a,exports.toComponent=c,exports.useDictionary=p,exports.useResolvedContent=f;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./installIntlayer.cjs"),t=require("./useDictionary.cjs");let n=require("@intlayer/core/interpreter"),r=require("vue"),i=require("@intlayer/core/dictionaryManipulator");var a=async(a,o)=>{let s=(0,r.inject)(e.INTLAYER_SYMBOL),c=(0,r.computed)(()=>(0,r.toValue)(o)??s?.locale?.value??(0,n.resolveInterpreterLocale)()),l=(0,i.getPreloadedDictionary)(a,c.value),u=(0,r.ref)(l??await a[c.value]?.());return(0,r.watch)(()=>c.value,async e=>{let t=await a[e]?.();t&&(u.value=t)}),t.useDictionary(u,c)};exports.useDictionaryAsync=a;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useDictionaryDynamic.cjs");var t=(t,n)=>e.useDynamicContent(t,``,n);exports.useDictionaryAsync=t;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./installIntlayer.cjs"),n=require("./useDictionaryAsync.cjs");let r=require("@intlayer/core/interpreter"),i=require("vue"),a=require("@intlayer/core/dictionaryManipulator");var o=async(o,s,c)=>{if(process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&(0,a.isQualifiedDynamicLoaderMap)(o)){let n=(0,i.inject)(t.INTLAYER_SYMBOL),l=c===void 0?void 0:(0,i.toValue)(c),{locale:u,selector:d}=(0,a.parseDictionarySelector)((0,a.resolveDictionaryArgument)({localeOrSelector:l??void 0,contextLocale:n?.locale?.value,contextVariant:n?.variant?.value,dictionaryKey:String(s)})),f=u??n?.locale?.value??(0,r.resolveInterpreterLocale)();return(0,a.resolveQualifiedDynamicContentAsync)({loaderMap:o,key:String(s),locale:f,selector:d,transform:t=>e.getDictionary(t,f)})}return n.useDictionaryAsync(o,c)};exports.useDictionaryDynamic=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./useDictionary.cjs");let n=require("vue");var r=(0,require("@intlayer/core/dictionaryManipulator").createDynamicContentStore)((t,n)=>e.getDictionary(t,n)),i=async(e,i,a)=>{let o=t.injectIntlayerProvider(),s=r.createReader(e,i),c=(0,n.shallowRef)({}),l=!1,u=()=>{},d=()=>{},f=new Promise((e,t)=>{u=e,d=t}),p=e=>{c.value=e,l=!0,u()},m=e=>{let t=s(e,p,e=>{if(l)throw e;d(e)});t&&p(t.content)},h=()=>({localeOrSelector:(0,n.toValue)(a),contextLocale:(0,n.toValue)(o?.locale),contextVariant:(0,n.toValue)(o?.variant)});return(0,n.watch)(h,m),m(h()),await f,t.createContentProxy(c)},a=(e,t,n)=>i(e,String(t),n);exports.useDictionaryDynamic=a,exports.useDynamicContent=i;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getIntlayer.cjs"),t=require("./installIntlayer.cjs"),n=require("./useDictionary.cjs");let r=require("@intlayer/core/interpreter"),i=require("vue"),a=require("@intlayer/core/dictionaryManipulator");var o=(o,s)=>{let c=(0,i.inject)(t.INTLAYER_SYMBOL),l=(0,i.isRef)(c?.locale)?c.locale:(0,i.ref)(c?.locale??(0,r.resolveInterpreterLocale)()),u=(0,i.computed)(()=>{let e=s===void 0?void 0:(0,i.toValue)(s);if(process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`){let t=(0,a.resolveDictionaryArgument)({localeOrSelector:e,contextLocale:l.value,contextVariant:c?.variant?.value,dictionaryKey:(0,i.toValue)(o)});return(0,a.parseDictionarySelector)(t)}return{selector:void 0,locale:e}}),d=(0,i.computed)(()=>u.value.locale??l.value),f=(0,i.shallowRef)({});(0,i.watch)([()=>(0,i.toValue)(o),()=>d.value,()=>u.value.selector],([t,n,r])=>{f.value=r?e.getIntlayer(t,{...r,locale:n}):e.getIntlayer(t,n)},{immediate:!0,flush:`sync`});let p=new Map,m=e=>{let t=e.join(`.`);if(p.has(t))return p.get(t);let r=(0,i.computed)(()=>n.atPath(f.value,e)),a=new Proxy({},{get(t,a,o){if(typeof a==`symbol`||typeof a==`string`&&(a.startsWith(`__`)||a.startsWith(`$`)))return a===`__v_isRef`?!0:a===`then`?void 0:Reflect.get(t,a,o);if(a===`value`)return r.value??``;if(a===`c`||a===`asComponent`)return n.toComponent(()=>r.value);if(a===`$raw`)return r;if(a===Symbol.toPrimitive)return()=>String(r.value??``);let s=e.concat(a),c=n.atPath(f.value,s);if(c===void 0||n.isObjectLike(c)&&!n.isComponentLike(c))return m(s);if(n.isIntlayerNode(c))return n.createIntlayerLeafProxy((0,i.computed)(()=>n.atPath(f.value,s)));if(typeof c==`function`){let t=n.atPath(f.value,e);return t!=null&&!Object.hasOwn(t,a)?c.bind(t):(...e)=>n.atPath(f.value,s)?.(...e)}let l=(0,i.computed)(()=>n.atPath(f.value,s));return new Proxy(l,{get(e,t,n){return t===`value`?e.value??``:t===`__v_isRef`||Reflect.get(e,t,n)}})},ownKeys(){let t=n.atPath(f.value,e);return n.isObjectLike(t)?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return p.set(t,a),a};return m([])};exports.useIntlayer=o;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getIntlayer.cjs"),t=require("./useDictionary.cjs");let n=require("vue");var r=(r,i)=>t.useResolvedContent({getSource:()=>(0,n.toValue)(r),getDictionaryKey:e=>e,readContent:(t,n)=>e.getIntlayer(t,n),localeOrSelector:i});exports.useIntlayer=r;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("vue"),t=require("@intlayer/editor/isEnabled");var n=(0,e.defineComponent)({name:`EditedContentSource`,props:{dictionaryKey:{type:String,required:!0},keyPath:{type:Array,required:!0}},setup(n,{slots:r}){let i=(0,e.ref)(),a=null,o=(e,n)=>{if(a?.(),a=null,i.value=void 0,process.env.INTLAYER_EDITOR_ENABLED===`false`||!t.isEnabled||typeof window>`u`||!e)return;let r=!1,o=null;import(`@intlayer/editor`).then(({subscribeToEditedContentSource:t})=>{r||(o=t(e,JSON.parse(n),e=>{i.value=e}))}).catch(()=>{}),a=()=>{r=!0,o?.()}};return(0,e.watch)(()=>[n.dictionaryKey,JSON.stringify(n.keyPath)],([e,t])=>o(e,t),{immediate:!0}),(0,e.onBeforeUnmount)(()=>a?.()),()=>r.default?.({editedSource:i.value})}});exports.EditedContentSource=n;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./editor/useEditor.cjs"),t=require("./getDictionary.cjs"),n=require("./client/installIntlayer.cjs"),r=require("./analytics/useAnalytics.cjs"),i=require("./analytics/useConversion.cjs"),a=require("./analytics/useExperiment.cjs");require("./analytics/index.cjs");const o=require("./client/useDictionary.cjs"),s=require("./client/useDictionaryAsync.cjs"),c=require("./client/useDictionaryDynamic.cjs"),l=require("./getIntlayer.cjs"),u=require("./client/useIntlayer.cjs"),d=require("./client/useLoadDynamic.cjs"),f=require("./client/useLocale.cjs"),p=require("./client/usePathname.cjs"),m=require("./client/useRewriteURL.cjs");require("./client/index.cjs");const h=require("./plugins.cjs");exports.INTLAYER_SYMBOL=n.INTLAYER_SYMBOL,exports.atPath=o.atPath,exports.createIntlayerClient=n.createIntlayerClient,exports.createIntlayerLeafProxy=o.createIntlayerLeafProxy,exports.getDictionary=t.getDictionary,exports.getIntlayer=l.getIntlayer,exports.getPlugins=h.getPlugins,exports.htmlPlugin=h.htmlPlugin,exports.insertionPlugin=h.insertionPlugin,exports.installIntlayer=n.installIntlayer,exports.intlayer=n.intlayer,exports.intlayerNodePlugins=h.intlayerNodePlugins,exports.isComponentLike=o.isComponentLike,exports.isIntlayerNode=o.isIntlayerNode,exports.isObjectLike=o.isObjectLike,exports.markdownPlugin=h.markdownPlugin,exports.markdownStringPlugin=h.markdownStringPlugin,exports.toComponent=o.toComponent,exports.useAnalytics=r.useAnalytics,exports.useConversion=i.useConversion,exports.useDictionary=o.useDictionary,exports.useDictionaryAsync=s.useDictionaryAsync,exports.useDictionaryDynamic=c.useDictionaryDynamic,exports.useEditor=e.useEditor,exports.useExperiment=a.useExperiment,exports.useIntlayer=u.useIntlayer,exports.useLoadDynamic=d.useLoadDynamic,exports.useLocale=f.useLocale,exports.usePathname=p.usePathname,exports.useRewriteURL=m.useRewriteURL;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./editor/useEditor.cjs"),t=require("./getDictionary.cjs"),n=require("./client/installIntlayer.cjs"),r=require("./analytics/useAnalytics.cjs"),i=require("./analytics/useConversion.cjs"),a=require("./analytics/useExperiment.cjs");require("./analytics/index.cjs");const o=require("./client/useDictionary.cjs"),s=require("./client/useDictionaryDynamic.cjs"),c=require("./client/useDictionaryAsync.cjs"),l=require("./getIntlayer.cjs"),u=require("./client/useIntlayer.cjs"),d=require("./client/useLoadDynamic.cjs"),f=require("./client/useLocale.cjs"),p=require("./client/usePathname.cjs"),m=require("./client/useRewriteURL.cjs");require("./client/index.cjs");const h=require("./plugins.cjs");exports.INTLAYER_SYMBOL=n.INTLAYER_SYMBOL,exports.atPath=o.atPath,exports.createContentProxy=o.createContentProxy,exports.createIntlayerClient=n.createIntlayerClient,exports.createIntlayerLeafProxy=o.createIntlayerLeafProxy,exports.getDictionary=t.getDictionary,exports.getIntlayer=l.getIntlayer,exports.getPlugins=h.getPlugins,exports.htmlPlugin=h.htmlPlugin,exports.injectIntlayerProvider=o.injectIntlayerProvider,exports.insertionPlugin=h.insertionPlugin,exports.installIntlayer=n.installIntlayer,exports.intlayer=n.intlayer,exports.intlayerNodePlugins=h.intlayerNodePlugins,exports.isComponentLike=o.isComponentLike,exports.isIntlayerNode=o.isIntlayerNode,exports.isObjectLike=o.isObjectLike,exports.markdownPlugin=h.markdownPlugin,exports.markdownStringPlugin=h.markdownStringPlugin,exports.toComponent=o.toComponent,exports.useAnalytics=r.useAnalytics,exports.useConversion=i.useConversion,exports.useDictionary=o.useDictionary,exports.useDictionaryAsync=c.useDictionaryAsync,exports.useDictionaryDynamic=s.useDictionaryDynamic,exports.useDynamicContent=s.useDynamicContent,exports.useEditor=e.useEditor,exports.useExperiment=a.useExperiment,exports.useIntlayer=u.useIntlayer,exports.useLoadDynamic=d.useLoadDynamic,exports.useLocale=f.useLocale,exports.usePathname=p.usePathname,exports.useResolvedContent=o.useResolvedContent,exports.useRewriteURL=m.useRewriteURL;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js"),t=require("./analytics/exposureSink.cjs"),n=require("./html/HTMLRenderer.cjs"),r=require("./markdown/installIntlayerMarkdown.cjs"),i=require("./renderIntlayerNode.cjs");let a=require("@intlayer/core/interpreter"),o=require("@intlayer/config/built"),s=require("@intlayer/core/markdown"),c=require("@intlayer/types/nodeType");c=e.t(c);let l=require("vue");var u=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,l.defineAsyncComponent)(()=>Promise.resolve().then(()=>require("./editor/ContentSelector.cjs"))),d={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,n)=>{let{children:r,dictionaryKey:a,keyPath:s}=n;process.env.INTLAYER_ANALYTICS_ENABLED!==`false`&&t.reportExposure({dictionaryKey:a,keyPath:s,locale:n.locale,nodeType:`text`});let c=e=>i.renderIntlayerNode({value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&o.editor.enabled?()=>(0,l.h)(u,{dictionaryKey:a,keyPath:s},{default:()=>typeof e==`function`?e():e}):e}),d=c(r);if(typeof r!=`function`)return d;let f=(...e)=>{let t=r(...e);return c(t)};Object.setPrototypeOf(f,Object.getPrototypeOf(d));for(let e of Object.getOwnPropertyNames(d)){let t=Object.getOwnPropertyDescriptor(d,e);t&&Object.defineProperty(f,e,t)}for(let e of Object.getOwnPropertySymbols(d)){let t=Object.getOwnPropertyDescriptor(d,e);t&&Object.defineProperty(f,e,t)}return(0,l.markRaw)(f)}},f=(e,t)=>{let n=new Map,r={};for(let[e,i]of Object.entries(t))typeof i==`string`||typeof i==`number`?r[e]=i:(n.set(e,i),r[e]=`__VNODE_${e}__`);let i=(0,a.splitInsertionTemplate)(e,r);if(n.size>0){let e=[];if(i.isSimple){let t=i.parts,r=0;for(let[i]of n){let a=`__VNODE_${i}__`,o=t.indexOf(a);o!==-1&&(o>r&&e.push(t.substring(r,o)),e.push(n.get(i)),r=o+a.length)}return r<t.length&&e.push(t.substring(r)),(0,l.h)(l.Fragment,null,...e)}return i.parts.forEach(t=>{if(typeof t==`string`){let r=t;for(let[t]of n){let i=`__VNODE_${t}__`,a=r.indexOf(i);a!==-1&&(a>0&&e.push(r.substring(0,a)),e.push(n.get(t)),r=r.substring(a+i.length))}r.length>0&&e.push(r)}else e.push(t)}),(0,l.h)(l.Fragment,null,...e)}return i.isSimple?i.parts:(0,l.h)(l.Fragment,null,i.parts)},p=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?a.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===c.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:c.INSERTION}],i=e[c.INSERTION],o={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,a.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,a.isInterpolableWrapperNode)(e))return i=>(0,a.transformInterpolableNode)(e,i,n,t.plugins,r);let i=r(e,{...n,children:e,plugins:(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)});return e=>{let a=f(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}},s=n(i,{...t,children:i,keyPath:r,plugins:[o,...t.plugins??[]]});return(0,a.resolveInsertedSelector)(i,s)}},m=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?a.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:a,...c}=t,d=n((0,s.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>i.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:c.dictionaryKey,keyPath:[]}),f=n=>i.renderIntlayerNode({...t,value:e,children:()=>{let{renderMarkdown:t,components:i}=r.useMarkdown(),a=t(e,void 0,{...i??{},...n??{}});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&o.editor.enabled?(0,l.h)(u,{dictionaryKey:c.dictionaryKey,keyPath:c.keyPath},{default:()=>a}):a},additionalProps:{metadata:d,use:e=>f(e)}});return f()}},h=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?a.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===c.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:c.MARKDOWN}],i=e[c.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[m,...t.plugins??[]]})}},g=process.env.INTLAYER_NODE_TYPE_HTML===`false`?a.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===c.HTML,transform:(e,t)=>{let r=e[c.HTML];e.tags;let a=(e={})=>{let s=n.renderHTML(r,{components:e});return i.renderIntlayerNode({...t,value:r,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&o.editor.enabled?()=>(0,l.h)(u,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath,...e},{default:()=>s}):s,additionalProps:{use:e=>a(e)}})};return a()}},_=new Map,v=(e,t=!0)=>{let n=(0,a.resolveInterpreterLocale)(e),r=`${n}_${t}`;if(_.has(r))return _.get(r);let i=[d,(0,a.translationPlugin)(n,t?o.internationalization.defaultLocale:void 0),a.enumerationPlugin,(0,a.pluralPlugin)(n),a.conditionPlugin,(0,a.nestedPlugin)(n),a.filePlugin,a.genderPlugin,a.selectPlugin,p,h,g].filter(e=>e!==a.fallbackPlugin);return _.set(r,i),i};exports.getPlugins=v,exports.htmlPlugin=g,exports.insertionPlugin=p,exports.intlayerNodePlugins=d,exports.markdownPlugin=h,exports.markdownStringPlugin=m;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../rolldown-runtime-BocRIvOZ.js"),t=require("./analytics/exposureSink.cjs"),n=require("./editor/EditedContentSource.cjs"),r=require("./html/HTMLRenderer.cjs"),i=require("./markdown/installIntlayerMarkdown.cjs"),a=require("./renderIntlayerNode.cjs");let o=require("@intlayer/core/interpreter"),s=require("@intlayer/config/built"),c=require("@intlayer/core/markdown"),l=require("@intlayer/types/nodeType");l=e.t(l);let u=require("vue");var d=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,u.defineAsyncComponent)(()=>Promise.resolve().then(()=>require("./editor/ContentSelector.cjs"))),f={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,n)=>{let{children:r,dictionaryKey:i,keyPath:o}=n;process.env.INTLAYER_ANALYTICS_ENABLED!==`false`&&t.reportExposure({dictionaryKey:i,keyPath:o,locale:n.locale,nodeType:`text`});let c=e=>a.renderIntlayerNode({value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&s.editor.enabled?()=>(0,u.h)(d,{dictionaryKey:i,keyPath:o},{default:()=>typeof e==`function`?e():e}):e}),l=c(r);if(typeof r!=`function`)return l;let f=(...e)=>{let t=r(...e);return c(t)};Object.setPrototypeOf(f,Object.getPrototypeOf(l));for(let e of Object.getOwnPropertyNames(l)){let t=Object.getOwnPropertyDescriptor(l,e);t&&Object.defineProperty(f,e,t)}for(let e of Object.getOwnPropertySymbols(l)){let t=Object.getOwnPropertyDescriptor(l,e);t&&Object.defineProperty(f,e,t)}return(0,u.markRaw)(f)}},p=(e,t)=>{let n=new Map,r={};for(let[e,i]of Object.entries(t))typeof i==`string`||typeof i==`number`?r[e]=i:(n.set(e,i),r[e]=`__VNODE_${e}__`);let i=(0,o.splitInsertionTemplate)(e,r);if(n.size>0){let e=[];if(i.isSimple){let t=i.parts,r=0;for(let[i]of n){let a=`__VNODE_${i}__`,o=t.indexOf(a);o!==-1&&(o>r&&e.push(t.substring(r,o)),e.push(n.get(i)),r=o+a.length)}return r<t.length&&e.push(t.substring(r)),(0,u.h)(u.Fragment,null,...e)}return i.parts.forEach(t=>{if(typeof t==`string`){let r=t;for(let[t]of n){let i=`__VNODE_${t}__`,a=r.indexOf(i);a!==-1&&(a>0&&e.push(r.substring(0,a)),e.push(n.get(t)),r=r.substring(a+i.length))}r.length>0&&e.push(r)}else e.push(t)}),(0,u.h)(u.Fragment,null,...e)}return i.isSimple?i.parts:(0,u.h)(u.Fragment,null,i.parts)},m=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?o.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===l.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:l.INSERTION}],i=e[l.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,o.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,o.isInterpolableWrapperNode)(e))return i=>(0,o.transformInterpolableNode)(e,i,n,t.plugins,r);let i=r(e,{...n,children:e,plugins:(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)});return e=>{let a=p(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}},s=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return(0,o.resolveInsertedSelector)(i,s)}},h=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?o.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,r)=>{let{plugins:o,...l}=t,f=r((0,c.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>a.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:l.dictionaryKey,keyPath:[]}),p=r=>a.renderIntlayerNode({...t,value:e,children:()=>{let{renderMarkdown:t,components:a}=i.useMarkdown(),o=e=>t(e,void 0,{...a??{},...r??{}});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&s.editor.enabled?(0,u.h)(d,{dictionaryKey:l.dictionaryKey,keyPath:l.keyPath},{default:()=>(0,u.h)(n.EditedContentSource,{dictionaryKey:l.dictionaryKey,keyPath:l.keyPath},{default:({editedSource:t})=>o(t??e)})}):o(e)},additionalProps:{metadata:f,use:e=>p(e)}});return p()}},g=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?o.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===l.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:l.MARKDOWN}],i=e[l.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[h,...t.plugins??[]]})}},_=process.env.INTLAYER_NODE_TYPE_HTML===`false`?o.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===l.HTML,transform:(e,t)=>{let i=e[l.HTML];e.tags;let o=(e={})=>{let c=r.renderHTML(i,{components:e});return a.renderIntlayerNode({...t,value:i,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&s.editor.enabled?()=>(0,u.h)(d,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath,...e},{default:()=>(0,u.h)(n.EditedContentSource,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath},{default:({editedSource:t})=>t===void 0?c:r.renderHTML(t,{components:e})})}):c,additionalProps:{use:e=>o(e)}})};return o()}},v=new Map,y=(e,t=!0)=>{let n=(0,o.resolveInterpreterLocale)(e),r=`${n}_${t}`;if(v.has(r))return v.get(r);let i=[f,(0,o.translationPlugin)(n,t?s.internationalization.defaultLocale:void 0),o.enumerationPlugin,(0,o.pluralPlugin)(n),o.conditionPlugin,(0,o.nestedPlugin)(n),o.filePlugin,o.genderPlugin,o.selectPlugin,m,g,_].filter(e=>e!==o.fallbackPlugin);return v.set(r,i),i};exports.getPlugins=y,exports.htmlPlugin=_,exports.insertionPlugin=m,exports.intlayerNodePlugins=f,exports.markdownPlugin=g,exports.markdownStringPlugin=h;
@@ -1,10 +1,10 @@
1
1
  import { INTLAYER_SYMBOL as e, createIntlayerClient as t, installIntlayer as n, intlayer as r } from "./installIntlayer.mjs";
2
- import { atPath as i, createIntlayerLeafProxy as a, isComponentLike as o, isIntlayerNode as s, isObjectLike as c, toComponent as l, useDictionary as u } from "./useDictionary.mjs";
3
- import { useDictionaryAsync as d } from "./useDictionaryAsync.mjs";
4
- import { useDictionaryDynamic as f } from "./useDictionaryDynamic.mjs";
5
- import { useIntlayer as p } from "./useIntlayer.mjs";
6
- import { useLoadDynamic as m } from "./useLoadDynamic.mjs";
7
- import { useLocale as h } from "./useLocale.mjs";
8
- import { usePathname as g } from "./usePathname.mjs";
9
- import { useRewriteURL as _ } from "./useRewriteURL.mjs";
10
- export { e as INTLAYER_SYMBOL, i as atPath, t as createIntlayerClient, a as createIntlayerLeafProxy, n as installIntlayer, r as intlayer, o as isComponentLike, s as isIntlayerNode, c as isObjectLike, l as toComponent, u as useDictionary, d as useDictionaryAsync, f as useDictionaryDynamic, p as useIntlayer, m as useLoadDynamic, h as useLocale, g as usePathname, _ as useRewriteURL };
2
+ import { atPath as i, createContentProxy as a, createIntlayerLeafProxy as o, injectIntlayerProvider as s, isComponentLike as c, isIntlayerNode as l, isObjectLike as u, toComponent as d, useDictionary as f, useResolvedContent as p } from "./useDictionary.mjs";
3
+ import { useDictionaryAsync as m } from "./useDictionaryAsync.mjs";
4
+ import { useDictionaryDynamic as h, useDynamicContent as g } from "./useDictionaryDynamic.mjs";
5
+ import { useIntlayer as _ } from "./useIntlayer.mjs";
6
+ import { useLoadDynamic as v } from "./useLoadDynamic.mjs";
7
+ import { useLocale as y } from "./useLocale.mjs";
8
+ import { usePathname as b } from "./usePathname.mjs";
9
+ import { useRewriteURL as x } from "./useRewriteURL.mjs";
10
+ export { e as INTLAYER_SYMBOL, i as atPath, a as createContentProxy, t as createIntlayerClient, o as createIntlayerLeafProxy, s as injectIntlayerProvider, n as installIntlayer, r as intlayer, c as isComponentLike, l as isIntlayerNode, u as isObjectLike, d as toComponent, f as useDictionary, m as useDictionaryAsync, h as useDictionaryDynamic, g as useDynamicContent, _ as useIntlayer, v as useLoadDynamic, y as useLocale, b as usePathname, p as useResolvedContent, x as useRewriteURL };
@@ -1,25 +1,24 @@
1
1
  import { getDictionary as e } from "../getDictionary.mjs";
2
2
  import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
3
- import { resolveInterpreterLocale as n } from "@intlayer/core/interpreter";
4
- import { computed as r, defineComponent as i, getCurrentInstance as a, h as o, inject as s, isRef as c, markRaw as l, ref as u, shallowRef as d, toValue as f, watch as p } from "vue";
5
- import { parseDictionarySelector as m, resolveDictionaryArgument as h } from "@intlayer/core/dictionaryManipulator";
3
+ import { computed as n, defineComponent as r, h as i, hasInjectionContext as a, inject as o, markRaw as s, shallowRef as c, toValue as l, watch as u } from "vue";
4
+ import { resolveDictionaryArgument as d } from "@intlayer/core/dictionaryManipulator";
6
5
  // src/client/useDictionary.ts
7
- var g = (e, t) => t.reduce((e, t) => e?.[t], e), _ = (e) => typeof e == "object" && !!e, v = (e) => typeof e == "function" || _(e) && ("render" in e || "setup" in e), y = (e) => e != null && (typeof e == "object" || typeof e == "function") && "__update" in e && "render" in e && "raw" in e, b = (e) => l(i({
6
+ var f = (e, t) => t.reduce((e, t) => e?.[t], e), p = (e) => typeof e == "object" && !!e, m = (e) => typeof e == "function" || p(e) && ("render" in e || "setup" in e), h = (e) => e != null && (typeof e == "object" || typeof e == "function") && "__update" in e && "render" in e && "raw" in e, g = (e) => s(r({
8
7
  name: "IntlayerLeaf",
9
8
  setup() {
10
9
  return () => {
11
10
  let t = e();
12
- return t == null ? null : v(t) ? o(t) : Array.isArray(t) ? o("span", t) : t;
11
+ return t == null ? null : m(t) ? i(t) : Array.isArray(t) ? i("span", t) : t;
13
12
  };
14
13
  }
15
- })), x = (e) => new Proxy({}, {
14
+ })), _ = (e) => new Proxy({}, {
16
15
  get(t, n) {
17
16
  let r = e.value;
18
17
  if (n === "__v_isRef") return !0;
19
18
  if (n === "value") return r ?? "";
20
19
  if (n === "$raw") return e;
21
20
  if (n === "__v_skip") return !0;
22
- if (n === "c" || n === "asComponent") return b(() => e.value);
21
+ if (n === "c" || n === "asComponent") return g(() => e.value);
23
22
  if (r == null) return n === Symbol.toPrimitive || n === "toString" ? () => "" : void 0;
24
23
  let i = r[n];
25
24
  return typeof i == "function" ? i.bind(r) : i;
@@ -34,66 +33,63 @@ var g = (e, t) => t.reduce((e, t) => e?.[t], e), _ = (e) => typeof e == "object"
34
33
  configurable: !0
35
34
  };
36
35
  }
37
- }), S = (i, o) => {
38
- let l = a() ? s(t) : void 0, S = c(l?.locale) ? l.locale : u(l?.locale ?? n()), C = r(() => {
39
- let e = o === void 0 ? void 0 : f(o);
40
- if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
41
- let t = h({
42
- localeOrSelector: e,
43
- contextLocale: S.value,
44
- contextVariant: l?.variant?.value,
45
- dictionaryKey: f(i).key
46
- });
47
- return m(t);
48
- }
49
- return {
50
- selector: void 0,
51
- locale: e
52
- };
53
- }), w = r(() => C.value.locale ?? S.value), T = d({});
54
- p([
55
- () => f(i),
56
- () => w.value,
57
- () => C.value.selector
58
- ], ([t, n, r]) => {
59
- T.value = r ? e(t, {
60
- ...r,
61
- locale: n
62
- }) : e(t, n);
36
+ }), v = () => a() ? o(t, void 0) : void 0, y = (e) => {
37
+ let t = /* @__PURE__ */ new Map(), r = (i) => {
38
+ let a = i.join("\0"), o = t.get(a);
39
+ if (o) return o;
40
+ let s = n(() => f(e.value, i)), c = new Proxy({}, {
41
+ get(t, a, o) {
42
+ if (typeof a == "symbol" || typeof a == "string" && (a.startsWith("__") || a.startsWith("$"))) return a === "__v_isRef" ? !0 : a === "$raw" ? s : a === Symbol.toPrimitive ? () => String(s.value ?? "") : Reflect.get(t, a, o);
43
+ if (a === "value") return s.value ?? "";
44
+ if (a === "then") return;
45
+ if (a === "c" || a === "asComponent") return g(() => s.value);
46
+ let c = i.concat(a), l = f(e.value, c);
47
+ if (l === void 0 || p(l) && !m(l)) return r(c);
48
+ if (h(l)) return _(n(() => f(e.value, c)));
49
+ if (typeof l == "function") {
50
+ let t = f(e.value, i);
51
+ return t != null && !Object.hasOwn(t, a) ? l.bind(t) : (...t) => f(e.value, c)?.(...t);
52
+ }
53
+ let u = n(() => f(e.value, c));
54
+ return new Proxy(u, { get(e, t, n) {
55
+ return t === "value" ? e.value ?? "" : t === "__v_isRef" || Reflect.get(e, t, n);
56
+ } });
57
+ },
58
+ ownKeys() {
59
+ let t = f(e.value, i);
60
+ return p(t) ? Reflect.ownKeys(t) : [];
61
+ },
62
+ getOwnPropertyDescriptor(t, n) {
63
+ let r = f(e.value, i), a = p(r) ? Reflect.getOwnPropertyDescriptor(r, n) : void 0;
64
+ return a ? {
65
+ enumerable: a.enumerable,
66
+ configurable: !0
67
+ } : void 0;
68
+ }
69
+ });
70
+ return t.set(a, c), c;
71
+ };
72
+ return r([]);
73
+ }, b = (e) => {
74
+ let t = v(), n = c({});
75
+ return u(() => {
76
+ let n = e.getSource(), r = l(e.localeOrSelector) ?? void 0, i = l(t?.locale);
77
+ return [n, process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? r ?? i : d({
78
+ localeOrSelector: r,
79
+ contextLocale: i,
80
+ contextVariant: l(t?.variant),
81
+ dictionaryKey: e.getDictionaryKey(n)
82
+ })];
83
+ }, ([t, r]) => {
84
+ n.value = e.readContent(t, r);
63
85
  }, {
64
86
  immediate: !0,
65
87
  flush: "sync"
66
- });
67
- let E = (e) => new Proxy({}, {
68
- get(t, n, i) {
69
- let a = r(() => g(T.value, e));
70
- if (typeof n == "symbol" || typeof n == "string" && (n.startsWith("__") || n.startsWith("$"))) return n === "__v_isRef" ? !0 : n === "$raw" ? a : n === Symbol.toPrimitive ? () => String(a.value ?? "") : Reflect.get(t, n, i);
71
- if (n === "value") return a.value ?? "";
72
- if (n === "then") return;
73
- if (n === "c" || n === "asComponent") return b(() => a.value);
74
- let o = e.concat(n), s = g(T.value, o);
75
- if (s === void 0 || _(s) && !v(s)) return E(o);
76
- if (y(s)) return x(r(() => g(T.value, o)));
77
- if (typeof s == "function") {
78
- let t = g(T.value, e);
79
- return t != null && !Object.hasOwn(t, n) ? s.bind(t) : (...e) => g(T.value, o)?.(...e);
80
- }
81
- let c = r(() => g(T.value, o));
82
- return new Proxy(c, { get(e, t, n) {
83
- return t === "value" ? e.value ?? "" : Reflect.get(e, t, n);
84
- } });
85
- },
86
- ownKeys() {
87
- let t = g(T.value, e);
88
- return _(t) ? Reflect.ownKeys(t) : [];
89
- },
90
- getOwnPropertyDescriptor() {
91
- return {
92
- enumerable: !0,
93
- configurable: !0
94
- };
95
- }
96
- });
97
- return E([]);
98
- };
99
- export { g as atPath, x as createIntlayerLeafProxy, v as isComponentLike, y as isIntlayerNode, _ as isObjectLike, b as toComponent, S as useDictionary };
88
+ }), y(n);
89
+ }, x = (t, n) => b({
90
+ getSource: () => l(t),
91
+ getDictionaryKey: (e) => e.key,
92
+ readContent: (t, n) => e(t, n),
93
+ localeOrSelector: n
94
+ });
95
+ export { f as atPath, y as createContentProxy, _ as createIntlayerLeafProxy, v as injectIntlayerProvider, m as isComponentLike, h as isIntlayerNode, p as isObjectLike, g as toComponent, x as useDictionary, b as useResolvedContent };
@@ -1,14 +1,4 @@
1
- import { INTLAYER_SYMBOL as e } from "./installIntlayer.mjs";
2
- import { useDictionary as t } from "./useDictionary.mjs";
3
- import { resolveInterpreterLocale as n } from "@intlayer/core/interpreter";
4
- import { computed as r, inject as i, ref as a, toValue as o, watch as s } from "vue";
5
- import { getPreloadedDictionary as c } from "@intlayer/core/dictionaryManipulator";
1
+ import { useDynamicContent as e } from "./useDictionaryDynamic.mjs";
6
2
  // src/client/useDictionaryAsync.ts
7
- var l = async (l, u) => {
8
- let d = i(e), f = r(() => o(u) ?? d?.locale?.value ?? n()), p = c(l, f.value), m = a(p ?? await l[f.value]?.());
9
- return s(() => f.value, async (e) => {
10
- let t = await l[e]?.();
11
- t && (m.value = t);
12
- }), t(m, f);
13
- };
14
- export { l as useDictionaryAsync };
3
+ var t = (t, n) => e(t, "", n);
4
+ export { t as useDictionaryAsync };
@@ -1,26 +1,24 @@
1
1
  import { getDictionary as e } from "../getDictionary.mjs";
2
- import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
3
- import { useDictionaryAsync as n } from "./useDictionaryAsync.mjs";
4
- import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
5
- import { inject as i, toValue as a } from "vue";
6
- import { isQualifiedDynamicLoaderMap as o, parseDictionarySelector as s, resolveDictionaryArgument as c, resolveQualifiedDynamicContentAsync as l } from "@intlayer/core/dictionaryManipulator";
2
+ import { createContentProxy as t, injectIntlayerProvider as n } from "./useDictionary.mjs";
3
+ import { shallowRef as r, toValue as i, watch as a } from "vue";
4
+ import { createDynamicContentStore as o } from "@intlayer/core/dictionaryManipulator";
7
5
  // src/client/useDictionaryDynamic.ts
8
- var u = async (u, d, f) => {
9
- if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && o(u)) {
10
- let n = i(t), o = f === void 0 ? void 0 : a(f), { locale: p, selector: m } = s(c({
11
- localeOrSelector: o ?? void 0,
12
- contextLocale: n?.locale?.value,
13
- contextVariant: n?.variant?.value,
14
- dictionaryKey: String(d)
15
- })), h = p ?? n?.locale?.value ?? r();
16
- return l({
17
- loaderMap: u,
18
- key: String(d),
19
- locale: h,
20
- selector: m,
21
- transform: (t) => e(t, h)
6
+ var s = o((t, n) => e(t, n)), c = async (e, o, c) => {
7
+ let l = n(), u = s.createReader(e, o), d = r({}), f = !1, p = () => {}, m = () => {}, h = new Promise((e, t) => {
8
+ p = e, m = t;
9
+ }), g = (e) => {
10
+ d.value = e, f = !0, p();
11
+ }, _ = (e) => {
12
+ let t = u(e, g, (e) => {
13
+ if (f) throw e;
14
+ m(e);
22
15
  });
23
- }
24
- return n(u, f);
25
- };
26
- export { u as useDictionaryDynamic };
16
+ t && g(t.content);
17
+ }, v = () => ({
18
+ localeOrSelector: i(c),
19
+ contextLocale: i(l?.locale),
20
+ contextVariant: i(l?.variant)
21
+ });
22
+ return a(v, _), _(v()), await h, t(d);
23
+ }, l = (e, t, n) => c(e, String(t), n);
24
+ export { l as useDictionaryDynamic, c as useDynamicContent };
@@ -1,75 +1,11 @@
1
1
  import { getIntlayer as e } from "../getIntlayer.mjs";
2
- import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
3
- import { atPath as n, createIntlayerLeafProxy as r, isComponentLike as i, isIntlayerNode as a, isObjectLike as o, toComponent as s } from "./useDictionary.mjs";
4
- import { resolveInterpreterLocale as c } from "@intlayer/core/interpreter";
5
- import { computed as l, inject as u, isRef as d, ref as f, shallowRef as p, toValue as m, watch as h } from "vue";
6
- import { parseDictionarySelector as g, resolveDictionaryArgument as _ } from "@intlayer/core/dictionaryManipulator";
2
+ import { useResolvedContent as t } from "./useDictionary.mjs";
3
+ import { toValue as n } from "vue";
7
4
  // src/client/useIntlayer.ts
8
- var v = (v, y) => {
9
- let b = u(t), x = d(b?.locale) ? b.locale : f(b?.locale ?? c()), S = l(() => {
10
- let e = y === void 0 ? void 0 : m(y);
11
- if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
12
- let t = _({
13
- localeOrSelector: e,
14
- contextLocale: x.value,
15
- contextVariant: b?.variant?.value,
16
- dictionaryKey: m(v)
17
- });
18
- return g(t);
19
- }
20
- return {
21
- selector: void 0,
22
- locale: e
23
- };
24
- }), C = l(() => S.value.locale ?? x.value), w = p({});
25
- h([
26
- () => m(v),
27
- () => C.value,
28
- () => S.value.selector
29
- ], ([t, n, r]) => {
30
- w.value = r ? e(t, {
31
- ...r,
32
- locale: n
33
- }) : e(t, n);
34
- }, {
35
- immediate: !0,
36
- flush: "sync"
37
- });
38
- let T = /* @__PURE__ */ new Map(), E = (e) => {
39
- let t = e.join(".");
40
- if (T.has(t)) return T.get(t);
41
- let c = l(() => n(w.value, e)), u = new Proxy({}, {
42
- get(t, u, d) {
43
- if (typeof u == "symbol" || typeof u == "string" && (u.startsWith("__") || u.startsWith("$"))) return u === "__v_isRef" ? !0 : u === "then" ? void 0 : Reflect.get(t, u, d);
44
- if (u === "value") return c.value ?? "";
45
- if (u === "c" || u === "asComponent") return s(() => c.value);
46
- if (u === "$raw") return c;
47
- if (u === Symbol.toPrimitive) return () => String(c.value ?? "");
48
- let f = e.concat(u), p = n(w.value, f);
49
- if (p === void 0 || o(p) && !i(p)) return E(f);
50
- if (a(p)) return r(l(() => n(w.value, f)));
51
- if (typeof p == "function") {
52
- let t = n(w.value, e);
53
- return t != null && !Object.hasOwn(t, u) ? p.bind(t) : (...e) => n(w.value, f)?.(...e);
54
- }
55
- let m = l(() => n(w.value, f));
56
- return new Proxy(m, { get(e, t, n) {
57
- return t === "value" ? e.value ?? "" : t === "__v_isRef" || Reflect.get(e, t, n);
58
- } });
59
- },
60
- ownKeys() {
61
- let t = n(w.value, e);
62
- return o(t) ? Reflect.ownKeys(t) : [];
63
- },
64
- getOwnPropertyDescriptor() {
65
- return {
66
- enumerable: !0,
67
- configurable: !0
68
- };
69
- }
70
- });
71
- return T.set(t, u), u;
72
- };
73
- return E([]);
74
- };
75
- export { v as useIntlayer };
5
+ var r = (r, i) => t({
6
+ getSource: () => n(r),
7
+ getDictionaryKey: (e) => e,
8
+ readContent: (t, n) => e(t, n),
9
+ localeOrSelector: i
10
+ });
11
+ export { r as useIntlayer };
@@ -0,0 +1,31 @@
1
+ import { defineComponent as e, onBeforeUnmount as t, ref as n, watch as r } from "vue";
2
+ import { isEnabled as i } from "@intlayer/editor/isEnabled";
3
+ // src/editor/EditedContentSource.ts
4
+ var a = e({
5
+ name: "EditedContentSource",
6
+ props: {
7
+ dictionaryKey: {
8
+ type: String,
9
+ required: !0
10
+ },
11
+ keyPath: {
12
+ type: Array,
13
+ required: !0
14
+ }
15
+ },
16
+ setup(e, { slots: a }) {
17
+ let o = n(), s = null, c = (e, t) => {
18
+ if (s?.(), s = null, o.value = void 0, process.env.INTLAYER_EDITOR_ENABLED === "false" || !i || typeof window > "u" || !e) return;
19
+ let n = !1, r = null;
20
+ import("@intlayer/editor").then(({ subscribeToEditedContentSource: i }) => {
21
+ n || (r = i(e, JSON.parse(t), (e) => {
22
+ o.value = e;
23
+ }));
24
+ }).catch(() => {}), s = () => {
25
+ n = !0, r?.();
26
+ };
27
+ };
28
+ return r(() => [e.dictionaryKey, JSON.stringify(e.keyPath)], ([e, t]) => c(e, t), { immediate: !0 }), t(() => s?.()), () => a.default?.({ editedSource: o.value });
29
+ }
30
+ });
31
+ export { a as EditedContentSource };
@@ -5,15 +5,15 @@ import { useAnalytics as o } from "./analytics/useAnalytics.mjs";
5
5
  import { useConversion as s } from "./analytics/useConversion.mjs";
6
6
  import { useExperiment as c } from "./analytics/useExperiment.mjs";
7
7
  import "./analytics/index.mjs";
8
- import { atPath as l, createIntlayerLeafProxy as u, isComponentLike as d, isIntlayerNode as f, isObjectLike as p, toComponent as m, useDictionary as h } from "./client/useDictionary.mjs";
9
- import { useDictionaryAsync as g } from "./client/useDictionaryAsync.mjs";
10
- import { useDictionaryDynamic as _ } from "./client/useDictionaryDynamic.mjs";
11
- import { getIntlayer as v } from "./getIntlayer.mjs";
12
- import { useIntlayer as y } from "./client/useIntlayer.mjs";
13
- import { useLoadDynamic as b } from "./client/useLoadDynamic.mjs";
14
- import { useLocale as x } from "./client/useLocale.mjs";
15
- import { usePathname as S } from "./client/usePathname.mjs";
16
- import { useRewriteURL as C } from "./client/useRewriteURL.mjs";
8
+ import { atPath as l, createContentProxy as u, createIntlayerLeafProxy as d, injectIntlayerProvider as f, isComponentLike as p, isIntlayerNode as m, isObjectLike as h, toComponent as g, useDictionary as _, useResolvedContent as v } from "./client/useDictionary.mjs";
9
+ import { useDictionaryDynamic as y, useDynamicContent as b } from "./client/useDictionaryDynamic.mjs";
10
+ import { useDictionaryAsync as x } from "./client/useDictionaryAsync.mjs";
11
+ import { getIntlayer as S } from "./getIntlayer.mjs";
12
+ import { useIntlayer as C } from "./client/useIntlayer.mjs";
13
+ import { useLoadDynamic as w } from "./client/useLoadDynamic.mjs";
14
+ import { useLocale as T } from "./client/useLocale.mjs";
15
+ import { usePathname as E } from "./client/usePathname.mjs";
16
+ import { useRewriteURL as D } from "./client/useRewriteURL.mjs";
17
17
  import "./client/index.mjs";
18
- import { getPlugins as w, htmlPlugin as T, insertionPlugin as E, intlayerNodePlugins as D, markdownPlugin as O, markdownStringPlugin as k } from "./plugins.mjs";
19
- export { n as INTLAYER_SYMBOL, l as atPath, r as createIntlayerClient, u as createIntlayerLeafProxy, t as getDictionary, v as getIntlayer, w as getPlugins, T as htmlPlugin, E as insertionPlugin, i as installIntlayer, a as intlayer, D as intlayerNodePlugins, d as isComponentLike, f as isIntlayerNode, p as isObjectLike, O as markdownPlugin, k as markdownStringPlugin, m as toComponent, o as useAnalytics, s as useConversion, h as useDictionary, g as useDictionaryAsync, _ as useDictionaryDynamic, e as useEditor, c as useExperiment, y as useIntlayer, b as useLoadDynamic, x as useLocale, S as usePathname, C as useRewriteURL };
18
+ import { getPlugins as O, htmlPlugin as k, insertionPlugin as A, intlayerNodePlugins as j, markdownPlugin as M, markdownStringPlugin as N } from "./plugins.mjs";
19
+ export { n as INTLAYER_SYMBOL, l as atPath, u as createContentProxy, r as createIntlayerClient, d as createIntlayerLeafProxy, t as getDictionary, S as getIntlayer, O as getPlugins, k as htmlPlugin, f as injectIntlayerProvider, A as insertionPlugin, i as installIntlayer, a as intlayer, j as intlayerNodePlugins, p as isComponentLike, m as isIntlayerNode, h as isObjectLike, M as markdownPlugin, N as markdownStringPlugin, g as toComponent, o as useAnalytics, s as useConversion, _ as useDictionary, x as useDictionaryAsync, y as useDictionaryDynamic, b as useDynamicContent, e as useEditor, c as useExperiment, C as useIntlayer, w as useLoadDynamic, T as useLocale, E as usePathname, v as useResolvedContent, D as useRewriteURL };
@@ -1,34 +1,35 @@
1
1
  import { reportExposure as e } from "./analytics/exposureSink.mjs";
2
- import { renderHTML as t } from "./html/HTMLRenderer.mjs";
3
- import { useMarkdown as n } from "./markdown/installIntlayerMarkdown.mjs";
4
- import { renderIntlayerNode as r } from "./renderIntlayerNode.mjs";
5
- import { conditionPlugin as i, enumerationPlugin as a, fallbackPlugin as o, filePlugin as s, genderPlugin as c, isInterpolableWrapperNode as l, nestedPlugin as u, pluralPlugin as d, resolveInsertedSelector as f, resolveInterpreterLocale as p, selectPlugin as m, splitInsertionTemplate as h, transformInterpolableNode as g, translationPlugin as _ } from "@intlayer/core/interpreter";
6
- import { editor as v, internationalization as y } from "@intlayer/config/built";
7
- import { getMarkdownMetadata as b } from "@intlayer/core/markdown";
8
- import * as x from "@intlayer/types/nodeType";
9
- import { Fragment as S, defineAsyncComponent as C, h as w, markRaw as T } from "vue";
2
+ import { EditedContentSource as t } from "./editor/EditedContentSource.mjs";
3
+ import { renderHTML as n } from "./html/HTMLRenderer.mjs";
4
+ import { useMarkdown as r } from "./markdown/installIntlayerMarkdown.mjs";
5
+ import { renderIntlayerNode as i } from "./renderIntlayerNode.mjs";
6
+ import { conditionPlugin as a, enumerationPlugin as o, fallbackPlugin as s, filePlugin as c, genderPlugin as l, isInterpolableWrapperNode as u, nestedPlugin as d, pluralPlugin as f, resolveInsertedSelector as p, resolveInterpreterLocale as m, selectPlugin as h, splitInsertionTemplate as g, transformInterpolableNode as _, translationPlugin as v } from "@intlayer/core/interpreter";
7
+ import { editor as y, internationalization as b } from "@intlayer/config/built";
8
+ import { getMarkdownMetadata as x } from "@intlayer/core/markdown";
9
+ import * as S from "@intlayer/types/nodeType";
10
+ import { Fragment as C, defineAsyncComponent as w, h as T, markRaw as E } from "vue";
10
11
  // src/plugins.ts
11
- var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import("./editor/ContentSelector.mjs")), D = {
12
+ var D = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : w(() => import("./editor/ContentSelector.mjs")), O = {
12
13
  id: "intlayer-node-plugin",
13
14
  canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
14
15
  transform: (t, n) => {
15
- let { children: i, dictionaryKey: a, keyPath: o } = n;
16
+ let { children: r, dictionaryKey: a, keyPath: o } = n;
16
17
  process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
17
18
  dictionaryKey: a,
18
19
  keyPath: o,
19
20
  locale: n.locale,
20
21
  nodeType: "text"
21
22
  });
22
- let s = (e) => r({
23
+ let s = (e) => i({
23
24
  value: e,
24
- children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? () => w(E, {
25
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && y.enabled ? () => T(D, {
25
26
  dictionaryKey: a,
26
27
  keyPath: o
27
28
  }, { default: () => typeof e == "function" ? e() : e }) : e
28
- }), c = s(i);
29
- if (typeof i != "function") return c;
29
+ }), c = s(r);
30
+ if (typeof r != "function") return c;
30
31
  let l = (...e) => {
31
- let t = i(...e);
32
+ let t = r(...e);
32
33
  return s(t);
33
34
  };
34
35
  Object.setPrototypeOf(l, Object.getPrototypeOf(c));
@@ -40,12 +41,12 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
40
41
  let t = Object.getOwnPropertyDescriptor(c, e);
41
42
  t && Object.defineProperty(l, e, t);
42
43
  }
43
- return T(l);
44
+ return E(l);
44
45
  }
45
- }, O = (e, t) => {
46
+ }, k = (e, t) => {
46
47
  let n = /* @__PURE__ */ new Map(), r = {};
47
48
  for (let [e, i] of Object.entries(t)) typeof i == "string" || typeof i == "number" ? r[e] = i : (n.set(e, i), r[e] = `__VNODE_${e}__`);
48
- let i = h(e, r);
49
+ let i = g(e, r);
49
50
  if (n.size > 0) {
50
51
  let e = [];
51
52
  if (i.isSimple) {
@@ -54,7 +55,7 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
54
55
  let a = `__VNODE_${i}__`, o = t.indexOf(a);
55
56
  o !== -1 && (o > r && e.push(t.substring(r, o)), e.push(n.get(i)), r = o + a.length);
56
57
  }
57
- return r < t.length && e.push(t.substring(r)), w(S, null, ...e);
58
+ return r < t.length && e.push(t.substring(r)), T(C, null, ...e);
58
59
  }
59
60
  return i.parts.forEach((t) => {
60
61
  if (typeof t == "string") {
@@ -65,25 +66,25 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
65
66
  }
66
67
  r.length > 0 && e.push(r);
67
68
  } else e.push(t);
68
- }), w(S, null, ...e);
69
+ }), T(C, null, ...e);
69
70
  }
70
- return i.isSimple ? i.parts : w(S, null, i.parts);
71
- }, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? o : {
71
+ return i.isSimple ? i.parts : T(C, null, i.parts);
72
+ }, A = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? s : {
72
73
  id: "insertion-plugin",
73
- canHandle: (e) => typeof e == "object" && e?.nodeType === x.INSERTION,
74
+ canHandle: (e) => typeof e == "object" && e?.nodeType === S.INSERTION,
74
75
  transform: (e, t, n) => {
75
- let r = [...t.keyPath, { type: x.INSERTION }], i = e[x.INSERTION], a = {
76
+ let r = [...t.keyPath, { type: S.INSERTION }], i = e[S.INSERTION], a = {
76
77
  id: "insertion-string-plugin",
77
- canHandle: (e) => typeof e == "string" || l(e),
78
+ canHandle: (e) => typeof e == "string" || u(e),
78
79
  transform: (e, n, r) => {
79
- if (l(e)) return (i) => g(e, i, n, t.plugins, r);
80
+ if (u(e)) return (i) => _(e, i, n, t.plugins, r);
80
81
  let i = r(e, {
81
82
  ...n,
82
83
  children: e,
83
84
  plugins: (t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")
84
85
  });
85
86
  return (e) => {
86
- let a = O(i, e);
87
+ let a = k(i, e);
87
88
  return r(a, {
88
89
  ...n,
89
90
  plugins: t.plugins,
@@ -97,94 +98,100 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
97
98
  keyPath: r,
98
99
  plugins: [a, ...t.plugins ?? []]
99
100
  });
100
- return f(i, o);
101
+ return p(i, o);
101
102
  }
102
- }, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? o : {
103
+ }, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? s : {
103
104
  id: "markdown-string-plugin",
104
105
  canHandle: (e) => typeof e == "string",
105
- transform: (e, t, i) => {
106
- let { plugins: a, ...o } = t, s = i(b(e) ?? {}, {
106
+ transform: (e, n, a) => {
107
+ let { plugins: o, ...s } = n, c = a(x(e) ?? {}, {
107
108
  plugins: [{
108
109
  id: "markdown-metadata-plugin",
109
110
  canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
110
- transform: (t, n) => r({
111
+ transform: (t, n) => i({
111
112
  ...n,
112
113
  value: t,
113
114
  children: e
114
115
  })
115
116
  }],
116
- dictionaryKey: o.dictionaryKey,
117
+ dictionaryKey: s.dictionaryKey,
117
118
  keyPath: []
118
- }), c = (i) => r({
119
- ...t,
119
+ }), l = (a) => i({
120
+ ...n,
120
121
  value: e,
121
122
  children: () => {
122
- let { renderMarkdown: t, components: r } = n(), a = t(e, void 0, {
123
- ...r ?? {},
124
- ...i ?? {}
123
+ let { renderMarkdown: n, components: i } = r(), o = (e) => n(e, void 0, {
124
+ ...i ?? {},
125
+ ...a ?? {}
125
126
  });
126
- return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? w(E, {
127
- dictionaryKey: o.dictionaryKey,
128
- keyPath: o.keyPath
129
- }, { default: () => a }) : a;
127
+ return process.env.INTLAYER_EDITOR_ENABLED !== "false" && y.enabled ? T(D, {
128
+ dictionaryKey: s.dictionaryKey,
129
+ keyPath: s.keyPath
130
+ }, { default: () => T(t, {
131
+ dictionaryKey: s.dictionaryKey,
132
+ keyPath: s.keyPath
133
+ }, { default: ({ editedSource: t }) => o(t ?? e) }) }) : o(e);
130
134
  },
131
135
  additionalProps: {
132
- metadata: s,
133
- use: (e) => c(e)
136
+ metadata: c,
137
+ use: (e) => l(e)
134
138
  }
135
139
  });
136
- return c();
140
+ return l();
137
141
  }
138
- }, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? o : {
142
+ }, M = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? s : {
139
143
  id: "markdown-plugin",
140
- canHandle: (e) => typeof e == "object" && e?.nodeType === x.MARKDOWN,
144
+ canHandle: (e) => typeof e == "object" && e?.nodeType === S.MARKDOWN,
141
145
  transform: (e, t, n) => {
142
- let r = [...t.keyPath, { type: x.MARKDOWN }], i = e[x.MARKDOWN];
146
+ let r = [...t.keyPath, { type: S.MARKDOWN }], i = e[S.MARKDOWN];
143
147
  return n(i, {
144
148
  ...t,
145
149
  children: i,
146
150
  keyPath: r,
147
- plugins: [A, ...t.plugins ?? []]
151
+ plugins: [j, ...t.plugins ?? []]
148
152
  });
149
153
  }
150
- }, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? o : {
154
+ }, N = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? s : {
151
155
  id: "html-plugin",
152
- canHandle: (e) => typeof e == "object" && e?.nodeType === x.HTML,
153
- transform: (e, n) => {
154
- let i = e[x.HTML];
156
+ canHandle: (e) => typeof e == "object" && e?.nodeType === S.HTML,
157
+ transform: (e, r) => {
158
+ let a = e[S.HTML];
155
159
  e.tags;
156
- let a = (e = {}) => {
157
- let o = t(i, { components: e });
158
- return r({
159
- ...n,
160
- value: i,
161
- children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? () => w(E, {
162
- dictionaryKey: n.dictionaryKey,
163
- keyPath: n.keyPath,
160
+ let o = (e = {}) => {
161
+ let s = n(a, { components: e });
162
+ return i({
163
+ ...r,
164
+ value: a,
165
+ children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && y.enabled ? () => T(D, {
166
+ dictionaryKey: r.dictionaryKey,
167
+ keyPath: r.keyPath,
164
168
  ...e
165
- }, { default: () => o }) : o,
166
- additionalProps: { use: (e) => a(e) }
169
+ }, { default: () => T(t, {
170
+ dictionaryKey: r.dictionaryKey,
171
+ keyPath: r.keyPath
172
+ }, { default: ({ editedSource: t }) => t === void 0 ? s : n(t, { components: e }) }) }) : s,
173
+ additionalProps: { use: (e) => o(e) }
167
174
  });
168
175
  };
169
- return a();
176
+ return o();
170
177
  }
171
- }, N = /* @__PURE__ */ new Map(), P = (e, t = !0) => {
172
- let n = p(e), r = `${n}_${t}`;
173
- if (N.has(r)) return N.get(r);
174
- let l = [
175
- D,
176
- _(n, t ? y.defaultLocale : void 0),
178
+ }, P = /* @__PURE__ */ new Map(), F = (e, t = !0) => {
179
+ let n = m(e), r = `${n}_${t}`;
180
+ if (P.has(r)) return P.get(r);
181
+ let i = [
182
+ O,
183
+ v(n, t ? b.defaultLocale : void 0),
184
+ o,
185
+ f(n),
177
186
  a,
178
187
  d(n),
179
- i,
180
- u(n),
181
- s,
182
188
  c,
183
- m,
184
- k,
185
- j,
186
- M
187
- ].filter((e) => e !== o);
188
- return N.set(r, l), l;
189
+ l,
190
+ h,
191
+ A,
192
+ M,
193
+ N
194
+ ].filter((e) => e !== s);
195
+ return P.set(r, i), i;
189
196
  };
190
- export { P as getPlugins, M as htmlPlugin, k as insertionPlugin, D as intlayerNodePlugins, j as markdownPlugin, A as markdownStringPlugin };
197
+ export { F as getPlugins, N as htmlPlugin, A as insertionPlugin, O as intlayerNodePlugins, M as markdownPlugin, j as markdownStringPlugin };
@@ -1,7 +1,8 @@
1
- import { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from '@intlayer/types/dictionary';
1
+ import { Dictionary, DictionarySelector, DictionarySelectorForGroup, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from '@intlayer/types/dictionary';
2
2
  import { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from '@intlayer/types/module_augmentation';
3
- import { ComputedRef, MaybeRefOrGetter } from 'vue';
3
+ import { ComputedRef, MaybeRefOrGetter, Ref } from 'vue';
4
4
  import { DeepTransformContent } from '../plugins';
5
+ import { IntlayerProvider } from './installIntlayer';
5
6
  export declare const atPath: (obj: any, path: (string | number)[]) => any;
6
7
  export declare const isObjectLike: (v: any) => boolean;
7
8
  export declare const isComponentLike: (v: any) => boolean;
@@ -17,4 +18,37 @@ export declare const toComponent: (getter: () => any) => import('vue').Raw<impor
17
18
  * - Passes through other IntlayerNode properties (render, toString, etc.)
18
19
  */
19
20
  export declare const createIntlayerLeafProxy: (leafRef: ComputedRef<any>) => any;
21
+ /**
22
+ * The provider installed by `installIntlayer`, when called where `inject` works
23
+ * (a component setup, or `app.runWithContext`).
24
+ */
25
+ export declare const injectIntlayerProvider: () => IntlayerProvider | undefined;
26
+ /**
27
+ * Creates the deep, read-only proxy every Vue read returns over its content:
28
+ * fields are ref-like (templates unwrap them), IntlayerNode leaves expose
29
+ * `.value`, and a locale switch only replaces `source`. One proxy per path, so
30
+ * repeated accesses share their computed refs.
31
+ *
32
+ * @param source - The single reactive source of the whole content tree.
33
+ */
34
+ export declare const createContentProxy: (source: Ref<unknown>) => any;
35
+ /**
36
+ * Runs a read whenever its source, the call argument, the provider locale or
37
+ * the provider variant changes, and returns the content proxy over it — the
38
+ * one implementation behind `useDictionary` and `useIntlayer`.
39
+ */
40
+ export declare const useResolvedContent: <Source>(params: {
41
+ getSource: () => Source;
42
+ getDictionaryKey: (source: Source) => string;
43
+ readContent: (source: Source, argument: LocalesValues | DictionarySelector | undefined) => unknown;
44
+ localeOrSelector?: MaybeRefOrGetter<LocalesValues | DictionarySelector | null | undefined>;
45
+ }) => any;
46
+ /**
47
+ * Vue composable that transforms a dictionary (or qualified dictionary group)
48
+ * and returns its reactive content.
49
+ *
50
+ * If the locale is not provided (directly or through the selector), it will
51
+ * use the provider locale. The same applies to the variant, which falls back
52
+ * to the provider's ambient `variant`.
53
+ */
20
54
  export declare const useDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: MaybeRefOrGetter<T>, localeOrSelector?: MaybeRefOrGetter<A | null | undefined>) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>;
@@ -1,9 +1,12 @@
1
- import { Dictionary } from '@intlayer/types/dictionary';
1
+ import { Dictionary, DictionarySelector } from '@intlayer/types/dictionary';
2
2
  import { LocalesValues, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
3
3
  import { MaybeRefOrGetter } from 'vue';
4
+ import { useDictionary } from './useDictionary';
4
5
  /**
5
- * On the server side, Hook that transform a dictionary and return the content
6
+ * Loads the chunk of a per-locale loader map and returns its reactive content,
7
+ * through the same implementation as `useDictionaryDynamic`.
6
8
  *
7
- * If the locale is not provided, it will use the locale from the client context
9
+ * If the locale is not provided, it will use the locale from the client context.
10
+ * A selector can pin the locale or request `{ metadataOnly: true }`.
8
11
  */
9
- export declare const useDictionaryAsync: <const T extends Dictionary>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: MaybeRefOrGetter<LocalesValues>) => Promise<unknown>;
12
+ export declare const useDictionaryAsync: <const T extends Dictionary>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, localeOrSelector?: MaybeRefOrGetter<LocalesValues | DictionarySelector | null | undefined>) => Promise<ReturnType<typeof useDictionary<T, any>>>;
@@ -1,15 +1,31 @@
1
- import { QualifiedDynamicLoaderMap } from '@intlayer/core/dictionaryManipulator';
2
- import { Dictionary } from '@intlayer/types/dictionary';
1
+ import { DynamicLoaderMap, QualifiedDynamicLoaderMap } from '@intlayer/core/dictionaryManipulator';
2
+ import { Dictionary, DictionarySelector } from '@intlayer/types/dictionary';
3
3
  import { DeclaredLocales, DictionaryKeys, DictionarySelectorForKey, LocalesValues, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
4
4
  import { MaybeRefOrGetter } from 'vue';
5
+ import { DeepTransformContent } from '../plugins';
5
6
  /**
6
- * Lazily loads a dictionary (plain or qualified) and returns its content.
7
+ * Loads a dynamic read and returns the content proxy over it, reloading on
8
+ * every change of the call argument, provider locale or provider variant — the
9
+ * one implementation behind `useDictionaryDynamic` and `useDictionaryAsync`.
7
10
  *
8
- * For a qualified loader map (collection / variant, possibly
9
- * combined), only the chunk(s) the selector targets are awaited and resolved.
10
- * For a plain loader map, the locale chunk is awaited and made reactive.
11
+ * Resolves once the first content is loaded (Vue awaits it in `<script
12
+ * setup>`); later reloads keep the previous content until the next one lands.
11
13
  *
12
- * If the locale is not provided (directly or through the selector), it will use
13
- * the locale from the client context.
14
+ * @param loaderMap - Plain or qualified dynamic loader map.
15
+ * @param dictionaryKey - Dictionary key (provider variant lookup, cache keys).
16
+ * @param localeOrSelector - Optional reactive locale or selector.
14
17
  */
15
- export declare const useDictionaryDynamic: <const T extends Dictionary, const K extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>> | QualifiedDynamicLoaderMap, key: K, localeOrSelector?: MaybeRefOrGetter<A | null | undefined>) => Promise<any>;
18
+ export declare const useDynamicContent: (loaderMap: DynamicLoaderMap, dictionaryKey: string, localeOrSelector?: MaybeRefOrGetter<LocalesValues | DictionarySelector | null | undefined>) => Promise<any>;
19
+ /**
20
+ * Vue composable that lazily loads a dictionary (plain or qualified) and
21
+ * returns its reactive content.
22
+ *
23
+ * The locale, selector, chunk selection and transform are resolved by the
24
+ * shared `resolveDictionaryRead` / dynamic content store, so only the chunk(s)
25
+ * the read targets are loaded.
26
+ *
27
+ * @param dictionaryPromise - Locale-keyed loader map, or a qualified loader map.
28
+ * @param key - The dictionary key.
29
+ * @param localeOrSelector - Optional reactive locale or selector.
30
+ */
31
+ export declare const useDictionaryDynamic: <const T extends Dictionary, const K extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<K> = DeclaredLocales>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>> | QualifiedDynamicLoaderMap, key: K, localeOrSelector?: MaybeRefOrGetter<A | null | undefined>) => Promise<DeepTransformContent<T["content"]>>;
@@ -5,10 +5,11 @@ import { DeepTransformContent } from '../plugins';
5
5
  * Vue composable that picks one dictionary by its key and returns its reactive content.
6
6
  *
7
7
  * This hook provides deep reactivity, meaning your components will automatically
8
- * update when the locale changes.
8
+ * update when the locale changes. It shares its implementation with
9
+ * `useDictionary`, which the build optimization rewrites it into.
9
10
  *
10
11
  * @param key - The unique key of the dictionary to retrieve.
11
- * @param locale - Optional reactive locale or getter to override the current context locale.
12
+ * @param localeOrSelector - Optional reactive locale or selector (or getter) overriding the provider locale.
12
13
  * @returns A reactive proxy to the dictionary content.
13
14
  *
14
15
  * @example
@@ -0,0 +1,28 @@
1
+ import { KeyPath } from '@intlayer/types/keyPath';
2
+ import { PropType } from 'vue';
3
+ /**
4
+ * Renderless component exposing, through its default scoped slot, the source
5
+ * string edited in the visual editor for a markdown / html node
6
+ * (`{ editedSource }`, `undefined` when the node is not edited).
7
+ */
8
+ export declare const EditedContentSource: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
9
+ dictionaryKey: {
10
+ type: StringConstructor;
11
+ required: true;
12
+ };
13
+ keyPath: {
14
+ type: PropType<KeyPath[]>;
15
+ required: true;
16
+ };
17
+ }>, () => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
18
+ [key: string]: any;
19
+ }>[] | undefined, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
20
+ dictionaryKey: {
21
+ type: StringConstructor;
22
+ required: true;
23
+ };
24
+ keyPath: {
25
+ type: PropType<KeyPath[]>;
26
+ required: true;
27
+ };
28
+ }>> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-intlayer",
3
- "version": "9.8.4",
3
+ "version": "9.9.0",
4
4
  "private": false,
5
5
  "description": "Easily internationalize i18n your Vue applications with type-safe multilingual content management.",
6
6
  "keywords": [
@@ -103,12 +103,12 @@
103
103
  "typecheck": "vue-tsc --noEmit --project tsconfig.types.json"
104
104
  },
105
105
  "dependencies": {
106
- "@intlayer/api": "9.8.4",
107
- "@intlayer/config": "9.8.4",
108
- "@intlayer/core": "9.8.4",
109
- "@intlayer/dictionaries-entry": "9.8.4",
110
- "@intlayer/editor": "9.8.4",
111
- "@intlayer/types": "9.8.4",
106
+ "@intlayer/api": "9.9.0",
107
+ "@intlayer/config": "9.9.0",
108
+ "@intlayer/core": "9.9.0",
109
+ "@intlayer/dictionaries-entry": "9.9.0",
110
+ "@intlayer/editor": "9.9.0",
111
+ "@intlayer/types": "9.9.0",
112
112
  "@vue/devtools-api": "^6.6.4"
113
113
  },
114
114
  "devDependencies": {
@@ -128,7 +128,7 @@
128
128
  "vue-tsc": "3.3.9"
129
129
  },
130
130
  "peerDependencies": {
131
- "intlayer": "9.8.4",
131
+ "intlayer": "9.9.0",
132
132
  "vue": ">=3.0.0"
133
133
  },
134
134
  "peerDependenciesMeta": {
@@ -137,7 +137,7 @@
137
137
  }
138
138
  },
139
139
  "optionalDependencies": {
140
- "@intlayer/analytics": "9.8.4"
140
+ "@intlayer/analytics": "9.9.0"
141
141
  },
142
142
  "engines": {
143
143
  "node": ">=14.18"