vue-intlayer 9.8.5 → 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.
@@ -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;
@@ -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,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 };
@@ -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,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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-intlayer",
3
- "version": "9.8.5",
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.5",
107
- "@intlayer/config": "9.8.5",
108
- "@intlayer/core": "9.8.5",
109
- "@intlayer/dictionaries-entry": "9.8.5",
110
- "@intlayer/editor": "9.8.5",
111
- "@intlayer/types": "9.8.5",
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.5",
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.5"
140
+ "@intlayer/analytics": "9.9.0"
141
141
  },
142
142
  "engines": {
143
143
  "node": ">=14.18"