lit-intlayer 9.8.1 → 9.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/plugins.cjs +2 -2
- package/dist/esm/client/useDictionary.mjs +4 -4
- package/dist/esm/client/useDictionaryDynamic.mjs +9 -9
- package/dist/esm/client/useIntlayer.mjs +5 -5
- package/dist/esm/index.mjs +4 -4
- package/dist/esm/plugins.mjs +46 -46
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("../../installIntlayer-Btnci_ES.js"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/core/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("../../installIntlayer-Btnci_ES.js"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/core/interpreter"),i=require("@intlayer/core/dictionaryManipulator");var a=(a,o)=>{let s=t.r(),c=process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&typeof o==`object`&&o?o.locale:o,l=t=>process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?e.getDictionary(a,t):e.getDictionary(a,(0,i.resolveDictionaryArgument)({localeOrSelector:o,contextLocale:t,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("../getDictionary.cjs"),t=require("../../installIntlayer-Btnci_ES.js"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/core/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("../../installIntlayer-Btnci_ES.js"),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=t.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=t=>{if(f){(0,i.resolveQualifiedDynamicContentAsync)({loaderMap:c,key:String(l),locale:t,selector:m,transform:n=>e.getDictionary(n,t)}).then(e=>{g=e,v()});return}let n=`${String(l)}.${t}`,r=(0,i.getPreloadedDictionary)(c,t);if(r){a.set(n,r),g=e.getDictionary(r,t),v();return}let s=c[t];o(n,s).then(n=>{n&&(g=e.getDictionary(n,t),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("../getIntlayer.cjs"),t=require("../../installIntlayer-Btnci_ES.js"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/core/
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getIntlayer.cjs"),t=require("../../installIntlayer-Btnci_ES.js"),n=require("./IntlayerBinding.cjs");let r=require("@intlayer/core/interpreter"),i=require("@intlayer/core/dictionaryManipulator");var a=(a,o)=>{let s=t.r(),c=process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`&&typeof o==`object`&&o?o.locale:o,l=t=>process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?e.getIntlayer(a,t):e.getIntlayer(a,(0,i.resolveDictionaryArgument)({localeOrSelector:o,contextLocale:t,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;
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./client/useLocaleStorage.cjs"),t=require("../installIntlayer-Btnci_ES.js"),n=require("./
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./client/useLocaleStorage.cjs"),t=require("../installIntlayer-Btnci_ES.js"),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("./plugins.cjs"),c=require("./client/useIntlayer.cjs"),l=require("./client/useLocale.cjs"),u=require("./client/useRewriteURL.cjs");require("./client/index.cjs"),exports.IntlayerBinding=i.IntlayerBinding,exports.IntlayerClient=t.t,exports.LocaleController=l.LocaleController,exports.createIntlayerClient=t.n,exports.getDictionary=n.getDictionary,exports.getIntlayer=r.getIntlayer,exports.getIntlayerClient=t.r,exports.getLocaleInStorage=e.getLocaleInStorage,exports.getPlugins=s.getPlugins,exports.htmlPlugin=s.htmlPlugin,exports.insertionPlugin=s.insertionPlugin,exports.installIntlayer=t.i,exports.intlayerNodePlugins=s.intlayerNodePlugins,exports.localeCookie=e.localeCookie,exports.localeInStorage=e.localeInStorage,exports.markdownPlugin=s.markdownPlugin,exports.markdownStringPlugin=s.markdownStringPlugin,exports.setLocaleCookie=e.setLocaleCookie,exports.setLocaleInStorage=e.setLocaleInStorage,exports.useDictionary=a.useDictionary,exports.useDictionaryDynamic=o.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,3 +1,3 @@
|
|
|
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/
|
|
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}
|
|
2
2
|
>${e.children}</${(0,_.unsafeStatic)(t)}
|
|
3
|
-
>`}}),o=(0,
|
|
3
|
+
>`}}),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,16 +1,16 @@
|
|
|
1
1
|
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
2
|
import { r as t } from "../../installIntlayer-Dvl7Prhw.mjs";
|
|
3
3
|
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
|
|
5
|
+
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
// src/client/useDictionary.ts
|
|
7
7
|
var a = (a, o) => {
|
|
8
|
-
let s = t(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (t) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? e(a, t) : e(a,
|
|
8
|
+
let s = t(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (t) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? e(a, t) : e(a, i({
|
|
9
9
|
localeOrSelector: o,
|
|
10
10
|
contextLocale: t,
|
|
11
11
|
contextVariant: s.variant,
|
|
12
12
|
dictionaryKey: a.key
|
|
13
|
-
})), u = l(c ?? s.locale ??
|
|
13
|
+
})), u = l(c ?? s.locale ?? r());
|
|
14
14
|
s.subscribe((e) => {
|
|
15
15
|
u = l(c ?? e);
|
|
16
16
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
2
|
import { r as t } from "../../installIntlayer-Dvl7Prhw.mjs";
|
|
3
3
|
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
|
|
5
|
+
import { getPreloadedDictionary as i, isQualifiedDynamicLoaderMap as a, parseDictionarySelector as o, resolveDictionaryArgument as s, resolveQualifiedDynamicContentAsync as c } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
// src/client/useDictionaryDynamic.ts
|
|
7
7
|
var l = /* @__PURE__ */ new Map(), u = async (e, t) => {
|
|
8
8
|
if (!t) return;
|
|
@@ -17,19 +17,19 @@ var l = /* @__PURE__ */ new Map(), u = async (e, t) => {
|
|
|
17
17
|
apply: () => d,
|
|
18
18
|
construct: () => ({})
|
|
19
19
|
}), f = (f, p, m) => {
|
|
20
|
-
let h = t(), g = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" &&
|
|
20
|
+
let h = t(), g = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && a(f), { locale: _, selector: v } = process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? {
|
|
21
21
|
locale: m,
|
|
22
22
|
selector: void 0
|
|
23
|
-
} :
|
|
23
|
+
} : o(s({
|
|
24
24
|
localeOrSelector: m,
|
|
25
25
|
contextLocale: h.locale,
|
|
26
26
|
contextVariant: h.variant,
|
|
27
27
|
dictionaryKey: String(p)
|
|
28
|
-
})), y = () => _ ?? h.locale ??
|
|
28
|
+
})), y = () => _ ?? h.locale ?? r(), b, x = /* @__PURE__ */ new Set(), S = () => {
|
|
29
29
|
for (let e of x) e();
|
|
30
30
|
}, C = (t) => {
|
|
31
31
|
if (g) {
|
|
32
|
-
|
|
32
|
+
c({
|
|
33
33
|
loaderMap: f,
|
|
34
34
|
key: String(p),
|
|
35
35
|
locale: t,
|
|
@@ -40,9 +40,9 @@ var l = /* @__PURE__ */ new Map(), u = async (e, t) => {
|
|
|
40
40
|
});
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
let n = `${String(p)}.${t}`,
|
|
44
|
-
if (
|
|
45
|
-
l.set(n,
|
|
43
|
+
let n = `${String(p)}.${t}`, r = i(f, t);
|
|
44
|
+
if (r) {
|
|
45
|
+
l.set(n, r), b = e(r, t), S();
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
let a = f[t];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { getIntlayer as e } from "../getIntlayer.mjs";
|
|
2
2
|
import { r as t } from "../../installIntlayer-Dvl7Prhw.mjs";
|
|
3
3
|
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
|
|
5
|
+
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
6
6
|
// src/client/useIntlayer.ts
|
|
7
7
|
var a = (a, o) => {
|
|
8
|
-
let s = t(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (t) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? e(a, t) : e(a,
|
|
8
|
+
let s = t(), c = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && typeof o == "object" && o ? o.locale : o, l = (t) => process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? e(a, t) : e(a, i({
|
|
9
9
|
localeOrSelector: o,
|
|
10
10
|
contextLocale: t,
|
|
11
11
|
contextVariant: s.variant,
|
|
@@ -14,8 +14,8 @@ var a = (a, o) => {
|
|
|
14
14
|
if (t === "observe") return (e) => (new n(e), p);
|
|
15
15
|
if (t === Symbol.toPrimitive || t === "toString") return () => "";
|
|
16
16
|
if (t === "then" || typeof t == "symbol" || typeof t == "string" && t.startsWith("_$")) return;
|
|
17
|
-
let
|
|
18
|
-
if (f && u ===
|
|
17
|
+
let i = c ?? s.locale ?? r();
|
|
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
|
};
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
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
2
|
import { a as s, i as c, n as l, r as u, t as d } from "../installIntlayer-Dvl7Prhw.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { getDictionary as f } from "./getDictionary.mjs";
|
|
4
|
+
import { getIntlayer as p } from "./getIntlayer.mjs";
|
|
5
|
+
import { IntlayerBinding as m } from "./client/IntlayerBinding.mjs";
|
|
6
6
|
import { useDictionary as h } from "./client/useDictionary.mjs";
|
|
7
7
|
import { useDictionaryDynamic as g } from "./client/useDictionaryDynamic.mjs";
|
|
8
8
|
import { getPlugins as _, htmlPlugin as v, insertionPlugin as y, intlayerNodePlugins as b, markdownPlugin as x, markdownStringPlugin as S } from "./plugins.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 {
|
|
13
|
+
export { m as IntlayerBinding, d as IntlayerClient, w as LocaleController, l as createIntlayerClient, f as getDictionary, p as getIntlayer, u as getIntlayerClient, e as getLocaleInStorage, _ as getPlugins, v as htmlPlugin, y as insertionPlugin, c as installIntlayer, b as intlayerNodePlugins, t as localeCookie, n as localeInStorage, x as markdownPlugin, S as markdownStringPlugin, r as setLocaleCookie, i as setLocaleInStorage, h as useDictionary, g 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,52 +1,52 @@
|
|
|
1
1
|
import { r as e } from "../installIntlayer-Dvl7Prhw.mjs";
|
|
2
2
|
import t from "./markdown/runtime.mjs";
|
|
3
3
|
import { renderIntlayerNode as n } from "./renderIntlayerNode.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
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, resolveInsertedSelector as f, resolveInterpreterLocale as p, selectPlugin as m, splitInsertionTemplate as h, transformInterpolableNode as g, translationPlugin as _ } from "@intlayer/core/interpreter";
|
|
5
|
+
import { editor as v, internationalization as y } from "@intlayer/config/built";
|
|
6
|
+
import { compileWithOptions as b, getMarkdownMetadata as x } from "@intlayer/core/markdown";
|
|
7
|
+
import { getIntlayerNodePrototype as S } from "@intlayer/core/utils";
|
|
8
8
|
import * as C from "@intlayer/types/nodeType";
|
|
9
9
|
import { unsafeHTML as w } from "lit/directives/unsafe-html.js";
|
|
10
10
|
import { html as T, unsafeStatic as E } from "lit/static-html.js";
|
|
11
11
|
// src/plugins.ts
|
|
12
|
-
var D = (e = "", n = {}) =>
|
|
13
|
-
let r = typeof e == "string" ? w(e) : e, i = Array.isArray(r),
|
|
12
|
+
var D = (e = "", n = {}) => b(e, t, n), O = (e, t, n = {}) => {
|
|
13
|
+
let r = typeof e == "string" ? w(e) : e, i = Array.isArray(r), a = Object.assign(i ? [...r] : { ...r }, n, {
|
|
14
14
|
value: t,
|
|
15
15
|
raw: t,
|
|
16
16
|
[Symbol.iterator]: void 0,
|
|
17
17
|
__update: () => {},
|
|
18
18
|
isJSX: !0
|
|
19
19
|
});
|
|
20
|
-
return Object.setPrototypeOf(
|
|
20
|
+
return Object.setPrototypeOf(a, S(t, i ? Array.prototype : Object.prototype));
|
|
21
21
|
}, k = (e) => e.replace(/&/g, "&").replace(/"/g, """), A = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), j = {
|
|
22
22
|
id: "intlayer-node-plugin",
|
|
23
23
|
canHandle: (e) => typeof e == "bigint" || typeof e == "string" || typeof e == "number",
|
|
24
|
-
transform: (e, { children: t, keyPath:
|
|
25
|
-
if (process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
24
|
+
transform: (e, { children: t, keyPath: r, dictionaryKey: i }) => {
|
|
25
|
+
if (process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled) {
|
|
26
26
|
let e = String(t ?? "");
|
|
27
|
-
return O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(
|
|
27
|
+
return O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(r ?? []))}" dictionary-key="${k(String(i ?? ""))}">${A(e)}</intlayer-content-selector-wrapper>`, e);
|
|
28
28
|
}
|
|
29
29
|
return n({
|
|
30
30
|
value: t,
|
|
31
31
|
children: t
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
}, M = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ?
|
|
34
|
+
}, M = process.env.INTLAYER_NODE_TYPE_INSERTION === "false" ? a : {
|
|
35
35
|
id: "insertion-plugin",
|
|
36
36
|
canHandle: (e) => typeof e == "object" && e?.nodeType === C.INSERTION,
|
|
37
37
|
transform: (e, t, n) => {
|
|
38
38
|
let r = [...t.keyPath, { type: C.INSERTION }], i = e[C.INSERTION], a = {
|
|
39
39
|
id: "insertion-string-plugin",
|
|
40
|
-
canHandle: (e) => typeof e == "string" ||
|
|
40
|
+
canHandle: (e) => typeof e == "string" || l(e),
|
|
41
41
|
transform: (e, n, r) => {
|
|
42
|
-
if (
|
|
42
|
+
if (l(e)) return (i) => g(e, i, n, t.plugins, r);
|
|
43
43
|
let i = r(e, {
|
|
44
44
|
...n,
|
|
45
45
|
children: e,
|
|
46
46
|
plugins: (t.plugins ?? []).filter((e) => e.id !== "intlayer-node-plugin")
|
|
47
47
|
});
|
|
48
48
|
return (e) => {
|
|
49
|
-
let a =
|
|
49
|
+
let a = h(i, e), o = a.isSimple ? a.parts : a.parts.join("");
|
|
50
50
|
return r(o, {
|
|
51
51
|
...n,
|
|
52
52
|
plugins: t.plugins,
|
|
@@ -60,13 +60,13 @@ var D = (e = "", n = {}) => x(e, t, n), O = (e, t, n = {}) => {
|
|
|
60
60
|
keyPath: r,
|
|
61
61
|
plugins: [a, ...t.plugins ?? []]
|
|
62
62
|
});
|
|
63
|
-
return
|
|
63
|
+
return f(i, o);
|
|
64
64
|
}
|
|
65
|
-
}, N = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
65
|
+
}, N = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? a : {
|
|
66
66
|
id: "markdown-string-plugin",
|
|
67
67
|
canHandle: (e) => typeof e == "string",
|
|
68
|
-
transform: (e, t,
|
|
69
|
-
let { plugins:
|
|
68
|
+
transform: (e, t, r) => {
|
|
69
|
+
let { plugins: i, ...a } = t, { keyPath: o, dictionaryKey: s } = a, c = r(x(e) ?? {}, {
|
|
70
70
|
plugins: [{
|
|
71
71
|
id: "markdown-metadata-plugin",
|
|
72
72
|
canHandle: (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" || !e,
|
|
@@ -76,21 +76,21 @@ var D = (e = "", n = {}) => x(e, t, n), O = (e, t, n = {}) => {
|
|
|
76
76
|
children: e
|
|
77
77
|
})
|
|
78
78
|
}],
|
|
79
|
-
dictionaryKey:
|
|
79
|
+
dictionaryKey: a.dictionaryKey,
|
|
80
80
|
keyPath: []
|
|
81
|
-
}),
|
|
81
|
+
}), l = D(e), u = (t) => {
|
|
82
82
|
let n = D(e, { components: t });
|
|
83
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
83
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(o ?? []))}" dictionary-key="${k(String(s ?? ""))}">${n}</intlayer-content-selector-wrapper>`, e) : O(n, e);
|
|
84
84
|
};
|
|
85
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
86
|
-
metadata:
|
|
87
|
-
use:
|
|
88
|
-
}) : O(
|
|
89
|
-
metadata:
|
|
90
|
-
use:
|
|
85
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(o ?? []))}" dictionary-key="${k(String(s ?? ""))}">${l}</intlayer-content-selector-wrapper>`, e, {
|
|
86
|
+
metadata: c,
|
|
87
|
+
use: u
|
|
88
|
+
}) : O(l, e, {
|
|
89
|
+
metadata: c,
|
|
90
|
+
use: u
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
|
-
}, P = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ?
|
|
93
|
+
}, P = process.env.INTLAYER_NODE_TYPE_MARKDOWN === "false" ? a : {
|
|
94
94
|
id: "markdown-plugin",
|
|
95
95
|
canHandle: (e) => typeof e == "object" && e?.nodeType === C.MARKDOWN,
|
|
96
96
|
transform: (e, t, n) => {
|
|
@@ -102,38 +102,38 @@ var D = (e = "", n = {}) => x(e, t, n), O = (e, t, n = {}) => {
|
|
|
102
102
|
plugins: [N, ...t.plugins ?? []]
|
|
103
103
|
});
|
|
104
104
|
}
|
|
105
|
-
}, F = process.env.INTLAYER_NODE_TYPE_HTML === "false" ?
|
|
105
|
+
}, F = process.env.INTLAYER_NODE_TYPE_HTML === "false" ? a : {
|
|
106
106
|
id: "html-plugin",
|
|
107
107
|
canHandle: (e) => typeof e == "object" && e?.nodeType === C.HTML,
|
|
108
108
|
transform: (e, t) => {
|
|
109
|
-
let n = e[C.HTML], { keyPath:
|
|
110
|
-
let t = Object.fromEntries(Object.entries(e).filter(([, e]) => e).map(([e, t]) => [e, (e) => t(e)])),
|
|
109
|
+
let n = e[C.HTML], { keyPath: r, dictionaryKey: i } = t, a = (e = {}) => {
|
|
110
|
+
let t = Object.fromEntries(Object.entries(e).filter(([, e]) => e).map(([e, t]) => [e, (e) => t(e)])), a = new Proxy(t, { get(e, t) {
|
|
111
111
|
if (typeof t == "string" && t in e) return e[t];
|
|
112
112
|
if (typeof t == "string" && /^[a-z][a-z0-9]*$/.test(t)) return (e) => T`<${E(t)} ...${e}
|
|
113
113
|
>${e.children}</${E(t)}
|
|
114
114
|
>`;
|
|
115
|
-
} }),
|
|
116
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
115
|
+
} }), o = c(n, a);
|
|
116
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(r ?? []))}" dictionary-key="${k(String(i ?? ""))}">${o}</intlayer-content-selector-wrapper>`, n) : O(o, n);
|
|
117
117
|
};
|
|
118
|
-
return process.env.INTLAYER_EDITOR_ENABLED !== "false" &&
|
|
118
|
+
return process.env.INTLAYER_EDITOR_ENABLED !== "false" && v.enabled ? O(`<intlayer-content-selector-wrapper key-path="${k(JSON.stringify(r ?? []))}" dictionary-key="${k(String(i ?? ""))}">${n}</intlayer-content-selector-wrapper>`, n, { use: a }) : O(n, n, { use: a });
|
|
119
119
|
}
|
|
120
120
|
}, I = /* @__PURE__ */ new Map(), L = (t, n = !0) => {
|
|
121
|
-
let
|
|
122
|
-
if (I.has(
|
|
123
|
-
let
|
|
121
|
+
let c = t ?? (typeof window < "u" && e()?.locale) ?? p(), l = `${c}_${n}`;
|
|
122
|
+
if (I.has(l)) return I.get(l);
|
|
123
|
+
let f = [
|
|
124
124
|
j,
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
125
|
+
_(c, n ? y.defaultLocale : void 0),
|
|
126
|
+
i,
|
|
127
|
+
d(c),
|
|
128
|
+
r,
|
|
129
|
+
u(c),
|
|
128
130
|
o,
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
u,
|
|
132
|
-
_,
|
|
131
|
+
s,
|
|
132
|
+
m,
|
|
133
133
|
M,
|
|
134
134
|
P,
|
|
135
135
|
F
|
|
136
|
-
].filter((e) => e !==
|
|
137
|
-
return I.set(
|
|
136
|
+
].filter((e) => e !== a);
|
|
137
|
+
return I.set(l, f), f;
|
|
138
138
|
};
|
|
139
139
|
export { L as getPlugins, F as htmlPlugin, M as insertionPlugin, j as intlayerNodePlugins, P as markdownPlugin, N as markdownStringPlugin };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-intlayer",
|
|
3
|
-
"version": "9.8.
|
|
3
|
+
"version": "9.8.3",
|
|
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.8.
|
|
108
|
-
"@intlayer/config": "9.8.
|
|
109
|
-
"@intlayer/core": "9.8.
|
|
110
|
-
"@intlayer/editor": "9.8.
|
|
111
|
-
"@intlayer/types": "9.8.
|
|
107
|
+
"@intlayer/api": "9.8.3",
|
|
108
|
+
"@intlayer/config": "9.8.3",
|
|
109
|
+
"@intlayer/core": "9.8.3",
|
|
110
|
+
"@intlayer/editor": "9.8.3",
|
|
111
|
+
"@intlayer/types": "9.8.3"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@types/node": "^26",
|
|
@@ -122,10 +122,10 @@
|
|
|
122
122
|
"typescript": "7.0.2",
|
|
123
123
|
"vite": "8.3.8",
|
|
124
124
|
"vite-plugin-dts": "5.1.2",
|
|
125
|
-
"vitest": "5.1.
|
|
125
|
+
"vitest": "5.1.1"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
|
-
"intlayer": "9.8.
|
|
128
|
+
"intlayer": "9.8.3",
|
|
129
129
|
"lit": ">=3.0.0"
|
|
130
130
|
},
|
|
131
131
|
"peerDependenciesMeta": {
|