vue-intlayer 9.5.11 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryAsync.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/client/useDictionary.mjs +2 -2
- package/dist/esm/client/useDictionaryAsync.mjs +2 -2
- package/dist/esm/client/useDictionaryDynamic.mjs +2 -2
- package/dist/esm/client/useIntlayer.mjs +2 -2
- package/dist/esm/plugins.mjs +43 -43
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./installIntlayer.cjs");let n=require("@intlayer/
|
|
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 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./installIntlayer.cjs"),t=require("./useDictionary.cjs");let n=require("@intlayer/
|
|
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 +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/
|
|
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 +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/
|
|
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;
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./analytics/exposureSink.cjs"),l=require("./html/HTMLRenderer.cjs"),u=require("./markdown/installIntlayerMarkdown.cjs"),d=require("./renderIntlayerNode.cjs");let f=require("@intlayer/core/interpreter"),p=require("@intlayer/config/built"),m=require("@intlayer/core/markdown"),h=require("@intlayer/types/nodeType");h=s(h);let g=require("vue");var _=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,g.defineAsyncComponent)(()=>Promise.resolve().then(()=>require("./editor/ContentSelector.cjs"))),v={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,t)=>{let{children:n,dictionaryKey:r,keyPath:i}=t;process.env.INTLAYER_ANALYTICS_ENABLED!==`false`&&c.reportExposure({dictionaryKey:r,keyPath:i,locale:t.locale,nodeType:`text`});let a=e=>d.renderIntlayerNode({value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?()=>(0,g.h)(_,{dictionaryKey:r,keyPath:i},{default:()=>typeof e==`function`?e():e}):e}),o=a(n);if(typeof n!=`function`)return o;let s=(...e)=>{let t=n(...e);return a(t)};Object.setPrototypeOf(s,Object.getPrototypeOf(o));for(let e of Object.getOwnPropertyNames(o)){let t=Object.getOwnPropertyDescriptor(o,e);t&&Object.defineProperty(s,e,t)}for(let e of Object.getOwnPropertySymbols(o)){let t=Object.getOwnPropertyDescriptor(o,e);t&&Object.defineProperty(s,e,t)}return(0,g.markRaw)(s)}},y=(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,f.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,g.h)(g.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,g.h)(g.Fragment,null,...e)}return i.isSimple?i.parts:(0,g.h)(g.Fragment,null,i.parts)},b=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?f.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.INSERTION}],i=e[h.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,f.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,f.isInterpolableWrapperNode)(e))return i=>(0,f.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=y(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return(0,f.resolveInsertedSelector)(i,o)}},x=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,a=n((0,m.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>d.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),o=n=>d.renderIntlayerNode({...t,value:e,children:()=>{let{renderMarkdown:t,components:r}=u.useMarkdown(),a=t(e,void 0,{...r??{},...n??{}});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?(0,g.h)(_,{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},{default:()=>a}):a},additionalProps:{metadata:a,use:e=>o(e)}});return o()}},S=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.MARKDOWN}],i=e[h.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[x,...t.plugins??[]]})}},C=process.env.INTLAYER_NODE_TYPE_HTML===`false`?f.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.HTML,transform:(e,t)=>{let n=e[h.HTML];e.tags;let r=(e={})=>{let i=l.renderHTML(n,{components:e});return d.renderIntlayerNode({...t,value:n,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?()=>(0,g.h)(_,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath,...e},{default:()=>i}):i,additionalProps:{use:e=>r(e)}})};return r()}},w=new Map,T=(e,t=!0)=>{let n=`${
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./analytics/exposureSink.cjs"),l=require("./html/HTMLRenderer.cjs"),u=require("./markdown/installIntlayerMarkdown.cjs"),d=require("./renderIntlayerNode.cjs");let f=require("@intlayer/core/interpreter"),p=require("@intlayer/config/built"),m=require("@intlayer/core/markdown"),h=require("@intlayer/types/nodeType");h=s(h);let g=require("vue");var _=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,g.defineAsyncComponent)(()=>Promise.resolve().then(()=>require("./editor/ContentSelector.cjs"))),v={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,t)=>{let{children:n,dictionaryKey:r,keyPath:i}=t;process.env.INTLAYER_ANALYTICS_ENABLED!==`false`&&c.reportExposure({dictionaryKey:r,keyPath:i,locale:t.locale,nodeType:`text`});let a=e=>d.renderIntlayerNode({value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?()=>(0,g.h)(_,{dictionaryKey:r,keyPath:i},{default:()=>typeof e==`function`?e():e}):e}),o=a(n);if(typeof n!=`function`)return o;let s=(...e)=>{let t=n(...e);return a(t)};Object.setPrototypeOf(s,Object.getPrototypeOf(o));for(let e of Object.getOwnPropertyNames(o)){let t=Object.getOwnPropertyDescriptor(o,e);t&&Object.defineProperty(s,e,t)}for(let e of Object.getOwnPropertySymbols(o)){let t=Object.getOwnPropertyDescriptor(o,e);t&&Object.defineProperty(s,e,t)}return(0,g.markRaw)(s)}},y=(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,f.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,g.h)(g.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,g.h)(g.Fragment,null,...e)}return i.isSimple?i.parts:(0,g.h)(g.Fragment,null,i.parts)},b=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?f.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.INSERTION}],i=e[h.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,f.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,f.isInterpolableWrapperNode)(e))return i=>(0,f.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=y(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return(0,f.resolveInsertedSelector)(i,o)}},x=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,a=n((0,m.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>d.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),o=n=>d.renderIntlayerNode({...t,value:e,children:()=>{let{renderMarkdown:t,components:r}=u.useMarkdown(),a=t(e,void 0,{...r??{},...n??{}});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?(0,g.h)(_,{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},{default:()=>a}):a},additionalProps:{metadata:a,use:e=>o(e)}});return o()}},S=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.MARKDOWN}],i=e[h.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[x,...t.plugins??[]]})}},C=process.env.INTLAYER_NODE_TYPE_HTML===`false`?f.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.HTML,transform:(e,t)=>{let n=e[h.HTML];e.tags;let r=(e={})=>{let i=l.renderHTML(n,{components:e});return d.renderIntlayerNode({...t,value:n,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?()=>(0,g.h)(_,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath,...e},{default:()=>i}):i,additionalProps:{use:e=>r(e)}})};return r()}},w=new Map,T=(e,t=!0)=>{let n=(0,f.resolveInterpreterLocale)(e),r=`${n}_${t}`;if(w.has(r))return w.get(r);let i=[v,(0,f.translationPlugin)(n,t?p.internationalization.defaultLocale:void 0),f.enumerationPlugin,(0,f.pluralPlugin)(n),f.conditionPlugin,(0,f.nestedPlugin)(n),f.filePlugin,f.genderPlugin,f.selectPlugin,b,S,C].filter(e=>e!==f.fallbackPlugin);return w.set(r,i),i};exports.getPlugins=T,exports.htmlPlugin=C,exports.insertionPlugin=b,exports.intlayerNodePlugins=v,exports.markdownPlugin=S,exports.markdownStringPlugin=x;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
2
|
import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveInterpreterLocale as n } from "@intlayer/core/interpreter";
|
|
4
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
5
|
import { parseDictionarySelector as m, resolveDictionaryArgument as h } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
//#region src/client/useDictionary.ts
|
|
@@ -35,7 +35,7 @@ var g = (e, t) => t.reduce((e, t) => e?.[t], e), _ = (e) => typeof e == "object"
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
}), S = (i, o) => {
|
|
38
|
-
let l = a() ? s(t) : void 0, S = c(l?.locale) ? l.locale : u(l?.locale ?? n
|
|
38
|
+
let l = a() ? s(t) : void 0, S = c(l?.locale) ? l.locale : u(l?.locale ?? n()), C = r(() => {
|
|
39
39
|
let e = o === void 0 ? void 0 : f(o);
|
|
40
40
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
|
|
41
41
|
let t = h({
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { INTLAYER_SYMBOL as e } from "./installIntlayer.mjs";
|
|
2
2
|
import { useDictionary as t } from "./useDictionary.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveInterpreterLocale as n } from "@intlayer/core/interpreter";
|
|
4
4
|
import { computed as r, inject as i, ref as a, toValue as o, watch as s } from "vue";
|
|
5
5
|
import { getPreloadedDictionary as c } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
//#region src/client/useDictionaryAsync.ts
|
|
7
7
|
var l = async (l, u) => {
|
|
8
|
-
let d = i(e), f = r(() => o(u) ?? d?.locale?.value ?? n
|
|
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
9
|
return s(() => f.value, async (e) => {
|
|
10
10
|
let t = await l[e]?.();
|
|
11
11
|
t && (m.value = t);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
2
|
import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
|
|
3
3
|
import { useDictionaryAsync as n } from "./useDictionaryAsync.mjs";
|
|
4
|
-
import {
|
|
4
|
+
import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
|
|
5
5
|
import { inject as i, toValue as a } from "vue";
|
|
6
6
|
import { isQualifiedDynamicLoaderMap as o, parseDictionarySelector as s, resolveDictionaryArgument as c, resolveQualifiedDynamicContentAsync as l } from "@intlayer/core/dictionaryManipulator";
|
|
7
7
|
//#region src/client/useDictionaryDynamic.ts
|
|
@@ -12,7 +12,7 @@ var u = async (u, d, f) => {
|
|
|
12
12
|
contextLocale: n?.locale?.value,
|
|
13
13
|
contextVariant: n?.variant?.value,
|
|
14
14
|
dictionaryKey: String(d)
|
|
15
|
-
})), h = p ?? n?.locale?.value ?? r
|
|
15
|
+
})), h = p ?? n?.locale?.value ?? r();
|
|
16
16
|
return l({
|
|
17
17
|
loaderMap: u,
|
|
18
18
|
key: String(d),
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { getIntlayer as e } from "../getIntlayer.mjs";
|
|
2
2
|
import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
|
|
3
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 {
|
|
4
|
+
import { resolveInterpreterLocale as c } from "@intlayer/core/interpreter";
|
|
5
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
6
|
import { parseDictionarySelector as g, resolveDictionaryArgument as _ } from "@intlayer/core/dictionaryManipulator";
|
|
7
7
|
//#region src/client/useIntlayer.ts
|
|
8
8
|
var v = (v, y) => {
|
|
9
|
-
let b = u(t), x = d(b?.locale) ? b.locale : f(b?.locale ?? c
|
|
9
|
+
let b = u(t), x = d(b?.locale) ? b.locale : f(b?.locale ?? c()), S = l(() => {
|
|
10
10
|
let e = y === void 0 ? void 0 : m(y);
|
|
11
11
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
|
|
12
12
|
let t = _({
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -2,13 +2,13 @@ import { reportExposure as e } from "./analytics/exposureSink.mjs";
|
|
|
2
2
|
import { renderHTML as t } from "./html/HTMLRenderer.mjs";
|
|
3
3
|
import { useMarkdown as n } from "./markdown/installIntlayerMarkdown.mjs";
|
|
4
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,
|
|
6
|
-
import { editor as
|
|
7
|
-
import { getMarkdownMetadata as
|
|
8
|
-
import * as
|
|
9
|
-
import { Fragment as
|
|
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";
|
|
10
10
|
//#region src/plugins.ts
|
|
11
|
-
var
|
|
11
|
+
var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import("./editor/ContentSelector.mjs")), D = {
|
|
12
12
|
id: "intlayer-node-plugin",
|
|
13
13
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
14
14
|
transform: (t, n) => {
|
|
@@ -21,7 +21,7 @@ var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : S(() => import(
|
|
|
21
21
|
});
|
|
22
22
|
let s = (e) => r({
|
|
23
23
|
value: e,
|
|
24
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
24
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? () => w(E, {
|
|
25
25
|
dictionaryKey: a,
|
|
26
26
|
keyPath: o
|
|
27
27
|
}, { default: () => typeof e == "function" ? e() : e }) : e
|
|
@@ -40,12 +40,12 @@ var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : S(() => import(
|
|
|
40
40
|
let t = Object.getOwnPropertyDescriptor(c, e);
|
|
41
41
|
t && Object.defineProperty(l, e, t);
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return T(l);
|
|
44
44
|
}
|
|
45
|
-
},
|
|
45
|
+
}, O = (e, t) => {
|
|
46
46
|
let n = /* @__PURE__ */ new Map(), r = {};
|
|
47
47
|
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 =
|
|
48
|
+
let i = h(e, r);
|
|
49
49
|
if (n.size > 0) {
|
|
50
50
|
let e = [];
|
|
51
51
|
if (i.isSimple) {
|
|
@@ -54,7 +54,7 @@ var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : S(() => import(
|
|
|
54
54
|
let a = `__VNODE_${i}__`, o = t.indexOf(a);
|
|
55
55
|
o !== -1 && (o > r && e.push(t.substring(r, o)), e.push(n.get(i)), r = o + a.length);
|
|
56
56
|
}
|
|
57
|
-
return r < t.length && e.push(t.substring(r)),
|
|
57
|
+
return r < t.length && e.push(t.substring(r)), w(S, null, ...e);
|
|
58
58
|
}
|
|
59
59
|
return i.parts.forEach((t) => {
|
|
60
60
|
if (typeof t == "string") {
|
|
@@ -65,25 +65,25 @@ var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : S(() => import(
|
|
|
65
65
|
}
|
|
66
66
|
r.length > 0 && e.push(r);
|
|
67
67
|
} else e.push(t);
|
|
68
|
-
}),
|
|
68
|
+
}), w(S, null, ...e);
|
|
69
69
|
}
|
|
70
|
-
return i.isSimple ? i.parts :
|
|
71
|
-
},
|
|
70
|
+
return i.isSimple ? i.parts : w(S, null, i.parts);
|
|
71
|
+
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? o : {
|
|
72
72
|
id: "insertion-plugin",
|
|
73
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
73
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === x.INSERTION,
|
|
74
74
|
transform: (e, t, n) => {
|
|
75
|
-
let r = [...t.keyPath, { type:
|
|
75
|
+
let r = [...t.keyPath, { type: x.INSERTION }], i = e[x.INSERTION], a = {
|
|
76
76
|
id: "insertion-string-plugin",
|
|
77
77
|
canHandle: (e) => typeof e == "string" || l(e),
|
|
78
78
|
transform: (e, n, r) => {
|
|
79
|
-
if (l(e)) return (i) =>
|
|
79
|
+
if (l(e)) return (i) => g(e, i, n, t.plugins, r);
|
|
80
80
|
let i = r(e, {
|
|
81
81
|
...n,
|
|
82
82
|
children: e,
|
|
83
83
|
plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
|
|
84
84
|
});
|
|
85
85
|
return (e) => {
|
|
86
|
-
let a =
|
|
86
|
+
let a = O(i, e);
|
|
87
87
|
return r(a, {
|
|
88
88
|
...n,
|
|
89
89
|
plugins: t.plugins,
|
|
@@ -99,11 +99,11 @@ var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : S(() => import(
|
|
|
99
99
|
});
|
|
100
100
|
return f(i, o);
|
|
101
101
|
}
|
|
102
|
-
},
|
|
102
|
+
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? o : {
|
|
103
103
|
id: "markdown-string-plugin",
|
|
104
104
|
canHandle: (e) => typeof e == "string",
|
|
105
105
|
transform: (e, t, i) => {
|
|
106
|
-
let { plugins: a, ...o } = t, s = i(
|
|
106
|
+
let { plugins: a, ...o } = t, s = i(b(e) ?? {}, {
|
|
107
107
|
plugins: [{
|
|
108
108
|
id: "markdown-metadata-plugin",
|
|
109
109
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
@@ -123,7 +123,7 @@ var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : S(() => import(
|
|
|
123
123
|
...r ?? {},
|
|
124
124
|
...i ?? {}
|
|
125
125
|
});
|
|
126
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
126
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? w(E, {
|
|
127
127
|
dictionaryKey: o.dictionaryKey,
|
|
128
128
|
keyPath: o.keyPath
|
|
129
129
|
}, { default: () => a }) : a;
|
|
@@ -135,30 +135,30 @@ var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : S(() => import(
|
|
|
135
135
|
});
|
|
136
136
|
return c();
|
|
137
137
|
}
|
|
138
|
-
},
|
|
138
|
+
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? o : {
|
|
139
139
|
id: "markdown-plugin",
|
|
140
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
140
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === x.MARKDOWN,
|
|
141
141
|
transform: (e, t, n) => {
|
|
142
|
-
let r = [...t.keyPath, { type:
|
|
142
|
+
let r = [...t.keyPath, { type: x.MARKDOWN }], i = e[x.MARKDOWN];
|
|
143
143
|
return n(i, {
|
|
144
144
|
...t,
|
|
145
145
|
children: i,
|
|
146
146
|
keyPath: r,
|
|
147
|
-
plugins: [
|
|
147
|
+
plugins: [A, ...t.plugins ?? []]
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
},
|
|
150
|
+
}, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? o : {
|
|
151
151
|
id: "html-plugin",
|
|
152
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
152
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === x.HTML,
|
|
153
153
|
transform: (e, n) => {
|
|
154
|
-
let i = e[
|
|
154
|
+
let i = e[x.HTML];
|
|
155
155
|
e.tags;
|
|
156
156
|
let a = (e = {}) => {
|
|
157
157
|
let o = t(i, { components: e });
|
|
158
158
|
return r({
|
|
159
159
|
...n,
|
|
160
160
|
value: i,
|
|
161
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
161
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? () => w(E, {
|
|
162
162
|
dictionaryKey: n.dictionaryKey,
|
|
163
163
|
keyPath: n.keyPath,
|
|
164
164
|
...e
|
|
@@ -168,24 +168,24 @@ var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : S(() => import(
|
|
|
168
168
|
};
|
|
169
169
|
return a();
|
|
170
170
|
}
|
|
171
|
-
},
|
|
172
|
-
let n =
|
|
173
|
-
if (
|
|
174
|
-
let
|
|
175
|
-
|
|
176
|
-
|
|
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),
|
|
177
177
|
a,
|
|
178
|
-
d(
|
|
178
|
+
d(n),
|
|
179
179
|
i,
|
|
180
|
-
u(
|
|
180
|
+
u(n),
|
|
181
181
|
s,
|
|
182
182
|
c,
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
183
|
+
m,
|
|
184
|
+
k,
|
|
185
|
+
j,
|
|
186
|
+
M
|
|
187
187
|
].filter((e) => e !== o);
|
|
188
|
-
return
|
|
188
|
+
return N.set(r, l), l;
|
|
189
189
|
};
|
|
190
190
|
//#endregion
|
|
191
|
-
export {
|
|
191
|
+
export { P as getPlugins, M as htmlPlugin, k as insertionPlugin, D as intlayerNodePlugins, j as markdownPlugin, A as markdownStringPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intlayer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.6.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.
|
|
107
|
-
"@intlayer/config": "9.
|
|
108
|
-
"@intlayer/core": "9.
|
|
109
|
-
"@intlayer/dictionaries-entry": "9.
|
|
110
|
-
"@intlayer/editor": "9.
|
|
111
|
-
"@intlayer/types": "9.
|
|
106
|
+
"@intlayer/api": "9.6.0",
|
|
107
|
+
"@intlayer/config": "9.6.0",
|
|
108
|
+
"@intlayer/core": "9.6.0",
|
|
109
|
+
"@intlayer/dictionaries-entry": "9.6.0",
|
|
110
|
+
"@intlayer/editor": "9.6.0",
|
|
111
|
+
"@intlayer/types": "9.6.0",
|
|
112
112
|
"@vue/devtools-api": "^6.6.4"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
@@ -124,11 +124,11 @@
|
|
|
124
124
|
"typescript": "7.0.2",
|
|
125
125
|
"vite": "8.3.1",
|
|
126
126
|
"vite-plugin-dts": "5.1.1",
|
|
127
|
-
"vitest": "5.0.
|
|
127
|
+
"vitest": "5.0.3",
|
|
128
128
|
"vue-tsc": "3.3.9"
|
|
129
129
|
},
|
|
130
130
|
"peerDependencies": {
|
|
131
|
-
"intlayer": "9.
|
|
131
|
+
"intlayer": "9.6.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.
|
|
140
|
+
"@intlayer/analytics": "9.6.0"
|
|
141
141
|
},
|
|
142
142
|
"engines": {
|
|
143
143
|
"node": ">=14.18"
|