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/browser.cjs
CHANGED
|
@@ -175,13 +175,26 @@ function reportError(error, context) {
|
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
+
// src/utils/globalSingleton.ts
|
|
179
|
+
function globalSingleton(key, create) {
|
|
180
|
+
const g = globalThis;
|
|
181
|
+
return g[key] ?? (g[key] = create());
|
|
182
|
+
}
|
|
183
|
+
|
|
178
184
|
// src/core/rendering/dispose.ts
|
|
185
|
+
var state2 = globalSingleton(/* @__PURE__ */ Symbol.for("sibujs.disposers.v1"), () => ({
|
|
186
|
+
disposers: /* @__PURE__ */ new WeakMap(),
|
|
187
|
+
captures: [],
|
|
188
|
+
bindings: { count: 0 }
|
|
189
|
+
}));
|
|
190
|
+
var elementDisposers = state2.disposers;
|
|
191
|
+
var bindings = state2.bindings;
|
|
179
192
|
function resolveCapture(capture) {
|
|
180
193
|
let frame = capture;
|
|
181
194
|
while (frame?.closed) frame = frame.forwardTo;
|
|
182
195
|
return frame ?? null;
|
|
183
196
|
}
|
|
184
|
-
var registrationCaptures =
|
|
197
|
+
var registrationCaptures = state2.captures;
|
|
185
198
|
function currentDisposerCapture() {
|
|
186
199
|
return resolveCapture(registrationCaptures[registrationCaptures.length - 1]);
|
|
187
200
|
}
|
|
@@ -357,6 +370,201 @@ function bindOwnerScope(fn) {
|
|
|
357
370
|
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
358
371
|
}
|
|
359
372
|
var currentStructOwner = null;
|
|
373
|
+
var frozenOwners = 0;
|
|
374
|
+
var ACTIVE = 0;
|
|
375
|
+
var PAUSED = 1;
|
|
376
|
+
var ENDED = 2;
|
|
377
|
+
var NOOP = () => {
|
|
378
|
+
};
|
|
379
|
+
var skippedWhileHeld = /* @__PURE__ */ new Set();
|
|
380
|
+
var waiters = /* @__PURE__ */ new Set();
|
|
381
|
+
var heldRoots = /* @__PURE__ */ new Set();
|
|
382
|
+
function ownerState(tok) {
|
|
383
|
+
let state3 = ACTIVE;
|
|
384
|
+
for (let t = tok; t !== null; ) {
|
|
385
|
+
const o = t.sub;
|
|
386
|
+
if (o === null) return ENDED;
|
|
387
|
+
if (o._frozen === true) state3 = PAUSED;
|
|
388
|
+
t = o._owner ?? null;
|
|
389
|
+
}
|
|
390
|
+
return state3;
|
|
391
|
+
}
|
|
392
|
+
var endWatchers = /* @__PURE__ */ new Set();
|
|
393
|
+
var stateWatchers = /* @__PURE__ */ new Set();
|
|
394
|
+
var stateCheckQueued = false;
|
|
395
|
+
function queueStateCheck() {
|
|
396
|
+
if (stateCheckQueued || stateWatchers.size === 0) return;
|
|
397
|
+
stateCheckQueued = true;
|
|
398
|
+
queueMicrotask(() => {
|
|
399
|
+
stateCheckQueued = false;
|
|
400
|
+
for (const watcher of [...stateWatchers]) {
|
|
401
|
+
if (!stateWatchers.has(watcher)) continue;
|
|
402
|
+
const state3 = watcher.check.state();
|
|
403
|
+
if (state3 === ENDED) stateWatchers.delete(watcher);
|
|
404
|
+
if (state3 === ENDED || state3 === watcher.last) continue;
|
|
405
|
+
watcher.last = state3;
|
|
406
|
+
try {
|
|
407
|
+
watcher.listener(state3);
|
|
408
|
+
} catch (err) {
|
|
409
|
+
reportError(err, { phase: "effect" });
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
var ALWAYS_ACTIVE = Object.assign(() => false, {
|
|
415
|
+
state: () => ACTIVE,
|
|
416
|
+
wait: (onActive) => {
|
|
417
|
+
onActive();
|
|
418
|
+
return NOOP;
|
|
419
|
+
},
|
|
420
|
+
onEnd: () => NOOP,
|
|
421
|
+
run: (fn) => fn(),
|
|
422
|
+
onChange: () => NOOP,
|
|
423
|
+
within: () => false
|
|
424
|
+
});
|
|
425
|
+
function captureFrozen() {
|
|
426
|
+
const tok = currentStructOwner;
|
|
427
|
+
if (tok === null) return ALWAYS_ACTIVE;
|
|
428
|
+
const state3 = () => ownerState(tok);
|
|
429
|
+
const check = Object.assign(() => state3() !== ACTIVE, {
|
|
430
|
+
state: state3,
|
|
431
|
+
wait: (onActive, onEnd) => {
|
|
432
|
+
const now = state3();
|
|
433
|
+
if (now !== PAUSED) {
|
|
434
|
+
(now === ACTIVE ? onActive : onEnd)();
|
|
435
|
+
return NOOP;
|
|
436
|
+
}
|
|
437
|
+
const waiter = { check, onActive, onEnd };
|
|
438
|
+
waiters.add(waiter);
|
|
439
|
+
return () => {
|
|
440
|
+
waiters.delete(waiter);
|
|
441
|
+
};
|
|
442
|
+
},
|
|
443
|
+
onEnd: (onEnd) => {
|
|
444
|
+
if (state3() === ENDED) {
|
|
445
|
+
onEnd();
|
|
446
|
+
return NOOP;
|
|
447
|
+
}
|
|
448
|
+
const watcher = { check, onActive: NOOP, onEnd };
|
|
449
|
+
endWatchers.add(watcher);
|
|
450
|
+
return () => {
|
|
451
|
+
endWatchers.delete(watcher);
|
|
452
|
+
};
|
|
453
|
+
},
|
|
454
|
+
run: (fn) => {
|
|
455
|
+
const prev = currentStructOwner;
|
|
456
|
+
currentStructOwner = tok.sub === null ? null : tok;
|
|
457
|
+
try {
|
|
458
|
+
return fn();
|
|
459
|
+
} finally {
|
|
460
|
+
currentStructOwner = prev;
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
onChange: (listener) => {
|
|
464
|
+
const last = state3();
|
|
465
|
+
if (last === ENDED) return NOOP;
|
|
466
|
+
const watcher = { check, last, listener };
|
|
467
|
+
stateWatchers.add(watcher);
|
|
468
|
+
return () => {
|
|
469
|
+
stateWatchers.delete(watcher);
|
|
470
|
+
};
|
|
471
|
+
},
|
|
472
|
+
within: (owner) => {
|
|
473
|
+
const target = owner.run(() => currentStructOwner);
|
|
474
|
+
if (target === null) return false;
|
|
475
|
+
for (let t = tok; t !== null; ) {
|
|
476
|
+
if (t === target) return true;
|
|
477
|
+
const o = t.sub;
|
|
478
|
+
if (o === null) return false;
|
|
479
|
+
t = o._owner ?? null;
|
|
480
|
+
}
|
|
481
|
+
return false;
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
return check;
|
|
485
|
+
}
|
|
486
|
+
function holdSubtree(root) {
|
|
487
|
+
heldRoots.add(root);
|
|
488
|
+
return () => {
|
|
489
|
+
if (heldRoots.delete(root)) settleHeld();
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function isHeld(sub) {
|
|
493
|
+
if (frozenOwners !== 0 && hasFrozenOwner(sub)) return true;
|
|
494
|
+
if (heldRoots.size !== 0) {
|
|
495
|
+
const node = sub._errorNode;
|
|
496
|
+
if (node != null) {
|
|
497
|
+
for (const root of heldRoots) if (root.contains(node)) return true;
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
return false;
|
|
501
|
+
}
|
|
502
|
+
function notifyEnded() {
|
|
503
|
+
for (const watcher of stateWatchers) if (watcher.check.state() === ENDED) stateWatchers.delete(watcher);
|
|
504
|
+
let ended = null;
|
|
505
|
+
for (const watcher of endWatchers) {
|
|
506
|
+
if (watcher.check.state() !== ENDED) continue;
|
|
507
|
+
endWatchers.delete(watcher);
|
|
508
|
+
(ended ?? (ended = [])).push(watcher);
|
|
509
|
+
}
|
|
510
|
+
if (ended === null) return;
|
|
511
|
+
for (const watcher of ended) {
|
|
512
|
+
try {
|
|
513
|
+
watcher.onEnd();
|
|
514
|
+
} catch (err) {
|
|
515
|
+
reportError(err, { phase: "cleanup" });
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
function dropReleasedSkipped() {
|
|
520
|
+
for (const sub of skippedWhileHeld) {
|
|
521
|
+
if (sub._disposed === true || sub.depsHead == null) skippedWhileHeld.delete(sub);
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
function settleHeld() {
|
|
525
|
+
for (const sub of skippedWhileHeld) {
|
|
526
|
+
if (sub._disposed === true) skippedWhileHeld.delete(sub);
|
|
527
|
+
else if (!isHeld(sub)) {
|
|
528
|
+
skippedWhileHeld.delete(sub);
|
|
529
|
+
if (!pendingSet.has(sub)) {
|
|
530
|
+
pendingSet.add(sub);
|
|
531
|
+
pendingQueue.push(sub);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
if (frozenOwners === 0 && heldRoots.size === 0) skippedWhileHeld.clear();
|
|
536
|
+
let ready = null;
|
|
537
|
+
for (const waiter of waiters) {
|
|
538
|
+
if (waiter.check.state() === PAUSED) continue;
|
|
539
|
+
waiters.delete(waiter);
|
|
540
|
+
(ready ?? (ready = [])).push(waiter);
|
|
541
|
+
}
|
|
542
|
+
if (ready !== null) {
|
|
543
|
+
const settle = ready;
|
|
544
|
+
queueMicrotask(() => {
|
|
545
|
+
for (const waiter of settle) {
|
|
546
|
+
const state3 = waiter.check.state();
|
|
547
|
+
if (state3 === PAUSED) waiters.add(waiter);
|
|
548
|
+
else
|
|
549
|
+
try {
|
|
550
|
+
(state3 === ACTIVE ? waiter.onActive : waiter.onEnd)();
|
|
551
|
+
} catch (err) {
|
|
552
|
+
reportError(err, { phase: "effect" });
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
if (pendingQueue.length > 0) drainNotificationQueue();
|
|
558
|
+
}
|
|
559
|
+
function hasFrozenOwner(sub) {
|
|
560
|
+
for (let t = sub._owner ?? null; t !== null; ) {
|
|
561
|
+
const o = t.sub;
|
|
562
|
+
if (o === null) return false;
|
|
563
|
+
if (o._frozen === true) return true;
|
|
564
|
+
t = o._owner ?? null;
|
|
565
|
+
}
|
|
566
|
+
return false;
|
|
567
|
+
}
|
|
360
568
|
var subscriberEpochCounter = 0;
|
|
361
569
|
function retrack(effectFn, subscriber) {
|
|
362
570
|
const prev = currentSubscriber;
|
|
@@ -464,6 +672,20 @@ function structuralBinding(commit, ownerNode) {
|
|
|
464
672
|
} finally {
|
|
465
673
|
currentStructOwner = prev;
|
|
466
674
|
}
|
|
675
|
+
},
|
|
676
|
+
freeze: () => {
|
|
677
|
+
const s = sub;
|
|
678
|
+
if (s._disposed || s._frozen) return;
|
|
679
|
+
s._frozen = true;
|
|
680
|
+
frozenOwners++;
|
|
681
|
+
queueStateCheck();
|
|
682
|
+
},
|
|
683
|
+
thaw: () => {
|
|
684
|
+
if (!sub._frozen) return;
|
|
685
|
+
sub._frozen = false;
|
|
686
|
+
frozenOwners--;
|
|
687
|
+
queueStateCheck();
|
|
688
|
+
settleHeld();
|
|
467
689
|
}
|
|
468
690
|
};
|
|
469
691
|
}
|
|
@@ -492,20 +714,34 @@ function createBinding(commit, ownerNode, structural) {
|
|
|
492
714
|
subscriber._errorNode = ownerNode;
|
|
493
715
|
subscriber._tok = null;
|
|
494
716
|
subscriber._owner = null;
|
|
717
|
+
subscriber._frozen = false;
|
|
495
718
|
if (structural) subscriber._tok = { sub: subscriber };
|
|
496
719
|
try {
|
|
497
720
|
run();
|
|
498
721
|
} catch (err) {
|
|
499
722
|
subscriber._disposed = true;
|
|
500
723
|
subscriber._errorNode = void 0;
|
|
501
|
-
if (subscriber._tok != null)
|
|
724
|
+
if (subscriber._tok != null) {
|
|
725
|
+
subscriber._tok.sub = null;
|
|
726
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
727
|
+
}
|
|
502
728
|
cleanup(subscriber);
|
|
503
729
|
throw err;
|
|
504
730
|
}
|
|
505
731
|
subscriber._dispose = () => {
|
|
506
732
|
subscriber._disposed = true;
|
|
733
|
+
const wasFrozen = subscriber._frozen === true;
|
|
734
|
+
if (wasFrozen) {
|
|
735
|
+
subscriber._frozen = false;
|
|
736
|
+
frozenOwners--;
|
|
737
|
+
}
|
|
507
738
|
subscriber._errorNode = void 0;
|
|
508
|
-
if (subscriber._tok != null)
|
|
739
|
+
if (subscriber._tok != null) {
|
|
740
|
+
subscriber._tok.sub = null;
|
|
741
|
+
if (endWatchers.size !== 0 || stateWatchers.size !== 0) notifyEnded();
|
|
742
|
+
if (skippedWhileHeld.size !== 0) dropReleasedSkipped();
|
|
743
|
+
if (wasFrozen || waiters.size !== 0) settleHeld();
|
|
744
|
+
}
|
|
509
745
|
cleanup(subscriber);
|
|
510
746
|
};
|
|
511
747
|
return subscriber;
|
|
@@ -615,6 +851,10 @@ function runPendingOwners(sub) {
|
|
|
615
851
|
}
|
|
616
852
|
}
|
|
617
853
|
function runQueued(sub) {
|
|
854
|
+
if ((frozenOwners !== 0 || heldRoots.size !== 0) && isHeld(sub)) {
|
|
855
|
+
skippedWhileHeld.add(sub);
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
618
858
|
if (quarantined.size > 0 && quarantined.has(sub)) return;
|
|
619
859
|
if (sub._hasComputedDep === true && !depsChanged(sub)) return;
|
|
620
860
|
if (tickRepeat(sub)) {
|
|
@@ -762,7 +1002,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
762
1002
|
}
|
|
763
1003
|
|
|
764
1004
|
// src/reactivity/track.ts
|
|
765
|
-
var _runtimeVersion = true ? "4.
|
|
1005
|
+
var _runtimeVersion = true ? "4.15.0" : "dev";
|
|
766
1006
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
767
1007
|
function resolveReactiveApi() {
|
|
768
1008
|
const g = globalThis;
|
|
@@ -798,6 +1038,8 @@ function resolveReactiveApi() {
|
|
|
798
1038
|
runWithOwnerScope,
|
|
799
1039
|
bindOwnerScope,
|
|
800
1040
|
structuralBinding,
|
|
1041
|
+
captureFrozen,
|
|
1042
|
+
holdSubtree,
|
|
801
1043
|
version: _runtimeVersion
|
|
802
1044
|
};
|
|
803
1045
|
g[REGISTRY_KEY] = local;
|
|
@@ -825,6 +1067,22 @@ var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
|
825
1067
|
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
826
1068
|
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
827
1069
|
var structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
|
|
1070
|
+
var captureFrozen2 = API.captureFrozen ?? (() => Object.assign(() => false, {
|
|
1071
|
+
state: () => 0,
|
|
1072
|
+
wait: (onActive) => {
|
|
1073
|
+
onActive();
|
|
1074
|
+
return () => {
|
|
1075
|
+
};
|
|
1076
|
+
},
|
|
1077
|
+
onEnd: () => () => {
|
|
1078
|
+
},
|
|
1079
|
+
run: (fn) => fn(),
|
|
1080
|
+
onChange: () => () => {
|
|
1081
|
+
},
|
|
1082
|
+
within: () => false
|
|
1083
|
+
}));
|
|
1084
|
+
var holdSubtree2 = API.holdSubtree ?? (() => () => {
|
|
1085
|
+
});
|
|
828
1086
|
|
|
829
1087
|
// src/reactivity/batch.ts
|
|
830
1088
|
var batchDepth = 0;
|
|
@@ -887,7 +1145,7 @@ function emitDevtools(hook, event, payload) {
|
|
|
887
1145
|
// src/core/signals/signal.ts
|
|
888
1146
|
var _g = globalThis;
|
|
889
1147
|
function signal(initial, options) {
|
|
890
|
-
const
|
|
1148
|
+
const state3 = {
|
|
891
1149
|
value: initial,
|
|
892
1150
|
__v: 0,
|
|
893
1151
|
__sc: 0,
|
|
@@ -900,57 +1158,57 @@ function signal(initial, options) {
|
|
|
900
1158
|
};
|
|
901
1159
|
const debugName = DEV ? options?.name : void 0;
|
|
902
1160
|
const equalsFn = options?.equals;
|
|
903
|
-
if (debugName)
|
|
1161
|
+
if (debugName) state3.__name = debugName;
|
|
904
1162
|
function get() {
|
|
905
|
-
recordDependency2(
|
|
906
|
-
return
|
|
1163
|
+
recordDependency2(state3);
|
|
1164
|
+
return state3.value;
|
|
907
1165
|
}
|
|
908
|
-
get.__signal =
|
|
1166
|
+
get.__signal = state3;
|
|
909
1167
|
if (debugName) get.__name = debugName;
|
|
910
1168
|
let set;
|
|
911
1169
|
if (equalsFn) {
|
|
912
1170
|
set = (next) => {
|
|
913
|
-
const prev =
|
|
1171
|
+
const prev = state3.value;
|
|
914
1172
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
915
1173
|
if (equalsFn(prev, newValue)) return;
|
|
916
|
-
|
|
917
|
-
|
|
1174
|
+
state3.value = newValue;
|
|
1175
|
+
state3.__v++;
|
|
918
1176
|
if (DEV) {
|
|
919
1177
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
920
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
1178
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
|
|
921
1179
|
}
|
|
922
|
-
if (!enqueueBatchedSignal(
|
|
923
|
-
notifySubscribers2(
|
|
1180
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1181
|
+
notifySubscribers2(state3);
|
|
924
1182
|
}
|
|
925
1183
|
};
|
|
926
1184
|
} else if (DEV) {
|
|
927
1185
|
set = (next) => {
|
|
928
|
-
const prev =
|
|
1186
|
+
const prev = state3.value;
|
|
929
1187
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
930
1188
|
if (Object.is(newValue, prev)) return;
|
|
931
|
-
|
|
932
|
-
|
|
1189
|
+
state3.value = newValue;
|
|
1190
|
+
state3.__v++;
|
|
933
1191
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
934
|
-
if (hook) emitDevtools(hook, "signal:update", { signal:
|
|
935
|
-
if (!enqueueBatchedSignal(
|
|
936
|
-
notifySubscribers2(
|
|
1192
|
+
if (hook) emitDevtools(hook, "signal:update", { signal: state3, name: debugName, oldValue: prev, newValue });
|
|
1193
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1194
|
+
notifySubscribers2(state3);
|
|
937
1195
|
}
|
|
938
1196
|
};
|
|
939
1197
|
} else {
|
|
940
1198
|
set = (next) => {
|
|
941
|
-
const prev =
|
|
1199
|
+
const prev = state3.value;
|
|
942
1200
|
const newValue = typeof next === "function" ? next(prev) : next;
|
|
943
1201
|
if (Object.is(newValue, prev)) return;
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
if (!enqueueBatchedSignal(
|
|
947
|
-
notifySubscribers2(
|
|
1202
|
+
state3.value = newValue;
|
|
1203
|
+
state3.__v++;
|
|
1204
|
+
if (!enqueueBatchedSignal(state3)) {
|
|
1205
|
+
notifySubscribers2(state3);
|
|
948
1206
|
}
|
|
949
1207
|
};
|
|
950
1208
|
}
|
|
951
1209
|
if (DEV) {
|
|
952
1210
|
const hook = _g.__SIBU_DEVTOOLS_GLOBAL_HOOK__;
|
|
953
|
-
if (hook) emitDevtools(hook, "signal:create", { signal:
|
|
1211
|
+
if (hook) emitDevtools(hook, "signal:create", { signal: state3, name: debugName, getter: get, initial });
|
|
954
1212
|
}
|
|
955
1213
|
return [get, set];
|
|
956
1214
|
}
|
|
@@ -1383,13 +1641,13 @@ function idle(timeout = 6e4) {
|
|
|
1383
1641
|
|
|
1384
1642
|
// src/browser/permissions.ts
|
|
1385
1643
|
function permissions(name) {
|
|
1386
|
-
const [
|
|
1644
|
+
const [state3, setState] = signal("prompt");
|
|
1387
1645
|
let permissionStatus = null;
|
|
1388
1646
|
let onChange = null;
|
|
1389
1647
|
let disposed = false;
|
|
1390
1648
|
if (typeof navigator === "undefined" || !navigator.permissions) {
|
|
1391
1649
|
setState("unsupported");
|
|
1392
|
-
return { state:
|
|
1650
|
+
return { state: state3, dispose: () => {
|
|
1393
1651
|
} };
|
|
1394
1652
|
}
|
|
1395
1653
|
navigator.permissions.query({ name }).then((status) => {
|
|
@@ -1412,7 +1670,7 @@ function permissions(name) {
|
|
|
1412
1670
|
onChange = null;
|
|
1413
1671
|
}
|
|
1414
1672
|
}
|
|
1415
|
-
return { state:
|
|
1673
|
+
return { state: state3, dispose };
|
|
1416
1674
|
}
|
|
1417
1675
|
|
|
1418
1676
|
// src/browser/clipboard.ts
|
|
@@ -1608,12 +1866,6 @@ function dropZone(element, options) {
|
|
|
1608
1866
|
return { isOver, dispose };
|
|
1609
1867
|
}
|
|
1610
1868
|
|
|
1611
|
-
// src/utils/globalSingleton.ts
|
|
1612
|
-
function globalSingleton(key, create) {
|
|
1613
|
-
const g = globalThis;
|
|
1614
|
-
return g[key] ?? (g[key] = create());
|
|
1615
|
-
}
|
|
1616
|
-
|
|
1617
1869
|
// src/utils/singletonResource.ts
|
|
1618
1870
|
function singletonResource(io) {
|
|
1619
1871
|
let original = null;
|
|
@@ -1763,9 +2015,9 @@ function colorScheme() {
|
|
|
1763
2015
|
// src/browser/format.ts
|
|
1764
2016
|
var I18N_STATE = /* @__PURE__ */ Symbol.for("sibujs.i18n.v1");
|
|
1765
2017
|
function activeI18nLocale() {
|
|
1766
|
-
const
|
|
1767
|
-
if (!
|
|
1768
|
-
return
|
|
2018
|
+
const state3 = globalThis[I18N_STATE];
|
|
2019
|
+
if (!state3) return void 0;
|
|
2020
|
+
return state3.getLocale ? state3.getLocale() : state3.locale?.[0]();
|
|
1769
2021
|
}
|
|
1770
2022
|
function formatNumber(value, options) {
|
|
1771
2023
|
const { locale, ...formatOptions } = options ?? {};
|
|
@@ -1947,9 +2199,9 @@ function notifyUrlWrite() {
|
|
|
1947
2199
|
for (const sync of Array.from(_url.instances)) sync();
|
|
1948
2200
|
}
|
|
1949
2201
|
var SCROLL_ENTRY_KEY = "__sibuScrollKey";
|
|
1950
|
-
function withoutEntryIdentity(
|
|
1951
|
-
if (
|
|
1952
|
-
const { [SCROLL_ENTRY_KEY]: _identity, ...rest } =
|
|
2202
|
+
function withoutEntryIdentity(state3) {
|
|
2203
|
+
if (state3 === null || typeof state3 !== "object" || !Object.hasOwn(state3, SCROLL_ENTRY_KEY)) return state3;
|
|
2204
|
+
const { [SCROLL_ENTRY_KEY]: _identity, ...rest } = state3;
|
|
1953
2205
|
return rest;
|
|
1954
2206
|
}
|
|
1955
2207
|
function urlState() {
|
|
@@ -1987,9 +2239,9 @@ function urlState() {
|
|
|
1987
2239
|
window.addEventListener("hashchange", syncFromLocation);
|
|
1988
2240
|
_url.instances.add(syncFromLocation);
|
|
1989
2241
|
function writeHistory(newUrl, opts) {
|
|
1990
|
-
const
|
|
1991
|
-
if (opts.replace) window.history.replaceState(
|
|
1992
|
-
else window.history.pushState("state" in opts ?
|
|
2242
|
+
const state3 = "state" in opts ? opts.state : window.history.state;
|
|
2243
|
+
if (opts.replace) window.history.replaceState(state3, "", newUrl);
|
|
2244
|
+
else window.history.pushState("state" in opts ? state3 : withoutEntryIdentity(state3), "", newUrl);
|
|
1993
2245
|
}
|
|
1994
2246
|
function setParams(next, opts = {}) {
|
|
1995
2247
|
const p = next instanceof URLSearchParams ? next : new URLSearchParams(next);
|
package/dist/browser.js
CHANGED
|
@@ -36,16 +36,15 @@ import {
|
|
|
36
36
|
visibility,
|
|
37
37
|
wakeLock,
|
|
38
38
|
windowSize
|
|
39
|
-
} from "./chunk-
|
|
40
|
-
import "./chunk-
|
|
39
|
+
} from "./chunk-KIDETDMU.js";
|
|
40
|
+
import "./chunk-HTPOIAAL.js";
|
|
41
41
|
import "./chunk-62BDYGAG.js";
|
|
42
|
-
import "./chunk-
|
|
43
|
-
import "./chunk-AE32RGWX.js";
|
|
42
|
+
import "./chunk-LGUXYHTZ.js";
|
|
44
43
|
import "./chunk-B3HOT4TK.js";
|
|
45
44
|
import "./chunk-UYTYNCMZ.js";
|
|
46
|
-
import "./chunk-
|
|
47
|
-
import "./chunk-
|
|
48
|
-
import "./chunk-
|
|
45
|
+
import "./chunk-IUBV5WO5.js";
|
|
46
|
+
import "./chunk-GFM5WWPU.js";
|
|
47
|
+
import "./chunk-BF3WBJJQ.js";
|
|
49
48
|
import "./chunk-NT3ZYB5S.js";
|
|
50
49
|
import "./chunk-R5U7XKVJ.js";
|
|
51
50
|
export {
|