vue-intlayer 9.3.2 → 9.4.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/README.md CHANGED
@@ -327,4 +327,4 @@ Contribute on [GitHub](https://github.com/aymericzip/intlayer), [GitLab](https:/
327
327
 
328
328
  If you like Intlayer, give us a ⭐ on GitHub. It helps others discover the project! [See why GitHub Stars matter](https://github.com/aymericzip/intlayer/blob/main/CONTRIBUTING.md#why-github-stars-matter-).
329
329
 
330
- [![Star History Chart](https://api.star-history.com/svg?repos=aymericzip/intlayer&type=Date)](https://star-history.com/#aymericzip/intlayer&Date)
330
+ [![Star History Chart](https://star-history.dera.page/svg?repos=aymericzip/intlayer&type=Date)](https://star-history.dera.page/#aymericzip/intlayer&Date)
@@ -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"),i=require("@intlayer/core/dictionaryManipulator");var a=(e,t)=>t.reduce((e,t)=>e?.[t],e),o=e=>typeof e==`object`&&!!e,s=e=>typeof e==`function`||o(e)&&(`render`in e||`setup`in e),c=e=>e!=null&&(typeof e==`object`||typeof e==`function`)&&`__update`in e&&`render`in e&&`raw`in e,l=e=>(0,n.markRaw)((0,n.defineComponent)({name:`IntlayerLeaf`,setup(){return()=>{let t=e();return t==null?null:s(t)?(0,n.h)(t):Array.isArray(t)?(0,n.h)(`span`,t):t}}})),u=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 l(()=>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}}}),d=(d,f)=>{let p=(0,n.getCurrentInstance)()?(0,n.inject)(t.INTLAYER_SYMBOL):void 0,m=(0,n.isRef)(p?.locale)?p.locale:(0,n.ref)(p?.locale??r.internationalization.defaultLocale),h=(0,n.computed)(()=>{let e=f===void 0?void 0:(0,n.toValue)(f);if(process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`){let t=(0,i.resolveDictionaryArgument)({localeOrSelector:e,contextLocale:m.value,contextVariant:p?.variant?.value,dictionaryKey:(0,n.toValue)(d).key});return(0,i.parseDictionarySelector)(t)}return{selector:void 0,locale:e}}),g=(0,n.computed)(()=>h.value.locale??m.value),_=(0,n.shallowRef)({});(0,n.watch)([()=>(0,n.toValue)(d),()=>g.value,()=>h.value.selector],([t,n,r])=>{_.value=r?e.getDictionary(t,{...r,locale:n}):e.getDictionary(t,n)},{immediate:!0,flush:`sync`});let v=e=>new Proxy({},{get(t,r,i){if(r===`__v_isRef`)return!0;let d=(0,n.computed)(()=>a(_.value,e));if(r===`value`)return d.value??``;if(r===`then`)return;if(r===`c`||r===`asComponent`)return l(()=>d.value);if(r===`$raw`)return d;if(r===Symbol.toPrimitive)return()=>d.value;let f=e.concat(r),p=a(_.value,f);if(p===void 0||o(p)&&!s(p))return v(f);if(c(p))return u((0,n.computed)(()=>a(_.value,f)));if(typeof p==`function`){let t=a(_.value,e);return t!=null&&!Object.hasOwn(t,r)?p.bind(t):(...e)=>a(_.value,f)?.(...e)}let m=(0,n.computed)(()=>a(_.value,f));return new Proxy(m,{get(e,t,n){return t===`value`?e.value??``:Reflect.get(e,t,n)}})},ownKeys(){let t=a(_.value,e);return o(t)?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return v([])};exports.atPath=a,exports.createIntlayerLeafProxy=u,exports.isComponentLike=s,exports.isIntlayerNode=c,exports.isObjectLike=o,exports.toComponent=l,exports.useDictionary=d;
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"),i=require("@intlayer/core/dictionaryManipulator");var a=(e,t)=>t.reduce((e,t)=>e?.[t],e),o=e=>typeof e==`object`&&!!e,s=e=>typeof e==`function`||o(e)&&(`render`in e||`setup`in e),c=e=>e!=null&&(typeof e==`object`||typeof e==`function`)&&`__update`in e&&`render`in e&&`raw`in e,l=e=>(0,n.markRaw)((0,n.defineComponent)({name:`IntlayerLeaf`,setup(){return()=>{let t=e();return t==null?null:s(t)?(0,n.h)(t):Array.isArray(t)?(0,n.h)(`span`,t):t}}})),u=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 l(()=>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}}}),d=(d,f)=>{let p=(0,n.getCurrentInstance)()?(0,n.inject)(t.INTLAYER_SYMBOL):void 0,m=(0,n.isRef)(p?.locale)?p.locale:(0,n.ref)(p?.locale??r.internationalization.defaultLocale),h=(0,n.computed)(()=>{let e=f===void 0?void 0:(0,n.toValue)(f);if(process.env.INTLAYER_DICTIONARY_SELECTOR!==`false`){let t=(0,i.resolveDictionaryArgument)({localeOrSelector:e,contextLocale:m.value,contextVariant:p?.variant?.value,dictionaryKey:(0,n.toValue)(d).key});return(0,i.parseDictionarySelector)(t)}return{selector:void 0,locale:e}}),g=(0,n.computed)(()=>h.value.locale??m.value),_=(0,n.shallowRef)({});(0,n.watch)([()=>(0,n.toValue)(d),()=>g.value,()=>h.value.selector],([t,n,r])=>{_.value=r?e.getDictionary(t,{...r,locale:n}):e.getDictionary(t,n)},{immediate:!0,flush:`sync`});let v=e=>new Proxy({},{get(t,r,i){let d=(0,n.computed)(()=>a(_.value,e));if(typeof r==`symbol`||typeof r==`string`&&(r.startsWith(`__`)||r.startsWith(`$`)))return r===`__v_isRef`?!0:r===`$raw`?d:r===Symbol.toPrimitive?()=>String(d.value??``):Reflect.get(t,r,i);if(r===`value`)return d.value??``;if(r===`then`)return;if(r===`c`||r===`asComponent`)return l(()=>d.value);let f=e.concat(r),p=a(_.value,f);if(p===void 0||o(p)&&!s(p))return v(f);if(c(p))return u((0,n.computed)(()=>a(_.value,f)));if(typeof p==`function`){let t=a(_.value,e);return t!=null&&!Object.hasOwn(t,r)?p.bind(t):(...e)=>a(_.value,f)?.(...e)}let m=(0,n.computed)(()=>a(_.value,f));return new Proxy(m,{get(e,t,n){return t===`value`?e.value??``:Reflect.get(e,t,n)}})},ownKeys(){let t=a(_.value,e);return o(t)?Reflect.ownKeys(t):[]},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}}});return v([])};exports.atPath=a,exports.createIntlayerLeafProxy=u,exports.isComponentLike=s,exports.isIntlayerNode=c,exports.isObjectLike=o,exports.toComponent=l,exports.useDictionary=d;
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./installIntlayer.cjs"),t=require("./useDictionary.cjs");let n=require("vue"),r=require("@intlayer/config/built");var i=async(i,a)=>{let o=(0,n.inject)(e.INTLAYER_SYMBOL),s=(0,n.computed)(()=>a??o?.locale?.value??r.internationalization.defaultLocale),c=(0,n.ref)(await i[s.value]?.());return(0,n.watch)(()=>s.value,async e=>{let t=await i[e]?.();t&&(c.value=t)}),t.useDictionary(c,s)};exports.useDictionaryAsync=i;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("./installIntlayer.cjs"),t=require("./useDictionary.cjs");let n=require("vue"),r=require("@intlayer/config/built"),i=require("@intlayer/core/dictionaryManipulator");var a=async(a,o)=>{let s=(0,n.inject)(e.INTLAYER_SYMBOL),c=(0,n.computed)(()=>o??s?.locale?.value??r.internationalization.defaultLocale),l=(0,i.getPreloadedDictionary)(a,c.value),u=(0,n.ref)(l??await a[c.value]?.());return(0,n.watch)(()=>c.value,async e=>{let t=await a[e]?.();t&&(u.value=t)}),t.useDictionary(u,c)};exports.useDictionaryAsync=a;
@@ -66,13 +66,11 @@ var g = (e, t) => t.reduce((e, t) => e?.[t], e), _ = (e) => typeof e == "object"
66
66
  });
67
67
  let E = (e) => new Proxy({}, {
68
68
  get(t, r, i) {
69
- if (r === "__v_isRef") return !0;
70
69
  let a = n(() => g(T.value, e));
70
+ if (typeof r == "symbol" || typeof r == "string" && (r.startsWith("__") || r.startsWith("$"))) return r === "__v_isRef" ? !0 : r === "$raw" ? a : r === Symbol.toPrimitive ? () => String(a.value ?? "") : Reflect.get(t, r, i);
71
71
  if (r === "value") return a.value ?? "";
72
72
  if (r === "then") return;
73
73
  if (r === "c" || r === "asComponent") return b(() => a.value);
74
- if (r === "$raw") return a;
75
- if (r === Symbol.toPrimitive) return () => a.value;
76
74
  let o = e.concat(r), s = g(T.value, o);
77
75
  if (s === void 0 || _(s) && !v(s)) return E(o);
78
76
  if (y(s)) return x(n(() => g(T.value, o)));
@@ -2,13 +2,14 @@ import { INTLAYER_SYMBOL as e } from "./installIntlayer.mjs";
2
2
  import { useDictionary as t } from "./useDictionary.mjs";
3
3
  import { computed as n, inject as r, ref as i, watch as a } from "vue";
4
4
  import { internationalization as o } from "@intlayer/config/built";
5
+ import { getPreloadedDictionary as s } from "@intlayer/core/dictionaryManipulator";
5
6
  //#region src/client/useDictionaryAsync.ts
6
- var s = async (s, c) => {
7
- let l = r(e), u = n(() => c ?? l?.locale?.value ?? o.defaultLocale), d = i(await s[u.value]?.());
8
- return a(() => u.value, async (e) => {
9
- let t = await s[e]?.();
10
- t && (d.value = t);
11
- }), t(d, u);
7
+ var c = async (c, l) => {
8
+ let u = r(e), d = n(() => l ?? u?.locale?.value ?? o.defaultLocale), f = s(c, d.value), p = i(f ?? await c[d.value]?.());
9
+ return a(() => d.value, async (e) => {
10
+ let t = await c[e]?.();
11
+ t && (p.value = t);
12
+ }), t(p, d);
12
13
  };
13
14
  //#endregion
14
- export { s as useDictionaryAsync };
15
+ export { c as useDictionaryAsync };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue-intlayer",
3
- "version": "9.3.2",
3
+ "version": "9.4.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,11 +102,11 @@
102
102
  "typecheck": "vue-tsc --noEmit --project tsconfig.types.json"
103
103
  },
104
104
  "dependencies": {
105
- "@intlayer/api": "9.3.2",
106
- "@intlayer/config": "9.3.2",
107
- "@intlayer/core": "9.3.2",
108
- "@intlayer/editor": "9.3.2",
109
- "@intlayer/types": "9.3.2"
105
+ "@intlayer/api": "9.4.0-canary.0",
106
+ "@intlayer/config": "9.4.0-canary.0",
107
+ "@intlayer/core": "9.4.0-canary.0",
108
+ "@intlayer/editor": "9.4.0-canary.0",
109
+ "@intlayer/types": "9.4.0-canary.0"
110
110
  },
111
111
  "devDependencies": {
112
112
  "@types/node": "26.2.0",
@@ -119,13 +119,13 @@
119
119
  "rimraf": "6.1.3",
120
120
  "tsdown": "0.22.14",
121
121
  "typescript": "7.0.2",
122
- "vite": "8.2.1",
122
+ "vite": "8.2.2",
123
123
  "vite-plugin-dts": "5.0.3",
124
- "vitest": "4.1.10",
124
+ "vitest": "4.1.11",
125
125
  "vue-tsc": "3.3.9"
126
126
  },
127
127
  "peerDependencies": {
128
- "intlayer": "9.3.2",
128
+ "intlayer": "9.4.0-canary.0",
129
129
  "vue": ">=3.0.0"
130
130
  },
131
131
  "peerDependenciesMeta": {
@@ -134,7 +134,7 @@
134
134
  }
135
135
  },
136
136
  "optionalDependencies": {
137
- "@intlayer/analytics": "9.3.2"
137
+ "@intlayer/analytics": "9.4.0-canary.0"
138
138
  },
139
139
  "engines": {
140
140
  "node": ">=14.18"