sibujs 4.4.0 → 4.5.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 +11 -0
- package/dist/browser.cjs +31 -2
- package/dist/browser.d.cts +15 -2
- package/dist/browser.d.ts +15 -2
- package/dist/browser.js +4 -4
- package/dist/build.cjs +92 -13
- package/dist/build.js +10 -10
- package/dist/cdn.dev.global.js +9 -9
- package/dist/cdn.full.dev.global.js +10 -10
- package/dist/cdn.full.global.js +9 -9
- package/dist/cdn.global.js +9 -9
- package/dist/{chunk-XLO7SLIX.js → chunk-2DCGACUU.js} +16 -9
- package/dist/{chunk-6GSIXTWX.js → chunk-3JZ4L5TJ.js} +10 -4
- package/dist/{chunk-UCALUKB5.js → chunk-4PMLNECI.js} +4 -4
- package/dist/{chunk-RR7M3FHM.js → chunk-7LN645I6.js} +1 -1
- package/dist/{chunk-SKPTERHP.js → chunk-B3WHI2QA.js} +1 -1
- package/dist/{chunk-4Z3SPQ67.js → chunk-FTIR4QW2.js} +13 -3
- package/dist/{chunk-HFCOH2GN.js → chunk-GW3SCCZG.js} +4 -4
- package/dist/{chunk-PNIRUQ4C.js → chunk-KEISJXBU.js} +2 -2
- package/dist/{chunk-LYVUX7NT.js → chunk-OMJJM3KM.js} +2 -2
- package/dist/{chunk-VCTAEPSB.js → chunk-ONOHFDLG.js} +9 -1
- package/dist/{chunk-36S2YPP4.js → chunk-PCT43HW3.js} +1 -1
- package/dist/{chunk-W2EQ7X2L.js → chunk-RBTPLM32.js} +46 -8
- package/dist/{chunk-7GIHSAWB.js → chunk-RIXRAYIU.js} +1 -1
- package/dist/{chunk-HQSEH5F6.js → chunk-RJE2BNI4.js} +3 -3
- package/dist/{chunk-ADM46X22.js → chunk-S373NSMK.js} +18 -13
- package/dist/{chunk-M2F7TZHH.js → chunk-TBYTO6BS.js} +2 -2
- package/dist/{chunk-3BTTCZ5J.js → chunk-UGRX3S57.js} +31 -2
- package/dist/{chunk-7NBDXVHS.js → chunk-VUF4ALSW.js} +1 -1
- package/dist/{chunk-LQFGQNMV.js → chunk-VZKNK2V7.js} +9 -4
- package/dist/{chunk-NVNJH22U.js → chunk-XZZOBQAY.js} +1 -1
- package/dist/{customElement-CNZxEB9G.d.ts → customElement-OB9CIsc5.d.cts} +38 -10
- package/dist/{customElement-CNZxEB9G.d.cts → customElement-OB9CIsc5.d.ts} +38 -10
- package/dist/data.cjs +81 -9
- package/dist/data.js +6 -6
- package/dist/devtools.cjs +41 -2
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +83 -9
- package/dist/ecosystem.d.cts +13 -5
- package/dist/ecosystem.d.ts +13 -5
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +115 -14
- package/dist/extras.d.cts +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/extras.js +19 -19
- package/dist/index.cjs +92 -13
- package/dist/index.d.cts +24 -151
- package/dist/index.d.ts +24 -151
- package/dist/index.js +10 -10
- package/dist/motion.cjs +31 -2
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +81 -10
- package/dist/patterns.d.cts +5 -0
- package/dist/patterns.d.ts +5 -0
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +31 -2
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +39 -2
- package/dist/plugins.js +6 -6
- package/dist/ssr.cjs +39 -2
- package/dist/ssr.js +7 -7
- package/dist/tagFactory-DVoDpHye.d.cts +215 -0
- package/dist/tagFactory-DVoDpHye.d.ts +215 -0
- package/dist/testing.cjs +31 -2
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +93 -13
- package/dist/ui.d.cts +1 -1
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +6 -6
- package/dist/widgets.cjs +75 -9
- package/dist/widgets.js +6 -6
- package/package.json +2 -2
- package/dist/tagFactory-Bzupt4Pj.d.cts +0 -55
- package/dist/tagFactory-Bzupt4Pj.d.ts +0 -55
package/dist/data.cjs
CHANGED
|
@@ -295,6 +295,15 @@ function untracked(fn) {
|
|
|
295
295
|
var subscriberEpochCounter = 0;
|
|
296
296
|
function retrack(effectFn, subscriber) {
|
|
297
297
|
const prev = currentSubscriber;
|
|
298
|
+
let savedDepth = 0;
|
|
299
|
+
let savedSuspendSub = null;
|
|
300
|
+
if (trackingSuspended) {
|
|
301
|
+
savedDepth = suspendDepth;
|
|
302
|
+
savedSuspendSub = suspendSavedSub;
|
|
303
|
+
suspendDepth = 0;
|
|
304
|
+
suspendSavedSub = null;
|
|
305
|
+
trackingSuspended = false;
|
|
306
|
+
}
|
|
298
307
|
currentSubscriber = subscriber;
|
|
299
308
|
const sub = subscriber;
|
|
300
309
|
const epoch = ++subscriberEpochCounter;
|
|
@@ -309,6 +318,11 @@ function retrack(effectFn, subscriber) {
|
|
|
309
318
|
effectFn();
|
|
310
319
|
} finally {
|
|
311
320
|
currentSubscriber = prev;
|
|
321
|
+
if (savedDepth !== 0) {
|
|
322
|
+
suspendDepth = savedDepth;
|
|
323
|
+
suspendSavedSub = savedSuspendSub;
|
|
324
|
+
trackingSuspended = true;
|
|
325
|
+
}
|
|
312
326
|
let node = sub.depsHead ?? null;
|
|
313
327
|
while (node !== null) {
|
|
314
328
|
const next = node.subNext;
|
|
@@ -328,11 +342,25 @@ function track(effectFn, subscriber) {
|
|
|
328
342
|
if (!subscriber) return reactiveBinding(effectFn);
|
|
329
343
|
cleanup(subscriber);
|
|
330
344
|
const prev = currentSubscriber;
|
|
345
|
+
let savedDepth = 0;
|
|
346
|
+
let savedSuspendSub = null;
|
|
347
|
+
if (trackingSuspended) {
|
|
348
|
+
savedDepth = suspendDepth;
|
|
349
|
+
savedSuspendSub = suspendSavedSub;
|
|
350
|
+
suspendDepth = 0;
|
|
351
|
+
suspendSavedSub = null;
|
|
352
|
+
trackingSuspended = false;
|
|
353
|
+
}
|
|
331
354
|
currentSubscriber = subscriber;
|
|
332
355
|
try {
|
|
333
356
|
effectFn();
|
|
334
357
|
} finally {
|
|
335
358
|
currentSubscriber = prev;
|
|
359
|
+
if (savedDepth !== 0) {
|
|
360
|
+
suspendDepth = savedDepth;
|
|
361
|
+
suspendSavedSub = savedSuspendSub;
|
|
362
|
+
trackingSuspended = true;
|
|
363
|
+
}
|
|
336
364
|
const sub2 = subscriber;
|
|
337
365
|
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
338
366
|
const sig = n.sig;
|
|
@@ -503,8 +531,9 @@ function propagateDirty(sub) {
|
|
|
503
531
|
if (s._c) {
|
|
504
532
|
const nSig = s._sig;
|
|
505
533
|
if (nSig) {
|
|
506
|
-
if (!nSig._d) {
|
|
534
|
+
if (!nSig._d || nSig._f === true) {
|
|
507
535
|
nSig._d = true;
|
|
536
|
+
nSig._f = false;
|
|
508
537
|
stack.push(nSig);
|
|
509
538
|
}
|
|
510
539
|
} else {
|
|
@@ -604,7 +633,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
604
633
|
}
|
|
605
634
|
|
|
606
635
|
// src/reactivity/track.ts
|
|
607
|
-
var _runtimeVersion = true ? "4.
|
|
636
|
+
var _runtimeVersion = true ? "4.5.0" : "dev";
|
|
608
637
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
609
638
|
function resolveReactiveApi() {
|
|
610
639
|
const g = globalThis;
|
|
@@ -668,10 +697,14 @@ function derived(getter, options) {
|
|
|
668
697
|
const cs = {};
|
|
669
698
|
cs._d = false;
|
|
670
699
|
cs._init = false;
|
|
700
|
+
cs._f = false;
|
|
671
701
|
cs._g = getter;
|
|
672
702
|
cs.__v = 0;
|
|
703
|
+
let evaluating = false;
|
|
704
|
+
let disposed = false;
|
|
705
|
+
let pendingError;
|
|
673
706
|
const markDirty = () => {
|
|
674
|
-
if (cs._d) return;
|
|
707
|
+
if (cs._d || disposed) return;
|
|
675
708
|
cs._d = true;
|
|
676
709
|
};
|
|
677
710
|
markDirty._c = 1;
|
|
@@ -694,33 +727,53 @@ function derived(getter, options) {
|
|
|
694
727
|
}
|
|
695
728
|
}, markDirty);
|
|
696
729
|
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
697
|
-
let evaluating = false;
|
|
698
730
|
const validate = () => {
|
|
699
|
-
if (!cs._d) return;
|
|
731
|
+
if (!cs._d || disposed || pendingError !== void 0) return;
|
|
700
732
|
const oldValue = cs._v;
|
|
701
733
|
evaluating = true;
|
|
702
734
|
try {
|
|
703
735
|
retrack2(recompute, markDirty);
|
|
704
736
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
737
|
+
} catch (err) {
|
|
738
|
+
pendingError = { error: err };
|
|
739
|
+
cs.__v++;
|
|
740
|
+
if (disposed) cs._d = true;
|
|
741
|
+
else cs._f = true;
|
|
705
742
|
} finally {
|
|
706
743
|
evaluating = false;
|
|
744
|
+
if (disposed) cleanup2(markDirty);
|
|
707
745
|
}
|
|
708
|
-
if (hook && !Object.is(oldValue, cs._v)) {
|
|
746
|
+
if (hook && !disposed && !Object.is(oldValue, cs._v)) {
|
|
709
747
|
hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
|
|
710
748
|
}
|
|
711
749
|
};
|
|
712
750
|
cs._validate = validate;
|
|
751
|
+
const throwPending = () => {
|
|
752
|
+
const { error } = pendingError;
|
|
753
|
+
pendingError = void 0;
|
|
754
|
+
if (disposed) cs._d = false;
|
|
755
|
+
throw error;
|
|
756
|
+
};
|
|
713
757
|
function computedGetter() {
|
|
714
758
|
if (evaluating) {
|
|
715
759
|
throw new Error(
|
|
716
760
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
717
761
|
);
|
|
718
762
|
}
|
|
719
|
-
if (isTrackingSuspended2()) {
|
|
720
|
-
if (cs._d)
|
|
763
|
+
if (isTrackingSuspended2() || disposed) {
|
|
764
|
+
if (cs._d) {
|
|
765
|
+
validate();
|
|
766
|
+
if (pendingError !== void 0) throwPending();
|
|
767
|
+
}
|
|
721
768
|
return cs._v;
|
|
722
769
|
}
|
|
723
|
-
if (cs._d)
|
|
770
|
+
if (cs._d) {
|
|
771
|
+
validate();
|
|
772
|
+
if (pendingError !== void 0) {
|
|
773
|
+
recordDependency2(cs);
|
|
774
|
+
throwPending();
|
|
775
|
+
}
|
|
776
|
+
}
|
|
724
777
|
recordDependency2(cs);
|
|
725
778
|
return cs._v;
|
|
726
779
|
}
|
|
@@ -729,6 +782,19 @@ function derived(getter, options) {
|
|
|
729
782
|
cs.__name = debugName;
|
|
730
783
|
}
|
|
731
784
|
computedGetter.__signal = cs;
|
|
785
|
+
computedGetter.dispose = () => {
|
|
786
|
+
if (disposed) return;
|
|
787
|
+
disposed = true;
|
|
788
|
+
cs._d = pendingError !== void 0;
|
|
789
|
+
cleanup2(markDirty);
|
|
790
|
+
const h = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
791
|
+
if (h) {
|
|
792
|
+
try {
|
|
793
|
+
h.emit("computed:destroy", { signal: cs, getter: computedGetter });
|
|
794
|
+
} catch {
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
};
|
|
732
798
|
if (hook) hook.emit("computed:create", { signal: cs, name: debugName, getter: computedGetter });
|
|
733
799
|
return computedGetter;
|
|
734
800
|
}
|
|
@@ -1402,6 +1468,8 @@ function query(key, fetcher, options = {}) {
|
|
|
1402
1468
|
if (disposed) return;
|
|
1403
1469
|
disposed = true;
|
|
1404
1470
|
effectCleanup();
|
|
1471
|
+
loading.dispose();
|
|
1472
|
+
isStale.dispose();
|
|
1405
1473
|
if (intervalTimer) clearInterval(intervalTimer);
|
|
1406
1474
|
detachFromEntry();
|
|
1407
1475
|
if (focusHandler && typeof globalThis.removeEventListener === "function") {
|
|
@@ -1691,6 +1759,10 @@ function infiniteQuery(key, fetcher, options) {
|
|
|
1691
1759
|
disposed = true;
|
|
1692
1760
|
abortController?.abort();
|
|
1693
1761
|
effectCleanup();
|
|
1762
|
+
data.dispose();
|
|
1763
|
+
loading.dispose();
|
|
1764
|
+
hasNextPage.dispose();
|
|
1765
|
+
hasPreviousPage.dispose();
|
|
1694
1766
|
}
|
|
1695
1767
|
return {
|
|
1696
1768
|
data,
|
package/dist/data.js
CHANGED
|
@@ -20,15 +20,15 @@ import {
|
|
|
20
20
|
syncAdapter,
|
|
21
21
|
throttle,
|
|
22
22
|
withRetry
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import "./chunk-
|
|
25
|
-
import "./chunk-
|
|
23
|
+
} from "./chunk-3JZ4L5TJ.js";
|
|
24
|
+
import "./chunk-VUF4ALSW.js";
|
|
25
|
+
import "./chunk-RBTPLM32.js";
|
|
26
26
|
import "./chunk-IXKSNWV5.js";
|
|
27
27
|
import "./chunk-7ZHH77QA.js";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-RIXRAYIU.js";
|
|
29
29
|
import "./chunk-5DXA2J44.js";
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
30
|
+
import "./chunk-XZZOBQAY.js";
|
|
31
|
+
import "./chunk-UGRX3S57.js";
|
|
32
32
|
import "./chunk-2WLZ6757.js";
|
|
33
33
|
export {
|
|
34
34
|
__resetQueryCache,
|
package/dist/devtools.cjs
CHANGED
|
@@ -427,6 +427,15 @@ function untracked(fn) {
|
|
|
427
427
|
var subscriberEpochCounter = 0;
|
|
428
428
|
function retrack(effectFn, subscriber) {
|
|
429
429
|
const prev = currentSubscriber;
|
|
430
|
+
let savedDepth = 0;
|
|
431
|
+
let savedSuspendSub = null;
|
|
432
|
+
if (trackingSuspended) {
|
|
433
|
+
savedDepth = suspendDepth;
|
|
434
|
+
savedSuspendSub = suspendSavedSub;
|
|
435
|
+
suspendDepth = 0;
|
|
436
|
+
suspendSavedSub = null;
|
|
437
|
+
trackingSuspended = false;
|
|
438
|
+
}
|
|
430
439
|
currentSubscriber = subscriber;
|
|
431
440
|
const sub = subscriber;
|
|
432
441
|
const epoch = ++subscriberEpochCounter;
|
|
@@ -441,6 +450,11 @@ function retrack(effectFn, subscriber) {
|
|
|
441
450
|
effectFn();
|
|
442
451
|
} finally {
|
|
443
452
|
currentSubscriber = prev;
|
|
453
|
+
if (savedDepth !== 0) {
|
|
454
|
+
suspendDepth = savedDepth;
|
|
455
|
+
suspendSavedSub = savedSuspendSub;
|
|
456
|
+
trackingSuspended = true;
|
|
457
|
+
}
|
|
444
458
|
let node = sub.depsHead ?? null;
|
|
445
459
|
while (node !== null) {
|
|
446
460
|
const next = node.subNext;
|
|
@@ -460,11 +474,25 @@ function track(effectFn, subscriber) {
|
|
|
460
474
|
if (!subscriber) return reactiveBinding(effectFn);
|
|
461
475
|
cleanup(subscriber);
|
|
462
476
|
const prev = currentSubscriber;
|
|
477
|
+
let savedDepth = 0;
|
|
478
|
+
let savedSuspendSub = null;
|
|
479
|
+
if (trackingSuspended) {
|
|
480
|
+
savedDepth = suspendDepth;
|
|
481
|
+
savedSuspendSub = suspendSavedSub;
|
|
482
|
+
suspendDepth = 0;
|
|
483
|
+
suspendSavedSub = null;
|
|
484
|
+
trackingSuspended = false;
|
|
485
|
+
}
|
|
463
486
|
currentSubscriber = subscriber;
|
|
464
487
|
try {
|
|
465
488
|
effectFn();
|
|
466
489
|
} finally {
|
|
467
490
|
currentSubscriber = prev;
|
|
491
|
+
if (savedDepth !== 0) {
|
|
492
|
+
suspendDepth = savedDepth;
|
|
493
|
+
suspendSavedSub = savedSuspendSub;
|
|
494
|
+
trackingSuspended = true;
|
|
495
|
+
}
|
|
468
496
|
const sub2 = subscriber;
|
|
469
497
|
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
470
498
|
const sig = n.sig;
|
|
@@ -635,8 +663,9 @@ function propagateDirty(sub) {
|
|
|
635
663
|
if (s._c) {
|
|
636
664
|
const nSig = s._sig;
|
|
637
665
|
if (nSig) {
|
|
638
|
-
if (!nSig._d) {
|
|
666
|
+
if (!nSig._d || nSig._f === true) {
|
|
639
667
|
nSig._d = true;
|
|
668
|
+
nSig._f = false;
|
|
640
669
|
stack.push(nSig);
|
|
641
670
|
}
|
|
642
671
|
} else {
|
|
@@ -736,7 +765,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
736
765
|
}
|
|
737
766
|
|
|
738
767
|
// src/reactivity/track.ts
|
|
739
|
-
var _runtimeVersion = true ? "4.
|
|
768
|
+
var _runtimeVersion = true ? "4.5.0" : "dev";
|
|
740
769
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
741
770
|
function resolveReactiveApi() {
|
|
742
771
|
const g = globalThis;
|
|
@@ -1102,6 +1131,16 @@ function initDevTools(config) {
|
|
|
1102
1131
|
});
|
|
1103
1132
|
emit();
|
|
1104
1133
|
});
|
|
1134
|
+
hook.on("computed:destroy", (payload) => {
|
|
1135
|
+
const p = payload;
|
|
1136
|
+
for (const [id, node] of hook.nodes) {
|
|
1137
|
+
if (node.ref === p.signal) {
|
|
1138
|
+
hook.nodes.delete(id);
|
|
1139
|
+
break;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
emit();
|
|
1143
|
+
});
|
|
1105
1144
|
hook.on("effect:create", (payload) => {
|
|
1106
1145
|
_dt.nextNodeId++;
|
|
1107
1146
|
const name = inferName();
|
package/dist/devtools.js
CHANGED
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
trackCleanup,
|
|
36
36
|
walkDependencyGraph,
|
|
37
37
|
withErrorTracking
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-FTIR4QW2.js";
|
|
39
39
|
import "./chunk-IXKSNWV5.js";
|
|
40
40
|
import "./chunk-7ZHH77QA.js";
|
|
41
|
-
import "./chunk-
|
|
41
|
+
import "./chunk-RIXRAYIU.js";
|
|
42
42
|
import "./chunk-5DXA2J44.js";
|
|
43
43
|
import "./chunk-QKRPLZ2V.js";
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
44
|
+
import "./chunk-XZZOBQAY.js";
|
|
45
|
+
import "./chunk-UGRX3S57.js";
|
|
46
46
|
import {
|
|
47
47
|
isDev
|
|
48
48
|
} from "./chunk-2WLZ6757.js";
|
package/dist/ecosystem.cjs
CHANGED
|
@@ -288,6 +288,15 @@ function untracked(fn) {
|
|
|
288
288
|
var subscriberEpochCounter = 0;
|
|
289
289
|
function retrack(effectFn, subscriber) {
|
|
290
290
|
const prev = currentSubscriber;
|
|
291
|
+
let savedDepth = 0;
|
|
292
|
+
let savedSuspendSub = null;
|
|
293
|
+
if (trackingSuspended) {
|
|
294
|
+
savedDepth = suspendDepth;
|
|
295
|
+
savedSuspendSub = suspendSavedSub;
|
|
296
|
+
suspendDepth = 0;
|
|
297
|
+
suspendSavedSub = null;
|
|
298
|
+
trackingSuspended = false;
|
|
299
|
+
}
|
|
291
300
|
currentSubscriber = subscriber;
|
|
292
301
|
const sub = subscriber;
|
|
293
302
|
const epoch = ++subscriberEpochCounter;
|
|
@@ -302,6 +311,11 @@ function retrack(effectFn, subscriber) {
|
|
|
302
311
|
effectFn();
|
|
303
312
|
} finally {
|
|
304
313
|
currentSubscriber = prev;
|
|
314
|
+
if (savedDepth !== 0) {
|
|
315
|
+
suspendDepth = savedDepth;
|
|
316
|
+
suspendSavedSub = savedSuspendSub;
|
|
317
|
+
trackingSuspended = true;
|
|
318
|
+
}
|
|
305
319
|
let node = sub.depsHead ?? null;
|
|
306
320
|
while (node !== null) {
|
|
307
321
|
const next = node.subNext;
|
|
@@ -321,11 +335,25 @@ function track(effectFn, subscriber) {
|
|
|
321
335
|
if (!subscriber) return reactiveBinding(effectFn);
|
|
322
336
|
cleanup(subscriber);
|
|
323
337
|
const prev = currentSubscriber;
|
|
338
|
+
let savedDepth = 0;
|
|
339
|
+
let savedSuspendSub = null;
|
|
340
|
+
if (trackingSuspended) {
|
|
341
|
+
savedDepth = suspendDepth;
|
|
342
|
+
savedSuspendSub = suspendSavedSub;
|
|
343
|
+
suspendDepth = 0;
|
|
344
|
+
suspendSavedSub = null;
|
|
345
|
+
trackingSuspended = false;
|
|
346
|
+
}
|
|
324
347
|
currentSubscriber = subscriber;
|
|
325
348
|
try {
|
|
326
349
|
effectFn();
|
|
327
350
|
} finally {
|
|
328
351
|
currentSubscriber = prev;
|
|
352
|
+
if (savedDepth !== 0) {
|
|
353
|
+
suspendDepth = savedDepth;
|
|
354
|
+
suspendSavedSub = savedSuspendSub;
|
|
355
|
+
trackingSuspended = true;
|
|
356
|
+
}
|
|
329
357
|
const sub2 = subscriber;
|
|
330
358
|
for (let n = sub2.depsHead ?? null; n !== null; n = n.subNext) {
|
|
331
359
|
const sig = n.sig;
|
|
@@ -496,8 +524,9 @@ function propagateDirty(sub) {
|
|
|
496
524
|
if (s._c) {
|
|
497
525
|
const nSig = s._sig;
|
|
498
526
|
if (nSig) {
|
|
499
|
-
if (!nSig._d) {
|
|
527
|
+
if (!nSig._d || nSig._f === true) {
|
|
500
528
|
nSig._d = true;
|
|
529
|
+
nSig._f = false;
|
|
501
530
|
stack.push(nSig);
|
|
502
531
|
}
|
|
503
532
|
} else {
|
|
@@ -597,7 +626,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
597
626
|
}
|
|
598
627
|
|
|
599
628
|
// src/reactivity/track.ts
|
|
600
|
-
var _runtimeVersion = true ? "4.
|
|
629
|
+
var _runtimeVersion = true ? "4.5.0" : "dev";
|
|
601
630
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
602
631
|
function resolveReactiveApi() {
|
|
603
632
|
const g = globalThis;
|
|
@@ -1084,10 +1113,14 @@ function derived(getter, options) {
|
|
|
1084
1113
|
const cs = {};
|
|
1085
1114
|
cs._d = false;
|
|
1086
1115
|
cs._init = false;
|
|
1116
|
+
cs._f = false;
|
|
1087
1117
|
cs._g = getter;
|
|
1088
1118
|
cs.__v = 0;
|
|
1119
|
+
let evaluating = false;
|
|
1120
|
+
let disposed = false;
|
|
1121
|
+
let pendingError;
|
|
1089
1122
|
const markDirty = () => {
|
|
1090
|
-
if (cs._d) return;
|
|
1123
|
+
if (cs._d || disposed) return;
|
|
1091
1124
|
cs._d = true;
|
|
1092
1125
|
};
|
|
1093
1126
|
markDirty._c = 1;
|
|
@@ -1110,33 +1143,53 @@ function derived(getter, options) {
|
|
|
1110
1143
|
}
|
|
1111
1144
|
}, markDirty);
|
|
1112
1145
|
const hook = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1113
|
-
let evaluating = false;
|
|
1114
1146
|
const validate = () => {
|
|
1115
|
-
if (!cs._d) return;
|
|
1147
|
+
if (!cs._d || disposed || pendingError !== void 0) return;
|
|
1116
1148
|
const oldValue = cs._v;
|
|
1117
1149
|
evaluating = true;
|
|
1118
1150
|
try {
|
|
1119
1151
|
retrack2(recompute, markDirty);
|
|
1120
1152
|
if (!Object.is(oldValue, cs._v)) cs.__v++;
|
|
1153
|
+
} catch (err) {
|
|
1154
|
+
pendingError = { error: err };
|
|
1155
|
+
cs.__v++;
|
|
1156
|
+
if (disposed) cs._d = true;
|
|
1157
|
+
else cs._f = true;
|
|
1121
1158
|
} finally {
|
|
1122
1159
|
evaluating = false;
|
|
1160
|
+
if (disposed) cleanup2(markDirty);
|
|
1123
1161
|
}
|
|
1124
|
-
if (hook && !Object.is(oldValue, cs._v)) {
|
|
1162
|
+
if (hook && !disposed && !Object.is(oldValue, cs._v)) {
|
|
1125
1163
|
hook.emit("computed:update", { signal: cs, oldValue, newValue: cs._v });
|
|
1126
1164
|
}
|
|
1127
1165
|
};
|
|
1128
1166
|
cs._validate = validate;
|
|
1167
|
+
const throwPending = () => {
|
|
1168
|
+
const { error } = pendingError;
|
|
1169
|
+
pendingError = void 0;
|
|
1170
|
+
if (disposed) cs._d = false;
|
|
1171
|
+
throw error;
|
|
1172
|
+
};
|
|
1129
1173
|
function computedGetter() {
|
|
1130
1174
|
if (evaluating) {
|
|
1131
1175
|
throw new Error(
|
|
1132
1176
|
`[SibuJS] Circular dependency detected in derived${debugName ? ` "${debugName}"` : ""}. A derived signal cannot read itself (directly or through a chain).`
|
|
1133
1177
|
);
|
|
1134
1178
|
}
|
|
1135
|
-
if (isTrackingSuspended2()) {
|
|
1136
|
-
if (cs._d)
|
|
1179
|
+
if (isTrackingSuspended2() || disposed) {
|
|
1180
|
+
if (cs._d) {
|
|
1181
|
+
validate();
|
|
1182
|
+
if (pendingError !== void 0) throwPending();
|
|
1183
|
+
}
|
|
1137
1184
|
return cs._v;
|
|
1138
1185
|
}
|
|
1139
|
-
if (cs._d)
|
|
1186
|
+
if (cs._d) {
|
|
1187
|
+
validate();
|
|
1188
|
+
if (pendingError !== void 0) {
|
|
1189
|
+
recordDependency2(cs);
|
|
1190
|
+
throwPending();
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1140
1193
|
recordDependency2(cs);
|
|
1141
1194
|
return cs._v;
|
|
1142
1195
|
}
|
|
@@ -1145,6 +1198,19 @@ function derived(getter, options) {
|
|
|
1145
1198
|
cs.__name = debugName;
|
|
1146
1199
|
}
|
|
1147
1200
|
computedGetter.__signal = cs;
|
|
1201
|
+
computedGetter.dispose = () => {
|
|
1202
|
+
if (disposed) return;
|
|
1203
|
+
disposed = true;
|
|
1204
|
+
cs._d = pendingError !== void 0;
|
|
1205
|
+
cleanup2(markDirty);
|
|
1206
|
+
const h = globalThis.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1207
|
+
if (h) {
|
|
1208
|
+
try {
|
|
1209
|
+
h.emit("computed:destroy", { signal: cs, getter: computedGetter });
|
|
1210
|
+
} catch {
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
};
|
|
1148
1214
|
if (hook) hook.emit("computed:create", { signal: cs, name: debugName, getter: computedGetter });
|
|
1149
1215
|
return computedGetter;
|
|
1150
1216
|
}
|
|
@@ -1462,6 +1528,14 @@ function setSafeAttribute(el, name, value, options = {}) {
|
|
|
1462
1528
|
const html = isHtmlElement(el);
|
|
1463
1529
|
const idlName = html ? name.toLowerCase() : name;
|
|
1464
1530
|
if (typeof value === "boolean") {
|
|
1531
|
+
if (name.length > 5 && name.slice(0, 5).toLowerCase() === "aria-") {
|
|
1532
|
+
const token = value ? "true" : "false";
|
|
1533
|
+
if ((ns ? el.getAttributeNS(ns, localName) : el.getAttribute(name)) !== token) {
|
|
1534
|
+
if (ns) el.setAttributeNS(ns, name, token);
|
|
1535
|
+
else el.setAttribute(name, token);
|
|
1536
|
+
}
|
|
1537
|
+
return true;
|
|
1538
|
+
}
|
|
1465
1539
|
if (html && BOOLEAN_IDL_ATTRS.has(idlName) && idlName in el) {
|
|
1466
1540
|
setProp(el, idlName, value);
|
|
1467
1541
|
} else if (value) {
|
package/dist/ecosystem.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as SibuPlugin } from './plugin-D30wlGW5.cjs';
|
|
2
|
-
import { T as TagProps } from './tagFactory-
|
|
2
|
+
import { D as DerivedAccessor, T as TagProps } from './tagFactory-DVoDpHye.cjs';
|
|
3
3
|
|
|
4
4
|
/** MobX autorun disposer function type. */
|
|
5
5
|
type MobXReactionDisposer = () => void;
|
|
@@ -67,8 +67,12 @@ interface ReduxAdapterOptions<S = unknown> {
|
|
|
67
67
|
interface ReduxAdapterAPI<S = unknown> {
|
|
68
68
|
/** Full store state as a SibuJS reactive getter */
|
|
69
69
|
getState: () => S;
|
|
70
|
-
/**
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Create a SibuJS reactive getter from a Redux selector. The getter is a
|
|
72
|
+
* `derived()` subscribed to the store state; call its `dispose()` when a
|
|
73
|
+
* selector is discarded before the adapter.
|
|
74
|
+
*/
|
|
75
|
+
select: <R>(selector: (state: S) => R) => DerivedAccessor<R>;
|
|
72
76
|
/** Dispatch an action to the Redux store */
|
|
73
77
|
dispatch: ReduxStore<S>["dispatch"];
|
|
74
78
|
/** Unsubscribe from the Redux store */
|
|
@@ -110,8 +114,12 @@ interface ZustandAdapterOptions<S> {
|
|
|
110
114
|
interface ZustandAdapterAPI<S> {
|
|
111
115
|
/** Full Zustand state as a SibuJS reactive getter */
|
|
112
116
|
getState: () => S;
|
|
113
|
-
/**
|
|
114
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Create a SibuJS reactive getter from a Zustand selector. The getter is a
|
|
119
|
+
* `derived()` subscribed to the store state; call its `dispose()` when a
|
|
120
|
+
* selector is discarded before the adapter.
|
|
121
|
+
*/
|
|
122
|
+
select: <R>(selector: (state: S) => R) => DerivedAccessor<R>;
|
|
115
123
|
/** Set state on the Zustand store */
|
|
116
124
|
setState: ZustandStore<S>["setState"];
|
|
117
125
|
/** Destroy the subscription and the Zustand store */
|
package/dist/ecosystem.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { S as SibuPlugin } from './plugin-D30wlGW5.js';
|
|
2
|
-
import { T as TagProps } from './tagFactory-
|
|
2
|
+
import { D as DerivedAccessor, T as TagProps } from './tagFactory-DVoDpHye.js';
|
|
3
3
|
|
|
4
4
|
/** MobX autorun disposer function type. */
|
|
5
5
|
type MobXReactionDisposer = () => void;
|
|
@@ -67,8 +67,12 @@ interface ReduxAdapterOptions<S = unknown> {
|
|
|
67
67
|
interface ReduxAdapterAPI<S = unknown> {
|
|
68
68
|
/** Full store state as a SibuJS reactive getter */
|
|
69
69
|
getState: () => S;
|
|
70
|
-
/**
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Create a SibuJS reactive getter from a Redux selector. The getter is a
|
|
72
|
+
* `derived()` subscribed to the store state; call its `dispose()` when a
|
|
73
|
+
* selector is discarded before the adapter.
|
|
74
|
+
*/
|
|
75
|
+
select: <R>(selector: (state: S) => R) => DerivedAccessor<R>;
|
|
72
76
|
/** Dispatch an action to the Redux store */
|
|
73
77
|
dispatch: ReduxStore<S>["dispatch"];
|
|
74
78
|
/** Unsubscribe from the Redux store */
|
|
@@ -110,8 +114,12 @@ interface ZustandAdapterOptions<S> {
|
|
|
110
114
|
interface ZustandAdapterAPI<S> {
|
|
111
115
|
/** Full Zustand state as a SibuJS reactive getter */
|
|
112
116
|
getState: () => S;
|
|
113
|
-
/**
|
|
114
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Create a SibuJS reactive getter from a Zustand selector. The getter is a
|
|
119
|
+
* `derived()` subscribed to the store state; call its `dispose()` when a
|
|
120
|
+
* selector is discarded before the adapter.
|
|
121
|
+
*/
|
|
122
|
+
select: <R>(selector: (state: S) => R) => DerivedAccessor<R>;
|
|
115
123
|
/** Set state on the Zustand store */
|
|
116
124
|
setState: ZustandStore<S>["setState"];
|
|
117
125
|
/** Destroy the subscription and the Zustand store */
|
package/dist/ecosystem.js
CHANGED
|
@@ -7,18 +7,18 @@ import {
|
|
|
7
7
|
mobXAdapter,
|
|
8
8
|
reduxAdapter,
|
|
9
9
|
zustandAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-4PMLNECI.js";
|
|
11
11
|
import "./chunk-WWV3SJ3L.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-KEISJXBU.js";
|
|
13
|
+
import "./chunk-ONOHFDLG.js";
|
|
14
|
+
import "./chunk-RBTPLM32.js";
|
|
15
15
|
import "./chunk-IXKSNWV5.js";
|
|
16
16
|
import "./chunk-7ZHH77QA.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-RIXRAYIU.js";
|
|
18
18
|
import "./chunk-5DXA2J44.js";
|
|
19
19
|
import "./chunk-QKRPLZ2V.js";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-XZZOBQAY.js";
|
|
21
|
+
import "./chunk-UGRX3S57.js";
|
|
22
22
|
import "./chunk-2WLZ6757.js";
|
|
23
23
|
export {
|
|
24
24
|
antdAdapter,
|