vue-intlayer 9.7.1 → 9.7.3
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 +6 -6
- package/dist/esm/plugins.mjs +53 -53
- package/package.json +50 -50
|
@@ -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("vue"),r=require("@intlayer/core/dictionaryManipulator"),i=require("@intlayer/core/interpreter");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,n.markRaw)((0,n.defineComponent)({name:`IntlayerLeaf`,setup(){return()=>{let t=e();return t==null?null:s(t)?(0,n.h)(t):Array.isArray(t)?(0,n.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,n.getCurrentInstance)()?(0,n.inject)(t.INTLAYER_SYMBOL):void 0,m=(0,n.isRef)(p?.locale)?p.locale:(0,n.ref)(p?.locale??(0,i.resolveInterpreterLocale)()),h=(0,n.computed)(()=>{let e=f===void 0?void 0:(0,n.toValue)(f);if(process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`){let t=(0,r.resolveDictionaryArgument)({localeOrSelector:e,contextLocale:m.value,contextVariant:p?.variant?.value,dictionaryKey:(0,n.toValue)(d).key});return(0,r.parseDictionarySelector)(t)}return{selector:void 0,locale:e}}),g=(0,n.computed)(()=>h.value.locale??m.value),_=(0,n.shallowRef)({});(0,n.watch)([()=>(0,n.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,r,i){let d=(0,n.computed)(()=>a(_.value,e));if(typeof r==`symbol`||typeof r==`string`&&(r.startsWith(`__`)||r.startsWith(`$`)))return r===`__v_isRef`?!0:r===`$raw`?d:r===Symbol.toPrimitive?()=>String(d.value??``):Reflect.get(t,r,i);if(r===`value`)return d.value??``;if(r===`then`)return;if(r===`c`||r===`asComponent`)return l(()=>d.value);let f=e.concat(r),p=a(_.value,f);if(p===void 0||o(p)&&!s(p))return v(f);if(c(p))return u((0,n.computed)(()=>a(_.value,f)));if(typeof p==`function`){let t=a(_.value,e);return t!=null&&!Object.hasOwn(t,r)?p.bind(t):(...e)=>a(_.value,f)?.(...e)}let m=(0,n.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("vue"),r=require("@intlayer/core/dictionaryManipulator"),i=require("@intlayer/core/interpreter");var a=async(a,o)=>{let s=(0,n.inject)(e.INTLAYER_SYMBOL),c=(0,n.computed)(()=>(0,n.toValue)(o)??s?.locale?.value??(0,i.resolveInterpreterLocale)()),l=(0,r.getPreloadedDictionary)(a,c.value),u=(0,n.ref)(l??await a[c.value]?.());return(0,n.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("vue"),i=require("@intlayer/core/dictionaryManipulator"),a=require("@intlayer/core/interpreter");var o=async(o,s,c)=>{if(process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&(0,i.isQualifiedDynamicLoaderMap)(o)){let n=(0,r.inject)(t.INTLAYER_SYMBOL),l=c===void 0?void 0:(0,r.toValue)(c),{locale:u,selector:d}=(0,i.parseDictionarySelector)((0,i.resolveDictionaryArgument)({localeOrSelector:l??void 0,contextLocale:n?.locale?.value,contextVariant:n?.variant?.value,dictionaryKey:String(s)})),f=u??n?.locale?.value??(0,a.resolveInterpreterLocale)();return(0,i.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("vue"),i=require("@intlayer/core/dictionaryManipulator"),a=require("@intlayer/core/interpreter");var o=(o,s)=>{let c=(0,r.inject)(t.INTLAYER_SYMBOL),l=(0,r.isRef)(c?.locale)?c.locale:(0,r.ref)(c?.locale??(0,a.resolveInterpreterLocale)()),u=(0,r.computed)(()=>{let e=s===void 0?void 0:(0,r.toValue)(s);if(process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`){let t=(0,i.resolveDictionaryArgument)({localeOrSelector:e,contextLocale:l.value,contextVariant:c?.variant?.value,dictionaryKey:(0,r.toValue)(o)});return(0,i.parseDictionarySelector)(t)}return{selector:void 0,locale:e}}),d=(0,r.computed)(()=>u.value.locale??l.value),f=(0,r.shallowRef)({});(0,r.watch)([()=>(0,r.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 i=(0,r.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 i.value??``;if(a===`c`||a===`asComponent`)return n.toComponent(()=>i.value);if(a===`$raw`)return i;if(a===Symbol.toPrimitive)return()=>String(i.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,r.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,r.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/core/dictionaryManipulator"),r=require("@intlayer/types/nodeType");r=e.t(r);var i=e=>typeof e==`object`&&!!e&&!Array.isArray(e),a=(e,t)=>{let a=(0,n.getContentNodeByKeyPath)(e.content,t);return typeof a==`string`?`plain-string`:i(a)&&a.nodeType===r.TRANSLATION&&i(a[r.TRANSLATION])&&Object.values(a[r.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,n)=>{let i=t.listInspectorEntries(e).find(({label:e})=>e===n.label);return i?n.locale?[...i.keyPath,{type:r.TRANSLATION,key:n.locale}]:i.keyPath:null},c=(e,t,r)=>{if(typeof(0,n.getContentNodeByKeyPath)(e.content,t)!=`string`)return null;let i=(0,n.editDictionaryByKeyPath)(structuredClone(e.content),t,r);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("vue"),n=require("@intlayer/core/interpreter"),r=require("@intlayer/core/transpiler");var i=(e,{components:i={}}={})=>{let a=Object.fromEntries(Object.entries(i).filter(([,e])=>e).map(([e,n])=>[e,e=>(0,t.h)(n,e,e?.children)])),o=new Proxy(a,{get(e,n){if(typeof n==`string`&&n in e)return e[n];if(typeof n==`string`&&/^[a-z][a-z0-9]*$/.test(n))return r.VOID_HTML_ELEMENTS.has(n)?({children:e,...r})=>(0,t.h)(n,r):e=>(0,t.h)(n,e,e?.children)}});return(0,n.getHTML)(e,o)},a=({components:t}={})=>{let n=e.useHTML();return e=>n?n.renderHTML(e,{components:t}):i(e,{components:t})},o=(0,t.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("vue"),t=require("@intlayer/core/interpreter");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:e,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={...e,...o};return(0,t.getHTML)(n,s)})}let s=i((t,r)=>typeof a==`function`||typeof a==`object`&&a?.renderHTML?{setup(){return(0,e.provide)(n,{renderHTML:void 0}),()=>o(t,r)}}:o(t,r));r.provide(n,s)},o={install:a},s=()=>(0,e.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("./client/installIntlayer.cjs"),t=require("./analytics/useAnalytics.cjs"),n=require("./analytics/useConversion.cjs"),r=require("./analytics/useExperiment.cjs");require("./analytics/index.cjs");const i=require("./editor/useEditor.cjs"),a=require("./getDictionary.cjs"),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=e.INTLAYER_SYMBOL,exports.atPath=o.atPath,exports.createIntlayerClient=e.createIntlayerClient,exports.createIntlayerLeafProxy=o.createIntlayerLeafProxy,exports.getDictionary=a.getDictionary,exports.getIntlayer=l.getIntlayer,exports.getPlugins=h.getPlugins,exports.htmlPlugin=h.htmlPlugin,exports.insertionPlugin=h.insertionPlugin,exports.installIntlayer=e.installIntlayer,exports.intlayer=e.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=t.useAnalytics,exports.useConversion=n.useConversion,exports.useDictionary=o.useDictionary,exports.useDictionaryAsync=s.useDictionaryAsync,exports.useDictionaryDynamic=c.useDictionaryDynamic,exports.useEditor=i.useEditor,exports.useExperiment=r.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/config/built"),o=require("@intlayer/core/interpreter"),
|
|
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/config/built"),o=require("vue"),s=require("@intlayer/core/interpreter"),c=require("@intlayer/core/markdown"),l=require("@intlayer/types/nodeType");l=e.t(l);var u=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,o.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:s,keyPath:c}=n;process.env.INTLAYER_ANALYTICS_ENABLED!==`false`&&t.reportExposure({dictionaryKey:s,keyPath:c,locale:n.locale,nodeType:`text`});let l=e=>i.renderIntlayerNode({value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&a.editor.enabled?()=>(0,o.h)(u,{dictionaryKey:s,keyPath:c},{default:()=>typeof e==`function`?e():e}):e}),d=l(r);if(typeof r!=`function`)return d;let f=(...e)=>{let t=r(...e);return l(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,o.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,s.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,o.h)(o.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,o.h)(o.Fragment,null,...e)}return i.isSimple?i.parts:(0,o.h)(o.Fragment,null,i.parts)},p=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?s.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===l.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:l.INSERTION}],i=e[l.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,s.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,s.isInterpolableWrapperNode)(e))return i=>(0,s.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})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return(0,s.resolveInsertedSelector)(i,o)}},m=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?s.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:s,...l}=t,d=n((0,c.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:l.dictionaryKey,keyPath:[]}),f=n=>i.renderIntlayerNode({...t,value:e,children:()=>{let{renderMarkdown:t,components:i}=r.useMarkdown(),s=t(e,void 0,{...i??{},...n??{}});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&a.editor.enabled?(0,o.h)(u,{dictionaryKey:l.dictionaryKey,keyPath:l.keyPath},{default:()=>s}):s},additionalProps:{metadata:d,use:e=>f(e)}});return f()}},h=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?s.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===l.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:l.MARKDOWN}],i=e[l.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[m,...t.plugins??[]]})}},g=process.env.INTLAYER_NODE_TYPE_HTML===`false`?s.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===l.HTML,transform:(e,t)=>{let r=e[l.HTML];e.tags;let s=(e={})=>{let c=n.renderHTML(r,{components:e});return i.renderIntlayerNode({...t,value:r,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&a.editor.enabled?()=>(0,o.h)(u,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath,...e},{default:()=>c}):c,additionalProps:{use:e=>s(e)}})};return s()}},_=new Map,v=(e,t=!0)=>{let n=(0,s.resolveInterpreterLocale)(e),r=`${n}_${t}`;if(_.has(r))return _.get(r);let i=[d,(0,s.translationPlugin)(n,t?a.internationalization.defaultLocale:void 0),s.enumerationPlugin,(0,s.pluralPlugin)(n),s.conditionPlugin,(0,s.nestedPlugin)(n),s.filePlugin,s.genderPlugin,s.selectPlugin,p,h,g].filter(e=>e!==s.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 { computed as n, defineComponent as r, getCurrentInstance as i, h as a, inject as o, isRef as s, markRaw as c, ref as l, shallowRef as u, toValue as d, watch as f } from "vue";
|
|
4
|
+
import { parseDictionarySelector as p, resolveDictionaryArgument as m } from "@intlayer/core/dictionaryManipulator";
|
|
5
|
+
import { resolveInterpreterLocale as h } from "@intlayer/core/interpreter";
|
|
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) => c(r({
|
|
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) ? a(t) : Array.isArray(t) ? a("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 = (r, a) => {
|
|
38
|
+
let c = i() ? o(t) : void 0, S = s(c?.locale) ? c.locale : l(c?.locale ?? h()), C = n(() => {
|
|
39
|
+
let e = a === void 0 ? void 0 : d(a);
|
|
40
40
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
|
|
41
|
-
let t =
|
|
41
|
+
let t = m({
|
|
42
42
|
localeOrSelector: e,
|
|
43
43
|
contextLocale: S.value,
|
|
44
|
-
contextVariant:
|
|
45
|
-
dictionaryKey:
|
|
44
|
+
contextVariant: c?.variant?.value,
|
|
45
|
+
dictionaryKey: d(r).key
|
|
46
46
|
});
|
|
47
|
-
return
|
|
47
|
+
return p(t);
|
|
48
48
|
}
|
|
49
49
|
return {
|
|
50
50
|
selector: void 0,
|
|
51
51
|
locale: e
|
|
52
52
|
};
|
|
53
|
-
}), w =
|
|
54
|
-
|
|
55
|
-
() =>
|
|
53
|
+
}), w = n(() => C.value.locale ?? S.value), T = u({});
|
|
54
|
+
f([
|
|
55
|
+
() => d(r),
|
|
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, r, i) {
|
|
69
|
+
let a = n(() => g(T.value, e));
|
|
70
|
+
if (typeof r == "symbol" || typeof r == "string" && (r.startsWith("__") || r.startsWith("$"))) return r === "__v_isRef" ? !0 : r === "$raw" ? a : r === Symbol.toPrimitive ? () => String(a.value ?? "") : Reflect.get(t, r, i);
|
|
71
|
+
if (r === "value") return a.value ?? "";
|
|
72
|
+
if (r === "then") return;
|
|
73
|
+
if (r === "c" || r === "asComponent") return b(() => a.value);
|
|
74
|
+
let o = e.concat(r), 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(n(() => 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, r) ? s.bind(t) : (...e) => g(T.value, o)?.(...e);
|
|
80
80
|
}
|
|
81
|
-
let c =
|
|
81
|
+
let c = n(() => 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 { computed as n, inject as r, ref as i, toValue as a, watch as o } from "vue";
|
|
4
|
+
import { getPreloadedDictionary as s } from "@intlayer/core/dictionaryManipulator";
|
|
5
|
+
import { resolveInterpreterLocale as c } from "@intlayer/core/interpreter";
|
|
6
6
|
// src/client/useDictionaryAsync.ts
|
|
7
7
|
var l = async (l, u) => {
|
|
8
|
-
let d =
|
|
9
|
-
return
|
|
8
|
+
let d = r(e), f = n(() => a(u) ?? d?.locale?.value ?? c()), p = s(l, f.value), m = i(p ?? await l[f.value]?.());
|
|
9
|
+
return o(() => 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 { inject as r, toValue as i } from "vue";
|
|
5
|
+
import { isQualifiedDynamicLoaderMap as a, parseDictionarySelector as o, resolveDictionaryArgument as s, resolveQualifiedDynamicContentAsync as c } from "@intlayer/core/dictionaryManipulator";
|
|
6
|
+
import { resolveInterpreterLocale as l } from "@intlayer/core/interpreter";
|
|
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" && a(u)) {
|
|
10
|
+
let n = r(t), a = f === void 0 ? void 0 : i(f), { locale: p, selector: m } = o(s({
|
|
11
|
+
localeOrSelector: a ?? 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 ?? l();
|
|
16
|
+
return c({
|
|
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 { computed as c, inject as l, isRef as u, ref as d, shallowRef as f, toValue as p, watch as m } from "vue";
|
|
5
|
+
import { parseDictionarySelector as h, resolveDictionaryArgument as g } from "@intlayer/core/dictionaryManipulator";
|
|
6
|
+
import { resolveInterpreterLocale as _ } from "@intlayer/core/interpreter";
|
|
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 = l(t), x = u(b?.locale) ? b.locale : d(b?.locale ?? _()), S = c(() => {
|
|
10
|
+
let e = y === void 0 ? void 0 : p(y);
|
|
11
11
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
|
|
12
|
-
let t =
|
|
12
|
+
let t = g({
|
|
13
13
|
localeOrSelector: e,
|
|
14
14
|
contextLocale: x.value,
|
|
15
15
|
contextVariant: b?.variant?.value,
|
|
16
|
-
dictionaryKey:
|
|
16
|
+
dictionaryKey: p(v)
|
|
17
17
|
});
|
|
18
|
-
return
|
|
18
|
+
return h(t);
|
|
19
19
|
}
|
|
20
20
|
return {
|
|
21
21
|
selector: void 0,
|
|
22
22
|
locale: e
|
|
23
23
|
};
|
|
24
|
-
}), C =
|
|
25
|
-
|
|
26
|
-
() =>
|
|
24
|
+
}), C = c(() => S.value.locale ?? x.value), w = f({});
|
|
25
|
+
m([
|
|
26
|
+
() => p(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 l = c(() => 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 l.value ?? "";
|
|
45
|
+
if (u === "c" || u === "asComponent") return s(() => l.value);
|
|
46
|
+
if (u === "$raw") return l;
|
|
47
|
+
if (u === Symbol.toPrimitive) return () => String(l.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(c(() => 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 = c(() => 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 { editDictionaryByKeyPath as t, getContentNodeByKeyPath as n } from "@intlayer/core/dictionaryManipulator";
|
|
3
|
+
import * as r from "@intlayer/types/nodeType";
|
|
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, t) => {
|
|
6
|
+
let a = n(e.content, t);
|
|
7
|
+
return typeof a == "string" ? "plain-string" : i(a) && a.nodeType === r.TRANSLATION && i(a[r.TRANSLATION]) && Object.values(a[r.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 = (t, n) => {
|
|
15
|
+
let i = e(t).find(({ label: e }) => e === n.label);
|
|
16
|
+
return i ? n.locale ? [...i.keyPath, {
|
|
17
|
+
type: r.TRANSLATION,
|
|
18
|
+
key: n.locale
|
|
19
19
|
}] : i.keyPath : null;
|
|
20
|
-
}, c = (e,
|
|
21
|
-
if (typeof
|
|
22
|
-
let a =
|
|
20
|
+
}, c = (e, r, i) => {
|
|
21
|
+
if (typeof n(e.content, r) != "string") return null;
|
|
22
|
+
let a = t(structuredClone(e.content), r, 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 { defineComponent as t, h as n } from "vue";
|
|
3
|
+
import { getHTML as r } from "@intlayer/core/interpreter";
|
|
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: t = {} } = {}) => {
|
|
7
|
+
let a = Object.fromEntries(Object.entries(t).filter(([, e]) => e).map(([e, t]) => [e, (e) => n(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, ...r }) => n(t, r) : (e) => n(t, e, e?.children);
|
|
10
10
|
} });
|
|
11
|
-
return
|
|
11
|
+
return r(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 = t({
|
|
16
16
|
name: "HTMLRenderer",
|
|
17
17
|
props: {
|
|
18
18
|
content: {
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { inject as e, provide as t } from "vue";
|
|
2
|
+
import { getHTML as n } from "@intlayer/core/interpreter";
|
|
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 = (e, i) => {
|
|
5
5
|
let o;
|
|
6
6
|
if (typeof i == "function") o = i;
|
|
7
7
|
else {
|
|
8
|
-
let { components:
|
|
9
|
-
o =
|
|
8
|
+
let { components: e, renderHTML: t } = i ?? {};
|
|
9
|
+
o = t || ((t, r) => {
|
|
10
10
|
let { components: i, ...a } = r && typeof r == "object" && "components" in r ? r : { components: r }, o = i || a, s = {
|
|
11
|
-
...
|
|
11
|
+
...e,
|
|
12
12
|
...o
|
|
13
13
|
};
|
|
14
|
-
return
|
|
14
|
+
return n(t, 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, n) => typeof i == "function" || typeof i == "object" && i?.renderHTML ? { setup() {
|
|
18
|
+
return t(r, { renderHTML: void 0 }), () => o(e, n);
|
|
19
|
+
} } : o(e, n));
|
|
20
|
+
e.provide(r, s);
|
|
21
|
+
}, s = { install: o }, c = () => e(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,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useExperiment as s } from "./analytics/useExperiment.mjs";
|
|
1
|
+
import { INTLAYER_SYMBOL as e, createIntlayerClient as t, installIntlayer as n, intlayer as r } from "./client/installIntlayer.mjs";
|
|
2
|
+
import { useAnalytics as i } from "./analytics/useAnalytics.mjs";
|
|
3
|
+
import { useConversion as a } from "./analytics/useConversion.mjs";
|
|
4
|
+
import { useExperiment as o } from "./analytics/useExperiment.mjs";
|
|
6
5
|
import "./analytics/index.mjs";
|
|
6
|
+
import { useEditor as s } from "./editor/useEditor.mjs";
|
|
7
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";
|
|
@@ -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 { e as INTLAYER_SYMBOL, l as atPath, t as createIntlayerClient, u as createIntlayerLeafProxy, c as getDictionary, v as getIntlayer, w as getPlugins, T as htmlPlugin, E as insertionPlugin, n as installIntlayer, r as intlayer, D as intlayerNodePlugins, d as isComponentLike, f as isIntlayerNode, p as isObjectLike, O as markdownPlugin, k as markdownStringPlugin, m as toComponent, i as useAnalytics, a as useConversion, h as useDictionary, g as useDictionaryAsync, _ as useDictionaryDynamic, s as useEditor, o as useExperiment, y as useIntlayer, b as useLoadDynamic, x as useLocale, S as usePathname, C as useRewriteURL };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -3,12 +3,12 @@ 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
5
|
import { editor as i, internationalization as a } from "@intlayer/config/built";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import { Fragment as o, defineAsyncComponent as s, h as c, markRaw as l } from "vue";
|
|
7
|
+
import { conditionPlugin as u, enumerationPlugin as d, fallbackPlugin as f, filePlugin as p, genderPlugin as m, isInterpolableWrapperNode as h, nestedPlugin as g, pluralPlugin as _, resolveInsertedSelector as v, resolveInterpreterLocale as y, selectPlugin as b, splitInsertionTemplate as x, transformInterpolableNode as S, translationPlugin as C } from "@intlayer/core/interpreter";
|
|
8
|
+
import { getMarkdownMetadata as w } from "@intlayer/core/markdown";
|
|
9
|
+
import * as T from "@intlayer/types/nodeType";
|
|
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 : s(() => 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) => {
|
|
@@ -19,33 +19,33 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
19
19
|
locale: n.locale,
|
|
20
20
|
nodeType: "text"
|
|
21
21
|
});
|
|
22
|
-
let
|
|
22
|
+
let u = (e) => r({
|
|
23
23
|
value: e,
|
|
24
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? () =>
|
|
24
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? () => c(E, {
|
|
25
25
|
dictionaryKey: o,
|
|
26
26
|
keyPath: s
|
|
27
27
|
}, { default: () => typeof e == "function" ? e() : e }) : e
|
|
28
|
-
}),
|
|
29
|
-
if (typeof a != "function") return
|
|
30
|
-
let
|
|
28
|
+
}), d = u(a);
|
|
29
|
+
if (typeof a != "function") return d;
|
|
30
|
+
let f = (...e) => {
|
|
31
31
|
let t = a(...e);
|
|
32
|
-
return
|
|
32
|
+
return u(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(f, Object.getPrototypeOf(d));
|
|
35
|
+
for (let e of Object.getOwnPropertyNames(d)) {
|
|
36
|
+
let t = Object.getOwnPropertyDescriptor(d, e);
|
|
37
|
+
t && Object.defineProperty(f, 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(d)) {
|
|
40
|
+
let t = Object.getOwnPropertyDescriptor(d, e);
|
|
41
|
+
t && Object.defineProperty(f, e, t);
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return l(f);
|
|
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 = x(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 : C(() => 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)), c(o, null, ...e);
|
|
58
58
|
}
|
|
59
59
|
return i.parts.forEach((t) => {
|
|
60
60
|
if (typeof t == "string") {
|
|
@@ -65,22 +65,22 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
65
65
|
}
|
|
66
66
|
r.length > 0 && e.push(r);
|
|
67
67
|
} else e.push(t);
|
|
68
|
-
}),
|
|
68
|
+
}), c(o, 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 : c(o, null, i.parts);
|
|
71
|
+
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? f : {
|
|
72
72
|
id: "insertion-plugin",
|
|
73
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
73
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === T.INSERTION,
|
|
74
74
|
transform: (e, t, n) => {
|
|
75
|
-
let r = [...t.keyPath, { type:
|
|
75
|
+
let r = [...t.keyPath, { type: T.INSERTION }], i = e[T.INSERTION], a = {
|
|
76
76
|
id: "insertion-string-plugin",
|
|
77
|
-
canHandle: (e) => typeof e == "string" ||
|
|
77
|
+
canHandle: (e) => typeof e == "string" || h(e),
|
|
78
78
|
transform: (e, n, r) => {
|
|
79
|
-
if (
|
|
79
|
+
if (h(e)) return (i) => S(e, i, n, t.plugins, r);
|
|
80
80
|
let i = r(e, {
|
|
81
81
|
...n,
|
|
82
82
|
children: e,
|
|
83
|
-
plugins:
|
|
83
|
+
plugins: (t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")
|
|
84
84
|
});
|
|
85
85
|
return (e) => {
|
|
86
86
|
let a = O(i, e);
|
|
@@ -97,13 +97,13 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
97
97
|
keyPath: r,
|
|
98
98
|
plugins: [a, ...t.plugins ?? []]
|
|
99
99
|
});
|
|
100
|
-
return
|
|
100
|
+
return v(i, o);
|
|
101
101
|
}
|
|
102
|
-
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
102
|
+
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? f : {
|
|
103
103
|
id: "markdown-string-plugin",
|
|
104
104
|
canHandle: (e) => typeof e == "string",
|
|
105
105
|
transform: (e, t, a) => {
|
|
106
|
-
let { plugins: o, ...s } = t,
|
|
106
|
+
let { plugins: o, ...s } = t, l = a(w(e) ?? {}, {
|
|
107
107
|
plugins: [{
|
|
108
108
|
id: "markdown-metadata-plugin",
|
|
109
109
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
@@ -115,7 +115,7 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
115
115
|
}],
|
|
116
116
|
dictionaryKey: s.dictionaryKey,
|
|
117
117
|
keyPath: []
|
|
118
|
-
}),
|
|
118
|
+
}), u = (a) => r({
|
|
119
119
|
...t,
|
|
120
120
|
value: e,
|
|
121
121
|
children: () => {
|
|
@@ -123,23 +123,23 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
123
123
|
...r ?? {},
|
|
124
124
|
...a ?? {}
|
|
125
125
|
});
|
|
126
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ?
|
|
126
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? c(E, {
|
|
127
127
|
dictionaryKey: s.dictionaryKey,
|
|
128
128
|
keyPath: s.keyPath
|
|
129
129
|
}, { default: () => o }) : o;
|
|
130
130
|
},
|
|
131
131
|
additionalProps: {
|
|
132
|
-
metadata:
|
|
133
|
-
use: (e) =>
|
|
132
|
+
metadata: l,
|
|
133
|
+
use: (e) => u(e)
|
|
134
134
|
}
|
|
135
135
|
});
|
|
136
|
-
return
|
|
136
|
+
return u();
|
|
137
137
|
}
|
|
138
|
-
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
138
|
+
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? f : {
|
|
139
139
|
id: "markdown-plugin",
|
|
140
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
140
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === T.MARKDOWN,
|
|
141
141
|
transform: (e, t, n) => {
|
|
142
|
-
let r = [...t.keyPath, { type:
|
|
142
|
+
let r = [...t.keyPath, { type: T.MARKDOWN }], i = e[T.MARKDOWN];
|
|
143
143
|
return n(i, {
|
|
144
144
|
...t,
|
|
145
145
|
children: i,
|
|
@@ -147,18 +147,18 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => 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" ? f : {
|
|
151
151
|
id: "html-plugin",
|
|
152
|
-
canHandle: (e) => typeof e == "object" && e?.nodeType ===
|
|
152
|
+
canHandle: (e) => typeof e == "object" && e?.nodeType === T.HTML,
|
|
153
153
|
transform: (e, n) => {
|
|
154
|
-
let a = e[
|
|
154
|
+
let a = e[T.HTML];
|
|
155
155
|
e.tags;
|
|
156
156
|
let o = (e = {}) => {
|
|
157
157
|
let s = t(a, { components: e });
|
|
158
158
|
return r({
|
|
159
159
|
...n,
|
|
160
160
|
value: a,
|
|
161
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? () =>
|
|
161
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && i.enabled ? () => c(E, {
|
|
162
162
|
dictionaryKey: n.dictionaryKey,
|
|
163
163
|
keyPath: n.keyPath,
|
|
164
164
|
...e
|
|
@@ -169,22 +169,22 @@ var E = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : C(() => import(
|
|
|
169
169
|
return o();
|
|
170
170
|
}
|
|
171
171
|
}, N = /* @__PURE__ */ new Map(), P = (e, t = !0) => {
|
|
172
|
-
let n =
|
|
172
|
+
let n = y(e), r = `${n}_${t}`;
|
|
173
173
|
if (N.has(r)) return N.get(r);
|
|
174
174
|
let i = [
|
|
175
175
|
D,
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
o,
|
|
180
|
-
f(n),
|
|
181
|
-
l,
|
|
176
|
+
C(n, t ? a.defaultLocale : void 0),
|
|
177
|
+
d,
|
|
178
|
+
_(n),
|
|
182
179
|
u,
|
|
183
|
-
g,
|
|
180
|
+
g(n),
|
|
181
|
+
p,
|
|
182
|
+
m,
|
|
183
|
+
b,
|
|
184
184
|
k,
|
|
185
185
|
j,
|
|
186
186
|
M
|
|
187
|
-
].filter((e) => e !==
|
|
187
|
+
].filter((e) => e !== f);
|
|
188
188
|
return N.set(r, i), i;
|
|
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,27 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intlayer",
|
|
3
|
-
"version": "9.7.
|
|
3
|
+
"version": "9.7.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Vue applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
7
|
-
"intlayer",
|
|
8
7
|
"data",
|
|
8
|
+
"i18n",
|
|
9
9
|
"internationalization",
|
|
10
|
+
"intlayer",
|
|
11
|
+
"json",
|
|
10
12
|
"multilingual",
|
|
11
|
-
"i18n",
|
|
12
13
|
"typescript",
|
|
13
|
-
"vue",
|
|
14
14
|
"vite",
|
|
15
|
-
"
|
|
15
|
+
"vue"
|
|
16
16
|
],
|
|
17
17
|
"homepage": "https://intlayer.org",
|
|
18
18
|
"bugs": {
|
|
19
19
|
"url": "https://github.com/aymericzip/intlayer/issues"
|
|
20
20
|
},
|
|
21
|
-
"repository": {
|
|
22
|
-
"type": "git",
|
|
23
|
-
"url": "git+https://github.com/aymericzip/intlayer.git"
|
|
24
|
-
},
|
|
25
21
|
"license": "Apache-2.0",
|
|
26
22
|
"author": {
|
|
27
23
|
"name": "Aymeric PINEAU",
|
|
@@ -34,7 +30,37 @@
|
|
|
34
30
|
"url": "https://github.com/aymericzip"
|
|
35
31
|
}
|
|
36
32
|
],
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/aymericzip/intlayer.git"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"./dist",
|
|
39
|
+
"./package.json"
|
|
40
|
+
],
|
|
37
41
|
"sideEffects": false,
|
|
42
|
+
"main": "dist/cjs/index.cjs",
|
|
43
|
+
"module": "dist/esm/index.mjs",
|
|
44
|
+
"types": "dist/types/index.d.ts",
|
|
45
|
+
"typesVersions": {
|
|
46
|
+
"*": {
|
|
47
|
+
".": [
|
|
48
|
+
"./dist/types/index.d.ts"
|
|
49
|
+
],
|
|
50
|
+
"markdown": [
|
|
51
|
+
"./dist/types/markdown/index.d.ts"
|
|
52
|
+
],
|
|
53
|
+
"format": [
|
|
54
|
+
"./dist/types/format/index.d.ts"
|
|
55
|
+
],
|
|
56
|
+
"html": [
|
|
57
|
+
"./dist/types/html/index.d.ts"
|
|
58
|
+
],
|
|
59
|
+
"package.json": [
|
|
60
|
+
"./package.json"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
38
64
|
"exports": {
|
|
39
65
|
".": {
|
|
40
66
|
"types": "./dist/types/index.d.ts",
|
|
@@ -58,41 +84,15 @@
|
|
|
58
84
|
},
|
|
59
85
|
"./package.json": "./package.json"
|
|
60
86
|
},
|
|
61
|
-
"main": "dist/cjs/index.cjs",
|
|
62
|
-
"module": "dist/esm/index.mjs",
|
|
63
|
-
"types": "dist/types/index.d.ts",
|
|
64
|
-
"typesVersions": {
|
|
65
|
-
"*": {
|
|
66
|
-
".": [
|
|
67
|
-
"./dist/types/index.d.ts"
|
|
68
|
-
],
|
|
69
|
-
"markdown": [
|
|
70
|
-
"./dist/types/markdown/index.d.ts"
|
|
71
|
-
],
|
|
72
|
-
"format": [
|
|
73
|
-
"./dist/types/format/index.d.ts"
|
|
74
|
-
],
|
|
75
|
-
"html": [
|
|
76
|
-
"./dist/types/html/index.d.ts"
|
|
77
|
-
],
|
|
78
|
-
"package.json": [
|
|
79
|
-
"./package.json"
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
},
|
|
83
|
-
"files": [
|
|
84
|
-
"./dist",
|
|
85
|
-
"./package.json"
|
|
86
|
-
],
|
|
87
87
|
"scripts": {
|
|
88
88
|
"build": "bun --bun vite build",
|
|
89
89
|
"build:ci": "bun --bun vite build",
|
|
90
90
|
"clean": "bun --bun rimraf ./dist .turbo",
|
|
91
91
|
"dev": "bun --bun vite build --watch",
|
|
92
|
-
"format": "
|
|
93
|
-
"format:fix": "
|
|
94
|
-
"lint": "
|
|
95
|
-
"lint:fix": "
|
|
92
|
+
"format": "oxfmt --check .",
|
|
93
|
+
"format:fix": "oxfmt .",
|
|
94
|
+
"lint": "oxlint .",
|
|
95
|
+
"lint:fix": "oxlint --fix .",
|
|
96
96
|
"prepublish": "cp -f ../../README.md ./README.md",
|
|
97
97
|
"publish": "bun publish || true",
|
|
98
98
|
"publish:canary": "bun publish --access public --tag canary || true",
|
|
@@ -103,12 +103,12 @@
|
|
|
103
103
|
"typecheck": "vue-tsc --noEmit --project tsconfig.types.json"
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
|
-
"@intlayer/api": "9.7.
|
|
107
|
-
"@intlayer/config": "9.7.
|
|
108
|
-
"@intlayer/core": "9.7.
|
|
109
|
-
"@intlayer/dictionaries-entry": "9.7.
|
|
110
|
-
"@intlayer/editor": "9.7.
|
|
111
|
-
"@intlayer/types": "9.7.
|
|
106
|
+
"@intlayer/api": "9.7.3",
|
|
107
|
+
"@intlayer/config": "9.7.3",
|
|
108
|
+
"@intlayer/core": "9.7.3",
|
|
109
|
+
"@intlayer/dictionaries-entry": "9.7.3",
|
|
110
|
+
"@intlayer/editor": "9.7.3",
|
|
111
|
+
"@intlayer/types": "9.7.3",
|
|
112
112
|
"@vue/devtools-api": "^6.6.4"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
@@ -119,16 +119,16 @@
|
|
|
119
119
|
"@vitejs/plugin-vue": "6.0.8",
|
|
120
120
|
"ajv": "8.20.0",
|
|
121
121
|
"fast-glob": "3.3.3",
|
|
122
|
-
"rimraf": "6.1.
|
|
123
|
-
"tsdown": "0.23.
|
|
122
|
+
"rimraf": "6.1.4",
|
|
123
|
+
"tsdown": "0.23.7",
|
|
124
124
|
"typescript": "7.0.2",
|
|
125
|
-
"vite": "8.3.
|
|
125
|
+
"vite": "8.3.7",
|
|
126
126
|
"vite-plugin-dts": "5.1.2",
|
|
127
127
|
"vitest": "5.1.0",
|
|
128
128
|
"vue-tsc": "3.3.9"
|
|
129
129
|
},
|
|
130
130
|
"peerDependencies": {
|
|
131
|
-
"intlayer": "9.7.
|
|
131
|
+
"intlayer": "9.7.3",
|
|
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.7.
|
|
140
|
+
"@intlayer/analytics": "9.7.3"
|
|
141
141
|
},
|
|
142
142
|
"engines": {
|
|
143
143
|
"node": ">=14.18"
|