sibujs 4.14.0 → 4.15.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/browser.cjs +297 -45
- package/dist/browser.js +6 -7
- package/dist/build.cjs +2189 -573
- package/dist/build.js +16 -15
- package/dist/cdn.dev.global.js +13 -12
- package/dist/cdn.full.dev.global.js +14 -13
- package/dist/cdn.full.global.js +12 -12
- package/dist/cdn.global.js +12 -12
- package/dist/{chunk-RVR5NPFL.js → chunk-2VKTFA7C.js} +1 -1
- package/dist/{chunk-7ILEHTVX.js → chunk-4AEFGRYW.js} +1 -1
- package/dist/{chunk-4TQDTWWN.js → chunk-6IV5ZRG6.js} +5 -7
- package/dist/{chunk-GVAMIU6K.js → chunk-75EAQH3U.js} +2 -2
- package/dist/{chunk-TLS4NVIB.js → chunk-7JO7DPSS.js} +4 -4
- package/dist/{chunk-SVULV7O4.js → chunk-AQH7WDSE.js} +6 -8
- package/dist/{chunk-S37PZD6I.js → chunk-BF3WBJJQ.js} +60 -10
- package/dist/{chunk-LJMX4SQ7.js → chunk-BG4BP44S.js} +3 -3
- package/dist/{chunk-N7A6FKWW.js → chunk-D44TAGCT.js} +2 -2
- package/dist/{chunk-CCKUNHVU.js → chunk-DAEXQJQA.js} +1 -1
- package/dist/chunk-DNCQDFJJ.js +22 -0
- package/dist/{chunk-BKZ5N6NK.js → chunk-DNCT2UXB.js} +4 -4
- package/dist/{chunk-BOYKGGVD.js → chunk-DRWOD7RZ.js} +4 -4
- package/dist/chunk-DS5V2PRE.js +64 -0
- package/dist/{chunk-VM2U5LEL.js → chunk-EHSJESRN.js} +595 -123
- package/dist/{chunk-MIRKTVH4.js → chunk-GFM5WWPU.js} +252 -5
- package/dist/{chunk-52XFPGSN.js → chunk-HTPOIAAL.js} +1 -1
- package/dist/{chunk-3HEX6QJQ.js → chunk-I2R5QALY.js} +2 -4
- package/dist/{chunk-4FJSAUKB.js → chunk-IUBV5WO5.js} +1 -1
- package/dist/{chunk-A454RAEK.js → chunk-KIDETDMU.js} +5 -7
- package/dist/{chunk-JTFQ7IL4.js → chunk-KPAXG5IR.js} +7 -9
- package/dist/{chunk-AE32RGWX.js → chunk-LGUXYHTZ.js} +3 -3
- package/dist/{chunk-Y4LUM2XS.js → chunk-LQWLPQOK.js} +6 -8
- package/dist/{chunk-CNPT6NKV.js → chunk-MINLMJUY.js} +48 -9
- package/dist/{chunk-BNXRWZZV.js → chunk-OURTGOJT.js} +8 -10
- package/dist/{chunk-F67F77IA.js → chunk-TQ24Y3IV.js} +2 -2
- package/dist/{chunk-2TTRW2TE.js → chunk-UM3M5PXS.js} +8 -8
- package/dist/{chunk-CJ7KS3DF.js → chunk-VSTX3XSX.js} +205 -15
- package/dist/{chunk-HQIAL7F2.js → chunk-XPDZ2LDR.js} +2 -2
- package/dist/{chunk-UUIKJJIK.js → chunk-Y7JM7GY2.js} +5 -7
- package/dist/{chunk-QS6GMWDD.js → chunk-YAFITBOK.js} +1269 -162
- package/dist/data.cjs +285 -33
- package/dist/data.js +6 -7
- package/dist/devtools.cjs +289 -39
- package/dist/devtools.js +5 -6
- package/dist/{dispose-EIHHHDC7.js → dispose-3WDBYJMH.js} +3 -1
- package/dist/ecosystem.cjs +345 -61
- package/dist/ecosystem.d.cts +1 -1
- package/dist/ecosystem.d.ts +1 -1
- package/dist/ecosystem.js +10 -10
- package/dist/extras.cjs +568 -248
- package/dist/extras.d.cts +1 -1
- package/dist/extras.d.ts +1 -1
- package/dist/extras.js +27 -27
- package/dist/index.cjs +2134 -515
- package/dist/index.d.cts +628 -211
- package/dist/index.d.ts +628 -211
- package/dist/index.js +22 -15
- package/dist/motion.cjs +286 -30
- package/dist/motion.js +4 -4
- package/dist/patterns.cjs +301 -43
- package/dist/patterns.js +6 -6
- package/dist/performance.cjs +286 -36
- package/dist/performance.js +9 -9
- package/dist/plugins.cjs +1237 -291
- package/dist/plugins.d.cts +3 -1
- package/dist/plugins.d.ts +3 -1
- package/dist/plugins.js +20 -19
- package/dist/{renderRoute-fxgsm2Ir.d.ts → renderRoute-B84MONaO.d.cts} +2 -2
- package/dist/{renderRoute-DP20XwMS.d.cts → renderRoute-_yxPuEQY.d.ts} +2 -2
- package/dist/{routeHead-CE9SV-cH.d.cts → routeHead-DLxlq15W.d.cts} +94 -0
- package/dist/{routeHead-DzVxPviY.d.ts → routeHead-w8nANZ3M.d.ts} +94 -0
- package/dist/{ssr-NECEU4X4.js → ssr-EF3IUHTE.js} +6 -6
- package/dist/ssr-dom.cjs +64 -9
- package/dist/ssr-dom.d.cts +2 -0
- package/dist/ssr-dom.d.ts +2 -0
- package/dist/ssr-dom.js +2 -1
- package/dist/ssr.cjs +850 -170
- package/dist/ssr.d.cts +5 -3
- package/dist/ssr.d.ts +5 -3
- package/dist/ssr.js +16 -15
- package/dist/{tagFactory-DkytnJws.d.cts → tagFactory-BfEh69VF.d.cts} +7 -0
- package/dist/{tagFactory-Bnd_Nph9.d.ts → tagFactory-pSYiLYyh.d.ts} +7 -0
- package/dist/testing.cjs +817 -132
- package/dist/testing.d.cts +4 -2
- package/dist/testing.d.ts +4 -2
- package/dist/testing.js +18 -17
- package/dist/track-core-0edROAF5.d.ts +187 -0
- package/dist/track-core-DN5fYLWi.d.cts +187 -0
- package/dist/ui.cjs +293 -43
- package/dist/ui.js +10 -12
- package/dist/widgets.cjs +285 -27
- package/dist/widgets.js +7 -7
- package/package.json +1 -1
- package/dist/chunk-7ZHH77QA.js +0 -9
package/dist/performance.cjs
CHANGED
|
@@ -356,7 +356,12 @@ function isHydrating() {
|
|
|
356
356
|
}
|
|
357
357
|
|
|
358
358
|
// src/core/rendering/dispose.ts
|
|
359
|
-
var
|
|
359
|
+
var state2 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.disposers.v1"), () => ({
|
|
360
|
+
disposers: /* @__PURE__ */ new WeakMap(),
|
|
361
|
+
captures: [],
|
|
362
|
+
bindings: { count: 0 }
|
|
363
|
+
}));
|
|
364
|
+
var elementDisposers = state2.disposers;
|
|
360
365
|
var MAX_DRAIN_TEARDOWNS = 1e4;
|
|
361
366
|
function reportDrainRunaway(label, executed, remaining) {
|
|
362
367
|
if (typeof console === "undefined") return;
|
|
@@ -365,13 +370,13 @@ function reportDrainRunaway(label, executed, remaining) {
|
|
|
365
370
|
{ executed, remaining }
|
|
366
371
|
);
|
|
367
372
|
}
|
|
368
|
-
var
|
|
373
|
+
var bindings = state2.bindings;
|
|
369
374
|
function resolveCapture(capture) {
|
|
370
375
|
let frame = capture;
|
|
371
376
|
while (frame?.closed) frame = frame.forwardTo;
|
|
372
377
|
return frame ?? null;
|
|
373
378
|
}
|
|
374
|
-
var registrationCaptures =
|
|
379
|
+
var registrationCaptures = state2.captures;
|
|
375
380
|
function currentDisposerCapture() {
|
|
376
381
|
return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
377
382
|
}
|
|
@@ -390,7 +395,7 @@ function registerDisposer(node, teardown) {
|
|
|
390
395
|
elementDisposers.set(node, disposers);
|
|
391
396
|
}
|
|
392
397
|
disposers.push(teardown);
|
|
393
|
-
if (DEV)
|
|
398
|
+
if (DEV) bindings.count++;
|
|
394
399
|
const capture = resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
395
400
|
if (capture) capture.entries.push([node, teardown]);
|
|
396
401
|
}
|
|
@@ -418,13 +423,13 @@ function disposeNodeOwn(node) {
|
|
|
418
423
|
if (!pending || pending.length === 0) break;
|
|
419
424
|
const snapshot = pending.slice();
|
|
420
425
|
elementDisposers.delete(node);
|
|
421
|
-
if (DEV)
|
|
426
|
+
if (DEV) bindings.count -= snapshot.length;
|
|
422
427
|
for (let i = 0; i < snapshot.length; i++) {
|
|
423
428
|
if (executed >= MAX_DRAIN_TEARDOWNS) {
|
|
424
429
|
const rest = snapshot.slice(i);
|
|
425
430
|
const added = elementDisposers.get(node);
|
|
426
431
|
elementDisposers.set(node, added ? rest.concat(added) : rest);
|
|
427
|
-
if (DEV)
|
|
432
|
+
if (DEV) bindings.count += rest.length;
|
|
428
433
|
reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
|
|
429
434
|
runaway = true;
|
|
430
435
|
break;
|
|
@@ -627,6 +632,201 @@ function bindOwnerScope(fn) {
|
|
|
627
632
|
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
628
633
|
}
|
|
629
634
|
var currentStructOwner = null;
|
|
635
|
+
var frozenOwners = 0;
|
|
636
|
+
var ACTIVE = 0;
|
|
637
|
+
var PAUSED = 1;
|
|
638
|
+
var ENDED = 2;
|
|
639
|
+
var NOOP = () => {
|
|
640
|
+
};
|
|
641
|
+
var skippedWhileHeld = /* @__PURE__ */ new Set();
|
|
642
|
+
var waiters = /* @__PURE__ */ new Set();
|
|
643
|
+
var heldRoots = /* @__PURE__ */ new Set();
|
|
644
|
+
function ownerState(tok) {
|
|
645
|
+
let state3 = ACTIVE;
|
|
646
|
+
for (let t = tok; t !== null; ) {
|
|
647
|
+
const o = t.sub;
|
|
648
|
+
if (o === null) return ENDED;
|
|
649
|
+
if (o._frozen === true) state3 = PAUSED;
|
|
650
|
+
t = o._owner ?? null;
|
|
651
|
+
}
|
|
652
|
+
return state3;
|
|
653
|
+
}
|
|
654
|
+
var endWatchers = /* @__PURE__ */ new Set();
|
|
655
|
+
var stateWatchers = /* @__PURE__ */ new Set();
|
|
656
|
+
var stateCheckQueued = false;
|
|
657
|
+
function queueStateCheck() {
|
|
658
|
+
if (stateCheckQueued || stateWatchers.size === 0) return;
|
|
659
|
+
stateCheckQueued = true;
|
|
660
|
+
queueMicrotask(() => {
|
|
661
|
+
stateCheckQueued = false;
|
|
662
|
+
for (const watcher of [...stateWatchers]) {
|
|
663
|
+
if (!stateWatchers.has(watcher)) continue;
|
|
664
|
+
const state3 = watcher.check.state();
|
|
665
|
+
if (state3 === ENDED) stateWatchers.delete(watcher);
|
|
666
|
+
if (state3 === ENDED || state3 === watcher.last) continue;
|
|
667
|
+
watcher.last = state3;
|
|
668
|
+
try {
|
|
669
|
+
watcher.listener(state3);
|
|
670
|
+
} catch (err) {
|
|
671
|
+
reportError(err, { phase: "effect" });
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
}
|
|
676
|
+
var ALWAYS_ACTIVE = Object.assign(() => false, {
|
|
677
|
+
state: () => ACTIVE,
|
|
678
|
+
wait: (onActive) => {
|
|
679
|
+
onActive();
|
|
680
|
+
return NOOP;
|
|
681
|
+
},
|
|
682
|
+
onEnd: () => NOOP,
|
|
683
|
+
run: (fn) => fn(),
|
|
684
|
+
onChange: () => NOOP,
|
|
685
|
+
within: () => false
|
|
686
|
+
});
|
|
687
|
+
function captureFrozen() {
|
|
688
|
+
const tok = currentStructOwner;
|
|
689
|
+
if (tok === null) return ALWAYS_ACTIVE;
|
|
690
|
+
const state3 = () => ownerState(tok);
|
|
691
|
+
const check = Object.assign(() => state3() !== ACTIVE, {
|
|
692
|
+
state: state3,
|
|
693
|
+
wait: (onActive, onEnd) => {
|
|
694
|
+
const now = state3();
|
|
695
|
+
if (now !== PAUSED) {
|
|
696
|
+
(now === ACTIVE ? onActive : onEnd)();
|
|
697
|
+
return NOOP;
|
|
698
|
+
}
|
|
699
|
+
const waiter = { check, onActive, onEnd };
|
|
700
|
+
waiters.add(waiter);
|
|
701
|
+
return () => {
|
|
702
|
+
waiters.delete(waiter);
|
|
703
|
+
};
|
|
704
|
+
},
|
|
705
|
+
onEnd: (onEnd) => {
|
|
706
|
+
if (state3() === ENDED) {
|
|
707
|
+
onEnd();
|
|
708
|
+
return NOOP;
|
|
709
|
+
}
|
|
710
|
+
const watcher = { check, onActive: NOOP, onEnd };
|
|
711
|
+
endWatchers.add(watcher);
|
|
712
|
+
return () => {
|
|
713
|
+
endWatchers.delete(watcher);
|
|
714
|
+
};
|
|
715
|
+
},
|
|
716
|
+
run: (fn) => {
|
|
717
|
+
const prev = currentStructOwner;
|
|
718
|
+
currentStructOwner = tok.sub === null ? null : tok;
|
|
719
|
+
try {
|
|
720
|
+
return fn();
|
|
721
|
+
} finally {
|
|
722
|
+
currentStructOwner = prev;
|
|
723
|
+
}
|
|
724
|
+
},
|
|
725
|
+
onChange: (listener) => {
|
|
726
|
+
const last = state3();
|
|
727
|
+
if (last === ENDED) return NOOP;
|
|
728
|
+
const watcher = { check, last, listener };
|
|
729
|
+
stateWatchers.add(watcher);
|
|
730
|
+
return () => {
|
|
731
|
+
stateWatchers.delete(watcher);
|
|
732
|
+
};
|
|
733
|
+
},
|
|
734
|
+
within: (owner) => {
|
|
735
|
+
const target = owner.run(() => currentStructOwner);
|
|
736
|
+
if (target === null) return false;
|
|
737
|
+
for (let t = tok; t !== null; ) {
|
|
738
|
+
if (t === target) return true;
|
|
739
|
+
const o = t.sub;
|
|
740
|
+
if (o === null) return false;
|
|
741
|
+
t = o._owner ?? null;
|
|
742
|
+
}
|
|
743
|
+
return false;
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
return check;
|
|
747
|
+
}
|
|
748
|
+
function holdSubtree(root) {
|
|
749
|
+
heldRoots.add(root);
|
|
750
|
+
return () => {
|
|
751
|
+
if (heldRoots.delete(root)) settleHeld();
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
function isHeld(sub) {
|
|
755
|
+
if (frozenOwners !== 0 && hasFrozenOwner(sub)) return true;
|
|
756
|
+
if (heldRoots.size !== 0) {
|
|
757
|
+
const node = sub._errorNode;
|
|
758
|
+
if (node != null) {
|
|
759
|
+
for (const root of heldRoots) if (root.contains(node)) return true;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
return false;
|
|
763
|
+
}
|
|
764
|
+
function notifyEnded() {
|
|
765
|
+
for (const watcher of stateWatchers) if (watcher.check.state() === ENDED) stateWatchers.delete(watcher);
|
|
766
|
+
let ended = null;
|
|
767
|
+
for (const watcher of endWatchers) {
|
|
768
|
+
if (watcher.check.state() !== ENDED) continue;
|
|
769
|
+
endWatchers.delete(watcher);
|
|
770
|
+
(ended ?? (ended = [])).push(watcher);
|
|
771
|
+
}
|
|
772
|
+
if (ended === null) return;
|
|
773
|
+
for (const watcher of ended) {
|
|
774
|
+
try {
|
|
775
|
+
watcher.onEnd();
|
|
776
|
+
} catch (err) {
|
|
777
|
+
reportError(err, { phase: "cleanup" });
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
function dropReleasedSkipped() {
|
|
782
|
+
for (const sub of skippedWhileHeld) {
|
|
783
|
+
if (sub._disposed === true || sub.depsHead == null) skippedWhileHeld.delete(sub);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
function settleHeld() {
|
|
787
|
+
for (const sub of skippedWhileHeld) {
|
|
788
|
+
if (sub._disposed === true) skippedWhileHeld.delete(sub);
|
|
789
|
+
else if (!isHeld(sub)) {
|
|
790
|
+
skippedWhileHeld.delete(sub);
|
|
791
|
+
if (!pendingSet.has(sub)) {
|
|
792
|
+
pendingSet.add(sub);
|
|
793
|
+
pendingQueue.push(sub);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
if (frozenOwners === 0 && heldRoots.size === 0) skippedWhileHeld.clear();
|
|
798
|
+
let ready = null;
|
|
799
|
+
for (const waiter of waiters) {
|
|
800
|
+
if (waiter.check.state() === PAUSED) continue;
|
|
801
|
+
waiters.delete(waiter);
|
|
802
|
+
(ready ?? (ready = [])).push(waiter);
|
|
803
|
+
}
|
|
804
|
+
if (ready !== null) {
|
|
805
|
+
const settle = ready;
|
|
806
|
+
queueMicrotask(() => {
|
|
807
|
+
for (const waiter of settle) {
|
|
808
|
+
const state3 = waiter.check.state();
|
|
809
|
+
if (state3 === PAUSED) waiters.add(waiter);
|
|
810
|
+
else
|
|
811
|
+
try {
|
|
812
|
+
(state3 === ACTIVE ? waiter.onActive : waiter.onEnd)();
|
|
813
|
+
} catch (err) {
|
|
814
|
+
reportError(err, { phase: "effect" });
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
if (pendingQueue.length > 0) drainNotificationQueue();
|
|
820
|
+
}
|
|
821
|
+
function hasFrozenOwner(sub) {
|
|
822
|
+
for (let t = sub._owner ?? null; t !== null; ) {
|
|
823
|
+
const o = t.sub;
|
|
824
|
+
if (o === null) return false;
|
|
825
|
+
if (o._frozen === true) return true;
|
|
826
|
+
t = o._owner ?? null;
|
|
827
|
+
}
|
|
828
|
+
return false;
|
|
829
|
+
}
|
|
630
830
|
var subscriberEpochCounter = 0;
|
|
631
831
|
function retrack(effectFn, subscriber) {
|
|
632
832
|
const prev = currentSubscriber;
|
|
@@ -734,6 +934,20 @@ function structuralBinding(commit, ownerNode) {
|
|
|
734
934
|
} finally {
|
|
735
935
|
currentStructOwner = prev;
|
|
736
936
|
}
|
|
937
|
+
},
|
|
938
|
+
freeze: () => {
|
|
939
|
+
const s = sub;
|
|
940
|
+
if (s._disposed || s._frozen) return;
|
|
941
|
+
s._frozen = true;
|
|
942
|
+
frozenOwners++;
|
|
943
|
+
queueStateCheck();
|
|
944
|
+
},
|
|
945
|
+
thaw: () => {
|
|
946
|
+
if (!sub._frozen) return;
|
|
947
|
+
sub._frozen = false;
|
|
948
|
+
frozenOwners--;
|
|
949
|
+
queueStateCheck();
|
|
950
|
+
settleHeld();
|
|
737
951
|
}
|
|
738
952
|
};
|
|
739
953
|
}
|
|
@@ -762,20 +976,34 @@ function createBinding(commit, ownerNode, structural) {
|
|
|
762
976
|
subscriber._errorNode = ownerNode;
|
|
763
977
|
subscriber._tok = null;
|
|
764
978
|
subscriber._owner = null;
|
|
979
|
+
subscriber._frozen = false;
|
|
765
980
|
if (structural) subscriber._tok = { sub: subscriber };
|
|
766
981
|
try {
|
|
767
982
|
run();
|
|
768
983
|
} catch (err) {
|
|
769
984
|
subscriber._disposed = true;
|
|
770
985
|
subscriber._errorNode = void 0;
|
|
771
|
-
if (subscriber._tok != null)
|
|
986
|
+
if (subscriber._tok != null) {
|
|
987
|
+
subscriber._tok.sub = null;
|
|
988
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
989
|
+
}
|
|
772
990
|
cleanup(subscriber);
|
|
773
991
|
throw err;
|
|
774
992
|
}
|
|
775
993
|
subscriber._dispose = () => {
|
|
776
994
|
subscriber._disposed = true;
|
|
995
|
+
const wasFrozen = subscriber._frozen === true;
|
|
996
|
+
if (wasFrozen) {
|
|
997
|
+
subscriber._frozen = false;
|
|
998
|
+
frozenOwners--;
|
|
999
|
+
}
|
|
777
1000
|
subscriber._errorNode = void 0;
|
|
778
|
-
if (subscriber._tok != null)
|
|
1001
|
+
if (subscriber._tok != null) {
|
|
1002
|
+
subscriber._tok.sub = null;
|
|
1003
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
1004
|
+
if (skippedWhileHeld.size !== 0) dropReleasedSkipped();
|
|
1005
|
+
if (wasFrozen || waiters.size !== 0) settleHeld();
|
|
1006
|
+
}
|
|
779
1007
|
cleanup(subscriber);
|
|
780
1008
|
};
|
|
781
1009
|
return subscriber;
|
|
@@ -885,6 +1113,10 @@ function runPendingOwners(sub) {
|
|
|
885
1113
|
}
|
|
886
1114
|
}
|
|
887
1115
|
function runQueued(sub) {
|
|
1116
|
+
if ((frozenOwners !== 0 || heldRoots.size !== 0) && isHeld(sub)) {
|
|
1117
|
+
skippedWhileHeld.add(sub);
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
888
1120
|
if (quarantined.size > 0 && quarantined.has(sub)) return;
|
|
889
1121
|
if (sub._hasComputedDep === true && !depsChanged(sub)) return;
|
|
890
1122
|
if (tickRepeat(sub)) {
|
|
@@ -1032,7 +1264,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
1032
1264
|
}
|
|
1033
1265
|
|
|
1034
1266
|
// src/reactivity/track.ts
|
|
1035
|
-
var _runtimeVersion = true ? "4.
|
|
1267
|
+
var _runtimeVersion = true ? "4.15.0" : "dev";
|
|
1036
1268
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1037
1269
|
function resolveReactiveApi() {
|
|
1038
1270
|
const g = globalThis;
|
|
@@ -1068,6 +1300,8 @@ function resolveReactiveApi() {
|
|
|
1068
1300
|
runWithOwnerScope,
|
|
1069
1301
|
bindOwnerScope,
|
|
1070
1302
|
structuralBinding,
|
|
1303
|
+
captureFrozen,
|
|
1304
|
+
holdSubtree,
|
|
1071
1305
|
version: _runtimeVersion
|
|
1072
1306
|
};
|
|
1073
1307
|
g[REGISTRY_KEY] = local;
|
|
@@ -1095,6 +1329,22 @@ var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
|
1095
1329
|
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
1096
1330
|
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
1097
1331
|
var structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
|
|
1332
|
+
var captureFrozen2 = API.captureFrozen ?? (() => Object.assign(() => false, {
|
|
1333
|
+
state: () => 0,
|
|
1334
|
+
wait: (onActive) => {
|
|
1335
|
+
onActive();
|
|
1336
|
+
return () => {
|
|
1337
|
+
};
|
|
1338
|
+
},
|
|
1339
|
+
onEnd: () => () => {
|
|
1340
|
+
},
|
|
1341
|
+
run: (fn) => fn(),
|
|
1342
|
+
onChange: () => () => {
|
|
1343
|
+
},
|
|
1344
|
+
within: () => false
|
|
1345
|
+
}));
|
|
1346
|
+
var holdSubtree2 = API.holdSubtree ?? (() => () => {
|
|
1347
|
+
});
|
|
1098
1348
|
|
|
1099
1349
|
// src/core/devtoolsHook.ts
|
|
1100
1350
|
function emitDevtools(hook, event, payload) {
|
|
@@ -1332,7 +1582,7 @@ var isBatching = API2.isBatching;
|
|
|
1332
1582
|
// src/core/signals/signal.ts
|
|
1333
1583
|
var _g2 = globalThis;
|
|
1334
1584
|
function signal(initial, options) {
|
|
1335
|
-
const
|
|
1585
|
+
const state3 = {
|
|
1336
1586
|
value: initial,
|
|
1337
1587
|
__v: 0,
|
|
1338
1588
|
__sc: 0,
|
|
@@ -1345,57 +1595,57 @@ function signal(initial, options) {
|
|
|
1345
1595
|
};
|
|
1346
1596
|
const debugName = DEV ? options?.name : void 0;
|
|
1347
1597
|
const equalsFn = options?.equals;
|
|
1348
|
-
if (debugName)
|
|
1598
|
+
if (debugName) state3.__name = debugName;
|
|
1349
1599
|
function get() {
|
|
1350
|
-
recordDependency2(
|
|
1351
|
-
return
|
|
1600
|
+
recordDependency2(state3);
|
|
1601
|
+
return state3.value;
|
|
1352
1602
|
}
|
|
1353
|
-
get.__signal =
|
|
1603
|
+
get.__signal = state3;
|
|
1354
1604
|
if (debugName) get.__name = debugName;
|
|
1355
1605
|
let set;
|
|
1356
1606
|
if (equalsFn) {
|
|
1357
1607
|
set = (next) => {
|
|
1358
|
-
const prev =
|
|
1608
|
+
const prev = state3.value;
|
|
1359
1609
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
1360
1610
|
if (equalsFn(prev, newValue)) return;
|
|
1361
|
-
|
|
1362
|
-
|
|
1611
|
+
state3.value = newValue;
|
|
1612
|
+
state3.__v++;
|
|
1363
1613
|
if (DEV) {
|
|
1364
1614
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1365
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
1615
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
|
|
1366
1616
|
}
|
|
1367
|
-
if (!enqueueBatchedSignal(
|
|
1368
|
-
notifySubscribers2(
|
|
1617
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1618
|
+
notifySubscribers2(state3);
|
|
1369
1619
|
}
|
|
1370
1620
|
};
|
|
1371
1621
|
} else if (DEV) {
|
|
1372
1622
|
set = (next) => {
|
|
1373
|
-
const prev =
|
|
1623
|
+
const prev = state3.value;
|
|
1374
1624
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
1375
1625
|
if (Object.is(newValue, prev)) return;
|
|
1376
|
-
|
|
1377
|
-
|
|
1626
|
+
state3.value = newValue;
|
|
1627
|
+
state3.__v++;
|
|
1378
1628
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1379
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
1380
|
-
if (!enqueueBatchedSignal(
|
|
1381
|
-
notifySubscribers2(
|
|
1629
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
|
|
1630
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1631
|
+
notifySubscribers2(state3);
|
|
1382
1632
|
}
|
|
1383
1633
|
};
|
|
1384
1634
|
} else {
|
|
1385
1635
|
set = (next) => {
|
|
1386
|
-
const prev =
|
|
1636
|
+
const prev = state3.value;
|
|
1387
1637
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
1388
1638
|
if (Object.is(newValue, prev)) return;
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
if (!enqueueBatchedSignal(
|
|
1392
|
-
notifySubscribers2(
|
|
1639
|
+
state3.value = newValue;
|
|
1640
|
+
state3.__v++;
|
|
1641
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1642
|
+
notifySubscribers2(state3);
|
|
1393
1643
|
}
|
|
1394
1644
|
};
|
|
1395
1645
|
}
|
|
1396
1646
|
if (DEV) {
|
|
1397
1647
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1398
|
-
if (hook) emitDevtools(hook, "signal:create", { signal:
|
|
1648
|
+
if (hook) emitDevtools(hook, "signal:create", { signal: state3, name: debugName, getter: get, initial });
|
|
1399
1649
|
}
|
|
1400
1650
|
return [get, set];
|
|
1401
1651
|
}
|
|
@@ -1729,8 +1979,8 @@ function normalizedStore(schema) {
|
|
|
1729
1979
|
return ownGet(getState().entities, id);
|
|
1730
1980
|
}
|
|
1731
1981
|
function getAll() {
|
|
1732
|
-
const
|
|
1733
|
-
return
|
|
1982
|
+
const state3 = getState();
|
|
1983
|
+
return state3.ids.map((id) => state3.entities[id]);
|
|
1734
1984
|
}
|
|
1735
1985
|
function update(id, partial) {
|
|
1736
1986
|
const prev = getState();
|
|
@@ -1763,8 +2013,8 @@ function normalizedStore(schema) {
|
|
|
1763
2013
|
});
|
|
1764
2014
|
}
|
|
1765
2015
|
function select(predicate) {
|
|
1766
|
-
const
|
|
1767
|
-
return
|
|
2016
|
+
const state3 = getState();
|
|
2017
|
+
return state3.ids.map((id) => state3.entities[id]).filter(predicate);
|
|
1768
2018
|
}
|
|
1769
2019
|
return { add, addMany, get, getAll, update, remove, select, getState };
|
|
1770
2020
|
}
|
package/dist/performance.js
CHANGED
|
@@ -33,22 +33,22 @@ import {
|
|
|
33
33
|
transitionState,
|
|
34
34
|
uniqueId,
|
|
35
35
|
yieldToMain
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-Y7JM7GY2.js";
|
|
37
37
|
import {
|
|
38
38
|
trustHTML
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
41
|
-
import "./chunk-
|
|
39
|
+
} from "./chunk-DRWOD7RZ.js";
|
|
40
|
+
import "./chunk-MINLMJUY.js";
|
|
41
|
+
import "./chunk-BG4BP44S.js";
|
|
42
42
|
import "./chunk-3HZOSMPX.js";
|
|
43
43
|
import "./chunk-62BDYGAG.js";
|
|
44
|
+
import "./chunk-DNCQDFJJ.js";
|
|
44
45
|
import "./chunk-RVWJGWCL.js";
|
|
45
|
-
import "./chunk-
|
|
46
|
-
import "./chunk-AE32RGWX.js";
|
|
46
|
+
import "./chunk-LGUXYHTZ.js";
|
|
47
47
|
import "./chunk-B3HOT4TK.js";
|
|
48
48
|
import "./chunk-UYTYNCMZ.js";
|
|
49
|
-
import "./chunk-
|
|
50
|
-
import "./chunk-
|
|
51
|
-
import "./chunk-
|
|
49
|
+
import "./chunk-IUBV5WO5.js";
|
|
50
|
+
import "./chunk-GFM5WWPU.js";
|
|
51
|
+
import "./chunk-BF3WBJJQ.js";
|
|
52
52
|
import "./chunk-NT3ZYB5S.js";
|
|
53
53
|
import "./chunk-R5U7XKVJ.js";
|
|
54
54
|
export {
|