essor 0.0.17-beta.6 → 0.0.17
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/essor.browser.dev.js +891 -270
- package/dist/essor.browser.dev.js.map +1 -1
- package/dist/essor.browser.js +7 -7
- package/dist/essor.cjs +3 -3
- package/dist/essor.d.cts +1 -1
- package/dist/essor.d.ts +1 -1
- package/dist/essor.dev.cjs +3 -3
- package/dist/essor.dev.cjs.map +1 -1
- package/dist/essor.dev.js +3 -3
- package/dist/essor.dev.js.map +1 -1
- package/dist/essor.js +3 -3
- package/package.json +4 -4
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* essor v0.0.17
|
|
3
|
-
* build time 2026-
|
|
2
|
+
* essor v0.0.17
|
|
3
|
+
* build time 2026-07-08T06:29:31.073Z
|
|
4
4
|
* (c) 2023-Present jiangxd <jiangxd2016@gmail.com>
|
|
5
5
|
* @license MIT
|
|
6
6
|
**/
|
|
7
7
|
|
|
8
8
|
// src/version.ts
|
|
9
|
-
var __version = "0.0.17
|
|
9
|
+
var __version = "0.0.17";
|
|
10
10
|
|
|
11
11
|
// ../shared/dist/shared.dev.js
|
|
12
12
|
var isObject = (val) => val !== null && typeof val === "object";
|
|
@@ -20,6 +20,9 @@ function isString(val) {
|
|
|
20
20
|
function isNumber(val) {
|
|
21
21
|
return typeof val === "number";
|
|
22
22
|
}
|
|
23
|
+
function isNull(val) {
|
|
24
|
+
return val === null;
|
|
25
|
+
}
|
|
23
26
|
function isSymbol(val) {
|
|
24
27
|
return typeof val === "symbol";
|
|
25
28
|
}
|
|
@@ -36,7 +39,11 @@ function isMap(val) {
|
|
|
36
39
|
return _toString.call(val) === "[object Map]";
|
|
37
40
|
}
|
|
38
41
|
var isFunction = (val) => typeof val === "function";
|
|
39
|
-
var isPlainObject = (val) =>
|
|
42
|
+
var isPlainObject = (val) => {
|
|
43
|
+
if (_toString.call(val) !== "[object Object]") return false;
|
|
44
|
+
const proto = Object.getPrototypeOf(val);
|
|
45
|
+
return proto === null || proto === Object.prototype;
|
|
46
|
+
};
|
|
40
47
|
function isStringNumber(val) {
|
|
41
48
|
if (!isString(val) || val === "") {
|
|
42
49
|
return false;
|
|
@@ -46,6 +53,12 @@ function isStringNumber(val) {
|
|
|
46
53
|
function isUndefined(val) {
|
|
47
54
|
return typeof val === "undefined";
|
|
48
55
|
}
|
|
56
|
+
function isDate(val) {
|
|
57
|
+
return _toString.call(val) === "[object Date]";
|
|
58
|
+
}
|
|
59
|
+
function isRegExp(val) {
|
|
60
|
+
return _toString.call(val) === "[object RegExp]";
|
|
61
|
+
}
|
|
49
62
|
var _toString = Object.prototype.toString;
|
|
50
63
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
51
64
|
var hasOwn = (val, key) => hasOwnProperty.call(val, key);
|
|
@@ -432,6 +445,17 @@ function isValidLink(checkLink, sub) {
|
|
|
432
445
|
}
|
|
433
446
|
var targetMap = /* @__PURE__ */ new WeakMap();
|
|
434
447
|
var triggerVersion = 0;
|
|
448
|
+
var triggerEffects = [];
|
|
449
|
+
var triggerDepth = 0;
|
|
450
|
+
function startTriggerEffects() {
|
|
451
|
+
const effects = triggerDepth === 0 ? triggerEffects : [];
|
|
452
|
+
triggerDepth++;
|
|
453
|
+
return effects;
|
|
454
|
+
}
|
|
455
|
+
function endTriggerEffects(effects) {
|
|
456
|
+
effects.length = 0;
|
|
457
|
+
triggerDepth--;
|
|
458
|
+
}
|
|
435
459
|
function collectTriggeredEffects(dep, effects, version) {
|
|
436
460
|
if (!dep) {
|
|
437
461
|
return;
|
|
@@ -462,46 +486,127 @@ function track(target, key) {
|
|
|
462
486
|
linkReactiveNode(dep, activeSub);
|
|
463
487
|
}
|
|
464
488
|
function trigger(target, type, key, newValue) {
|
|
465
|
-
var
|
|
489
|
+
var _a62;
|
|
466
490
|
const depsMap = targetMap.get(target);
|
|
467
491
|
if (!depsMap) {
|
|
468
492
|
return;
|
|
469
493
|
}
|
|
470
|
-
const effects =
|
|
494
|
+
const effects = startTriggerEffects();
|
|
471
495
|
const version = ++triggerVersion;
|
|
472
|
-
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
|
|
496
|
+
try {
|
|
497
|
+
if (key !== void 0) {
|
|
498
|
+
if (isArray(key)) {
|
|
499
|
+
for (const element of key) {
|
|
500
|
+
collectTriggeredEffects(depsMap.get(element), effects, version);
|
|
501
|
+
}
|
|
502
|
+
} else {
|
|
503
|
+
collectTriggeredEffects(depsMap.get(key), effects, version);
|
|
476
504
|
}
|
|
477
|
-
} else {
|
|
478
|
-
collectTriggeredEffects(depsMap.get(key), effects, version);
|
|
479
505
|
}
|
|
506
|
+
if (type === "ADD" || type === "DELETE" || type === "CLEAR") {
|
|
507
|
+
const iterationKey = isArray(target) ? ARRAY_ITERATE_KEY : ITERATE_KEY;
|
|
508
|
+
collectTriggeredEffects(depsMap.get(iterationKey), effects, version);
|
|
509
|
+
}
|
|
510
|
+
for (const effect2 of effects) {
|
|
511
|
+
if (isFunction(effect2.onTrigger)) {
|
|
512
|
+
effect2.onTrigger({
|
|
513
|
+
effect: effect2,
|
|
514
|
+
target,
|
|
515
|
+
type,
|
|
516
|
+
key,
|
|
517
|
+
newValue
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
if (effect2.flag & 2) {
|
|
521
|
+
(_a62 = effect2.notify) == null ? void 0 : _a62.call(effect2);
|
|
522
|
+
} else if (effect2.flag & 1) {
|
|
523
|
+
effect2.flag |= 16;
|
|
524
|
+
if (effect2.subLink) {
|
|
525
|
+
propagate(effect2.subLink);
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
} finally {
|
|
530
|
+
endTriggerEffects(effects);
|
|
480
531
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
532
|
+
}
|
|
533
|
+
function trackNode(node) {
|
|
534
|
+
if (!activeSub || isUntracking) return;
|
|
535
|
+
linkReactiveNode(node, activeSub);
|
|
536
|
+
}
|
|
537
|
+
function triggerNode(node) {
|
|
538
|
+
var _a62;
|
|
539
|
+
const link = node.subLink;
|
|
540
|
+
if (!link) return;
|
|
541
|
+
const effects = startTriggerEffects();
|
|
542
|
+
const version = ++triggerVersion;
|
|
543
|
+
try {
|
|
544
|
+
for (let current = link; current; current = current.nextSubLink) {
|
|
545
|
+
const effect2 = current.subNode;
|
|
546
|
+
if (effect2._triggerVersion === version) {
|
|
547
|
+
continue;
|
|
548
|
+
}
|
|
549
|
+
effect2._triggerVersion = version;
|
|
550
|
+
effects.push(effect2);
|
|
494
551
|
}
|
|
495
|
-
|
|
496
|
-
(
|
|
497
|
-
|
|
498
|
-
effect2.flag
|
|
499
|
-
|
|
500
|
-
|
|
552
|
+
for (const effect2 of effects) {
|
|
553
|
+
if (effect2.flag & 2) {
|
|
554
|
+
(_a62 = effect2.notify) == null ? void 0 : _a62.call(effect2);
|
|
555
|
+
} else if (effect2.flag & 1) {
|
|
556
|
+
effect2.flag |= 16;
|
|
557
|
+
if (effect2.subLink) {
|
|
558
|
+
propagate(effect2.subLink);
|
|
559
|
+
}
|
|
501
560
|
}
|
|
502
561
|
}
|
|
562
|
+
} finally {
|
|
563
|
+
endTriggerEffects(effects);
|
|
503
564
|
}
|
|
504
565
|
}
|
|
566
|
+
var ReactiveProperty = class {
|
|
567
|
+
constructor(_target, _key) {
|
|
568
|
+
this._target = _target;
|
|
569
|
+
this._key = _key;
|
|
570
|
+
this.flag = 1;
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Read the property value and track the dependency.
|
|
574
|
+
*
|
|
575
|
+
* Uses trackNode(this) — bypasses targetMap/Dep. The ReactiveProperty itself
|
|
576
|
+
* IS the depNode, so linkReactiveNode connects the active subscriber directly
|
|
577
|
+
* to this node's subLink chain.
|
|
578
|
+
*
|
|
579
|
+
* Nested proxy wrapping and signal auto-unwrapping are handled by the caller
|
|
580
|
+
* (the reactive proxy get trap), keeping this method self-contained and free
|
|
581
|
+
* of a circular dependency on the rest of reactive.ts.
|
|
582
|
+
*/
|
|
583
|
+
getValue() {
|
|
584
|
+
trackNode(this);
|
|
585
|
+
return this._target[this._key];
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Update the property value and notify subscribers.
|
|
589
|
+
*
|
|
590
|
+
* Uses triggerNode(this) — directly walks the subLink chain, bypassing
|
|
591
|
+
* targetMap + collectTriggeredEffects.
|
|
592
|
+
*
|
|
593
|
+
* @param rawValue - The new (already unrawed) value.
|
|
594
|
+
* @param oldValue - The previous value, read BEFORE Reflect.set.
|
|
595
|
+
*/
|
|
596
|
+
setValue(rawValue, oldValue) {
|
|
597
|
+
if (Object.is(oldValue, rawValue)) {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
triggerNode(this);
|
|
601
|
+
}
|
|
602
|
+
/**
|
|
603
|
+
* Invalidate this property (called on delete).
|
|
604
|
+
* Notifies subscribers that the value is gone.
|
|
605
|
+
*/
|
|
606
|
+
invalidate() {
|
|
607
|
+
triggerNode(this);
|
|
608
|
+
}
|
|
609
|
+
};
|
|
505
610
|
var reactiveCaches = /* @__PURE__ */ new WeakMap();
|
|
506
611
|
var shallowReactiveCaches = /* @__PURE__ */ new WeakMap();
|
|
507
612
|
function toRaw(value) {
|
|
@@ -563,7 +668,7 @@ function createArrayInstrumentations() {
|
|
|
563
668
|
const isShallowMode = isShallow(this);
|
|
564
669
|
track(arr, ARRAY_ITERATE_KEY);
|
|
565
670
|
const res = Array.prototype[key].apply(arr, args);
|
|
566
|
-
if (!
|
|
671
|
+
if (!isArray(res)) {
|
|
567
672
|
return res;
|
|
568
673
|
}
|
|
569
674
|
return res.map((item) => isObject(item) ? reactiveImpl(item, isShallowMode) : item);
|
|
@@ -598,7 +703,7 @@ function createArrayInstrumentations() {
|
|
|
598
703
|
if (done) {
|
|
599
704
|
return { value, done };
|
|
600
705
|
}
|
|
601
|
-
if (
|
|
706
|
+
if (isArray(value)) {
|
|
602
707
|
return {
|
|
603
708
|
value: value.map((v) => isObject(v) ? reactiveImpl(v, isShallowMode) : v),
|
|
604
709
|
done
|
|
@@ -660,6 +765,32 @@ var arrayHandlers = (shallow) => ({
|
|
|
660
765
|
}
|
|
661
766
|
}
|
|
662
767
|
return result;
|
|
768
|
+
},
|
|
769
|
+
has: (target, key) => {
|
|
770
|
+
const result = Reflect.has(target, key);
|
|
771
|
+
if (typeof key !== "symbol") {
|
|
772
|
+
if (isStringNumber(key)) {
|
|
773
|
+
track(target, key);
|
|
774
|
+
}
|
|
775
|
+
track(target, ARRAY_KEY);
|
|
776
|
+
}
|
|
777
|
+
return result;
|
|
778
|
+
},
|
|
779
|
+
deleteProperty: (target, key) => {
|
|
780
|
+
const hadKey = hasOwn(target, key);
|
|
781
|
+
const result = Reflect.deleteProperty(target, key);
|
|
782
|
+
if (hadKey && result) {
|
|
783
|
+
if (isStringNumber(key)) {
|
|
784
|
+
trigger(target, TriggerOpTypes.DELETE, [key, ARRAY_ITERATE_KEY, ARRAY_KEY]);
|
|
785
|
+
} else {
|
|
786
|
+
trigger(target, TriggerOpTypes.DELETE, key);
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
return result;
|
|
790
|
+
},
|
|
791
|
+
ownKeys: (target) => {
|
|
792
|
+
track(target, ARRAY_ITERATE_KEY);
|
|
793
|
+
return Reflect.ownKeys(target);
|
|
663
794
|
}
|
|
664
795
|
});
|
|
665
796
|
var shallowArrayHandlers = arrayHandlers(true);
|
|
@@ -826,7 +957,7 @@ var collectionInstrumentations = {
|
|
|
826
957
|
if (isShallowMode) {
|
|
827
958
|
return { value, done };
|
|
828
959
|
}
|
|
829
|
-
if (
|
|
960
|
+
if (isArray(value)) {
|
|
830
961
|
return {
|
|
831
962
|
value: value.map((v) => isObject(v) ? reactiveImpl(v) : v),
|
|
832
963
|
done
|
|
@@ -1017,9 +1148,46 @@ var weakInstrumentations = {
|
|
|
1017
1148
|
return result;
|
|
1018
1149
|
}
|
|
1019
1150
|
};
|
|
1151
|
+
var targetPropertyMaps = /* @__PURE__ */ new WeakMap();
|
|
1152
|
+
function getTargetDepSize(target, key) {
|
|
1153
|
+
var _a62, _b2;
|
|
1154
|
+
const rawTarget = (_a62 = target[
|
|
1155
|
+
"_RAW"
|
|
1156
|
+
/* RAW */
|
|
1157
|
+
]) != null ? _a62 : target;
|
|
1158
|
+
const prop = (_b2 = targetPropertyMaps.get(rawTarget)) == null ? void 0 : _b2.get(key);
|
|
1159
|
+
if (!(prop == null ? void 0 : prop.subLink)) return 0;
|
|
1160
|
+
let size = 0;
|
|
1161
|
+
for (let link = prop.subLink; link; link = link.nextSubLink) size++;
|
|
1162
|
+
return size;
|
|
1163
|
+
}
|
|
1164
|
+
function getPropertyMap(target) {
|
|
1165
|
+
let map = targetPropertyMaps.get(target);
|
|
1166
|
+
if (!map) {
|
|
1167
|
+
map = /* @__PURE__ */ new Map();
|
|
1168
|
+
targetPropertyMaps.set(target, map);
|
|
1169
|
+
}
|
|
1170
|
+
return map;
|
|
1171
|
+
}
|
|
1172
|
+
function trackProperty(target, key) {
|
|
1173
|
+
if (!activeSub) {
|
|
1174
|
+
return target[key];
|
|
1175
|
+
}
|
|
1176
|
+
const pm = getPropertyMap(target);
|
|
1177
|
+
let prop = pm.get(key);
|
|
1178
|
+
if (!prop) {
|
|
1179
|
+
prop = new ReactiveProperty(target, key);
|
|
1180
|
+
pm.set(key, prop);
|
|
1181
|
+
}
|
|
1182
|
+
return prop.getValue();
|
|
1183
|
+
}
|
|
1020
1184
|
var objectHandlers = (shallow) => ({
|
|
1021
1185
|
/**
|
|
1022
1186
|
* Reads an object property, unwraps signals, and tracks the access.
|
|
1187
|
+
*
|
|
1188
|
+
* Own properties use the per-property signal fast path (trackNode),
|
|
1189
|
+
* which bypasses the targetMap → Map → Dep indirection.
|
|
1190
|
+
* Prototype-chain properties fall back to the standard track() path.
|
|
1023
1191
|
*/
|
|
1024
1192
|
get(target, key, receiver) {
|
|
1025
1193
|
if (key === "_RAW") {
|
|
@@ -1031,6 +1199,14 @@ var objectHandlers = (shallow) => ({
|
|
|
1031
1199
|
if (key === "_IS_SHALLOW") {
|
|
1032
1200
|
return shallow;
|
|
1033
1201
|
}
|
|
1202
|
+
if (activeSub && hasOwn(target, key)) {
|
|
1203
|
+
const result = trackProperty(target, key);
|
|
1204
|
+
const unwrapped = isSignal(result) ? result.value : result;
|
|
1205
|
+
if (isObject(unwrapped) && !shallow) {
|
|
1206
|
+
return reactiveImpl(unwrapped);
|
|
1207
|
+
}
|
|
1208
|
+
return unwrapped;
|
|
1209
|
+
}
|
|
1034
1210
|
const value = Reflect.get(target, key, receiver);
|
|
1035
1211
|
const valueUnwrapped = isSignal(value) ? value.value : value;
|
|
1036
1212
|
track(target, key);
|
|
@@ -1044,6 +1220,14 @@ var objectHandlers = (shallow) => ({
|
|
|
1044
1220
|
const oldValue = Reflect.get(target, key, receiver);
|
|
1045
1221
|
const rawValue = toRaw(value);
|
|
1046
1222
|
const result = Reflect.set(target, key, rawValue, receiver);
|
|
1223
|
+
if (hadKey) {
|
|
1224
|
+
const pm = targetPropertyMaps.get(target);
|
|
1225
|
+
const prop = pm == null ? void 0 : pm.get(key);
|
|
1226
|
+
if (prop) {
|
|
1227
|
+
prop.setValue(rawValue, oldValue);
|
|
1228
|
+
return result;
|
|
1229
|
+
}
|
|
1230
|
+
}
|
|
1047
1231
|
if (hasStoredValueChanged(rawValue, oldValue)) {
|
|
1048
1232
|
trigger(target, hadKey ? TriggerOpTypes.SET : TriggerOpTypes.ADD, key, rawValue);
|
|
1049
1233
|
}
|
|
@@ -1053,6 +1237,12 @@ var objectHandlers = (shallow) => ({
|
|
|
1053
1237
|
const hadKey = hasOwn(target, key);
|
|
1054
1238
|
const result = Reflect.deleteProperty(target, key);
|
|
1055
1239
|
if (hadKey && result) {
|
|
1240
|
+
const pm = targetPropertyMaps.get(target);
|
|
1241
|
+
const prop = pm == null ? void 0 : pm.get(key);
|
|
1242
|
+
if (prop) {
|
|
1243
|
+
pm.delete(key);
|
|
1244
|
+
prop.invalidate();
|
|
1245
|
+
}
|
|
1056
1246
|
trigger(target, TriggerOpTypes.DELETE, key, void 0);
|
|
1057
1247
|
}
|
|
1058
1248
|
return result;
|
|
@@ -1295,6 +1485,7 @@ function isSignal(value) {
|
|
|
1295
1485
|
}
|
|
1296
1486
|
var queue = /* @__PURE__ */ new Set();
|
|
1297
1487
|
var activePreFlushCbs = /* @__PURE__ */ new Set();
|
|
1488
|
+
var activePostFlushCbs = /* @__PURE__ */ new Set();
|
|
1298
1489
|
var p = Promise.resolve();
|
|
1299
1490
|
var isFlushPending = false;
|
|
1300
1491
|
var RECURSION_LIMIT = 100;
|
|
@@ -1315,6 +1506,10 @@ function queuePreFlushCb(cb) {
|
|
|
1315
1506
|
activePreFlushCbs.add(cb);
|
|
1316
1507
|
queueFlush();
|
|
1317
1508
|
}
|
|
1509
|
+
function queuePostFlushJob(cb) {
|
|
1510
|
+
activePostFlushCbs.add(cb);
|
|
1511
|
+
queueFlush();
|
|
1512
|
+
}
|
|
1318
1513
|
function flushJobs() {
|
|
1319
1514
|
isFlushPending = false;
|
|
1320
1515
|
flushPreFlushCbs();
|
|
@@ -1327,7 +1522,7 @@ function flushJobs() {
|
|
|
1327
1522
|
`[Scheduler] Maximum recursive flush count (${RECURSION_LIMIT}) exceeded. This usually means an effect or watch callback is mutating a reactive dependency it also reads, causing an infinite update loop. The remaining queued jobs have been dropped to keep the app responsive.`
|
|
1328
1523
|
);
|
|
1329
1524
|
}
|
|
1330
|
-
|
|
1525
|
+
break;
|
|
1331
1526
|
}
|
|
1332
1527
|
const jobs = [...queue];
|
|
1333
1528
|
queue.clear();
|
|
@@ -1341,6 +1536,7 @@ function flushJobs() {
|
|
|
1341
1536
|
}
|
|
1342
1537
|
}
|
|
1343
1538
|
}
|
|
1539
|
+
flushPostFlushCbs();
|
|
1344
1540
|
}
|
|
1345
1541
|
function flushPreFlushCbs() {
|
|
1346
1542
|
const callbacks = Array.from(activePreFlushCbs);
|
|
@@ -1355,6 +1551,20 @@ function flushPreFlushCbs() {
|
|
|
1355
1551
|
}
|
|
1356
1552
|
}
|
|
1357
1553
|
}
|
|
1554
|
+
function flushPostFlushCbs() {
|
|
1555
|
+
if (activePostFlushCbs.size === 0) return;
|
|
1556
|
+
const callbacks = Array.from(activePostFlushCbs);
|
|
1557
|
+
activePostFlushCbs.clear();
|
|
1558
|
+
for (const callback of callbacks) {
|
|
1559
|
+
try {
|
|
1560
|
+
callback();
|
|
1561
|
+
} catch (_error) {
|
|
1562
|
+
{
|
|
1563
|
+
error("Error executing post-flush callback:", _error);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1358
1568
|
function createScheduler(effect2, flush) {
|
|
1359
1569
|
switch (flush) {
|
|
1360
1570
|
case "sync":
|
|
@@ -1405,7 +1615,7 @@ var EffectScope = class {
|
|
|
1405
1615
|
constructor(detached = false, parent = void 0) {
|
|
1406
1616
|
this.detached = detached;
|
|
1407
1617
|
this.parent = parent;
|
|
1408
|
-
this.
|
|
1618
|
+
this._state = 0;
|
|
1409
1619
|
this.effects = /* @__PURE__ */ new Set();
|
|
1410
1620
|
this.scopes = /* @__PURE__ */ new Set();
|
|
1411
1621
|
this.cleanups = [];
|
|
@@ -1415,36 +1625,46 @@ var EffectScope = class {
|
|
|
1415
1625
|
}
|
|
1416
1626
|
}
|
|
1417
1627
|
get active() {
|
|
1418
|
-
return this.
|
|
1628
|
+
return this._state !== 2;
|
|
1629
|
+
}
|
|
1630
|
+
/** Whether the scope is paused. */
|
|
1631
|
+
get isPaused() {
|
|
1632
|
+
return this._state === 1;
|
|
1633
|
+
}
|
|
1634
|
+
/** Whether the scope has been stopped / disposed. */
|
|
1635
|
+
get isDisposed() {
|
|
1636
|
+
return this._state === 2;
|
|
1419
1637
|
}
|
|
1420
1638
|
pause() {
|
|
1421
|
-
var
|
|
1422
|
-
if (
|
|
1639
|
+
var _a62;
|
|
1640
|
+
if (this._state !== 0) {
|
|
1423
1641
|
return;
|
|
1424
1642
|
}
|
|
1643
|
+
this._state = 1;
|
|
1425
1644
|
for (const scope of this.scopes) {
|
|
1426
1645
|
scope.pause();
|
|
1427
1646
|
}
|
|
1428
1647
|
for (const effect2 of this.effects) {
|
|
1429
|
-
(
|
|
1648
|
+
(_a62 = effect2.pause) == null ? void 0 : _a62.call(effect2);
|
|
1430
1649
|
}
|
|
1431
1650
|
}
|
|
1432
1651
|
resume() {
|
|
1433
|
-
var
|
|
1434
|
-
if (
|
|
1652
|
+
var _a62;
|
|
1653
|
+
if (this._state !== 1) {
|
|
1435
1654
|
return;
|
|
1436
1655
|
}
|
|
1656
|
+
this._state = 0;
|
|
1437
1657
|
for (const scope of this.scopes) {
|
|
1438
1658
|
scope.resume();
|
|
1439
1659
|
}
|
|
1440
1660
|
for (const effect2 of this.effects) {
|
|
1441
|
-
(
|
|
1661
|
+
(_a62 = effect2.resume) == null ? void 0 : _a62.call(effect2);
|
|
1442
1662
|
}
|
|
1443
1663
|
}
|
|
1444
1664
|
run(fn) {
|
|
1445
|
-
if (
|
|
1665
|
+
if (this._state === 2) {
|
|
1446
1666
|
{
|
|
1447
|
-
warn("cannot run
|
|
1667
|
+
warn("cannot run a disposed effect scope.");
|
|
1448
1668
|
}
|
|
1449
1669
|
return;
|
|
1450
1670
|
}
|
|
@@ -1457,27 +1677,42 @@ var EffectScope = class {
|
|
|
1457
1677
|
}
|
|
1458
1678
|
}
|
|
1459
1679
|
stop(fromParent = false) {
|
|
1460
|
-
if (
|
|
1680
|
+
if (this._state === 2) {
|
|
1461
1681
|
return;
|
|
1462
1682
|
}
|
|
1463
|
-
this.
|
|
1464
|
-
|
|
1465
|
-
scope.
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
this.
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1683
|
+
this._state = 2;
|
|
1684
|
+
try {
|
|
1685
|
+
for (const scope of this.scopes) {
|
|
1686
|
+
try {
|
|
1687
|
+
scope.stop(true);
|
|
1688
|
+
} catch (error_) {
|
|
1689
|
+
if (true) error("[EffectScope] child scope disposal threw:", error_);
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
this.scopes.clear();
|
|
1693
|
+
const effects = Array.from(this.effects);
|
|
1694
|
+
this.effects.clear();
|
|
1695
|
+
for (const effect2 of effects) {
|
|
1696
|
+
try {
|
|
1697
|
+
effect2.stop();
|
|
1698
|
+
} catch (error_) {
|
|
1699
|
+
if (true) error("[EffectScope] effect disposal threw:", error_);
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1702
|
+
for (let i = 0; i < this.cleanups.length; i++) {
|
|
1703
|
+
try {
|
|
1704
|
+
this.cleanups[i]();
|
|
1705
|
+
} catch (error_) {
|
|
1706
|
+
if (true) error("[EffectScope] cleanup threw:", error_);
|
|
1707
|
+
}
|
|
1708
|
+
}
|
|
1709
|
+
this.cleanups.length = 0;
|
|
1710
|
+
} finally {
|
|
1711
|
+
if (!fromParent && this.parent) {
|
|
1712
|
+
this.parent.scopes.delete(this);
|
|
1713
|
+
}
|
|
1714
|
+
this.parent = void 0;
|
|
1479
1715
|
}
|
|
1480
|
-
this.parent = void 0;
|
|
1481
1716
|
}
|
|
1482
1717
|
_record(effect2) {
|
|
1483
1718
|
this.effects.add(effect2);
|
|
@@ -1641,9 +1876,9 @@ var EffectImpl = class {
|
|
|
1641
1876
|
const prevSub = startTracking(this);
|
|
1642
1877
|
try {
|
|
1643
1878
|
return this.fn();
|
|
1644
|
-
} catch (
|
|
1879
|
+
} catch (error6) {
|
|
1645
1880
|
this.flag |= 16;
|
|
1646
|
-
throw
|
|
1881
|
+
throw error6;
|
|
1647
1882
|
} finally {
|
|
1648
1883
|
this.flag &= -513;
|
|
1649
1884
|
endTracking(this, prevSub);
|
|
@@ -1669,13 +1904,13 @@ var EffectImpl = class {
|
|
|
1669
1904
|
* @returns {void}
|
|
1670
1905
|
*/
|
|
1671
1906
|
notify() {
|
|
1672
|
-
var
|
|
1907
|
+
var _a62, _b2, _c, _d;
|
|
1673
1908
|
const flags = this.flag;
|
|
1674
1909
|
if (!this._active || flags & (256 | 512 | 16)) {
|
|
1675
1910
|
return;
|
|
1676
1911
|
}
|
|
1677
1912
|
this.flag = flags | 16;
|
|
1678
|
-
if ((
|
|
1913
|
+
if ((_a62 = this.options) == null ? void 0 : _a62.onTrigger) {
|
|
1679
1914
|
this.options.onTrigger({
|
|
1680
1915
|
effect: this,
|
|
1681
1916
|
target: {},
|
|
@@ -1708,7 +1943,7 @@ var EffectImpl = class {
|
|
|
1708
1943
|
* @returns {void}
|
|
1709
1944
|
*/
|
|
1710
1945
|
stop() {
|
|
1711
|
-
var
|
|
1946
|
+
var _a62;
|
|
1712
1947
|
if (!this._active) {
|
|
1713
1948
|
return;
|
|
1714
1949
|
}
|
|
@@ -1738,7 +1973,7 @@ var EffectImpl = class {
|
|
|
1738
1973
|
);
|
|
1739
1974
|
}
|
|
1740
1975
|
}
|
|
1741
|
-
if ((
|
|
1976
|
+
if ((_a62 = this.options) == null ? void 0 : _a62.onStop) {
|
|
1742
1977
|
this.options.onStop();
|
|
1743
1978
|
}
|
|
1744
1979
|
}
|
|
@@ -1885,7 +2120,7 @@ var ComputedImpl = class {
|
|
|
1885
2120
|
const hadValue = oldValue !== NO_VALUE;
|
|
1886
2121
|
const prevSub = startTracking(this);
|
|
1887
2122
|
try {
|
|
1888
|
-
const newValue = this.getter();
|
|
2123
|
+
const newValue = this.getter(hadValue ? oldValue : void 0);
|
|
1889
2124
|
const flags = this.flag;
|
|
1890
2125
|
const subs = this.subLink;
|
|
1891
2126
|
const clearMask = ~(16 | 32);
|
|
@@ -2008,13 +2243,13 @@ function cloneInitialState(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
2008
2243
|
if (seen.has(value)) {
|
|
2009
2244
|
return seen.get(value);
|
|
2010
2245
|
}
|
|
2011
|
-
if (value
|
|
2246
|
+
if (isDate(value)) {
|
|
2012
2247
|
return new Date(value.getTime());
|
|
2013
2248
|
}
|
|
2014
|
-
if (value
|
|
2249
|
+
if (isRegExp(value)) {
|
|
2015
2250
|
return new RegExp(value.source, value.flags);
|
|
2016
2251
|
}
|
|
2017
|
-
if (value
|
|
2252
|
+
if (isMap(value)) {
|
|
2018
2253
|
const clone2 = /* @__PURE__ */ new Map();
|
|
2019
2254
|
seen.set(value, clone2);
|
|
2020
2255
|
value.forEach((mapValue, mapKey) => {
|
|
@@ -2022,7 +2257,7 @@ function cloneInitialState(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
2022
2257
|
});
|
|
2023
2258
|
return clone2;
|
|
2024
2259
|
}
|
|
2025
|
-
if (value
|
|
2260
|
+
if (isSet(value)) {
|
|
2026
2261
|
const clone2 = /* @__PURE__ */ new Set();
|
|
2027
2262
|
seen.set(value, clone2);
|
|
2028
2263
|
value.forEach((setValue) => {
|
|
@@ -2030,7 +2265,7 @@ function cloneInitialState(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
2030
2265
|
});
|
|
2031
2266
|
return clone2;
|
|
2032
2267
|
}
|
|
2033
|
-
if (
|
|
2268
|
+
if (isArray(value)) {
|
|
2034
2269
|
const clone2 = [];
|
|
2035
2270
|
seen.set(value, clone2);
|
|
2036
2271
|
value.forEach((item, index) => {
|
|
@@ -2039,7 +2274,7 @@ function cloneInitialState(value, seen = /* @__PURE__ */ new WeakMap()) {
|
|
|
2039
2274
|
return clone2;
|
|
2040
2275
|
}
|
|
2041
2276
|
const prototype = Object.getPrototypeOf(value);
|
|
2042
|
-
if (prototype !== Object.prototype && prototype
|
|
2277
|
+
if (prototype !== Object.prototype && !isNull(prototype)) {
|
|
2043
2278
|
return value;
|
|
2044
2279
|
}
|
|
2045
2280
|
const clone = Object.create(prototype);
|
|
@@ -2070,11 +2305,58 @@ function createOptionsStore(options) {
|
|
|
2070
2305
|
};
|
|
2071
2306
|
}
|
|
2072
2307
|
set.add(callback);
|
|
2073
|
-
|
|
2308
|
+
const unsubscribe = () => set.delete(callback);
|
|
2309
|
+
onScopeDispose(
|
|
2310
|
+
unsubscribe,
|
|
2311
|
+
/* failSilently */
|
|
2312
|
+
true
|
|
2313
|
+
);
|
|
2314
|
+
return unsubscribe;
|
|
2315
|
+
};
|
|
2316
|
+
let activeTransaction = null;
|
|
2317
|
+
const flushTransaction = (transaction) => {
|
|
2318
|
+
if (transaction.depth === 0 && transaction.pending === 0 && !transaction.notified) {
|
|
2319
|
+
transaction.notified = true;
|
|
2320
|
+
notify(reactiveState);
|
|
2321
|
+
}
|
|
2074
2322
|
};
|
|
2075
2323
|
const commit = (mutate) => {
|
|
2076
|
-
|
|
2077
|
-
|
|
2324
|
+
const transaction = activeTransaction != null ? activeTransaction : {
|
|
2325
|
+
depth: 0,
|
|
2326
|
+
pending: 0,
|
|
2327
|
+
notified: false
|
|
2328
|
+
};
|
|
2329
|
+
const previousTransaction = activeTransaction;
|
|
2330
|
+
transaction.depth++;
|
|
2331
|
+
let result;
|
|
2332
|
+
try {
|
|
2333
|
+
activeTransaction = transaction;
|
|
2334
|
+
result = batch(mutate);
|
|
2335
|
+
} catch (error6) {
|
|
2336
|
+
transaction.depth--;
|
|
2337
|
+
activeTransaction = previousTransaction;
|
|
2338
|
+
throw error6;
|
|
2339
|
+
}
|
|
2340
|
+
activeTransaction = previousTransaction;
|
|
2341
|
+
if (isPromise(result)) {
|
|
2342
|
+
transaction.pending++;
|
|
2343
|
+
transaction.depth--;
|
|
2344
|
+
return result.then(
|
|
2345
|
+
(value) => {
|
|
2346
|
+
transaction.pending--;
|
|
2347
|
+
flushTransaction(transaction);
|
|
2348
|
+
return value;
|
|
2349
|
+
},
|
|
2350
|
+
(error6) => {
|
|
2351
|
+
transaction.pending--;
|
|
2352
|
+
flushTransaction(transaction);
|
|
2353
|
+
throw error6;
|
|
2354
|
+
}
|
|
2355
|
+
);
|
|
2356
|
+
}
|
|
2357
|
+
transaction.depth--;
|
|
2358
|
+
flushTransaction(transaction);
|
|
2359
|
+
return result;
|
|
2078
2360
|
};
|
|
2079
2361
|
const defaultActions = {
|
|
2080
2362
|
$patch(payload) {
|
|
@@ -2097,7 +2379,15 @@ function createOptionsStore(options) {
|
|
|
2097
2379
|
actionCallbacks.delete(callback);
|
|
2098
2380
|
},
|
|
2099
2381
|
$reset() {
|
|
2100
|
-
commit(() =>
|
|
2382
|
+
commit(() => {
|
|
2383
|
+
const fresh = cloneInitialState(initState);
|
|
2384
|
+
for (const key of Object.keys(reactiveState)) {
|
|
2385
|
+
if (!Object.prototype.hasOwnProperty.call(fresh, key)) {
|
|
2386
|
+
delete reactiveState[key];
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
Object.assign(reactiveState, fresh);
|
|
2390
|
+
});
|
|
2101
2391
|
}
|
|
2102
2392
|
};
|
|
2103
2393
|
const store = {};
|
|
@@ -2115,7 +2405,7 @@ function createOptionsStore(options) {
|
|
|
2115
2405
|
value: reactiveState,
|
|
2116
2406
|
enumerable: true,
|
|
2117
2407
|
configurable: true,
|
|
2118
|
-
writable:
|
|
2408
|
+
writable: false
|
|
2119
2409
|
});
|
|
2120
2410
|
Object.assign(store, defaultActions);
|
|
2121
2411
|
if (getters) {
|
|
@@ -2135,9 +2425,7 @@ function createOptionsStore(options) {
|
|
|
2135
2425
|
const action = actions[key];
|
|
2136
2426
|
if (action) {
|
|
2137
2427
|
store[key] = (...args) => {
|
|
2138
|
-
|
|
2139
|
-
actionCallbacks.forEach((callback) => callback(reactiveState));
|
|
2140
|
-
return result;
|
|
2428
|
+
return commit(() => action.apply(store, args));
|
|
2141
2429
|
};
|
|
2142
2430
|
}
|
|
2143
2431
|
}
|
|
@@ -2209,6 +2497,12 @@ var RefImpl = class extends (_b = SignalImpl, _a4 = "_IS_REF", _b) {
|
|
|
2209
2497
|
if (sub) {
|
|
2210
2498
|
linkReactiveNode(this, sub);
|
|
2211
2499
|
}
|
|
2500
|
+
if (this.flag & 16 && this.shouldUpdate()) {
|
|
2501
|
+
const subs = this.subLink;
|
|
2502
|
+
if (subs) {
|
|
2503
|
+
shallowPropagate(subs);
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2212
2506
|
return this._value;
|
|
2213
2507
|
}
|
|
2214
2508
|
/**
|
|
@@ -2224,6 +2518,7 @@ var RefImpl = class extends (_b = SignalImpl, _a4 = "_IS_REF", _b) {
|
|
|
2224
2518
|
newValue = newValue.value;
|
|
2225
2519
|
}
|
|
2226
2520
|
if (hasChanged(this._value, newValue)) {
|
|
2521
|
+
this._oldValue = this._rawValue;
|
|
2227
2522
|
this._rawValue = newValue;
|
|
2228
2523
|
this._value = newValue;
|
|
2229
2524
|
this.flag |= 16;
|
|
@@ -2248,6 +2543,45 @@ function isRef(value) {
|
|
|
2248
2543
|
/* IS_REF */
|
|
2249
2544
|
];
|
|
2250
2545
|
}
|
|
2546
|
+
var _a5;
|
|
2547
|
+
_a5 = "_IS_COMPUTED";
|
|
2548
|
+
var ObjectPropertyRef = class {
|
|
2549
|
+
constructor(obj, key, defaultValue) {
|
|
2550
|
+
this.obj = obj;
|
|
2551
|
+
this.key = key;
|
|
2552
|
+
this.defaultValue = defaultValue;
|
|
2553
|
+
this[_a5] = true;
|
|
2554
|
+
}
|
|
2555
|
+
get value() {
|
|
2556
|
+
const value = this.obj[this.key];
|
|
2557
|
+
return value !== void 0 ? value : this.defaultValue;
|
|
2558
|
+
}
|
|
2559
|
+
set value(value) {
|
|
2560
|
+
this.obj[this.key] = value;
|
|
2561
|
+
}
|
|
2562
|
+
peek() {
|
|
2563
|
+
return untrack(() => this.value);
|
|
2564
|
+
}
|
|
2565
|
+
};
|
|
2566
|
+
function unref(value) {
|
|
2567
|
+
if (isSignal(value) || isRef(value) || isComputed(value)) {
|
|
2568
|
+
return value.value;
|
|
2569
|
+
}
|
|
2570
|
+
if (isFunction(value)) {
|
|
2571
|
+
return value();
|
|
2572
|
+
}
|
|
2573
|
+
return value;
|
|
2574
|
+
}
|
|
2575
|
+
function toRef(obj, key, defaultValue) {
|
|
2576
|
+
return new ObjectPropertyRef(obj, key, defaultValue);
|
|
2577
|
+
}
|
|
2578
|
+
function toRefs(obj) {
|
|
2579
|
+
const result = {};
|
|
2580
|
+
for (const key of Object.keys(obj)) {
|
|
2581
|
+
result[key] = toRef(obj, key);
|
|
2582
|
+
}
|
|
2583
|
+
return result;
|
|
2584
|
+
}
|
|
2251
2585
|
var INITIAL_WATCHER_VALUE = {};
|
|
2252
2586
|
var _traverseSeen = /* @__PURE__ */ new Set();
|
|
2253
2587
|
var _traverseBusy = false;
|
|
@@ -2258,7 +2592,7 @@ function traverseValue(value, seen) {
|
|
|
2258
2592
|
seen.add(value);
|
|
2259
2593
|
if (isSignal(value) || isComputed(value)) {
|
|
2260
2594
|
traverseValue(value.value, seen);
|
|
2261
|
-
} else if (
|
|
2595
|
+
} else if (isArray(value)) {
|
|
2262
2596
|
for (const element of value) {
|
|
2263
2597
|
traverseValue(element, seen);
|
|
2264
2598
|
}
|
|
@@ -2308,7 +2642,7 @@ function resolveSingleSource(source) {
|
|
|
2308
2642
|
return () => source;
|
|
2309
2643
|
}
|
|
2310
2644
|
function resolveSource(source) {
|
|
2311
|
-
if (
|
|
2645
|
+
if (isArray(source)) {
|
|
2312
2646
|
const getters = source.map((s) => resolveSingleSource(s));
|
|
2313
2647
|
return () => getters.map((g) => g());
|
|
2314
2648
|
}
|
|
@@ -2319,7 +2653,7 @@ function watch(source, callback, options = {}) {
|
|
|
2319
2653
|
let oldValue = INITIAL_WATCHER_VALUE;
|
|
2320
2654
|
let lastValue;
|
|
2321
2655
|
let active = true;
|
|
2322
|
-
const isSingleReactive = !
|
|
2656
|
+
const isSingleReactive = !isArray(source) && isReactive(source);
|
|
2323
2657
|
const needTraverse = deep && !isSingleReactive;
|
|
2324
2658
|
const getter = resolveSource(source);
|
|
2325
2659
|
let cleanup;
|
|
@@ -2328,8 +2662,8 @@ function watch(source, callback, options = {}) {
|
|
|
2328
2662
|
cleanup = void 0;
|
|
2329
2663
|
try {
|
|
2330
2664
|
fn();
|
|
2331
|
-
} catch (
|
|
2332
|
-
warn("[watch] cleanup handler threw:",
|
|
2665
|
+
} catch (error6) {
|
|
2666
|
+
warn("[watch] cleanup handler threw:", error6);
|
|
2333
2667
|
}
|
|
2334
2668
|
};
|
|
2335
2669
|
};
|
|
@@ -2462,12 +2796,12 @@ function runWithScope(scope, fn) {
|
|
|
2462
2796
|
}
|
|
2463
2797
|
}
|
|
2464
2798
|
function disposeScope(scope) {
|
|
2465
|
-
var
|
|
2799
|
+
var _a7;
|
|
2466
2800
|
if (!scope || scope.isDestroyed) {
|
|
2467
2801
|
return;
|
|
2468
2802
|
}
|
|
2469
2803
|
scope.isDestroyed = true;
|
|
2470
|
-
if ((
|
|
2804
|
+
if ((_a7 = scope.parent) == null ? void 0 : _a7.children) {
|
|
2471
2805
|
scope.parent.children.delete(scope);
|
|
2472
2806
|
}
|
|
2473
2807
|
scope.parent = null;
|
|
@@ -2539,6 +2873,24 @@ var FOR_COMPONENT = /* @__PURE__ */ Symbol("For Component");
|
|
|
2539
2873
|
var TRANSITION_COMPONENT = /* @__PURE__ */ Symbol("Transition Component");
|
|
2540
2874
|
var TRANSITION_GROUP_COMPONENT = /* @__PURE__ */ Symbol("TransitionGroup Component");
|
|
2541
2875
|
var DANGEROUS_DATA_MIME_RE = /^data:\s*(?:text\/html|text\/xml|application\/xhtml\+xml|image\/svg\+xml|application\/xml)/;
|
|
2876
|
+
var BOOLEAN_PROPERTY_ALIASES = {
|
|
2877
|
+
allowfullscreen: "allowFullscreen",
|
|
2878
|
+
formnovalidate: "formNoValidate",
|
|
2879
|
+
ismap: "isMap",
|
|
2880
|
+
nomodule: "noModule",
|
|
2881
|
+
novalidate: "noValidate",
|
|
2882
|
+
readonly: "readOnly"
|
|
2883
|
+
};
|
|
2884
|
+
function syncBooleanProperty(el, key, value) {
|
|
2885
|
+
var _a22;
|
|
2886
|
+
if (el.namespaceURI === SVG_NAMESPACE) return;
|
|
2887
|
+
const prop = (_a22 = BOOLEAN_PROPERTY_ALIASES[key.toLowerCase()]) != null ? _a22 : key;
|
|
2888
|
+
if (!(prop in el) || typeof el[prop] !== "boolean") return;
|
|
2889
|
+
try {
|
|
2890
|
+
el[prop] = value;
|
|
2891
|
+
} catch (e) {
|
|
2892
|
+
}
|
|
2893
|
+
}
|
|
2542
2894
|
function isUnsafeUrl(value) {
|
|
2543
2895
|
const v = value.replaceAll(/[\u0000-\u0020]+/g, "").toLowerCase();
|
|
2544
2896
|
if (startsWith(v, "javascript:") || startsWith(v, "vbscript:")) {
|
|
@@ -2615,14 +2967,19 @@ function patchAttr(el, key, prev, next2) {
|
|
|
2615
2967
|
} else {
|
|
2616
2968
|
el.removeAttribute(key);
|
|
2617
2969
|
}
|
|
2970
|
+
if (isBoolean || lowerKey === "indeterminate") {
|
|
2971
|
+
syncBooleanProperty(el, key, false);
|
|
2972
|
+
}
|
|
2618
2973
|
return;
|
|
2619
2974
|
}
|
|
2620
2975
|
if (isBoolean) {
|
|
2621
|
-
|
|
2976
|
+
const included = includeBooleanAttr(next2);
|
|
2977
|
+
if (included) {
|
|
2622
2978
|
el.setAttribute(key, "");
|
|
2623
2979
|
} else {
|
|
2624
2980
|
el.removeAttribute(key);
|
|
2625
2981
|
}
|
|
2982
|
+
syncBooleanProperty(el, key, included);
|
|
2626
2983
|
return;
|
|
2627
2984
|
}
|
|
2628
2985
|
const attrValue = isSymbol(next2) ? String(next2) : next2;
|
|
@@ -2849,19 +3206,31 @@ function endHydration() {
|
|
|
2849
3206
|
_teleportTargetStarts.clear();
|
|
2850
3207
|
}
|
|
2851
3208
|
function claimHydratedNodes(parent, expected, before) {
|
|
2852
|
-
var _a22, _b2;
|
|
3209
|
+
var _a22, _b2, _c;
|
|
2853
3210
|
if (!_isHydrating || before && before.parentNode !== parent) return null;
|
|
2854
3211
|
if (expected.length === 0) return [];
|
|
2855
3212
|
const claimed = new Array(expected.length);
|
|
2856
3213
|
let cursor = before ? before.previousSibling : parent.lastChild;
|
|
2857
3214
|
for (let i = expected.length - 1; i >= 0; i--) {
|
|
2858
|
-
if (!cursor) return null;
|
|
2859
3215
|
const expectedNode = expected[i];
|
|
2860
3216
|
const expectedType = expectedNode.nodeType;
|
|
2861
3217
|
if (expectedType === Node.TEXT_NODE) {
|
|
2862
3218
|
const expectedText = (_a22 = expectedNode.textContent) != null ? _a22 : "";
|
|
2863
|
-
if (
|
|
2864
|
-
|
|
3219
|
+
if (expectedText === "") {
|
|
3220
|
+
if ((cursor == null ? void 0 : cursor.nodeType) === Node.TEXT_NODE && ((_b2 = cursor.textContent) != null ? _b2 : "") === "") {
|
|
3221
|
+
claimed[i] = cursor;
|
|
3222
|
+
cursor = cursor.previousSibling;
|
|
3223
|
+
} else {
|
|
3224
|
+
const emptyNode = document.createTextNode("");
|
|
3225
|
+
const anchor = i + 1 < expected.length ? claimed[i + 1] : before != null ? before : null;
|
|
3226
|
+
parent.insertBefore(emptyNode, anchor);
|
|
3227
|
+
claimed[i] = emptyNode;
|
|
3228
|
+
}
|
|
3229
|
+
continue;
|
|
3230
|
+
}
|
|
3231
|
+
if (!cursor) return null;
|
|
3232
|
+
if (cursor.nodeType !== Node.TEXT_NODE) return null;
|
|
3233
|
+
const existingText = (_c = cursor.textContent) != null ? _c : "";
|
|
2865
3234
|
if (existingText === expectedText) {
|
|
2866
3235
|
claimed[i] = cursor;
|
|
2867
3236
|
cursor = cursor.previousSibling;
|
|
@@ -2877,6 +3246,7 @@ function claimHydratedNodes(parent, expected, before) {
|
|
|
2877
3246
|
cursor = prefixNode;
|
|
2878
3247
|
continue;
|
|
2879
3248
|
}
|
|
3249
|
+
if (!cursor) return null;
|
|
2880
3250
|
if (cursor.nodeType !== expectedType) return null;
|
|
2881
3251
|
if (expectedType === Node.ELEMENT_NODE) {
|
|
2882
3252
|
if (cursor.tagName !== expectedNode.tagName) return null;
|
|
@@ -3180,6 +3550,8 @@ function insert(parent, nodeFactory, before) {
|
|
|
3180
3550
|
const effectRunner = effect(() => {
|
|
3181
3551
|
const executeUpdate = () => {
|
|
3182
3552
|
const rawNodes = isFunction(nodeFactory) ? nodeFactory() : nodeFactory;
|
|
3553
|
+
const rawType = typeof rawNodes;
|
|
3554
|
+
const canPatchText = rawNodes == null || rawType === "string" || rawType === "number" || rawType === "boolean" || rawType === "symbol";
|
|
3183
3555
|
const nodes = resolveNodes(rawNodes);
|
|
3184
3556
|
if (isFirstRun && isHydrating() && nodes.every((node) => node instanceof Node && node.parentNode === parent)) {
|
|
3185
3557
|
renderedNodes = nodes;
|
|
@@ -3194,6 +3566,13 @@ function insert(parent, nodeFactory, before) {
|
|
|
3194
3566
|
return;
|
|
3195
3567
|
}
|
|
3196
3568
|
}
|
|
3569
|
+
if (canPatchText && renderedNodes.length === 1 && nodes.length === 1 && renderedNodes[0].nodeType === Node.TEXT_NODE && nodes[0].nodeType === Node.TEXT_NODE) {
|
|
3570
|
+
const current = renderedNodes[0];
|
|
3571
|
+
const nextText = nodes[0].textContent;
|
|
3572
|
+
if (current.textContent !== nextText) current.textContent = nextText;
|
|
3573
|
+
isFirstRun = false;
|
|
3574
|
+
return;
|
|
3575
|
+
}
|
|
3197
3576
|
renderedNodes = reconcileArrays(parent, renderedNodes, nodes, before);
|
|
3198
3577
|
isFirstRun = false;
|
|
3199
3578
|
};
|
|
@@ -3238,7 +3617,7 @@ function addEvent(el, event, handler, options) {
|
|
|
3238
3617
|
const selector = options.delegate;
|
|
3239
3618
|
const wrappedHandler = (e) => {
|
|
3240
3619
|
const target = e.target;
|
|
3241
|
-
if (target.
|
|
3620
|
+
if (target.closest(selector)) {
|
|
3242
3621
|
handler.call(el, e);
|
|
3243
3622
|
}
|
|
3244
3623
|
};
|
|
@@ -3337,27 +3716,28 @@ function triggerUpdateHooks(scope) {
|
|
|
3337
3716
|
return runWithScope(scope, () => executeHooks(scope.onUpdate, scope.id, "update"));
|
|
3338
3717
|
}
|
|
3339
3718
|
function syncDescriptors(target, source, pruneMissing = false) {
|
|
3340
|
-
|
|
3719
|
+
const sourceKeys = Reflect.ownKeys(source);
|
|
3720
|
+
for (const key of sourceKeys) {
|
|
3341
3721
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
3342
3722
|
}
|
|
3343
3723
|
if (pruneMissing) {
|
|
3344
|
-
const sourceKeySet = new Set(
|
|
3345
|
-
for (const key of
|
|
3724
|
+
const sourceKeySet = new Set(sourceKeys);
|
|
3725
|
+
for (const key of Reflect.ownKeys(target)) {
|
|
3346
3726
|
if (!sourceKeySet.has(key)) delete target[key];
|
|
3347
3727
|
}
|
|
3348
3728
|
}
|
|
3349
3729
|
}
|
|
3350
|
-
function
|
|
3730
|
+
function readDescriptorValue(source, key) {
|
|
3351
3731
|
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
3352
3732
|
return descriptor.get ? descriptor.get.call(source) : descriptor.value;
|
|
3353
3733
|
}
|
|
3354
|
-
var
|
|
3355
|
-
|
|
3734
|
+
var _a6;
|
|
3735
|
+
_a6 = "normal";
|
|
3356
3736
|
var Component = class {
|
|
3357
3737
|
constructor(component, props = {}) {
|
|
3358
3738
|
this.component = component;
|
|
3359
3739
|
this.props = props;
|
|
3360
|
-
this[
|
|
3740
|
+
this[_a6] = true;
|
|
3361
3741
|
this.scope = null;
|
|
3362
3742
|
this.state = 0;
|
|
3363
3743
|
this.beforeNode = void 0;
|
|
@@ -3366,9 +3746,9 @@ var Component = class {
|
|
|
3366
3746
|
this.parentNode = void 0;
|
|
3367
3747
|
this.rootEventCleanups = [];
|
|
3368
3748
|
this.parentScope = getActiveScope();
|
|
3369
|
-
const
|
|
3370
|
-
syncDescriptors(
|
|
3371
|
-
this.reactiveProps = shallowReactive(
|
|
3749
|
+
const reactiveProps = /* @__PURE__ */ Object.create(null);
|
|
3750
|
+
syncDescriptors(reactiveProps, props);
|
|
3751
|
+
this.reactiveProps = shallowReactive(reactiveProps);
|
|
3372
3752
|
}
|
|
3373
3753
|
/**
|
|
3374
3754
|
* Mount the component into `parentNode` (optionally before `beforeNode`).
|
|
@@ -3416,14 +3796,14 @@ var Component = class {
|
|
|
3416
3796
|
*/
|
|
3417
3797
|
update(props) {
|
|
3418
3798
|
this.props = props;
|
|
3419
|
-
const scope = this.scope;
|
|
3420
|
-
if (!scope || scope.isDestroyed) return;
|
|
3421
3799
|
syncDescriptors(
|
|
3422
3800
|
this.reactiveProps,
|
|
3423
3801
|
props != null ? props : {},
|
|
3424
3802
|
/* pruneMissing */
|
|
3425
3803
|
true
|
|
3426
3804
|
);
|
|
3805
|
+
const scope = this.scope;
|
|
3806
|
+
if (!scope || scope.isDestroyed) return;
|
|
3427
3807
|
this.syncSpecialProps(props);
|
|
3428
3808
|
triggerUpdateHooks(scope);
|
|
3429
3809
|
}
|
|
@@ -3435,7 +3815,10 @@ var Component = class {
|
|
|
3435
3815
|
if (!this.parentNode) return;
|
|
3436
3816
|
const parent = this.parentNode;
|
|
3437
3817
|
const before = this.beforeNode;
|
|
3818
|
+
const savedProps = /* @__PURE__ */ Object.create(null);
|
|
3819
|
+
syncDescriptors(savedProps, this.reactiveProps);
|
|
3438
3820
|
this.destroy();
|
|
3821
|
+
syncDescriptors(this.reactiveProps, savedProps);
|
|
3439
3822
|
this.mount(parent, before);
|
|
3440
3823
|
}
|
|
3441
3824
|
/**
|
|
@@ -3452,7 +3835,7 @@ var Component = class {
|
|
|
3452
3835
|
this.renderedNodes = [];
|
|
3453
3836
|
this.firstChild = void 0;
|
|
3454
3837
|
this.parentNode = void 0;
|
|
3455
|
-
for (const key of
|
|
3838
|
+
for (const key of Reflect.ownKeys(this.reactiveProps)) {
|
|
3456
3839
|
delete this.reactiveProps[key];
|
|
3457
3840
|
}
|
|
3458
3841
|
this.state = 0;
|
|
@@ -3465,38 +3848,51 @@ var Component = class {
|
|
|
3465
3848
|
*/
|
|
3466
3849
|
syncSpecialProps(props) {
|
|
3467
3850
|
if (!props) return;
|
|
3468
|
-
const
|
|
3469
|
-
if (
|
|
3851
|
+
const roots = this.getRootElements();
|
|
3852
|
+
if (roots.length === 0) return;
|
|
3853
|
+
const refRoot = roots[0];
|
|
3470
3854
|
this.releaseSpecialProps();
|
|
3471
|
-
for (const key of
|
|
3855
|
+
for (const key of Reflect.ownKeys(props)) {
|
|
3856
|
+
if (!isString(key)) continue;
|
|
3472
3857
|
if (key === REF_KEY) {
|
|
3473
|
-
const value =
|
|
3474
|
-
this.rootRefCleanup = this.bindRootRef(value,
|
|
3858
|
+
const value = readDescriptorValue(props, key);
|
|
3859
|
+
this.rootRefCleanup = this.bindRootRef(value, refRoot);
|
|
3475
3860
|
continue;
|
|
3476
3861
|
}
|
|
3477
3862
|
if (isOn(key)) {
|
|
3478
|
-
const value =
|
|
3863
|
+
const value = readDescriptorValue(props, key);
|
|
3479
3864
|
if (!isFunction(value)) continue;
|
|
3480
3865
|
const eventName = key.slice(2).toLowerCase();
|
|
3481
|
-
const
|
|
3482
|
-
|
|
3483
|
-
const prev = target[slot];
|
|
3484
|
-
if (isFunction(prev)) {
|
|
3485
|
-
target[slot] = value;
|
|
3486
|
-
this.rootEventCleanups.push(() => {
|
|
3487
|
-
if (target[slot] === value) target[slot] = prev;
|
|
3488
|
-
});
|
|
3489
|
-
continue;
|
|
3866
|
+
for (const root of roots) {
|
|
3867
|
+
this.bindRootEvent(root, eventName, value);
|
|
3490
3868
|
}
|
|
3491
|
-
const fn = value;
|
|
3492
|
-
const handler = (event) => {
|
|
3493
|
-
if (target.disabled) return;
|
|
3494
|
-
fn.call(target, event);
|
|
3495
|
-
};
|
|
3496
|
-
this.rootEventCleanups.push(addEvent(target, eventName, handler));
|
|
3497
3869
|
}
|
|
3498
3870
|
}
|
|
3499
3871
|
}
|
|
3872
|
+
getRootElements() {
|
|
3873
|
+
const roots = [];
|
|
3874
|
+
for (const node of this.renderedNodes) {
|
|
3875
|
+
if (node instanceof Element) roots.push(node);
|
|
3876
|
+
}
|
|
3877
|
+
return roots;
|
|
3878
|
+
}
|
|
3879
|
+
bindRootEvent(target, eventName, handler) {
|
|
3880
|
+
const slot = `_$${eventName}`;
|
|
3881
|
+
const prev = target[slot];
|
|
3882
|
+
if (isFunction(prev)) {
|
|
3883
|
+
target[slot] = handler;
|
|
3884
|
+
this.rootEventCleanups.push(() => {
|
|
3885
|
+
if (target[slot] === handler) target[slot] = prev;
|
|
3886
|
+
});
|
|
3887
|
+
return;
|
|
3888
|
+
}
|
|
3889
|
+
this.rootEventCleanups.push(
|
|
3890
|
+
addEvent(target, eventName, (event) => {
|
|
3891
|
+
if (target.disabled) return;
|
|
3892
|
+
handler.call(target, event);
|
|
3893
|
+
})
|
|
3894
|
+
);
|
|
3895
|
+
}
|
|
3500
3896
|
/**
|
|
3501
3897
|
* Remove all listeners/ref bindings currently attached to the root element.
|
|
3502
3898
|
*/
|
|
@@ -3688,7 +4084,9 @@ function eventHandler(e) {
|
|
|
3688
4084
|
return true;
|
|
3689
4085
|
};
|
|
3690
4086
|
const walkUpTree = () => {
|
|
3691
|
-
while (handleNode() && (node = node._$host || node.parentNode || node.host))
|
|
4087
|
+
while (handleNode() && (node = node._$host || node.parentNode || node.host)) {
|
|
4088
|
+
if (node === oriCurrentTarget) break;
|
|
4089
|
+
}
|
|
3692
4090
|
};
|
|
3693
4091
|
Object.defineProperty(e, "currentTarget", {
|
|
3694
4092
|
configurable: true,
|
|
@@ -3699,26 +4097,30 @@ function eventHandler(e) {
|
|
|
3699
4097
|
return node || document;
|
|
3700
4098
|
}
|
|
3701
4099
|
});
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
|
|
3708
|
-
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3713
|
-
|
|
3714
|
-
|
|
4100
|
+
try {
|
|
4101
|
+
if (e.composedPath) {
|
|
4102
|
+
const path = e.composedPath();
|
|
4103
|
+
reTargetEvent(e, path[0]);
|
|
4104
|
+
for (let i = 0; i < path.length - 2; i++) {
|
|
4105
|
+
node = path[i];
|
|
4106
|
+
if (!handleNode()) break;
|
|
4107
|
+
if (node._$host) {
|
|
4108
|
+
node = node._$host;
|
|
4109
|
+
walkUpTree();
|
|
4110
|
+
break;
|
|
4111
|
+
}
|
|
4112
|
+
if (node.parentNode === oriCurrentTarget) {
|
|
4113
|
+
break;
|
|
4114
|
+
}
|
|
3715
4115
|
}
|
|
3716
|
-
}
|
|
3717
|
-
}
|
|
3718
|
-
|
|
4116
|
+
} else walkUpTree();
|
|
4117
|
+
} finally {
|
|
4118
|
+
reTargetEvent(e, oriTarget);
|
|
4119
|
+
}
|
|
3719
4120
|
}
|
|
3720
4121
|
var $EVENTS = /* @__PURE__ */ Symbol("_$EVENTS");
|
|
3721
4122
|
function delegateEvents(eventNames, document2 = globalThis.document) {
|
|
4123
|
+
if (!document2) return;
|
|
3722
4124
|
const docWithEvents = document2;
|
|
3723
4125
|
const eventSet = docWithEvents[$EVENTS] || (docWithEvents[$EVENTS] = /* @__PURE__ */ new Set());
|
|
3724
4126
|
for (const name of eventNames) {
|
|
@@ -3729,6 +4131,7 @@ function delegateEvents(eventNames, document2 = globalThis.document) {
|
|
|
3729
4131
|
}
|
|
3730
4132
|
}
|
|
3731
4133
|
function clearDelegatedEvents(document2 = globalThis.document) {
|
|
4134
|
+
if (!document2) return;
|
|
3732
4135
|
const docWithEvents = document2;
|
|
3733
4136
|
const eventSet = docWithEvents[$EVENTS];
|
|
3734
4137
|
if (eventSet) {
|
|
@@ -3749,6 +4152,7 @@ var EMPTY_FILES = (() => {
|
|
|
3749
4152
|
if (typeof DataTransfer !== "undefined") return new DataTransfer().files;
|
|
3750
4153
|
return [];
|
|
3751
4154
|
})();
|
|
4155
|
+
var checkboxArraySnapshots = /* @__PURE__ */ new WeakMap();
|
|
3752
4156
|
function writeValue(el, v) {
|
|
3753
4157
|
const target = el;
|
|
3754
4158
|
const next2 = v == null ? "" : String(v);
|
|
@@ -3865,11 +4269,16 @@ function bindElement(node, prop, getter, setter, modifiers = {}) {
|
|
|
3865
4269
|
const getModel = isFunction(getter) ? getter : () => getter;
|
|
3866
4270
|
const cast = shouldCast ? (v) => applyModifiers(v, trim, toNum) : IDENTITY;
|
|
3867
4271
|
const computeNext = checkboxArray ? (raw) => {
|
|
4272
|
+
var _a22;
|
|
3868
4273
|
const current = getModel();
|
|
3869
|
-
if (!isArray(current))
|
|
4274
|
+
if (!isArray(current)) {
|
|
4275
|
+
return cast(raw);
|
|
4276
|
+
}
|
|
3870
4277
|
const own = node.value;
|
|
3871
|
-
const
|
|
4278
|
+
const source = (_a22 = checkboxArraySnapshots.get(current)) != null ? _a22 : current;
|
|
4279
|
+
const next2 = source.filter((item) => String(item) !== own);
|
|
3872
4280
|
if (raw) next2.push(own);
|
|
4281
|
+
checkboxArraySnapshots.set(current, next2);
|
|
3873
4282
|
return next2;
|
|
3874
4283
|
} : cast;
|
|
3875
4284
|
let composing = false;
|
|
@@ -3896,6 +4305,9 @@ function bindElement(node, prop, getter, setter, modifiers = {}) {
|
|
|
3896
4305
|
}
|
|
3897
4306
|
const runner = effect(() => {
|
|
3898
4307
|
const value = getModel();
|
|
4308
|
+
if (checkboxArray) {
|
|
4309
|
+
if (isArray(value)) checkboxArraySnapshots.set(value, [...value]);
|
|
4310
|
+
}
|
|
3899
4311
|
if (ime && composing) return;
|
|
3900
4312
|
if (ime && !lazy && isFocused(node) && Object.is(cast(read(node)), value)) return;
|
|
3901
4313
|
write(node, value);
|
|
@@ -3906,7 +4318,7 @@ function bindElement(node, prop, getter, setter, modifiers = {}) {
|
|
|
3906
4318
|
}
|
|
3907
4319
|
function unwrapSlotValue(raw) {
|
|
3908
4320
|
let v = raw;
|
|
3909
|
-
if (
|
|
4321
|
+
if (isArray(v) && v.length === 1) v = v[0];
|
|
3910
4322
|
return isFunction(v) ? v() : v;
|
|
3911
4323
|
}
|
|
3912
4324
|
function useChildren(props) {
|
|
@@ -3987,7 +4399,9 @@ function Portal(props) {
|
|
|
3987
4399
|
if (children == null) return placeholder;
|
|
3988
4400
|
const parentScope = getActiveScope();
|
|
3989
4401
|
let innerScope = null;
|
|
4402
|
+
let disposed = false;
|
|
3990
4403
|
const mountAt = (parent, before) => {
|
|
4404
|
+
if (disposed || (parentScope == null ? void 0 : parentScope.isDestroyed)) return;
|
|
3991
4405
|
innerScope = createScope(parentScope);
|
|
3992
4406
|
runWithScope(innerScope, () => {
|
|
3993
4407
|
insert(parent, () => children, before);
|
|
@@ -4000,6 +4414,7 @@ function Portal(props) {
|
|
|
4000
4414
|
}
|
|
4001
4415
|
};
|
|
4002
4416
|
const apply = (disabled, target) => {
|
|
4417
|
+
if (disposed) return;
|
|
4003
4418
|
teardown();
|
|
4004
4419
|
if (disabled) {
|
|
4005
4420
|
const parent = placeholder.parentNode;
|
|
@@ -4032,11 +4447,13 @@ function Portal(props) {
|
|
|
4032
4447
|
return;
|
|
4033
4448
|
}
|
|
4034
4449
|
queueMicrotask(() => {
|
|
4450
|
+
if (disposed) return;
|
|
4035
4451
|
if (!placeholder.parentNode) return;
|
|
4036
4452
|
apply(evalDisabled(props), resolveTarget(props));
|
|
4037
4453
|
});
|
|
4038
4454
|
});
|
|
4039
4455
|
onCleanup(() => {
|
|
4456
|
+
disposed = true;
|
|
4040
4457
|
effectRunner.stop();
|
|
4041
4458
|
teardown();
|
|
4042
4459
|
});
|
|
@@ -4082,12 +4499,15 @@ function resolveNodeValue(value) {
|
|
|
4082
4499
|
if (isSignal(current) || isComputed(current)) {
|
|
4083
4500
|
return resolveNodeValue(current.value);
|
|
4084
4501
|
}
|
|
4085
|
-
if (
|
|
4502
|
+
if (isArray(current)) {
|
|
4086
4503
|
return current.map((item) => resolveNodeValue(item));
|
|
4087
4504
|
}
|
|
4088
4505
|
return current;
|
|
4089
4506
|
}
|
|
4090
4507
|
var SuspenseContext = /* @__PURE__ */ Symbol("SuspenseContext");
|
|
4508
|
+
function isAbortError(error4) {
|
|
4509
|
+
return !!error4 && typeof error4 === "object" && error4.name === "AbortError";
|
|
4510
|
+
}
|
|
4091
4511
|
function Suspense(props) {
|
|
4092
4512
|
var _a22;
|
|
4093
4513
|
if (!isBrowser()) {
|
|
@@ -4101,10 +4521,14 @@ function Suspense(props) {
|
|
|
4101
4521
|
let mounted = true;
|
|
4102
4522
|
let pending = 0;
|
|
4103
4523
|
let mounting = false;
|
|
4524
|
+
let boundaryVersion = 0;
|
|
4525
|
+
let currentChildren = null;
|
|
4104
4526
|
let contentScope = null;
|
|
4105
4527
|
let parked = null;
|
|
4106
4528
|
let fallbackScope = null;
|
|
4107
4529
|
let resolved = null;
|
|
4530
|
+
let hasResolved = false;
|
|
4531
|
+
let manualReleases = [];
|
|
4108
4532
|
const parkContent = () => {
|
|
4109
4533
|
const off = document.createDocumentFragment();
|
|
4110
4534
|
while (end.previousSibling && end.previousSibling !== start) {
|
|
@@ -4134,14 +4558,35 @@ function Suspense(props) {
|
|
|
4134
4558
|
disposeScope(fallbackScope);
|
|
4135
4559
|
fallbackScope = null;
|
|
4136
4560
|
};
|
|
4137
|
-
const
|
|
4561
|
+
const disposeContent = () => {
|
|
4562
|
+
if (contentScope) {
|
|
4563
|
+
disposeScope(contentScope);
|
|
4564
|
+
contentScope = null;
|
|
4565
|
+
}
|
|
4566
|
+
if (parked) {
|
|
4567
|
+
while (parked.firstChild) parked.firstChild.remove();
|
|
4568
|
+
parked = null;
|
|
4569
|
+
}
|
|
4570
|
+
};
|
|
4571
|
+
const mountContent = (children) => {
|
|
4572
|
+
const scope = createScope(owner);
|
|
4138
4573
|
mounting = true;
|
|
4139
|
-
contentScope =
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4574
|
+
contentScope = scope;
|
|
4575
|
+
try {
|
|
4576
|
+
runWithScope(scope, () => {
|
|
4577
|
+
var _a32;
|
|
4578
|
+
insert((_a32 = end.parentNode) != null ? _a32 : frag, () => resolveNodeValue(children), end);
|
|
4579
|
+
});
|
|
4580
|
+
} catch (error4) {
|
|
4581
|
+
if (contentScope === scope) contentScope = null;
|
|
4582
|
+
disposeScope(scope);
|
|
4583
|
+
pending = 0;
|
|
4584
|
+
manualReleases = [];
|
|
4585
|
+
boundaryVersion++;
|
|
4586
|
+
throw error4;
|
|
4587
|
+
} finally {
|
|
4588
|
+
mounting = false;
|
|
4589
|
+
}
|
|
4145
4590
|
if (pending && !parked) {
|
|
4146
4591
|
parkContent();
|
|
4147
4592
|
mountFallback();
|
|
@@ -4155,53 +4600,89 @@ function Suspense(props) {
|
|
|
4155
4600
|
};
|
|
4156
4601
|
const showContent = () => {
|
|
4157
4602
|
if (!parked) return;
|
|
4158
|
-
const hasSyncChildren =
|
|
4159
|
-
if (contentScope == null &&
|
|
4603
|
+
const hasSyncChildren = currentChildren != null && !isPromise(currentChildren);
|
|
4604
|
+
if (contentScope == null && !hasResolved && !hasSyncChildren) return;
|
|
4160
4605
|
disposeFallback();
|
|
4161
4606
|
restoreContent();
|
|
4162
4607
|
if (!contentScope) {
|
|
4163
|
-
if (
|
|
4608
|
+
if (hasResolved) {
|
|
4164
4609
|
mountContent(resolved);
|
|
4165
4610
|
} else if (hasSyncChildren) {
|
|
4166
|
-
mountContent(
|
|
4611
|
+
mountContent(currentChildren);
|
|
4167
4612
|
}
|
|
4168
4613
|
}
|
|
4169
4614
|
};
|
|
4170
|
-
const
|
|
4615
|
+
const addPending = (version = boundaryVersion) => {
|
|
4616
|
+
pending++;
|
|
4617
|
+
showFallback();
|
|
4618
|
+
const release = (() => {
|
|
4619
|
+
if (!release.active) return;
|
|
4620
|
+
release.active = false;
|
|
4621
|
+
if (!mounted || version !== boundaryVersion) return;
|
|
4622
|
+
if (--pending === 0) showContent();
|
|
4623
|
+
});
|
|
4624
|
+
release.active = true;
|
|
4625
|
+
return release;
|
|
4626
|
+
};
|
|
4627
|
+
const settle = (release) => {
|
|
4171
4628
|
if (!mounted) return;
|
|
4172
|
-
|
|
4629
|
+
release();
|
|
4630
|
+
};
|
|
4631
|
+
const dequeueManualRelease = () => {
|
|
4632
|
+
while (manualReleases.length > 0) {
|
|
4633
|
+
const release = manualReleases.shift();
|
|
4634
|
+
if (release.active) return release;
|
|
4635
|
+
}
|
|
4636
|
+
return void 0;
|
|
4173
4637
|
};
|
|
4174
4638
|
const ctx = {
|
|
4175
4639
|
register: (promise) => {
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4640
|
+
const release = addPending();
|
|
4641
|
+
promise.then(
|
|
4642
|
+
() => settle(release),
|
|
4643
|
+
(error4) => {
|
|
4644
|
+
if (!isAbortError(error4)) warn("[Suspense] Resource failed:", error4);
|
|
4645
|
+
settle(release);
|
|
4646
|
+
}
|
|
4647
|
+
);
|
|
4648
|
+
return release;
|
|
4182
4649
|
},
|
|
4183
4650
|
increment: () => {
|
|
4184
|
-
|
|
4185
|
-
|
|
4651
|
+
const release = addPending();
|
|
4652
|
+
manualReleases.push(release);
|
|
4653
|
+
return release;
|
|
4186
4654
|
},
|
|
4187
4655
|
decrement: () => {
|
|
4188
|
-
|
|
4189
|
-
if (
|
|
4656
|
+
const release = dequeueManualRelease();
|
|
4657
|
+
if (release) settle(release);
|
|
4190
4658
|
}
|
|
4191
4659
|
};
|
|
4192
4660
|
provide(SuspenseContext, ctx);
|
|
4193
|
-
const
|
|
4194
|
-
|
|
4195
|
-
children
|
|
4196
|
-
|
|
4197
|
-
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4204
|
-
|
|
4661
|
+
const renderChildren = (children) => {
|
|
4662
|
+
const version = ++boundaryVersion;
|
|
4663
|
+
currentChildren = children != null ? children : null;
|
|
4664
|
+
pending = 0;
|
|
4665
|
+
resolved = null;
|
|
4666
|
+
hasResolved = false;
|
|
4667
|
+
manualReleases = [];
|
|
4668
|
+
disposeContent();
|
|
4669
|
+
disposeFallback();
|
|
4670
|
+
if (isPromise(children)) {
|
|
4671
|
+
children.then((value) => {
|
|
4672
|
+
if (!mounted || version !== boundaryVersion) return;
|
|
4673
|
+
resolved = value;
|
|
4674
|
+
hasResolved = true;
|
|
4675
|
+
}).catch(() => {
|
|
4676
|
+
});
|
|
4677
|
+
ctx.register(children);
|
|
4678
|
+
} else if (children != null) {
|
|
4679
|
+
mountContent(children);
|
|
4680
|
+
} else if (props.fallback != null) {
|
|
4681
|
+
showFallback();
|
|
4682
|
+
}
|
|
4683
|
+
};
|
|
4684
|
+
renderChildren(props.children);
|
|
4685
|
+
onUpdate(() => renderChildren(props.children));
|
|
4205
4686
|
onCleanup(() => {
|
|
4206
4687
|
mounted = false;
|
|
4207
4688
|
pending = 0;
|
|
@@ -4219,6 +4700,9 @@ Suspense[SUSPENSE_COMPONENT] = true;
|
|
|
4219
4700
|
function isSuspense(node) {
|
|
4220
4701
|
return !!node && !!node[SUSPENSE_COMPONENT];
|
|
4221
4702
|
}
|
|
4703
|
+
function isAbortError2(error4) {
|
|
4704
|
+
return !!error4 && typeof error4 === "object" && error4.name === "AbortError";
|
|
4705
|
+
}
|
|
4222
4706
|
function createResource(fetcher, options) {
|
|
4223
4707
|
const value = signal(options == null ? void 0 : options.initialValue);
|
|
4224
4708
|
const loading = signal(true);
|
|
@@ -4253,7 +4737,7 @@ function createResource(fetcher, options) {
|
|
|
4253
4737
|
}
|
|
4254
4738
|
} catch (error_) {
|
|
4255
4739
|
if (id !== fetchId) return;
|
|
4256
|
-
if (error_
|
|
4740
|
+
if (isAbortError2(error_)) {
|
|
4257
4741
|
loading.value = false;
|
|
4258
4742
|
return;
|
|
4259
4743
|
}
|
|
@@ -4308,17 +4792,26 @@ function defineServerAsyncComponent(loader, ssr) {
|
|
|
4308
4792
|
function defineClientAsyncComponent(loader, options) {
|
|
4309
4793
|
const { loading, error: errorComp, delay = 200, timeout, onError } = options;
|
|
4310
4794
|
let component = null;
|
|
4311
|
-
let
|
|
4795
|
+
let loadError = null;
|
|
4312
4796
|
let status = "pending";
|
|
4313
4797
|
let loadPromise = null;
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4798
|
+
let loadId = 0;
|
|
4799
|
+
const currentLoad = (id) => id !== loadId ? loadPromise != null ? loadPromise : void 0 : void 0;
|
|
4800
|
+
const load = (forceId) => {
|
|
4801
|
+
if (loadPromise && forceId === void 0) return loadPromise;
|
|
4802
|
+
const id = forceId != null ? forceId : ++loadId;
|
|
4803
|
+
loadPromise = loader().then((mod) => {
|
|
4804
|
+
if (id !== loadId) return currentLoad(id);
|
|
4805
|
+
component = resolveModule(mod);
|
|
4806
|
+
status = "resolved";
|
|
4807
|
+
}).catch((error_) => {
|
|
4808
|
+
if (id !== loadId) return currentLoad(id);
|
|
4809
|
+
loadError = error_ instanceof Error ? error_ : new Error(String(error_));
|
|
4810
|
+
status = "errored";
|
|
4811
|
+
loadPromise = null;
|
|
4812
|
+
});
|
|
4813
|
+
return loadPromise;
|
|
4814
|
+
};
|
|
4322
4815
|
load();
|
|
4323
4816
|
function AsyncWrapper(props) {
|
|
4324
4817
|
var _a22;
|
|
@@ -4330,6 +4823,7 @@ function defineClientAsyncComponent(loader, options) {
|
|
|
4330
4823
|
let viewScope = null;
|
|
4331
4824
|
let delayTimer = null;
|
|
4332
4825
|
let timeoutTimer = null;
|
|
4826
|
+
let instanceRetryId = 0;
|
|
4333
4827
|
const clearTimers = () => {
|
|
4334
4828
|
if (delayTimer != null) clearTimeout(delayTimer);
|
|
4335
4829
|
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
@@ -4359,28 +4853,34 @@ function defineClientAsyncComponent(loader, options) {
|
|
|
4359
4853
|
end.remove();
|
|
4360
4854
|
});
|
|
4361
4855
|
const retryWith = (retryProps) => () => {
|
|
4856
|
+
if (!alive) return;
|
|
4857
|
+
const retryLoadId = ++loadId;
|
|
4362
4858
|
loadPromise = null;
|
|
4363
4859
|
status = "pending";
|
|
4364
|
-
|
|
4860
|
+
loadError = null;
|
|
4861
|
+
instanceRetryId++;
|
|
4862
|
+
const capturedRetry = instanceRetryId;
|
|
4365
4863
|
if (loading) render(loading);
|
|
4366
|
-
load().then(() =>
|
|
4864
|
+
load(retryLoadId).then(() => {
|
|
4865
|
+
if (alive && capturedRetry === instanceRetryId) settle(retryProps);
|
|
4866
|
+
});
|
|
4367
4867
|
};
|
|
4368
4868
|
const settle = (renderProps) => {
|
|
4369
4869
|
if (!alive) return;
|
|
4370
4870
|
clearTimers();
|
|
4371
4871
|
if (status === "resolved" && component) {
|
|
4372
4872
|
render(component, renderProps);
|
|
4373
|
-
} else if (status === "errored" &&
|
|
4374
|
-
if (errorComp) render(errorComp, { error:
|
|
4375
|
-
if (onError) onError(
|
|
4873
|
+
} else if (status === "errored" && loadError) {
|
|
4874
|
+
if (errorComp) render(errorComp, { error: loadError, retry: retryWith(renderProps) });
|
|
4875
|
+
if (onError) onError(loadError, retryWith(renderProps));
|
|
4376
4876
|
}
|
|
4377
4877
|
};
|
|
4378
4878
|
if (status === "resolved" && component) {
|
|
4379
4879
|
render(component, props);
|
|
4380
4880
|
return frag;
|
|
4381
4881
|
}
|
|
4382
|
-
if (status === "errored" &&
|
|
4383
|
-
if (errorComp) render(errorComp, { error:
|
|
4882
|
+
if (status === "errored" && loadError) {
|
|
4883
|
+
if (errorComp) render(errorComp, { error: loadError, retry: retryWith(props) });
|
|
4384
4884
|
return frag;
|
|
4385
4885
|
}
|
|
4386
4886
|
const pending = load().then(() => settle(props));
|
|
@@ -4395,10 +4895,9 @@ function defineClientAsyncComponent(loader, options) {
|
|
|
4395
4895
|
if (timeout != null) {
|
|
4396
4896
|
timeoutTimer = setTimeout(() => {
|
|
4397
4897
|
if (!alive || status !== "pending") return;
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
if (
|
|
4401
|
-
if (onError) onError(error4, retryWith(props));
|
|
4898
|
+
const err = new Error(`[defineAsyncComponent] Timeout after ${timeout}ms`);
|
|
4899
|
+
if (errorComp) render(errorComp, { error: err, retry: retryWith(props) });
|
|
4900
|
+
if (onError) onError(err, retryWith(props));
|
|
4402
4901
|
}, timeout);
|
|
4403
4902
|
}
|
|
4404
4903
|
return frag;
|
|
@@ -4417,9 +4916,11 @@ function For(props) {
|
|
|
4417
4916
|
fragment.appendChild(marker);
|
|
4418
4917
|
let entries = [];
|
|
4419
4918
|
let fallbackNodes = [];
|
|
4919
|
+
let fallbackScope = null;
|
|
4920
|
+
const ownerScope = getActiveScope();
|
|
4420
4921
|
const keyFn = props.key;
|
|
4421
4922
|
const raw = props.children;
|
|
4422
|
-
const renderFn =
|
|
4923
|
+
const renderFn = isArray(raw) && raw.length === 1 && isFunction(raw[0]) ? raw[0] : props.children;
|
|
4423
4924
|
if (!isFunction(renderFn)) {
|
|
4424
4925
|
throw new TypeError("<For> requires `children` to be a function (item, index) => Node");
|
|
4425
4926
|
}
|
|
@@ -4431,9 +4932,31 @@ function For(props) {
|
|
|
4431
4932
|
return input != null ? input : [];
|
|
4432
4933
|
};
|
|
4433
4934
|
const getKey = (item, index) => keyFn ? keyFn(item, index) : item;
|
|
4935
|
+
const formatKeyForWarning = (key) => {
|
|
4936
|
+
if (typeof key === "string") return JSON.stringify(key);
|
|
4937
|
+
return String(key);
|
|
4938
|
+
};
|
|
4939
|
+
const getKeys = (items) => {
|
|
4940
|
+
const keys = new Array(items.length);
|
|
4941
|
+
{
|
|
4942
|
+
const seen = /* @__PURE__ */ new Set();
|
|
4943
|
+
for (const [i, item] of items.entries()) {
|
|
4944
|
+
const key = getKey(item, i);
|
|
4945
|
+
keys[i] = key;
|
|
4946
|
+
if (seen.has(key)) {
|
|
4947
|
+
warn(
|
|
4948
|
+
`[For] duplicate key ${formatKeyForWarning(key)} detected. Duplicate keys may cause rows to remount or lose state.`
|
|
4949
|
+
);
|
|
4950
|
+
} else {
|
|
4951
|
+
seen.add(key);
|
|
4952
|
+
}
|
|
4953
|
+
}
|
|
4954
|
+
return keys;
|
|
4955
|
+
}
|
|
4956
|
+
};
|
|
4434
4957
|
const mountValue = (value, parent, before) => {
|
|
4435
4958
|
if (value == null || value === false) return [];
|
|
4436
|
-
if (
|
|
4959
|
+
if (isArray(value)) {
|
|
4437
4960
|
const nodes = [];
|
|
4438
4961
|
for (const child2 of value) nodes.push(...mountValue(child2, parent, before));
|
|
4439
4962
|
return nodes;
|
|
@@ -4447,17 +4970,30 @@ function For(props) {
|
|
|
4447
4970
|
return [node];
|
|
4448
4971
|
};
|
|
4449
4972
|
const mountFallback = (parent, before) => {
|
|
4973
|
+
var _a22;
|
|
4450
4974
|
if (!props.fallback) return;
|
|
4451
|
-
|
|
4452
|
-
|
|
4975
|
+
fallbackScope = createScope((_a22 = getActiveScope()) != null ? _a22 : ownerScope);
|
|
4976
|
+
try {
|
|
4977
|
+
runWithScope(fallbackScope, () => {
|
|
4978
|
+
fallbackNodes = mountValue(props.fallback(), parent, before);
|
|
4979
|
+
});
|
|
4980
|
+
} catch (error4) {
|
|
4981
|
+
disposeScope(fallbackScope);
|
|
4982
|
+
fallbackScope = null;
|
|
4983
|
+
fallbackNodes = [];
|
|
4984
|
+
throw error4;
|
|
4985
|
+
}
|
|
4453
4986
|
};
|
|
4454
4987
|
const clearFallback = () => {
|
|
4988
|
+
if (fallbackScope) {
|
|
4989
|
+
disposeScope(fallbackScope);
|
|
4990
|
+
fallbackScope = null;
|
|
4991
|
+
}
|
|
4455
4992
|
for (const node of fallbackNodes) {
|
|
4456
4993
|
removeNode(node);
|
|
4457
4994
|
}
|
|
4458
4995
|
fallbackNodes = [];
|
|
4459
4996
|
};
|
|
4460
|
-
const ownerScope = getActiveScope();
|
|
4461
4997
|
const renderItem = (item, index, parent, before, key = getKey(item, index)) => {
|
|
4462
4998
|
var _a22;
|
|
4463
4999
|
const parentScope = (_a22 = getActiveScope()) != null ? _a22 : ownerScope;
|
|
@@ -4489,10 +5025,9 @@ function For(props) {
|
|
|
4489
5025
|
mountFallback(fragment, marker);
|
|
4490
5026
|
} else {
|
|
4491
5027
|
entries = new Array(newItems.length);
|
|
4492
|
-
|
|
4493
|
-
for (const newItem of newItems) {
|
|
4494
|
-
entries[
|
|
4495
|
-
idx++;
|
|
5028
|
+
const newKeys = getKeys(newItems);
|
|
5029
|
+
for (const [i, newItem] of newItems.entries()) {
|
|
5030
|
+
entries[i] = renderItem(newItem, i, fragment, marker, newKeys[i]);
|
|
4496
5031
|
}
|
|
4497
5032
|
}
|
|
4498
5033
|
return;
|
|
@@ -4518,10 +5053,13 @@ function For(props) {
|
|
|
4518
5053
|
}
|
|
4519
5054
|
entries = new Array(newLen);
|
|
4520
5055
|
const batchFragment2 = document.createDocumentFragment();
|
|
5056
|
+
const newKeys2 = getKeys(newItems);
|
|
4521
5057
|
for (let i = 0; i < newLen; i++) {
|
|
4522
|
-
entries[i] = renderItem(newItems[i], i, batchFragment2, null);
|
|
5058
|
+
entries[i] = renderItem(newItems[i], i, batchFragment2, null, newKeys2[i]);
|
|
4523
5059
|
}
|
|
4524
|
-
|
|
5060
|
+
untrack(() => {
|
|
5061
|
+
parent.insertBefore(batchFragment2, marker);
|
|
5062
|
+
});
|
|
4525
5063
|
return;
|
|
4526
5064
|
}
|
|
4527
5065
|
const oldKeyMap = /* @__PURE__ */ new Map();
|
|
@@ -4538,10 +5076,7 @@ function For(props) {
|
|
|
4538
5076
|
const newIndexToOldIndex = new Int32Array(newLen);
|
|
4539
5077
|
let moved = false;
|
|
4540
5078
|
let maxOldSeen = 0;
|
|
4541
|
-
const newKeys =
|
|
4542
|
-
for (let i = 0; i < newLen; i++) {
|
|
4543
|
-
newKeys[i] = getKey(newItems[i], i);
|
|
4544
|
-
}
|
|
5079
|
+
const newKeys = getKeys(newItems);
|
|
4545
5080
|
for (let i = 0; i < newLen; i++) {
|
|
4546
5081
|
const item = newItems[i];
|
|
4547
5082
|
const key = newKeys[i];
|
|
@@ -4556,7 +5091,7 @@ function For(props) {
|
|
|
4556
5091
|
else maxOldSeen = oldIndex;
|
|
4557
5092
|
} else {
|
|
4558
5093
|
if (!batchFragment) batchFragment = document.createDocumentFragment();
|
|
4559
|
-
disposeItem(reused);
|
|
5094
|
+
untrack(() => disposeItem(reused));
|
|
4560
5095
|
newEntries[i] = renderItem(item, i, batchFragment, null, key);
|
|
4561
5096
|
}
|
|
4562
5097
|
} else {
|
|
@@ -4567,28 +5102,30 @@ function For(props) {
|
|
|
4567
5102
|
for (const list of oldKeyMap.values()) {
|
|
4568
5103
|
for (const [entry] of list) toRemove.push(entry);
|
|
4569
5104
|
}
|
|
4570
|
-
for (const entry of toRemove) disposeItem(entry);
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
5105
|
+
for (const entry of toRemove) untrack(() => disposeItem(entry));
|
|
5106
|
+
untrack(() => {
|
|
5107
|
+
const lis = moved ? getSequence(newIndexToOldIndex) : [];
|
|
5108
|
+
let lisCursor = lis.length - 1;
|
|
5109
|
+
let nextNode = marker;
|
|
5110
|
+
for (let i = newLen - 1; i >= 0; i--) {
|
|
5111
|
+
const entry = newEntries[i];
|
|
5112
|
+
const nodes = entry.nodes;
|
|
5113
|
+
const isFresh = newIndexToOldIndex[i] === 0;
|
|
5114
|
+
const inLis = !isFresh && moved && lisCursor >= 0 && i === lis[lisCursor];
|
|
5115
|
+
if (inLis) {
|
|
5116
|
+
lisCursor--;
|
|
5117
|
+
for (let j = nodes.length - 1; j >= 0; j--) nextNode = nodes[j];
|
|
5118
|
+
continue;
|
|
5119
|
+
}
|
|
5120
|
+
for (let j = nodes.length - 1; j >= 0; j--) {
|
|
5121
|
+
const node = nodes[j];
|
|
5122
|
+
if (node.nextSibling !== nextNode) {
|
|
5123
|
+
parent.insertBefore(node, nextNode);
|
|
5124
|
+
}
|
|
5125
|
+
nextNode = node;
|
|
4588
5126
|
}
|
|
4589
|
-
nextNode = node;
|
|
4590
5127
|
}
|
|
4591
|
-
}
|
|
5128
|
+
});
|
|
4592
5129
|
entries = newEntries;
|
|
4593
5130
|
}
|
|
4594
5131
|
onCleanup(() => {
|
|
@@ -4651,21 +5188,40 @@ function addClass(el, cls) {
|
|
|
4651
5188
|
function removeClass(el, cls) {
|
|
4652
5189
|
for (const c of cls.split(/\s+/)) if (c) el.classList.remove(c);
|
|
4653
5190
|
}
|
|
4654
|
-
function
|
|
4655
|
-
|
|
5191
|
+
function nextFrameCancellable(cb) {
|
|
5192
|
+
let cancelled = false;
|
|
5193
|
+
let innerId = null;
|
|
5194
|
+
const outerId = requestAnimationFrame(() => {
|
|
5195
|
+
if (cancelled) return;
|
|
5196
|
+
innerId = requestAnimationFrame(cb);
|
|
5197
|
+
});
|
|
5198
|
+
return () => {
|
|
5199
|
+
cancelled = true;
|
|
5200
|
+
cancelAnimationFrame(outerId);
|
|
5201
|
+
if (innerId != null) cancelAnimationFrame(innerId);
|
|
5202
|
+
};
|
|
4656
5203
|
}
|
|
4657
5204
|
function forceReflow(el) {
|
|
4658
5205
|
void el.offsetHeight;
|
|
4659
5206
|
}
|
|
4660
5207
|
function whenTransitionEnds(el, type, explicit, resolve2) {
|
|
4661
5208
|
if (explicit != null) {
|
|
4662
|
-
|
|
4663
|
-
|
|
5209
|
+
let done2 = false;
|
|
5210
|
+
const timer2 = setTimeout(() => {
|
|
5211
|
+
if (done2) return;
|
|
5212
|
+
done2 = true;
|
|
5213
|
+
resolve2();
|
|
5214
|
+
}, explicit);
|
|
5215
|
+
return () => {
|
|
5216
|
+
done2 = true;
|
|
5217
|
+
clearTimeout(timer2);
|
|
5218
|
+
};
|
|
4664
5219
|
}
|
|
4665
5220
|
const info = getTransitionInfo(el, type);
|
|
4666
5221
|
if (!info) {
|
|
4667
5222
|
resolve2();
|
|
4668
|
-
return
|
|
5223
|
+
return () => {
|
|
5224
|
+
};
|
|
4669
5225
|
}
|
|
4670
5226
|
let done = false;
|
|
4671
5227
|
const finish = () => {
|
|
@@ -4675,9 +5231,18 @@ function whenTransitionEnds(el, type, explicit, resolve2) {
|
|
|
4675
5231
|
el.removeEventListener(info.event, onEnd);
|
|
4676
5232
|
resolve2();
|
|
4677
5233
|
};
|
|
4678
|
-
const onEnd = () =>
|
|
5234
|
+
const onEnd = (event) => {
|
|
5235
|
+
if (event.target !== el) return;
|
|
5236
|
+
finish();
|
|
5237
|
+
};
|
|
4679
5238
|
el.addEventListener(info.event, onEnd);
|
|
4680
5239
|
const timer = setTimeout(finish, info.timeout + 1);
|
|
5240
|
+
return () => {
|
|
5241
|
+
if (done) return;
|
|
5242
|
+
done = true;
|
|
5243
|
+
clearTimeout(timer);
|
|
5244
|
+
el.removeEventListener(info.event, onEnd);
|
|
5245
|
+
};
|
|
4681
5246
|
}
|
|
4682
5247
|
function resolveDuration(d, dir) {
|
|
4683
5248
|
if (d == null) return null;
|
|
@@ -4686,7 +5251,7 @@ function resolveDuration(d, dir) {
|
|
|
4686
5251
|
}
|
|
4687
5252
|
function validateSlot(value) {
|
|
4688
5253
|
if (value == null || value === false) return null;
|
|
4689
|
-
if (
|
|
5254
|
+
if (isArray(value)) {
|
|
4690
5255
|
{
|
|
4691
5256
|
throw new Error(
|
|
4692
5257
|
"[essor] <Transition> expects a single root child. Use <TransitionGroup> for multiple children."
|
|
@@ -4732,8 +5297,26 @@ function Transition(props) {
|
|
|
4732
5297
|
let hasPending = false;
|
|
4733
5298
|
let scheduled = false;
|
|
4734
5299
|
let disposed = false;
|
|
5300
|
+
let cancelEnterWait = null;
|
|
5301
|
+
let cancelLeaveWait = null;
|
|
5302
|
+
const stopEnterWait = () => {
|
|
5303
|
+
cancelEnterWait == null ? void 0 : cancelEnterWait();
|
|
5304
|
+
cancelEnterWait = null;
|
|
5305
|
+
};
|
|
5306
|
+
const stopLeaveWait = () => {
|
|
5307
|
+
cancelLeaveWait == null ? void 0 : cancelLeaveWait();
|
|
5308
|
+
cancelLeaveWait = null;
|
|
5309
|
+
};
|
|
4735
5310
|
const enter = (el, phase) => {
|
|
4736
5311
|
var _a22;
|
|
5312
|
+
stopEnterWait();
|
|
5313
|
+
let cancelWait = null;
|
|
5314
|
+
const stopWait = () => {
|
|
5315
|
+
cancelWait == null ? void 0 : cancelWait();
|
|
5316
|
+
cancelWait = null;
|
|
5317
|
+
if (cancelEnterWait === stopWait) cancelEnterWait = null;
|
|
5318
|
+
};
|
|
5319
|
+
cancelEnterWait = stopWait;
|
|
4737
5320
|
const prevLeave = el[LEAVE_CB];
|
|
4738
5321
|
if (prevLeave) prevLeave(true);
|
|
4739
5322
|
state = "entering";
|
|
@@ -4750,6 +5333,7 @@ function Transition(props) {
|
|
|
4750
5333
|
var _a32, _b2;
|
|
4751
5334
|
if (called) return;
|
|
4752
5335
|
called = true;
|
|
5336
|
+
stopWait();
|
|
4753
5337
|
el[ENTER_CB] = void 0;
|
|
4754
5338
|
if (useCss) {
|
|
4755
5339
|
removeClass(el, fromCls);
|
|
@@ -4764,7 +5348,8 @@ function Transition(props) {
|
|
|
4764
5348
|
}
|
|
4765
5349
|
};
|
|
4766
5350
|
el[ENTER_CB] = done;
|
|
4767
|
-
|
|
5351
|
+
cancelWait = nextFrameCancellable(() => {
|
|
5352
|
+
cancelWait = null;
|
|
4768
5353
|
if (called) return;
|
|
4769
5354
|
if (useCss) {
|
|
4770
5355
|
removeClass(el, fromCls);
|
|
@@ -4774,7 +5359,10 @@ function Transition(props) {
|
|
|
4774
5359
|
props.onEnter(el, () => done(false));
|
|
4775
5360
|
} else if (useCss) {
|
|
4776
5361
|
const explicit = resolveDuration(props.duration, "enter");
|
|
4777
|
-
whenTransitionEnds(el, props.type, explicit, () =>
|
|
5362
|
+
cancelWait = whenTransitionEnds(el, props.type, explicit, () => {
|
|
5363
|
+
cancelWait = null;
|
|
5364
|
+
done(false);
|
|
5365
|
+
});
|
|
4778
5366
|
} else {
|
|
4779
5367
|
done(false);
|
|
4780
5368
|
}
|
|
@@ -4782,6 +5370,14 @@ function Transition(props) {
|
|
|
4782
5370
|
};
|
|
4783
5371
|
const leave = (el, after) => {
|
|
4784
5372
|
var _a22;
|
|
5373
|
+
stopLeaveWait();
|
|
5374
|
+
let cancelWait = null;
|
|
5375
|
+
const stopWait = () => {
|
|
5376
|
+
cancelWait == null ? void 0 : cancelWait();
|
|
5377
|
+
cancelWait = null;
|
|
5378
|
+
if (cancelLeaveWait === stopWait) cancelLeaveWait = null;
|
|
5379
|
+
};
|
|
5380
|
+
cancelLeaveWait = stopWait;
|
|
4785
5381
|
const prevEnter = el[ENTER_CB];
|
|
4786
5382
|
if (prevEnter) {
|
|
4787
5383
|
prevEnter(true);
|
|
@@ -4798,6 +5394,7 @@ function Transition(props) {
|
|
|
4798
5394
|
var _a32, _b2;
|
|
4799
5395
|
if (called) return;
|
|
4800
5396
|
called = true;
|
|
5397
|
+
stopWait();
|
|
4801
5398
|
el[LEAVE_CB] = void 0;
|
|
4802
5399
|
if (useCss) {
|
|
4803
5400
|
removeClass(el, classes.leaveFrom);
|
|
@@ -4819,7 +5416,8 @@ function Transition(props) {
|
|
|
4819
5416
|
done(false);
|
|
4820
5417
|
return;
|
|
4821
5418
|
}
|
|
4822
|
-
|
|
5419
|
+
cancelWait = nextFrameCancellable(() => {
|
|
5420
|
+
cancelWait = null;
|
|
4823
5421
|
if (called) return;
|
|
4824
5422
|
if (useCss) {
|
|
4825
5423
|
removeClass(el, classes.leaveFrom);
|
|
@@ -4828,7 +5426,10 @@ function Transition(props) {
|
|
|
4828
5426
|
if (props.onLeave) {
|
|
4829
5427
|
props.onLeave(el, () => done(false));
|
|
4830
5428
|
} else if (useCss) {
|
|
4831
|
-
whenTransitionEnds(el, props.type, explicit, () =>
|
|
5429
|
+
cancelWait = whenTransitionEnds(el, props.type, explicit, () => {
|
|
5430
|
+
cancelWait = null;
|
|
5431
|
+
done(false);
|
|
5432
|
+
});
|
|
4832
5433
|
} else {
|
|
4833
5434
|
done(false);
|
|
4834
5435
|
}
|
|
@@ -4903,6 +5504,8 @@ function Transition(props) {
|
|
|
4903
5504
|
});
|
|
4904
5505
|
onCleanup(() => {
|
|
4905
5506
|
disposed = true;
|
|
5507
|
+
stopEnterWait();
|
|
5508
|
+
stopLeaveWait();
|
|
4906
5509
|
effectRunner.stop();
|
|
4907
5510
|
for (const el of [currentEl, leavingEl]) {
|
|
4908
5511
|
if (!el) continue;
|
|
@@ -4924,7 +5527,7 @@ function isTransition(node) {
|
|
|
4924
5527
|
}
|
|
4925
5528
|
function resolveItemElement(raw, parent) {
|
|
4926
5529
|
if (raw == null || raw === false) return { el: null, comp: null };
|
|
4927
|
-
if (
|
|
5530
|
+
if (isArray(raw) && raw.length === 1) {
|
|
4928
5531
|
return resolveItemElement(raw[0], parent);
|
|
4929
5532
|
}
|
|
4930
5533
|
if (isFunction(raw)) {
|
|
@@ -4979,7 +5582,7 @@ function TransitionGroup(props) {
|
|
|
4979
5582
|
const moveClass = (_c = props.moveClass) != null ? _c : `${(_b2 = props.name) != null ? _b2 : "v"}-move`;
|
|
4980
5583
|
const keyFn = props.key;
|
|
4981
5584
|
const rawChildren = props.children;
|
|
4982
|
-
const childrenFn =
|
|
5585
|
+
const childrenFn = isArray(rawChildren) && rawChildren.length === 1 && isFunction(rawChildren[0]) ? rawChildren[0] : props.children;
|
|
4983
5586
|
if (!isFunction(childrenFn) || !isFunction(keyFn)) {
|
|
4984
5587
|
throw new TypeError(
|
|
4985
5588
|
"<TransitionGroup> requires `children: (item, index) => Node` and `key: (item, index) => unknown`"
|
|
@@ -5030,9 +5633,12 @@ function TransitionGroup(props) {
|
|
|
5030
5633
|
if (entry.el.parentNode === wrapper) wrapper.removeChild(entry.el);
|
|
5031
5634
|
};
|
|
5032
5635
|
const disposeEntry = (entry) => {
|
|
5033
|
-
var _a32, _b22;
|
|
5636
|
+
var _a32, _b22, _c2, _d, _e;
|
|
5034
5637
|
(_a32 = entry.cancelEnter) == null ? void 0 : _a32.call(entry, true);
|
|
5035
5638
|
(_b22 = entry.cancelLeave) == null ? void 0 : _b22.call(entry, true);
|
|
5639
|
+
(_c2 = entry.cancelEnterWait) == null ? void 0 : _c2.call(entry);
|
|
5640
|
+
(_d = entry.cancelLeaveWait) == null ? void 0 : _d.call(entry);
|
|
5641
|
+
(_e = entry.cancelMoveWait) == null ? void 0 : _e.call(entry);
|
|
5036
5642
|
if (entry.comp) entry.comp.destroy();
|
|
5037
5643
|
detachEntryDom(entry);
|
|
5038
5644
|
disposeScope(entry.scope);
|
|
@@ -5051,23 +5657,26 @@ function TransitionGroup(props) {
|
|
|
5051
5657
|
addClass(el, classes.enterActive);
|
|
5052
5658
|
let called = false;
|
|
5053
5659
|
const done = (cancelled) => {
|
|
5054
|
-
var _a42, _b3;
|
|
5660
|
+
var _a42, _b3, _c3;
|
|
5055
5661
|
if (called) return;
|
|
5056
5662
|
called = true;
|
|
5057
5663
|
entry.cancelEnter = void 0;
|
|
5664
|
+
(_a42 = entry.cancelEnterWait) == null ? void 0 : _a42.call(entry);
|
|
5665
|
+
entry.cancelEnterWait = void 0;
|
|
5058
5666
|
removeClass(el, classes.enterFrom);
|
|
5059
5667
|
removeClass(el, classes.enterActive);
|
|
5060
5668
|
removeClass(el, classes.enterTo);
|
|
5061
5669
|
if (cancelled) {
|
|
5062
|
-
(
|
|
5670
|
+
(_b3 = props.onEnterCancelled) == null ? void 0 : _b3.call(props, el);
|
|
5063
5671
|
} else {
|
|
5064
5672
|
entry.state = "present";
|
|
5065
|
-
(
|
|
5673
|
+
(_c3 = props.onAfterEnter) == null ? void 0 : _c3.call(props, el);
|
|
5066
5674
|
}
|
|
5067
5675
|
};
|
|
5068
5676
|
entry.cancelEnter = done;
|
|
5069
5677
|
entry.state = "entering";
|
|
5070
|
-
|
|
5678
|
+
entry.cancelEnterWait = nextFrameCancellable(() => {
|
|
5679
|
+
entry.cancelEnterWait = void 0;
|
|
5071
5680
|
if (called) return;
|
|
5072
5681
|
removeClass(el, classes.enterFrom);
|
|
5073
5682
|
addClass(el, classes.enterTo);
|
|
@@ -5075,7 +5684,10 @@ function TransitionGroup(props) {
|
|
|
5075
5684
|
props.onEnter(el, () => done(false));
|
|
5076
5685
|
} else {
|
|
5077
5686
|
const explicit = resolveDuration(props.duration, "enter");
|
|
5078
|
-
whenTransitionEnds(el, props.type, explicit, () =>
|
|
5687
|
+
entry.cancelEnterWait = whenTransitionEnds(el, props.type, explicit, () => {
|
|
5688
|
+
entry.cancelEnterWait = void 0;
|
|
5689
|
+
done(false);
|
|
5690
|
+
});
|
|
5079
5691
|
}
|
|
5080
5692
|
});
|
|
5081
5693
|
};
|
|
@@ -5107,17 +5719,19 @@ function TransitionGroup(props) {
|
|
|
5107
5719
|
addClass(el, classes.leaveActive);
|
|
5108
5720
|
let called = false;
|
|
5109
5721
|
const done = (cancelled) => {
|
|
5110
|
-
var _a42, _b3;
|
|
5722
|
+
var _a42, _b3, _c2;
|
|
5111
5723
|
if (called) return;
|
|
5112
5724
|
called = true;
|
|
5113
5725
|
entry.cancelLeave = void 0;
|
|
5726
|
+
(_a42 = entry.cancelLeaveWait) == null ? void 0 : _a42.call(entry);
|
|
5727
|
+
entry.cancelLeaveWait = void 0;
|
|
5114
5728
|
removeClass(el, classes.leaveFrom);
|
|
5115
5729
|
removeClass(el, classes.leaveActive);
|
|
5116
5730
|
removeClass(el, classes.leaveTo);
|
|
5117
5731
|
if (cancelled) {
|
|
5118
5732
|
if (entry.savedStyles) restoreStyles(el, entry.savedStyles);
|
|
5119
5733
|
entry.savedStyles = void 0;
|
|
5120
|
-
(
|
|
5734
|
+
(_b3 = props.onLeaveCancelled) == null ? void 0 : _b3.call(props, el);
|
|
5121
5735
|
return;
|
|
5122
5736
|
}
|
|
5123
5737
|
if (entry.savedStyles) restoreStyles(el, entry.savedStyles);
|
|
@@ -5125,10 +5739,11 @@ function TransitionGroup(props) {
|
|
|
5125
5739
|
detachEntryDom(entry);
|
|
5126
5740
|
disposeScope(entry.scope);
|
|
5127
5741
|
if (entry.comp) entry.comp.destroy();
|
|
5128
|
-
(
|
|
5742
|
+
(_c2 = props.onAfterLeave) == null ? void 0 : _c2.call(props, el);
|
|
5129
5743
|
};
|
|
5130
5744
|
entry.cancelLeave = done;
|
|
5131
|
-
|
|
5745
|
+
entry.cancelLeaveWait = nextFrameCancellable(() => {
|
|
5746
|
+
entry.cancelLeaveWait = void 0;
|
|
5132
5747
|
if (called) return;
|
|
5133
5748
|
removeClass(el, classes.leaveFrom);
|
|
5134
5749
|
addClass(el, classes.leaveTo);
|
|
@@ -5136,11 +5751,15 @@ function TransitionGroup(props) {
|
|
|
5136
5751
|
props.onLeave(el, () => done(false));
|
|
5137
5752
|
} else {
|
|
5138
5753
|
const explicit = resolveDuration(props.duration, "leave");
|
|
5139
|
-
whenTransitionEnds(el, props.type, explicit, () =>
|
|
5754
|
+
entry.cancelLeaveWait = whenTransitionEnds(el, props.type, explicit, () => {
|
|
5755
|
+
entry.cancelLeaveWait = void 0;
|
|
5756
|
+
done(false);
|
|
5757
|
+
});
|
|
5140
5758
|
}
|
|
5141
5759
|
});
|
|
5142
5760
|
};
|
|
5143
5761
|
const runMove = (entry, prevRect) => {
|
|
5762
|
+
var _a32;
|
|
5144
5763
|
if (!useCss || entry.state !== "present") return;
|
|
5145
5764
|
const el = entry.el;
|
|
5146
5765
|
const newRect = el.getBoundingClientRect();
|
|
@@ -5156,7 +5775,9 @@ function TransitionGroup(props) {
|
|
|
5156
5775
|
el.style.transform = savedTransform;
|
|
5157
5776
|
el.style.transitionDuration = savedTransition;
|
|
5158
5777
|
const explicit = resolveDuration(props.duration, "enter");
|
|
5159
|
-
|
|
5778
|
+
(_a32 = entry.cancelMoveWait) == null ? void 0 : _a32.call(entry);
|
|
5779
|
+
entry.cancelMoveWait = whenTransitionEnds(el, props.type, explicit, () => {
|
|
5780
|
+
entry.cancelMoveWait = void 0;
|
|
5160
5781
|
removeClass(el, moveClass);
|
|
5161
5782
|
});
|
|
5162
5783
|
};
|
|
@@ -5265,6 +5886,6 @@ if (globalThis) {
|
|
|
5265
5886
|
globalThis.__essor_version__ = __version;
|
|
5266
5887
|
}
|
|
5267
5888
|
|
|
5268
|
-
export { Component, EffectScope, For, Fragment, Portal, Suspense, Transition, TransitionGroup, TriggerOpTypes, __version, addEvent, addEventListener, batch, beginHydration, bindElement, child, clearDelegatedEvents, computed, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, createStore, defineAsyncComponent, delegateEvents, effect, effectScope, endBatch, endHydration, getBatchDepth, getCurrentScope, getHydrationKey, getRenderedElement, hydrate, hydrationAnchor, hydrationMarker, inject, insert, isBatching, isComponent, isComputed, isEffect, isFragment, isHydrating, isPortal, isReactive, isRef, isShallow, isSignal, isSuspense, isTransition, isTransitionGroup, memoEffect, next, nextTick, normalizeClass, nthChild, omitProps, onDestroy, onMount, onScopeDispose, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, provide, queueJob, queuePreFlushCb, reactive, ref, resetHydrationKey, setCurrentScope, setStyle, shallowReactive, shallowSignal, signal, startBatch, stop, template, toRaw, toReactive, trigger, untrack, watch };
|
|
5889
|
+
export { Component, EffectScope, For, Fragment, Portal, Suspense, Transition, TransitionGroup, TriggerOpTypes, __version, addEvent, addEventListener, batch, beginHydration, bindElement, child, clearDelegatedEvents, computed, consumeTeleportAnchor, consumeTeleportBlock, createApp, createComponent, createResource, createStore, defineAsyncComponent, delegateEvents, effect, effectScope, endBatch, endHydration, getBatchDepth, getCurrentScope, getHydrationKey, getRenderedElement, getTargetDepSize, hydrate, hydrationAnchor, hydrationMarker, inject, insert, isBatching, isComponent, isComputed, isEffect, isFragment, isHydrating, isPortal, isReactive, isRef, isShallow, isSignal, isSuspense, isTransition, isTransitionGroup, memoEffect, next, nextTick, normalizeClass, nthChild, omitProps, onDestroy, onMount, onScopeDispose, onUpdate, patchAttr, patchAttrHydrate, patchClass, patchClassHydrate, patchStyle, patchStyleHydrate, provide, queueJob, queuePostFlushJob, queuePreFlushCb, reactive, ref, resetHydrationKey, setCurrentScope, setStyle, shallowReactive, shallowSignal, signal, startBatch, stop, template, toRaw, toReactive, toRef, toRefs, trigger, unref, untrack, watch };
|
|
5269
5890
|
//# sourceMappingURL=essor.browser.dev.js.map
|
|
5270
5891
|
//# sourceMappingURL=essor.browser.dev.js.map
|