@symbiotejs/symbiote 3.4.4 → 3.4.5
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/CHANGELOG.md +6 -0
- package/core/PubSub.js +30 -4
- package/package.json +1 -1
- package/types/core/PubSub.d.ts +1 -0
- package/types/core/PubSub.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.4.5
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **PubSub: computed properties with cross-context deps no longer depend on import order.** When a computed property declared `deps: ['CTX/prop']` and the target context wasn't registered yet, the subscription was silently skipped. Now deferred deps are stored in `PubSub.pendingDeps` and automatically resolved when `registerCtx()` is called.
|
|
8
|
+
|
|
3
9
|
## 3.4.4
|
|
4
10
|
|
|
5
11
|
### Fixed
|
package/core/PubSub.js
CHANGED
|
@@ -120,10 +120,24 @@ export class PubSub {
|
|
|
120
120
|
let extCtx = PubSub.getCtx(ctxName, false);
|
|
121
121
|
|
|
122
122
|
if (!extCtx) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
// Defer: will resolve when the context is registered
|
|
124
|
+
if (!PubSub.pendingDeps.has(ctxName)) {
|
|
125
|
+
PubSub.pendingDeps.set(ctxName, []);
|
|
126
|
+
}
|
|
127
|
+
PubSub.pendingDeps.get(ctxName).push(() => {
|
|
128
|
+
let resolvedCtx = PubSub.getCtx(ctxName, false);
|
|
129
|
+
if (!resolvedCtx) return;
|
|
130
|
+
let sub = resolvedCtx.sub(propName, () => {
|
|
131
|
+
this.#recalcComputed(compProp);
|
|
132
|
+
}, false);
|
|
133
|
+
if (sub) {
|
|
134
|
+
if (!this.#externalSubs[compProp]) {
|
|
135
|
+
this.#externalSubs[compProp] = [];
|
|
136
|
+
}
|
|
137
|
+
this.#externalSubs[compProp].push(sub);
|
|
138
|
+
}
|
|
139
|
+
this.#recalcComputed(compProp);
|
|
140
|
+
});
|
|
127
141
|
continue;
|
|
128
142
|
}
|
|
129
143
|
|
|
@@ -366,6 +380,15 @@ export class PubSub {
|
|
|
366
380
|
data = new PubSub(schema);
|
|
367
381
|
data.uid = uid;
|
|
368
382
|
PubSub.globalStore.set(uid, data);
|
|
383
|
+
|
|
384
|
+
// Resolve deferred external deps waiting for this context:
|
|
385
|
+
let pending = PubSub.pendingDeps.get(uid);
|
|
386
|
+
if (pending) {
|
|
387
|
+
PubSub.pendingDeps.delete(uid);
|
|
388
|
+
for (let resolve of pending) {
|
|
389
|
+
resolve();
|
|
390
|
+
}
|
|
391
|
+
}
|
|
369
392
|
}
|
|
370
393
|
return data;
|
|
371
394
|
}
|
|
@@ -391,6 +414,9 @@ export class PubSub {
|
|
|
391
414
|
/** @type {Map<String | Symbol, PubSub>} */
|
|
392
415
|
PubSub.globalStore = globalThis.__SYMBIOTE_PUBSUB_STORE || (globalThis.__SYMBIOTE_PUBSUB_STORE = new Map());
|
|
393
416
|
|
|
417
|
+
/** @type {Map<String | Symbol, Array<Function>>} */
|
|
418
|
+
PubSub.pendingDeps = new Map();
|
|
419
|
+
|
|
394
420
|
/** @type {Boolean} */
|
|
395
421
|
PubSub.devMode = false;
|
|
396
422
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@symbiotejs/symbiote",
|
|
4
|
-
"version": "3.4.
|
|
4
|
+
"version": "3.4.5",
|
|
5
5
|
"description": "Symbiote.js - zero-dependency close-to-platform frontend library to build super-powered web components",
|
|
6
6
|
"author": "team@rnd-pro.com",
|
|
7
7
|
"license": "MIT",
|
package/types/core/PubSub.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PubSub.d.ts","sourceRoot":"","sources":["../../core/PubSub.js"],"names":[],"mappings":"AAgBA,oBADwC,CAAC,SAA1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE;IA2DrC,oDAFW,GAAC,kBAKX;
|
|
1
|
+
{"version":3,"file":"PubSub.d.ts","sourceRoot":"","sources":["../../core/PubSub.js"],"names":[],"mappings":"AAgBA,oBADwC,CAAC,SAA1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE;IA2DrC,oDAFW,GAAC,kBAKX;IAwSD,mBALuC,CAAC,SAA1B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,UAC3B,CAAC,QACD,SAAS,MAAM,GACb,MAAM,CAAC,CAAC,CAAC,CAsBrB;IAGD,sBADY,SAAS,MAAM,QAG1B;IAOD,mBAJW,SAAS,MAAM,iCASzB;IAhWD,oBADY,CAAC,EAWZ;IARG,WAA6B;IAO/B,aADW,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,EAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAChB;IAsIxC,WADY,MAAM,CAAC,OAqClB;IAzBK,sBAAuB;IA4B7B,uBAEC;IAOD,uBAHW,OAAO,2BASjB;IAMD,UAHW,MAAM,CAAC,OACP,OAAO,QAqBjB;IAGD,aADc,CAAC,CAed;IAGD,iBADY,CAAC,QAKZ;IAGD,aADY,MAAM,CAAC,kBAoBlB;IAOD,UAJW,MAAM,CAAC,YACP,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI;;wBAAhB,OAAO,KAAK,IAAI;MAwBhC;IAKD,aAFW,SAAS,MAAM,EAIzB;IAED,WANW,SAAS,MAAM,CAQzB;;CA8CF;;qBAEU,GAAG,CAAC,SAAS,MAAM,cAAS;qBAG5B,GAAG,CAAC,SAAS,MAAM,EAAE,KAAK,UAAU,CAAC"}
|