sibujs 4.14.1 → 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-4XCWNGRY.js → chunk-2VKTFA7C.js} +1 -1
- package/dist/{chunk-YPLQQTWS.js → chunk-4AEFGRYW.js} +1 -1
- package/dist/{chunk-VIAVYBNQ.js → chunk-6IV5ZRG6.js} +5 -7
- package/dist/{chunk-KTJC7QPA.js → chunk-75EAQH3U.js} +2 -2
- package/dist/{chunk-LJ2LR5P4.js → chunk-7JO7DPSS.js} +4 -4
- package/dist/{chunk-B2NLNZ3E.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-ZYK4NZZA.js → chunk-D44TAGCT.js} +2 -2
- package/dist/{chunk-OPRQW4LI.js → chunk-DAEXQJQA.js} +1 -1
- package/dist/chunk-DNCQDFJJ.js +22 -0
- package/dist/{chunk-WFMMSMA5.js → chunk-DNCT2UXB.js} +4 -4
- package/dist/{chunk-TOV4PN3P.js → chunk-DRWOD7RZ.js} +4 -4
- package/dist/chunk-DS5V2PRE.js +64 -0
- package/dist/{chunk-L2IPKGUJ.js → chunk-EHSJESRN.js} +595 -123
- package/dist/{chunk-LAHX7XFG.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-FCWOMATN.js → chunk-IUBV5WO5.js} +1 -1
- package/dist/{chunk-TZNR6E6D.js → chunk-KIDETDMU.js} +5 -7
- package/dist/{chunk-TS6JDK7Y.js → chunk-KPAXG5IR.js} +7 -9
- package/dist/{chunk-FFXZ6ELZ.js → chunk-LGUXYHTZ.js} +3 -3
- package/dist/{chunk-NIHGSXOX.js → chunk-LQWLPQOK.js} +6 -8
- package/dist/{chunk-YIXMS546.js → chunk-MINLMJUY.js} +5 -8
- package/dist/{chunk-OLMZF4RU.js → chunk-OURTGOJT.js} +8 -10
- package/dist/{chunk-55TAOW5M.js → chunk-TQ24Y3IV.js} +2 -2
- package/dist/{chunk-LUZXFMKH.js → chunk-UM3M5PXS.js} +8 -8
- package/dist/{chunk-ZKI4SDZ2.js → chunk-VSTX3XSX.js} +205 -15
- package/dist/{chunk-3T7TWMSD.js → chunk-XPDZ2LDR.js} +2 -2
- package/dist/{chunk-RBRITLFL.js → chunk-Y7JM7GY2.js} +5 -7
- package/dist/{chunk-LZKKMDQF.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 +525 -247
- 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 +1194 -290
- 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-HHU3DAD2.js → ssr-EF3IUHTE.js} +6 -6
- package/dist/ssr-dom.cjs +21 -8
- package/dist/ssr-dom.js +2 -1
- package/dist/ssr.cjs +807 -169
- 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 +774 -131
- 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/extras.cjs
CHANGED
|
@@ -452,6 +452,12 @@ function reportError(error, context) {
|
|
|
452
452
|
});
|
|
453
453
|
}
|
|
454
454
|
|
|
455
|
+
// src/utils/globalSingleton.ts
|
|
456
|
+
function globalSingleton(key, create) {
|
|
457
|
+
const g2 = globalThis;
|
|
458
|
+
return g2[key] ?? (g2[key] = create());
|
|
459
|
+
}
|
|
460
|
+
|
|
455
461
|
// src/core/rendering/adoptScope.ts
|
|
456
462
|
var current = null;
|
|
457
463
|
function inAdoptScope() {
|
|
@@ -557,7 +563,12 @@ function beginHydration() {
|
|
|
557
563
|
}
|
|
558
564
|
|
|
559
565
|
// src/core/rendering/dispose.ts
|
|
560
|
-
var
|
|
566
|
+
var state2 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.disposers.v1"), () => ({
|
|
567
|
+
disposers: /* @__PURE__ */ new WeakMap(),
|
|
568
|
+
captures: [],
|
|
569
|
+
bindings: { count: 0 }
|
|
570
|
+
}));
|
|
571
|
+
var elementDisposers = state2.disposers;
|
|
561
572
|
var MAX_DRAIN_TEARDOWNS = 1e4;
|
|
562
573
|
function reportDrainRunaway(label2, executed, remaining) {
|
|
563
574
|
if (typeof console === "undefined") return;
|
|
@@ -566,13 +577,13 @@ function reportDrainRunaway(label2, executed, remaining) {
|
|
|
566
577
|
{ executed, remaining }
|
|
567
578
|
);
|
|
568
579
|
}
|
|
569
|
-
var
|
|
580
|
+
var bindings = state2.bindings;
|
|
570
581
|
function resolveCapture(capture) {
|
|
571
582
|
let frame = capture;
|
|
572
583
|
while (frame?.closed) frame = frame.forwardTo;
|
|
573
584
|
return frame ?? null;
|
|
574
585
|
}
|
|
575
|
-
var registrationCaptures =
|
|
586
|
+
var registrationCaptures = state2.captures;
|
|
576
587
|
function currentDisposerCapture() {
|
|
577
588
|
return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
578
589
|
}
|
|
@@ -591,7 +602,7 @@ function registerDisposer(node, teardown) {
|
|
|
591
602
|
elementDisposers.set(node, disposers);
|
|
592
603
|
}
|
|
593
604
|
disposers.push(teardown);
|
|
594
|
-
if (DEV)
|
|
605
|
+
if (DEV) bindings.count++;
|
|
595
606
|
const capture = resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
596
607
|
if (capture) capture.entries.push([node, teardown]);
|
|
597
608
|
}
|
|
@@ -644,7 +655,7 @@ function unregisterDisposer(node, teardown) {
|
|
|
644
655
|
const index = disposers.indexOf(teardown);
|
|
645
656
|
if (index === -1) return false;
|
|
646
657
|
disposers.splice(index, 1);
|
|
647
|
-
if (DEV)
|
|
658
|
+
if (DEV) bindings.count--;
|
|
648
659
|
if (disposers.length === 0) elementDisposers.delete(node);
|
|
649
660
|
return true;
|
|
650
661
|
}
|
|
@@ -668,17 +679,17 @@ function disposeNodeOwn(node) {
|
|
|
668
679
|
let executed = 0;
|
|
669
680
|
let runaway = false;
|
|
670
681
|
while (!runaway) {
|
|
671
|
-
const
|
|
672
|
-
if (!
|
|
673
|
-
const snapshot =
|
|
682
|
+
const pending2 = elementDisposers.get(node);
|
|
683
|
+
if (!pending2 || pending2.length === 0) break;
|
|
684
|
+
const snapshot = pending2.slice();
|
|
674
685
|
elementDisposers.delete(node);
|
|
675
|
-
if (DEV)
|
|
686
|
+
if (DEV) bindings.count -= snapshot.length;
|
|
676
687
|
for (let i2 = 0; i2 < snapshot.length; i2++) {
|
|
677
688
|
if (executed >= MAX_DRAIN_TEARDOWNS) {
|
|
678
689
|
const rest = snapshot.slice(i2);
|
|
679
690
|
const added = elementDisposers.get(node);
|
|
680
691
|
elementDisposers.set(node, added ? rest.concat(added) : rest);
|
|
681
|
-
if (DEV)
|
|
692
|
+
if (DEV) bindings.count += rest.length;
|
|
682
693
|
reportDrainRunaway("dispose", executed, rest.length + (added?.length ?? 0));
|
|
683
694
|
runaway = true;
|
|
684
695
|
break;
|
|
@@ -881,6 +892,201 @@ function bindOwnerScope(fn) {
|
|
|
881
892
|
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
882
893
|
}
|
|
883
894
|
var currentStructOwner = null;
|
|
895
|
+
var frozenOwners = 0;
|
|
896
|
+
var ACTIVE = 0;
|
|
897
|
+
var PAUSED = 1;
|
|
898
|
+
var ENDED = 2;
|
|
899
|
+
var NOOP = () => {
|
|
900
|
+
};
|
|
901
|
+
var skippedWhileHeld = /* @__PURE__ */ new Set();
|
|
902
|
+
var waiters = /* @__PURE__ */ new Set();
|
|
903
|
+
var heldRoots = /* @__PURE__ */ new Set();
|
|
904
|
+
function ownerState(tok) {
|
|
905
|
+
let state5 = ACTIVE;
|
|
906
|
+
for (let t = tok; t !== null; ) {
|
|
907
|
+
const o = t.sub;
|
|
908
|
+
if (o === null) return ENDED;
|
|
909
|
+
if (o._frozen === true) state5 = PAUSED;
|
|
910
|
+
t = o._owner ?? null;
|
|
911
|
+
}
|
|
912
|
+
return state5;
|
|
913
|
+
}
|
|
914
|
+
var endWatchers = /* @__PURE__ */ new Set();
|
|
915
|
+
var stateWatchers = /* @__PURE__ */ new Set();
|
|
916
|
+
var stateCheckQueued = false;
|
|
917
|
+
function queueStateCheck() {
|
|
918
|
+
if (stateCheckQueued || stateWatchers.size === 0) return;
|
|
919
|
+
stateCheckQueued = true;
|
|
920
|
+
queueMicrotask(() => {
|
|
921
|
+
stateCheckQueued = false;
|
|
922
|
+
for (const watcher of [...stateWatchers]) {
|
|
923
|
+
if (!stateWatchers.has(watcher)) continue;
|
|
924
|
+
const state5 = watcher.check.state();
|
|
925
|
+
if (state5 === ENDED) stateWatchers.delete(watcher);
|
|
926
|
+
if (state5 === ENDED || state5 === watcher.last) continue;
|
|
927
|
+
watcher.last = state5;
|
|
928
|
+
try {
|
|
929
|
+
watcher.listener(state5);
|
|
930
|
+
} catch (err) {
|
|
931
|
+
reportError(err, { phase: "effect" });
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
var ALWAYS_ACTIVE = Object.assign(() => false, {
|
|
937
|
+
state: () => ACTIVE,
|
|
938
|
+
wait: (onActive) => {
|
|
939
|
+
onActive();
|
|
940
|
+
return NOOP;
|
|
941
|
+
},
|
|
942
|
+
onEnd: () => NOOP,
|
|
943
|
+
run: (fn) => fn(),
|
|
944
|
+
onChange: () => NOOP,
|
|
945
|
+
within: () => false
|
|
946
|
+
});
|
|
947
|
+
function captureFrozen() {
|
|
948
|
+
const tok = currentStructOwner;
|
|
949
|
+
if (tok === null) return ALWAYS_ACTIVE;
|
|
950
|
+
const state5 = () => ownerState(tok);
|
|
951
|
+
const check = Object.assign(() => state5() !== ACTIVE, {
|
|
952
|
+
state: state5,
|
|
953
|
+
wait: (onActive, onEnd) => {
|
|
954
|
+
const now = state5();
|
|
955
|
+
if (now !== PAUSED) {
|
|
956
|
+
(now === ACTIVE ? onActive : onEnd)();
|
|
957
|
+
return NOOP;
|
|
958
|
+
}
|
|
959
|
+
const waiter = { check, onActive, onEnd };
|
|
960
|
+
waiters.add(waiter);
|
|
961
|
+
return () => {
|
|
962
|
+
waiters.delete(waiter);
|
|
963
|
+
};
|
|
964
|
+
},
|
|
965
|
+
onEnd: (onEnd) => {
|
|
966
|
+
if (state5() === ENDED) {
|
|
967
|
+
onEnd();
|
|
968
|
+
return NOOP;
|
|
969
|
+
}
|
|
970
|
+
const watcher = { check, onActive: NOOP, onEnd };
|
|
971
|
+
endWatchers.add(watcher);
|
|
972
|
+
return () => {
|
|
973
|
+
endWatchers.delete(watcher);
|
|
974
|
+
};
|
|
975
|
+
},
|
|
976
|
+
run: (fn) => {
|
|
977
|
+
const prev = currentStructOwner;
|
|
978
|
+
currentStructOwner = tok.sub === null ? null : tok;
|
|
979
|
+
try {
|
|
980
|
+
return fn();
|
|
981
|
+
} finally {
|
|
982
|
+
currentStructOwner = prev;
|
|
983
|
+
}
|
|
984
|
+
},
|
|
985
|
+
onChange: (listener) => {
|
|
986
|
+
const last = state5();
|
|
987
|
+
if (last === ENDED) return NOOP;
|
|
988
|
+
const watcher = { check, last, listener };
|
|
989
|
+
stateWatchers.add(watcher);
|
|
990
|
+
return () => {
|
|
991
|
+
stateWatchers.delete(watcher);
|
|
992
|
+
};
|
|
993
|
+
},
|
|
994
|
+
within: (owner) => {
|
|
995
|
+
const target = owner.run(() => currentStructOwner);
|
|
996
|
+
if (target === null) return false;
|
|
997
|
+
for (let t = tok; t !== null; ) {
|
|
998
|
+
if (t === target) return true;
|
|
999
|
+
const o = t.sub;
|
|
1000
|
+
if (o === null) return false;
|
|
1001
|
+
t = o._owner ?? null;
|
|
1002
|
+
}
|
|
1003
|
+
return false;
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
return check;
|
|
1007
|
+
}
|
|
1008
|
+
function holdSubtree(root) {
|
|
1009
|
+
heldRoots.add(root);
|
|
1010
|
+
return () => {
|
|
1011
|
+
if (heldRoots.delete(root)) settleHeld();
|
|
1012
|
+
};
|
|
1013
|
+
}
|
|
1014
|
+
function isHeld(sub2) {
|
|
1015
|
+
if (frozenOwners !== 0 && hasFrozenOwner(sub2)) return true;
|
|
1016
|
+
if (heldRoots.size !== 0) {
|
|
1017
|
+
const node = sub2._errorNode;
|
|
1018
|
+
if (node != null) {
|
|
1019
|
+
for (const root of heldRoots) if (root.contains(node)) return true;
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
return false;
|
|
1023
|
+
}
|
|
1024
|
+
function notifyEnded() {
|
|
1025
|
+
for (const watcher of stateWatchers) if (watcher.check.state() === ENDED) stateWatchers.delete(watcher);
|
|
1026
|
+
let ended = null;
|
|
1027
|
+
for (const watcher of endWatchers) {
|
|
1028
|
+
if (watcher.check.state() !== ENDED) continue;
|
|
1029
|
+
endWatchers.delete(watcher);
|
|
1030
|
+
(ended ?? (ended = [])).push(watcher);
|
|
1031
|
+
}
|
|
1032
|
+
if (ended === null) return;
|
|
1033
|
+
for (const watcher of ended) {
|
|
1034
|
+
try {
|
|
1035
|
+
watcher.onEnd();
|
|
1036
|
+
} catch (err) {
|
|
1037
|
+
reportError(err, { phase: "cleanup" });
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
function dropReleasedSkipped() {
|
|
1042
|
+
for (const sub2 of skippedWhileHeld) {
|
|
1043
|
+
if (sub2._disposed === true || sub2.depsHead == null) skippedWhileHeld.delete(sub2);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
function settleHeld() {
|
|
1047
|
+
for (const sub2 of skippedWhileHeld) {
|
|
1048
|
+
if (sub2._disposed === true) skippedWhileHeld.delete(sub2);
|
|
1049
|
+
else if (!isHeld(sub2)) {
|
|
1050
|
+
skippedWhileHeld.delete(sub2);
|
|
1051
|
+
if (!pendingSet.has(sub2)) {
|
|
1052
|
+
pendingSet.add(sub2);
|
|
1053
|
+
pendingQueue.push(sub2);
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
if (frozenOwners === 0 && heldRoots.size === 0) skippedWhileHeld.clear();
|
|
1058
|
+
let ready = null;
|
|
1059
|
+
for (const waiter of waiters) {
|
|
1060
|
+
if (waiter.check.state() === PAUSED) continue;
|
|
1061
|
+
waiters.delete(waiter);
|
|
1062
|
+
(ready ?? (ready = [])).push(waiter);
|
|
1063
|
+
}
|
|
1064
|
+
if (ready !== null) {
|
|
1065
|
+
const settle = ready;
|
|
1066
|
+
queueMicrotask(() => {
|
|
1067
|
+
for (const waiter of settle) {
|
|
1068
|
+
const state5 = waiter.check.state();
|
|
1069
|
+
if (state5 === PAUSED) waiters.add(waiter);
|
|
1070
|
+
else
|
|
1071
|
+
try {
|
|
1072
|
+
(state5 === ACTIVE ? waiter.onActive : waiter.onEnd)();
|
|
1073
|
+
} catch (err) {
|
|
1074
|
+
reportError(err, { phase: "effect" });
|
|
1075
|
+
}
|
|
1076
|
+
}
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
if (pendingQueue.length > 0) drainNotificationQueue();
|
|
1080
|
+
}
|
|
1081
|
+
function hasFrozenOwner(sub2) {
|
|
1082
|
+
for (let t = sub2._owner ?? null; t !== null; ) {
|
|
1083
|
+
const o = t.sub;
|
|
1084
|
+
if (o === null) return false;
|
|
1085
|
+
if (o._frozen === true) return true;
|
|
1086
|
+
t = o._owner ?? null;
|
|
1087
|
+
}
|
|
1088
|
+
return false;
|
|
1089
|
+
}
|
|
884
1090
|
var subscriberEpochCounter = 0;
|
|
885
1091
|
function retrack(effectFn, subscriber) {
|
|
886
1092
|
const prev = currentSubscriber;
|
|
@@ -988,6 +1194,20 @@ function structuralBinding(commit, ownerNode) {
|
|
|
988
1194
|
} finally {
|
|
989
1195
|
currentStructOwner = prev;
|
|
990
1196
|
}
|
|
1197
|
+
},
|
|
1198
|
+
freeze: () => {
|
|
1199
|
+
const s2 = sub2;
|
|
1200
|
+
if (s2._disposed || s2._frozen) return;
|
|
1201
|
+
s2._frozen = true;
|
|
1202
|
+
frozenOwners++;
|
|
1203
|
+
queueStateCheck();
|
|
1204
|
+
},
|
|
1205
|
+
thaw: () => {
|
|
1206
|
+
if (!sub2._frozen) return;
|
|
1207
|
+
sub2._frozen = false;
|
|
1208
|
+
frozenOwners--;
|
|
1209
|
+
queueStateCheck();
|
|
1210
|
+
settleHeld();
|
|
991
1211
|
}
|
|
992
1212
|
};
|
|
993
1213
|
}
|
|
@@ -1016,20 +1236,34 @@ function createBinding(commit, ownerNode, structural) {
|
|
|
1016
1236
|
subscriber._errorNode = ownerNode;
|
|
1017
1237
|
subscriber._tok = null;
|
|
1018
1238
|
subscriber._owner = null;
|
|
1239
|
+
subscriber._frozen = false;
|
|
1019
1240
|
if (structural) subscriber._tok = { sub: subscriber };
|
|
1020
1241
|
try {
|
|
1021
1242
|
run();
|
|
1022
1243
|
} catch (err) {
|
|
1023
1244
|
subscriber._disposed = true;
|
|
1024
1245
|
subscriber._errorNode = void 0;
|
|
1025
|
-
if (subscriber._tok != null)
|
|
1246
|
+
if (subscriber._tok != null) {
|
|
1247
|
+
subscriber._tok.sub = null;
|
|
1248
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
1249
|
+
}
|
|
1026
1250
|
cleanup(subscriber);
|
|
1027
1251
|
throw err;
|
|
1028
1252
|
}
|
|
1029
1253
|
subscriber._dispose = () => {
|
|
1030
1254
|
subscriber._disposed = true;
|
|
1255
|
+
const wasFrozen = subscriber._frozen === true;
|
|
1256
|
+
if (wasFrozen) {
|
|
1257
|
+
subscriber._frozen = false;
|
|
1258
|
+
frozenOwners--;
|
|
1259
|
+
}
|
|
1031
1260
|
subscriber._errorNode = void 0;
|
|
1032
|
-
if (subscriber._tok != null)
|
|
1261
|
+
if (subscriber._tok != null) {
|
|
1262
|
+
subscriber._tok.sub = null;
|
|
1263
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
1264
|
+
if (skippedWhileHeld.size !== 0) dropReleasedSkipped();
|
|
1265
|
+
if (wasFrozen || waiters.size !== 0) settleHeld();
|
|
1266
|
+
}
|
|
1033
1267
|
cleanup(subscriber);
|
|
1034
1268
|
};
|
|
1035
1269
|
return subscriber;
|
|
@@ -1139,6 +1373,10 @@ function runPendingOwners(sub2) {
|
|
|
1139
1373
|
}
|
|
1140
1374
|
}
|
|
1141
1375
|
function runQueued(sub2) {
|
|
1376
|
+
if ((frozenOwners !== 0 || heldRoots.size !== 0) && isHeld(sub2)) {
|
|
1377
|
+
skippedWhileHeld.add(sub2);
|
|
1378
|
+
return;
|
|
1379
|
+
}
|
|
1142
1380
|
if (quarantined.size > 0 && quarantined.has(sub2)) return;
|
|
1143
1381
|
if (sub2._hasComputedDep === true && !depsChanged(sub2)) return;
|
|
1144
1382
|
if (tickRepeat(sub2)) {
|
|
@@ -1286,7 +1524,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
1286
1524
|
}
|
|
1287
1525
|
|
|
1288
1526
|
// src/reactivity/track.ts
|
|
1289
|
-
var _runtimeVersion = true ? "4.
|
|
1527
|
+
var _runtimeVersion = true ? "4.15.0" : "dev";
|
|
1290
1528
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
1291
1529
|
function resolveReactiveApi() {
|
|
1292
1530
|
const g2 = globalThis;
|
|
@@ -1322,6 +1560,8 @@ function resolveReactiveApi() {
|
|
|
1322
1560
|
runWithOwnerScope,
|
|
1323
1561
|
bindOwnerScope,
|
|
1324
1562
|
structuralBinding,
|
|
1563
|
+
captureFrozen,
|
|
1564
|
+
holdSubtree,
|
|
1325
1565
|
version: _runtimeVersion
|
|
1326
1566
|
};
|
|
1327
1567
|
g2[REGISTRY_KEY] = local;
|
|
@@ -1349,6 +1589,22 @@ var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
|
1349
1589
|
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
1350
1590
|
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
1351
1591
|
var structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
|
|
1592
|
+
var captureFrozen2 = API.captureFrozen ?? (() => Object.assign(() => false, {
|
|
1593
|
+
state: () => 0,
|
|
1594
|
+
wait: (onActive) => {
|
|
1595
|
+
onActive();
|
|
1596
|
+
return () => {
|
|
1597
|
+
};
|
|
1598
|
+
},
|
|
1599
|
+
onEnd: () => () => {
|
|
1600
|
+
},
|
|
1601
|
+
run: (fn) => fn(),
|
|
1602
|
+
onChange: () => () => {
|
|
1603
|
+
},
|
|
1604
|
+
within: () => false
|
|
1605
|
+
}));
|
|
1606
|
+
var holdSubtree2 = API.holdSubtree ?? (() => () => {
|
|
1607
|
+
});
|
|
1352
1608
|
|
|
1353
1609
|
// src/core/devtoolsHook.ts
|
|
1354
1610
|
function emitDevtools(hook, event, payload) {
|
|
@@ -1598,14 +1854,14 @@ function runInSSRContext(fn) {
|
|
|
1598
1854
|
}
|
|
1599
1855
|
function trackPending(promise, label2, hydration = true) {
|
|
1600
1856
|
const store = getRequestStore();
|
|
1601
|
-
const
|
|
1602
|
-
const sessions =
|
|
1603
|
-
if (!
|
|
1857
|
+
const pending2 = store?.pending;
|
|
1858
|
+
const sessions = pending2 || !hydration ? [] : hydrationOwners();
|
|
1859
|
+
if (!pending2 && sessions.length === 0) return promise;
|
|
1604
1860
|
const entry = { label: label2, since: Date.now(), boundary: currentBoundary() ?? void 0 };
|
|
1605
|
-
|
|
1861
|
+
pending2?.add(entry);
|
|
1606
1862
|
const release = holdHydration(sessions, entry);
|
|
1607
1863
|
const done = () => {
|
|
1608
|
-
|
|
1864
|
+
pending2?.delete(entry);
|
|
1609
1865
|
store?.wake?.();
|
|
1610
1866
|
release();
|
|
1611
1867
|
};
|
|
@@ -1804,7 +2060,7 @@ var isBatching = API2.isBatching;
|
|
|
1804
2060
|
// src/core/signals/signal.ts
|
|
1805
2061
|
var _g2 = globalThis;
|
|
1806
2062
|
function signal(initial, options) {
|
|
1807
|
-
const
|
|
2063
|
+
const state5 = {
|
|
1808
2064
|
value: initial,
|
|
1809
2065
|
__v: 0,
|
|
1810
2066
|
__sc: 0,
|
|
@@ -1817,67 +2073,61 @@ function signal(initial, options) {
|
|
|
1817
2073
|
};
|
|
1818
2074
|
const debugName = DEV ? options?.name : void 0;
|
|
1819
2075
|
const equalsFn = options?.equals;
|
|
1820
|
-
if (debugName)
|
|
2076
|
+
if (debugName) state5.__name = debugName;
|
|
1821
2077
|
function get() {
|
|
1822
|
-
recordDependency2(
|
|
1823
|
-
return
|
|
2078
|
+
recordDependency2(state5);
|
|
2079
|
+
return state5.value;
|
|
1824
2080
|
}
|
|
1825
|
-
get.__signal =
|
|
2081
|
+
get.__signal = state5;
|
|
1826
2082
|
if (debugName) get.__name = debugName;
|
|
1827
2083
|
let set;
|
|
1828
2084
|
if (equalsFn) {
|
|
1829
2085
|
set = (next) => {
|
|
1830
|
-
const prev =
|
|
2086
|
+
const prev = state5.value;
|
|
1831
2087
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
1832
2088
|
if (equalsFn(prev, newValue)) return;
|
|
1833
|
-
|
|
1834
|
-
|
|
2089
|
+
state5.value = newValue;
|
|
2090
|
+
state5.__v++;
|
|
1835
2091
|
if (DEV) {
|
|
1836
2092
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1837
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
2093
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state5, name: debugName, oldValue: prev, newValue });
|
|
1838
2094
|
}
|
|
1839
|
-
if (!enqueueBatchedSignal(
|
|
1840
|
-
notifySubscribers2(
|
|
2095
|
+
if (!enqueueBatchedSignal(state5)) {
|
|
2096
|
+
notifySubscribers2(state5);
|
|
1841
2097
|
}
|
|
1842
2098
|
};
|
|
1843
2099
|
} else if (DEV) {
|
|
1844
2100
|
set = (next) => {
|
|
1845
|
-
const prev =
|
|
2101
|
+
const prev = state5.value;
|
|
1846
2102
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
1847
2103
|
if (Object.is(newValue, prev)) return;
|
|
1848
|
-
|
|
1849
|
-
|
|
2104
|
+
state5.value = newValue;
|
|
2105
|
+
state5.__v++;
|
|
1850
2106
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1851
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
1852
|
-
if (!enqueueBatchedSignal(
|
|
1853
|
-
notifySubscribers2(
|
|
2107
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state5, name: debugName, oldValue: prev, newValue });
|
|
2108
|
+
if (!enqueueBatchedSignal(state5)) {
|
|
2109
|
+
notifySubscribers2(state5);
|
|
1854
2110
|
}
|
|
1855
2111
|
};
|
|
1856
2112
|
} else {
|
|
1857
2113
|
set = (next) => {
|
|
1858
|
-
const prev =
|
|
2114
|
+
const prev = state5.value;
|
|
1859
2115
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
1860
2116
|
if (Object.is(newValue, prev)) return;
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
if (!enqueueBatchedSignal(
|
|
1864
|
-
notifySubscribers2(
|
|
2117
|
+
state5.value = newValue;
|
|
2118
|
+
state5.__v++;
|
|
2119
|
+
if (!enqueueBatchedSignal(state5)) {
|
|
2120
|
+
notifySubscribers2(state5);
|
|
1865
2121
|
}
|
|
1866
2122
|
};
|
|
1867
2123
|
}
|
|
1868
2124
|
if (DEV) {
|
|
1869
2125
|
const hook = _g2.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
1870
|
-
if (hook) emitDevtools(hook, "signal:create", { signal:
|
|
2126
|
+
if (hook) emitDevtools(hook, "signal:create", { signal: state5, name: debugName, getter: get, initial });
|
|
1871
2127
|
}
|
|
1872
2128
|
return [get, set];
|
|
1873
2129
|
}
|
|
1874
2130
|
|
|
1875
|
-
// src/utils/globalSingleton.ts
|
|
1876
|
-
function globalSingleton(key, create) {
|
|
1877
|
-
const g2 = globalThis;
|
|
1878
|
-
return g2[key] ?? (g2[key] = create());
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
2131
|
// src/utils/guards.ts
|
|
1882
2132
|
var UNSAFE_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
1883
2133
|
function isUnsafeKey(key) {
|
|
@@ -2183,10 +2433,10 @@ function primeFromTransfer() {
|
|
|
2183
2433
|
}
|
|
2184
2434
|
}
|
|
2185
2435
|
registerTransferCollector("q", () => {
|
|
2186
|
-
const
|
|
2187
|
-
if (!
|
|
2436
|
+
const cache2 = getRequestScopedCache("query");
|
|
2437
|
+
if (!cache2) return void 0;
|
|
2188
2438
|
const out = {};
|
|
2189
|
-
for (const [key, entry] of
|
|
2439
|
+
for (const [key, entry] of cache2) {
|
|
2190
2440
|
if (entry.noTransfer || entry.data === void 0 || entry.error) continue;
|
|
2191
2441
|
out[key] = { d: entry.data, t: entry.dataUpdatedAt };
|
|
2192
2442
|
}
|
|
@@ -2200,8 +2450,8 @@ function abandonEntry(entry) {
|
|
|
2200
2450
|
entry.promise = null;
|
|
2201
2451
|
entry.generation++;
|
|
2202
2452
|
}
|
|
2203
|
-
function getOrCreateEntry(
|
|
2204
|
-
let entry =
|
|
2453
|
+
function getOrCreateEntry(cache2, key, initialData) {
|
|
2454
|
+
let entry = cache2.get(key);
|
|
2205
2455
|
if (!entry) {
|
|
2206
2456
|
entry = {
|
|
2207
2457
|
data: initialData,
|
|
@@ -2219,7 +2469,7 @@ function getOrCreateEntry(cache, key, initialData) {
|
|
|
2219
2469
|
sharedFrom: void 0,
|
|
2220
2470
|
hasShared: false
|
|
2221
2471
|
};
|
|
2222
|
-
|
|
2472
|
+
cache2.set(key, entry);
|
|
2223
2473
|
}
|
|
2224
2474
|
return entry;
|
|
2225
2475
|
}
|
|
@@ -2244,7 +2494,7 @@ function query(key, fetcher, options = {}) {
|
|
|
2244
2494
|
const resolveKey = typeof key === "function" ? key : () => key;
|
|
2245
2495
|
const enabledGate = typeof enabled === "function" ? derived(() => Boolean(enabled())) : null;
|
|
2246
2496
|
const isEnabled = onServer && !ssr ? () => false : enabledGate ?? (() => Boolean(enabled));
|
|
2247
|
-
const
|
|
2497
|
+
const cache2 = getActiveQueryCache();
|
|
2248
2498
|
const [data2, setData] = signal(initialData);
|
|
2249
2499
|
const [isFetching, setIsFetching] = signal(false);
|
|
2250
2500
|
const [error, setError] = signal(void 0);
|
|
@@ -2269,7 +2519,7 @@ function query(key, fetcher, options = {}) {
|
|
|
2269
2519
|
data2();
|
|
2270
2520
|
updatedAt();
|
|
2271
2521
|
if (!currentKey) return true;
|
|
2272
|
-
const entry =
|
|
2522
|
+
const entry = cache2.get(currentKey);
|
|
2273
2523
|
if (!entry || entry.dataUpdatedAt === 0) return true;
|
|
2274
2524
|
return Date.now() - entry.dataUpdatedAt >= staleTime;
|
|
2275
2525
|
});
|
|
@@ -2328,13 +2578,13 @@ function query(key, fetcher, options = {}) {
|
|
|
2328
2578
|
entry.refetchers.delete(doFetch);
|
|
2329
2579
|
entry.subscribers = Math.max(0, entry.subscribers - 1);
|
|
2330
2580
|
if (entry.subscribers > 0 || cacheTime < 0 || key2 === null) return;
|
|
2331
|
-
if (
|
|
2581
|
+
if (cache2.get(key2) !== entry) return;
|
|
2332
2582
|
if (entry.gcTimer !== null) clearTimeout(entry.gcTimer);
|
|
2333
2583
|
entry.gcTimer = setTimeout(() => {
|
|
2334
|
-
const current2 =
|
|
2584
|
+
const current2 = cache2.get(key2);
|
|
2335
2585
|
if (current2 === entry && current2.subscribers <= 0) {
|
|
2336
2586
|
abandonEntry(current2);
|
|
2337
|
-
|
|
2587
|
+
cache2.delete(key2);
|
|
2338
2588
|
}
|
|
2339
2589
|
}, cacheTime);
|
|
2340
2590
|
entry.gcTimer.unref?.();
|
|
@@ -2361,7 +2611,7 @@ function query(key, fetcher, options = {}) {
|
|
|
2361
2611
|
async function doFetch() {
|
|
2362
2612
|
if (disposed || !currentKey || !untracked2(isEnabled)) return;
|
|
2363
2613
|
const key2 = currentKey;
|
|
2364
|
-
const entry = getOrCreateEntry(
|
|
2614
|
+
const entry = getOrCreateEntry(cache2, key2);
|
|
2365
2615
|
attachToEntry(entry, key2);
|
|
2366
2616
|
if (entry.promise) {
|
|
2367
2617
|
setIsFetching(true);
|
|
@@ -2441,7 +2691,7 @@ function query(key, fetcher, options = {}) {
|
|
|
2441
2691
|
}
|
|
2442
2692
|
function onCacheUpdate() {
|
|
2443
2693
|
if (disposed || !currentKey) return;
|
|
2444
|
-
const entry =
|
|
2694
|
+
const entry = cache2.get(currentKey);
|
|
2445
2695
|
if (!entry) {
|
|
2446
2696
|
batch(() => {
|
|
2447
2697
|
commitBase(null, void 0);
|
|
@@ -2471,7 +2721,7 @@ function query(key, fetcher, options = {}) {
|
|
|
2471
2721
|
setIsFetching(false);
|
|
2472
2722
|
return;
|
|
2473
2723
|
}
|
|
2474
|
-
const entry = getOrCreateEntry(
|
|
2724
|
+
const entry = getOrCreateEntry(cache2, key2, initialData);
|
|
2475
2725
|
if (!ssr) entry.noTransfer = true;
|
|
2476
2726
|
const reattached = attachedEntry !== entry;
|
|
2477
2727
|
attachToEntry(entry, key2);
|
|
@@ -2890,23 +3140,23 @@ function debounce(getter, delay) {
|
|
|
2890
3140
|
function throttle(getter, interval) {
|
|
2891
3141
|
const [throttled, setThrottled] = signal(getter());
|
|
2892
3142
|
let cooldown = false;
|
|
2893
|
-
let
|
|
3143
|
+
let pending2 = null;
|
|
2894
3144
|
let lastEmitted = getter();
|
|
2895
3145
|
let timer = null;
|
|
2896
3146
|
function emit(value) {
|
|
2897
3147
|
setThrottled(value);
|
|
2898
3148
|
lastEmitted = value;
|
|
2899
3149
|
cooldown = true;
|
|
2900
|
-
|
|
3150
|
+
pending2 = null;
|
|
2901
3151
|
timer = setTimeout(endWindow, interval);
|
|
2902
3152
|
}
|
|
2903
3153
|
function endWindow() {
|
|
2904
3154
|
timer = null;
|
|
2905
|
-
if (
|
|
2906
|
-
emit(
|
|
3155
|
+
if (pending2 !== null && !Object.is(pending2.value, lastEmitted)) {
|
|
3156
|
+
emit(pending2.value);
|
|
2907
3157
|
return;
|
|
2908
3158
|
}
|
|
2909
|
-
|
|
3159
|
+
pending2 = null;
|
|
2910
3160
|
cooldown = false;
|
|
2911
3161
|
}
|
|
2912
3162
|
const stop2 = effect(() => {
|
|
@@ -2914,7 +3164,7 @@ function throttle(getter, interval) {
|
|
|
2914
3164
|
if (!cooldown) {
|
|
2915
3165
|
if (!Object.is(value, lastEmitted)) emit(value);
|
|
2916
3166
|
} else {
|
|
2917
|
-
|
|
3167
|
+
pending2 = { value };
|
|
2918
3168
|
}
|
|
2919
3169
|
});
|
|
2920
3170
|
Object.defineProperty(throttled, "dispose", {
|
|
@@ -3268,8 +3518,8 @@ async function offlineStore(options) {
|
|
|
3268
3518
|
const out = [];
|
|
3269
3519
|
for (const remote of remoteItems) {
|
|
3270
3520
|
const key = remote[keyPath];
|
|
3271
|
-
const
|
|
3272
|
-
if (!
|
|
3521
|
+
const pending2 = key == null ? void 0 : pendingByKey.get(key);
|
|
3522
|
+
if (!pending2) {
|
|
3273
3523
|
out.push(remote);
|
|
3274
3524
|
continue;
|
|
3275
3525
|
}
|
|
@@ -3287,8 +3537,8 @@ async function offlineStore(options) {
|
|
|
3287
3537
|
continue;
|
|
3288
3538
|
}
|
|
3289
3539
|
try {
|
|
3290
|
-
const local =
|
|
3291
|
-
const choice = await activeAdapter.resolveConflict({ key, local, remote, pending });
|
|
3540
|
+
const local = pending2.type === "delete" ? void 0 : await idbGet(db, "items", key);
|
|
3541
|
+
const choice = await activeAdapter.resolveConflict({ key, local, remote, pending: pending2 });
|
|
3292
3542
|
if (choice !== void 0) out.push(choice);
|
|
3293
3543
|
} catch (err) {
|
|
3294
3544
|
if (typeof console !== "undefined") {
|
|
@@ -3340,23 +3590,23 @@ function syncAdapter(config) {
|
|
|
3340
3590
|
var _clientScope = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.routeLoader.v2"), () => ({ stack: [] }));
|
|
3341
3591
|
var _disposed = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.routeLoader.disposed.v1"), () => /* @__PURE__ */ new WeakSet());
|
|
3342
3592
|
function currentScope() {
|
|
3343
|
-
const
|
|
3344
|
-
if (!
|
|
3345
|
-
let scope =
|
|
3593
|
+
const cache2 = getRequestScopedCache("routeLoader");
|
|
3594
|
+
if (!cache2) return _clientScope;
|
|
3595
|
+
let scope = cache2.get("scope");
|
|
3346
3596
|
if (!scope) {
|
|
3347
3597
|
scope = { stack: [] };
|
|
3348
|
-
|
|
3598
|
+
cache2.set("scope", scope);
|
|
3349
3599
|
}
|
|
3350
3600
|
return scope;
|
|
3351
3601
|
}
|
|
3352
3602
|
function automaticKey(loader, context) {
|
|
3353
3603
|
const key = `loader:${context.path}${loader.name ? `:${loader.name}` : ""}`;
|
|
3354
|
-
const
|
|
3355
|
-
if (!
|
|
3356
|
-
let owners =
|
|
3604
|
+
const cache2 = getRequestScopedCache("routeLoader");
|
|
3605
|
+
if (!cache2) return key;
|
|
3606
|
+
let owners = cache2.get("owners");
|
|
3357
3607
|
if (!owners) {
|
|
3358
3608
|
owners = /* @__PURE__ */ new Map();
|
|
3359
|
-
|
|
3609
|
+
cache2.set("owners", owners);
|
|
3360
3610
|
}
|
|
3361
3611
|
const owner = owners.get(key);
|
|
3362
3612
|
if (owner === void 0) {
|
|
@@ -4352,13 +4602,13 @@ function idle(timeout = 6e4) {
|
|
|
4352
4602
|
|
|
4353
4603
|
// src/browser/permissions.ts
|
|
4354
4604
|
function permissions(name) {
|
|
4355
|
-
const [
|
|
4605
|
+
const [state5, setState] = signal("prompt");
|
|
4356
4606
|
let permissionStatus = null;
|
|
4357
4607
|
let onChange = null;
|
|
4358
4608
|
let disposed = false;
|
|
4359
4609
|
if (typeof navigator === "undefined" || !navigator.permissions) {
|
|
4360
4610
|
setState("unsupported");
|
|
4361
|
-
return { state:
|
|
4611
|
+
return { state: state5, dispose: () => {
|
|
4362
4612
|
} };
|
|
4363
4613
|
}
|
|
4364
4614
|
navigator.permissions.query({ name }).then((status) => {
|
|
@@ -4381,7 +4631,7 @@ function permissions(name) {
|
|
|
4381
4631
|
onChange = null;
|
|
4382
4632
|
}
|
|
4383
4633
|
}
|
|
4384
|
-
return { state:
|
|
4634
|
+
return { state: state5, dispose: dispose2 };
|
|
4385
4635
|
}
|
|
4386
4636
|
|
|
4387
4637
|
// src/browser/clipboard.ts
|
|
@@ -4730,9 +4980,9 @@ function colorScheme() {
|
|
|
4730
4980
|
// src/browser/format.ts
|
|
4731
4981
|
var I18N_STATE = /* @__PURE__ */ Symbol.for("sibujs.i18n.v1");
|
|
4732
4982
|
function activeI18nLocale() {
|
|
4733
|
-
const
|
|
4734
|
-
if (!
|
|
4735
|
-
return
|
|
4983
|
+
const state5 = globalThis[I18N_STATE];
|
|
4984
|
+
if (!state5) return void 0;
|
|
4985
|
+
return state5.getLocale ? state5.getLocale() : state5.locale?.[0]();
|
|
4736
4986
|
}
|
|
4737
4987
|
function formatNumber(value, options) {
|
|
4738
4988
|
const { locale, ...formatOptions } = options ?? {};
|
|
@@ -4914,9 +5164,9 @@ function notifyUrlWrite() {
|
|
|
4914
5164
|
for (const sync of Array.from(_url.instances)) sync();
|
|
4915
5165
|
}
|
|
4916
5166
|
var SCROLL_ENTRY_KEY = "__sibuScrollKey";
|
|
4917
|
-
function withoutEntryIdentity(
|
|
4918
|
-
if (
|
|
4919
|
-
const { [SCROLL_ENTRY_KEY]: _identity, ...rest } =
|
|
5167
|
+
function withoutEntryIdentity(state5) {
|
|
5168
|
+
if (state5 === null || typeof state5 !== "object" || !Object.hasOwn(state5, SCROLL_ENTRY_KEY)) return state5;
|
|
5169
|
+
const { [SCROLL_ENTRY_KEY]: _identity, ...rest } = state5;
|
|
4920
5170
|
return rest;
|
|
4921
5171
|
}
|
|
4922
5172
|
function urlState() {
|
|
@@ -4954,9 +5204,9 @@ function urlState() {
|
|
|
4954
5204
|
window.addEventListener("hashchange", syncFromLocation);
|
|
4955
5205
|
_url.instances.add(syncFromLocation);
|
|
4956
5206
|
function writeHistory(newUrl, opts) {
|
|
4957
|
-
const
|
|
4958
|
-
if (opts.replace) window.history.replaceState(
|
|
4959
|
-
else window.history.pushState("state" in opts ?
|
|
5207
|
+
const state5 = "state" in opts ? opts.state : window.history.state;
|
|
5208
|
+
if (opts.replace) window.history.replaceState(state5, "", newUrl);
|
|
5209
|
+
else window.history.pushState("state" in opts ? state5 : withoutEntryIdentity(state5), "", newUrl);
|
|
4960
5210
|
}
|
|
4961
5211
|
function setParams(next, opts = {}) {
|
|
4962
5212
|
const p2 = next instanceof URLSearchParams ? next : new URLSearchParams(next);
|
|
@@ -5763,7 +6013,7 @@ function ownEntry(table2, key) {
|
|
|
5763
6013
|
return Object.hasOwn(table2, key) ? table2[key] : void 0;
|
|
5764
6014
|
}
|
|
5765
6015
|
function machine(config) {
|
|
5766
|
-
const [
|
|
6016
|
+
const [state5, setState] = signal(config.initial);
|
|
5767
6017
|
const [context, setContext] = signal(config.context || {});
|
|
5768
6018
|
let currentState = config.initial;
|
|
5769
6019
|
let currentContext = context();
|
|
@@ -5837,10 +6087,10 @@ function machine(config) {
|
|
|
5837
6087
|
if (queue.length > 0) drain();
|
|
5838
6088
|
}
|
|
5839
6089
|
function matches(s2) {
|
|
5840
|
-
return
|
|
6090
|
+
return state5() === s2;
|
|
5841
6091
|
}
|
|
5842
6092
|
function can(event) {
|
|
5843
|
-
const currentState2 =
|
|
6093
|
+
const currentState2 = state5();
|
|
5844
6094
|
const stateDef = ownEntry(config.states, currentState2);
|
|
5845
6095
|
if (!stateDef?.on) return false;
|
|
5846
6096
|
const transition2 = ownEntry(stateDef.on, event);
|
|
@@ -5851,7 +6101,7 @@ function machine(config) {
|
|
|
5851
6101
|
}
|
|
5852
6102
|
return true;
|
|
5853
6103
|
}
|
|
5854
|
-
return { state:
|
|
6104
|
+
return { state: state5, context, send, matches, can };
|
|
5855
6105
|
}
|
|
5856
6106
|
|
|
5857
6107
|
// src/patterns/persist.ts
|
|
@@ -5940,7 +6190,7 @@ function persisted(key, initial, options = {}) {
|
|
|
5940
6190
|
// src/patterns/optimistic.ts
|
|
5941
6191
|
function optimistic(initialValue) {
|
|
5942
6192
|
const [value, setValue] = signal(initialValue);
|
|
5943
|
-
const [
|
|
6193
|
+
const [pending2, setPending] = signal(false);
|
|
5944
6194
|
let inflightCount = 0;
|
|
5945
6195
|
let version = 0;
|
|
5946
6196
|
async function update(optimisticValue, asyncAction) {
|
|
@@ -5966,7 +6216,7 @@ function optimistic(initialValue) {
|
|
|
5966
6216
|
}
|
|
5967
6217
|
}
|
|
5968
6218
|
}
|
|
5969
|
-
return { value, pending, update };
|
|
6219
|
+
return { value, pending: pending2, update };
|
|
5970
6220
|
}
|
|
5971
6221
|
function optimisticList(initialValue) {
|
|
5972
6222
|
let nextRowId = 0;
|
|
@@ -6012,7 +6262,7 @@ function optimisticList(initialValue) {
|
|
|
6012
6262
|
if (i2 > 0) claims.splice(0, i2);
|
|
6013
6263
|
}
|
|
6014
6264
|
const [items, setItems] = signal(order.map((id) => effectiveValue(records.get(id))));
|
|
6015
|
-
const [
|
|
6265
|
+
const [pending2, setPending] = signal(false);
|
|
6016
6266
|
let inflight = 0;
|
|
6017
6267
|
const retiredRowIds = /* @__PURE__ */ new Set();
|
|
6018
6268
|
function project() {
|
|
@@ -6215,7 +6465,7 @@ function optimisticList(initialValue) {
|
|
|
6215
6465
|
}
|
|
6216
6466
|
return {
|
|
6217
6467
|
items,
|
|
6218
|
-
pending,
|
|
6468
|
+
pending: pending2,
|
|
6219
6469
|
add,
|
|
6220
6470
|
remove,
|
|
6221
6471
|
update: updateItem
|
|
@@ -6317,13 +6567,13 @@ function adopt(value) {
|
|
|
6317
6567
|
resolvePromise = resolve;
|
|
6318
6568
|
rejectPromise = reject;
|
|
6319
6569
|
});
|
|
6320
|
-
let
|
|
6570
|
+
let state5 = "invoking";
|
|
6321
6571
|
let nativeTarget;
|
|
6322
|
-
const
|
|
6572
|
+
const waiters2 = [];
|
|
6323
6573
|
const transition2 = (next) => {
|
|
6324
|
-
|
|
6574
|
+
state5 = next;
|
|
6325
6575
|
if (next === "invoking") return;
|
|
6326
|
-
for (const waiter of
|
|
6576
|
+
for (const waiter of waiters2.splice(0)) waiter();
|
|
6327
6577
|
};
|
|
6328
6578
|
const fulfil = (result) => {
|
|
6329
6579
|
resolvePromise(result);
|
|
@@ -6379,18 +6629,18 @@ function adopt(value) {
|
|
|
6379
6629
|
} catch (error) {
|
|
6380
6630
|
onReject(error);
|
|
6381
6631
|
}
|
|
6382
|
-
if (!done &&
|
|
6632
|
+
if (!done && state5 === "invoking") transition2("pending");
|
|
6383
6633
|
});
|
|
6384
6634
|
};
|
|
6385
6635
|
invokeLater(value, then);
|
|
6386
6636
|
const probe = (onRejected, onOpen) => {
|
|
6387
6637
|
const decide = () => {
|
|
6388
|
-
if (
|
|
6389
|
-
else (
|
|
6638
|
+
if (state5 === "native") probeNative(nativeTarget, onRejected, onOpen);
|
|
6639
|
+
else (state5 === "rejected" ? onRejected : onOpen)();
|
|
6390
6640
|
};
|
|
6391
|
-
if (
|
|
6392
|
-
else if (
|
|
6393
|
-
else queueMicrotask(
|
|
6641
|
+
if (state5 === "native") probeNative(nativeTarget, onRejected, onOpen);
|
|
6642
|
+
else if (state5 === "invoking") waiters2.push(decide);
|
|
6643
|
+
else queueMicrotask(state5 === "rejected" ? onRejected : onOpen);
|
|
6394
6644
|
};
|
|
6395
6645
|
return { promise, failedEarly: false, probe };
|
|
6396
6646
|
}
|
|
@@ -6431,12 +6681,12 @@ function globalStore(config) {
|
|
|
6431
6681
|
const [getState, setState] = signal({ ...initialState });
|
|
6432
6682
|
const subscriptions = /* @__PURE__ */ new Map();
|
|
6433
6683
|
const middlewares = config.middleware || [];
|
|
6434
|
-
function notifyListeners2(
|
|
6684
|
+
function notifyListeners2(state5) {
|
|
6435
6685
|
if (subscriptions.size === 0) return;
|
|
6436
6686
|
for (const subscription of Array.from(subscriptions.values())) {
|
|
6437
6687
|
if (!subscription.active) continue;
|
|
6438
6688
|
try {
|
|
6439
|
-
subscription.callback(
|
|
6689
|
+
subscription.callback(state5);
|
|
6440
6690
|
} catch (err) {
|
|
6441
6691
|
reportError(err, { phase: "event", name: "globalStore(subscribe)" });
|
|
6442
6692
|
}
|
|
@@ -7411,16 +7661,16 @@ function form(config) {
|
|
|
7411
7661
|
}
|
|
7412
7662
|
if (isValid()) {
|
|
7413
7663
|
const report = (error) => reportError(error, { phase: "async", name: "form.handleSubmit" });
|
|
7414
|
-
let
|
|
7664
|
+
let pending2;
|
|
7415
7665
|
try {
|
|
7416
|
-
|
|
7666
|
+
pending2 = adoptThenable(onSubmit(values()));
|
|
7417
7667
|
} catch (error) {
|
|
7418
7668
|
report(error);
|
|
7419
7669
|
return;
|
|
7420
7670
|
}
|
|
7421
|
-
if (
|
|
7671
|
+
if (pending2) {
|
|
7422
7672
|
setSubmitting(true);
|
|
7423
|
-
|
|
7673
|
+
pending2.then(
|
|
7424
7674
|
() => setSubmitting(false),
|
|
7425
7675
|
(error) => {
|
|
7426
7676
|
setSubmitting(false);
|
|
@@ -8362,8 +8612,8 @@ function commitSafeAttribute(el, name, value, options) {
|
|
|
8362
8612
|
else el.removeAttribute(name);
|
|
8363
8613
|
return false;
|
|
8364
8614
|
}
|
|
8365
|
-
const
|
|
8366
|
-
const refusal = contextualAttributeRefusal(el, name,
|
|
8615
|
+
const pending2 = value == null || value === false ? null : value === true ? "" : String(value);
|
|
8616
|
+
const refusal = contextualAttributeRefusal(el, name, pending2, options.reactive ? "reactive" : "runtime");
|
|
8367
8617
|
if (refusal !== ContextualRefusal.None) {
|
|
8368
8618
|
warnContextualRefusal(options.label ?? "setSafeAttribute", name, refusal);
|
|
8369
8619
|
if (ns) el.removeAttributeNS(ns, localName);
|
|
@@ -9188,14 +9438,14 @@ function noSideEffect(fn) {
|
|
|
9188
9438
|
}
|
|
9189
9439
|
|
|
9190
9440
|
// src/utils/embedPolicy.ts
|
|
9191
|
-
var
|
|
9441
|
+
var state3 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.embed.v2"), () => ({
|
|
9192
9442
|
allowed: [],
|
|
9193
9443
|
frames: /* @__PURE__ */ new WeakMap()
|
|
9194
9444
|
}));
|
|
9195
9445
|
var REQUEST_CACHE = "embed";
|
|
9196
9446
|
function currentEmbedAllowlist() {
|
|
9197
9447
|
const scoped = getRequestStore()?.caches?.get(REQUEST_CACHE)?.get("allowed");
|
|
9198
|
-
return scoped ??
|
|
9448
|
+
return scoped ?? state3.allowed;
|
|
9199
9449
|
}
|
|
9200
9450
|
function resolveEmbedSrc(value, allowed = currentEmbedAllowlist()) {
|
|
9201
9451
|
if (typeof value !== "string" || sanitizeUrl(value) === "") return null;
|
|
@@ -9255,7 +9505,7 @@ function narrowEmbedAllow(value) {
|
|
|
9255
9505
|
return granted.filter((feature) => !denied.includes(feature)).join("; ");
|
|
9256
9506
|
}
|
|
9257
9507
|
function getEmbedRecord(frame) {
|
|
9258
|
-
return
|
|
9508
|
+
return state3.frames.get(frame);
|
|
9259
9509
|
}
|
|
9260
9510
|
function intersect(current2, permitted, separator) {
|
|
9261
9511
|
const allowed = permitted.split(separator);
|
|
@@ -9370,6 +9620,25 @@ function serializePlannedHeadEntry(tag, attributes) {
|
|
|
9370
9620
|
return `<${tag} ${pairs} />`;
|
|
9371
9621
|
}
|
|
9372
9622
|
|
|
9623
|
+
// src/utils/styleKey.ts
|
|
9624
|
+
var EXCEPTIONS = { cssFloat: "float" };
|
|
9625
|
+
var VENDOR_PREFIX = /^(webkit|moz|ms|o)-/;
|
|
9626
|
+
var cache = /* @__PURE__ */ new Map();
|
|
9627
|
+
var CACHE_MAX = 1e3;
|
|
9628
|
+
function styleKeyToProperty(key) {
|
|
9629
|
+
let name = cache.get(key);
|
|
9630
|
+
if (name !== void 0) return name;
|
|
9631
|
+
if (key.startsWith("--")) name = key;
|
|
9632
|
+
else if (Object.hasOwn(EXCEPTIONS, key)) name = EXCEPTIONS[key];
|
|
9633
|
+
else {
|
|
9634
|
+
name = key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
9635
|
+
if (VENDOR_PREFIX.test(name)) name = `-${name}`;
|
|
9636
|
+
}
|
|
9637
|
+
if (cache.size >= CACHE_MAX) cache.clear();
|
|
9638
|
+
cache.set(key, name);
|
|
9639
|
+
return name;
|
|
9640
|
+
}
|
|
9641
|
+
|
|
9373
9642
|
// src/platform/serverDom.ts
|
|
9374
9643
|
var HTML_NS3 = "http://www.w3.org/1999/xhtml";
|
|
9375
9644
|
var SVG_NS3 = "http://www.w3.org/2000/svg";
|
|
@@ -10045,12 +10314,6 @@ function splitDeclarations(text2) {
|
|
|
10045
10314
|
out.push(text2.slice(start));
|
|
10046
10315
|
return out;
|
|
10047
10316
|
}
|
|
10048
|
-
var CAMEL_EXCEPTIONS = { cssFloat: "float" };
|
|
10049
|
-
function toKebab(prop) {
|
|
10050
|
-
if (prop.startsWith("--")) return prop;
|
|
10051
|
-
if (Object.hasOwn(CAMEL_EXCEPTIONS, prop)) return CAMEL_EXCEPTIONS[prop];
|
|
10052
|
-
return prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`).replace(/^(webkit|moz|ms)-/, "-$1-");
|
|
10053
|
-
}
|
|
10054
10317
|
var ServerStyle = class {
|
|
10055
10318
|
constructor(el) {
|
|
10056
10319
|
this.el = el;
|
|
@@ -10145,13 +10408,13 @@ function styleProxy(style2) {
|
|
|
10145
10408
|
get(target, key, receiver) {
|
|
10146
10409
|
if (typeof key === "string" && !(key in target)) {
|
|
10147
10410
|
if (/^\d+$/.test(key)) return target.item(Number(key));
|
|
10148
|
-
return target.getPropertyValue(
|
|
10411
|
+
return target.getPropertyValue(styleKeyToProperty(key));
|
|
10149
10412
|
}
|
|
10150
10413
|
return Reflect.get(target, key, receiver);
|
|
10151
10414
|
},
|
|
10152
10415
|
set(target, key, value, receiver) {
|
|
10153
10416
|
if (typeof key === "string" && !(key in target)) {
|
|
10154
|
-
target.setProperty(
|
|
10417
|
+
target.setProperty(styleKeyToProperty(key), value == null ? "" : String(value));
|
|
10155
10418
|
return true;
|
|
10156
10419
|
}
|
|
10157
10420
|
return Reflect.set(target, key, value, receiver);
|
|
@@ -10983,21 +11246,21 @@ function compileSelector(selector) {
|
|
|
10983
11246
|
const tokens = text2.match(/(?:\\.|\[[^\]]*\]|[^\s>])+|>/g) ?? [];
|
|
10984
11247
|
const compounds = [];
|
|
10985
11248
|
const combinators = [];
|
|
10986
|
-
let
|
|
11249
|
+
let pending2 = " ";
|
|
10987
11250
|
let scoped = false;
|
|
10988
11251
|
for (const token of tokens) {
|
|
10989
11252
|
if (token === ">") {
|
|
10990
|
-
|
|
11253
|
+
pending2 = ">";
|
|
10991
11254
|
continue;
|
|
10992
11255
|
}
|
|
10993
11256
|
if (token === ":scope") {
|
|
10994
11257
|
scoped = true;
|
|
10995
|
-
|
|
11258
|
+
pending2 = " ";
|
|
10996
11259
|
continue;
|
|
10997
11260
|
}
|
|
10998
|
-
if (compounds.length > 0) combinators.unshift(
|
|
11261
|
+
if (compounds.length > 0) combinators.unshift(pending2);
|
|
10999
11262
|
compounds.unshift(parseCompound(token, selector));
|
|
11000
|
-
|
|
11263
|
+
pending2 = " ";
|
|
11001
11264
|
}
|
|
11002
11265
|
if (compounds.length === 0) throw syntaxError(selector);
|
|
11003
11266
|
groups.push({ compounds, combinators, scoped });
|
|
@@ -11848,12 +12111,12 @@ async function hydrateAdopt(component, container, options = {}) {
|
|
|
11848
12111
|
inScope(rootScope, () => session.place(container, tree));
|
|
11849
12112
|
}
|
|
11850
12113
|
const deadline = Date.now() + (options.timeout ?? 1e4);
|
|
11851
|
-
const { pending, wake } = hydration;
|
|
12114
|
+
const { pending: pending2, wake } = hydration;
|
|
11852
12115
|
for (; ; ) {
|
|
11853
12116
|
await macrotask();
|
|
11854
|
-
if (
|
|
12117
|
+
if (pending2.size === 0) {
|
|
11855
12118
|
await macrotask();
|
|
11856
|
-
if (
|
|
12119
|
+
if (pending2.size === 0) break;
|
|
11857
12120
|
continue;
|
|
11858
12121
|
}
|
|
11859
12122
|
const remaining = deadline - Date.now();
|
|
@@ -11924,9 +12187,9 @@ function installHook() {
|
|
|
11924
12187
|
if (hookInstalled) return;
|
|
11925
12188
|
hookInstalled = true;
|
|
11926
12189
|
setBoundaryHook((container) => {
|
|
11927
|
-
const
|
|
12190
|
+
const state5 = requestSlot("stream");
|
|
11928
12191
|
const store = getRequestStore();
|
|
11929
|
-
if (!
|
|
12192
|
+
if (!state5 || !store) return null;
|
|
11930
12193
|
const id = `sibu-sus-${store.suspenseIdCounter++}`;
|
|
11931
12194
|
container.setAttribute("data-sibu-suspense-id", id);
|
|
11932
12195
|
const record = {
|
|
@@ -11937,8 +12200,8 @@ function installHook() {
|
|
|
11937
12200
|
fallbackHtml: null,
|
|
11938
12201
|
api: {
|
|
11939
12202
|
enter: (fn) => {
|
|
11940
|
-
if (record.fallbackHtml === null &&
|
|
11941
|
-
record.fallbackHtml = Array.from(container.childNodes, (n) =>
|
|
12203
|
+
if (record.fallbackHtml === null && state5.serialize) {
|
|
12204
|
+
record.fallbackHtml = Array.from(container.childNodes, (n) => state5.serialize?.(n) ?? "").join("");
|
|
11942
12205
|
}
|
|
11943
12206
|
return runInBoundary(record.api, fn);
|
|
11944
12207
|
},
|
|
@@ -11948,7 +12211,7 @@ function installHook() {
|
|
|
11948
12211
|
}
|
|
11949
12212
|
}
|
|
11950
12213
|
};
|
|
11951
|
-
|
|
12214
|
+
state5.boundaries.push(record);
|
|
11952
12215
|
return record.api;
|
|
11953
12216
|
});
|
|
11954
12217
|
}
|
|
@@ -12033,9 +12296,9 @@ async function waitFor(ready, deadline, stop2) {
|
|
|
12033
12296
|
});
|
|
12034
12297
|
}
|
|
12035
12298
|
}
|
|
12036
|
-
function pendingFor(
|
|
12037
|
-
if (!
|
|
12038
|
-
for (const work of
|
|
12299
|
+
function pendingFor(pending2, boundary) {
|
|
12300
|
+
if (!pending2) return false;
|
|
12301
|
+
for (const work of pending2) if (work.boundary === boundary) return true;
|
|
12039
12302
|
return false;
|
|
12040
12303
|
}
|
|
12041
12304
|
function streamPage(input2, options = {}) {
|
|
@@ -12048,8 +12311,8 @@ function streamPage(input2, options = {}) {
|
|
|
12048
12311
|
const MARK_END = "<sibu-stream-end>";
|
|
12049
12312
|
void runInSSRContext(async () => {
|
|
12050
12313
|
const store = getRequestStore();
|
|
12051
|
-
const
|
|
12052
|
-
requestSlot("stream", () =>
|
|
12314
|
+
const state5 = { boundaries: [], serialize: null };
|
|
12315
|
+
requestSlot("stream", () => state5);
|
|
12053
12316
|
const errors = [];
|
|
12054
12317
|
if (store) store.errors = errors;
|
|
12055
12318
|
let holder = null;
|
|
@@ -12070,13 +12333,13 @@ function streamPage(input2, options = {}) {
|
|
|
12070
12333
|
throw explainServerError(err);
|
|
12071
12334
|
}
|
|
12072
12335
|
const serialize = (node) => renderToStringWith(node, { marker: options.marker ?? "root", ids });
|
|
12073
|
-
|
|
12336
|
+
state5.serialize = serialize;
|
|
12074
12337
|
holder = document.createDocumentFragment();
|
|
12075
12338
|
holder.appendChild(root);
|
|
12076
12339
|
const ready = (b2) => b2.done && !pendingFor(store?.pending, b2.api);
|
|
12077
12340
|
const serializeWithFallbacks = (node) => {
|
|
12078
12341
|
const held = [];
|
|
12079
|
-
for (const b2 of
|
|
12342
|
+
for (const b2 of state5.boundaries) {
|
|
12080
12343
|
if (ready(b2) || b2.container === node || !node.contains(b2.container)) continue;
|
|
12081
12344
|
if (held.some((h) => h.b.container.contains(b2.container))) continue;
|
|
12082
12345
|
const nodes = Array.from(b2.container.childNodes);
|
|
@@ -12098,9 +12361,9 @@ function streamPage(input2, options = {}) {
|
|
|
12098
12361
|
await waitFor(() => !pendingFor(store?.pending, void 0), shellDeadline, stopWaiting);
|
|
12099
12362
|
failIfErrored();
|
|
12100
12363
|
if (channel.cancelled) return;
|
|
12101
|
-
for (const b2 of
|
|
12364
|
+
for (const b2 of state5.boundaries) {
|
|
12102
12365
|
const inline = (x) => x.done && !pendingFor(store?.pending, x.api);
|
|
12103
|
-
const enclosing =
|
|
12366
|
+
const enclosing = state5.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
|
|
12104
12367
|
if (inline(b2) && enclosing.every(inline)) b2.emitted = true;
|
|
12105
12368
|
}
|
|
12106
12369
|
const shell = serializeWithFallbacks(holder);
|
|
@@ -12121,8 +12384,8 @@ function streamPage(input2, options = {}) {
|
|
|
12121
12384
|
if (channel.cancelled) return;
|
|
12122
12385
|
failIfErrored();
|
|
12123
12386
|
const deadline = Date.now() + (options.timeout ?? 1e4);
|
|
12124
|
-
const outstanding = () =>
|
|
12125
|
-
const ancestorsOf = (b2) =>
|
|
12387
|
+
const outstanding = () => state5.boundaries.filter((b2) => !b2.emitted);
|
|
12388
|
+
const ancestorsOf = (b2) => state5.boundaries.filter((a2) => a2 !== b2 && a2.container.contains(b2.container));
|
|
12126
12389
|
const emittable = (b2) => ready(b2) && ancestorsOf(b2).every((a2) => a2.emitted);
|
|
12127
12390
|
let bodyClosed = false;
|
|
12128
12391
|
for (; ; ) {
|
|
@@ -12146,7 +12409,7 @@ function streamPage(input2, options = {}) {
|
|
|
12146
12409
|
if (channel.cancelled) return;
|
|
12147
12410
|
failIfErrored();
|
|
12148
12411
|
}
|
|
12149
|
-
for (const b2 of
|
|
12412
|
+
for (const b2 of state5.boundaries) {
|
|
12150
12413
|
if (b2 === next || !next.container.contains(b2.container) || !ready(b2)) continue;
|
|
12151
12414
|
const between2 = ancestorsOf(b2).filter((a2) => a2 !== next && next.container.contains(a2.container));
|
|
12152
12415
|
if (between2.every(ready)) b2.emitted = true;
|
|
@@ -12845,12 +13108,12 @@ function escapeScriptJson(json) {
|
|
|
12845
13108
|
}
|
|
12846
13109
|
var DEFAULT_MAX_SSR_BYTES = 1024 * 1024;
|
|
12847
13110
|
var SAFE_GLOBAL_NAME = /^[A-Za-z_$][A-Za-z0-9_$]*$/;
|
|
12848
|
-
function serializeState(
|
|
13111
|
+
function serializeState(state5, nonce, options) {
|
|
12849
13112
|
const globalName = options?.global ?? SSR_DATA_ATTR;
|
|
12850
13113
|
if (!SAFE_GLOBAL_NAME.test(globalName)) {
|
|
12851
13114
|
throw new Error(`[SibuJS SSR] serializeState: global must be an identifier (got: ${JSON.stringify(globalName)})`);
|
|
12852
13115
|
}
|
|
12853
|
-
const rawJson = JSON.stringify(
|
|
13116
|
+
const rawJson = JSON.stringify(state5);
|
|
12854
13117
|
const maxBytes = options?.maxBytes ?? DEFAULT_MAX_SSR_BYTES;
|
|
12855
13118
|
const byteLen = typeof TextEncoder !== "undefined" ? new TextEncoder().encode(rawJson).byteLength : Buffer.byteLength(rawJson, "utf8");
|
|
12856
13119
|
if (byteLen > maxBytes) {
|
|
@@ -12962,8 +13225,8 @@ function normalizedStore(schema) {
|
|
|
12962
13225
|
return ownGet(getState().entities, id);
|
|
12963
13226
|
}
|
|
12964
13227
|
function getAll() {
|
|
12965
|
-
const
|
|
12966
|
-
return
|
|
13228
|
+
const state5 = getState();
|
|
13229
|
+
return state5.ids.map((id) => state5.entities[id]);
|
|
12967
13230
|
}
|
|
12968
13231
|
function update(id, partial) {
|
|
12969
13232
|
const prev = getState();
|
|
@@ -12996,8 +13259,8 @@ function normalizedStore(schema) {
|
|
|
12996
13259
|
});
|
|
12997
13260
|
}
|
|
12998
13261
|
function select3(predicate) {
|
|
12999
|
-
const
|
|
13000
|
-
return
|
|
13262
|
+
const state5 = getState();
|
|
13263
|
+
return state5.ids.map((id) => state5.entities[id]).filter(predicate);
|
|
13001
13264
|
}
|
|
13002
13265
|
return { add, addMany, get, getAll, update, remove, select: select3, getState };
|
|
13003
13266
|
}
|
|
@@ -13085,8 +13348,8 @@ function createChunkRegistry(config = {}) {
|
|
|
13085
13348
|
onLoadEnd,
|
|
13086
13349
|
onLoadError
|
|
13087
13350
|
} = config;
|
|
13088
|
-
const
|
|
13089
|
-
const
|
|
13351
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
13352
|
+
const pending2 = /* @__PURE__ */ new Map();
|
|
13090
13353
|
const preloaded = /* @__PURE__ */ new Map();
|
|
13091
13354
|
function notify2(name, run) {
|
|
13092
13355
|
try {
|
|
@@ -13096,17 +13359,17 @@ function createChunkRegistry(config = {}) {
|
|
|
13096
13359
|
}
|
|
13097
13360
|
}
|
|
13098
13361
|
function evict() {
|
|
13099
|
-
while (
|
|
13362
|
+
while (cache2.size >= maxCacheSize) {
|
|
13100
13363
|
let lru = null;
|
|
13101
13364
|
let lruTime = Infinity;
|
|
13102
|
-
for (const [key, entry] of
|
|
13365
|
+
for (const [key, entry] of cache2) {
|
|
13103
13366
|
if (entry.lastAccess < lruTime) {
|
|
13104
13367
|
lruTime = entry.lastAccess;
|
|
13105
13368
|
lru = key;
|
|
13106
13369
|
}
|
|
13107
13370
|
}
|
|
13108
13371
|
if (!lru) return;
|
|
13109
|
-
|
|
13372
|
+
cache2.delete(lru);
|
|
13110
13373
|
}
|
|
13111
13374
|
}
|
|
13112
13375
|
function isValid(entry) {
|
|
@@ -13143,13 +13406,13 @@ function createChunkRegistry(config = {}) {
|
|
|
13143
13406
|
}
|
|
13144
13407
|
}
|
|
13145
13408
|
async function loadFn(id, loader) {
|
|
13146
|
-
const cached =
|
|
13409
|
+
const cached = cache2.get(id);
|
|
13147
13410
|
if (cached && isValid(cached)) {
|
|
13148
13411
|
cached.accessCount++;
|
|
13149
13412
|
cached.lastAccess = Date.now();
|
|
13150
13413
|
return cached.value;
|
|
13151
13414
|
}
|
|
13152
|
-
const existing =
|
|
13415
|
+
const existing = pending2.get(id);
|
|
13153
13416
|
if (existing) return existing.promise;
|
|
13154
13417
|
let resolveOuter;
|
|
13155
13418
|
let rejectOuter;
|
|
@@ -13158,22 +13421,22 @@ function createChunkRegistry(config = {}) {
|
|
|
13158
13421
|
rejectOuter = reject;
|
|
13159
13422
|
});
|
|
13160
13423
|
const entry = { promise: outcome };
|
|
13161
|
-
|
|
13162
|
-
const owns = () =>
|
|
13424
|
+
pending2.set(id, entry);
|
|
13425
|
+
const owns = () => pending2.get(id) === entry;
|
|
13163
13426
|
notify2("onLoadStart", () => onLoadStart?.(id));
|
|
13164
13427
|
void loadWithRetry(id, loader).then(
|
|
13165
13428
|
(value) => {
|
|
13166
13429
|
if (owns()) {
|
|
13167
|
-
|
|
13430
|
+
pending2.delete(id);
|
|
13168
13431
|
evict();
|
|
13169
13432
|
const now = Date.now();
|
|
13170
|
-
|
|
13433
|
+
cache2.set(id, { value, timestamp: now, lastAccess: now, accessCount: 1 });
|
|
13171
13434
|
}
|
|
13172
13435
|
notify2("onLoadEnd", () => onLoadEnd?.(id));
|
|
13173
13436
|
resolveOuter(value);
|
|
13174
13437
|
},
|
|
13175
13438
|
(err) => {
|
|
13176
|
-
if (owns())
|
|
13439
|
+
if (owns()) pending2.delete(id);
|
|
13177
13440
|
const error = err instanceof Error ? err : new Error(String(err));
|
|
13178
13441
|
notify2("onLoadError", () => onLoadError?.(id, error));
|
|
13179
13442
|
rejectOuter(error);
|
|
@@ -13185,7 +13448,7 @@ function createChunkRegistry(config = {}) {
|
|
|
13185
13448
|
return outcome;
|
|
13186
13449
|
}
|
|
13187
13450
|
function preloadFn(id, loader) {
|
|
13188
|
-
if (
|
|
13451
|
+
if (cache2.has(id) || pending2.has(id) || preloaded.has(id)) return;
|
|
13189
13452
|
const marker2 = {};
|
|
13190
13453
|
preloaded.set(id, marker2);
|
|
13191
13454
|
loadFn(id, loader).catch(() => {
|
|
@@ -13207,14 +13470,14 @@ function createChunkRegistry(config = {}) {
|
|
|
13207
13470
|
* Check if a chunk is cached and valid.
|
|
13208
13471
|
*/
|
|
13209
13472
|
has(id) {
|
|
13210
|
-
const entry =
|
|
13473
|
+
const entry = cache2.get(id);
|
|
13211
13474
|
return !!entry && isValid(entry);
|
|
13212
13475
|
},
|
|
13213
13476
|
/**
|
|
13214
13477
|
* Get a cached chunk synchronously. Returns undefined if not cached.
|
|
13215
13478
|
*/
|
|
13216
13479
|
get(id) {
|
|
13217
|
-
const entry =
|
|
13480
|
+
const entry = cache2.get(id);
|
|
13218
13481
|
if (entry && isValid(entry)) {
|
|
13219
13482
|
entry.accessCount++;
|
|
13220
13483
|
entry.lastAccess = Date.now();
|
|
@@ -13231,9 +13494,9 @@ function createChunkRegistry(config = {}) {
|
|
|
13231
13494
|
* a subsequent `load(id, …)` starts fresh work rather than adopting it.
|
|
13232
13495
|
*/
|
|
13233
13496
|
invalidate(id) {
|
|
13234
|
-
|
|
13497
|
+
cache2.delete(id);
|
|
13235
13498
|
preloaded.delete(id);
|
|
13236
|
-
|
|
13499
|
+
pending2.delete(id);
|
|
13237
13500
|
},
|
|
13238
13501
|
/**
|
|
13239
13502
|
* Clear all cached chunks, and supersede every load still in flight.
|
|
@@ -13241,9 +13504,9 @@ function createChunkRegistry(config = {}) {
|
|
|
13241
13504
|
* Same barrier as `invalidate`, applied to every key at once.
|
|
13242
13505
|
*/
|
|
13243
13506
|
clear() {
|
|
13244
|
-
|
|
13507
|
+
cache2.clear();
|
|
13245
13508
|
preloaded.clear();
|
|
13246
|
-
|
|
13509
|
+
pending2.clear();
|
|
13247
13510
|
},
|
|
13248
13511
|
/**
|
|
13249
13512
|
* Get cache statistics.
|
|
@@ -13253,9 +13516,9 @@ function createChunkRegistry(config = {}) {
|
|
|
13253
13516
|
*/
|
|
13254
13517
|
stats() {
|
|
13255
13518
|
return {
|
|
13256
|
-
size:
|
|
13519
|
+
size: cache2.size,
|
|
13257
13520
|
maxSize: maxCacheSize,
|
|
13258
|
-
pending:
|
|
13521
|
+
pending: pending2.size,
|
|
13259
13522
|
preloaded: preloaded.size
|
|
13260
13523
|
};
|
|
13261
13524
|
}
|
|
@@ -13993,16 +14256,16 @@ async function loadWasmModuleWithOptions(source2, opts = {}) {
|
|
|
13993
14256
|
if (cachedInstance) return cachedInstance;
|
|
13994
14257
|
const inFlight = inFlightCache.get(key);
|
|
13995
14258
|
if (inFlight) return inFlight;
|
|
13996
|
-
const
|
|
14259
|
+
const pending2 = instantiateWasm(source2, opts.imports, key, generation).then((instance) => {
|
|
13997
14260
|
if (isCurrentGeneration(generation)) instanceCache.set(key, instance);
|
|
13998
14261
|
return instance;
|
|
13999
14262
|
});
|
|
14000
|
-
inFlightCache.set(key,
|
|
14001
|
-
void
|
|
14263
|
+
inFlightCache.set(key, pending2);
|
|
14264
|
+
void pending2.catch(() => {
|
|
14002
14265
|
}).then(() => {
|
|
14003
|
-
if (inFlightCache.get(key) ===
|
|
14266
|
+
if (inFlightCache.get(key) === pending2) inFlightCache.delete(key);
|
|
14004
14267
|
});
|
|
14005
|
-
return
|
|
14268
|
+
return pending2;
|
|
14006
14269
|
}
|
|
14007
14270
|
async function instantiateWasm(source2, wasmImports, key, generation) {
|
|
14008
14271
|
const cachedModule = key ? moduleCache.get(key) : void 0;
|
|
@@ -14179,7 +14442,7 @@ function restoreFocusWithin(snapshot, nodes, where, policy) {
|
|
|
14179
14442
|
const active = document.activeElement;
|
|
14180
14443
|
if (active === snapshot.el) return;
|
|
14181
14444
|
if (active && active !== document.body && active !== document.documentElement) return;
|
|
14182
|
-
if (snapshot.el.isConnected) {
|
|
14445
|
+
if (snapshot.el.isConnected && !snapshot.el.closest("[inert]")) {
|
|
14183
14446
|
refocus(snapshot.el, snapshot);
|
|
14184
14447
|
return;
|
|
14185
14448
|
}
|
|
@@ -14206,8 +14469,25 @@ function restoreFocusWithin(snapshot, nodes, where, policy) {
|
|
|
14206
14469
|
});
|
|
14207
14470
|
}
|
|
14208
14471
|
|
|
14472
|
+
// src/core/rendering/range.ts
|
|
14473
|
+
var state4 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.ranges.v1"), () => ({
|
|
14474
|
+
ends: /* @__PURE__ */ new WeakMap(),
|
|
14475
|
+
pending: /* @__PURE__ */ new WeakMap(),
|
|
14476
|
+
registrations: /* @__PURE__ */ new Set(),
|
|
14477
|
+
listeners: /* @__PURE__ */ new Set(),
|
|
14478
|
+
notice: { queued: false, batch: [] }
|
|
14479
|
+
}));
|
|
14480
|
+
var ends = state4.ends;
|
|
14481
|
+
function registerRange(start, last) {
|
|
14482
|
+
ends.set(start, last);
|
|
14483
|
+
}
|
|
14484
|
+
var pending = state4.pending;
|
|
14485
|
+
var registrations = state4.registrations;
|
|
14486
|
+
var loadListeners = state4.listeners;
|
|
14487
|
+
var notice = state4.notice;
|
|
14488
|
+
|
|
14209
14489
|
// src/reactivity/bindChildNode.ts
|
|
14210
|
-
function bindChildNode(placeholder, getter) {
|
|
14490
|
+
function bindChildNode(placeholder, getter, exposeNodes) {
|
|
14211
14491
|
let lastNodes = [];
|
|
14212
14492
|
const scope = captureScope();
|
|
14213
14493
|
function commit() {
|
|
@@ -14278,6 +14558,12 @@ function bindChildNode(placeholder, getter) {
|
|
|
14278
14558
|
lastNodes = newNodes;
|
|
14279
14559
|
restoreFocusWithin(focused, newNodes, "bindChildNode");
|
|
14280
14560
|
}
|
|
14561
|
+
if (exposeNodes) {
|
|
14562
|
+
registerRange(placeholder, () => {
|
|
14563
|
+
for (let i2 = lastNodes.length - 1; i2 >= 0; i2--) if (lastNodes[i2].parentNode !== null) return lastNodes[i2];
|
|
14564
|
+
return null;
|
|
14565
|
+
});
|
|
14566
|
+
}
|
|
14281
14567
|
return reactiveBinding2(commit, placeholder, true);
|
|
14282
14568
|
}
|
|
14283
14569
|
|
|
@@ -14306,14 +14592,6 @@ var CLOBBER_RISKY_IDS = /* @__PURE__ */ new Set([
|
|
|
14306
14592
|
var warnedLoneStrings = /* @__PURE__ */ new Set();
|
|
14307
14593
|
var MAX_WARNED_LONE_STRINGS = 100;
|
|
14308
14594
|
var loneStringCapAnnounced = false;
|
|
14309
|
-
var kebabCache = /* @__PURE__ */ new Map();
|
|
14310
|
-
function toKebab2(prop) {
|
|
14311
|
-
let cached = kebabCache.get(prop);
|
|
14312
|
-
if (cached !== void 0) return cached;
|
|
14313
|
-
cached = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
14314
|
-
kebabCache.set(prop, cached);
|
|
14315
|
-
return cached;
|
|
14316
|
-
}
|
|
14317
14595
|
function applyStyle(el, style2) {
|
|
14318
14596
|
if (typeof style2 === "function") {
|
|
14319
14597
|
const getter = style2;
|
|
@@ -14337,7 +14615,7 @@ function applyStyle(el, style2) {
|
|
|
14337
14615
|
if (!Object.hasOwn(value, prop)) continue;
|
|
14338
14616
|
const val = value[prop];
|
|
14339
14617
|
if (val == null) continue;
|
|
14340
|
-
const name =
|
|
14618
|
+
const name = styleKeyToProperty(prop);
|
|
14341
14619
|
next.push(name);
|
|
14342
14620
|
decl.setProperty(name, sanitizeCSSDeclaration(name, String(val), { element: el }));
|
|
14343
14621
|
}
|
|
@@ -14357,7 +14635,7 @@ function applyStyle(el, style2) {
|
|
|
14357
14635
|
for (const prop in style2) {
|
|
14358
14636
|
if (!Object.hasOwn(style2, prop)) continue;
|
|
14359
14637
|
const val = style2[prop];
|
|
14360
|
-
const name =
|
|
14638
|
+
const name = styleKeyToProperty(prop);
|
|
14361
14639
|
if (typeof val === "function") {
|
|
14362
14640
|
const getter = val;
|
|
14363
14641
|
const teardown = reactiveBinding2(() => {
|
|
@@ -15176,8 +15454,8 @@ function scrollRestoration(options) {
|
|
|
15176
15454
|
nativeModeLease = acquireScrollRestorationMode("manual");
|
|
15177
15455
|
if (currentKey !== null) tagCurrentEntry(currentKey);
|
|
15178
15456
|
popstateHandler = (event) => {
|
|
15179
|
-
const
|
|
15180
|
-
const rawDestination =
|
|
15457
|
+
const state5 = event.state ?? null;
|
|
15458
|
+
const rawDestination = state5 ? state5[stateKey] : void 0;
|
|
15181
15459
|
const destination = typeof rawDestination === "string" ? rawDestination : null;
|
|
15182
15460
|
let outgoing = currentKey;
|
|
15183
15461
|
if (outgoing === null && options?.getKey) {
|
|
@@ -15333,18 +15611,18 @@ function createPluginRegistry() {
|
|
|
15333
15611
|
return true;
|
|
15334
15612
|
};
|
|
15335
15613
|
installStack.add(p2.name);
|
|
15336
|
-
let
|
|
15614
|
+
let pending2;
|
|
15337
15615
|
try {
|
|
15338
|
-
|
|
15616
|
+
pending2 = adoptThenable(p2.install(ctx, options));
|
|
15339
15617
|
} finally {
|
|
15340
15618
|
installStack.delete(p2.name);
|
|
15341
15619
|
}
|
|
15342
|
-
if (!
|
|
15620
|
+
if (!pending2) {
|
|
15343
15621
|
if (!commit()) throw new PluginInstallCancelledError(p2.name);
|
|
15344
15622
|
return;
|
|
15345
15623
|
}
|
|
15346
15624
|
if (myGeneration === generation) pendingInstalls.set(p2.name, myGeneration);
|
|
15347
|
-
const settled =
|
|
15625
|
+
const settled = pending2.then(
|
|
15348
15626
|
() => {
|
|
15349
15627
|
if (commit()) return;
|
|
15350
15628
|
if (pendingInstalls.get(p2.name) === myGeneration) pendingInstalls.delete(p2.name);
|
|
@@ -15527,16 +15805,16 @@ function createModuleRegistry() {
|
|
|
15527
15805
|
};
|
|
15528
15806
|
}
|
|
15529
15807
|
function createBundle(modules) {
|
|
15530
|
-
const
|
|
15808
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
15531
15809
|
const bundle = {};
|
|
15532
15810
|
for (const key of Object.keys(modules)) {
|
|
15533
15811
|
Object.defineProperty(bundle, key, {
|
|
15534
15812
|
get() {
|
|
15535
|
-
if (
|
|
15536
|
-
return
|
|
15813
|
+
if (cache2.has(key)) {
|
|
15814
|
+
return cache2.get(key);
|
|
15537
15815
|
}
|
|
15538
15816
|
const value = modules[key]();
|
|
15539
|
-
|
|
15817
|
+
cache2.set(key, value);
|
|
15540
15818
|
return value;
|
|
15541
15819
|
},
|
|
15542
15820
|
enumerable: true,
|
|
@@ -15605,7 +15883,7 @@ var CDN_ENTRY_POINTS = {
|
|
|
15605
15883
|
};
|
|
15606
15884
|
var packageInfo = {
|
|
15607
15885
|
name: "sibujs",
|
|
15608
|
-
version: true ? "4.
|
|
15886
|
+
version: true ? "4.15.0" : "dev",
|
|
15609
15887
|
entryPoints: MODULE_ENTRY_POINTS,
|
|
15610
15888
|
/**
|
|
15611
15889
|
* Generate the package.json `exports` map. Module entries resolve to the
|
|
@@ -15750,7 +16028,7 @@ var env = {
|
|
|
15750
16028
|
};
|
|
15751
16029
|
|
|
15752
16030
|
// src/plugins/versioning.ts
|
|
15753
|
-
var VERSION = true ? "4.
|
|
16031
|
+
var VERSION = true ? "4.15.0" : "dev";
|
|
15754
16032
|
var NUM = "(?:0|[1-9]\\d*)";
|
|
15755
16033
|
var PRE_ID = `(?:${NUM}|\\d*[a-zA-Z-][0-9a-zA-Z-]*)`;
|
|
15756
16034
|
var BUILD_ID = "[0-9a-zA-Z-]+";
|
|
@@ -15935,9 +16213,9 @@ function createMigrationRunner(config) {
|
|
|
15935
16213
|
return serialize(async () => {
|
|
15936
16214
|
const applied = [];
|
|
15937
16215
|
const errors = [];
|
|
15938
|
-
let
|
|
16216
|
+
let pending2;
|
|
15939
16217
|
try {
|
|
15940
|
-
|
|
16218
|
+
pending2 = getPending();
|
|
15941
16219
|
} catch (e) {
|
|
15942
16220
|
errors.push({
|
|
15943
16221
|
version: getAppliedVersion() ?? "",
|
|
@@ -15945,7 +16223,7 @@ function createMigrationRunner(config) {
|
|
|
15945
16223
|
});
|
|
15946
16224
|
return { applied, errors };
|
|
15947
16225
|
}
|
|
15948
|
-
for (const migration of
|
|
16226
|
+
for (const migration of pending2) {
|
|
15949
16227
|
try {
|
|
15950
16228
|
await migration.up();
|
|
15951
16229
|
} catch (e) {
|
|
@@ -16056,24 +16334,24 @@ function assertCacheSize(name, value) {
|
|
|
16056
16334
|
throw new RangeError(`[Startup] ${name} must be a non-negative integer, got ${value}`);
|
|
16057
16335
|
}
|
|
16058
16336
|
}
|
|
16059
|
-
function makeRoomFor(
|
|
16337
|
+
function makeRoomFor(cache2, key, maxSize, isValid) {
|
|
16060
16338
|
if (maxSize === 0) return false;
|
|
16061
|
-
if (
|
|
16062
|
-
if (
|
|
16063
|
-
for (const [k, entry] of
|
|
16064
|
-
if (!isValid(entry))
|
|
16339
|
+
if (cache2.has(key)) return true;
|
|
16340
|
+
if (cache2.size < maxSize) return true;
|
|
16341
|
+
for (const [k, entry] of cache2) {
|
|
16342
|
+
if (!isValid(entry)) cache2.delete(k);
|
|
16065
16343
|
}
|
|
16066
|
-
while (
|
|
16344
|
+
while (cache2.size >= maxSize) {
|
|
16067
16345
|
let oldestKey = null;
|
|
16068
16346
|
let oldestTime = Infinity;
|
|
16069
|
-
for (const [k, entry] of
|
|
16347
|
+
for (const [k, entry] of cache2) {
|
|
16070
16348
|
if (entry.timestamp < oldestTime) {
|
|
16071
16349
|
oldestTime = entry.timestamp;
|
|
16072
16350
|
oldestKey = k;
|
|
16073
16351
|
}
|
|
16074
16352
|
}
|
|
16075
16353
|
if (oldestKey === null) break;
|
|
16076
|
-
|
|
16354
|
+
cache2.delete(oldestKey);
|
|
16077
16355
|
}
|
|
16078
16356
|
return true;
|
|
16079
16357
|
}
|
|
@@ -16081,57 +16359,57 @@ function prerenderRoutes(routes, options) {
|
|
|
16081
16359
|
const maxCacheSize = options?.maxCacheSize ?? 50;
|
|
16082
16360
|
const cacheTTL = options?.cacheTTL ?? 0;
|
|
16083
16361
|
assertCacheSize("maxCacheSize", maxCacheSize);
|
|
16084
|
-
const
|
|
16362
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
16085
16363
|
function isValid(entry) {
|
|
16086
16364
|
if (cacheTTL === 0) return true;
|
|
16087
16365
|
return Date.now() - entry.timestamp < cacheTTL;
|
|
16088
16366
|
}
|
|
16089
16367
|
for (const route of routes) {
|
|
16090
|
-
if (!makeRoomFor(
|
|
16368
|
+
if (!makeRoomFor(cache2, route.path, maxCacheSize, isValid)) break;
|
|
16091
16369
|
const html2 = renderToString(route.component());
|
|
16092
|
-
|
|
16370
|
+
cache2.set(route.path, { html: html2, timestamp: Date.now() });
|
|
16093
16371
|
}
|
|
16094
16372
|
return {
|
|
16095
16373
|
/** Get cached HTML for a route, or undefined if not cached or expired */
|
|
16096
16374
|
get(path2) {
|
|
16097
|
-
const entry =
|
|
16375
|
+
const entry = cache2.get(path2);
|
|
16098
16376
|
if (!entry) return void 0;
|
|
16099
16377
|
if (!isValid(entry)) {
|
|
16100
|
-
|
|
16378
|
+
cache2.delete(path2);
|
|
16101
16379
|
return void 0;
|
|
16102
16380
|
}
|
|
16103
16381
|
return entry.html;
|
|
16104
16382
|
},
|
|
16105
16383
|
/** Check if a route has been prerendered and is still valid */
|
|
16106
16384
|
has(path2) {
|
|
16107
|
-
const entry =
|
|
16385
|
+
const entry = cache2.get(path2);
|
|
16108
16386
|
if (!entry) return false;
|
|
16109
16387
|
if (!isValid(entry)) {
|
|
16110
|
-
|
|
16388
|
+
cache2.delete(path2);
|
|
16111
16389
|
return false;
|
|
16112
16390
|
}
|
|
16113
16391
|
return true;
|
|
16114
16392
|
},
|
|
16115
16393
|
/** Invalidate a cached route */
|
|
16116
16394
|
invalidate(path2) {
|
|
16117
|
-
|
|
16395
|
+
cache2.delete(path2);
|
|
16118
16396
|
},
|
|
16119
16397
|
/** Clear all cached routes */
|
|
16120
16398
|
clear() {
|
|
16121
|
-
|
|
16399
|
+
cache2.clear();
|
|
16122
16400
|
},
|
|
16123
16401
|
/** Get cache statistics */
|
|
16124
16402
|
stats() {
|
|
16125
16403
|
if (cacheTTL > 0) {
|
|
16126
|
-
for (const [key, entry] of
|
|
16404
|
+
for (const [key, entry] of cache2) {
|
|
16127
16405
|
if (!isValid(entry)) {
|
|
16128
|
-
|
|
16406
|
+
cache2.delete(key);
|
|
16129
16407
|
}
|
|
16130
16408
|
}
|
|
16131
16409
|
}
|
|
16132
16410
|
return {
|
|
16133
|
-
size:
|
|
16134
|
-
routes: Array.from(
|
|
16411
|
+
size: cache2.size,
|
|
16412
|
+
routes: Array.from(cache2.keys())
|
|
16135
16413
|
};
|
|
16136
16414
|
}
|
|
16137
16415
|
};
|
|
@@ -16140,7 +16418,7 @@ function createSSRCache(config) {
|
|
|
16140
16418
|
const maxSize = config?.maxSize ?? 100;
|
|
16141
16419
|
const defaultTTL = config?.defaultTTL ?? 6e4;
|
|
16142
16420
|
assertCacheSize("maxSize", maxSize);
|
|
16143
|
-
const
|
|
16421
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
16144
16422
|
let hits = 0;
|
|
16145
16423
|
let misses = 0;
|
|
16146
16424
|
function isValid(entry) {
|
|
@@ -16150,13 +16428,13 @@ function createSSRCache(config) {
|
|
|
16150
16428
|
return {
|
|
16151
16429
|
/** Get cached HTML for a key, or undefined if not cached or expired */
|
|
16152
16430
|
get(key) {
|
|
16153
|
-
const entry =
|
|
16431
|
+
const entry = cache2.get(key);
|
|
16154
16432
|
if (!entry) {
|
|
16155
16433
|
misses++;
|
|
16156
16434
|
return void 0;
|
|
16157
16435
|
}
|
|
16158
16436
|
if (!isValid(entry)) {
|
|
16159
|
-
|
|
16437
|
+
cache2.delete(key);
|
|
16160
16438
|
misses++;
|
|
16161
16439
|
return void 0;
|
|
16162
16440
|
}
|
|
@@ -16165,8 +16443,8 @@ function createSSRCache(config) {
|
|
|
16165
16443
|
},
|
|
16166
16444
|
/** Cache an HTML string with an optional TTL override */
|
|
16167
16445
|
set(key, html2, ttl) {
|
|
16168
|
-
if (!makeRoomFor(
|
|
16169
|
-
|
|
16446
|
+
if (!makeRoomFor(cache2, key, maxSize, isValid)) return;
|
|
16447
|
+
cache2.set(key, {
|
|
16170
16448
|
html: html2,
|
|
16171
16449
|
timestamp: Date.now(),
|
|
16172
16450
|
ttl: ttl ?? defaultTTL
|
|
@@ -16174,27 +16452,27 @@ function createSSRCache(config) {
|
|
|
16174
16452
|
},
|
|
16175
16453
|
/** Check if a key exists in the cache and is still valid */
|
|
16176
16454
|
has(key) {
|
|
16177
|
-
const entry =
|
|
16455
|
+
const entry = cache2.get(key);
|
|
16178
16456
|
if (!entry) return false;
|
|
16179
16457
|
if (!isValid(entry)) {
|
|
16180
|
-
|
|
16458
|
+
cache2.delete(key);
|
|
16181
16459
|
return false;
|
|
16182
16460
|
}
|
|
16183
16461
|
return true;
|
|
16184
16462
|
},
|
|
16185
16463
|
/** Invalidate a cached entry */
|
|
16186
16464
|
invalidate(key) {
|
|
16187
|
-
|
|
16465
|
+
cache2.delete(key);
|
|
16188
16466
|
},
|
|
16189
16467
|
/** Clear all cached entries and reset statistics */
|
|
16190
16468
|
clear() {
|
|
16191
|
-
|
|
16469
|
+
cache2.clear();
|
|
16192
16470
|
hits = 0;
|
|
16193
16471
|
misses = 0;
|
|
16194
16472
|
},
|
|
16195
16473
|
/** Get cache statistics including hit/miss counts */
|
|
16196
16474
|
stats() {
|
|
16197
|
-
return { size:
|
|
16475
|
+
return { size: cache2.size, hits, misses };
|
|
16198
16476
|
}
|
|
16199
16477
|
};
|
|
16200
16478
|
}
|
|
@@ -16607,8 +16885,8 @@ function initDevTools(config) {
|
|
|
16607
16885
|
function clearEvents() {
|
|
16608
16886
|
eventLog.length = 0;
|
|
16609
16887
|
}
|
|
16610
|
-
function registerComponent(name, element,
|
|
16611
|
-
hook.components.set(name, { element, state:
|
|
16888
|
+
function registerComponent(name, element, state5) {
|
|
16889
|
+
hook.components.set(name, { element, state: state5 });
|
|
16612
16890
|
emit();
|
|
16613
16891
|
}
|
|
16614
16892
|
function unregisterComponent(name) {
|
|
@@ -19052,9 +19330,9 @@ function zustandAdapter(options) {
|
|
|
19052
19330
|
return createPlugin("sibu-zustand", (ctx) => {
|
|
19053
19331
|
const { store } = options;
|
|
19054
19332
|
const [getState, setSibuState] = signal(store.getState());
|
|
19055
|
-
const unsubscribe = store.subscribe((
|
|
19333
|
+
const unsubscribe = store.subscribe((state5) => {
|
|
19056
19334
|
batch(() => {
|
|
19057
|
-
setSibuState(
|
|
19335
|
+
setSibuState(state5);
|
|
19058
19336
|
});
|
|
19059
19337
|
});
|
|
19060
19338
|
function select3(selector) {
|