vue-intlayer 9.5.8 → 9.5.9
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/analytics/useAnalytics.cjs +1 -1
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/devtools/index.cjs +1 -1
- package/dist/cjs/format/index.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/analytics/useAnalytics.mjs +17 -17
- package/dist/esm/client/useDictionary.mjs +6 -6
- package/dist/esm/client/useDictionaryDynamic.mjs +4 -4
- package/dist/esm/client/useIntlayer.mjs +24 -24
- package/dist/esm/devtools/index.mjs +15 -15
- package/dist/esm/format/index.mjs +6 -6
- package/dist/esm/html/HTMLRenderer.mjs +7 -7
- package/dist/esm/html/installIntlayerHTML.mjs +12 -12
- package/dist/esm/index.mjs +11 -11
- package/dist/esm/plugins.mjs +84 -84
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./exposureSink.cjs"),t=require("../../isEnabled-CuTKz0YA.js"),n=require("../client/installIntlayer.cjs");let r=require("vue");var i=t=>{let n=null,i=!1,a=!1;return Promise.resolve().then(()=>require("../../esm-DXg1m_y3.js")).then(({initAnalyticsClient:o,buildContentExposure:s})=>{if(i)return;let c=o();a=!0,t?.value&&c.setLocale(t.value),c.trackPageView({reason:`initial`}),e.setExposureSink(e=>c.trackContentExposure(s(e))),t&&(n=(0,r.watch)(t,e=>{e&&(c.setLocale(e),c.trackPageView({reason:`locale_change`}))}))}).catch(()=>{}),()=>{i=!0,n?.(),e.setExposureSink(null),Promise.resolve().then(()=>require("../../esm-DXg1m_y3.js")).then(({stopAnalyticsClient:e})=>{a&&e()}).catch(()=>{})}},a=e=>{if(process.env.INTLAYER_ANALYTICS_ENABLED===`false`||!t.t)return;if(e){let t=null;e.mixin({inject:{_intlayerClient:{from:n.INTLAYER_SYMBOL,default:null}},mounted(){if(this.$parent!==null)return;let e=this._intlayerClient;t=i(e?.locale)},unmounted(){this.$parent===null&&t?.()}});return}let a=(0,r.inject)(n.INTLAYER_SYMBOL),o=null;(0,r.onMounted)(()=>{o=i(a?.locale)}),(0,r.onUnmounted)(()=>{o?.()})};exports.useAnalytics=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./installIntlayer.cjs");let n=require("@intlayer/config/built"),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??n.internationalization.defaultLocale),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("
|
|
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/config/built"),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??r.internationalization.defaultLocale;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("
|
|
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/config/built"),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??r.internationalization.defaultLocale),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("../client/installIntlayer.cjs"),t=require("../client/useLocaleStorage.cjs"),n=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../client/installIntlayer.cjs"),t=require("../client/useLocaleStorage.cjs"),n=require("./formatDictionaryForInspector.cjs"),r=require("./buildLocalesInspectorNode.cjs");let i=require("@intlayer/config/built"),a=require("vue"),o=require("@intlayer/dictionaries-entry"),s=require("@vue/devtools-api");var c=`intlayer`,l=`intlayer-dictionaries-inspector`,{defaultLocale:u,locales:d}=i.internationalization??{},f=s.setupDevtoolsPlugin,p=i=>{f({id:c,label:`Intlayer`,packageName:`vue-intlayer`,homepage:`https://intlayer.org`,componentStateTypes:[c],app:i},i=>{i.addInspector({id:l,label:`Intlayer`,icon:`language`,treeFilterPlaceholder:`Search dictionaries`,nodeActions:[{icon:`check`,tooltip:`Set as current locale`,action:n=>{if(!r.isLocaleNodeId(n))return;let a=r.getLocaleFromNodeId(n);if(!d?.map(String).includes(a)){console.error(`Locale ${a} is not available`);return}let o=e.createIntlayerClient();o.setLocale(a),t.setLocaleInStorage(a,o.isCookieEnabled??!0),i.sendInspectorTree(l),i.sendInspectorState(l)}}]}),(0,a.watch)(()=>e.createIntlayerClient().locale.value,()=>{i.sendInspectorTree(l),i.sendInspectorState(l)}),i.on.getInspectorTree(t=>{if(t.inspectorId!==`intlayer-dictionaries-inspector`)return;let n=(0,o.getDictionaries)(),i=Object.keys(n),a=e.createIntlayerClient().locale.value??u;t.rootNodes=[...i.length===0?[{id:`intlayer-no-dictionaries`,label:`No dictionaries loaded. Add an Intlayer build plugin (e.g. vite-intlayer) to generate them.`}]:i.map(e=>({id:e,label:e})),r.buildLocalesInspectorNode(a)]}),i.on.getInspectorState(t=>{if(t.inspectorId!==`intlayer-dictionaries-inspector`)return;let i=e.createIntlayerClient().locale.value??u;if(t.nodeId===`intlayer-locales`){t.state={Locales:(d??[]).map(e=>({key:e,value:e===i?`current`:``,editable:!1}))};return}if(r.isLocaleNodeId(t.nodeId)){let e=r.getLocaleFromNodeId(t.nodeId);t.state={Locale:[{key:`locale`,value:e,editable:!1},{key:`current`,value:e===i,editable:!1}]};return}let a=(0,o.getDictionaries)()[t.nodeId];if(!a){t.state={};return}let s=n.formatDictionaryForInspector(a);t.state={Translations:Object.entries(s).map(([e,t])=>({key:e,value:t,editable:!1})),Metadata:[{key:`key`,value:a.key,editable:!1},{key:`title`,value:a.title??``,editable:!1},{key:`description`,value:a.description??``,editable:!1}]}})})};exports.INTLAYER_DEVTOOLS_PLUGIN_ID=c,exports.INTLAYER_DICTIONARIES_INSPECTOR_ID=l,exports.enableIntlayerDevtools=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./usePercentage.cjs"),t=require("./useUnit.cjs"),n=require("./useCompact.cjs"),r=require("./useNumber.cjs"),i=require("./useIntl.cjs"),a=require("./useList.cjs"),o=require("./useCurrency.cjs"),s=require("./useDate.cjs"),c=require("./useRelativeTime.cjs");exports.useCompact=n.useCompact,exports.useCurrency=o.useCurrency,exports.useDate=s.useDate,exports.useIntl=i.useIntl,exports.useList=a.useList,exports.useNumber=r.useNumber,exports.usePercentage=e.usePercentage,exports.useRelativeTime=c.useRelativeTime,exports.useUnit=t.useUnit;
|
|
@@ -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("./plugins.cjs"),t=require("./getDictionary.cjs"),n=require("./getIntlayer.cjs"),r=require("./client/installIntlayer.cjs"),i=require("./analytics/useAnalytics.cjs"),a=require("./analytics/useConversion.cjs"),o=require("./analytics/useExperiment.cjs");require("./analytics/index.cjs");const s=require("./client/useDictionary.cjs"),c=require("./client/useDictionaryAsync.cjs"),l=require("./client/useDictionaryDynamic.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("./editor/useEditor.cjs");exports.INTLAYER_SYMBOL=r.INTLAYER_SYMBOL,exports.atPath=s.atPath,exports.createIntlayerClient=r.createIntlayerClient,exports.createIntlayerLeafProxy=s.createIntlayerLeafProxy,exports.getDictionary=t.getDictionary,exports.getIntlayer=n.getIntlayer,exports.getPlugins=e.getPlugins,exports.htmlPlugin=e.htmlPlugin,exports.insertionPlugin=e.insertionPlugin,exports.installIntlayer=r.installIntlayer,exports.intlayer=r.intlayer,exports.intlayerNodePlugins=e.intlayerNodePlugins,exports.isComponentLike=s.isComponentLike,exports.isIntlayerNode=s.isIntlayerNode,exports.isObjectLike=s.isObjectLike,exports.markdownPlugin=e.markdownPlugin,exports.markdownStringPlugin=e.markdownStringPlugin,exports.toComponent=s.toComponent,exports.useAnalytics=i.useAnalytics,exports.useConversion=a.useConversion,exports.useDictionary=s.useDictionary,exports.useDictionaryAsync=c.useDictionaryAsync,exports.useDictionaryDynamic=l.useDictionaryDynamic,exports.useEditor=h.useEditor,exports.useExperiment=o.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`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./analytics/exposureSink.cjs"),l=require("./html/HTMLRenderer.cjs"),u=require("./markdown/installIntlayerMarkdown.cjs"),d=require("./renderIntlayerNode.cjs");let f=require("@intlayer/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));const c=require("./analytics/exposureSink.cjs"),l=require("./html/HTMLRenderer.cjs"),u=require("./markdown/installIntlayerMarkdown.cjs"),d=require("./renderIntlayerNode.cjs");let f=require("@intlayer/core/interpreter"),p=require("@intlayer/config/built"),m=require("@intlayer/core/markdown"),h=require("@intlayer/types/nodeType");h=s(h);let g=require("vue");var _=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,g.defineAsyncComponent)(()=>Promise.resolve().then(()=>require("./editor/ContentSelector.cjs"))),v={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:t,...n})=>{process.env.INTLAYER_ANALYTICS_ENABLED!==`false`&&c.reportExposure({dictionaryKey:n.dictionaryKey,keyPath:n.keyPath,locale:n.locale,nodeType:`text`});let r=e=>d.renderIntlayerNode({...n,value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?()=>(0,g.h)(_,{dictionaryKey:n.dictionaryKey,keyPath:n.keyPath},{default:()=>typeof e==`function`?e():e}):e}),i=r(t);if(typeof t!=`function`)return i;let a=(...e)=>{let n=t(...e);return r(n)};Object.setPrototypeOf(a,Object.getPrototypeOf(i));for(let e of Object.getOwnPropertyNames(i)){let t=Object.getOwnPropertyDescriptor(i,e);t&&Object.defineProperty(a,e,t)}for(let e of Object.getOwnPropertySymbols(i)){let t=Object.getOwnPropertyDescriptor(i,e);t&&Object.defineProperty(a,e,t)}return(0,g.markRaw)(a)}},y=(e,t)=>{let n=new Map,r={};for(let[e,i]of Object.entries(t))typeof i==`string`||typeof i==`number`?r[e]=i:(n.set(e,i),r[e]=`__VNODE_${e}__`);let i=(0,f.splitInsertionTemplate)(e,r);if(n.size>0){let e=[];if(i.isSimple){let t=i.parts,r=0;for(let[i]of n){let a=`__VNODE_${i}__`,o=t.indexOf(a);o!==-1&&(o>r&&e.push(t.substring(r,o)),e.push(n.get(i)),r=o+a.length)}return r<t.length&&e.push(t.substring(r)),(0,g.h)(g.Fragment,null,...e)}return i.parts.forEach(t=>{if(typeof t==`string`){let r=t;for(let[t]of n){let i=`__VNODE_${t}__`,a=r.indexOf(i);a!==-1&&(a>0&&e.push(r.substring(0,a)),e.push(n.get(t)),r=r.substring(a+i.length))}r.length>0&&e.push(r)}else e.push(t)}),(0,g.h)(g.Fragment,null,...e)}return i.isSimple?i.parts:(0,g.h)(g.Fragment,null,i.parts)},b=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?f.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.INSERTION}],i=e[h.INSERTION],a={id:`insertion-string-plugin`,canHandle:e=>typeof e==`string`||(0,f.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,f.isInterpolableWrapperNode)(e))return i=>(0,f.transformInterpolableNode)(e,i,n,t.plugins,r);let i=r(e,{...n,children:e,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]});return e=>{let a=y(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return(0,f.resolveInsertedSelector)(i,o)}},x=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,a=n((0,m.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>d.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),o=n=>d.renderIntlayerNode({...t,value:e,children:()=>{let{renderMarkdown:t,components:r}=u.useMarkdown(),a=t(e,void 0,{...r??{},...n??{}});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?(0,g.h)(_,{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},{default:()=>a}):a},additionalProps:{metadata:a,use:e=>o(e)}});return o()}},S=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?f.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:h.MARKDOWN}],i=e[h.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[x,...t.plugins??[]]})}},C=process.env.INTLAYER_NODE_TYPE_HTML===`false`?f.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.HTML,transform:(e,t)=>{let n=e[h.HTML];e.tags;let r=(e={})=>{let i=l.renderHTML(n,{components:e});return d.renderIntlayerNode({...t,value:n,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&p.editor.enabled?()=>(0,g.h)(_,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath,...e},{default:()=>i}):i,additionalProps:{use:e=>r(e)}})};return r()}},w=new Map,T=(e,t=!0)=>{let n=`${e??p.internationalization.defaultLocale}_${t}`;if(w.has(n))return w.get(n);let r=[(0,f.translationPlugin)(e??p.internationalization.defaultLocale,t?p.internationalization.defaultLocale:void 0),f.enumerationPlugin,(0,f.pluralPlugin)(e??p.internationalization.defaultLocale),f.conditionPlugin,(0,f.nestedPlugin)(e??p.internationalization.defaultLocale),f.filePlugin,f.genderPlugin,f.selectPlugin,v,b,S,C];return w.set(n,r),r};exports.getPlugins=T,exports.htmlPlugin=C,exports.insertionPlugin=b,exports.intlayerNodePlugins=v,exports.markdownPlugin=S,exports.markdownStringPlugin=x;
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { setExposureSink as e } from "./exposureSink.mjs";
|
|
2
|
+
import { t } from "../../isEnabled-BbWU6Ox5.mjs";
|
|
3
|
+
import { INTLAYER_SYMBOL as n } from "../client/installIntlayer.mjs";
|
|
4
4
|
import { inject as r, onMounted as i, onUnmounted as a, watch as o } from "vue";
|
|
5
5
|
//#region src/analytics/useAnalytics.ts
|
|
6
|
-
var s = (
|
|
7
|
-
let
|
|
6
|
+
var s = (t) => {
|
|
7
|
+
let n = null, r = !1, i = !1;
|
|
8
8
|
return import("../../esm-DZ1bEPA6.mjs").then(({ initAnalyticsClient: a, buildContentExposure: s }) => {
|
|
9
9
|
if (r) return;
|
|
10
10
|
let c = a();
|
|
11
|
-
i = !0,
|
|
11
|
+
i = !0, t?.value && c.setLocale(t.value), c.trackPageView({ reason: "initial" }), e((e) => c.trackContentExposure(s(e))), t && (n = o(t, (e) => {
|
|
12
12
|
e && (c.setLocale(e), c.trackPageView({ reason: "locale_change" }));
|
|
13
13
|
}));
|
|
14
14
|
}).catch(() => {}), () => {
|
|
15
|
-
r = !0,
|
|
15
|
+
r = !0, n?.(), e(null), import("../../esm-DZ1bEPA6.mjs").then(({ stopAnalyticsClient: e }) => {
|
|
16
16
|
i && e();
|
|
17
17
|
}).catch(() => {});
|
|
18
18
|
};
|
|
19
|
-
}, c = (
|
|
20
|
-
if (process.env.INTLAYER_ANALYTICS_ENABLED === "false" || !
|
|
21
|
-
if (
|
|
22
|
-
let
|
|
23
|
-
|
|
19
|
+
}, c = (e) => {
|
|
20
|
+
if (process.env.INTLAYER_ANALYTICS_ENABLED === "false" || !t) return;
|
|
21
|
+
if (e) {
|
|
22
|
+
let t = null;
|
|
23
|
+
e.mixin({
|
|
24
24
|
inject: { _intlayerClient: {
|
|
25
|
-
from:
|
|
25
|
+
from: n,
|
|
26
26
|
default: null
|
|
27
27
|
} },
|
|
28
28
|
mounted() {
|
|
29
29
|
if (this.$parent !== null) return;
|
|
30
|
-
let
|
|
31
|
-
|
|
30
|
+
let e = this._intlayerClient;
|
|
31
|
+
t = s(e?.locale);
|
|
32
32
|
},
|
|
33
33
|
unmounted() {
|
|
34
|
-
this.$parent === null &&
|
|
34
|
+
this.$parent === null && t?.();
|
|
35
35
|
}
|
|
36
36
|
});
|
|
37
37
|
return;
|
|
38
38
|
}
|
|
39
|
-
let o = r(
|
|
39
|
+
let o = r(n), c = null;
|
|
40
40
|
i(() => {
|
|
41
41
|
c = s(o?.locale);
|
|
42
42
|
}), a(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
|
+
import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
|
|
3
3
|
import { internationalization as n } from "@intlayer/config/built";
|
|
4
4
|
import { computed as r, defineComponent as i, getCurrentInstance as a, h as o, inject as s, isRef as c, markRaw as l, ref as u, shallowRef as d, toValue as f, watch as p } from "vue";
|
|
5
5
|
import { parseDictionarySelector as m, resolveDictionaryArgument as h } from "@intlayer/core/dictionaryManipulator";
|
|
@@ -35,7 +35,7 @@ var g = (e, t) => t.reduce((e, t) => e?.[t], e), _ = (e) => typeof e == "object"
|
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
37
|
}), S = (i, o) => {
|
|
38
|
-
let l = a() ? s(
|
|
38
|
+
let l = a() ? s(t) : void 0, S = c(l?.locale) ? l.locale : u(l?.locale ?? n.defaultLocale), C = r(() => {
|
|
39
39
|
let e = o === void 0 ? void 0 : f(o);
|
|
40
40
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
|
|
41
41
|
let t = h({
|
|
@@ -55,11 +55,11 @@ var g = (e, t) => t.reduce((e, t) => e?.[t], e), _ = (e) => typeof e == "object"
|
|
|
55
55
|
() => f(i),
|
|
56
56
|
() => w.value,
|
|
57
57
|
() => C.value.selector
|
|
58
|
-
], ([
|
|
59
|
-
T.value = r ? t
|
|
58
|
+
], ([t, n, r]) => {
|
|
59
|
+
T.value = r ? e(t, {
|
|
60
60
|
...r,
|
|
61
61
|
locale: n
|
|
62
|
-
}) : t
|
|
62
|
+
}) : e(t, n);
|
|
63
63
|
}, {
|
|
64
64
|
immediate: !0,
|
|
65
65
|
flush: "sync"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
|
+
import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
|
|
3
3
|
import { useDictionaryAsync as n } from "./useDictionaryAsync.mjs";
|
|
4
4
|
import { internationalization as r } from "@intlayer/config/built";
|
|
5
5
|
import { inject as i, toValue as a } from "vue";
|
|
@@ -7,7 +7,7 @@ import { isQualifiedDynamicLoaderMap as o, parseDictionarySelector as s, resolve
|
|
|
7
7
|
//#region src/client/useDictionaryDynamic.ts
|
|
8
8
|
var u = async (u, d, f) => {
|
|
9
9
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && o(u)) {
|
|
10
|
-
let n = i(
|
|
10
|
+
let n = i(t), o = f === void 0 ? void 0 : a(f), { locale: p, selector: m } = s(c({
|
|
11
11
|
localeOrSelector: o ?? void 0,
|
|
12
12
|
contextLocale: n?.locale?.value,
|
|
13
13
|
contextVariant: n?.variant?.value,
|
|
@@ -18,7 +18,7 @@ var u = async (u, d, f) => {
|
|
|
18
18
|
key: String(d),
|
|
19
19
|
locale: h,
|
|
20
20
|
selector: m,
|
|
21
|
-
transform: (
|
|
21
|
+
transform: (t) => e(t, h)
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
24
|
return n(u, f);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { getIntlayer as e } from "../getIntlayer.mjs";
|
|
2
|
+
import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
|
|
3
|
+
import { atPath as n, createIntlayerLeafProxy as r, isComponentLike as i, isIntlayerNode as a, isObjectLike as o, toComponent as s } from "./useDictionary.mjs";
|
|
4
4
|
import { internationalization as c } from "@intlayer/config/built";
|
|
5
5
|
import { computed as l, inject as u, isRef as d, ref as f, shallowRef as p, toValue as m, watch as h } from "vue";
|
|
6
6
|
import { parseDictionarySelector as g, resolveDictionaryArgument as _ } from "@intlayer/core/dictionaryManipulator";
|
|
7
7
|
//#region src/client/useIntlayer.ts
|
|
8
8
|
var v = (v, y) => {
|
|
9
|
-
let b = u(
|
|
9
|
+
let b = u(t), x = d(b?.locale) ? b.locale : f(b?.locale ?? c.defaultLocale), S = l(() => {
|
|
10
10
|
let e = y === void 0 ? void 0 : m(y);
|
|
11
11
|
if (process.env.INTLAYER_DICTIONARY_SELECTOR !== "false") {
|
|
12
12
|
let t = _({
|
|
@@ -26,40 +26,40 @@ var v = (v, y) => {
|
|
|
26
26
|
() => m(v),
|
|
27
27
|
() => C.value,
|
|
28
28
|
() => S.value.selector
|
|
29
|
-
], ([
|
|
30
|
-
w.value =
|
|
31
|
-
...
|
|
32
|
-
locale:
|
|
33
|
-
}) :
|
|
29
|
+
], ([t, n, r]) => {
|
|
30
|
+
w.value = r ? e(t, {
|
|
31
|
+
...r,
|
|
32
|
+
locale: n
|
|
33
|
+
}) : e(t, n);
|
|
34
34
|
}, {
|
|
35
35
|
immediate: !0,
|
|
36
36
|
flush: "sync"
|
|
37
37
|
});
|
|
38
38
|
let T = /* @__PURE__ */ new Map(), E = (e) => {
|
|
39
|
-
let
|
|
40
|
-
if (T.has(
|
|
41
|
-
let c = l(() =>
|
|
42
|
-
get(
|
|
43
|
-
if (typeof u == "symbol" || typeof u == "string" && (u.startsWith("__") || u.startsWith("$"))) return u === "__v_isRef" ? !0 : u === "then" ? void 0 : Reflect.get(
|
|
39
|
+
let t = e.join(".");
|
|
40
|
+
if (T.has(t)) return T.get(t);
|
|
41
|
+
let c = l(() => n(w.value, e)), u = new Proxy({}, {
|
|
42
|
+
get(t, u, d) {
|
|
43
|
+
if (typeof u == "symbol" || typeof u == "string" && (u.startsWith("__") || u.startsWith("$"))) return u === "__v_isRef" ? !0 : u === "then" ? void 0 : Reflect.get(t, u, d);
|
|
44
44
|
if (u === "value") return c.value ?? "";
|
|
45
|
-
if (u === "c" || u === "asComponent") return
|
|
45
|
+
if (u === "c" || u === "asComponent") return s(() => c.value);
|
|
46
46
|
if (u === "$raw") return c;
|
|
47
47
|
if (u === Symbol.toPrimitive) return () => String(c.value ?? "");
|
|
48
|
-
let f = e.concat(u), p =
|
|
49
|
-
if (p === void 0 ||
|
|
50
|
-
if (
|
|
48
|
+
let f = e.concat(u), p = n(w.value, f);
|
|
49
|
+
if (p === void 0 || o(p) && !i(p)) return E(f);
|
|
50
|
+
if (a(p)) return r(l(() => n(w.value, f)));
|
|
51
51
|
if (typeof p == "function") {
|
|
52
|
-
let
|
|
53
|
-
return
|
|
52
|
+
let t = n(w.value, e);
|
|
53
|
+
return t != null && !Object.hasOwn(t, u) ? p.bind(t) : (...e) => n(w.value, f)?.(...e);
|
|
54
54
|
}
|
|
55
|
-
let m = l(() =>
|
|
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
|
} });
|
|
59
59
|
},
|
|
60
60
|
ownKeys() {
|
|
61
|
-
let
|
|
62
|
-
return
|
|
61
|
+
let t = n(w.value, e);
|
|
62
|
+
return o(t) ? Reflect.ownKeys(t) : [];
|
|
63
63
|
},
|
|
64
64
|
getOwnPropertyDescriptor() {
|
|
65
65
|
return {
|
|
@@ -68,7 +68,7 @@ var v = (v, y) => {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
|
-
return T.set(
|
|
71
|
+
return T.set(t, u), u;
|
|
72
72
|
};
|
|
73
73
|
return E([]);
|
|
74
74
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createIntlayerClient as e } from "../client/installIntlayer.mjs";
|
|
2
2
|
import { setLocaleInStorage as t } from "../client/useLocaleStorage.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { formatDictionaryForInspector as n } from "./formatDictionaryForInspector.mjs";
|
|
4
|
+
import { buildLocalesInspectorNode as r, getLocaleFromNodeId as i, isLocaleNodeId as a } from "./buildLocalesInspectorNode.mjs";
|
|
5
5
|
import { internationalization as o } from "@intlayer/config/built";
|
|
6
6
|
import { watch as s } from "vue";
|
|
7
7
|
import { getDictionaries as c } from "@intlayer/dictionaries-entry";
|
|
@@ -25,48 +25,48 @@ var u = "intlayer", d = "intlayer-dictionaries-inspector", { defaultLocale: f, l
|
|
|
25
25
|
icon: "check",
|
|
26
26
|
tooltip: "Set as current locale",
|
|
27
27
|
action: (n) => {
|
|
28
|
-
if (!
|
|
29
|
-
let
|
|
30
|
-
if (!p?.map(String).includes(
|
|
31
|
-
console.error(`Locale ${
|
|
28
|
+
if (!a(n)) return;
|
|
29
|
+
let r = i(n);
|
|
30
|
+
if (!p?.map(String).includes(r)) {
|
|
31
|
+
console.error(`Locale ${r} is not available`);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
let s = e();
|
|
35
|
-
s.setLocale(
|
|
35
|
+
s.setLocale(r), t(r, s.isCookieEnabled ?? !0), o.sendInspectorTree(d), o.sendInspectorState(d);
|
|
36
36
|
}
|
|
37
37
|
}]
|
|
38
38
|
}), s(() => e().locale.value, () => {
|
|
39
39
|
o.sendInspectorTree(d), o.sendInspectorState(d);
|
|
40
40
|
}), o.on.getInspectorTree((t) => {
|
|
41
41
|
if (t.inspectorId !== "intlayer-dictionaries-inspector") return;
|
|
42
|
-
let
|
|
42
|
+
let n = c(), i = Object.keys(n), a = e().locale.value ?? f;
|
|
43
43
|
t.rootNodes = [...i.length === 0 ? [{
|
|
44
44
|
id: "intlayer-no-dictionaries",
|
|
45
45
|
label: "No dictionaries loaded. Add an Intlayer build plugin (e.g. vite-intlayer) to generate them."
|
|
46
46
|
}] : i.map((e) => ({
|
|
47
47
|
id: e,
|
|
48
48
|
label: e
|
|
49
|
-
})),
|
|
49
|
+
})), r(a)];
|
|
50
50
|
}), o.on.getInspectorState((t) => {
|
|
51
51
|
if (t.inspectorId !== "intlayer-dictionaries-inspector") return;
|
|
52
|
-
let
|
|
52
|
+
let r = e().locale.value ?? f;
|
|
53
53
|
if (t.nodeId === "intlayer-locales") {
|
|
54
54
|
t.state = { Locales: (p ?? []).map((e) => ({
|
|
55
55
|
key: e,
|
|
56
|
-
value: e ===
|
|
56
|
+
value: e === r ? "current" : "",
|
|
57
57
|
editable: !1
|
|
58
58
|
})) };
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (
|
|
62
|
-
let e =
|
|
61
|
+
if (a(t.nodeId)) {
|
|
62
|
+
let e = i(t.nodeId);
|
|
63
63
|
t.state = { Locale: [{
|
|
64
64
|
key: "locale",
|
|
65
65
|
value: e,
|
|
66
66
|
editable: !1
|
|
67
67
|
}, {
|
|
68
68
|
key: "current",
|
|
69
|
-
value: e ===
|
|
69
|
+
value: e === r,
|
|
70
70
|
editable: !1
|
|
71
71
|
}] };
|
|
72
72
|
return;
|
|
@@ -76,7 +76,7 @@ var u = "intlayer", d = "intlayer-dictionaries-inspector", { defaultLocale: f, l
|
|
|
76
76
|
t.state = {};
|
|
77
77
|
return;
|
|
78
78
|
}
|
|
79
|
-
let s =
|
|
79
|
+
let s = n(o);
|
|
80
80
|
t.state = {
|
|
81
81
|
Translations: Object.entries(s).map(([e, t]) => ({
|
|
82
82
|
key: e,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { usePercentage as e } from "./usePercentage.mjs";
|
|
2
2
|
import { useUnit as t } from "./useUnit.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { useCompact as n } from "./useCompact.mjs";
|
|
4
|
+
import { useNumber as r } from "./useNumber.mjs";
|
|
5
5
|
import { useIntl as i } from "./useIntl.mjs";
|
|
6
6
|
import { useList as a } from "./useList.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { useCurrency as o } from "./useCurrency.mjs";
|
|
8
|
+
import { useDate as s } from "./useDate.mjs";
|
|
9
9
|
import { useRelativeTime as c } from "./useRelativeTime.mjs";
|
|
10
|
-
export {
|
|
10
|
+
export { n as useCompact, o as useCurrency, s as useDate, i as useIntl, a as useList, r as useNumber, e as usePercentage, c as useRelativeTime, t as useUnit };
|
|
@@ -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
|
//#region 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,23 +1,23 @@
|
|
|
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
|
//#region 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
|
//#endregion
|
|
23
23
|
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,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { getPlugins as e, htmlPlugin as t, insertionPlugin as n, intlayerNodePlugins as r, markdownPlugin as i, markdownStringPlugin as a } from "./plugins.mjs";
|
|
2
|
+
import { getDictionary as o } from "./getDictionary.mjs";
|
|
3
|
+
import { getIntlayer as s } from "./getIntlayer.mjs";
|
|
4
|
+
import { INTLAYER_SYMBOL as c, createIntlayerClient as l, installIntlayer as u, intlayer as d } from "./client/installIntlayer.mjs";
|
|
5
|
+
import { useAnalytics as f } from "./analytics/useAnalytics.mjs";
|
|
6
|
+
import { useConversion as p } from "./analytics/useConversion.mjs";
|
|
7
|
+
import { useExperiment as m } from "./analytics/useExperiment.mjs";
|
|
5
8
|
import "./analytics/index.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { useDictionaryAsync as x } from "./client/useDictionaryAsync.mjs";
|
|
10
|
-
import { useDictionaryDynamic as S } from "./client/useDictionaryDynamic.mjs";
|
|
11
|
-
import { getIntlayer as C } from "./getIntlayer.mjs";
|
|
9
|
+
import { atPath as h, createIntlayerLeafProxy as g, isComponentLike as _, isIntlayerNode as v, isObjectLike as y, toComponent as b, useDictionary as x } from "./client/useDictionary.mjs";
|
|
10
|
+
import { useDictionaryAsync as S } from "./client/useDictionaryAsync.mjs";
|
|
11
|
+
import { useDictionaryDynamic as C } from "./client/useDictionaryDynamic.mjs";
|
|
12
12
|
import { useIntlayer as w } from "./client/useIntlayer.mjs";
|
|
13
13
|
import { useLoadDynamic as T } from "./client/useLoadDynamic.mjs";
|
|
14
14
|
import { useLocale as E } from "./client/useLocale.mjs";
|
|
@@ -16,4 +16,4 @@ import { usePathname as D } from "./client/usePathname.mjs";
|
|
|
16
16
|
import { useRewriteURL as O } from "./client/useRewriteURL.mjs";
|
|
17
17
|
import "./client/index.mjs";
|
|
18
18
|
import { useEditor as k } from "./editor/useEditor.mjs";
|
|
19
|
-
export {
|
|
19
|
+
export { c as INTLAYER_SYMBOL, h as atPath, l as createIntlayerClient, g as createIntlayerLeafProxy, o as getDictionary, s as getIntlayer, e as getPlugins, t as htmlPlugin, n as insertionPlugin, u as installIntlayer, d as intlayer, r as intlayerNodePlugins, _ as isComponentLike, v as isIntlayerNode, y as isObjectLike, i as markdownPlugin, a as markdownStringPlugin, b as toComponent, f as useAnalytics, p as useConversion, x as useDictionary, S as useDictionaryAsync, C as useDictionaryDynamic, k as useEditor, m as useExperiment, w as useIntlayer, T as useLoadDynamic, E as useLocale, D as usePathname, O 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, selectPlugin as p, splitInsertionTemplate as m, transformInterpolableNode as h, translationPlugin as g } from "@intlayer/core/interpreter";
|
|
6
|
+
import { editor as _, internationalization as v } from "@intlayer/config/built";
|
|
7
|
+
import { getMarkdownMetadata as y } from "@intlayer/core/markdown";
|
|
8
|
+
import * as b from "@intlayer/types/nodeType";
|
|
9
|
+
import { Fragment as x, defineAsyncComponent as S, h as C, markRaw as w } from "vue";
|
|
10
10
|
//#region src/plugins.ts
|
|
11
|
-
var
|
|
11
|
+
var T = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : S(() => import("./editor/ContentSelector.mjs")), E = {
|
|
12
12
|
id: "intlayer-node-plugin",
|
|
13
13
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
14
|
-
transform: (t, { children: n, ...
|
|
14
|
+
transform: (t, { children: n, ...i }) => {
|
|
15
15
|
process.env.INTLAYER_ANALYTICS_ENABLED !== "false" && e({
|
|
16
|
-
dictionaryKey:
|
|
17
|
-
keyPath:
|
|
18
|
-
locale:
|
|
16
|
+
dictionaryKey: i.dictionaryKey,
|
|
17
|
+
keyPath: i.keyPath,
|
|
18
|
+
locale: i.locale,
|
|
19
19
|
nodeType: "text"
|
|
20
20
|
});
|
|
21
|
-
let
|
|
22
|
-
...
|
|
21
|
+
let a = (e) => r({
|
|
22
|
+
...i,
|
|
23
23
|
value: e,
|
|
24
|
-
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
25
|
-
dictionaryKey:
|
|
26
|
-
keyPath:
|
|
24
|
+
children: process.env.INTLAYER_EDITOR_ENABLED !== "false" && _.enabled ? () => C(T, {
|
|
25
|
+
dictionaryKey: i.dictionaryKey,
|
|
26
|
+
keyPath: i.keyPath
|
|
27
27
|
}, { default: () => typeof e == "function" ? e() : e }) : e
|
|
28
|
-
}),
|
|
29
|
-
if (typeof n != "function") return
|
|
30
|
-
let
|
|
28
|
+
}), o = a(n);
|
|
29
|
+
if (typeof n != "function") return o;
|
|
30
|
+
let s = (...e) => {
|
|
31
31
|
let t = n(...e);
|
|
32
|
-
return
|
|
32
|
+
return a(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(s, Object.getPrototypeOf(o));
|
|
35
|
+
for (let e of Object.getOwnPropertyNames(o)) {
|
|
36
|
+
let t = Object.getOwnPropertyDescriptor(o, e);
|
|
37
|
+
t && Object.defineProperty(s, 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(o)) {
|
|
40
|
+
let t = Object.getOwnPropertyDescriptor(o, e);
|
|
41
|
+
t && Object.defineProperty(s, e, t);
|
|
42
42
|
}
|
|
43
|
-
return
|
|
43
|
+
return w(s);
|
|
44
44
|
}
|
|
45
|
-
},
|
|
45
|
+
}, D = (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 = m(e, r);
|
|
49
49
|
if (n.size > 0) {
|
|
50
50
|
let e = [];
|
|
51
51
|
if (i.isSimple) {
|
|
@@ -54,7 +54,7 @@ var w = 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)), C(x, null, ...e);
|
|
58
58
|
}
|
|
59
59
|
return i.parts.forEach((t) => {
|
|
60
60
|
if (typeof t == "string") {
|
|
@@ -65,25 +65,25 @@ var w = 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
|
+
}), C(x, null, ...e);
|
|
69
69
|
}
|
|
70
|
-
return i.isSimple ? i.parts :
|
|
71
|
-
},
|
|
70
|
+
return i.isSimple ? i.parts : C(x, null, i.parts);
|
|
71
|
+
}, O = 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 === b.INSERTION,
|
|
74
74
|
transform: (e, t, n) => {
|
|
75
|
-
let r = [...t.keyPath, { type:
|
|
75
|
+
let r = [...t.keyPath, { type: b.INSERTION }], i = e[b.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) => h(e, i, n, t.plugins, r);
|
|
80
80
|
let i = r(e, {
|
|
81
81
|
...n,
|
|
82
82
|
children: e,
|
|
83
83
|
plugins: [...(t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")]
|
|
84
84
|
});
|
|
85
85
|
return (e) => {
|
|
86
|
-
let a =
|
|
86
|
+
let a = D(i, e);
|
|
87
87
|
return r(a, {
|
|
88
88
|
...n,
|
|
89
89
|
plugins: t.plugins,
|
|
@@ -91,19 +91,19 @@ var w = process.env.INTLAYER_EDITOR_ENABLED === "false" ? null : s(() => import(
|
|
|
91
91
|
});
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
|
-
}
|
|
95
|
-
return n(i, {
|
|
94
|
+
}, o = n(i, {
|
|
96
95
|
...t,
|
|
97
96
|
children: i,
|
|
98
97
|
keyPath: r,
|
|
99
98
|
plugins: [a, ...t.plugins ?? []]
|
|
100
99
|
});
|
|
100
|
+
return f(i, o);
|
|
101
101
|
}
|
|
102
|
-
},
|
|
102
|
+
}, k = 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(y(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,79 +113,79 @@ var w = 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" && _.enabled ? C(T, {
|
|
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
|
-
},
|
|
138
|
+
}, A = 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 === b.MARKDOWN,
|
|
141
141
|
transform: (e, t, n) => {
|
|
142
|
-
let r = [...t.keyPath, { type:
|
|
142
|
+
let r = [...t.keyPath, { type: b.MARKDOWN }], i = e[b.MARKDOWN];
|
|
143
143
|
return n(i, {
|
|
144
144
|
...t,
|
|
145
145
|
children: i,
|
|
146
146
|
keyPath: r,
|
|
147
|
-
plugins: [
|
|
147
|
+
plugins: [k, ...t.plugins ?? []]
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
|
-
},
|
|
150
|
+
}, j = 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 === b.HTML,
|
|
153
153
|
transform: (e, n) => {
|
|
154
|
-
let
|
|
154
|
+
let i = e[b.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" && _.enabled ? () => C(T, {
|
|
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
|
-
},
|
|
172
|
-
let n = `${e ??
|
|
173
|
-
if (
|
|
171
|
+
}, M = /* @__PURE__ */ new Map(), N = (e, t = !0) => {
|
|
172
|
+
let n = `${e ?? v.defaultLocale}_${t}`;
|
|
173
|
+
if (M.has(n)) return M.get(n);
|
|
174
174
|
let r = [
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
175
|
+
g(e ?? v.defaultLocale, t ? v.defaultLocale : void 0),
|
|
176
|
+
a,
|
|
177
|
+
d(e ?? v.defaultLocale),
|
|
178
|
+
i,
|
|
179
|
+
u(e ?? v.defaultLocale),
|
|
180
|
+
s,
|
|
181
|
+
c,
|
|
180
182
|
p,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
k,
|
|
186
|
-
A
|
|
183
|
+
E,
|
|
184
|
+
O,
|
|
185
|
+
A,
|
|
186
|
+
j
|
|
187
187
|
];
|
|
188
|
-
return
|
|
188
|
+
return M.set(n, r), r;
|
|
189
189
|
};
|
|
190
190
|
//#endregion
|
|
191
|
-
export {
|
|
191
|
+
export { N as getPlugins, j as htmlPlugin, O as insertionPlugin, E as intlayerNodePlugins, A as markdownPlugin, k as markdownStringPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intlayer",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.9",
|
|
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.5.
|
|
107
|
-
"@intlayer/config": "9.5.
|
|
108
|
-
"@intlayer/core": "9.5.
|
|
109
|
-
"@intlayer/dictionaries-entry": "9.5.
|
|
110
|
-
"@intlayer/editor": "9.5.
|
|
111
|
-
"@intlayer/types": "9.5.
|
|
106
|
+
"@intlayer/api": "9.5.9",
|
|
107
|
+
"@intlayer/config": "9.5.9",
|
|
108
|
+
"@intlayer/core": "9.5.9",
|
|
109
|
+
"@intlayer/dictionaries-entry": "9.5.9",
|
|
110
|
+
"@intlayer/editor": "9.5.9",
|
|
111
|
+
"@intlayer/types": "9.5.9",
|
|
112
112
|
"@vue/devtools-api": "^6.6.4"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"vue-tsc": "3.3.9"
|
|
129
129
|
},
|
|
130
130
|
"peerDependencies": {
|
|
131
|
-
"intlayer": "9.5.
|
|
131
|
+
"intlayer": "9.5.9",
|
|
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.5.
|
|
140
|
+
"@intlayer/analytics": "9.5.9"
|
|
141
141
|
},
|
|
142
142
|
"engines": {
|
|
143
143
|
"node": ">=14.18"
|