lit-intlayer 9.8.4 → 9.9.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/README.md +1 -0
- package/dist/cjs/client/IntlayerBinding.cjs +1 -1
- package/dist/cjs/client/index.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/index.cjs +1 -1
- package/dist/esm/client/IntlayerBinding.mjs +30 -2
- package/dist/esm/client/index.mjs +9 -9
- package/dist/esm/client/useDictionary.mjs +9 -23
- package/dist/esm/client/useDictionaryDynamic.mjs +10 -68
- package/dist/esm/client/useIntlayer.mjs +9 -20
- package/dist/esm/index.mjs +8 -8
- package/dist/types/client/IntlayerBinding.d.ts +21 -0
- package/dist/types/client/IntlayerBinding.d.ts.map +1 -1
- package/dist/types/client/useDictionary.d.ts.map +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +4 -4
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useIntlayer.d.ts +2 -2
- package/dist/types/client/useIntlayer.d.ts.map +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -190,6 +190,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
190
190
|
<li><a href="https://intlayer.org/doc/environment/vite-and-react" rel=''>Vite + React using Compiler</a></li>
|
|
191
191
|
<li><a href="https://intlayer.org/doc/environment/vite-and-react/react-router-v7" rel=''>React-router-v7</a></li>
|
|
192
192
|
<li><a href="https://intlayer.org/doc/environment/remix-3" rel=''>Remix 3</a></li>
|
|
193
|
+
<li><a href="https://intlayer.org/doc/environment/vinext" rel=''>vinext (Next.js on Vite)</a></li>
|
|
193
194
|
<li><a href="https://intlayer.org/doc/environment/tanstack-start" rel=''>Tanstack start</a>
|
|
194
195
|
<ul>
|
|
195
196
|
<li><a href="https://intlayer.org/doc/environment/tanstack-start/solid" rel=''>Solid</a></li>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-Btnci_ES.js");let t=require("@intlayer/core/dictionaryManipulator");var n=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?.()}},r=r=>{let i=e.r(),a=new Set,o,s,c,l=!1,u=()=>{if(!l||s!==i.locale||c!==i.variant){l=!0,s=i.locale,c=i.variant;let e=r({contextLocale:i.locale,contextVariant:i.variant},e=>{o={content:e};for(let e of a)e.requestUpdate()});e&&(o=e)}return o};u();let d=new Proxy({},{get(e,r){if(r===`observe`)return e=>(a.add(e),new n(e,()=>{o&&e.requestUpdate()},()=>a.delete(e)),d);if(r===`then`||typeof r==`string`&&r.startsWith(`_$`))return;let i=u();if(!i)return t.loadingContentPlaceholder[r];let s=i.content;return r===Symbol.toPrimitive?()=>s?.[Symbol.toPrimitive]?.()??``:r===`toString`?()=>String(s?.toString?.()??``):s?.[r]}});return d};exports.IntlayerBinding=n,exports.createContentProxy=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./IntlayerBinding.cjs"),t=require("../../installIntlayer-Btnci_ES.js"),n=require("./useDictionary.cjs"),r=require("./useDictionaryDynamic.cjs"),i=require("./useIntlayer.cjs"),a=require("./useLocale.cjs"),o=require("./useLocaleStorage.cjs"),s=require("./useRewriteURL.cjs");exports.IntlayerBinding=e.IntlayerBinding,exports.IntlayerClient=t.t,exports.LocaleController=a.LocaleController,exports.createIntlayerClient=t.n,exports.getIntlayerClient=t.r,exports.getLocaleInStorage=o.getLocaleInStorage,exports.installIntlayer=t.i,exports.localeCookie=o.localeCookie,exports.localeInStorage=o.localeInStorage,exports.setLocaleCookie=o.setLocaleCookie,exports.setLocaleInStorage=o.setLocaleInStorage,exports.useDictionary=n.useDictionary,exports.useDictionaryDynamic=r.useDictionaryDynamic,exports.useIntlayer=i.useIntlayer,exports.useLocale=a.useLocale,exports.useLocaleCookie=o.useLocaleCookie,exports.useLocaleStorage=o.useLocaleStorage,exports.useRewriteURL=s.useRewriteURL;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./IntlayerBinding.cjs"),t=require("../../installIntlayer-Btnci_ES.js"),n=require("./useDictionary.cjs"),r=require("./useDictionaryDynamic.cjs"),i=require("./useIntlayer.cjs"),a=require("./useLocale.cjs"),o=require("./useLocaleStorage.cjs"),s=require("./useRewriteURL.cjs");exports.IntlayerBinding=e.IntlayerBinding,exports.IntlayerClient=t.t,exports.LocaleController=a.LocaleController,exports.createContentProxy=e.createContentProxy,exports.createIntlayerClient=t.n,exports.getIntlayerClient=t.r,exports.getLocaleInStorage=o.getLocaleInStorage,exports.installIntlayer=t.i,exports.localeCookie=o.localeCookie,exports.localeInStorage=o.localeInStorage,exports.setLocaleCookie=o.setLocaleCookie,exports.setLocaleInStorage=o.setLocaleInStorage,exports.useDictionary=n.useDictionary,exports.useDictionaryDynamic=r.useDictionaryDynamic,exports.useIntlayer=i.useIntlayer,exports.useLocale=a.useLocale,exports.useLocaleCookie=o.useLocaleCookie,exports.useLocaleStorage=o.useLocaleStorage,exports.useRewriteURL=s.useRewriteURL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./IntlayerBinding.cjs");let n=require("@intlayer/core/dictionaryManipulator");var r=(r,i)=>t.createContentProxy(({contextLocale:t,contextVariant:a})=>({content:process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?e.getDictionary(r,i??t):e.getDictionary(r,(0,n.resolveDictionaryArgument)({localeOrSelector:i,contextLocale:t,contextVariant:a,dictionaryKey:r.key}))}));exports.useDictionary=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./IntlayerBinding.cjs");var n=(0,require("@intlayer/core/dictionaryManipulator").createDynamicContentStore)((t,n)=>e.getDictionary(t,n)),r=(e,r,i)=>{let a=n.createReader(e,String(r));return t.createContentProxy(({contextLocale:e,contextVariant:t},n)=>a({localeOrSelector:i,contextLocale:e,contextVariant:t},n))};exports.useDictionaryDynamic=r;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getIntlayer.cjs"),t=require("
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getIntlayer.cjs"),t=require("./IntlayerBinding.cjs");let n=require("@intlayer/core/dictionaryManipulator");var r=(r,i)=>t.createContentProxy(({contextLocale:t,contextVariant:a})=>({content:process.env.INTLAYER_DICTIONARY_SELECTOR===`false`?e.getIntlayer(r,i??t):e.getIntlayer(r,(0,n.resolveDictionaryArgument)({localeOrSelector:i,contextLocale:t,contextVariant:a,dictionaryKey:r}))}));exports.useIntlayer=r;
|
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("./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;
|
|
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.createContentProxy=i.createContentProxy,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;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { r as e } from "../../installIntlayer-Dvl7Prhw.mjs";
|
|
2
|
+
import { loadingContentPlaceholder as t } from "@intlayer/core/dictionaryManipulator";
|
|
2
3
|
// src/client/IntlayerBinding.ts
|
|
3
|
-
var
|
|
4
|
+
var n = class {
|
|
4
5
|
host;
|
|
5
6
|
unsubscribeLocale = null;
|
|
6
7
|
onConnect;
|
|
@@ -17,5 +18,32 @@ var t = class {
|
|
|
17
18
|
hostDisconnected() {
|
|
18
19
|
this.unsubscribeLocale?.(), this.unsubscribeLocale = null, this.onDisconnect?.();
|
|
19
20
|
}
|
|
21
|
+
}, r = (r) => {
|
|
22
|
+
let i = e(), a = /* @__PURE__ */ new Set(), o, s, c, l = !1, u = () => {
|
|
23
|
+
if (!l || s !== i.locale || c !== i.variant) {
|
|
24
|
+
l = !0, s = i.locale, c = i.variant;
|
|
25
|
+
let e = r({
|
|
26
|
+
contextLocale: i.locale,
|
|
27
|
+
contextVariant: i.variant
|
|
28
|
+
}, (e) => {
|
|
29
|
+
o = { content: e };
|
|
30
|
+
for (let e of a) e.requestUpdate();
|
|
31
|
+
});
|
|
32
|
+
e && (o = e);
|
|
33
|
+
}
|
|
34
|
+
return o;
|
|
35
|
+
};
|
|
36
|
+
u();
|
|
37
|
+
let d = new Proxy({}, { get(e, r) {
|
|
38
|
+
if (r === "observe") return (e) => (a.add(e), new n(e, () => {
|
|
39
|
+
o && e.requestUpdate();
|
|
40
|
+
}, () => a.delete(e)), d);
|
|
41
|
+
if (r === "then" || typeof r == "string" && r.startsWith("_$")) return;
|
|
42
|
+
let i = u();
|
|
43
|
+
if (!i) return t[r];
|
|
44
|
+
let s = i.content;
|
|
45
|
+
return r === Symbol.toPrimitive ? () => s?.[Symbol.toPrimitive]?.() ?? "" : r === "toString" ? () => String(s?.toString?.() ?? "") : s?.[r];
|
|
46
|
+
} });
|
|
47
|
+
return d;
|
|
20
48
|
};
|
|
21
|
-
export {
|
|
49
|
+
export { n as IntlayerBinding, r as createContentProxy };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { IntlayerBinding as e } from "./IntlayerBinding.mjs";
|
|
2
|
-
import { i as
|
|
3
|
-
import { useDictionary as
|
|
4
|
-
import { useDictionaryDynamic as
|
|
5
|
-
import { useIntlayer as
|
|
6
|
-
import { LocaleController as
|
|
7
|
-
import { getLocaleInStorage as
|
|
8
|
-
import { useRewriteURL as
|
|
9
|
-
export { e as IntlayerBinding,
|
|
1
|
+
import { IntlayerBinding as e, createContentProxy as t } from "./IntlayerBinding.mjs";
|
|
2
|
+
import { i as n, n as r, r as i, t as a } from "../../installIntlayer-Dvl7Prhw.mjs";
|
|
3
|
+
import { useDictionary as o } from "./useDictionary.mjs";
|
|
4
|
+
import { useDictionaryDynamic as s } from "./useDictionaryDynamic.mjs";
|
|
5
|
+
import { useIntlayer as c } from "./useIntlayer.mjs";
|
|
6
|
+
import { LocaleController as l, useLocale as u } from "./useLocale.mjs";
|
|
7
|
+
import { getLocaleInStorage as d, localeCookie as f, localeInStorage as p, setLocaleCookie as m, setLocaleInStorage as h, useLocaleCookie as g, useLocaleStorage as _ } from "./useLocaleStorage.mjs";
|
|
8
|
+
import { useRewriteURL as v } from "./useRewriteURL.mjs";
|
|
9
|
+
export { e as IntlayerBinding, a as IntlayerClient, l as LocaleController, t as createContentProxy, r as createIntlayerClient, i as getIntlayerClient, d as getLocaleInStorage, n as installIntlayer, f as localeCookie, p as localeInStorage, m as setLocaleCookie, h as setLocaleInStorage, o as useDictionary, s as useDictionaryDynamic, c as useIntlayer, u as useLocale, g as useLocaleCookie, _ as useLocaleStorage, v as useRewriteURL };
|
|
@@ -1,25 +1,11 @@
|
|
|
1
1
|
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
|
|
5
|
-
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
2
|
+
import { createContentProxy as t } from "./IntlayerBinding.mjs";
|
|
3
|
+
import { resolveDictionaryArgument as n } from "@intlayer/core/dictionaryManipulator";
|
|
6
4
|
// src/client/useDictionary.ts
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
s.subscribe((e) => {
|
|
15
|
-
u = l(c ?? e);
|
|
16
|
-
});
|
|
17
|
-
let d, f = new Proxy({}, { get(e, t) {
|
|
18
|
-
if (t === "observe") return d;
|
|
19
|
-
if (t === Symbol.toPrimitive) return () => u?.[Symbol.toPrimitive]?.() ?? "";
|
|
20
|
-
if (t === "toString") return () => String(u?.toString?.() ?? "");
|
|
21
|
-
if (t !== "then" && u != null) return u[t];
|
|
22
|
-
} });
|
|
23
|
-
return d = (e) => (new n(e), f), f;
|
|
24
|
-
};
|
|
25
|
-
export { a as useDictionary };
|
|
5
|
+
var r = (r, i) => t(({ contextLocale: t, contextVariant: a }) => ({ content: process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? e(r, i ?? t) : e(r, n({
|
|
6
|
+
localeOrSelector: i,
|
|
7
|
+
contextLocale: t,
|
|
8
|
+
contextVariant: a,
|
|
9
|
+
dictionaryKey: r.key
|
|
10
|
+
})) }));
|
|
11
|
+
export { r as useDictionary };
|
|
@@ -1,71 +1,13 @@
|
|
|
1
1
|
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
|
-
import {
|
|
3
|
-
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";
|
|
2
|
+
import { createContentProxy as t } from "./IntlayerBinding.mjs";
|
|
3
|
+
import { createDynamicContentStore as n } from "@intlayer/core/dictionaryManipulator";
|
|
6
4
|
// src/client/useDictionaryDynamic.ts
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (t === Symbol.toPrimitive || t === "toString") return () => "";
|
|
15
|
-
if (t !== "then" && !(typeof t == "string" && t.startsWith("_$")) && t !== "nodeType" && t !== Symbol.iterator) return d;
|
|
16
|
-
},
|
|
17
|
-
apply: () => d,
|
|
18
|
-
construct: () => ({})
|
|
19
|
-
}), f = (f, p, m) => {
|
|
20
|
-
let h = t(), g = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && a(f), { locale: _, selector: v } = process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? {
|
|
21
|
-
locale: m,
|
|
22
|
-
selector: void 0
|
|
23
|
-
} : o(s({
|
|
24
|
-
localeOrSelector: m,
|
|
25
|
-
contextLocale: h.locale,
|
|
26
|
-
contextVariant: h.variant,
|
|
27
|
-
dictionaryKey: String(p)
|
|
28
|
-
})), y = () => _ ?? h.locale ?? r(), b, x = /* @__PURE__ */ new Set(), S = () => {
|
|
29
|
-
for (let e of x) e();
|
|
30
|
-
}, C = (t) => {
|
|
31
|
-
if (g) {
|
|
32
|
-
c({
|
|
33
|
-
loaderMap: f,
|
|
34
|
-
key: String(p),
|
|
35
|
-
locale: t,
|
|
36
|
-
selector: v,
|
|
37
|
-
transform: (n) => e(n, t)
|
|
38
|
-
}).then((e) => {
|
|
39
|
-
b = e, S();
|
|
40
|
-
});
|
|
41
|
-
return;
|
|
42
|
-
}
|
|
43
|
-
let n = `${String(p)}.${t}`, r = i(f, t);
|
|
44
|
-
if (r) {
|
|
45
|
-
l.set(n, r), b = e(r, t), S();
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
let a = f[t];
|
|
49
|
-
u(n, a).then((n) => {
|
|
50
|
-
n && (b = e(n, t), S());
|
|
51
|
-
});
|
|
52
|
-
};
|
|
53
|
-
C(y()), h.subscribe((e) => {
|
|
54
|
-
C(_ ?? e);
|
|
55
|
-
});
|
|
56
|
-
let w, T = new Proxy({}, { get(e, t) {
|
|
57
|
-
if (t === "observe") return w;
|
|
58
|
-
if (t === Symbol.toPrimitive) return () => void 0;
|
|
59
|
-
if (t === "toString") return () => "";
|
|
60
|
-
if (t !== "then") return b == null ? d : b[t];
|
|
61
|
-
} });
|
|
62
|
-
return w = (e) => {
|
|
63
|
-
let t = () => e.requestUpdate();
|
|
64
|
-
return x.add(t), new n(e, () => {
|
|
65
|
-
b != null && e.requestUpdate();
|
|
66
|
-
}, () => {
|
|
67
|
-
x.delete(t);
|
|
68
|
-
}), T;
|
|
69
|
-
}, T;
|
|
5
|
+
var r = n((t, n) => e(t, n)), i = (e, n, i) => {
|
|
6
|
+
let a = r.createReader(e, String(n));
|
|
7
|
+
return t(({ contextLocale: e, contextVariant: t }, n) => a({
|
|
8
|
+
localeOrSelector: i,
|
|
9
|
+
contextLocale: e,
|
|
10
|
+
contextVariant: t
|
|
11
|
+
}, n));
|
|
70
12
|
};
|
|
71
|
-
export {
|
|
13
|
+
export { i as useDictionaryDynamic };
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import { getIntlayer as e } from "../getIntlayer.mjs";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { resolveInterpreterLocale as r } from "@intlayer/core/interpreter";
|
|
5
|
-
import { resolveDictionaryArgument as i } from "@intlayer/core/dictionaryManipulator";
|
|
2
|
+
import { createContentProxy as t } from "./IntlayerBinding.mjs";
|
|
3
|
+
import { resolveDictionaryArgument as n } from "@intlayer/core/dictionaryManipulator";
|
|
6
4
|
// src/client/useIntlayer.ts
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
let i = c ?? s.locale ?? r();
|
|
18
|
-
if (f && u === i || (d = l(i), u = i, f = !0), d != null) return d[t];
|
|
19
|
-
} });
|
|
20
|
-
return p;
|
|
21
|
-
};
|
|
22
|
-
export { a as useIntlayer };
|
|
5
|
+
var r = (r, i) => t(({ contextLocale: t, contextVariant: a }) => ({ content: process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? e(r, i ?? t) : e(r, n({
|
|
6
|
+
localeOrSelector: i,
|
|
7
|
+
contextLocale: t,
|
|
8
|
+
contextVariant: a,
|
|
9
|
+
dictionaryKey: r
|
|
10
|
+
})) }));
|
|
11
|
+
export { r as useIntlayer };
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2,12 +2,12 @@ import { getLocaleInStorage as e, localeCookie as t, localeInStorage as n, setLo
|
|
|
2
2
|
import { a as s, i as c, n as l, r as u, t as d } from "../installIntlayer-Dvl7Prhw.mjs";
|
|
3
3
|
import { getDictionary as f } from "./getDictionary.mjs";
|
|
4
4
|
import { getIntlayer as p } from "./getIntlayer.mjs";
|
|
5
|
-
import { IntlayerBinding as m } from "./client/IntlayerBinding.mjs";
|
|
6
|
-
import { useDictionary as
|
|
7
|
-
import { useDictionaryDynamic as
|
|
8
|
-
import { getPlugins as
|
|
9
|
-
import { useIntlayer as
|
|
10
|
-
import { LocaleController as
|
|
11
|
-
import { useRewriteURL as
|
|
5
|
+
import { IntlayerBinding as m, createContentProxy as h } from "./client/IntlayerBinding.mjs";
|
|
6
|
+
import { useDictionary as g } from "./client/useDictionary.mjs";
|
|
7
|
+
import { useDictionaryDynamic as _ } from "./client/useDictionaryDynamic.mjs";
|
|
8
|
+
import { getPlugins as v, htmlPlugin as y, insertionPlugin as b, intlayerNodePlugins as x, markdownPlugin as S, markdownStringPlugin as C } from "./plugins.mjs";
|
|
9
|
+
import { useIntlayer as w } from "./client/useIntlayer.mjs";
|
|
10
|
+
import { LocaleController as T, useLocale as E } from "./client/useLocale.mjs";
|
|
11
|
+
import { useRewriteURL as D } from "./client/useRewriteURL.mjs";
|
|
12
12
|
import "./client/index.mjs";
|
|
13
|
-
export { m as IntlayerBinding, d as IntlayerClient,
|
|
13
|
+
export { m as IntlayerBinding, d as IntlayerClient, T as LocaleController, h as createContentProxy, l as createIntlayerClient, f as getDictionary, p as getIntlayer, u as getIntlayerClient, e as getLocaleInStorage, v as getPlugins, y as htmlPlugin, b as insertionPlugin, c as installIntlayer, x as intlayerNodePlugins, t as localeCookie, n as localeInStorage, S as markdownPlugin, C as markdownStringPlugin, r as setLocaleCookie, i as setLocaleInStorage, g as useDictionary, _ as useDictionaryDynamic, s as useEditor, w as useIntlayer, E as useLocale, a as useLocaleCookie, o as useLocaleStorage, D as useRewriteURL };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LocalesValues, ProviderVariant } from '@intlayer/types/module_augmentation';
|
|
1
2
|
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
3
|
/**
|
|
3
4
|
* Proxy type returned by every `use*` hook in `lit-intlayer`.
|
|
@@ -38,4 +39,24 @@ export declare class IntlayerBinding implements ReactiveController {
|
|
|
38
39
|
hostConnected(): void;
|
|
39
40
|
hostDisconnected(): void;
|
|
40
41
|
}
|
|
42
|
+
/** The client context a content proxy reads for. */
|
|
43
|
+
export type ContentReadContext = {
|
|
44
|
+
contextLocale: LocalesValues;
|
|
45
|
+
contextVariant: ProviderVariant | undefined;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Reads the content of a context: `{ content }` when available right away,
|
|
49
|
+
* else `undefined`, calling `onLoad` once the content lands.
|
|
50
|
+
*/
|
|
51
|
+
export type ContentReader = (context: ContentReadContext, onLoad: (content: unknown) => void) => {
|
|
52
|
+
content: unknown;
|
|
53
|
+
} | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Wraps content read for the client's locale and variant (read again whenever
|
|
56
|
+
* either changes) in an {@link IntlayerLitProxy}. Chain `.observe(this)` so
|
|
57
|
+
* the host re-renders on locale changes and once loading content lands; while
|
|
58
|
+
* the first content loads, every access renders `''`. Shared by `useDictionary`,
|
|
59
|
+
* `useIntlayer` and `useDictionaryDynamic`.
|
|
60
|
+
*/
|
|
61
|
+
export declare const createContentProxy: <Content>(readContent: ContentReader) => IntlayerLitProxy<Content>;
|
|
41
62
|
//# sourceMappingURL=IntlayerBinding.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerBinding.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerBinding.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntlayerBinding.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerBinding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAChB,MAAM,qCAAqC,CAAC;AAC7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAGtE;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG;IACpC,OAAO,EAAE,CAAC,IAAI,EAAE,sBAAsB,KAAK,gBAAgB,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC;AAEF;;;;;;;;;;;;;GAaG;AACH,qBAAa,eAAgB,YAAW,kBAAkB;IACxD,OAAO,CAAC,IAAI,CAAyB;IACrC,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAa;gBAGzC,IAAI,EAAE,sBAAsB,EAC5B,SAAS,CAAC,EAAE,MAAM,IAAI,EACtB,YAAY,CAAC,EAAE,MAAM,IAAI;IAQ3B,aAAa,IAAI,IAAI;IAQrB,gBAAgB,IAAI,IAAI;CAKzB;AAED,oDAAoD;AACpD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,aAAa,EAAE,aAAa,CAAC;IAC7B,cAAc,EAAE,eAAe,GAAG,SAAS,CAAC;CAC7C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,CAC1B,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KAC/B;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,CAAC;AAEtC;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,EACxC,aAAa,aAAa,KACzB,gBAAgB,CAAC,OAAO,CAgF1B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useDictionary.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,UAAU,EACV,0BAA0B,EAC1B,wBAAwB,EACxB,iCAAiC,EAClC,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EACrB,aAAa,EACd,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE9E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK,CAAC,CAAC,SAAS,UAAU,GAAG,wBAAwB,EACrD,KAAK,CAAC,CAAC,SAAS,aAAa,GAAG,0BAA0B,CAAC,CAAC,CAAC,GAC3D,eAAe,EAEjB,YAAY,CAAC,EACb,mBAAmB,CAAC,KACnB,gBAAgB,CACjB,oBAAoB,CAClB,iCAAiC,CAAC,CAAC,EAAE,CAAC,CAAC,EACvC,qBAAqB,CAAC,CAAC,CAAC,CACzB,CAgBE,CAAC"}
|
|
@@ -14,17 +14,17 @@ import { IntlayerLitProxy } from './IntlayerBinding';
|
|
|
14
14
|
* by the build plugin, matching the same signature as `react-intlayer` and
|
|
15
15
|
* other framework adapters.
|
|
16
16
|
*
|
|
17
|
-
* While loading, property accesses return
|
|
18
|
-
*
|
|
17
|
+
* While loading, property accesses return the shared loading placeholder,
|
|
18
|
+
* which renders `''`. Chain `.observe(this)` so Lit triggers `requestUpdate()`
|
|
19
19
|
* once the bundle is ready and on every subsequent locale change.
|
|
20
20
|
*
|
|
21
21
|
* The `intlayerLitPlugin` Vite plugin automatically appends
|
|
22
22
|
* `.observe(this)` at build / serve time, so manual chaining is usually
|
|
23
23
|
* unnecessary.
|
|
24
24
|
*
|
|
25
|
-
* @param dictionaryPromise - Locale-keyed map
|
|
25
|
+
* @param dictionaryPromise - Locale-keyed loader map, or a qualified loader map.
|
|
26
26
|
* @param key - The dictionary key (used for cache namespacing).
|
|
27
|
-
* @param
|
|
27
|
+
* @param localeOrSelector - Optional locale or selector.
|
|
28
28
|
* @returns An {@link IntlayerLitProxy} proxy with an `.observe()` method.
|
|
29
29
|
*
|
|
30
30
|
* @example
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryDynamic.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryDynamic.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,yBAAyB,EAC/B,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,aAAa,EACb,mBAAmB,EACpB,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAO9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,oBAAoB,GAC/B,KAAK,CAAC,CAAC,SAAS,UAAU,EAC1B,KAAK,CAAC,CAAC,SAAS,cAAc,EAC9B,KAAK,CAAC,CAAC,SAAS,aAAa,GAAG,wBAAwB,CAAC,CAAC,CAAC,GAAG,eAAe,EAE7E,mBACI,mBAAmB,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,GACrC,yBAAyB,EAC7B,KAAK,CAAC,EACN,mBAAmB,CAAC,KACnB,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CASrD,CAAC"}
|
|
@@ -16,8 +16,8 @@ import { IntlayerLitProxy } from './IntlayerBinding';
|
|
|
16
16
|
* - static mode: `useDictionary(_hash)` — synchronous JSON import
|
|
17
17
|
* - dynamic mode: `useDictionaryDynamic(_dyn, 'key')` — lazy locale split
|
|
18
18
|
*
|
|
19
|
-
* In non-optimized builds (dev without babel) the content is
|
|
20
|
-
* `getIntlayer
|
|
19
|
+
* In non-optimized builds (dev without babel) the content is read from
|
|
20
|
+
* `getIntlayer`, again whenever the client locale or variant changes.
|
|
21
21
|
*/
|
|
22
22
|
export declare const useIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => IntlayerLitProxy<DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>>;
|
|
23
23
|
//# sourceMappingURL=useIntlayer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/client/useIntlayer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useIntlayer.d.ts","sourceRoot":"","sources":["../../../src/client/useIntlayer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,wBAAwB,EACxB,qBAAqB,EACrB,aAAa,EACd,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAsB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE9E;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,WAAW,GACtB,KAAK,CAAC,CAAC,SAAS,cAAc,EAC9B,KAAK,CAAC,CAAC,SAAS,aAAa,GAAG,wBAAwB,CAAC,CAAC,CAAC,GAAG,eAAe,EAE7E,KAAK,CAAC,EACN,mBAAmB,CAAC,KACnB,gBAAgB,CACjB,oBAAoB,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAgB3E,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-intlayer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.9.0",
|
|
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.
|
|
108
|
-
"@intlayer/config": "9.
|
|
109
|
-
"@intlayer/core": "9.
|
|
110
|
-
"@intlayer/editor": "9.
|
|
111
|
-
"@intlayer/types": "9.
|
|
107
|
+
"@intlayer/api": "9.9.0",
|
|
108
|
+
"@intlayer/config": "9.9.0",
|
|
109
|
+
"@intlayer/core": "9.9.0",
|
|
110
|
+
"@intlayer/editor": "9.9.0",
|
|
111
|
+
"@intlayer/types": "9.9.0"
|
|
112
112
|
},
|
|
113
113
|
"devDependencies": {
|
|
114
114
|
"@types/node": "^26",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"vitest": "5.1.1"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
|
-
"intlayer": "9.
|
|
128
|
+
"intlayer": "9.9.0",
|
|
129
129
|
"lit": ">=3.0.0"
|
|
130
130
|
},
|
|
131
131
|
"peerDependenciesMeta": {
|