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/devtools.cjs
CHANGED
|
@@ -291,8 +291,19 @@ function reportError(error, context) {
|
|
|
291
291
|
});
|
|
292
292
|
}
|
|
293
293
|
|
|
294
|
+
// src/utils/globalSingleton.ts
|
|
295
|
+
function globalSingleton(key, create) {
|
|
296
|
+
const g = globalThis;
|
|
297
|
+
return g[key] ?? (g[key] = create());
|
|
298
|
+
}
|
|
299
|
+
|
|
294
300
|
// src/core/rendering/dispose.ts
|
|
295
|
-
var
|
|
301
|
+
var state2 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.disposers.v1"), () => ({
|
|
302
|
+
disposers: /* @__PURE__ */ new WeakMap(),
|
|
303
|
+
captures: [],
|
|
304
|
+
bindings: { count: 0 }
|
|
305
|
+
}));
|
|
306
|
+
var elementDisposers = state2.disposers;
|
|
296
307
|
var MAX_DRAIN_TEARDOWNS = 1e4;
|
|
297
308
|
function reportDrainRunaway(label, executed, remaining) {
|
|
298
309
|
if (typeof console === "undefined") return;
|
|
@@ -301,13 +312,13 @@ function reportDrainRunaway(label, executed, remaining) {
|
|
|
301
312
|
{ executed, remaining }
|
|
302
313
|
);
|
|
303
314
|
}
|
|
304
|
-
var
|
|
315
|
+
var bindings = state2.bindings;
|
|
305
316
|
function resolveCapture(capture) {
|
|
306
317
|
let frame = capture;
|
|
307
318
|
while (frame?.closed) frame = frame.forwardTo;
|
|
308
319
|
return frame ?? null;
|
|
309
320
|
}
|
|
310
|
-
var registrationCaptures =
|
|
321
|
+
var registrationCaptures = state2.captures;
|
|
311
322
|
function currentDisposerCapture() {
|
|
312
323
|
return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
313
324
|
}
|
|
@@ -343,13 +354,13 @@ function disposeNodeOwn(node) {
|
|
|
343
354
|
if (!pending || pending.length === 0) break;
|
|
344
355
|
const snapshot = pending.slice();
|
|
345
356
|
elementDisposers.delete(node);
|
|
346
|
-
if (DEV)
|
|
357
|
+
if (DEV) bindings.count -= snapshot.length;
|
|
347
358
|
for (let i = 0; i < snapshot.length; i++) {
|
|
348
359
|
if (executed >= MAX_DRAIN_TEARDOWNS) {
|
|
349
360
|
const rest = snapshot.slice(i);
|
|
350
361
|
const added = elementDisposers.get(node);
|
|
351
362
|
elementDisposers.set(node, added ? rest.concat(added) : rest);
|
|
352
|
-
if (DEV)
|
|
363
|
+
if (DEV) bindings.count += rest.length;
|
|
353
364
|
reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
|
|
354
365
|
runaway = true;
|
|
355
366
|
break;
|
|
@@ -527,6 +538,201 @@ function bindOwnerScope(fn) {
|
|
|
527
538
|
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
528
539
|
}
|
|
529
540
|
var currentStructOwner = null;
|
|
541
|
+
var frozenOwners = 0;
|
|
542
|
+
var ACTIVE = 0;
|
|
543
|
+
var PAUSED = 1;
|
|
544
|
+
var ENDED = 2;
|
|
545
|
+
var NOOP = () => {
|
|
546
|
+
};
|
|
547
|
+
var skippedWhileHeld = /* @__PURE__ */ new Set();
|
|
548
|
+
var waiters = /* @__PURE__ */ new Set();
|
|
549
|
+
var heldRoots = /* @__PURE__ */ new Set();
|
|
550
|
+
function ownerState(tok) {
|
|
551
|
+
let state3 = ACTIVE;
|
|
552
|
+
for (let t = tok; t !== null; ) {
|
|
553
|
+
const o = t.sub;
|
|
554
|
+
if (o === null) return ENDED;
|
|
555
|
+
if (o._frozen === true) state3 = PAUSED;
|
|
556
|
+
t = o._owner ?? null;
|
|
557
|
+
}
|
|
558
|
+
return state3;
|
|
559
|
+
}
|
|
560
|
+
var endWatchers = /* @__PURE__ */ new Set();
|
|
561
|
+
var stateWatchers = /* @__PURE__ */ new Set();
|
|
562
|
+
var stateCheckQueued = false;
|
|
563
|
+
function queueStateCheck() {
|
|
564
|
+
if (stateCheckQueued || stateWatchers.size === 0) return;
|
|
565
|
+
stateCheckQueued = true;
|
|
566
|
+
queueMicrotask(() => {
|
|
567
|
+
stateCheckQueued = false;
|
|
568
|
+
for (const watcher of [...stateWatchers]) {
|
|
569
|
+
if (!stateWatchers.has(watcher)) continue;
|
|
570
|
+
const state3 = watcher.check.state();
|
|
571
|
+
if (state3 === ENDED) stateWatchers.delete(watcher);
|
|
572
|
+
if (state3 === ENDED || state3 === watcher.last) continue;
|
|
573
|
+
watcher.last = state3;
|
|
574
|
+
try {
|
|
575
|
+
watcher.listener(state3);
|
|
576
|
+
} catch (err) {
|
|
577
|
+
reportError(err, { phase: "effect" });
|
|
578
|
+
}
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
var ALWAYS_ACTIVE = Object.assign(() => false, {
|
|
583
|
+
state: () => ACTIVE,
|
|
584
|
+
wait: (onActive) => {
|
|
585
|
+
onActive();
|
|
586
|
+
return NOOP;
|
|
587
|
+
},
|
|
588
|
+
onEnd: () => NOOP,
|
|
589
|
+
run: (fn) => fn(),
|
|
590
|
+
onChange: () => NOOP,
|
|
591
|
+
within: () => false
|
|
592
|
+
});
|
|
593
|
+
function captureFrozen() {
|
|
594
|
+
const tok = currentStructOwner;
|
|
595
|
+
if (tok === null) return ALWAYS_ACTIVE;
|
|
596
|
+
const state3 = () => ownerState(tok);
|
|
597
|
+
const check = Object.assign(() => state3() !== ACTIVE, {
|
|
598
|
+
state: state3,
|
|
599
|
+
wait: (onActive, onEnd) => {
|
|
600
|
+
const now = state3();
|
|
601
|
+
if (now !== PAUSED) {
|
|
602
|
+
(now === ACTIVE ? onActive : onEnd)();
|
|
603
|
+
return NOOP;
|
|
604
|
+
}
|
|
605
|
+
const waiter = { check, onActive, onEnd };
|
|
606
|
+
waiters.add(waiter);
|
|
607
|
+
return () => {
|
|
608
|
+
waiters.delete(waiter);
|
|
609
|
+
};
|
|
610
|
+
},
|
|
611
|
+
onEnd: (onEnd) => {
|
|
612
|
+
if (state3() === ENDED) {
|
|
613
|
+
onEnd();
|
|
614
|
+
return NOOP;
|
|
615
|
+
}
|
|
616
|
+
const watcher = { check, onActive: NOOP, onEnd };
|
|
617
|
+
endWatchers.add(watcher);
|
|
618
|
+
return () => {
|
|
619
|
+
endWatchers.delete(watcher);
|
|
620
|
+
};
|
|
621
|
+
},
|
|
622
|
+
run: (fn) => {
|
|
623
|
+
const prev = currentStructOwner;
|
|
624
|
+
currentStructOwner = tok.sub === null ? null : tok;
|
|
625
|
+
try {
|
|
626
|
+
return fn();
|
|
627
|
+
} finally {
|
|
628
|
+
currentStructOwner = prev;
|
|
629
|
+
}
|
|
630
|
+
},
|
|
631
|
+
onChange: (listener) => {
|
|
632
|
+
const last = state3();
|
|
633
|
+
if (last === ENDED) return NOOP;
|
|
634
|
+
const watcher = { check, last, listener };
|
|
635
|
+
stateWatchers.add(watcher);
|
|
636
|
+
return () => {
|
|
637
|
+
stateWatchers.delete(watcher);
|
|
638
|
+
};
|
|
639
|
+
},
|
|
640
|
+
within: (owner) => {
|
|
641
|
+
const target = owner.run(() => currentStructOwner);
|
|
642
|
+
if (target === null) return false;
|
|
643
|
+
for (let t = tok; t !== null; ) {
|
|
644
|
+
if (t === target) return true;
|
|
645
|
+
const o = t.sub;
|
|
646
|
+
if (o === null) return false;
|
|
647
|
+
t = o._owner ?? null;
|
|
648
|
+
}
|
|
649
|
+
return false;
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
return check;
|
|
653
|
+
}
|
|
654
|
+
function holdSubtree(root) {
|
|
655
|
+
heldRoots.add(root);
|
|
656
|
+
return () => {
|
|
657
|
+
if (heldRoots.delete(root)) settleHeld();
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
function isHeld(sub) {
|
|
661
|
+
if (frozenOwners !== 0 && hasFrozenOwner(sub)) return true;
|
|
662
|
+
if (heldRoots.size !== 0) {
|
|
663
|
+
const node = sub._errorNode;
|
|
664
|
+
if (node != null) {
|
|
665
|
+
for (const root of heldRoots) if (root.contains(node)) return true;
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
return false;
|
|
669
|
+
}
|
|
670
|
+
function notifyEnded() {
|
|
671
|
+
for (const watcher of stateWatchers) if (watcher.check.state() === ENDED) stateWatchers.delete(watcher);
|
|
672
|
+
let ended = null;
|
|
673
|
+
for (const watcher of endWatchers) {
|
|
674
|
+
if (watcher.check.state() !== ENDED) continue;
|
|
675
|
+
endWatchers.delete(watcher);
|
|
676
|
+
(ended ?? (ended = [])).push(watcher);
|
|
677
|
+
}
|
|
678
|
+
if (ended === null) return;
|
|
679
|
+
for (const watcher of ended) {
|
|
680
|
+
try {
|
|
681
|
+
watcher.onEnd();
|
|
682
|
+
} catch (err) {
|
|
683
|
+
reportError(err, { phase: "cleanup" });
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
function dropReleasedSkipped() {
|
|
688
|
+
for (const sub of skippedWhileHeld) {
|
|
689
|
+
if (sub._disposed === true || sub.depsHead == null) skippedWhileHeld.delete(sub);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
function settleHeld() {
|
|
693
|
+
for (const sub of skippedWhileHeld) {
|
|
694
|
+
if (sub._disposed === true) skippedWhileHeld.delete(sub);
|
|
695
|
+
else if (!isHeld(sub)) {
|
|
696
|
+
skippedWhileHeld.delete(sub);
|
|
697
|
+
if (!pendingSet.has(sub)) {
|
|
698
|
+
pendingSet.add(sub);
|
|
699
|
+
pendingQueue.push(sub);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
if (frozenOwners === 0 && heldRoots.size === 0) skippedWhileHeld.clear();
|
|
704
|
+
let ready = null;
|
|
705
|
+
for (const waiter of waiters) {
|
|
706
|
+
if (waiter.check.state() === PAUSED) continue;
|
|
707
|
+
waiters.delete(waiter);
|
|
708
|
+
(ready ?? (ready = [])).push(waiter);
|
|
709
|
+
}
|
|
710
|
+
if (ready !== null) {
|
|
711
|
+
const settle = ready;
|
|
712
|
+
queueMicrotask(() => {
|
|
713
|
+
for (const waiter of settle) {
|
|
714
|
+
const state3 = waiter.check.state();
|
|
715
|
+
if (state3 === PAUSED) waiters.add(waiter);
|
|
716
|
+
else
|
|
717
|
+
try {
|
|
718
|
+
(state3 === ACTIVE ? waiter.onActive : waiter.onEnd)();
|
|
719
|
+
} catch (err) {
|
|
720
|
+
reportError(err, { phase: "effect" });
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
if (pendingQueue.length > 0) drainNotificationQueue();
|
|
726
|
+
}
|
|
727
|
+
function hasFrozenOwner(sub) {
|
|
728
|
+
for (let t = sub._owner ?? null; t !== null; ) {
|
|
729
|
+
const o = t.sub;
|
|
730
|
+
if (o === null) return false;
|
|
731
|
+
if (o._frozen === true) return true;
|
|
732
|
+
t = o._owner ?? null;
|
|
733
|
+
}
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
530
736
|
var subscriberEpochCounter = 0;
|
|
531
737
|
function retrack(effectFn, subscriber) {
|
|
532
738
|
const prev = currentSubscriber;
|
|
@@ -634,6 +840,20 @@ function structuralBinding(commit, ownerNode) {
|
|
|
634
840
|
} finally {
|
|
635
841
|
currentStructOwner = prev;
|
|
636
842
|
}
|
|
843
|
+
},
|
|
844
|
+
freeze: () => {
|
|
845
|
+
const s = sub;
|
|
846
|
+
if (s._disposed || s._frozen) return;
|
|
847
|
+
s._frozen = true;
|
|
848
|
+
frozenOwners++;
|
|
849
|
+
queueStateCheck();
|
|
850
|
+
},
|
|
851
|
+
thaw: () => {
|
|
852
|
+
if (!sub._frozen) return;
|
|
853
|
+
sub._frozen = false;
|
|
854
|
+
frozenOwners--;
|
|
855
|
+
queueStateCheck();
|
|
856
|
+
settleHeld();
|
|
637
857
|
}
|
|
638
858
|
};
|
|
639
859
|
}
|
|
@@ -662,20 +882,34 @@ function createBinding(commit, ownerNode, structural) {
|
|
|
662
882
|
subscriber._errorNode = ownerNode;
|
|
663
883
|
subscriber._tok = null;
|
|
664
884
|
subscriber._owner = null;
|
|
885
|
+
subscriber._frozen = false;
|
|
665
886
|
if (structural) subscriber._tok = { sub: subscriber };
|
|
666
887
|
try {
|
|
667
888
|
run();
|
|
668
889
|
} catch (err) {
|
|
669
890
|
subscriber._disposed = true;
|
|
670
891
|
subscriber._errorNode = void 0;
|
|
671
|
-
if (subscriber._tok != null)
|
|
892
|
+
if (subscriber._tok != null) {
|
|
893
|
+
subscriber._tok.sub = null;
|
|
894
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
895
|
+
}
|
|
672
896
|
cleanup(subscriber);
|
|
673
897
|
throw err;
|
|
674
898
|
}
|
|
675
899
|
subscriber._dispose = () => {
|
|
676
900
|
subscriber._disposed = true;
|
|
901
|
+
const wasFrozen = subscriber._frozen === true;
|
|
902
|
+
if (wasFrozen) {
|
|
903
|
+
subscriber._frozen = false;
|
|
904
|
+
frozenOwners--;
|
|
905
|
+
}
|
|
677
906
|
subscriber._errorNode = void 0;
|
|
678
|
-
if (subscriber._tok != null)
|
|
907
|
+
if (subscriber._tok != null) {
|
|
908
|
+
subscriber._tok.sub = null;
|
|
909
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
910
|
+
if (skippedWhileHeld.size !== 0) dropReleasedSkipped();
|
|
911
|
+
if (wasFrozen || waiters.size !== 0) settleHeld();
|
|
912
|
+
}
|
|
679
913
|
cleanup(subscriber);
|
|
680
914
|
};
|
|
681
915
|
return subscriber;
|
|
@@ -785,6 +1019,10 @@ function runPendingOwners(sub) {
|
|
|
785
1019
|
}
|
|
786
1020
|
}
|
|
787
1021
|
function runQueued(sub) {
|
|
1022
|
+
if ((frozenOwners !== 0 || heldRoots.size !== 0) && isHeld(sub)) {
|
|
1023
|
+
skippedWhileHeld.add(sub);
|
|
1024
|
+
return;
|
|
1025
|
+
}
|
|
788
1026
|
if (quarantined.size > 0 && quarantined.has(sub)) return;
|
|
789
1027
|
if (sub._hasComputedDep === true && !depsChanged(sub)) return;
|
|
790
1028
|
if (tickRepeat(sub)) {
|
|
@@ -932,7 +1170,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
932
1170
|
}
|
|
933
1171
|
|
|
934
1172
|
// src/reactivity/track.ts
|
|
935
|
-
var _runtimeVersion = true ? "4.
|
|
1173
|
+
var _runtimeVersion = true ? "4.15.0" : "dev";
|
|
936
1174
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
937
1175
|
function resolveReactiveApi() {
|
|
938
1176
|
const g = globalThis;
|
|
@@ -968,6 +1206,8 @@ function resolveReactiveApi() {
|
|
|
968
1206
|
runWithOwnerScope,
|
|
969
1207
|
bindOwnerScope,
|
|
970
1208
|
structuralBinding,
|
|
1209
|
+
captureFrozen,
|
|
1210
|
+
holdSubtree,
|
|
971
1211
|
version: _runtimeVersion
|
|
972
1212
|
};
|
|
973
1213
|
g[REGISTRY_KEY] = local;
|
|
@@ -995,6 +1235,22 @@ var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
|
995
1235
|
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
996
1236
|
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
997
1237
|
var structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
|
|
1238
|
+
var captureFrozen2 = API.captureFrozen ?? (() => Object.assign(() => false, {
|
|
1239
|
+
state: () => 0,
|
|
1240
|
+
wait: (onActive) => {
|
|
1241
|
+
onActive();
|
|
1242
|
+
return () => {
|
|
1243
|
+
};
|
|
1244
|
+
},
|
|
1245
|
+
onEnd: () => () => {
|
|
1246
|
+
},
|
|
1247
|
+
run: (fn) => fn(),
|
|
1248
|
+
onChange: () => () => {
|
|
1249
|
+
},
|
|
1250
|
+
within: () => false
|
|
1251
|
+
}));
|
|
1252
|
+
var holdSubtree2 = API.holdSubtree ?? (() => () => {
|
|
1253
|
+
});
|
|
998
1254
|
|
|
999
1255
|
// src/reactivity/batch.ts
|
|
1000
1256
|
var batchDepth = 0;
|
|
@@ -1057,7 +1313,7 @@ function emitDevtools(hook, event, payload) {
|
|
|
1057
1313
|
// src/core/signals/signal.ts
|
|
1058
1314
|
var _g = globalThis;
|
|
1059
1315
|
function signal(initial, options) {
|
|
1060
|
-
const
|
|
1316
|
+
const state3 = {
|
|
1061
1317
|
value: initial,
|
|
1062
1318
|
__v: 0,
|
|
1063
1319
|
__sc: 0,
|
|
@@ -1070,67 +1326,61 @@ function signal(initial, options) {
|
|
|
1070
1326
|
};
|
|
1071
1327
|
const debugName = DEV ? options?.name : void 0;
|
|
1072
1328
|
const equalsFn = options?.equals;
|
|
1073
|
-
if (debugName)
|
|
1329
|
+
if (debugName) state3.__name = debugName;
|
|
1074
1330
|
function get() {
|
|
1075
|
-
recordDependency2(
|
|
1076
|
-
return
|
|
1331
|
+
recordDependency2(state3);
|
|
1332
|
+
return state3.value;
|
|
1077
1333
|
}
|
|
1078
|
-
get.__signal =
|
|
1334
|
+
get.__signal = state3;
|
|
1079
1335
|
if (debugName) get.__name = debugName;
|
|
1080
1336
|
let set;
|
|
1081
1337
|
if (equalsFn) {
|
|
1082
1338
|
set = (next) => {
|
|
1083
|
-
const prev =
|
|
1339
|
+
const prev = state3.value;
|
|
1084
1340
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
1085
1341
|
if (equalsFn(prev, newValue)) return;
|
|
1086
|
-
|
|
1087
|
-
|
|
1342
|
+
state3.value = newValue;
|
|
1343
|
+
state3.__v++;
|
|
1088
1344
|
if (DEV) {
|
|
1089
1345
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1090
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
1346
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
|
|
1091
1347
|
}
|
|
1092
|
-
if (!enqueueBatchedSignal(
|
|
1093
|
-
notifySubscribers2(
|
|
1348
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1349
|
+
notifySubscribers2(state3);
|
|
1094
1350
|
}
|
|
1095
1351
|
};
|
|
1096
1352
|
} else if (DEV) {
|
|
1097
1353
|
set = (next) => {
|
|
1098
|
-
const prev =
|
|
1354
|
+
const prev = state3.value;
|
|
1099
1355
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
1100
1356
|
if (Object.is(newValue, prev)) return;
|
|
1101
|
-
|
|
1102
|
-
|
|
1357
|
+
state3.value = newValue;
|
|
1358
|
+
state3.__v++;
|
|
1103
1359
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1104
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
1105
|
-
if (!enqueueBatchedSignal(
|
|
1106
|
-
notifySubscribers2(
|
|
1360
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
|
|
1361
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1362
|
+
notifySubscribers2(state3);
|
|
1107
1363
|
}
|
|
1108
1364
|
};
|
|
1109
1365
|
} else {
|
|
1110
1366
|
set = (next) => {
|
|
1111
|
-
const prev =
|
|
1367
|
+
const prev = state3.value;
|
|
1112
1368
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
1113
1369
|
if (Object.is(newValue, prev)) return;
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
if (!enqueueBatchedSignal(
|
|
1117
|
-
notifySubscribers2(
|
|
1370
|
+
state3.value = newValue;
|
|
1371
|
+
state3.__v++;
|
|
1372
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1373
|
+
notifySubscribers2(state3);
|
|
1118
1374
|
}
|
|
1119
1375
|
};
|
|
1120
1376
|
}
|
|
1121
1377
|
if (DEV) {
|
|
1122
1378
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1123
|
-
if (hook) emitDevtools(hook, "signal:create", { signal:
|
|
1379
|
+
if (hook) emitDevtools(hook, "signal:create", { signal: state3, name: debugName, getter: get, initial });
|
|
1124
1380
|
}
|
|
1125
1381
|
return [get, set];
|
|
1126
1382
|
}
|
|
1127
1383
|
|
|
1128
|
-
// src/utils/globalSingleton.ts
|
|
1129
|
-
function globalSingleton(key, create) {
|
|
1130
|
-
const g = globalThis;
|
|
1131
|
-
return g[key] ?? (g[key] = create());
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
1384
|
// src/utils/sanitize.ts
|
|
1135
1385
|
function stripHtml(html) {
|
|
1136
1386
|
const input = String(html);
|
|
@@ -1376,8 +1626,8 @@ function initDevTools(config) {
|
|
|
1376
1626
|
function clearEvents() {
|
|
1377
1627
|
eventLog.length = 0;
|
|
1378
1628
|
}
|
|
1379
|
-
function registerComponent(name, element,
|
|
1380
|
-
hook.components.set(name, { element, state:
|
|
1629
|
+
function registerComponent(name, element, state3) {
|
|
1630
|
+
hook.components.set(name, { element, state: state3 });
|
|
1381
1631
|
emit();
|
|
1382
1632
|
}
|
|
1383
1633
|
function unregisterComponent(name) {
|
package/dist/devtools.js
CHANGED
|
@@ -35,14 +35,13 @@ import {
|
|
|
35
35
|
trackCleanup,
|
|
36
36
|
walkDependencyGraph,
|
|
37
37
|
withErrorTracking
|
|
38
|
-
} from "./chunk-
|
|
39
|
-
import "./chunk-
|
|
40
|
-
import "./chunk-AE32RGWX.js";
|
|
38
|
+
} from "./chunk-LQWLPQOK.js";
|
|
39
|
+
import "./chunk-LGUXYHTZ.js";
|
|
41
40
|
import "./chunk-B3HOT4TK.js";
|
|
42
41
|
import "./chunk-UYTYNCMZ.js";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
42
|
+
import "./chunk-IUBV5WO5.js";
|
|
43
|
+
import "./chunk-GFM5WWPU.js";
|
|
44
|
+
import "./chunk-BF3WBJJQ.js";
|
|
46
45
|
import {
|
|
47
46
|
isDev
|
|
48
47
|
} from "./chunk-NT3ZYB5S.js";
|
|
@@ -9,9 +9,10 @@ import {
|
|
|
9
9
|
registerDisposer,
|
|
10
10
|
replaceChildrenSafely,
|
|
11
11
|
reportDrainRunaway,
|
|
12
|
+
stageReplaceChildren,
|
|
12
13
|
unregisterDisposer,
|
|
13
14
|
withDisposerRollback
|
|
14
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-BF3WBJJQ.js";
|
|
15
16
|
import "./chunk-NT3ZYB5S.js";
|
|
16
17
|
import "./chunk-R5U7XKVJ.js";
|
|
17
18
|
export {
|
|
@@ -25,6 +26,7 @@ export {
|
|
|
25
26
|
registerDisposer,
|
|
26
27
|
replaceChildrenSafely,
|
|
27
28
|
reportDrainRunaway,
|
|
29
|
+
stageReplaceChildren,
|
|
28
30
|
unregisterDisposer,
|
|
29
31
|
withDisposerRollback
|
|
30
32
|
};
|