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/patterns.cjs
CHANGED
|
@@ -158,13 +158,26 @@ function reportError(error, context) {
|
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
// src/utils/globalSingleton.ts
|
|
162
|
+
function globalSingleton(key, create) {
|
|
163
|
+
const g = globalThis;
|
|
164
|
+
return g[key] ?? (g[key] = create());
|
|
165
|
+
}
|
|
166
|
+
|
|
161
167
|
// src/core/rendering/dispose.ts
|
|
168
|
+
var state2 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.disposers.v1"), () => ({
|
|
169
|
+
disposers: /* @__PURE__ */ new WeakMap(),
|
|
170
|
+
captures: [],
|
|
171
|
+
bindings: { count: 0 }
|
|
172
|
+
}));
|
|
173
|
+
var elementDisposers = state2.disposers;
|
|
174
|
+
var bindings = state2.bindings;
|
|
162
175
|
function resolveCapture(capture) {
|
|
163
176
|
let frame = capture;
|
|
164
177
|
while (frame?.closed) frame = frame.forwardTo;
|
|
165
178
|
return frame ?? null;
|
|
166
179
|
}
|
|
167
|
-
var registrationCaptures =
|
|
180
|
+
var registrationCaptures = state2.captures;
|
|
168
181
|
function currentDisposerCapture() {
|
|
169
182
|
return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
170
183
|
}
|
|
@@ -340,6 +353,201 @@ function bindOwnerScope(fn) {
|
|
|
340
353
|
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
341
354
|
}
|
|
342
355
|
var currentStructOwner = null;
|
|
356
|
+
var frozenOwners = 0;
|
|
357
|
+
var ACTIVE = 0;
|
|
358
|
+
var PAUSED = 1;
|
|
359
|
+
var ENDED = 2;
|
|
360
|
+
var NOOP = () => {
|
|
361
|
+
};
|
|
362
|
+
var skippedWhileHeld = /* @__PURE__ */ new Set();
|
|
363
|
+
var waiters = /* @__PURE__ */ new Set();
|
|
364
|
+
var heldRoots = /* @__PURE__ */ new Set();
|
|
365
|
+
function ownerState(tok) {
|
|
366
|
+
let state3 = ACTIVE;
|
|
367
|
+
for (let t = tok; t !== null; ) {
|
|
368
|
+
const o = t.sub;
|
|
369
|
+
if (o === null) return ENDED;
|
|
370
|
+
if (o._frozen === true) state3 = PAUSED;
|
|
371
|
+
t = o._owner ?? null;
|
|
372
|
+
}
|
|
373
|
+
return state3;
|
|
374
|
+
}
|
|
375
|
+
var endWatchers = /* @__PURE__ */ new Set();
|
|
376
|
+
var stateWatchers = /* @__PURE__ */ new Set();
|
|
377
|
+
var stateCheckQueued = false;
|
|
378
|
+
function queueStateCheck() {
|
|
379
|
+
if (stateCheckQueued || stateWatchers.size === 0) return;
|
|
380
|
+
stateCheckQueued = true;
|
|
381
|
+
queueMicrotask(() => {
|
|
382
|
+
stateCheckQueued = false;
|
|
383
|
+
for (const watcher of [...stateWatchers]) {
|
|
384
|
+
if (!stateWatchers.has(watcher)) continue;
|
|
385
|
+
const state3 = watcher.check.state();
|
|
386
|
+
if (state3 === ENDED) stateWatchers.delete(watcher);
|
|
387
|
+
if (state3 === ENDED || state3 === watcher.last) continue;
|
|
388
|
+
watcher.last = state3;
|
|
389
|
+
try {
|
|
390
|
+
watcher.listener(state3);
|
|
391
|
+
} catch (err) {
|
|
392
|
+
reportError(err, { phase: "effect" });
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
var ALWAYS_ACTIVE = Object.assign(() => false, {
|
|
398
|
+
state: () => ACTIVE,
|
|
399
|
+
wait: (onActive) => {
|
|
400
|
+
onActive();
|
|
401
|
+
return NOOP;
|
|
402
|
+
},
|
|
403
|
+
onEnd: () => NOOP,
|
|
404
|
+
run: (fn) => fn(),
|
|
405
|
+
onChange: () => NOOP,
|
|
406
|
+
within: () => false
|
|
407
|
+
});
|
|
408
|
+
function captureFrozen() {
|
|
409
|
+
const tok = currentStructOwner;
|
|
410
|
+
if (tok === null) return ALWAYS_ACTIVE;
|
|
411
|
+
const state3 = () => ownerState(tok);
|
|
412
|
+
const check = Object.assign(() => state3() !== ACTIVE, {
|
|
413
|
+
state: state3,
|
|
414
|
+
wait: (onActive, onEnd) => {
|
|
415
|
+
const now = state3();
|
|
416
|
+
if (now !== PAUSED) {
|
|
417
|
+
(now === ACTIVE ? onActive : onEnd)();
|
|
418
|
+
return NOOP;
|
|
419
|
+
}
|
|
420
|
+
const waiter = { check, onActive, onEnd };
|
|
421
|
+
waiters.add(waiter);
|
|
422
|
+
return () => {
|
|
423
|
+
waiters.delete(waiter);
|
|
424
|
+
};
|
|
425
|
+
},
|
|
426
|
+
onEnd: (onEnd) => {
|
|
427
|
+
if (state3() === ENDED) {
|
|
428
|
+
onEnd();
|
|
429
|
+
return NOOP;
|
|
430
|
+
}
|
|
431
|
+
const watcher = { check, onActive: NOOP, onEnd };
|
|
432
|
+
endWatchers.add(watcher);
|
|
433
|
+
return () => {
|
|
434
|
+
endWatchers.delete(watcher);
|
|
435
|
+
};
|
|
436
|
+
},
|
|
437
|
+
run: (fn) => {
|
|
438
|
+
const prev = currentStructOwner;
|
|
439
|
+
currentStructOwner = tok.sub === null ? null : tok;
|
|
440
|
+
try {
|
|
441
|
+
return fn();
|
|
442
|
+
} finally {
|
|
443
|
+
currentStructOwner = prev;
|
|
444
|
+
}
|
|
445
|
+
},
|
|
446
|
+
onChange: (listener) => {
|
|
447
|
+
const last = state3();
|
|
448
|
+
if (last === ENDED) return NOOP;
|
|
449
|
+
const watcher = { check, last, listener };
|
|
450
|
+
stateWatchers.add(watcher);
|
|
451
|
+
return () => {
|
|
452
|
+
stateWatchers.delete(watcher);
|
|
453
|
+
};
|
|
454
|
+
},
|
|
455
|
+
within: (owner) => {
|
|
456
|
+
const target = owner.run(() => currentStructOwner);
|
|
457
|
+
if (target === null) return false;
|
|
458
|
+
for (let t = tok; t !== null; ) {
|
|
459
|
+
if (t === target) return true;
|
|
460
|
+
const o = t.sub;
|
|
461
|
+
if (o === null) return false;
|
|
462
|
+
t = o._owner ?? null;
|
|
463
|
+
}
|
|
464
|
+
return false;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
return check;
|
|
468
|
+
}
|
|
469
|
+
function holdSubtree(root) {
|
|
470
|
+
heldRoots.add(root);
|
|
471
|
+
return () => {
|
|
472
|
+
if (heldRoots.delete(root)) settleHeld();
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
function isHeld(sub) {
|
|
476
|
+
if (frozenOwners !== 0 && hasFrozenOwner(sub)) return true;
|
|
477
|
+
if (heldRoots.size !== 0) {
|
|
478
|
+
const node = sub._errorNode;
|
|
479
|
+
if (node != null) {
|
|
480
|
+
for (const root of heldRoots) if (root.contains(node)) return true;
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
return false;
|
|
484
|
+
}
|
|
485
|
+
function notifyEnded() {
|
|
486
|
+
for (const watcher of stateWatchers) if (watcher.check.state() === ENDED) stateWatchers.delete(watcher);
|
|
487
|
+
let ended = null;
|
|
488
|
+
for (const watcher of endWatchers) {
|
|
489
|
+
if (watcher.check.state() !== ENDED) continue;
|
|
490
|
+
endWatchers.delete(watcher);
|
|
491
|
+
(ended ?? (ended = [])).push(watcher);
|
|
492
|
+
}
|
|
493
|
+
if (ended === null) return;
|
|
494
|
+
for (const watcher of ended) {
|
|
495
|
+
try {
|
|
496
|
+
watcher.onEnd();
|
|
497
|
+
} catch (err) {
|
|
498
|
+
reportError(err, { phase: "cleanup" });
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function dropReleasedSkipped() {
|
|
503
|
+
for (const sub of skippedWhileHeld) {
|
|
504
|
+
if (sub._disposed === true || sub.depsHead == null) skippedWhileHeld.delete(sub);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
function settleHeld() {
|
|
508
|
+
for (const sub of skippedWhileHeld) {
|
|
509
|
+
if (sub._disposed === true) skippedWhileHeld.delete(sub);
|
|
510
|
+
else if (!isHeld(sub)) {
|
|
511
|
+
skippedWhileHeld.delete(sub);
|
|
512
|
+
if (!pendingSet.has(sub)) {
|
|
513
|
+
pendingSet.add(sub);
|
|
514
|
+
pendingQueue.push(sub);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (frozenOwners === 0 && heldRoots.size === 0) skippedWhileHeld.clear();
|
|
519
|
+
let ready = null;
|
|
520
|
+
for (const waiter of waiters) {
|
|
521
|
+
if (waiter.check.state() === PAUSED) continue;
|
|
522
|
+
waiters.delete(waiter);
|
|
523
|
+
(ready ?? (ready = [])).push(waiter);
|
|
524
|
+
}
|
|
525
|
+
if (ready !== null) {
|
|
526
|
+
const settle = ready;
|
|
527
|
+
queueMicrotask(() => {
|
|
528
|
+
for (const waiter of settle) {
|
|
529
|
+
const state3 = waiter.check.state();
|
|
530
|
+
if (state3 === PAUSED) waiters.add(waiter);
|
|
531
|
+
else
|
|
532
|
+
try {
|
|
533
|
+
(state3 === ACTIVE ? waiter.onActive : waiter.onEnd)();
|
|
534
|
+
} catch (err) {
|
|
535
|
+
reportError(err, { phase: "effect" });
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
if (pendingQueue.length > 0) drainNotificationQueue();
|
|
541
|
+
}
|
|
542
|
+
function hasFrozenOwner(sub) {
|
|
543
|
+
for (let t = sub._owner ?? null; t !== null; ) {
|
|
544
|
+
const o = t.sub;
|
|
545
|
+
if (o === null) return false;
|
|
546
|
+
if (o._frozen === true) return true;
|
|
547
|
+
t = o._owner ?? null;
|
|
548
|
+
}
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
343
551
|
var subscriberEpochCounter = 0;
|
|
344
552
|
function retrack(effectFn, subscriber) {
|
|
345
553
|
const prev = currentSubscriber;
|
|
@@ -447,6 +655,20 @@ function structuralBinding(commit, ownerNode) {
|
|
|
447
655
|
} finally {
|
|
448
656
|
currentStructOwner = prev;
|
|
449
657
|
}
|
|
658
|
+
},
|
|
659
|
+
freeze: () => {
|
|
660
|
+
const s = sub;
|
|
661
|
+
if (s._disposed || s._frozen) return;
|
|
662
|
+
s._frozen = true;
|
|
663
|
+
frozenOwners++;
|
|
664
|
+
queueStateCheck();
|
|
665
|
+
},
|
|
666
|
+
thaw: () => {
|
|
667
|
+
if (!sub._frozen) return;
|
|
668
|
+
sub._frozen = false;
|
|
669
|
+
frozenOwners--;
|
|
670
|
+
queueStateCheck();
|
|
671
|
+
settleHeld();
|
|
450
672
|
}
|
|
451
673
|
};
|
|
452
674
|
}
|
|
@@ -475,20 +697,34 @@ function createBinding(commit, ownerNode, structural) {
|
|
|
475
697
|
subscriber._errorNode = ownerNode;
|
|
476
698
|
subscriber._tok = null;
|
|
477
699
|
subscriber._owner = null;
|
|
700
|
+
subscriber._frozen = false;
|
|
478
701
|
if (structural) subscriber._tok = { sub: subscriber };
|
|
479
702
|
try {
|
|
480
703
|
run();
|
|
481
704
|
} catch (err) {
|
|
482
705
|
subscriber._disposed = true;
|
|
483
706
|
subscriber._errorNode = void 0;
|
|
484
|
-
if (subscriber._tok != null)
|
|
707
|
+
if (subscriber._tok != null) {
|
|
708
|
+
subscriber._tok.sub = null;
|
|
709
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
710
|
+
}
|
|
485
711
|
cleanup(subscriber);
|
|
486
712
|
throw err;
|
|
487
713
|
}
|
|
488
714
|
subscriber._dispose = () => {
|
|
489
715
|
subscriber._disposed = true;
|
|
716
|
+
const wasFrozen = subscriber._frozen === true;
|
|
717
|
+
if (wasFrozen) {
|
|
718
|
+
subscriber._frozen = false;
|
|
719
|
+
frozenOwners--;
|
|
720
|
+
}
|
|
490
721
|
subscriber._errorNode = void 0;
|
|
491
|
-
if (subscriber._tok != null)
|
|
722
|
+
if (subscriber._tok != null) {
|
|
723
|
+
subscriber._tok.sub = null;
|
|
724
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
725
|
+
if (skippedWhileHeld.size !== 0) dropReleasedSkipped();
|
|
726
|
+
if (wasFrozen || waiters.size !== 0) settleHeld();
|
|
727
|
+
}
|
|
492
728
|
cleanup(subscriber);
|
|
493
729
|
};
|
|
494
730
|
return subscriber;
|
|
@@ -598,6 +834,10 @@ function runPendingOwners(sub) {
|
|
|
598
834
|
}
|
|
599
835
|
}
|
|
600
836
|
function runQueued(sub) {
|
|
837
|
+
if ((frozenOwners !== 0 || heldRoots.size !== 0) && isHeld(sub)) {
|
|
838
|
+
skippedWhileHeld.add(sub);
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
601
841
|
if (quarantined.size > 0 && quarantined.has(sub)) return;
|
|
602
842
|
if (sub._hasComputedDep === true && !depsChanged(sub)) return;
|
|
603
843
|
if (tickRepeat(sub)) {
|
|
@@ -745,7 +985,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
745
985
|
}
|
|
746
986
|
|
|
747
987
|
// src/reactivity/track.ts
|
|
748
|
-
var _runtimeVersion = true ? "4.
|
|
988
|
+
var _runtimeVersion = true ? "4.15.0" : "dev";
|
|
749
989
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
750
990
|
function resolveReactiveApi() {
|
|
751
991
|
const g = globalThis;
|
|
@@ -781,6 +1021,8 @@ function resolveReactiveApi() {
|
|
|
781
1021
|
runWithOwnerScope,
|
|
782
1022
|
bindOwnerScope,
|
|
783
1023
|
structuralBinding,
|
|
1024
|
+
captureFrozen,
|
|
1025
|
+
holdSubtree,
|
|
784
1026
|
version: _runtimeVersion
|
|
785
1027
|
};
|
|
786
1028
|
g[REGISTRY_KEY] = local;
|
|
@@ -808,6 +1050,22 @@ var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
|
808
1050
|
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
809
1051
|
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
810
1052
|
var structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
|
|
1053
|
+
var captureFrozen2 = API.captureFrozen ?? (() => Object.assign(() => false, {
|
|
1054
|
+
state: () => 0,
|
|
1055
|
+
wait: (onActive) => {
|
|
1056
|
+
onActive();
|
|
1057
|
+
return () => {
|
|
1058
|
+
};
|
|
1059
|
+
},
|
|
1060
|
+
onEnd: () => () => {
|
|
1061
|
+
},
|
|
1062
|
+
run: (fn) => fn(),
|
|
1063
|
+
onChange: () => () => {
|
|
1064
|
+
},
|
|
1065
|
+
within: () => false
|
|
1066
|
+
}));
|
|
1067
|
+
var holdSubtree2 = API.holdSubtree ?? (() => () => {
|
|
1068
|
+
});
|
|
811
1069
|
|
|
812
1070
|
// src/reactivity/batch.ts
|
|
813
1071
|
var batchDepth = 0;
|
|
@@ -870,7 +1128,7 @@ function emitDevtools(hook, event, payload) {
|
|
|
870
1128
|
// src/core/signals/signal.ts
|
|
871
1129
|
var _g = globalThis;
|
|
872
1130
|
function signal(initial, options) {
|
|
873
|
-
const
|
|
1131
|
+
const state3 = {
|
|
874
1132
|
value: initial,
|
|
875
1133
|
__v: 0,
|
|
876
1134
|
__sc: 0,
|
|
@@ -883,57 +1141,57 @@ function signal(initial, options) {
|
|
|
883
1141
|
};
|
|
884
1142
|
const debugName = DEV ? options?.name : void 0;
|
|
885
1143
|
const equalsFn = options?.equals;
|
|
886
|
-
if (debugName)
|
|
1144
|
+
if (debugName) state3.__name = debugName;
|
|
887
1145
|
function get() {
|
|
888
|
-
recordDependency2(
|
|
889
|
-
return
|
|
1146
|
+
recordDependency2(state3);
|
|
1147
|
+
return state3.value;
|
|
890
1148
|
}
|
|
891
|
-
get.__signal =
|
|
1149
|
+
get.__signal = state3;
|
|
892
1150
|
if (debugName) get.__name = debugName;
|
|
893
1151
|
let set;
|
|
894
1152
|
if (equalsFn) {
|
|
895
1153
|
set = (next) => {
|
|
896
|
-
const prev =
|
|
1154
|
+
const prev = state3.value;
|
|
897
1155
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
898
1156
|
if (equalsFn(prev, newValue)) return;
|
|
899
|
-
|
|
900
|
-
|
|
1157
|
+
state3.value = newValue;
|
|
1158
|
+
state3.__v++;
|
|
901
1159
|
if (DEV) {
|
|
902
1160
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
903
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
1161
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
|
|
904
1162
|
}
|
|
905
|
-
if (!enqueueBatchedSignal(
|
|
906
|
-
notifySubscribers2(
|
|
1163
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1164
|
+
notifySubscribers2(state3);
|
|
907
1165
|
}
|
|
908
1166
|
};
|
|
909
1167
|
} else if (DEV) {
|
|
910
1168
|
set = (next) => {
|
|
911
|
-
const prev =
|
|
1169
|
+
const prev = state3.value;
|
|
912
1170
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
913
1171
|
if (Object.is(newValue, prev)) return;
|
|
914
|
-
|
|
915
|
-
|
|
1172
|
+
state3.value = newValue;
|
|
1173
|
+
state3.__v++;
|
|
916
1174
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
917
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
918
|
-
if (!enqueueBatchedSignal(
|
|
919
|
-
notifySubscribers2(
|
|
1175
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
|
|
1176
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1177
|
+
notifySubscribers2(state3);
|
|
920
1178
|
}
|
|
921
1179
|
};
|
|
922
1180
|
} else {
|
|
923
1181
|
set = (next) => {
|
|
924
|
-
const prev =
|
|
1182
|
+
const prev = state3.value;
|
|
925
1183
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
926
1184
|
if (Object.is(newValue, prev)) return;
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
if (!enqueueBatchedSignal(
|
|
930
|
-
notifySubscribers2(
|
|
1185
|
+
state3.value = newValue;
|
|
1186
|
+
state3.__v++;
|
|
1187
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1188
|
+
notifySubscribers2(state3);
|
|
931
1189
|
}
|
|
932
1190
|
};
|
|
933
1191
|
}
|
|
934
1192
|
if (DEV) {
|
|
935
1193
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
936
|
-
if (hook) emitDevtools(hook, "signal:create", { signal:
|
|
1194
|
+
if (hook) emitDevtools(hook, "signal:create", { signal: state3, name: debugName, getter: get, initial });
|
|
937
1195
|
}
|
|
938
1196
|
return [get, set];
|
|
939
1197
|
}
|
|
@@ -956,7 +1214,7 @@ function ownEntry(table, key) {
|
|
|
956
1214
|
return Object.hasOwn(table, key) ? table[key] : void 0;
|
|
957
1215
|
}
|
|
958
1216
|
function machine(config) {
|
|
959
|
-
const [
|
|
1217
|
+
const [state3, setState] = signal(config.initial);
|
|
960
1218
|
const [context, setContext] = signal(config.context || {});
|
|
961
1219
|
let currentState = config.initial;
|
|
962
1220
|
let currentContext = context();
|
|
@@ -1030,10 +1288,10 @@ function machine(config) {
|
|
|
1030
1288
|
if (queue.length > 0) drain();
|
|
1031
1289
|
}
|
|
1032
1290
|
function matches(s) {
|
|
1033
|
-
return
|
|
1291
|
+
return state3() === s;
|
|
1034
1292
|
}
|
|
1035
1293
|
function can(event) {
|
|
1036
|
-
const currentState2 =
|
|
1294
|
+
const currentState2 = state3();
|
|
1037
1295
|
const stateDef = ownEntry(config.states, currentState2);
|
|
1038
1296
|
if (!stateDef?.on) return false;
|
|
1039
1297
|
const transition = ownEntry(stateDef.on, event);
|
|
@@ -1044,7 +1302,7 @@ function machine(config) {
|
|
|
1044
1302
|
}
|
|
1045
1303
|
return true;
|
|
1046
1304
|
}
|
|
1047
|
-
return { state:
|
|
1305
|
+
return { state: state3, context, send, matches, can };
|
|
1048
1306
|
}
|
|
1049
1307
|
|
|
1050
1308
|
// src/core/ssr-context.ts
|
|
@@ -1795,13 +2053,13 @@ function adopt(value) {
|
|
|
1795
2053
|
resolvePromise = resolve;
|
|
1796
2054
|
rejectPromise = reject;
|
|
1797
2055
|
});
|
|
1798
|
-
let
|
|
2056
|
+
let state3 = "invoking";
|
|
1799
2057
|
let nativeTarget;
|
|
1800
|
-
const
|
|
2058
|
+
const waiters2 = [];
|
|
1801
2059
|
const transition = (next) => {
|
|
1802
|
-
|
|
2060
|
+
state3 = next;
|
|
1803
2061
|
if (next === "invoking") return;
|
|
1804
|
-
for (const waiter of
|
|
2062
|
+
for (const waiter of waiters2.splice(0)) waiter();
|
|
1805
2063
|
};
|
|
1806
2064
|
const fulfil = (result) => {
|
|
1807
2065
|
resolvePromise(result);
|
|
@@ -1857,18 +2115,18 @@ function adopt(value) {
|
|
|
1857
2115
|
} catch (error) {
|
|
1858
2116
|
onReject(error);
|
|
1859
2117
|
}
|
|
1860
|
-
if (!done &&
|
|
2118
|
+
if (!done && state3 === "invoking") transition("pending");
|
|
1861
2119
|
});
|
|
1862
2120
|
};
|
|
1863
2121
|
invokeLater(value, then);
|
|
1864
2122
|
const probe = (onRejected, onOpen) => {
|
|
1865
2123
|
const decide = () => {
|
|
1866
|
-
if (
|
|
1867
|
-
else (
|
|
2124
|
+
if (state3 === "native") probeNative(nativeTarget, onRejected, onOpen);
|
|
2125
|
+
else (state3 === "rejected" ? onRejected : onOpen)();
|
|
1868
2126
|
};
|
|
1869
|
-
if (
|
|
1870
|
-
else if (
|
|
1871
|
-
else queueMicrotask(
|
|
2127
|
+
if (state3 === "native") probeNative(nativeTarget, onRejected, onOpen);
|
|
2128
|
+
else if (state3 === "invoking") waiters2.push(decide);
|
|
2129
|
+
else queueMicrotask(state3 === "rejected" ? onRejected : onOpen);
|
|
1872
2130
|
};
|
|
1873
2131
|
return { promise, failedEarly: false, probe };
|
|
1874
2132
|
}
|
|
@@ -1909,12 +2167,12 @@ function globalStore(config) {
|
|
|
1909
2167
|
const [getState, setState] = signal({ ...initialState });
|
|
1910
2168
|
const subscriptions = /* @__PURE__ */ new Map();
|
|
1911
2169
|
const middlewares = config.middleware || [];
|
|
1912
|
-
function notifyListeners(
|
|
2170
|
+
function notifyListeners(state3) {
|
|
1913
2171
|
if (subscriptions.size === 0) return;
|
|
1914
2172
|
for (const subscription of Array.from(subscriptions.values())) {
|
|
1915
2173
|
if (!subscription.active) continue;
|
|
1916
2174
|
try {
|
|
1917
|
-
subscription.callback(
|
|
2175
|
+
subscription.callback(state3);
|
|
1918
2176
|
} catch (err) {
|
|
1919
2177
|
reportError(err, { phase: "event", name: "globalStore(subscribe)" });
|
|
1920
2178
|
}
|
package/dist/patterns.js
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
optimisticList,
|
|
6
6
|
persisted,
|
|
7
7
|
timeline
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-DNCT2UXB.js";
|
|
9
9
|
import {
|
|
10
10
|
RenderProp,
|
|
11
11
|
assertType,
|
|
@@ -23,12 +23,12 @@ import {
|
|
|
23
23
|
withWrapper
|
|
24
24
|
} from "./chunk-GIJ33UJZ.js";
|
|
25
25
|
import "./chunk-62BDYGAG.js";
|
|
26
|
-
import "./chunk-
|
|
27
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-D44TAGCT.js";
|
|
27
|
+
import "./chunk-LGUXYHTZ.js";
|
|
28
28
|
import "./chunk-UYTYNCMZ.js";
|
|
29
|
-
import "./chunk-
|
|
30
|
-
import "./chunk-
|
|
31
|
-
import "./chunk-
|
|
29
|
+
import "./chunk-IUBV5WO5.js";
|
|
30
|
+
import "./chunk-GFM5WWPU.js";
|
|
31
|
+
import "./chunk-BF3WBJJQ.js";
|
|
32
32
|
import "./chunk-NT3ZYB5S.js";
|
|
33
33
|
import "./chunk-R5U7XKVJ.js";
|
|
34
34
|
export {
|