lit-intlayer 9.6.0 → 9.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/IntlayerBinding.cjs +1 -1
- package/dist/cjs/client/index.cjs +1 -1
- package/dist/cjs/client/installIntlayer.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/client/useLocale.cjs +1 -1
- package/dist/cjs/client/useRewriteURL.cjs +1 -1
- package/dist/cjs/editor/useEditor.cjs +1 -1
- package/dist/cjs/format/useCompact.cjs +1 -1
- package/dist/cjs/format/useCurrency.cjs +1 -1
- package/dist/cjs/format/useDate.cjs +1 -1
- package/dist/cjs/format/useIntl.cjs +1 -1
- package/dist/cjs/format/useList.cjs +1 -1
- package/dist/cjs/format/useNumber.cjs +1 -1
- package/dist/cjs/format/usePercentage.cjs +1 -1
- package/dist/cjs/format/useRelativeTime.cjs +1 -1
- package/dist/cjs/format/useUnit.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/client/IntlayerBinding.mjs +1 -1
- package/dist/esm/client/index.mjs +3 -3
- package/dist/esm/client/installIntlayer.mjs +1 -1
- package/dist/esm/client/useDictionary.mjs +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +1 -1
- package/dist/esm/client/useIntlayer.mjs +1 -1
- package/dist/esm/client/useLocale.mjs +10 -10
- package/dist/esm/client/useRewriteURL.mjs +1 -1
- package/dist/esm/editor/useEditor.mjs +1 -1
- package/dist/esm/format/useCompact.mjs +1 -1
- package/dist/esm/format/useCurrency.mjs +1 -1
- package/dist/esm/format/useDate.mjs +1 -1
- package/dist/esm/format/useIntl.mjs +1 -1
- package/dist/esm/format/useList.mjs +1 -1
- package/dist/esm/format/useNumber.mjs +1 -1
- package/dist/esm/format/usePercentage.mjs +1 -1
- package/dist/esm/format/useRelativeTime.mjs +1 -1
- package/dist/esm/format/useUnit.mjs +1 -1
- package/dist/esm/index.mjs +3 -3
- package/dist/esm/plugins.mjs +1 -1
- package/dist/{installIntlayer-fyL4SuHX.mjs → installIntlayer-5LiejIKC.mjs} +30 -27
- package/dist/installIntlayer-Btnci_ES.js +1 -0
- package/dist/types/editor/useEditor.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/installIntlayer-tZQDhvqk.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");var t=class{host;unsubscribeLocale=null;onConnect;onDisconnect;constructor(e,t,n){this.host=e,this.onConnect=t,this.onDisconnect=n,this.host.addController(this)}hostConnected(){let t=e.r();this.unsubscribeLocale=t.subscribe(()=>{this.host.requestUpdate()}),this.onConnect?.()}hostDisconnected(){this.unsubscribeLocale?.(),this.unsubscribeLocale=null,this.onDisconnect?.()}};exports.IntlayerBinding=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useLocaleStorage.cjs"),t=require("../../installIntlayer-Btnci_ES.js"),n=require("./IntlayerBinding.cjs"),r=require("./useDictionary.cjs"),i=require("./useDictionaryDynamic.cjs"),a=require("./useIntlayer.cjs"),o=require("./useLocale.cjs"),s=require("./useRewriteURL.cjs");exports.IntlayerBinding=n.IntlayerBinding,exports.IntlayerClient=t.t,exports.LocaleController=o.LocaleController,exports.createIntlayerClient=t.n,exports.getIntlayerClient=t.r,exports.getLocaleInStorage=e.getLocaleInStorage,exports.installIntlayer=t.i,exports.localeCookie=e.localeCookie,exports.localeInStorage=e.localeInStorage,exports.setLocaleCookie=e.setLocaleCookie,exports.setLocaleInStorage=e.setLocaleInStorage,exports.useDictionary=r.useDictionary,exports.useDictionaryDynamic=i.useDictionaryDynamic,exports.useIntlayer=a.useIntlayer,exports.useLocale=o.useLocale,exports.useLocaleCookie=e.useLocaleCookie,exports.useLocaleStorage=e.useLocaleStorage,exports.useRewriteURL=s.useRewriteURL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");exports.IntlayerClient=e.t,exports.createIntlayerClient=e.n,exports.getIntlayerClient=e.r,exports.installIntlayer=e.i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js"),t=require("../getDictionary.cjs"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/core/interpreter"),i=require("@intlayer/core/dictionaryManipulator");var a=(a,o)=>{let s=e.r(),c=process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&typeof o==`object`&&o?o.locale:o,l=e=>process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?t.getDictionary(a,e):t.getDictionary(a,(0,i.resolveDictionaryArgument)({localeOrSelector:o,contextLocale:e,contextVariant:s.variant,dictionaryKey:a.key})),u=l(c??s.locale??(0,r.resolveInterpreterLocale)());s.subscribe(e=>{u=l(c??e)});let d,f=new Proxy({},{get(e,t){if(t===`observe`)return d;if(t===Symbol.toPrimitive)return()=>u?.[Symbol.toPrimitive]?.()??``;if(t===`toString`)return()=>String(u?.toString?.()??``);if(t!==`then`&&u!=null)return u[t]}});return d=e=>(new n.IntlayerBinding(e),f),f};exports.useDictionary=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js"),t=require("../getDictionary.cjs"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/core/interpreter"),i=require("@intlayer/core/dictionaryManipulator");var a=new Map,o=async(e,t)=>{if(!t)return;if(a.has(e))return a.get(e);let n=await t();return a.set(e,n),n},s=new Proxy(()=>{},{get:(e,t)=>{if(t===Symbol.toPrimitive||t===`toString`)return()=>``;if(t!==`then`&&!(typeof t==`string`&&t.startsWith(`_$`))&&t!==`nodeType`&&t!==Symbol.iterator)return s},apply:()=>s,construct:()=>({})}),c=(c,l,u)=>{let d=e.r(),f=process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&(0,i.isQualifiedDynamicLoaderMap)(c),{locale:p,selector:m}=process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?{locale:u,selector:void 0}:(0,i.parseDictionarySelector)((0,i.resolveDictionaryArgument)({localeOrSelector:u,contextLocale:d.locale,contextVariant:d.variant,dictionaryKey:String(l)})),h=()=>p??d.locale??(0,r.resolveInterpreterLocale)(),g,_=new Set,v=()=>{for(let e of _)e()},y=e=>{if(f){(0,i.resolveQualifiedDynamicContentAsync)({loaderMap:c,key:String(l),locale:e,selector:m,transform:n=>t.getDictionary(n,e)}).then(e=>{g=e,v()});return}let n=`${String(l)}.${e}`,r=(0,i.getPreloadedDictionary)(c,e);if(r){a.set(n,r),g=t.getDictionary(r,e),v();return}let s=c[e];o(n,s).then(n=>{n&&(g=t.getDictionary(n,e),v())})};y(h()),d.subscribe(e=>{y(p??e)});let b,x=new Proxy({},{get(e,t){if(t===`observe`)return b;if(t===Symbol.toPrimitive)return()=>void 0;if(t===`toString`)return()=>``;if(t!==`then`)return g==null?s:g[t]}});return b=e=>{let t=()=>e.requestUpdate();return _.add(t),new n.IntlayerBinding(e,()=>{g!=null&&e.requestUpdate()},()=>{_.delete(t)}),x},x};exports.useDictionaryDynamic=c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js"),t=require("../getIntlayer.cjs"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/core/interpreter"),i=require("@intlayer/core/dictionaryManipulator");var a=(a,o)=>{let s=e.r(),c=process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&typeof o==`object`&&o?o.locale:o,l=e=>process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?t.getIntlayer(a,e):t.getIntlayer(a,(0,i.resolveDictionaryArgument)({localeOrSelector:o,contextLocale:e,contextVariant:s.variant,dictionaryKey:a})),u,d,f=!1,p=new Proxy({},{get(e,t){if(t===`observe`)return e=>(new n.IntlayerBinding(e),p);if(t===Symbol.toPrimitive||t===`toString`)return()=>``;if(t===`then`||typeof t==`symbol`||typeof t==`string`&&t.startsWith(`_$`))return;let i=c??s.locale??(0,r.resolveInterpreterLocale)();if((!f||u!==i)&&(d=l(i),u=i,f=!0),d!=null)return d[t]}});return p};exports.useIntlayer=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("./useLocaleStorage.cjs"),t=require("../../installIntlayer-Btnci_ES.js");let n=require("@intlayer/config/built");var r=class{host;_isCookieEnabled;_onLocaleChange;_unsubscribe=null;locale;defaultLocale;availableLocales;constructor(e,r={}){this.host=e,this._isCookieEnabled=r.isCookieEnabled,this._onLocaleChange=r.onLocaleChange;let i=t.r(),{defaultLocale:a,locales:o}=n.internationalization??{};this.locale=i.locale,this.defaultLocale=a,this.availableLocales=o??[],e.addController(this)}setLocale=n=>{if(!this.availableLocales.map(String).includes(n)){console.error(`Locale "${n}" is not available.`);return}let r=t.r();r.setLocale(n),e.setLocaleInStorage(n,this._isCookieEnabled??r.isCookieEnabled??!0),this._onLocaleChange?.(n)};hostConnected(){let e=t.r();this._unsubscribe=e.subscribe(e=>{this.locale=e,this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},i=(e,t={})=>new r(e,t);exports.LocaleController=r,exports.useLocale=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/config/built"),n=require("@intlayer/core/localization");var r=class{_host;_unsubscribe=null;constructor(e){this._host=e,e.addController(this)}_rewrite(e){let r=t.routing?.rewrite;if(typeof window>`u`||!r)return;let i=window.location.pathname,a=(0,n.getRewritePath)(i,e,r);a&&a!==i&&window.history.replaceState(window.history.state,``,a+window.location.search+window.location.hash)}hostConnected(){let t=e.r();this._rewrite(t.locale),this._unsubscribe=t.subscribe(e=>{this._rewrite(e)})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},i=e=>{new r(e)};exports.useRewriteURL=i;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");exports.useEditor=e.a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/formatters");var n=class{host;_unsubscribe=null;value;constructor(n){this.host=n;let r=e.r();this.value=(...e)=>(0,t.compact)(e[0],{...e[1],locale:e[1]?.locale??r.locale}),n.addController(this)}hostConnected(){let n=e.r();this._unsubscribe=n.subscribe(e=>{this.value=(...n)=>(0,t.compact)(n[0],{...n[1],locale:n[1]?.locale??e}),this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},r=e=>new n(e);exports.useCompact=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/formatters");var n=class{host;_unsubscribe=null;value;constructor(n){this.host=n;let r=e.r();this.value=(...e)=>(0,t.currency)(e[0],{...e[1],locale:e[1]?.locale??r.locale}),n.addController(this)}hostConnected(){let n=e.r();this._unsubscribe=n.subscribe(e=>{this.value=(...n)=>(0,t.currency)(n[0],{...n[1],locale:n[1]?.locale??e}),this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},r=e=>new n(e);exports.useCurrency=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/formatters");var n=class{host;_unsubscribe=null;value;constructor(n){this.host=n;let r=e.r();this.value=(...e)=>{let n=typeof e[1]==`string`?{...t.presets[e[1]],locale:r.locale}:{...e[1],locale:e[1]?.locale??r.locale};return(0,t.date)(e[0],n)},n.addController(this)}hostConnected(){let n=e.r();this._unsubscribe=n.subscribe(e=>{this.value=(...n)=>{let r=typeof n[1]==`string`?{...t.presets[n[1]],locale:e}:{...n[1],locale:n[1]?.locale??e};return(0,t.date)(n[0],r)},this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},r=e=>new n(e);exports.useDate=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/utils");var n=class{host;_overrideLocale;_unsubscribe=null;value;constructor(n,r){this.host=n,this._overrideLocale=r;let i=e.r();this.value=(0,t.bindIntl)(this._overrideLocale??i.locale),n.addController(this)}hostConnected(){let n=e.r();this._unsubscribe=n.subscribe(e=>{this.value=(0,t.bindIntl)(this._overrideLocale??e),this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},r=(e,t)=>new n(e,t);exports.useIntl=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/formatters");var n=class{host;_unsubscribe=null;value;constructor(n){this.host=n;let r=e.r();this.value=(...e)=>(0,t.list)(e[0],{...e[1],locale:e[1]?.locale??r.locale}),n.addController(this)}hostConnected(){let n=e.r();this._unsubscribe=n.subscribe(e=>{this.value=(...n)=>(0,t.list)(n[0],{...n[1],locale:n[1]?.locale??e}),this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},r=e=>new n(e);exports.useList=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/formatters");var n=class{host;_unsubscribe=null;value;constructor(n){this.host=n;let r=e.r();this.value=(...e)=>(0,t.number)(e[0],{...e[1],locale:e[1]?.locale??r.locale}),n.addController(this)}hostConnected(){let n=e.r();this._unsubscribe=n.subscribe(e=>{this.value=(...n)=>(0,t.number)(n[0],{...n[1],locale:n[1]?.locale??e}),this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},r=e=>new n(e);exports.useNumber=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/formatters");var n=class{host;_unsubscribe=null;value;constructor(n){this.host=n;let r=e.r();this.value=(...e)=>(0,t.percentage)(e[0],{...e[1],locale:e[1]?.locale??r.locale}),n.addController(this)}hostConnected(){let n=e.r();this._unsubscribe=n.subscribe(e=>{this.value=(...n)=>(0,t.percentage)(n[0],{...n[1],locale:n[1]?.locale??e}),this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},r=e=>new n(e);exports.usePercentage=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/formatters");var n=class{host;_unsubscribe=null;value;constructor(n){this.host=n;let r=e.r();this.value=(...e)=>(0,t.relativeTime)(e[0],e[1],{...e[2],locale:e[2]?.locale??r.locale}),n.addController(this)}hostConnected(){let n=e.r();this._unsubscribe=n.subscribe(e=>{this.value=(...n)=>(0,t.relativeTime)(n[0],n[1],{...n[2],locale:n[2]?.locale??e}),this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},r=e=>new n(e);exports.useRelativeTime=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/formatters");var n=class{host;_unsubscribe=null;value;constructor(n){this.host=n;let r=e.r();this.value=(...e)=>(0,t.units)(e[0],{...e[1],locale:e[1]?.locale??r.locale}),n.addController(this)}hostConnected(){let n=e.r();this._unsubscribe=n.subscribe(e=>{this.value=(...n)=>(0,t.units)(n[0],{...n[1],locale:n[1]?.locale??e}),this.host.requestUpdate()})}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=null}},r=e=>new n(e);exports.useUnit=r;
|
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/useLocaleStorage.cjs"),t=require("../installIntlayer-Btnci_ES.js"),n=require("./plugins.cjs"),r=require("./getDictionary.cjs"),i=require("./getIntlayer.cjs"),a=require("./client/IntlayerBinding.cjs"),o=require("./client/useDictionary.cjs"),s=require("./client/useDictionaryDynamic.cjs"),c=require("./client/useIntlayer.cjs"),l=require("./client/useLocale.cjs"),u=require("./client/useRewriteURL.cjs");require("./client/index.cjs"),exports.IntlayerBinding=a.IntlayerBinding,exports.IntlayerClient=t.t,exports.LocaleController=l.LocaleController,exports.createIntlayerClient=t.n,exports.getDictionary=r.getDictionary,exports.getIntlayer=i.getIntlayer,exports.getIntlayerClient=t.r,exports.getLocaleInStorage=e.getLocaleInStorage,exports.getPlugins=n.getPlugins,exports.htmlPlugin=n.htmlPlugin,exports.insertionPlugin=n.insertionPlugin,exports.installIntlayer=t.i,exports.intlayerNodePlugins=n.intlayerNodePlugins,exports.localeCookie=e.localeCookie,exports.localeInStorage=e.localeInStorage,exports.markdownPlugin=n.markdownPlugin,exports.markdownStringPlugin=n.markdownStringPlugin,exports.setLocaleCookie=e.setLocaleCookie,exports.setLocaleInStorage=e.setLocaleInStorage,exports.useDictionary=o.useDictionary,exports.useDictionaryDynamic=s.useDictionaryDynamic,exports.useEditor=t.a,exports.useIntlayer=c.useIntlayer,exports.useLocale=l.useLocale,exports.useLocaleCookie=e.useLocaleCookie,exports.useLocaleStorage=e.useLocaleStorage,exports.useRewriteURL=u.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("../installIntlayer-
|
|
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("../installIntlayer-Btnci_ES.js"),l=require("./markdown/runtime.cjs"),u=require("./renderIntlayerNode.cjs");let d=require("@intlayer/core/interpreter"),f=require("@intlayer/config/built"),p=require("@intlayer/core/markdown"),m=require("@intlayer/core/utils"),h=require("@intlayer/types/nodeType");h=s(h);let g=require("lit/directives/unsafe-html.js"),_=require("lit/static-html.js");var v=(e=``,t={})=>(0,p.compileWithOptions)(e,l.default,t),y=(e,t,n={})=>{let r=typeof e==`string`?(0,g.unsafeHTML)(e):e,i=Array.isArray(r),a=Object.assign(i?[...r]:{...r},n,{value:t,raw:t,[Symbol.iterator]:void 0,__update:()=>{},isJSX:!0});return Object.setPrototypeOf(a,(0,m.getIntlayerNodePrototype)(t,i?Array.prototype:Object.prototype))},b=e=>e.replace(/&/g,`&`).replace(/"/g,`"`),x=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),S={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:t,keyPath:n,dictionaryKey:r})=>{if(process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled){let e=String(t??``);return y(`<intlayer-content-selector-wrapper key-path="${b(JSON.stringify(n??[]))}" dictionary-key="${b(String(r??``))}">${x(e)}</intlayer-content-selector-wrapper>`,e)}return u.renderIntlayerNode({value:t,children:t})}},C=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?d.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,d.isInterpolableWrapperNode)(e),transform:(e,n,r)=>{if((0,d.isInterpolableWrapperNode)(e))return i=>(0,d.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=(0,d.splitInsertionTemplate)(i,e),o=a.isSimple?a.parts:a.parts.join(``);return r(o,{...n,plugins:t.plugins,children:o})}}},o=n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]});return(0,d.resolveInsertedSelector)(i,o)}},w=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?d.fallbackPlugin:{id:`markdown-string-plugin`,canHandle:e=>typeof e==`string`,transform:(e,t,n)=>{let{plugins:r,...i}=t,{keyPath:a,dictionaryKey:o}=i,s=n((0,p.getMarkdownMetadata)(e)??{},{plugins:[{id:`markdown-metadata-plugin`,canHandle:e=>typeof e==`string`||typeof e==`number`||typeof e==`boolean`||!e,transform:(t,n)=>u.renderIntlayerNode({...n,value:t,children:e})}],dictionaryKey:i.dictionaryKey,keyPath:[]}),c=v(e),l=t=>{let n=v(e,{components:t});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?y(`<intlayer-content-selector-wrapper key-path="${b(JSON.stringify(a??[]))}" dictionary-key="${b(String(o??``))}">${n}</intlayer-content-selector-wrapper>`,e):y(n,e)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?y(`<intlayer-content-selector-wrapper key-path="${b(JSON.stringify(a??[]))}" dictionary-key="${b(String(o??``))}">${c}</intlayer-content-selector-wrapper>`,e,{metadata:s,use:l}):y(c,e,{metadata:s,use:l})}},T=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?d.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:[w,...t.plugins??[]]})}},E=process.env.INTLAYER_NODE_TYPE_HTML===`false`?d.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===h.HTML,transform:(e,t)=>{let n=e[h.HTML],{keyPath:r,dictionaryKey:i}=t,a=(e={})=>{let t=Object.fromEntries(Object.entries(e).filter(([,e])=>e).map(([e,t])=>[e,e=>t(e)])),a=new Proxy(t,{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 e=>_.html`<${(0,_.unsafeStatic)(t)} ...${e}>${e.children}</${(0,_.unsafeStatic)(t)}>`}}),o=(0,d.getHTML)(n,a);return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?y(`<intlayer-content-selector-wrapper key-path="${b(JSON.stringify(r??[]))}" dictionary-key="${b(String(i??``))}">${o}</intlayer-content-selector-wrapper>`,n):y(o,n)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?y(`<intlayer-content-selector-wrapper key-path="${b(JSON.stringify(r??[]))}" dictionary-key="${b(String(i??``))}">${n}</intlayer-content-selector-wrapper>`,n,{use:a}):y(n,n,{use:a})}},D=new Map,O=(e,t=!0)=>{let n=e??(typeof window<`u`&&c.r()?.locale)??(0,d.resolveInterpreterLocale)(),r=`${n}_${t}`;if(D.has(r))return D.get(r);let i=[S,(0,d.translationPlugin)(n,t?f.internationalization.defaultLocale:void 0),d.enumerationPlugin,(0,d.pluralPlugin)(n),d.conditionPlugin,(0,d.nestedPlugin)(n),d.filePlugin,d.genderPlugin,d.selectPlugin,C,T,E].filter(e=>e!==d.fallbackPlugin);return D.set(r,i),i};exports.getPlugins=O,exports.htmlPlugin=E,exports.insertionPlugin=C,exports.intlayerNodePlugins=S,exports.markdownPlugin=T,exports.markdownStringPlugin=w;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getLocaleInStorage as e, localeCookie as t, localeInStorage as n, setLocaleCookie as r, setLocaleInStorage as i, useLocaleCookie as a, useLocaleStorage as o } from "./useLocaleStorage.mjs";
|
|
2
|
+
import { i as s, n as c, r as l, t as u } from "../../installIntlayer-5LiejIKC.mjs";
|
|
3
3
|
import { IntlayerBinding as d } from "./IntlayerBinding.mjs";
|
|
4
4
|
import { useDictionary as f } from "./useDictionary.mjs";
|
|
5
5
|
import { useDictionaryDynamic as p } from "./useDictionaryDynamic.mjs";
|
|
6
6
|
import { useIntlayer as m } from "./useIntlayer.mjs";
|
|
7
7
|
import { LocaleController as h, useLocale as g } from "./useLocale.mjs";
|
|
8
8
|
import { useRewriteURL as _ } from "./useRewriteURL.mjs";
|
|
9
|
-
export { d as IntlayerBinding,
|
|
9
|
+
export { d as IntlayerBinding, u as IntlayerClient, h as LocaleController, c as createIntlayerClient, l as getIntlayerClient, e as getLocaleInStorage, s as installIntlayer, t as localeCookie, n as localeInStorage, r as setLocaleCookie, i as setLocaleInStorage, f as useDictionary, p as useDictionaryDynamic, m as useIntlayer, g as useLocale, a as useLocaleCookie, o as useLocaleStorage, _ as useRewriteURL };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { i as e, n as t, r as n, t as r } from "../../installIntlayer-
|
|
1
|
+
import { i as e, n as t, r as n, t as r } from "../../installIntlayer-5LiejIKC.mjs";
|
|
2
2
|
export { r as IntlayerClient, t as createIntlayerClient, n as getIntlayerClient, e as installIntlayer };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as e } from "../../installIntlayer-
|
|
1
|
+
import { r as e } from "../../installIntlayer-5LiejIKC.mjs";
|
|
2
2
|
import { getDictionary as t } from "../getDictionary.mjs";
|
|
3
3
|
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
4
|
import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as e } from "../../installIntlayer-
|
|
1
|
+
import { r as e } from "../../installIntlayer-5LiejIKC.mjs";
|
|
2
2
|
import { getDictionary as t } from "../getDictionary.mjs";
|
|
3
3
|
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
4
|
import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as e } from "../../installIntlayer-
|
|
1
|
+
import { r as e } from "../../installIntlayer-5LiejIKC.mjs";
|
|
2
2
|
import { getIntlayer as t } from "../getIntlayer.mjs";
|
|
3
3
|
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
4
|
import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { setLocaleInStorage as e } from "./useLocaleStorage.mjs";
|
|
2
|
+
import { r as t } from "../../installIntlayer-5LiejIKC.mjs";
|
|
3
3
|
import { internationalization as n } from "@intlayer/config/built";
|
|
4
4
|
//#region src/client/useLocale.ts
|
|
5
5
|
var r = class {
|
|
@@ -10,22 +10,22 @@ var r = class {
|
|
|
10
10
|
locale;
|
|
11
11
|
defaultLocale;
|
|
12
12
|
availableLocales;
|
|
13
|
-
constructor(
|
|
14
|
-
this.host =
|
|
15
|
-
let i =
|
|
16
|
-
this.locale = i.locale, this.defaultLocale = a, this.availableLocales = o ?? [],
|
|
13
|
+
constructor(e, r = {}) {
|
|
14
|
+
this.host = e, this._isCookieEnabled = r.isCookieEnabled, this._onLocaleChange = r.onLocaleChange;
|
|
15
|
+
let i = t(), { defaultLocale: a, locales: o } = n ?? {};
|
|
16
|
+
this.locale = i.locale, this.defaultLocale = a, this.availableLocales = o ?? [], e.addController(this);
|
|
17
17
|
}
|
|
18
18
|
setLocale = (n) => {
|
|
19
19
|
if (!this.availableLocales.map(String).includes(n)) {
|
|
20
20
|
console.error(`Locale "${n}" is not available.`);
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
let r =
|
|
24
|
-
r.setLocale(n),
|
|
23
|
+
let r = t();
|
|
24
|
+
r.setLocale(n), e(n, this._isCookieEnabled ?? r.isCookieEnabled ?? !0), this._onLocaleChange?.(n);
|
|
25
25
|
};
|
|
26
26
|
hostConnected() {
|
|
27
|
-
let
|
|
28
|
-
this._unsubscribe =
|
|
27
|
+
let e = t();
|
|
28
|
+
this._unsubscribe = e.subscribe((e) => {
|
|
29
29
|
this.locale = e, this.host.requestUpdate();
|
|
30
30
|
});
|
|
31
31
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as e } from "../../installIntlayer-
|
|
1
|
+
import { r as e } from "../../installIntlayer-5LiejIKC.mjs";
|
|
2
2
|
import { routing as t } from "@intlayer/config/built";
|
|
3
3
|
import { getRewritePath as n } from "@intlayer/core/localization";
|
|
4
4
|
//#region src/client/useRewriteURL.ts
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e } from "../../installIntlayer-
|
|
1
|
+
import { a as e } from "../../installIntlayer-5LiejIKC.mjs";
|
|
2
2
|
export { e as useEditor };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getLocaleInStorage as e, localeCookie as t, localeInStorage as n, setLocaleCookie as r, setLocaleInStorage as i, useLocaleCookie as a, useLocaleStorage as o } from "./client/useLocaleStorage.mjs";
|
|
2
|
+
import { a as s, i as c, n as l, r as u, t as d } from "../installIntlayer-5LiejIKC.mjs";
|
|
3
3
|
import { getPlugins as f, htmlPlugin as p, insertionPlugin as m, intlayerNodePlugins as h, markdownPlugin as g, markdownStringPlugin as _ } from "./plugins.mjs";
|
|
4
4
|
import { getDictionary as v } from "./getDictionary.mjs";
|
|
5
5
|
import { getIntlayer as y } from "./getIntlayer.mjs";
|
|
@@ -10,4 +10,4 @@ import { useIntlayer as C } from "./client/useIntlayer.mjs";
|
|
|
10
10
|
import { LocaleController as w, useLocale as T } from "./client/useLocale.mjs";
|
|
11
11
|
import { useRewriteURL as E } from "./client/useRewriteURL.mjs";
|
|
12
12
|
import "./client/index.mjs";
|
|
13
|
-
export { b as IntlayerBinding,
|
|
13
|
+
export { b as IntlayerBinding, d as IntlayerClient, w as LocaleController, l as createIntlayerClient, v as getDictionary, y as getIntlayer, u as getIntlayerClient, e as getLocaleInStorage, f as getPlugins, p as htmlPlugin, m as insertionPlugin, c as installIntlayer, h as intlayerNodePlugins, t as localeCookie, n as localeInStorage, g as markdownPlugin, _ as markdownStringPlugin, r as setLocaleCookie, i as setLocaleInStorage, x as useDictionary, S as useDictionaryDynamic, s as useEditor, C as useIntlayer, T as useLocale, a as useLocaleCookie, o as useLocaleStorage, E as useRewriteURL };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as e } from "../installIntlayer-
|
|
1
|
+
import { r as e } from "../installIntlayer-5LiejIKC.mjs";
|
|
2
2
|
import t from "./markdown/runtime.mjs";
|
|
3
3
|
import { renderIntlayerNode as n } from "./renderIntlayerNode.mjs";
|
|
4
4
|
import { conditionPlugin as r, enumerationPlugin as i, fallbackPlugin as a, filePlugin as o, genderPlugin as s, getHTML as c, isInterpolableWrapperNode as l, nestedPlugin as u, pluralPlugin as d, resolveInsertedSelector as f, resolveInterpreterLocale as p, selectPlugin as m, splitInsertionTemplate as h, transformInterpolableNode as g, translationPlugin as _ } from "@intlayer/core/interpreter";
|
|
@@ -1,9 +1,20 @@
|
|
|
1
|
-
import { getLocaleInStorage as e } from "./esm/client/useLocaleStorage.mjs";
|
|
2
|
-
import { internationalization as
|
|
3
|
-
import { setIntlayerIdentifier as
|
|
4
|
-
import { isEnabled as
|
|
1
|
+
import { getLocaleInStorage as e, setLocaleInStorage as t } from "./esm/client/useLocaleStorage.mjs";
|
|
2
|
+
import { internationalization as n } from "@intlayer/config/built";
|
|
3
|
+
import { setIntlayerIdentifier as r } from "@intlayer/config/client";
|
|
4
|
+
import { isEnabled as i } from "@intlayer/editor/isEnabled";
|
|
5
5
|
//#region src/editor/useEditor.ts
|
|
6
|
-
var
|
|
6
|
+
var a = (e) => {
|
|
7
|
+
let n = d();
|
|
8
|
+
e.currentLocale.set(n.locale);
|
|
9
|
+
let r = n.subscribe((t) => {
|
|
10
|
+
e.currentLocale.set(t);
|
|
11
|
+
}), i = e.onLocaleChangeRequested((e) => {
|
|
12
|
+
n.setLocale(e), t(e, n.isCookieEnabled);
|
|
13
|
+
});
|
|
14
|
+
return () => {
|
|
15
|
+
r(), i();
|
|
16
|
+
};
|
|
17
|
+
}, o = class {
|
|
7
18
|
host;
|
|
8
19
|
_stopped = !1;
|
|
9
20
|
_unsubscribeLocale = null;
|
|
@@ -11,12 +22,8 @@ var i = class {
|
|
|
11
22
|
this.host = e, e.addController(this);
|
|
12
23
|
}
|
|
13
24
|
hostConnected() {
|
|
14
|
-
this._stopped = !1, process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
15
|
-
|
|
16
|
-
let t = e(), n = l();
|
|
17
|
-
t.currentLocale.set(n.locale), this._unsubscribeLocale = n.subscribe((e) => {
|
|
18
|
-
t.currentLocale.set(e);
|
|
19
|
-
});
|
|
25
|
+
this._stopped = !1, process.env.INTLAYER_EDITOR_ENABLED !== "false" && i && import("@intlayer/editor").then(({ initEditorClient: e }) => {
|
|
26
|
+
this._stopped || (this._unsubscribeLocale = a(e()));
|
|
20
27
|
}).catch(() => {});
|
|
21
28
|
}
|
|
22
29
|
hostDisconnected() {
|
|
@@ -25,34 +32,30 @@ var i = class {
|
|
|
25
32
|
}).catch(() => {});
|
|
26
33
|
}
|
|
27
34
|
};
|
|
28
|
-
function
|
|
29
|
-
if (process.env.INTLAYER_EDITOR_ENABLED === "false" || !
|
|
35
|
+
function s(e) {
|
|
36
|
+
if (process.env.INTLAYER_EDITOR_ENABLED === "false" || !i) return e ? void 0 : () => {};
|
|
30
37
|
if (!e) {
|
|
31
38
|
let e = !1, t = null;
|
|
32
39
|
return import("@intlayer/editor").then(({ initEditorClient: n }) => {
|
|
33
|
-
|
|
34
|
-
let r = n(), i = l();
|
|
35
|
-
r.currentLocale.set(i.locale), t = i.subscribe((e) => {
|
|
36
|
-
r.currentLocale.set(e);
|
|
37
|
-
});
|
|
40
|
+
e || (t = a(n()));
|
|
38
41
|
}).catch(() => {}), () => {
|
|
39
42
|
e = !0, t?.(), import("@intlayer/editor").then(({ stopEditorClient: e }) => {
|
|
40
43
|
e();
|
|
41
44
|
}).catch(() => {});
|
|
42
45
|
};
|
|
43
46
|
}
|
|
44
|
-
new
|
|
47
|
+
new o(e);
|
|
45
48
|
}
|
|
46
49
|
//#endregion
|
|
47
50
|
//#region src/client/installIntlayer.ts
|
|
48
|
-
var
|
|
51
|
+
var c = class {
|
|
49
52
|
_locale;
|
|
50
53
|
_variant;
|
|
51
54
|
_listeners = /* @__PURE__ */ new Set();
|
|
52
55
|
isCookieEnabled;
|
|
53
|
-
constructor(
|
|
54
|
-
let { defaultLocale: o } =
|
|
55
|
-
|
|
56
|
+
constructor(t, i = !0, a) {
|
|
57
|
+
let { defaultLocale: o } = n ?? {};
|
|
58
|
+
r(), this._locale = t ?? e() ?? o, this._variant = a, this.isCookieEnabled = i;
|
|
56
59
|
}
|
|
57
60
|
get locale() {
|
|
58
61
|
return this._locale;
|
|
@@ -73,9 +76,9 @@ var o = class {
|
|
|
73
76
|
this._listeners.delete(e);
|
|
74
77
|
};
|
|
75
78
|
}
|
|
76
|
-
},
|
|
77
|
-
let r =
|
|
78
|
-
return
|
|
79
|
+
}, l = null, u = (e, t = !0, n) => l || (l = new c(e, t, n), l), d = () => (l ||= new c(), l), f = ({ locale: e, isCookieEnabled: t, variant: n } = {}) => {
|
|
80
|
+
let r = u(e, t, n);
|
|
81
|
+
return s(), r;
|
|
79
82
|
};
|
|
80
83
|
//#endregion
|
|
81
|
-
export { a,
|
|
84
|
+
export { s as a, f as i, u as n, d as r, c as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./cjs/client/useLocaleStorage.cjs");let t=require("@intlayer/config/built"),n=require("@intlayer/config/client"),r=require("@intlayer/editor/isEnabled");var i=t=>{let n=u();t.currentLocale.set(n.locale);let r=n.subscribe(e=>{t.currentLocale.set(e)}),i=t.onLocaleChangeRequested(t=>{n.setLocale(t),e.setLocaleInStorage(t,n.isCookieEnabled)});return()=>{r(),i()}},a=class{host;_stopped=!1;_unsubscribeLocale=null;constructor(e){this.host=e,e.addController(this)}hostConnected(){this._stopped=!1,process.env.INTLAYER_EDITOR_ENABLED!==`false`&&r.isEnabled&&import(`@intlayer/editor`).then(({initEditorClient:e})=>{this._stopped||(this._unsubscribeLocale=i(e()))}).catch(()=>{})}hostDisconnected(){this._stopped=!0,this._unsubscribeLocale?.(),this._unsubscribeLocale=null,import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()}).catch(()=>{})}};function o(e){if(process.env.INTLAYER_EDITOR_ENABLED===`false`||!r.isEnabled)return e?void 0:()=>{};if(!e){let e=!1,t=null;return import(`@intlayer/editor`).then(({initEditorClient:n})=>{e||(t=i(n()))}).catch(()=>{}),()=>{e=!0,t?.(),import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()}).catch(()=>{})}}new a(e)}var s=class{_locale;_variant;_listeners=new Set;isCookieEnabled;constructor(r,i=!0,a){let{defaultLocale:o}=t.internationalization??{};(0,n.setIntlayerIdentifier)(),this._locale=r??e.getLocaleInStorage()??o,this._variant=a,this.isCookieEnabled=i}get locale(){return this._locale}get variant(){return this._variant}setLocale(e){this._locale=e;for(let t of this._listeners)t(e)}setVariant(e){this._variant=e;for(let e of this._listeners)e(this._locale)}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}},c=null,l=(e,t=!0,n)=>c||(c=new s(e,t,n),c),u=()=>(c||=new s,c),d=({locale:e,isCookieEnabled:t,variant:n}={})=>{let r=l(e,t,n);return o(),r};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return s}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/useEditor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAsB,sBAAsB,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"useEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/useEditor.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAsB,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAwEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,SAAS,IAAI,MAAM,IAAI,CAAC;AACxC,wBAAgB,SAAS,CAAC,IAAI,EAAE,sBAAsB,GAAG,IAAI,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-intlayer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Lit applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -104,14 +104,14 @@
|
|
|
104
104
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@intlayer/api": "9.
|
|
108
|
-
"@intlayer/config": "9.
|
|
109
|
-
"@intlayer/core": "9.
|
|
110
|
-
"@intlayer/editor": "9.
|
|
111
|
-
"@intlayer/types": "9.
|
|
107
|
+
"@intlayer/api": "9.7.0",
|
|
108
|
+
"@intlayer/config": "9.7.0",
|
|
109
|
+
"@intlayer/core": "9.7.0",
|
|
110
|
+
"@intlayer/editor": "9.7.0",
|
|
111
|
+
"@intlayer/types": "9.7.0"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
|
-
"@types/node": "^
|
|
114
|
+
"@types/node": "^26",
|
|
115
115
|
"@typescript/typescript6": "^6.0.2",
|
|
116
116
|
"@utils/ts-config": "1.0.4",
|
|
117
117
|
"@utils/ts-config-types": "1.0.4",
|
|
@@ -120,12 +120,12 @@
|
|
|
120
120
|
"rimraf": "6.1.3",
|
|
121
121
|
"tsdown": "0.23.0",
|
|
122
122
|
"typescript": "7.0.2",
|
|
123
|
-
"vite": "8.3.
|
|
124
|
-
"vite-plugin-dts": "5.1.
|
|
123
|
+
"vite": "8.3.3",
|
|
124
|
+
"vite-plugin-dts": "5.1.2",
|
|
125
125
|
"vitest": "5.0.3"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
|
-
"intlayer": "9.
|
|
128
|
+
"intlayer": "9.7.0",
|
|
129
129
|
"lit": ">=3.0.0"
|
|
130
130
|
},
|
|
131
131
|
"peerDependenciesMeta": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./cjs/client/useLocaleStorage.cjs");let t=require("@intlayer/config/built"),n=require("@intlayer/config/client"),r=require("@intlayer/editor/isEnabled");var i=class{host;_stopped=!1;_unsubscribeLocale=null;constructor(e){this.host=e,e.addController(this)}hostConnected(){this._stopped=!1,process.env.INTLAYER_EDITOR_ENABLED!==`false`&&r.isEnabled&&import(`@intlayer/editor`).then(({initEditorClient:e})=>{if(this._stopped)return;let t=e(),n=l();t.currentLocale.set(n.locale),this._unsubscribeLocale=n.subscribe(e=>{t.currentLocale.set(e)})}).catch(()=>{})}hostDisconnected(){this._stopped=!0,this._unsubscribeLocale?.(),this._unsubscribeLocale=null,import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()}).catch(()=>{})}};function a(e){if(process.env.INTLAYER_EDITOR_ENABLED===`false`||!r.isEnabled)return e?void 0:()=>{};if(!e){let e=!1,t=null;return import(`@intlayer/editor`).then(({initEditorClient:n})=>{if(e)return;let r=n(),i=l();r.currentLocale.set(i.locale),t=i.subscribe(e=>{r.currentLocale.set(e)})}).catch(()=>{}),()=>{e=!0,t?.(),import(`@intlayer/editor`).then(({stopEditorClient:e})=>{e()}).catch(()=>{})}}new i(e)}var o=class{_locale;_variant;_listeners=new Set;isCookieEnabled;constructor(r,i=!0,a){let{defaultLocale:o}=t.internationalization??{};(0,n.setIntlayerIdentifier)(),this._locale=r??e.getLocaleInStorage()??o,this._variant=a,this.isCookieEnabled=i}get locale(){return this._locale}get variant(){return this._variant}setLocale(e){this._locale=e;for(let t of this._listeners)t(e)}setVariant(e){this._variant=e;for(let e of this._listeners)e(this._locale)}subscribe(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}},s=null,c=(e,t=!0,n)=>s||(s=new o(e,t,n),s),l=()=>(s||=new o,s),u=({locale:e,isCookieEnabled:t,variant:n}={})=>{let r=c(e,t,n);return a(),r};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return o}});
|