vue-intlayer 9.8.1 → 9.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/devtools/editDictionaryContent.cjs +1 -1
- package/dist/cjs/html/HTMLRenderer.cjs +1 -1
- package/dist/cjs/html/installIntlayerHTML.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/client/useDictionary.mjs +25 -25
- package/dist/esm/client/useDictionaryAsync.mjs +5 -5
- package/dist/esm/client/useDictionaryDynamic.mjs +8 -8
- package/dist/esm/client/useIntlayer.mjs +18 -18
- package/dist/esm/devtools/editDictionaryContent.mjs +13 -13
- package/dist/esm/html/HTMLRenderer.mjs +7 -7
- package/dist/esm/html/installIntlayerHTML.mjs +12 -12
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/plugins.mjs +74 -74
- 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("
|
|
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("
|
|
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("
|
|
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("
|
|
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 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../rolldown-runtime-BocRIvOZ.js"),t=require("./formatDictionaryForInspector.cjs");let n=require("@intlayer/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../rolldown-runtime-BocRIvOZ.js"),t=require("./formatDictionaryForInspector.cjs");let n=require("@intlayer/types/nodeType");n=e.t(n);let r=require("@intlayer/core/dictionaryManipulator");var i=e=>typeof e==`object`&&!!e&&!Array.isArray(e),a=(e,t)=>{let a=(0,r.getContentNodeByKeyPath)(e.content,t);return typeof a==`string`?`plain-string`:i(a)&&a.nodeType===n.TRANSLATION&&i(a[n.TRANSLATION])&&Object.values(a[n.TRANSLATION]).every(e=>typeof e==`string`)?`translation`:null},o=(e,t=`Translations`)=>{let[n,r,...i]=e[0]===t?e.slice(1):e;return!n||i.length>0?null:r?{label:n,locale:r}:{label:n}},s=(e,r)=>{let i=t.listInspectorEntries(e).find(({label:e})=>e===r.label);return i?r.locale?[...i.keyPath,{type:n.TRANSLATION,key:r.locale}]:i.keyPath:null},c=(e,t,n)=>{if(typeof(0,r.getContentNodeByKeyPath)(e.content,t)!=`string`)return null;let i=(0,r.editDictionaryByKeyPath)(structuredClone(e.content),t,n);return{...e,content:i}};exports.applyDictionaryEdit=c,exports.getEditKeyPath=s,exports.getEditability=a,exports.parseEditPath=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./installIntlayerHTML.cjs");let t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./installIntlayerHTML.cjs");let t=require("@intlayer/core/interpreter"),n=require("vue"),r=require("@intlayer/core/transpiler");var i=(e,{components:i={}}={})=>{let a=Object.fromEntries(Object.entries(i).filter(([,e])=>e).map(([e,t])=>[e,e=>(0,n.h)(t,e,e?.children)])),o=new Proxy(a,{get(e,t){if(typeof t==`string`&&t in e)return e[t];if(typeof t==`string`&&/^[a-z][a-z0-9]*$/.test(t))return r.VOID_HTML_ELEMENTS.has(t)?({children:e,...r})=>(0,n.h)(t,r):e=>(0,n.h)(t,e,e?.children)}});return(0,t.getHTML)(e,o)},a=({components:t}={})=>{let n=e.useHTML();return e=>n?n.renderHTML(e,{components:t}):i(e,{components:t})},o=(0,n.defineComponent)({name:`HTMLRenderer`,props:{content:{type:String,required:!0},components:{type:Object,default:void 0}},setup(e){let t=a({components:e.components});return()=>t(e.content)}});exports.HTMLRenderer=o,exports.renderHTML=i,exports.useHTMLRenderer=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("@intlayer/core/interpreter"),t=require("vue");var n=Symbol(`intlayerHTML`),r=null,i=e=>r||(r={renderHTML:e},r),a=(r,a)=>{let o;if(typeof a==`function`)o=a;else{let{components:t,renderHTML:n}=a??{};o=n||((n,r)=>{let{components:i,...a}=r&&typeof r==`object`&&`components`in r?r:{components:r},o=i||a,s={...t,...o};return(0,e.getHTML)(n,s)})}let s=i((e,r)=>typeof a==`function`||typeof a==`object`&&a?.renderHTML?{setup(){return(0,t.provide)(n,{renderHTML:void 0}),()=>o(e,r)}}:o(e,r));r.provide(n,s)},o={install:a},s=()=>(0,t.inject)(n);exports.INTLAYER_HTML_SYMBOL=n,exports.createIntlayerHTMLClient=i,exports.installIntlayerHTML=a,exports.intlayerHTML=o,exports.useHTML=s;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./
|
|
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;
|
package/dist/cjs/plugins.cjs
CHANGED
|
@@ -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/
|
|
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,15 +1,15 @@
|
|
|
1
1
|
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
2
|
import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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";
|
|
6
6
|
// 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) =>
|
|
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({
|
|
8
8
|
name: "IntlayerLeaf",
|
|
9
9
|
setup() {
|
|
10
10
|
return () => {
|
|
11
11
|
let t = e();
|
|
12
|
-
return t == null ? null : v(t) ?
|
|
12
|
+
return t == null ? null : v(t) ? o(t) : Array.isArray(t) ? o("span", t) : t;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
15
|
})), x = (e) => new Proxy({}, {
|
|
@@ -34,25 +34,25 @@ var g = (e, t) => t.reduce((e, t) => e?.[t], e), _ = (e) => typeof e == "object"
|
|
|
34
34
|
configurable: !0
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
}), S = (
|
|
38
|
-
let
|
|
39
|
-
let e =
|
|
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
40
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
|
|
41
|
-
let t =
|
|
41
|
+
let t = h({
|
|
42
42
|
localeOrSelector: e,
|
|
43
43
|
contextLocale: S.value,
|
|
44
|
-
contextVariant:
|
|
45
|
-
dictionaryKey:
|
|
44
|
+
contextVariant: l?.variant?.value,
|
|
45
|
+
dictionaryKey: f(i).key
|
|
46
46
|
});
|
|
47
|
-
return
|
|
47
|
+
return m(t);
|
|
48
48
|
}
|
|
49
49
|
return {
|
|
50
50
|
selector: void 0,
|
|
51
51
|
locale: e
|
|
52
52
|
};
|
|
53
|
-
}), w =
|
|
54
|
-
|
|
55
|
-
() =>
|
|
53
|
+
}), w = r(() => C.value.locale ?? S.value), T = d({});
|
|
54
|
+
p([
|
|
55
|
+
() => f(i),
|
|
56
56
|
() => w.value,
|
|
57
57
|
() => C.value.selector
|
|
58
58
|
], ([t, n, r]) => {
|
|
@@ -65,20 +65,20 @@ var g = (e, t) => t.reduce((e, t) => e?.[t], e), _ = (e) => typeof e == "object"
|
|
|
65
65
|
flush: "sync"
|
|
66
66
|
});
|
|
67
67
|
let E = (e) => new Proxy({}, {
|
|
68
|
-
get(t,
|
|
69
|
-
let a =
|
|
70
|
-
if (typeof
|
|
71
|
-
if (
|
|
72
|
-
if (
|
|
73
|
-
if (
|
|
74
|
-
let o = e.concat(
|
|
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
75
|
if (s === void 0 || _(s) && !v(s)) return E(o);
|
|
76
|
-
if (y(s)) return x(
|
|
76
|
+
if (y(s)) return x(r(() => g(T.value, o)));
|
|
77
77
|
if (typeof s == "function") {
|
|
78
78
|
let t = g(T.value, e);
|
|
79
|
-
return t != null && !Object.hasOwn(t,
|
|
79
|
+
return t != null && !Object.hasOwn(t, n) ? s.bind(t) : (...e) => g(T.value, o)?.(...e);
|
|
80
80
|
}
|
|
81
|
-
let c =
|
|
81
|
+
let c = r(() => g(T.value, o));
|
|
82
82
|
return new Proxy(c, { get(e, t, n) {
|
|
83
83
|
return t === "value" ? e.value ?? "" : Reflect.get(e, t, n);
|
|
84
84
|
} });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { INTLAYER_SYMBOL as e } from "./installIntlayer.mjs";
|
|
2
2
|
import { useDictionary as t } from "./useDictionary.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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";
|
|
6
6
|
// src/client/useDictionaryAsync.ts
|
|
7
7
|
var l = async (l, u) => {
|
|
8
|
-
let d =
|
|
9
|
-
return
|
|
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
10
|
let t = await l[e]?.();
|
|
11
11
|
t && (m.value = t);
|
|
12
12
|
}), t(m, f);
|
|
@@ -1,19 +1,19 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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";
|
|
7
7
|
// src/client/useDictionaryDynamic.ts
|
|
8
8
|
var u = async (u, d, f) => {
|
|
9
|
-
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" &&
|
|
10
|
-
let n =
|
|
11
|
-
localeOrSelector:
|
|
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
12
|
contextLocale: n?.locale?.value,
|
|
13
13
|
contextVariant: n?.variant?.value,
|
|
14
14
|
dictionaryKey: String(d)
|
|
15
|
-
})), h = p ?? n?.locale?.value ??
|
|
16
|
-
return
|
|
15
|
+
})), h = p ?? n?.locale?.value ?? r();
|
|
16
|
+
return l({
|
|
17
17
|
loaderMap: u,
|
|
18
18
|
key: String(d),
|
|
19
19
|
locale: h,
|
|
@@ -1,29 +1,29 @@
|
|
|
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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
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";
|
|
7
7
|
// src/client/useIntlayer.ts
|
|
8
8
|
var v = (v, y) => {
|
|
9
|
-
let b =
|
|
10
|
-
let e = y === void 0 ? void 0 :
|
|
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
11
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
|
|
12
|
-
let t =
|
|
12
|
+
let t = _({
|
|
13
13
|
localeOrSelector: e,
|
|
14
14
|
contextLocale: x.value,
|
|
15
15
|
contextVariant: b?.variant?.value,
|
|
16
|
-
dictionaryKey:
|
|
16
|
+
dictionaryKey: m(v)
|
|
17
17
|
});
|
|
18
|
-
return
|
|
18
|
+
return g(t);
|
|
19
19
|
}
|
|
20
20
|
return {
|
|
21
21
|
selector: void 0,
|
|
22
22
|
locale: e
|
|
23
23
|
};
|
|
24
|
-
}), C =
|
|
25
|
-
|
|
26
|
-
() =>
|
|
24
|
+
}), C = l(() => S.value.locale ?? x.value), w = p({});
|
|
25
|
+
h([
|
|
26
|
+
() => m(v),
|
|
27
27
|
() => C.value,
|
|
28
28
|
() => S.value.selector
|
|
29
29
|
], ([t, n, r]) => {
|
|
@@ -38,21 +38,21 @@ var v = (v, y) => {
|
|
|
38
38
|
let T = /* @__PURE__ */ new Map(), E = (e) => {
|
|
39
39
|
let t = e.join(".");
|
|
40
40
|
if (T.has(t)) return T.get(t);
|
|
41
|
-
let
|
|
41
|
+
let c = l(() => n(w.value, e)), u = new Proxy({}, {
|
|
42
42
|
get(t, u, d) {
|
|
43
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
|
|
45
|
-
if (u === "c" || u === "asComponent") return s(() =>
|
|
46
|
-
if (u === "$raw") return
|
|
47
|
-
if (u === Symbol.toPrimitive) return () => String(
|
|
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
48
|
let f = e.concat(u), p = n(w.value, f);
|
|
49
49
|
if (p === void 0 || o(p) && !i(p)) return E(f);
|
|
50
|
-
if (a(p)) return r(
|
|
50
|
+
if (a(p)) return r(l(() => n(w.value, f)));
|
|
51
51
|
if (typeof p == "function") {
|
|
52
52
|
let t = n(w.value, e);
|
|
53
53
|
return t != null && !Object.hasOwn(t, u) ? p.bind(t) : (...e) => n(w.value, f)?.(...e);
|
|
54
54
|
}
|
|
55
|
-
let m =
|
|
55
|
+
let m = l(() => n(w.value, f));
|
|
56
56
|
return new Proxy(m, { get(e, t, n) {
|
|
57
57
|
return t === "value" ? e.value ?? "" : t === "__v_isRef" || Reflect.get(e, t, n);
|
|
58
58
|
} });
|
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
import { listInspectorEntries as e } from "./formatDictionaryForInspector.mjs";
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import * as t from "@intlayer/types/nodeType";
|
|
3
|
+
import { editDictionaryByKeyPath as n, getContentNodeByKeyPath as r } from "@intlayer/core/dictionaryManipulator";
|
|
4
4
|
// src/devtools/editDictionaryContent.ts
|
|
5
|
-
var i = (e) => typeof e == "object" && !!e && !Array.isArray(e), a = (e,
|
|
6
|
-
let a =
|
|
7
|
-
return typeof a == "string" ? "plain-string" : i(a) && a.nodeType ===
|
|
5
|
+
var i = (e) => typeof e == "object" && !!e && !Array.isArray(e), a = (e, n) => {
|
|
6
|
+
let a = r(e.content, n);
|
|
7
|
+
return typeof a == "string" ? "plain-string" : i(a) && a.nodeType === t.TRANSLATION && i(a[t.TRANSLATION]) && Object.values(a[t.TRANSLATION]).every((e) => typeof e == "string") ? "translation" : null;
|
|
8
8
|
}, o = (e, t = "Translations") => {
|
|
9
9
|
let [n, r, ...i] = e[0] === t ? e.slice(1) : e;
|
|
10
10
|
return !n || i.length > 0 ? null : r ? {
|
|
11
11
|
label: n,
|
|
12
12
|
locale: r
|
|
13
13
|
} : { label: n };
|
|
14
|
-
}, s = (
|
|
15
|
-
let i = e(
|
|
16
|
-
return i ?
|
|
17
|
-
type:
|
|
18
|
-
key:
|
|
14
|
+
}, s = (n, r) => {
|
|
15
|
+
let i = e(n).find(({ label: e }) => e === r.label);
|
|
16
|
+
return i ? r.locale ? [...i.keyPath, {
|
|
17
|
+
type: t.TRANSLATION,
|
|
18
|
+
key: r.locale
|
|
19
19
|
}] : i.keyPath : null;
|
|
20
|
-
}, c = (e,
|
|
21
|
-
if (typeof
|
|
22
|
-
let a =
|
|
20
|
+
}, c = (e, t, i) => {
|
|
21
|
+
if (typeof r(e.content, t) != "string") return null;
|
|
22
|
+
let a = n(structuredClone(e.content), t, i);
|
|
23
23
|
return {
|
|
24
24
|
...e,
|
|
25
25
|
content: a
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { useHTML as e } from "./installIntlayerHTML.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getHTML as t } from "@intlayer/core/interpreter";
|
|
3
|
+
import { defineComponent as n, h as r } from "vue";
|
|
4
4
|
import { VOID_HTML_ELEMENTS as i } from "@intlayer/core/transpiler";
|
|
5
5
|
// src/html/HTMLRenderer.ts
|
|
6
|
-
var a = (e, { components:
|
|
7
|
-
let a = Object.fromEntries(Object.entries(
|
|
6
|
+
var a = (e, { components: n = {} } = {}) => {
|
|
7
|
+
let a = Object.fromEntries(Object.entries(n).filter(([, e]) => e).map(([e, t]) => [e, (e) => r(t, e, e?.children)])), o = new Proxy(a, { get(e, t) {
|
|
8
8
|
if (typeof t == "string" && t in e) return e[t];
|
|
9
|
-
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return i.has(t) ? ({ children: e, ...
|
|
9
|
+
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return i.has(t) ? ({ children: e, ...n }) => r(t, n) : (e) => r(t, e, e?.children);
|
|
10
10
|
} });
|
|
11
|
-
return
|
|
11
|
+
return t(e, o);
|
|
12
12
|
}, o = ({ components: t } = {}) => {
|
|
13
13
|
let n = e();
|
|
14
14
|
return (e) => n ? n.renderHTML(e, { components: t }) : a(e, { components: t });
|
|
15
|
-
}, s =
|
|
15
|
+
}, s = n({
|
|
16
16
|
name: "HTMLRenderer",
|
|
17
17
|
props: {
|
|
18
18
|
content: {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getHTML as e } from "@intlayer/core/interpreter";
|
|
2
|
+
import { inject as t, provide as n } from "vue";
|
|
3
3
|
// src/html/installIntlayerHTML.ts
|
|
4
|
-
var r = Symbol("intlayerHTML"), i = null, a = (e) => i || (i = { renderHTML: e }, i), o = (
|
|
4
|
+
var r = Symbol("intlayerHTML"), i = null, a = (e) => i || (i = { renderHTML: e }, i), o = (t, i) => {
|
|
5
5
|
let o;
|
|
6
6
|
if (typeof i == "function") o = i;
|
|
7
7
|
else {
|
|
8
|
-
let { components:
|
|
9
|
-
o =
|
|
8
|
+
let { components: t, renderHTML: n } = i ?? {};
|
|
9
|
+
o = n || ((n, r) => {
|
|
10
10
|
let { components: i, ...a } = r && typeof r == "object" && "components" in r ? r : { components: r }, o = i || a, s = {
|
|
11
|
-
...
|
|
11
|
+
...t,
|
|
12
12
|
...o
|
|
13
13
|
};
|
|
14
|
-
return n
|
|
14
|
+
return e(n, s);
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
|
-
let s = a((e,
|
|
18
|
-
return
|
|
19
|
-
} } : o(e,
|
|
20
|
-
|
|
21
|
-
}, s = { install: o }, c = () =>
|
|
17
|
+
let s = a((e, t) => typeof i == "function" || typeof i == "object" && i?.renderHTML ? { setup() {
|
|
18
|
+
return n(r, { renderHTML: void 0 }), () => o(e, t);
|
|
19
|
+
} } : o(e, t));
|
|
20
|
+
t.provide(r, s);
|
|
21
|
+
}, s = { install: o }, c = () => t(r);
|
|
22
22
|
export { r as INTLAYER_HTML_SYMBOL, a as createIntlayerHTMLClient, o as installIntlayerHTML, s as intlayerHTML, c as useHTML };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { useEditor as e } from "./editor/useEditor.mjs";
|
|
2
|
+
import { getDictionary as t } from "./getDictionary.mjs";
|
|
3
|
+
import { INTLAYER_SYMBOL as n, createIntlayerClient as r, installIntlayer as i, intlayer as a } from "./client/installIntlayer.mjs";
|
|
4
|
+
import { useAnalytics as o } from "./analytics/useAnalytics.mjs";
|
|
5
|
+
import { useConversion as s } from "./analytics/useConversion.mjs";
|
|
6
|
+
import { useExperiment as c } from "./analytics/useExperiment.mjs";
|
|
5
7
|
import "./analytics/index.mjs";
|
|
6
|
-
import { useEditor as s } from "./editor/useEditor.mjs";
|
|
7
|
-
import { getDictionary as c } from "./getDictionary.mjs";
|
|
8
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
9
|
import { useDictionaryAsync as g } from "./client/useDictionaryAsync.mjs";
|
|
10
10
|
import { useDictionaryDynamic as _ } from "./client/useDictionaryDynamic.mjs";
|
|
@@ -16,4 +16,4 @@ import { usePathname as S } from "./client/usePathname.mjs";
|
|
|
16
16
|
import { useRewriteURL as C } from "./client/useRewriteURL.mjs";
|
|
17
17
|
import "./client/index.mjs";
|
|
18
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 {
|
|
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 };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -2,50 +2,50 @@ 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 {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
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
|
// src/plugins.ts
|
|
11
|
-
var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null :
|
|
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) => {
|
|
15
|
-
let { children:
|
|
15
|
+
let { children: i, dictionaryKey: a, keyPath: o } = n;
|
|
16
16
|
process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
|
|
17
|
-
dictionaryKey:
|
|
18
|
-
keyPath:
|
|
17
|
+
dictionaryKey: a,
|
|
18
|
+
keyPath: o,
|
|
19
19
|
locale: n.locale,
|
|
20
20
|
nodeType: "text"
|
|
21
21
|
});
|
|
22
|
-
let
|
|
22
|
+
let s = (e) => r({
|
|
23
23
|
value: e,
|
|
24
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
25
|
-
dictionaryKey:
|
|
26
|
-
keyPath:
|
|
24
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? () => w(E, {
|
|
25
|
+
dictionaryKey: a,
|
|
26
|
+
keyPath: o
|
|
27
27
|
}, { default: () => typeof e == "function" ? e() : e }) : e
|
|
28
|
-
}),
|
|
29
|
-
if (typeof
|
|
30
|
-
let
|
|
31
|
-
let t =
|
|
32
|
-
return
|
|
28
|
+
}), c = s(i);
|
|
29
|
+
if (typeof i != "function") return c;
|
|
30
|
+
let l = (...e) => {
|
|
31
|
+
let t = i(...e);
|
|
32
|
+
return s(t);
|
|
33
33
|
};
|
|
34
|
-
Object.setPrototypeOf(
|
|
35
|
-
for (let e of Object.getOwnPropertyNames(
|
|
36
|
-
let t = Object.getOwnPropertyDescriptor(
|
|
37
|
-
t && Object.defineProperty(
|
|
34
|
+
Object.setPrototypeOf(l, Object.getPrototypeOf(c));
|
|
35
|
+
for (let e of Object.getOwnPropertyNames(c)) {
|
|
36
|
+
let t = Object.getOwnPropertyDescriptor(c, e);
|
|
37
|
+
t && Object.defineProperty(l, e, t);
|
|
38
38
|
}
|
|
39
|
-
for (let e of Object.getOwnPropertySymbols(
|
|
40
|
-
let t = Object.getOwnPropertyDescriptor(
|
|
41
|
-
t && Object.defineProperty(
|
|
39
|
+
for (let e of Object.getOwnPropertySymbols(c)) {
|
|
40
|
+
let t = Object.getOwnPropertyDescriptor(c, e);
|
|
41
|
+
t && Object.defineProperty(l, e, t);
|
|
42
42
|
}
|
|
43
|
-
return l
|
|
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 E = 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,18 +65,18 @@ var E = 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
|
-
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ?
|
|
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
|
-
canHandle: (e) => typeof e == "string" ||
|
|
77
|
+
canHandle: (e) => typeof e == "string" || l(e),
|
|
78
78
|
transform: (e, n, r) => {
|
|
79
|
-
if (
|
|
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,
|
|
@@ -97,13 +97,13 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : s(() => import(
|
|
|
97
97
|
keyPath: r,
|
|
98
98
|
plugins: [a, ...t.plugins ?? []]
|
|
99
99
|
});
|
|
100
|
-
return
|
|
100
|
+
return f(i, o);
|
|
101
101
|
}
|
|
102
|
-
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
102
|
+
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? o : {
|
|
103
103
|
id: "markdown-string-plugin",
|
|
104
104
|
canHandle: (e) => typeof e == "string",
|
|
105
|
-
transform: (e, t,
|
|
106
|
-
let { plugins:
|
|
105
|
+
transform: (e, t, 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,
|
|
@@ -113,33 +113,33 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : s(() => import(
|
|
|
113
113
|
children: e
|
|
114
114
|
})
|
|
115
115
|
}],
|
|
116
|
-
dictionaryKey:
|
|
116
|
+
dictionaryKey: o.dictionaryKey,
|
|
117
117
|
keyPath: []
|
|
118
|
-
}),
|
|
118
|
+
}), c = (i) => r({
|
|
119
119
|
...t,
|
|
120
120
|
value: e,
|
|
121
121
|
children: () => {
|
|
122
|
-
let { renderMarkdown: t, components: r } = n(),
|
|
122
|
+
let { renderMarkdown: t, components: r } = n(), a = t(e, void 0, {
|
|
123
123
|
...r ?? {},
|
|
124
|
-
...
|
|
124
|
+
...i ?? {}
|
|
125
125
|
});
|
|
126
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
127
|
-
dictionaryKey:
|
|
128
|
-
keyPath:
|
|
129
|
-
}, { default: () =>
|
|
126
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? w(E, {
|
|
127
|
+
dictionaryKey: o.dictionaryKey,
|
|
128
|
+
keyPath: o.keyPath
|
|
129
|
+
}, { default: () => a }) : a;
|
|
130
130
|
},
|
|
131
131
|
additionalProps: {
|
|
132
|
-
metadata:
|
|
133
|
-
use: (e) =>
|
|
132
|
+
metadata: s,
|
|
133
|
+
use: (e) => c(e)
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
|
-
return
|
|
136
|
+
return c();
|
|
137
137
|
}
|
|
138
|
-
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
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,
|
|
@@ -147,44 +147,44 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : s(() => import(
|
|
|
147
147
|
plugins: [A, ...t.plugins ?? []]
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
}, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ?
|
|
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
|
|
154
|
+
let i = e[x.HTML];
|
|
155
155
|
e.tags;
|
|
156
|
-
let
|
|
157
|
-
let
|
|
156
|
+
let a = (e = {}) => {
|
|
157
|
+
let o = t(i, { components: e });
|
|
158
158
|
return r({
|
|
159
159
|
...n,
|
|
160
|
-
value:
|
|
161
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
160
|
+
value: i,
|
|
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
|
|
165
|
-
}, { default: () =>
|
|
166
|
-
additionalProps: { use: (e) =>
|
|
165
|
+
}, { default: () => o }) : o,
|
|
166
|
+
additionalProps: { use: (e) => a(e) }
|
|
167
167
|
});
|
|
168
168
|
};
|
|
169
|
-
return
|
|
169
|
+
return a();
|
|
170
170
|
}
|
|
171
171
|
}, N = /* @__PURE__ */ new Map(), P = (e, t = !0) => {
|
|
172
|
-
let n =
|
|
172
|
+
let n = p(e), r = `${n}_${t}`;
|
|
173
173
|
if (N.has(r)) return N.get(r);
|
|
174
|
-
let
|
|
174
|
+
let l = [
|
|
175
175
|
D,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
176
|
+
_(n, t ? y.defaultLocale : void 0),
|
|
177
|
+
a,
|
|
178
|
+
d(n),
|
|
179
|
+
i,
|
|
180
|
+
u(n),
|
|
181
|
+
s,
|
|
182
|
+
c,
|
|
182
183
|
m,
|
|
183
|
-
b,
|
|
184
184
|
k,
|
|
185
185
|
j,
|
|
186
186
|
M
|
|
187
|
-
].filter((e) => e !==
|
|
188
|
-
return N.set(r,
|
|
187
|
+
].filter((e) => e !== o);
|
|
188
|
+
return N.set(r, l), l;
|
|
189
189
|
};
|
|
190
190
|
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.8.
|
|
3
|
+
"version": "9.8.2",
|
|
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.
|
|
107
|
-
"@intlayer/config": "9.8.
|
|
108
|
-
"@intlayer/core": "9.8.
|
|
109
|
-
"@intlayer/dictionaries-entry": "9.8.
|
|
110
|
-
"@intlayer/editor": "9.8.
|
|
111
|
-
"@intlayer/types": "9.8.
|
|
106
|
+
"@intlayer/api": "9.8.2",
|
|
107
|
+
"@intlayer/config": "9.8.2",
|
|
108
|
+
"@intlayer/core": "9.8.2",
|
|
109
|
+
"@intlayer/dictionaries-entry": "9.8.2",
|
|
110
|
+
"@intlayer/editor": "9.8.2",
|
|
111
|
+
"@intlayer/types": "9.8.2",
|
|
112
112
|
"@vue/devtools-api": "^6.6.4"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
@@ -124,11 +124,11 @@
|
|
|
124
124
|
"typescript": "6.0.3",
|
|
125
125
|
"vite": "8.3.8",
|
|
126
126
|
"vite-plugin-dts": "5.1.2",
|
|
127
|
-
"vitest": "5.1.
|
|
127
|
+
"vitest": "5.1.1",
|
|
128
128
|
"vue-tsc": "3.3.9"
|
|
129
129
|
},
|
|
130
130
|
"peerDependencies": {
|
|
131
|
-
"intlayer": "9.8.
|
|
131
|
+
"intlayer": "9.8.2",
|
|
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.
|
|
140
|
+
"@intlayer/analytics": "9.8.2"
|
|
141
141
|
},
|
|
142
142
|
"engines": {
|
|
143
143
|
"node": ">=14.18"
|