vue-intlayer 8.12.4 → 9.0.0-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/client/useDictionary.cjs +1 -1
- package/dist/cjs/client/useDictionaryDynamic.cjs +1 -1
- package/dist/cjs/client/useIntlayer.cjs +1 -1
- package/dist/cjs/getDictionary.cjs +1 -1
- package/dist/cjs/getIntlayer.cjs +1 -1
- package/dist/esm/client/useDictionary.mjs +31 -11
- package/dist/esm/client/useDictionaryDynamic.mjs +20 -3
- package/dist/esm/client/useIntlayer.mjs +33 -13
- package/dist/esm/getDictionary.mjs +1 -1
- package/dist/esm/getIntlayer.mjs +1 -1
- package/dist/plugins-jnYcT_H4.js +1 -0
- package/dist/types/client/useDictionary.d.ts +3 -3
- package/dist/types/client/useDictionaryAsync.d.ts +1 -1
- package/dist/types/client/useDictionaryDynamic.d.ts +10 -4
- package/dist/types/client/useIntlayer.d.ts +2 -2
- package/dist/types/getDictionary.d.ts +8 -3
- package/dist/types/getIntlayer.d.ts +7 -2
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./installIntlayer.cjs");let n=require("vue"),r=require("@intlayer/config/built");var i=(e,t)=>t.reduce((e,t)=>e?.[t],e),a=e=>typeof e==`object`&&!!e,o=e=>typeof e==`function`||a(e)&&(`render`in e||`setup`in e),s=e=>e!=null&&(typeof e==`object`||typeof e==`function`)&&`__update`in e&&`render`in e&&`raw`in e,c=e=>(0,n.markRaw)((0,n.defineComponent)({name:`IntlayerLeaf`,setup(){return()=>{let t=e();return t==null?null:o(t)?(0,n.h)(t):Array.isArray(t)?(0,n.h)(`span`,t):t}}})),l=e=>new Proxy({},{get(t,n){let r=e.value;if(n===`__v_isRef`)return!0;if(n===`value`)return r??``;if(n===`$raw`)return e;if(n===`__v_skip`)return!0;if(n===`c`||n===`asComponent`)return c(()=>e.value);if(r==null)return n===Symbol.toPrimitive||n===`toString`?()=>``:void 0;let i=r[n];return typeof i==`function`?i.bind(r):i},ownKeys(){let t=e.value;return typeof t==`object`&&t?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}}),u=(u,d)=>{let f=(0,n.getCurrentInstance)()?(0,n.inject)(t.INTLAYER_SYMBOL):void 0,p=(0,n.isRef)(f?.locale)?f.locale:(0,n.ref)(f?.locale??r.internationalization.defaultLocale),m=(0,n.computed)(()=>
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./installIntlayer.cjs");let n=require("vue"),r=require("@intlayer/config/built");var i=(e,t)=>t.reduce((e,t)=>e?.[t],e),a=e=>typeof e==`object`&&!!e,o=e=>typeof e==`function`||a(e)&&(`render`in e||`setup`in e),s=e=>e!=null&&(typeof e==`object`||typeof e==`function`)&&`__update`in e&&`render`in e&&`raw`in e,c=e=>(0,n.markRaw)((0,n.defineComponent)({name:`IntlayerLeaf`,setup(){return()=>{let t=e();return t==null?null:o(t)?(0,n.h)(t):Array.isArray(t)?(0,n.h)(`span`,t):t}}})),l=e=>new Proxy({},{get(t,n){let r=e.value;if(n===`__v_isRef`)return!0;if(n===`value`)return r??``;if(n===`$raw`)return e;if(n===`__v_skip`)return!0;if(n===`c`||n===`asComponent`)return c(()=>e.value);if(r==null)return n===Symbol.toPrimitive||n===`toString`?()=>``:void 0;let i=r[n];return typeof i==`function`?i.bind(r):i},ownKeys(){let t=e.value;return typeof t==`object`&&t?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}}),u=(u,d)=>{let f=(0,n.getCurrentInstance)()?(0,n.inject)(t.INTLAYER_SYMBOL):void 0,p=(0,n.isRef)(f?.locale)?f.locale:(0,n.ref)(f?.locale??r.internationalization.defaultLocale),m=(0,n.computed)(()=>{let e=d===void 0?void 0:(0,n.toValue)(d);if(typeof e==`object`&&e){let t=e;return{selector:t,locale:t.locale}}return{selector:void 0,locale:e}}),h=(0,n.computed)(()=>m.value.locale??p.value),g=(0,n.shallowRef)({});(0,n.watch)([()=>(0,n.toValue)(u),()=>h.value,()=>m.value.selector],([t,n,r])=>{g.value=r?e.getDictionary(t,{...r,locale:n}):e.getDictionary(t,n)},{immediate:!0,flush:`sync`});let _=e=>new Proxy({},{get(t,r,u){if(r===`__v_isRef`)return!0;let d=(0,n.computed)(()=>i(g.value,e));if(r===`value`)return d.value??``;if(r===`then`)return;if(r===`c`||r===`asComponent`)return c(()=>d.value);if(r===`$raw`)return d;if(r===Symbol.toPrimitive)return()=>d.value;let f=e.concat(r),p=i(g.value,f);if(p===void 0||a(p)&&!o(p))return _(f);if(s(p))return l((0,n.computed)(()=>i(g.value,f)));let m=(0,n.computed)(()=>i(g.value,f));return new Proxy(m,{get(e,t,n){return t===`value`?e.value??``:Reflect.get(e,t,n)}})},ownKeys(){let t=i(g.value,e);return a(t)?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return _([])};exports.atPath=i,exports.createIntlayerLeafProxy=l,exports.isComponentLike=o,exports.isIntlayerNode=s,exports.isObjectLike=a,exports.toComponent=c,exports.useDictionary=u;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./useDictionaryAsync.cjs");var
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getDictionary.cjs"),t=require("./installIntlayer.cjs"),n=require("./useDictionaryAsync.cjs");let r=require("vue"),i=require("@intlayer/config/built"),a=require("@intlayer/core/dictionaryManipulator");var o=async(o,s,c)=>{if((0,a.isQualifiedDynamicLoaderMap)(o)){let n=(0,r.inject)(t.INTLAYER_SYMBOL),{locale:l,selector:u}=(0,a.parseDictionarySelector)((c===void 0?void 0:(0,r.toValue)(c))??void 0),d=l??n?.locale?.value??i.internationalization.defaultLocale;return(0,a.resolveQualifiedDynamicContentAsync)({loaderMap:o,key:String(s),locale:d,selector:u,transform:t=>e.getDictionary(t,d)})}return n.useDictionaryAsync(o,c)};exports.useDictionaryDynamic=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getIntlayer.cjs"),t=require("./installIntlayer.cjs"),n=require("./useDictionary.cjs");let r=require("vue"),i=require("@intlayer/config/built");var a=(a,o)=>{let s=(0,r.inject)(t.INTLAYER_SYMBOL),c=(0,r.isRef)(s?.locale)?s.locale:(0,r.ref)(s?.locale??i.internationalization.defaultLocale),l=(0,r.computed)(()=>
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../getIntlayer.cjs"),t=require("./installIntlayer.cjs"),n=require("./useDictionary.cjs");let r=require("vue"),i=require("@intlayer/config/built");var a=(a,o)=>{let s=(0,r.inject)(t.INTLAYER_SYMBOL),c=(0,r.isRef)(s?.locale)?s.locale:(0,r.ref)(s?.locale??i.internationalization.defaultLocale),l=(0,r.computed)(()=>{let e=o===void 0?void 0:(0,r.toValue)(o);if(typeof e==`object`&&e){let t=e;return{selector:t,locale:t.locale}}return{selector:void 0,locale:e}}),u=(0,r.computed)(()=>l.value.locale??c.value),d=(0,r.shallowRef)({});(0,r.watch)([()=>(0,r.toValue)(a),()=>u.value,()=>l.value.selector],([t,n,r])=>{d.value=r?e.getIntlayer(t,{...r,locale:n}):e.getIntlayer(t,n)},{immediate:!0,flush:`sync`});let f=new Map,p=e=>{let t=e.join(`.`);if(f.has(t))return f.get(t);let i=(0,r.computed)(()=>n.atPath(d.value,e)),a=new Proxy({},{get(t,a,o){if(typeof a==`symbol`||typeof a==`string`&&(a.startsWith(`__`)||a.startsWith(`$`)))return a===`__v_isRef`?!0:a===`then`?void 0:Reflect.get(t,a,o);if(a===`value`)return i.value??``;if(a===`c`||a===`asComponent`)return n.toComponent(()=>i.value);if(a===`$raw`)return i;if(a===Symbol.toPrimitive)return()=>String(i.value??``);let s=e.concat(a),c=n.atPath(d.value,s);if(c===void 0||n.isObjectLike(c)&&!n.isComponentLike(c))return p(s);if(n.isIntlayerNode(c))return n.createIntlayerLeafProxy((0,r.computed)(()=>n.atPath(d.value,s)));let l=(0,r.computed)(()=>n.atPath(d.value,s));return new Proxy(l,{get(e,t,n){return t===`value`?e.value??``:t===`__v_isRef`?!0:Reflect.get(e,t,n)}})},ownKeys(){let t=n.atPath(d.value,e);return n.isObjectLike(t)?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return f.set(t,a),a};return p([])};exports.useIntlayer=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../plugins-2fO7C0IX.js");let t=require("@intlayer/core/interpreter");var n=(n,r)=>(0,t.getDictionary)(n,r,e.t(r));exports.getDictionary=n;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../plugins-2fO7C0IX.js");let t=require("@intlayer/core/interpreter");var n=(n,r)=>(0,t.getDictionary)(n,r,e.t(typeof r==`object`&&r?r.locale:r));exports.getDictionary=n;
|
package/dist/cjs/getIntlayer.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../plugins-2fO7C0IX.js");let t=require("@intlayer/core/interpreter");var n=(n,r)=>(0,t.getIntlayer)(n,r,e.t(r));exports.getIntlayer=n;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../plugins-2fO7C0IX.js");let t=require("@intlayer/core/interpreter");var n=(n,r)=>(0,t.getIntlayer)(n,r,e.t(typeof r==`object`&&r?r.locale:r));exports.getIntlayer=n;
|
|
@@ -34,32 +34,52 @@ var m = (e, t) => t.reduce((e, t) => e?.[t], e), h = (e) => typeof e == "object"
|
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
36
|
}), b = (r, a) => {
|
|
37
|
-
let c = i() ? o(t) : void 0, b = s(c?.locale) ? c.locale : l(c?.locale ?? p.defaultLocale), x = n(() =>
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
let c = i() ? o(t) : void 0, b = s(c?.locale) ? c.locale : l(c?.locale ?? p.defaultLocale), x = n(() => {
|
|
38
|
+
let e = a === void 0 ? void 0 : d(a);
|
|
39
|
+
if (typeof e == "object" && e) {
|
|
40
|
+
let t = e;
|
|
41
|
+
return {
|
|
42
|
+
selector: t,
|
|
43
|
+
locale: t.locale
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
selector: void 0,
|
|
48
|
+
locale: e
|
|
49
|
+
};
|
|
50
|
+
}), S = n(() => x.value.locale ?? b.value), C = u({});
|
|
51
|
+
f([
|
|
52
|
+
() => d(r),
|
|
53
|
+
() => S.value,
|
|
54
|
+
() => x.value.selector
|
|
55
|
+
], ([t, n, r]) => {
|
|
56
|
+
C.value = r ? e(t, {
|
|
57
|
+
...r,
|
|
58
|
+
locale: n
|
|
59
|
+
}) : e(t, n);
|
|
40
60
|
}, {
|
|
41
61
|
immediate: !0,
|
|
42
62
|
flush: "sync"
|
|
43
63
|
});
|
|
44
|
-
let
|
|
64
|
+
let w = (e) => new Proxy({}, {
|
|
45
65
|
get(t, r, i) {
|
|
46
66
|
if (r === "__v_isRef") return !0;
|
|
47
|
-
let a = n(() => m(
|
|
67
|
+
let a = n(() => m(C.value, e));
|
|
48
68
|
if (r === "value") return a.value ?? "";
|
|
49
69
|
if (r === "then") return;
|
|
50
70
|
if (r === "c" || r === "asComponent") return v(() => a.value);
|
|
51
71
|
if (r === "$raw") return a;
|
|
52
72
|
if (r === Symbol.toPrimitive) return () => a.value;
|
|
53
|
-
let o = e.concat(r), s = m(
|
|
54
|
-
if (s === void 0 || h(s) && !g(s)) return
|
|
55
|
-
if (_(s)) return y(n(() => m(
|
|
56
|
-
let c = n(() => m(
|
|
73
|
+
let o = e.concat(r), s = m(C.value, o);
|
|
74
|
+
if (s === void 0 || h(s) && !g(s)) return w(o);
|
|
75
|
+
if (_(s)) return y(n(() => m(C.value, o)));
|
|
76
|
+
let c = n(() => m(C.value, o));
|
|
57
77
|
return new Proxy(c, { get(e, t, n) {
|
|
58
78
|
return t === "value" ? e.value ?? "" : Reflect.get(e, t, n);
|
|
59
79
|
} });
|
|
60
80
|
},
|
|
61
81
|
ownKeys() {
|
|
62
|
-
let t = m(
|
|
82
|
+
let t = m(C.value, e);
|
|
63
83
|
return h(t) ? Reflect.ownKeys(t) : [];
|
|
64
84
|
},
|
|
65
85
|
getOwnPropertyDescriptor() {
|
|
@@ -69,7 +89,7 @@ var m = (e, t) => t.reduce((e, t) => e?.[t], e), h = (e) => typeof e == "object"
|
|
|
69
89
|
};
|
|
70
90
|
}
|
|
71
91
|
});
|
|
72
|
-
return
|
|
92
|
+
return w([]);
|
|
73
93
|
};
|
|
74
94
|
//#endregion
|
|
75
95
|
export { m as atPath, y as createIntlayerLeafProxy, g as isComponentLike, _ as isIntlayerNode, h as isObjectLike, v as toComponent, b as useDictionary };
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getDictionary as e } from "../getDictionary.mjs";
|
|
2
|
+
import { INTLAYER_SYMBOL as t } from "./installIntlayer.mjs";
|
|
3
|
+
import { useDictionaryAsync as n } from "./useDictionaryAsync.mjs";
|
|
4
|
+
import { inject as r, toValue as i } from "vue";
|
|
5
|
+
import { internationalization as a } from "@intlayer/config/built";
|
|
6
|
+
import { isQualifiedDynamicLoaderMap as o, parseDictionarySelector as s, resolveQualifiedDynamicContentAsync as c } from "@intlayer/core/dictionaryManipulator";
|
|
2
7
|
//#region src/client/useDictionaryDynamic.ts
|
|
3
|
-
var
|
|
8
|
+
var l = async (l, u, d) => {
|
|
9
|
+
if (o(l)) {
|
|
10
|
+
let n = r(t), { locale: o, selector: f } = s((d === void 0 ? void 0 : i(d)) ?? void 0), p = o ?? n?.locale?.value ?? a.defaultLocale;
|
|
11
|
+
return c({
|
|
12
|
+
loaderMap: l,
|
|
13
|
+
key: String(u),
|
|
14
|
+
locale: p,
|
|
15
|
+
selector: f,
|
|
16
|
+
transform: (t) => e(t, p)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return n(l, d);
|
|
20
|
+
};
|
|
4
21
|
//#endregion
|
|
5
|
-
export {
|
|
22
|
+
export { l as useDictionaryDynamic };
|
|
@@ -5,33 +5,53 @@ import { computed as c, inject as l, isRef as u, ref as d, shallowRef as f, toVa
|
|
|
5
5
|
import { internationalization as h } from "@intlayer/config/built";
|
|
6
6
|
//#region src/client/useIntlayer.ts
|
|
7
7
|
var g = (g, _) => {
|
|
8
|
-
let v = l(t), y = u(v?.locale) ? v.locale : d(v?.locale ?? h.defaultLocale), b = c(() =>
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
let v = l(t), y = u(v?.locale) ? v.locale : d(v?.locale ?? h.defaultLocale), b = c(() => {
|
|
9
|
+
let e = _ === void 0 ? void 0 : p(_);
|
|
10
|
+
if (typeof e == "object" && e) {
|
|
11
|
+
let t = e;
|
|
12
|
+
return {
|
|
13
|
+
selector: t,
|
|
14
|
+
locale: t.locale
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
selector: void 0,
|
|
19
|
+
locale: e
|
|
20
|
+
};
|
|
21
|
+
}), x = c(() => b.value.locale ?? y.value), S = f({});
|
|
22
|
+
m([
|
|
23
|
+
() => p(g),
|
|
24
|
+
() => x.value,
|
|
25
|
+
() => b.value.selector
|
|
26
|
+
], ([t, n, r]) => {
|
|
27
|
+
S.value = r ? e(t, {
|
|
28
|
+
...r,
|
|
29
|
+
locale: n
|
|
30
|
+
}) : e(t, n);
|
|
11
31
|
}, {
|
|
12
32
|
immediate: !0,
|
|
13
33
|
flush: "sync"
|
|
14
34
|
});
|
|
15
|
-
let
|
|
35
|
+
let C = /* @__PURE__ */ new Map(), w = (e) => {
|
|
16
36
|
let t = e.join(".");
|
|
17
|
-
if (
|
|
18
|
-
let l = c(() => n(
|
|
37
|
+
if (C.has(t)) return C.get(t);
|
|
38
|
+
let l = c(() => n(S.value, e)), u = new Proxy({}, {
|
|
19
39
|
get(t, u, d) {
|
|
20
40
|
if (typeof u == "symbol" || typeof u == "string" && (u.startsWith("__") || u.startsWith("$"))) return u === "__v_isRef" ? !0 : u === "then" ? void 0 : Reflect.get(t, u, d);
|
|
21
41
|
if (u === "value") return l.value ?? "";
|
|
22
42
|
if (u === "c" || u === "asComponent") return s(() => l.value);
|
|
23
43
|
if (u === "$raw") return l;
|
|
24
44
|
if (u === Symbol.toPrimitive) return () => String(l.value ?? "");
|
|
25
|
-
let f = e.concat(u), p = n(
|
|
26
|
-
if (p === void 0 || o(p) && !i(p)) return
|
|
27
|
-
if (a(p)) return r(c(() => n(
|
|
28
|
-
let m = c(() => n(
|
|
45
|
+
let f = e.concat(u), p = n(S.value, f);
|
|
46
|
+
if (p === void 0 || o(p) && !i(p)) return w(f);
|
|
47
|
+
if (a(p)) return r(c(() => n(S.value, f)));
|
|
48
|
+
let m = c(() => n(S.value, f));
|
|
29
49
|
return new Proxy(m, { get(e, t, n) {
|
|
30
50
|
return t === "value" ? e.value ?? "" : t === "__v_isRef" ? !0 : Reflect.get(e, t, n);
|
|
31
51
|
} });
|
|
32
52
|
},
|
|
33
53
|
ownKeys() {
|
|
34
|
-
let t = n(
|
|
54
|
+
let t = n(S.value, e);
|
|
35
55
|
return o(t) ? Reflect.ownKeys(t) : [];
|
|
36
56
|
},
|
|
37
57
|
getOwnPropertyDescriptor() {
|
|
@@ -41,9 +61,9 @@ var g = (g, _) => {
|
|
|
41
61
|
};
|
|
42
62
|
}
|
|
43
63
|
});
|
|
44
|
-
return
|
|
64
|
+
return C.set(t, u), u;
|
|
45
65
|
};
|
|
46
|
-
return
|
|
66
|
+
return w([]);
|
|
47
67
|
};
|
|
48
68
|
//#endregion
|
|
49
69
|
export { g as useIntlayer };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getPlugins as e } from "./plugins.mjs";
|
|
2
2
|
import { getDictionary as t } from "@intlayer/core/interpreter";
|
|
3
3
|
//#region src/getDictionary.ts
|
|
4
|
-
var n = (n, r) => t(n, r, e(r));
|
|
4
|
+
var n = (n, r) => t(n, r, e(typeof r == "object" && r ? r.locale : r));
|
|
5
5
|
//#endregion
|
|
6
6
|
export { n as getDictionary };
|
package/dist/esm/getIntlayer.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getPlugins as e } from "./plugins.mjs";
|
|
2
2
|
import { getIntlayer as t } from "@intlayer/core/interpreter";
|
|
3
3
|
//#region src/getIntlayer.ts
|
|
4
|
-
var n = (n, r) => t(n, r, e(r));
|
|
4
|
+
var n = (n, r) => t(n, r, e(typeof r == "object" && r ? r.locale : r));
|
|
5
5
|
//#endregion
|
|
6
6
|
export { n as getIntlayer };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
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,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));const c=require("./cjs/html/HTMLRenderer.cjs"),l=require("./cjs/markdown/installIntlayerMarkdown.cjs"),u=require("./cjs/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("vue");var g=process.env.INTLAYER_EDITOR_ENABLED===`false`?null:(0,h.defineAsyncComponent)(()=>Promise.resolve().then(()=>require("./cjs/editor/ContentSelector.cjs"))),_={id:`intlayer-node-plugin`,canHandle:e=>typeof e==`bigint`||typeof e==`string`||typeof e==`number`,transform:(e,{children:t,...n})=>{let r=e=>u.renderIntlayerNode({...n,value:e,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?()=>(0,h.h)(g,{dictionaryKey:n.dictionaryKey,keyPath:n.keyPath},{default:()=>typeof e==`function`?e():e}):e}),i=r(t);if(typeof t!=`function`)return i;let a=(...e)=>r(t(...e));Object.setPrototypeOf(a,Object.getPrototypeOf(i));for(let e of Object.getOwnPropertyNames(i)){let t=Object.getOwnPropertyDescriptor(i,e);t&&Object.defineProperty(a,e,t)}for(let e of Object.getOwnPropertySymbols(i)){let t=Object.getOwnPropertyDescriptor(i,e);t&&Object.defineProperty(a,e,t)}return(0,h.markRaw)(a)}},v=(e,t)=>{let n=new Map,r={};for(let[e,i]of Object.entries(t))typeof i==`string`||typeof i==`number`?r[e]=i:(n.set(e,i),r[e]=`__VNODE_${e}__`);let i=(0,d.splitInsertionTemplate)(e,r);if(n.size>0){let e=[];if(i.isSimple){let t=i.parts,r=0;for(let[i]of n){let a=`__VNODE_${i}__`,o=t.indexOf(a);o!==-1&&(o>r&&e.push(t.substring(r,o)),e.push(n.get(i)),r=o+a.length)}return r<t.length&&e.push(t.substring(r)),(0,h.h)(h.Fragment,null,...e)}else return i.parts.forEach(t=>{if(typeof t==`string`){let r=t;for(let[t]of n){let i=`__VNODE_${t}__`,a=r.indexOf(i);a!==-1&&(a>0&&e.push(r.substring(0,a)),e.push(n.get(t)),r=r.substring(a+i.length))}r.length>0&&e.push(r)}else e.push(t)}),(0,h.h)(h.Fragment,null,...e)}return i.isSimple?i.parts:(0,h.h)(h.Fragment,null,i.parts)},y=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`,transform:(e,n,r)=>{let i=r(e,{...n,children:e,plugins:[...(t.plugins??[]).filter(e=>e.id!==`intlayer-node-plugin`)]});return e=>{let a=v(i,e);return r(a,{...n,plugins:t.plugins,children:a})}}};return n(i,{...t,children:i,keyPath:r,plugins:[a,...t.plugins??[]]})}},b=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,a=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:[]}),o=n=>u.renderIntlayerNode({...t,value:e,children:()=>{let{renderMarkdown:t,components:r}=l.useMarkdown(),a=t(e,void 0,{...r??{},...n??{}});return process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?(0,h.h)(g,{dictionaryKey:i.dictionaryKey,keyPath:i.keyPath},{default:()=>a}):a},additionalProps:{metadata:a,use:e=>o(e)}});return o()}},x=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:[b,...t.plugins??[]]})}},S=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];e.tags;let r=(e={})=>{let i=c.renderHTML(n,{components:e});return u.renderIntlayerNode({...t,value:n,children:process.env.INTLAYER_EDITOR_ENABLED!==`false`&&f.editor.enabled?()=>(0,h.h)(g,{dictionaryKey:t.dictionaryKey,keyPath:t.keyPath,...e},{default:()=>i}):i,additionalProps:{use:e=>r(e)}})};return r()}},C=new Map,w=(e,t=!0)=>{let n=`${e??f.internationalization.defaultLocale}_${t}`;if(C.has(n))return C.get(n);let r=[(0,d.translationPlugin)(e??f.internationalization.defaultLocale,t?f.internationalization.defaultLocale:void 0),d.enumerationPlugin,(0,d.pluralPlugin)(e??f.internationalization.defaultLocale),d.conditionPlugin,(0,d.nestedPlugin)(e??f.internationalization.defaultLocale),d.filePlugin,d.genderPlugin,_,y,x,S];return C.set(n,r),r};Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return _}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return b}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return w}});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Dictionary } from '@intlayer/types/dictionary';
|
|
2
|
-
import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
1
|
+
import { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from '@intlayer/types/dictionary';
|
|
2
|
+
import { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
3
3
|
import { ComputedRef, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
import { DeepTransformContent } from '../plugins';
|
|
5
5
|
export declare const atPath: (obj: any, path: (string | number)[]) => any;
|
|
@@ -17,4 +17,4 @@ export declare const toComponent: (getter: () => any) => import('vue').Raw<impor
|
|
|
17
17
|
* - Passes through other IntlayerNode properties (render, toString, etc.)
|
|
18
18
|
*/
|
|
19
19
|
export declare const createIntlayerLeafProxy: (leafRef: ComputedRef<any>) => any;
|
|
20
|
-
export declare const useDictionary: <const T extends Dictionary, const
|
|
20
|
+
export declare const useDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: MaybeRefOrGetter<T>, localeOrSelector?: MaybeRefOrGetter<A | null | undefined>) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>;
|
|
@@ -6,4 +6,4 @@ import { MaybeRefOrGetter } from 'vue';
|
|
|
6
6
|
*
|
|
7
7
|
* If the locale is not provided, it will use the locale from the client context
|
|
8
8
|
*/
|
|
9
|
-
export declare const useDictionaryAsync: <const T extends Dictionary>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: MaybeRefOrGetter<LocalesValues>) => Promise<
|
|
9
|
+
export declare const useDictionaryAsync: <const T extends Dictionary>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>>, locale?: MaybeRefOrGetter<LocalesValues>) => Promise<unknown>;
|
|
@@ -1,9 +1,15 @@
|
|
|
1
|
+
import { QualifiedDynamicLoaderMap } from '@intlayer/core/dictionaryManipulator';
|
|
1
2
|
import { Dictionary } from '@intlayer/types/dictionary';
|
|
2
|
-
import { DictionaryKeys, LocalesValues, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
|
|
3
|
+
import { DictionaryKeys, DictionarySelectorForKey, LocalesValues, StrictModeLocaleMap } from '@intlayer/types/module_augmentation';
|
|
3
4
|
import { MaybeRefOrGetter } from 'vue';
|
|
4
5
|
/**
|
|
5
|
-
*
|
|
6
|
+
* Lazily loads a dictionary (plain or qualified) and returns its content.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
+
* For a qualified loader map (collection / variant / meta record, possibly
|
|
9
|
+
* combined), only the chunk(s) the selector targets are awaited and resolved.
|
|
10
|
+
* For a plain loader map, the locale chunk is awaited and made reactive.
|
|
11
|
+
*
|
|
12
|
+
* If the locale is not provided (directly or through the selector), it will use
|
|
13
|
+
* the locale from the client context.
|
|
8
14
|
*/
|
|
9
|
-
export declare const useDictionaryDynamic: <const T extends Dictionary, const K extends DictionaryKeys>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T
|
|
15
|
+
export declare const useDictionaryDynamic: <const T extends Dictionary, const K extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<K> = LocalesValues>(dictionaryPromise: StrictModeLocaleMap<() => Promise<T>> | QualifiedDynamicLoaderMap, key: K, localeOrSelector?: MaybeRefOrGetter<A | null | undefined>) => Promise<any>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DictionaryKeys,
|
|
1
|
+
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySelectorForKey, ExtractSelectorLocale, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
2
2
|
import { MaybeRefOrGetter } from 'vue';
|
|
3
3
|
import { DeepTransformContent } from '../plugins';
|
|
4
4
|
/**
|
|
@@ -24,4 +24,4 @@ import { DeepTransformContent } from '../plugins';
|
|
|
24
24
|
* </template>
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
|
-
export declare const useIntlayer: <const T extends DictionaryKeys>(key: T,
|
|
27
|
+
export declare const useIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: MaybeRefOrGetter<A | null | undefined>) => DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import { Dictionary } from '@intlayer/types/dictionary';
|
|
2
|
-
import { DeclaredLocales, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
1
|
+
import { Dictionary, DictionarySelectorForGroup, QualifiedDictionaryGroup, ResolveQualifiedDictionaryContent } from '@intlayer/types/dictionary';
|
|
2
|
+
import { DeclaredLocales, ExtractSelectorLocale, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
3
3
|
import { DeepTransformContent } from './plugins';
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Transforms a dictionary (or qualified dictionary group) and returns its
|
|
6
|
+
* content for the given locale or selector (`{ item }`, `{ variant }`,
|
|
7
|
+
* `{ id, ...meta }`, optionally combined with `locale`).
|
|
8
|
+
*/
|
|
9
|
+
export declare const getDictionary: <const T extends Dictionary | QualifiedDictionaryGroup, const A extends LocalesValues | DictionarySelectorForGroup<T> = DeclaredLocales>(dictionary: T, localeOrSelector?: A) => DeepTransformContent<ResolveQualifiedDictionaryContent<T, A>, ExtractSelectorLocale<A>>;
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
import { DeclaredLocales, DictionaryKeys,
|
|
1
|
+
import { DeclaredLocales, DictionaryKeys, DictionaryRegistryResult, DictionarySelectorForKey, ExtractSelectorLocale, LocalesValues } from '@intlayer/types/module_augmentation';
|
|
2
2
|
import { DeepTransformContent } from './plugins';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Picks one dictionary by its key and returns its content for the given
|
|
5
|
+
* locale or selector (`{ item }`, `{ variant }`, `{ id, ...meta }`,
|
|
6
|
+
* optionally combined with `locale`).
|
|
7
|
+
*/
|
|
8
|
+
export declare const getIntlayer: <const T extends DictionaryKeys, const A extends LocalesValues | DictionarySelectorForKey<T> = DeclaredLocales>(key: T, localeOrSelector?: A) => DeepTransformContent<DictionaryRegistryResult<T, A>, ExtractSelectorLocale<A>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-intlayer",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-canary.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your Vue applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -102,14 +102,14 @@
|
|
|
102
102
|
"typecheck": "vue-tsc --noEmit --project tsconfig.types.json"
|
|
103
103
|
},
|
|
104
104
|
"dependencies": {
|
|
105
|
-
"@intlayer/api": "
|
|
106
|
-
"@intlayer/config": "
|
|
107
|
-
"@intlayer/core": "
|
|
108
|
-
"@intlayer/editor": "
|
|
109
|
-
"@intlayer/types": "
|
|
105
|
+
"@intlayer/api": "9.0.0-canary.0",
|
|
106
|
+
"@intlayer/config": "9.0.0-canary.0",
|
|
107
|
+
"@intlayer/core": "9.0.0-canary.0",
|
|
108
|
+
"@intlayer/editor": "9.0.0-canary.0",
|
|
109
|
+
"@intlayer/types": "9.0.0-canary.0"
|
|
110
110
|
},
|
|
111
111
|
"devDependencies": {
|
|
112
|
-
"@types/node": "25.9.
|
|
112
|
+
"@types/node": "25.9.3",
|
|
113
113
|
"@utils/ts-config": "1.0.4",
|
|
114
114
|
"@utils/ts-config-types": "1.0.4",
|
|
115
115
|
"@utils/tsdown-config": "1.0.4",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"vue-tsc": "3.1.8"
|
|
126
126
|
},
|
|
127
127
|
"peerDependencies": {
|
|
128
|
-
"intlayer": "
|
|
128
|
+
"intlayer": "9.0.0-canary.0",
|
|
129
129
|
"vue": ">=3.0.0"
|
|
130
130
|
},
|
|
131
131
|
"peerDependenciesMeta": {
|