sibujs 4.12.0 → 4.13.1
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 +71 -18
- package/dist/browser.js +4 -4
- package/dist/build.cjs +6618 -6178
- package/dist/build.d.cts +554 -415
- package/dist/build.d.ts +554 -415
- package/dist/build.js +2091 -1735
- package/dist/cdn.dev.global.js +12 -12
- package/dist/cdn.full.dev.global.js +13 -13
- package/dist/cdn.full.global.js +12 -12
- package/dist/cdn.global.js +12 -12
- package/dist/{chunk-WFRQ6D7H.js → chunk-22OPSWMF.js} +1 -1
- package/dist/{chunk-ZJCHY2IB.js → chunk-2NC56RGY.js} +1 -1
- package/dist/{chunk-NB7TFSJE.js → chunk-2O6JJCUR.js} +4 -4
- package/dist/{chunk-B2Y5BJSP.js → chunk-4UTGDVSA.js} +70 -16
- package/dist/{chunk-NAVLCP4S.js → chunk-5RIBLY2N.js} +4 -4
- package/dist/{chunk-T5O2CUHV.js → chunk-5XUGJM3J.js} +1 -1
- package/dist/{chunk-HXT2RNH5.js → chunk-ADZHPN2B.js} +1 -1
- package/dist/chunk-B36ADEIR.js +21 -0
- package/dist/{chunk-DFZL3AX7.js → chunk-C73VBPEF.js} +9 -5
- package/dist/{chunk-WH4U2VUE.js → chunk-CPQKWCJ2.js} +13 -5
- package/dist/{chunk-LEUEKK4G.js → chunk-EU7T7EB3.js} +2 -2
- package/dist/{chunk-QLG5IK7F.js → chunk-G3Z2FEBR.js} +4 -4
- package/dist/{chunk-ZPY2UAKM.js → chunk-J4X7ICH4.js} +3 -3
- package/dist/{chunk-XX4BRMWF.js → chunk-K4LNUT5L.js} +1 -1
- package/dist/{chunk-CI4W6XAU.js → chunk-KC62VURU.js} +3 -3
- package/dist/chunk-N5TBYXHW.js +17 -0
- package/dist/{chunk-653KGQS2.js → chunk-OIKD7YDY.js} +2 -2
- package/dist/{chunk-LYTUTXQP.js → chunk-PBJYCE2Z.js} +46 -4
- package/dist/{chunk-EMB5PG7V.js → chunk-QC3NP47A.js} +1 -1
- package/dist/{chunk-IHA62NGJ.js → chunk-QKFVMIAV.js} +1 -1
- package/dist/{chunk-LXBMVGVB.js → chunk-QZ47OZ25.js} +3 -3
- package/dist/{chunk-ZTYCCBU3.js → chunk-VFPLWUT7.js} +44 -26
- package/dist/{chunk-RK7EPQPG.js → chunk-YFTBCCVH.js} +1 -1
- package/dist/data.cjs +71 -18
- package/dist/data.js +5 -5
- package/dist/datePicker-DxuxWpgF.d.cts +285 -0
- package/dist/datePicker-DxuxWpgF.d.ts +285 -0
- package/dist/devtools.cjs +71 -18
- package/dist/devtools.js +4 -4
- package/dist/ecosystem.cjs +82 -21
- package/dist/ecosystem.js +7 -7
- package/dist/extras.cjs +131 -23
- package/dist/extras.d.cts +2 -2
- package/dist/extras.d.ts +2 -2
- package/dist/extras.js +21 -20
- package/dist/index.cjs +115 -37
- package/dist/index.d.cts +59 -5
- package/dist/index.d.ts +59 -5
- package/dist/index.js +10 -10
- package/dist/motion.cjs +69 -16
- package/dist/motion.js +3 -3
- package/dist/patterns.cjs +71 -18
- package/dist/patterns.js +5 -5
- package/dist/performance.cjs +69 -16
- package/dist/performance.js +4 -4
- package/dist/plugins.cjs +1421 -996
- package/dist/plugins.d.cts +132 -3
- package/dist/plugins.d.ts +132 -3
- package/dist/plugins.js +262 -11
- package/dist/routeMiddleware-B1sp4P7a.d.ts +688 -0
- package/dist/routeMiddleware-CedQTsLK.d.cts +688 -0
- package/dist/ssr.cjs +3607 -3524
- package/dist/ssr.d.cts +20 -671
- package/dist/ssr.d.ts +20 -671
- package/dist/ssr.js +15 -7
- package/dist/testing.cjs +71 -18
- package/dist/testing.js +2 -2
- package/dist/ui.cjs +78 -18
- package/dist/ui.js +8 -7
- package/dist/widgets.cjs +1352 -952
- package/dist/widgets.d.cts +100 -268
- package/dist/widgets.d.ts +100 -268
- package/dist/widgets.js +316 -7
- package/package.json +9 -1
package/dist/devtools.cjs
CHANGED
|
@@ -515,6 +515,7 @@ function bindOwnerScope(fn) {
|
|
|
515
515
|
if (scope === null) return fn;
|
|
516
516
|
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
517
517
|
}
|
|
518
|
+
var currentStructOwner = null;
|
|
518
519
|
var subscriberEpochCounter = 0;
|
|
519
520
|
function retrack(effectFn, subscriber) {
|
|
520
521
|
const prev = currentSubscriber;
|
|
@@ -534,6 +535,9 @@ function retrack(effectFn, subscriber) {
|
|
|
534
535
|
if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
|
|
535
536
|
const scope = sub._scope === void 0 ? null : sub._scope;
|
|
536
537
|
if (scope !== prevScope) currentOwnerScope = scope;
|
|
538
|
+
const prevStructOwner = currentStructOwner;
|
|
539
|
+
if (prevStructOwner !== null && !sub._epoch && !sub._c && sub._owner == null) sub._owner = prevStructOwner;
|
|
540
|
+
if (sub._tok != null) currentStructOwner = sub._tok;
|
|
537
541
|
const epoch = ++subscriberEpochCounter;
|
|
538
542
|
sub._epoch = epoch;
|
|
539
543
|
sub._structDirty = false;
|
|
@@ -547,6 +551,7 @@ function retrack(effectFn, subscriber) {
|
|
|
547
551
|
} finally {
|
|
548
552
|
currentSubscriber = prev;
|
|
549
553
|
currentOwnerScope = prevScope;
|
|
554
|
+
currentStructOwner = prevStructOwner;
|
|
550
555
|
if (savedDepth !== 0) {
|
|
551
556
|
suspendDepth = savedDepth;
|
|
552
557
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -603,7 +608,25 @@ function track(effectFn, subscriber) {
|
|
|
603
608
|
}
|
|
604
609
|
return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
|
|
605
610
|
}
|
|
606
|
-
function reactiveBinding(commit, ownerNode) {
|
|
611
|
+
function reactiveBinding(commit, ownerNode, structural) {
|
|
612
|
+
return createBinding(commit, ownerNode, structural === true)._dispose;
|
|
613
|
+
}
|
|
614
|
+
function structuralBinding(commit, ownerNode) {
|
|
615
|
+
const sub = createBinding(commit, ownerNode, true);
|
|
616
|
+
return {
|
|
617
|
+
stop: sub._dispose,
|
|
618
|
+
run: (fn) => {
|
|
619
|
+
const prev = currentStructOwner;
|
|
620
|
+
currentStructOwner = sub._tok ?? null;
|
|
621
|
+
try {
|
|
622
|
+
return fn();
|
|
623
|
+
} finally {
|
|
624
|
+
currentStructOwner = prev;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
function createBinding(commit, ownerNode, structural) {
|
|
607
630
|
const run = () => {
|
|
608
631
|
const s = subscriber;
|
|
609
632
|
if (s._disposed || s._reentrant) return;
|
|
@@ -626,19 +649,25 @@ function reactiveBinding(commit, ownerNode) {
|
|
|
626
649
|
subscriber._disposed = false;
|
|
627
650
|
subscriber._errorPhase = "binding";
|
|
628
651
|
subscriber._errorNode = ownerNode;
|
|
652
|
+
subscriber._tok = null;
|
|
653
|
+
subscriber._owner = null;
|
|
654
|
+
if (structural) subscriber._tok = { sub: subscriber };
|
|
629
655
|
try {
|
|
630
656
|
run();
|
|
631
657
|
} catch (err) {
|
|
632
658
|
subscriber._disposed = true;
|
|
633
659
|
subscriber._errorNode = void 0;
|
|
660
|
+
if (subscriber._tok != null) subscriber._tok.sub = null;
|
|
634
661
|
cleanup(subscriber);
|
|
635
662
|
throw err;
|
|
636
663
|
}
|
|
637
|
-
|
|
664
|
+
subscriber._dispose = () => {
|
|
638
665
|
subscriber._disposed = true;
|
|
639
666
|
subscriber._errorNode = void 0;
|
|
667
|
+
if (subscriber._tok != null) subscriber._tok.sub = null;
|
|
640
668
|
cleanup(subscriber);
|
|
641
|
-
}
|
|
669
|
+
};
|
|
670
|
+
return subscriber;
|
|
642
671
|
}
|
|
643
672
|
function recordDependency(signal2) {
|
|
644
673
|
if (!currentSubscriber) return;
|
|
@@ -662,6 +691,7 @@ function recordDependency(signal2) {
|
|
|
662
691
|
}
|
|
663
692
|
function cleanup(subscriber) {
|
|
664
693
|
const sub = subscriber;
|
|
694
|
+
if (sub._owner != null) sub._owner = null;
|
|
665
695
|
let node = sub.depsHead ?? null;
|
|
666
696
|
sub.depsHead = null;
|
|
667
697
|
sub.depsTail = null;
|
|
@@ -721,20 +751,41 @@ function drainQueue() {
|
|
|
721
751
|
break;
|
|
722
752
|
}
|
|
723
753
|
const sub = pendingQueue[i++];
|
|
724
|
-
pendingSet.delete(sub);
|
|
725
|
-
if (
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
754
|
+
if (!pendingSet.delete(sub)) continue;
|
|
755
|
+
if (sub._owner != null && pendingSet.size > 0) {
|
|
756
|
+
runPendingOwners(sub);
|
|
757
|
+
if (pendingSet.has(sub)) continue;
|
|
758
|
+
}
|
|
759
|
+
runQueued(sub);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
function runPendingOwners(sub) {
|
|
763
|
+
for (; ; ) {
|
|
764
|
+
let outer = null;
|
|
765
|
+
for (let t = sub._owner ?? null; t !== null; ) {
|
|
766
|
+
const o = t.sub;
|
|
767
|
+
if (o === null) break;
|
|
768
|
+
if (pendingSet.has(o)) outer = o;
|
|
769
|
+
t = o._owner ?? null;
|
|
770
|
+
}
|
|
771
|
+
if (outer === null) return;
|
|
772
|
+
pendingSet.delete(outer);
|
|
773
|
+
runQueued(outer);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
function runQueued(sub) {
|
|
777
|
+
if (quarantined.size > 0 && quarantined.has(sub)) return;
|
|
778
|
+
if (sub._hasComputedDep === true && !depsChanged(sub)) return;
|
|
779
|
+
if (tickRepeat(sub)) {
|
|
780
|
+
cycleError(sub);
|
|
781
|
+
quarantined.add(sub);
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
const pushed = beginDisposerCapture(sub._cap ?? null);
|
|
785
|
+
try {
|
|
786
|
+
safeInvoke(sub);
|
|
787
|
+
} finally {
|
|
788
|
+
if (pushed) endDisposerCapture();
|
|
738
789
|
}
|
|
739
790
|
}
|
|
740
791
|
function drainNotificationQueue() {
|
|
@@ -870,7 +921,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
870
921
|
}
|
|
871
922
|
|
|
872
923
|
// src/reactivity/track.ts
|
|
873
|
-
var _runtimeVersion = true ? "4.
|
|
924
|
+
var _runtimeVersion = true ? "4.13.1" : "dev";
|
|
874
925
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
875
926
|
function resolveReactiveApi() {
|
|
876
927
|
const g = globalThis;
|
|
@@ -905,6 +956,7 @@ function resolveReactiveApi() {
|
|
|
905
956
|
getOwnerScope,
|
|
906
957
|
runWithOwnerScope,
|
|
907
958
|
bindOwnerScope,
|
|
959
|
+
structuralBinding,
|
|
908
960
|
version: _runtimeVersion
|
|
909
961
|
};
|
|
910
962
|
g[REGISTRY_KEY] = local;
|
|
@@ -931,6 +983,7 @@ var forEachSubscriber2 = API.forEachSubscriber;
|
|
|
931
983
|
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
932
984
|
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
933
985
|
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
986
|
+
var structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
|
|
934
987
|
|
|
935
988
|
// src/reactivity/batch.ts
|
|
936
989
|
var batchDepth = 0;
|
package/dist/devtools.js
CHANGED
|
@@ -35,13 +35,13 @@ import {
|
|
|
35
35
|
trackCleanup,
|
|
36
36
|
walkDependencyGraph,
|
|
37
37
|
withErrorTracking
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-J4X7ICH4.js";
|
|
39
39
|
import "./chunk-7ZHH77QA.js";
|
|
40
|
-
import "./chunk-
|
|
40
|
+
import "./chunk-QC3NP47A.js";
|
|
41
41
|
import "./chunk-EXXSN3BW.js";
|
|
42
42
|
import "./chunk-7XHATCIH.js";
|
|
43
|
-
import "./chunk-
|
|
44
|
-
import "./chunk-
|
|
43
|
+
import "./chunk-QKFVMIAV.js";
|
|
44
|
+
import "./chunk-4UTGDVSA.js";
|
|
45
45
|
import {
|
|
46
46
|
isDev
|
|
47
47
|
} from "./chunk-NYNYSPK7.js";
|
package/dist/ecosystem.cjs
CHANGED
|
@@ -387,6 +387,7 @@ function bindOwnerScope(fn) {
|
|
|
387
387
|
if (scope === null) return fn;
|
|
388
388
|
return (...args) => runWithOwnerScope(scope, () => fn(...args));
|
|
389
389
|
}
|
|
390
|
+
var currentStructOwner = null;
|
|
390
391
|
var subscriberEpochCounter = 0;
|
|
391
392
|
function retrack(effectFn, subscriber) {
|
|
392
393
|
const prev = currentSubscriber;
|
|
@@ -406,6 +407,9 @@ function retrack(effectFn, subscriber) {
|
|
|
406
407
|
if (prevScope !== null && !sub._epoch && sub._scope === void 0) sub._scope = prevScope;
|
|
407
408
|
const scope = sub._scope === void 0 ? null : sub._scope;
|
|
408
409
|
if (scope !== prevScope) currentOwnerScope = scope;
|
|
410
|
+
const prevStructOwner = currentStructOwner;
|
|
411
|
+
if (prevStructOwner !== null && !sub._epoch && !sub._c && sub._owner == null) sub._owner = prevStructOwner;
|
|
412
|
+
if (sub._tok != null) currentStructOwner = sub._tok;
|
|
409
413
|
const epoch = ++subscriberEpochCounter;
|
|
410
414
|
sub._epoch = epoch;
|
|
411
415
|
sub._structDirty = false;
|
|
@@ -419,6 +423,7 @@ function retrack(effectFn, subscriber) {
|
|
|
419
423
|
} finally {
|
|
420
424
|
currentSubscriber = prev;
|
|
421
425
|
currentOwnerScope = prevScope;
|
|
426
|
+
currentStructOwner = prevStructOwner;
|
|
422
427
|
if (savedDepth !== 0) {
|
|
423
428
|
suspendDepth = savedDepth;
|
|
424
429
|
suspendSavedSub = savedSuspendSub;
|
|
@@ -475,7 +480,25 @@ function track(effectFn, subscriber) {
|
|
|
475
480
|
}
|
|
476
481
|
return sub._dispose ?? (sub._dispose = () => cleanup(subscriber));
|
|
477
482
|
}
|
|
478
|
-
function reactiveBinding(commit, ownerNode) {
|
|
483
|
+
function reactiveBinding(commit, ownerNode, structural) {
|
|
484
|
+
return createBinding(commit, ownerNode, structural === true)._dispose;
|
|
485
|
+
}
|
|
486
|
+
function structuralBinding(commit, ownerNode) {
|
|
487
|
+
const sub = createBinding(commit, ownerNode, true);
|
|
488
|
+
return {
|
|
489
|
+
stop: sub._dispose,
|
|
490
|
+
run: (fn) => {
|
|
491
|
+
const prev = currentStructOwner;
|
|
492
|
+
currentStructOwner = sub._tok ?? null;
|
|
493
|
+
try {
|
|
494
|
+
return fn();
|
|
495
|
+
} finally {
|
|
496
|
+
currentStructOwner = prev;
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
function createBinding(commit, ownerNode, structural) {
|
|
479
502
|
const run = () => {
|
|
480
503
|
const s = subscriber;
|
|
481
504
|
if (s._disposed || s._reentrant) return;
|
|
@@ -498,19 +521,25 @@ function reactiveBinding(commit, ownerNode) {
|
|
|
498
521
|
subscriber._disposed = false;
|
|
499
522
|
subscriber._errorPhase = "binding";
|
|
500
523
|
subscriber._errorNode = ownerNode;
|
|
524
|
+
subscriber._tok = null;
|
|
525
|
+
subscriber._owner = null;
|
|
526
|
+
if (structural) subscriber._tok = { sub: subscriber };
|
|
501
527
|
try {
|
|
502
528
|
run();
|
|
503
529
|
} catch (err) {
|
|
504
530
|
subscriber._disposed = true;
|
|
505
531
|
subscriber._errorNode = void 0;
|
|
532
|
+
if (subscriber._tok != null) subscriber._tok.sub = null;
|
|
506
533
|
cleanup(subscriber);
|
|
507
534
|
throw err;
|
|
508
535
|
}
|
|
509
|
-
|
|
536
|
+
subscriber._dispose = () => {
|
|
510
537
|
subscriber._disposed = true;
|
|
511
538
|
subscriber._errorNode = void 0;
|
|
539
|
+
if (subscriber._tok != null) subscriber._tok.sub = null;
|
|
512
540
|
cleanup(subscriber);
|
|
513
|
-
}
|
|
541
|
+
};
|
|
542
|
+
return subscriber;
|
|
514
543
|
}
|
|
515
544
|
function recordDependency(signal2) {
|
|
516
545
|
if (!currentSubscriber) return;
|
|
@@ -534,6 +563,7 @@ function recordDependency(signal2) {
|
|
|
534
563
|
}
|
|
535
564
|
function cleanup(subscriber) {
|
|
536
565
|
const sub = subscriber;
|
|
566
|
+
if (sub._owner != null) sub._owner = null;
|
|
537
567
|
let node = sub.depsHead ?? null;
|
|
538
568
|
sub.depsHead = null;
|
|
539
569
|
sub.depsTail = null;
|
|
@@ -593,20 +623,41 @@ function drainQueue() {
|
|
|
593
623
|
break;
|
|
594
624
|
}
|
|
595
625
|
const sub = pendingQueue[i++];
|
|
596
|
-
pendingSet.delete(sub);
|
|
597
|
-
if (
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
626
|
+
if (!pendingSet.delete(sub)) continue;
|
|
627
|
+
if (sub._owner != null && pendingSet.size > 0) {
|
|
628
|
+
runPendingOwners(sub);
|
|
629
|
+
if (pendingSet.has(sub)) continue;
|
|
630
|
+
}
|
|
631
|
+
runQueued(sub);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
function runPendingOwners(sub) {
|
|
635
|
+
for (; ; ) {
|
|
636
|
+
let outer = null;
|
|
637
|
+
for (let t = sub._owner ?? null; t !== null; ) {
|
|
638
|
+
const o = t.sub;
|
|
639
|
+
if (o === null) break;
|
|
640
|
+
if (pendingSet.has(o)) outer = o;
|
|
641
|
+
t = o._owner ?? null;
|
|
642
|
+
}
|
|
643
|
+
if (outer === null) return;
|
|
644
|
+
pendingSet.delete(outer);
|
|
645
|
+
runQueued(outer);
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
function runQueued(sub) {
|
|
649
|
+
if (quarantined.size > 0 && quarantined.has(sub)) return;
|
|
650
|
+
if (sub._hasComputedDep === true && !depsChanged(sub)) return;
|
|
651
|
+
if (tickRepeat(sub)) {
|
|
652
|
+
cycleError(sub);
|
|
653
|
+
quarantined.add(sub);
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
const pushed = beginDisposerCapture(sub._cap ?? null);
|
|
657
|
+
try {
|
|
658
|
+
safeInvoke(sub);
|
|
659
|
+
} finally {
|
|
660
|
+
if (pushed) endDisposerCapture();
|
|
610
661
|
}
|
|
611
662
|
}
|
|
612
663
|
function drainNotificationQueue() {
|
|
@@ -742,7 +793,7 @@ function forEachSubscriber(signal2, visit) {
|
|
|
742
793
|
}
|
|
743
794
|
|
|
744
795
|
// src/reactivity/track.ts
|
|
745
|
-
var _runtimeVersion = true ? "4.
|
|
796
|
+
var _runtimeVersion = true ? "4.13.1" : "dev";
|
|
746
797
|
var REGISTRY_KEY = /* @__PURE__ */ Symbol.for("sibujs.reactive.v1");
|
|
747
798
|
function resolveReactiveApi() {
|
|
748
799
|
const g = globalThis;
|
|
@@ -777,6 +828,7 @@ function resolveReactiveApi() {
|
|
|
777
828
|
getOwnerScope,
|
|
778
829
|
runWithOwnerScope,
|
|
779
830
|
bindOwnerScope,
|
|
831
|
+
structuralBinding,
|
|
780
832
|
version: _runtimeVersion
|
|
781
833
|
};
|
|
782
834
|
g[REGISTRY_KEY] = local;
|
|
@@ -803,6 +855,7 @@ var forEachSubscriber2 = API.forEachSubscriber;
|
|
|
803
855
|
var getOwnerScope2 = API.getOwnerScope ?? getOwnerScope;
|
|
804
856
|
var runWithOwnerScope2 = API.runWithOwnerScope ?? runWithOwnerScope;
|
|
805
857
|
var bindOwnerScope2 = API.bindOwnerScope ?? bindOwnerScope;
|
|
858
|
+
var structuralBinding2 = API.structuralBinding ?? ((commit, ownerNode) => ({ stop: API.reactiveBinding(commit, ownerNode), run: (fn) => fn() }));
|
|
806
859
|
|
|
807
860
|
// src/core/devtoolsHook.ts
|
|
808
861
|
function emitDevtools(hook, event, payload) {
|
|
@@ -2263,9 +2316,10 @@ function refocus(el, snapshot) {
|
|
|
2263
2316
|
field.setSelectionRange(start, end, snapshot.direction ?? "none");
|
|
2264
2317
|
}
|
|
2265
2318
|
}
|
|
2266
|
-
function restoreFocusWithin(snapshot, nodes, where) {
|
|
2319
|
+
function restoreFocusWithin(snapshot, nodes, where, policy) {
|
|
2267
2320
|
if (!snapshot) return;
|
|
2268
2321
|
if (typeof document === "undefined") return;
|
|
2322
|
+
if (policy === "discard") return;
|
|
2269
2323
|
const active = document.activeElement;
|
|
2270
2324
|
if (active === snapshot.el) return;
|
|
2271
2325
|
if (active && active !== document.body && active !== document.documentElement) return;
|
|
@@ -2282,10 +2336,17 @@ function restoreFocusWithin(snapshot, nodes, where) {
|
|
|
2282
2336
|
}
|
|
2283
2337
|
ambiguous = count > 1;
|
|
2284
2338
|
}
|
|
2339
|
+
if (policy !== void 0 && typeof policy === "object") {
|
|
2340
|
+
const target = typeof policy.restoreTo === "function" ? policy.restoreTo() : policy.restoreTo;
|
|
2341
|
+
if (target?.isConnected) {
|
|
2342
|
+
target.focus();
|
|
2343
|
+
if (document.activeElement === target) return;
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2285
2346
|
devWarnLazy(() => {
|
|
2286
2347
|
const id = snapshot.attr ? ` (${snapshot.attr}="${snapshot.value}")` : "";
|
|
2287
2348
|
const why = ambiguous ? `several elements in the rebuilt subtree share ${snapshot.attr}="${snapshot.value}", so there is no way to tell which one the user was in \u2014 a shared name (a radio group) identifies a GROUP, not a control. Add a unique id or data-focus-key to each` : "no element in the rebuilt subtree carries the same identity. Give it a stable id, name, or data-focus-key that the rebuild reproduces";
|
|
2288
|
-
return `${where}: a reactive rebuild discarded the focused element <${snapshot.tag.toLowerCase()}>${id} and could not re-establish it, so focus fell back to <body>. An in-progress edit ends here, and an in-progress IME composition is lost outright \u2014 a composition belongs to the DOM node, so it cannot survive the node being destroyed. ${why}, or stop the rebuild from happening: key the subtree with match(() => shapeKey(), { \u2026 }) so it is re-created only when the shape actually changes, and drive the rest with reactive attributes and text children, which mutate nodes in place instead of replacing them
|
|
2349
|
+
return `${where}: a reactive rebuild discarded the focused element <${snapshot.tag.toLowerCase()}>${id} and could not re-establish it, so focus fell back to <body>. An in-progress edit ends here, and an in-progress IME composition is lost outright \u2014 a composition belongs to the DOM node, so it cannot survive the node being destroyed. ${why}, or stop the rebuild from happening: key the subtree with match(() => shapeKey(), { \u2026 }) so it is re-created only when the shape actually changes, and drive the rest with reactive attributes and text children, which mutate nodes in place instead of replacing them. If dropping focus is INTENDED here (closing a panel, say), pass { focus: "discard" } to when()/match() to silence this, or { focus: { restoreTo: element } } to send focus somewhere other than <body>.`;
|
|
2289
2350
|
});
|
|
2290
2351
|
}
|
|
2291
2352
|
|
|
@@ -2360,7 +2421,7 @@ function bindChildNode(placeholder, getter) {
|
|
|
2360
2421
|
lastNodes = newNodes;
|
|
2361
2422
|
restoreFocusWithin(focused, newNodes, "bindChildNode");
|
|
2362
2423
|
}
|
|
2363
|
-
return reactiveBinding2(commit, placeholder);
|
|
2424
|
+
return reactiveBinding2(commit, placeholder, true);
|
|
2364
2425
|
}
|
|
2365
2426
|
|
|
2366
2427
|
// src/core/rendering/requireDocument.ts
|
package/dist/ecosystem.js
CHANGED
|
@@ -7,19 +7,19 @@ import {
|
|
|
7
7
|
mobXAdapter,
|
|
8
8
|
reduxAdapter,
|
|
9
9
|
zustandAdapter
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-5RIBLY2N.js";
|
|
11
11
|
import "./chunk-J6FW5TV6.js";
|
|
12
|
-
import "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-CPQKWCJ2.js";
|
|
13
|
+
import "./chunk-K4LNUT5L.js";
|
|
14
14
|
import "./chunk-F2UWOZ6J.js";
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-YFTBCCVH.js";
|
|
16
16
|
import "./chunk-7ZHH77QA.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-QC3NP47A.js";
|
|
18
18
|
import "./chunk-EXXSN3BW.js";
|
|
19
19
|
import "./chunk-7XHATCIH.js";
|
|
20
20
|
import "./chunk-5HZXGZ6T.js";
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-QKFVMIAV.js";
|
|
22
|
+
import "./chunk-4UTGDVSA.js";
|
|
23
23
|
import "./chunk-NYNYSPK7.js";
|
|
24
24
|
export {
|
|
25
25
|
antdAdapter,
|