lit-intlayer 9.3.2 → 9.3.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/useDictionaryDynamic.cjs +1 -1
- package/dist/esm/client/useDictionaryDynamic.mjs +44 -39
- package/dist/types/client/useDictionaryDynamic.d.ts.map +1 -1
- package/dist/types/client/useLocaleStorage.d.ts +4 -4
- package/dist/types/client/useLocaleStorage.d.ts.map +1 -1
- package/package.json +7 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-oiUYUnN4.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=(
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../installIntlayer-oiUYUnN4.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;
|
|
@@ -2,66 +2,71 @@ import { r as e } from "../../installIntlayer-BANc5sF6.mjs";
|
|
|
2
2
|
import { getDictionary as t } from "../getDictionary.mjs";
|
|
3
3
|
import { IntlayerBinding as n } from "./IntlayerBinding.mjs";
|
|
4
4
|
import { internationalization as r } from "@intlayer/config/built";
|
|
5
|
-
import {
|
|
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
|
|
7
|
-
var
|
|
7
|
+
var l = /* @__PURE__ */ new Map(), u = async (e, t) => {
|
|
8
8
|
if (!t) return;
|
|
9
|
-
if (
|
|
9
|
+
if (l.has(e)) return l.get(e);
|
|
10
10
|
let n = await t();
|
|
11
|
-
return
|
|
12
|
-
},
|
|
11
|
+
return l.set(e, n), n;
|
|
12
|
+
}, d = new Proxy(() => {}, {
|
|
13
13
|
get: (e, t) => {
|
|
14
14
|
if (t === Symbol.toPrimitive || t === "toString") return () => "";
|
|
15
|
-
if (t !== "then" && !(typeof t == "string" && t.startsWith("_$")) && t !== "nodeType" && t !== Symbol.iterator) return
|
|
15
|
+
if (t !== "then" && !(typeof t == "string" && t.startsWith("_$")) && t !== "nodeType" && t !== Symbol.iterator) return d;
|
|
16
16
|
},
|
|
17
|
-
apply: () =>
|
|
17
|
+
apply: () => d,
|
|
18
18
|
construct: () => ({})
|
|
19
|
-
}),
|
|
20
|
-
let
|
|
21
|
-
locale:
|
|
19
|
+
}), f = (f, p, m) => {
|
|
20
|
+
let h = e(), g = process.env.INTLAYER_DICTIONARY_SELECTOR !== "false" && a(f), { locale: _, selector: v } = process.env.INTLAYER_DICTIONARY_SELECTOR === "false" ? {
|
|
21
|
+
locale: m,
|
|
22
22
|
selector: void 0
|
|
23
|
-
} :
|
|
24
|
-
localeOrSelector:
|
|
25
|
-
contextLocale:
|
|
26
|
-
contextVariant:
|
|
27
|
-
dictionaryKey: String(
|
|
28
|
-
})),
|
|
29
|
-
for (let e of
|
|
30
|
-
},
|
|
31
|
-
if (
|
|
32
|
-
|
|
33
|
-
loaderMap:
|
|
34
|
-
key: String(
|
|
23
|
+
} : o(s({
|
|
24
|
+
localeOrSelector: m,
|
|
25
|
+
contextLocale: h.locale,
|
|
26
|
+
contextVariant: h.variant,
|
|
27
|
+
dictionaryKey: String(p)
|
|
28
|
+
})), y = () => _ ?? h.locale ?? r.defaultLocale, b, x = /* @__PURE__ */ new Set(), S = () => {
|
|
29
|
+
for (let e of x) e();
|
|
30
|
+
}, C = (e) => {
|
|
31
|
+
if (g) {
|
|
32
|
+
c({
|
|
33
|
+
loaderMap: f,
|
|
34
|
+
key: String(p),
|
|
35
35
|
locale: e,
|
|
36
|
-
selector:
|
|
36
|
+
selector: v,
|
|
37
37
|
transform: (n) => t(n, e)
|
|
38
38
|
}).then((e) => {
|
|
39
|
-
|
|
39
|
+
b = e, S();
|
|
40
40
|
});
|
|
41
41
|
return;
|
|
42
42
|
}
|
|
43
|
-
let n = `${String(
|
|
44
|
-
|
|
45
|
-
n
|
|
43
|
+
let n = `${String(p)}.${e}`, r = i(f, e);
|
|
44
|
+
if (r) {
|
|
45
|
+
l.set(n, r), b = t(r, e), S();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
let a = f[e];
|
|
49
|
+
u(n, a).then((n) => {
|
|
50
|
+
n && (b = t(n, e), S());
|
|
46
51
|
});
|
|
47
52
|
};
|
|
48
|
-
|
|
49
|
-
|
|
53
|
+
C(y()), h.subscribe((e) => {
|
|
54
|
+
C(_ ?? e);
|
|
50
55
|
});
|
|
51
|
-
let
|
|
52
|
-
if (t === "observe") return
|
|
56
|
+
let w, T = new Proxy({}, { get(e, t) {
|
|
57
|
+
if (t === "observe") return w;
|
|
53
58
|
if (t === Symbol.toPrimitive) return () => void 0;
|
|
54
59
|
if (t === "toString") return () => "";
|
|
55
|
-
if (t !== "then") return
|
|
60
|
+
if (t !== "then") return b == null ? d : b[t];
|
|
56
61
|
} });
|
|
57
|
-
return
|
|
62
|
+
return w = (e) => {
|
|
58
63
|
let t = () => e.requestUpdate();
|
|
59
|
-
return
|
|
60
|
-
|
|
64
|
+
return x.add(t), new n(e, () => {
|
|
65
|
+
b != null && e.requestUpdate();
|
|
61
66
|
}, () => {
|
|
62
|
-
|
|
63
|
-
}),
|
|
64
|
-
},
|
|
67
|
+
x.delete(t);
|
|
68
|
+
}), T;
|
|
69
|
+
}, T;
|
|
65
70
|
};
|
|
66
71
|
//#endregion
|
|
67
|
-
export {
|
|
72
|
+
export { f as useDictionaryDynamic };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryDynamic.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryDynamic.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"useDictionaryDynamic.d.ts","sourceRoot":"","sources":["../../../src/client/useDictionaryDynamic.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,yBAAyB,EAG/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;AAG7C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EAAmB,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAkD3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAyIrD,CAAC"}
|
|
@@ -2,11 +2,11 @@ import { LocalesValues } from '@intlayer/types/module_augmentation';
|
|
|
2
2
|
/**
|
|
3
3
|
* Get the current locale from storage (cookie or localStorage).
|
|
4
4
|
*/
|
|
5
|
-
export declare const localeInStorage: import('
|
|
5
|
+
export declare const localeInStorage: import('intlayer').Locale;
|
|
6
6
|
/**
|
|
7
7
|
* @deprecated Use localeInStorage instead.
|
|
8
8
|
*/
|
|
9
|
-
export declare const localeCookie: import('
|
|
9
|
+
export declare const localeCookie: import('intlayer').Locale;
|
|
10
10
|
/**
|
|
11
11
|
* Persist the locale to storage (cookie and/or localStorage).
|
|
12
12
|
*/
|
|
@@ -19,14 +19,14 @@ export declare const setLocaleCookie: (locale: LocalesValues, isCookieEnabled: b
|
|
|
19
19
|
* Returns the current locale from storage and a setter.
|
|
20
20
|
*/
|
|
21
21
|
export declare const useLocaleStorage: (isCookieEnabled?: boolean) => {
|
|
22
|
-
localeStorage: import('
|
|
22
|
+
localeStorage: import('intlayer').Locale;
|
|
23
23
|
setLocaleStorage: (locale: LocalesValues) => void;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* @deprecated Use useLocaleStorage instead.
|
|
27
27
|
*/
|
|
28
28
|
export declare const useLocaleCookie: (isCookieEnabled?: boolean) => {
|
|
29
|
-
localeStorage: import('
|
|
29
|
+
localeStorage: import('intlayer').Locale;
|
|
30
30
|
setLocaleStorage: (locale: LocalesValues) => void;
|
|
31
31
|
};
|
|
32
32
|
//# sourceMappingURL=useLocaleStorage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLocaleStorage.d.ts","sourceRoot":"","sources":["../../../src/client/useLocaleStorage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"useLocaleStorage.d.ts","sourceRoot":"","sources":["../../../src/client/useLocaleStorage.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEzE;;GAEG;AACH,eAAO,MAAM,eAAe,2BAAmD,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,YAAY,2BAAkB,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,QAAQ,aAAa,EACrB,iBAAiB,OAAO,SAKtB,CAAC;AAEL;;GAEG;AACH,eAAO,MAAM,eAAe,WAXlB,aAAa,mBACJ,OAAO,SAUuB,CAAC;AAElD;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,kBAAkB,OAAO;;;CAUzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe,qBAfuB,OAAO;;;CAeX,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lit-intlayer",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Lit applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -104,10 +104,10 @@
|
|
|
104
104
|
},
|
|
105
105
|
"dependencies": {
|
|
106
106
|
"@intlayer/api": "9.3.2",
|
|
107
|
-
"@intlayer/config": "9.3.
|
|
108
|
-
"@intlayer/core": "9.3.
|
|
109
|
-
"@intlayer/editor": "9.3.
|
|
110
|
-
"@intlayer/types": "9.3.
|
|
107
|
+
"@intlayer/config": "9.3.3",
|
|
108
|
+
"@intlayer/core": "9.3.3",
|
|
109
|
+
"@intlayer/editor": "9.3.3",
|
|
110
|
+
"@intlayer/types": "9.3.3"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
113
|
"@types/node": "26.2.0",
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
"typescript": "7.0.2",
|
|
122
122
|
"vite": "8.2.1",
|
|
123
123
|
"vite-plugin-dts": "5.0.3",
|
|
124
|
-
"vitest": "4.1.
|
|
124
|
+
"vitest": "4.1.11"
|
|
125
125
|
},
|
|
126
126
|
"peerDependencies": {
|
|
127
|
-
"intlayer": "9.3.
|
|
127
|
+
"intlayer": "9.3.3",
|
|
128
128
|
"lit": ">=3.0.0"
|
|
129
129
|
},
|
|
130
130
|
"peerDependenciesMeta": {
|