@pie-element/shared-i18n 0.1.2-next.20261019084117 → 0.1.2
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/index.js +5 -13
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -80,11 +80,7 @@ var d = class n {
|
|
|
80
80
|
}
|
|
81
81
|
async setLocale(e) {
|
|
82
82
|
let n = this.resolveLocaleTag(e);
|
|
83
|
-
|
|
84
|
-
this.locale = t(e) || "en-US", this.notify();
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
await this.ensureLoaded(n), this.locale = n, this.notify();
|
|
83
|
+
n ? (await this.ensureLoaded(n), this.locale = n, this.notify()) : (this.locale = t(e) || "en-US", this.notify());
|
|
88
84
|
}
|
|
89
85
|
t(e, t) {
|
|
90
86
|
let n = this.lookup(e);
|
|
@@ -239,7 +235,7 @@ function g(e, t) {
|
|
|
239
235
|
let n = { ...e };
|
|
240
236
|
for (let [e, r] of Object.entries(t)) {
|
|
241
237
|
let t = n[e];
|
|
242
|
-
r && typeof r == "object" && t && typeof t == "object" ?
|
|
238
|
+
n[e] = r && typeof r == "object" && t && typeof t == "object" ? g(t, r) : r;
|
|
243
239
|
}
|
|
244
240
|
return n;
|
|
245
241
|
}
|
|
@@ -378,11 +374,11 @@ var D = /* @__PURE__ */ new WeakSet(), O = (e, t) => typeof t == "object" && !!t
|
|
|
378
374
|
let t = e.context;
|
|
379
375
|
if (t === void 0) return;
|
|
380
376
|
let n = this.pendingByContext.get(t);
|
|
381
|
-
if (
|
|
377
|
+
if (n && n.requests.length !== 0) {
|
|
382
378
|
this.pendingByContext.delete(t);
|
|
383
379
|
for (let e of n.requests) {
|
|
384
380
|
let n = e.requestorRef.deref(), r = e.callbackRef.deref();
|
|
385
|
-
|
|
381
|
+
n && r && n.dispatchEvent(new k(t, n, r, !0));
|
|
386
382
|
}
|
|
387
383
|
}
|
|
388
384
|
};
|
|
@@ -420,11 +416,7 @@ var P = class {
|
|
|
420
416
|
return this.currentValue;
|
|
421
417
|
}
|
|
422
418
|
handleValue = (e, t) => {
|
|
423
|
-
|
|
424
|
-
t?.();
|
|
425
|
-
return;
|
|
426
|
-
}
|
|
427
|
-
t !== this.unsubscribe && (this.unsubscribe?.(), this.unsubscribe = t), !this.subscribe && this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.currentValue = e, this.onValue?.(e);
|
|
419
|
+
this.isDisconnected ? t?.() : (t !== this.unsubscribe && (this.unsubscribe?.(), this.unsubscribe = t), !this.subscribe && this.unsubscribe && (this.unsubscribe(), this.unsubscribe = void 0), this.currentValue = e, this.onValue?.(e));
|
|
428
420
|
};
|
|
429
421
|
requestValue() {
|
|
430
422
|
this.host.dispatchEvent(new k(this.context, this.host, this.handleValue, this.subscribe));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/shared-i18n",
|
|
3
|
-
"version": "0.1.2
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Interface-string i18n engine for PIE elements: typed per-package catalogs, lazy locales, RFC 4647 resolution",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|