lit-intlayer 9.5.5 → 9.5.7
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/README.md +0 -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/format/index.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +1 -1
- package/dist/esm/client/useDictionary.mjs +4 -4
- package/dist/esm/client/useDictionaryDynamic.mjs +10 -10
- package/dist/esm/client/useIntlayer.mjs +8 -8
- package/dist/esm/format/index.mjs +6 -6
- package/dist/esm/index.mjs +7 -7
- package/dist/esm/plugins.mjs +40 -40
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -201,7 +201,6 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
201
201
|
<li><a href="https://intlayer.org/doc/environment/astro/vue" rel=''>Vue</a></li>
|
|
202
202
|
<li><a href="https://intlayer.org/doc/environment/astro/svelte" rel=''>Svelte</a></li>
|
|
203
203
|
<li><a href="https://intlayer.org/doc/environment/astro/solid" rel=''>Solid</a></li>
|
|
204
|
-
<li><a href="https://intlayer.org/doc/environment/astro/vanilla" rel=''>Vanilla JS</a></li>
|
|
205
204
|
<li><a href="https://intlayer.org/doc/environment/astro/lit" rel=''>Lit</a></li>
|
|
206
205
|
</ul>
|
|
207
206
|
</li>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("../getDictionary.cjs"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/config/built"),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??r.internationalization.defaultLocale);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-DOvWQYtw.js"),t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("../getDictionary.cjs"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/config/built"),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??r.internationalization.defaultLocale,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-DOvWQYtw.js"),t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-DOvWQYtw.js"),t=require("../getIntlayer.cjs"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/config/built"),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??r.internationalization.defaultLocale;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("./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;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../installIntlayer-DOvWQYtw.js"),t=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../installIntlayer-DOvWQYtw.js"),t=require("./plugins.cjs"),n=require("./getDictionary.cjs"),r=require("./getIntlayer.cjs"),i=require("./client/IntlayerBinding.cjs"),a=require("./client/useDictionary.cjs"),o=require("./client/useDictionaryDynamic.cjs"),s=require("./client/useIntlayer.cjs"),c=require("./client/useLocaleStorage.cjs"),l=require("./client/useLocale.cjs"),u=require("./client/useRewriteURL.cjs");require("./client/index.cjs"),exports.IntlayerBinding=i.IntlayerBinding,exports.IntlayerClient=e.t,exports.LocaleController=l.LocaleController,exports.createIntlayerClient=e.n,exports.getDictionary=n.getDictionary,exports.getIntlayer=r.getIntlayer,exports.getIntlayerClient=e.r,exports.getPlugins=t.getPlugins,exports.htmlPlugin=t.htmlPlugin,exports.insertionPlugin=t.insertionPlugin,exports.installIntlayer=e.i,exports.intlayerNodePlugins=t.intlayerNodePlugins,exports.localeCookie=c.localeCookie,exports.localeInStorage=c.localeInStorage,exports.markdownPlugin=t.markdownPlugin,exports.markdownStringPlugin=t.markdownStringPlugin,exports.setLocaleCookie=c.setLocaleCookie,exports.setLocaleInStorage=c.setLocaleInStorage,exports.useDictionary=a.useDictionary,exports.useDictionaryDynamic=o.useDictionaryDynamic,exports.useEditor=e.a,exports.useIntlayer=s.useIntlayer,exports.useLocale=l.useLocale,exports.useLocaleCookie=c.useLocaleCookie,exports.useLocaleStorage=c.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-DOvWQYtw.js"),l=require("./markdown/runtime.cjs"),u=require("./renderIntlayerNode.cjs");let d=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("../installIntlayer-DOvWQYtw.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/types/nodeType");m=s(m);let h=require("lit/directives/unsafe-html.js"),g=require("lit/static-html.js");var _=(e=``,t={})=>(0,p.compileWithOptions)(e,l.default,t),v=(e,t,n={})=>{let r=typeof e==`string`?(0,h.unsafeHTML)(e):e;return new Proxy(r,{get(e,r,i){if(r===`value`||r===`raw`)return t;if(r===`toString`||r===Symbol.toPrimitive)return()=>t;if(r!==Symbol.iterator)return r===`__update`?()=>{}:r===`isJSX`?!0:r in n?n[r]:Reflect.get(e,r,i)}})},y=e=>e.replace(/&/g,`&`).replace(/"/g,`"`),b=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`),x={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:t,keyPath:n,dictionaryKey:r,...i})=>{if(process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled){let e=String(t??``);return v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(n??[]))}" dictionary-key="${y(String(r??``))}">${b(e)}</intlayer-content-selector-wrapper>`,e)}return u.renderIntlayerNode({...i,value:t,children:t})}},S=process.env.INTLAYER_NODE_TYPE_INSERTION===`false`?d.fallbackPlugin:{id:`insertion-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.INSERTION,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.INSERTION}],i=e[m.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 typeof i==`object`&&i&&`nodeType`in i&&[m.ENUMERATION,m.CONDITION].includes(i.nodeType)?e=>t=>{let n=o(t);return typeof n==`function`?n(e):n}:o}},C=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=_(e),l=t=>{let n=_(e,{components:t});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(a??[]))}" dictionary-key="${y(String(o??``))}">${n}</intlayer-content-selector-wrapper>`,e):v(n,e)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(a??[]))}" dictionary-key="${y(String(o??``))}">${c}</intlayer-content-selector-wrapper>`,e,{metadata:s,use:l}):v(c,e,{metadata:s,use:l})}},w=process.env.INTLAYER_NODE_TYPE_MARKDOWN===`false`?d.fallbackPlugin:{id:`markdown-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.MARKDOWN,transform:(e,t,n)=>{let r=[...t.keyPath,{type:m.MARKDOWN}],i=e[m.MARKDOWN];return n(i,{...t,children:i,keyPath:r,plugins:[C,...t.plugins??[]]})}},T=process.env.INTLAYER_NODE_TYPE_HTML===`false`?d.fallbackPlugin:{id:`html-plugin`,canHandle:e=>typeof e==`object`&&e?.nodeType===m.HTML,transform:(e,t)=>{let n=e[m.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=>g.html`<${(0,g.unsafeStatic)(t)} ...${e}>${e.children}</${(0,g.unsafeStatic)(t)}>`}}),o=(0,d.getHTML)(n,a);return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(r??[]))}" dictionary-key="${y(String(i??``))}">${o}</intlayer-content-selector-wrapper>`,n):v(o,n)};return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?v(`<intlayer-content-selector-wrapper key-path="${y(JSON.stringify(r??[]))}" dictionary-key="${y(String(i??``))}">${n}</intlayer-content-selector-wrapper>`,n,{use:a}):v(n,n,{use:a})}},E=new Map,D=(e,t=!0)=>{let n=e??(typeof window<`u`&&c.r()?.locale)??f.internationalization.defaultLocale,r=`${n}_${t}`;if(E.has(r))return E.get(r);let i=[(0,d.translationPlugin)(e??f.internationalization.defaultLocale,t?f.internationalization.defaultLocale:void 0),d.enumerationPlugin,(0,d.pluralPlugin)(n),d.conditionPlugin,(0,d.nestedPlugin)(n),d.filePlugin,d.genderPlugin,d.selectPlugin,x,S,w,T];return E.set(r,i),i};exports.getPlugins=D,exports.htmlPlugin=T,exports.insertionPlugin=S,exports.intlayerNodePlugins=x,exports.markdownPlugin=w,exports.markdownStringPlugin=C;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { r as e } from "../../installIntlayer-DT6bzUDN.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getDictionary as t } from "../getDictionary.mjs";
|
|
3
|
+
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
4
|
import { internationalization as r } from "@intlayer/config/built";
|
|
5
5
|
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
//#region src/client/useDictionary.ts
|
|
7
7
|
var a = (a, o) => {
|
|
8
|
-
let s = e(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (e) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ?
|
|
8
|
+
let s = e(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (e) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? t(a, e) : t(a, i({
|
|
9
9
|
localeOrSelector: o,
|
|
10
10
|
contextLocale: e,
|
|
11
11
|
contextVariant: s.variant,
|
|
@@ -20,7 +20,7 @@ var a = (a, o) => {
|
|
|
20
20
|
if (t === "toString") return () => String(u?.toString?.() ?? "");
|
|
21
21
|
if (t !== "then" && u != null) return u[t];
|
|
22
22
|
} });
|
|
23
|
-
return d = (e) => (new
|
|
23
|
+
return d = (e) => (new n(e), f), f;
|
|
24
24
|
};
|
|
25
25
|
//#endregion
|
|
26
26
|
export { a as useDictionary };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as e } from "../../installIntlayer-DT6bzUDN.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getDictionary as t } from "../getDictionary.mjs";
|
|
3
|
+
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
4
|
import { internationalization as r } from "@intlayer/config/built";
|
|
5
5
|
import { getPreloadedDictionary as i, isQualifiedDynamicLoaderMap as a, parseDictionarySelector as o, resolveDictionaryArgument as s, resolveQualifiedDynamicContentAsync as c } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
//#region src/client/useDictionaryDynamic.ts
|
|
@@ -34,20 +34,20 @@ var l = /* @__PURE__ */ new Map(), u = async (e, t) => {
|
|
|
34
34
|
key: String(p),
|
|
35
35
|
locale: e,
|
|
36
36
|
selector: v,
|
|
37
|
-
transform: (
|
|
37
|
+
transform: (n) => t(n, e)
|
|
38
38
|
}).then((e) => {
|
|
39
39
|
b = e, S();
|
|
40
40
|
});
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
let
|
|
43
|
+
let n = `${String(p)}.${e}`, r = i(f, e);
|
|
44
44
|
if (r) {
|
|
45
|
-
l.set(
|
|
45
|
+
l.set(n, r), b = t(r, e), S();
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
let a = f[e];
|
|
49
|
-
u(
|
|
50
|
-
|
|
49
|
+
u(n, a).then((n) => {
|
|
50
|
+
n && (b = t(n, e), S());
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
C(y()), h.subscribe((e) => {
|
|
@@ -60,11 +60,11 @@ var l = /* @__PURE__ */ new Map(), u = async (e, t) => {
|
|
|
60
60
|
if (t !== "then") return b == null ? d : b[t];
|
|
61
61
|
} });
|
|
62
62
|
return w = (e) => {
|
|
63
|
-
let
|
|
64
|
-
return x.add(
|
|
63
|
+
let t = () => e.requestUpdate();
|
|
64
|
+
return x.add(t), new n(e, () => {
|
|
65
65
|
b != null && e.requestUpdate();
|
|
66
66
|
}, () => {
|
|
67
|
-
x.delete(
|
|
67
|
+
x.delete(t);
|
|
68
68
|
}), T;
|
|
69
69
|
}, T;
|
|
70
70
|
};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { r as e } from "../../installIntlayer-DT6bzUDN.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getIntlayer as t } from "../getIntlayer.mjs";
|
|
3
|
+
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
4
|
import { internationalization as r } from "@intlayer/config/built";
|
|
5
5
|
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
//#region src/client/useIntlayer.ts
|
|
7
7
|
var a = (a, o) => {
|
|
8
|
-
let s = e(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (e) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ?
|
|
8
|
+
let s = e(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (e) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? t(a, e) : t(a, i({
|
|
9
9
|
localeOrSelector: o,
|
|
10
10
|
contextLocale: e,
|
|
11
11
|
contextVariant: s.variant,
|
|
12
12
|
dictionaryKey: a
|
|
13
|
-
})), u, d, f = !1, p = new Proxy({}, { get(e,
|
|
14
|
-
if (
|
|
15
|
-
if (
|
|
16
|
-
if (
|
|
13
|
+
})), u, d, f = !1, p = new Proxy({}, { get(e, t) {
|
|
14
|
+
if (t === "observe") return (e) => (new n(e), p);
|
|
15
|
+
if (t === Symbol.toPrimitive || t === "toString") return () => "";
|
|
16
|
+
if (t === "then" || typeof t == "symbol" || typeof t == "string" && t.startsWith("_$")) return;
|
|
17
17
|
let i = c ?? s.locale ?? r.defaultLocale;
|
|
18
|
-
if ((!f || u !== i) && (d = l(i), u = i, f = !0), d != null) return d[
|
|
18
|
+
if ((!f || u !== i) && (d = l(i), u = i, f = !0), d != null) return d[t];
|
|
19
19
|
} });
|
|
20
20
|
return p;
|
|
21
21
|
};
|
|
@@ -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 };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { a as e, i as t, n, r, t as i } from "../installIntlayer-DT6bzUDN.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
2
|
+
import { getPlugins as a, htmlPlugin as o, insertionPlugin as s, intlayerNodePlugins as c, markdownPlugin as l, markdownStringPlugin as u } from "./plugins.mjs";
|
|
3
|
+
import { getDictionary as d } from "./getDictionary.mjs";
|
|
4
|
+
import { getIntlayer as f } from "./getIntlayer.mjs";
|
|
5
|
+
import { IntlayerBinding as p } from "./client/IntlayerBinding.mjs";
|
|
6
|
+
import { useDictionary as m } from "./client/useDictionary.mjs";
|
|
7
|
+
import { useDictionaryDynamic as h } from "./client/useDictionaryDynamic.mjs";
|
|
8
8
|
import { useIntlayer as g } from "./client/useIntlayer.mjs";
|
|
9
9
|
import { localeCookie as _, localeInStorage as v, setLocaleCookie as y, setLocaleInStorage as b, useLocaleCookie as x, useLocaleStorage as S } from "./client/useLocaleStorage.mjs";
|
|
10
10
|
import { LocaleController as C, useLocale as w } from "./client/useLocale.mjs";
|
|
11
11
|
import { useRewriteURL as T } from "./client/useRewriteURL.mjs";
|
|
12
12
|
import "./client/index.mjs";
|
|
13
|
-
export {
|
|
13
|
+
export { p as IntlayerBinding, i as IntlayerClient, C as LocaleController, n as createIntlayerClient, d as getDictionary, f as getIntlayer, r as getIntlayerClient, a as getPlugins, o as htmlPlugin, s as insertionPlugin, t as installIntlayer, c as intlayerNodePlugins, _ as localeCookie, v as localeInStorage, l as markdownPlugin, u as markdownStringPlugin, y as setLocaleCookie, b as setLocaleInStorage, m as useDictionary, h as useDictionaryDynamic, e as useEditor, g as useIntlayer, w as useLocale, x as useLocaleCookie, S as useLocaleStorage, T as useRewriteURL };
|
package/dist/esm/plugins.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { r as e } from "../installIntlayer-DT6bzUDN.mjs";
|
|
2
2
|
import t from "./markdown/runtime.mjs";
|
|
3
3
|
import { renderIntlayerNode as n } from "./renderIntlayerNode.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
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, selectPlugin as f, splitInsertionTemplate as p, transformInterpolableNode as m, translationPlugin as h } from "@intlayer/core/interpreter";
|
|
5
|
+
import { editor as g, internationalization as _ } from "@intlayer/config/built";
|
|
6
6
|
import { compileWithOptions as v, getMarkdownMetadata as y } from "@intlayer/core/markdown";
|
|
7
7
|
import * as b from "@intlayer/types/nodeType";
|
|
8
8
|
import { unsafeHTML as x } from "lit/directives/unsafe-html.js";
|
|
@@ -18,33 +18,33 @@ var w = (e = "", n = {}) => v(e, t, n), T = (e, t, n = {}) => {
|
|
|
18
18
|
}, E = (e) => e.replace(/&/g, "&").replace(/"/g, """), D = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), O = {
|
|
19
19
|
id: "intlayer-node-plugin",
|
|
20
20
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
21
|
-
transform: (e, { children: t, keyPath:
|
|
22
|
-
if (process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
21
|
+
transform: (e, { children: t, keyPath: r, dictionaryKey: i, ...a }) => {
|
|
22
|
+
if (process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled) {
|
|
23
23
|
let e = String(t ?? "");
|
|
24
|
-
return T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(
|
|
24
|
+
return T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(r ?? []))}" dictionary-key="${E(String(i ?? ""))}">${D(e)}</intlayer-content-selector-wrapper>`, e);
|
|
25
25
|
}
|
|
26
26
|
return n({
|
|
27
|
-
...
|
|
27
|
+
...a,
|
|
28
28
|
value: t,
|
|
29
29
|
children: t
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ?
|
|
32
|
+
}, k = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? a : {
|
|
33
33
|
id: "insertion-plugin",
|
|
34
34
|
canHandle: (e) => typeof e == "object" && e?.nodeType === b.INSERTION,
|
|
35
35
|
transform: (e, t, n) => {
|
|
36
36
|
let r = [...t.keyPath, { type: b.INSERTION }], i = e[b.INSERTION], a = {
|
|
37
37
|
id: "insertion-string-plugin",
|
|
38
|
-
canHandle: (e) => typeof e == "string" ||
|
|
38
|
+
canHandle: (e) => typeof e == "string" || l(e),
|
|
39
39
|
transform: (e, n, r) => {
|
|
40
|
-
if (
|
|
40
|
+
if (l(e)) return (i) => m(e, i, n, t.plugins, r);
|
|
41
41
|
let i = r(e, {
|
|
42
42
|
...n,
|
|
43
43
|
children: e,
|
|
44
44
|
plugins: (t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")
|
|
45
45
|
});
|
|
46
46
|
return (e) => {
|
|
47
|
-
let a =
|
|
47
|
+
let a = p(i, e), o = a.isSimple ? a.parts : a.parts.join("");
|
|
48
48
|
return r(o, {
|
|
49
49
|
...n,
|
|
50
50
|
plugins: t.plugins,
|
|
@@ -63,11 +63,11 @@ var w = (e = "", n = {}) => v(e, t, n), T = (e, t, n = {}) => {
|
|
|
63
63
|
return typeof n == "function" ? n(e) : n;
|
|
64
64
|
} : o;
|
|
65
65
|
}
|
|
66
|
-
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
66
|
+
}, A = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? a : {
|
|
67
67
|
id: "markdown-string-plugin",
|
|
68
68
|
canHandle: (e) => typeof e == "string",
|
|
69
|
-
transform: (e, t,
|
|
70
|
-
let { plugins:
|
|
69
|
+
transform: (e, t, r) => {
|
|
70
|
+
let { plugins: i, ...a } = t, { keyPath: o, dictionaryKey: s } = a, c = r(y(e) ?? {}, {
|
|
71
71
|
plugins: [{
|
|
72
72
|
id: "markdown-metadata-plugin",
|
|
73
73
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
@@ -77,21 +77,21 @@ var w = (e = "", n = {}) => v(e, t, n), T = (e, t, n = {}) => {
|
|
|
77
77
|
children: e
|
|
78
78
|
})
|
|
79
79
|
}],
|
|
80
|
-
dictionaryKey:
|
|
80
|
+
dictionaryKey: a.dictionaryKey,
|
|
81
81
|
keyPath: []
|
|
82
|
-
}),
|
|
82
|
+
}), l = w(e), u = (t) => {
|
|
83
83
|
let n = w(e, { components: t });
|
|
84
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
84
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(o ?? []))}" dictionary-key="${E(String(s ?? ""))}">${n}</intlayer-content-selector-wrapper>`, e) : T(n, e);
|
|
85
85
|
};
|
|
86
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
87
|
-
metadata:
|
|
88
|
-
use:
|
|
89
|
-
}) : T(
|
|
90
|
-
metadata:
|
|
91
|
-
use:
|
|
86
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(o ?? []))}" dictionary-key="${E(String(s ?? ""))}">${l}</intlayer-content-selector-wrapper>`, e, {
|
|
87
|
+
metadata: c,
|
|
88
|
+
use: u
|
|
89
|
+
}) : T(l, e, {
|
|
90
|
+
metadata: c,
|
|
91
|
+
use: u
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
94
|
+
}, j = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? a : {
|
|
95
95
|
id: "markdown-plugin",
|
|
96
96
|
canHandle: (e) => typeof e == "object" && e?.nodeType === b.MARKDOWN,
|
|
97
97
|
transform: (e, t, n) => {
|
|
@@ -103,37 +103,37 @@ var w = (e = "", n = {}) => v(e, t, n), T = (e, t, n = {}) => {
|
|
|
103
103
|
plugins: [A, ...t.plugins ?? []]
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
}, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ?
|
|
106
|
+
}, M = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? a : {
|
|
107
107
|
id: "html-plugin",
|
|
108
108
|
canHandle: (e) => typeof e == "object" && e?.nodeType === b.HTML,
|
|
109
109
|
transform: (e, t) => {
|
|
110
|
-
let n = e[b.HTML], { keyPath:
|
|
111
|
-
let t = Object.fromEntries(Object.entries(e).filter(([, e]) => e).map(([e, t]) => [e, (e) => t(e)])),
|
|
110
|
+
let n = e[b.HTML], { keyPath: r, dictionaryKey: i } = t, a = (e = {}) => {
|
|
111
|
+
let t = Object.fromEntries(Object.entries(e).filter(([, e]) => e).map(([e, t]) => [e, (e) => t(e)])), a = new Proxy(t, { get(e, t) {
|
|
112
112
|
if (typeof t == "string" && t in e) return e[t];
|
|
113
113
|
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return (e) => S`<${C(t)} ...${e}>${e.children}</${C(t)}>`;
|
|
114
|
-
} }),
|
|
115
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
114
|
+
} }), o = c(n, a);
|
|
115
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(r ?? []))}" dictionary-key="${E(String(i ?? ""))}">${o}</intlayer-content-selector-wrapper>`, n) : T(o, n);
|
|
116
116
|
};
|
|
117
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
117
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && g.enabled ? T(`<intlayer-content-selector-wrapper key-path="${E(JSON.stringify(r ?? []))}" dictionary-key="${E(String(i ?? ""))}">${n}</intlayer-content-selector-wrapper>`, n, { use: a }) : T(n, n, { use: a });
|
|
118
118
|
}
|
|
119
119
|
}, N = /* @__PURE__ */ new Map(), P = (t, n = !0) => {
|
|
120
|
-
let
|
|
121
|
-
if (N.has(
|
|
122
|
-
let
|
|
123
|
-
|
|
120
|
+
let a = t ?? (typeof window < "u" && e()?.locale) ?? _.defaultLocale, c = `${a}_${n}`;
|
|
121
|
+
if (N.has(c)) return N.get(c);
|
|
122
|
+
let l = [
|
|
123
|
+
h(t ?? _.defaultLocale, n ? _.defaultLocale : void 0),
|
|
124
|
+
i,
|
|
125
|
+
d(a),
|
|
126
|
+
r,
|
|
127
|
+
u(a),
|
|
124
128
|
o,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
f(r),
|
|
128
|
-
c,
|
|
129
|
-
l,
|
|
130
|
-
m,
|
|
129
|
+
s,
|
|
130
|
+
f,
|
|
131
131
|
O,
|
|
132
132
|
k,
|
|
133
133
|
j,
|
|
134
134
|
M
|
|
135
135
|
];
|
|
136
|
-
return N.set(
|
|
136
|
+
return N.set(c, l), l;
|
|
137
137
|
};
|
|
138
138
|
//#endregion
|
|
139
139
|
export { P as getPlugins, M as htmlPlugin, k as insertionPlugin, O as intlayerNodePlugins, j as markdownPlugin, A as markdownStringPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-intlayer",
|
|
3
|
-
"version": "9.5.
|
|
3
|
+
"version": "9.5.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Lit applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -104,11 +104,11 @@
|
|
|
104
104
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@intlayer/api": "9.5.
|
|
108
|
-
"@intlayer/config": "9.5.
|
|
109
|
-
"@intlayer/core": "9.5.
|
|
110
|
-
"@intlayer/editor": "9.5.
|
|
111
|
-
"@intlayer/types": "9.5.
|
|
107
|
+
"@intlayer/api": "9.5.6",
|
|
108
|
+
"@intlayer/config": "9.5.6",
|
|
109
|
+
"@intlayer/core": "9.5.6",
|
|
110
|
+
"@intlayer/editor": "9.5.7",
|
|
111
|
+
"@intlayer/types": "9.5.6"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@types/node": "^22",
|
|
@@ -121,11 +121,11 @@
|
|
|
121
121
|
"tsdown": "0.23.0",
|
|
122
122
|
"typescript": "7.0.2",
|
|
123
123
|
"vite": "8.3.0",
|
|
124
|
-
"vite-plugin-dts": "5.1.
|
|
124
|
+
"vite-plugin-dts": "5.1.1",
|
|
125
125
|
"vitest": "5.0.1"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
|
-
"intlayer": "9.5.
|
|
128
|
+
"intlayer": "9.5.6",
|
|
129
129
|
"lit": ">=3.0.0"
|
|
130
130
|
},
|
|
131
131
|
"peerDependenciesMeta": {
|