@vue/compat 3.4.26 → 3.5.0-alpha.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/vue.cjs.js +1022 -463
- package/dist/vue.cjs.prod.js +813 -449
- package/dist/vue.esm-browser.js +1020 -462
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +1032 -464
- package/dist/vue.global.js +1020 -462
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +834 -454
- package/dist/vue.runtime.esm-browser.prod.js +6 -6
- package/dist/vue.runtime.esm-bundler.js +846 -456
- package/dist/vue.runtime.global.js +834 -454
- package/dist/vue.runtime.global.prod.js +6 -6
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compat v3.
|
|
2
|
+
* @vue/compat v3.5.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -81,11 +81,10 @@ const invokeArrayFns = (fns, arg) => {
|
|
|
81
81
|
fns[i](arg);
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
const def = (obj, key, value
|
|
84
|
+
const def = (obj, key, value) => {
|
|
85
85
|
Object.defineProperty(obj, key, {
|
|
86
86
|
configurable: true,
|
|
87
87
|
enumerable: false,
|
|
88
|
-
writable,
|
|
89
88
|
value
|
|
90
89
|
});
|
|
91
90
|
};
|
|
@@ -385,156 +384,280 @@ class EffectScope {
|
|
|
385
384
|
function effectScope(detached) {
|
|
386
385
|
return new EffectScope(detached);
|
|
387
386
|
}
|
|
388
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
389
|
-
if (scope && scope.active) {
|
|
390
|
-
scope.effects.push(effect);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
387
|
function getCurrentScope() {
|
|
394
388
|
return activeEffectScope;
|
|
395
389
|
}
|
|
396
|
-
function onScopeDispose(fn) {
|
|
390
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
397
391
|
if (activeEffectScope) {
|
|
398
392
|
activeEffectScope.cleanups.push(fn);
|
|
399
|
-
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
393
|
+
} else if (!!(process.env.NODE_ENV !== "production") && !failSilently) {
|
|
400
394
|
warn$2(
|
|
401
395
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
402
396
|
);
|
|
403
397
|
}
|
|
404
398
|
}
|
|
405
399
|
|
|
406
|
-
let
|
|
400
|
+
let activeSub;
|
|
407
401
|
class ReactiveEffect {
|
|
408
|
-
constructor(fn
|
|
402
|
+
constructor(fn) {
|
|
409
403
|
this.fn = fn;
|
|
410
|
-
this.trigger = trigger;
|
|
411
|
-
this.scheduler = scheduler;
|
|
412
|
-
this.active = true;
|
|
413
|
-
this.deps = [];
|
|
414
404
|
/**
|
|
415
405
|
* @internal
|
|
416
406
|
*/
|
|
417
|
-
this.
|
|
407
|
+
this.deps = void 0;
|
|
418
408
|
/**
|
|
419
409
|
* @internal
|
|
420
410
|
*/
|
|
421
|
-
this.
|
|
411
|
+
this.depsTail = void 0;
|
|
422
412
|
/**
|
|
423
413
|
* @internal
|
|
424
414
|
*/
|
|
425
|
-
this.
|
|
415
|
+
this.flags = 1 | 4;
|
|
426
416
|
/**
|
|
427
417
|
* @internal
|
|
428
418
|
*/
|
|
429
|
-
this.
|
|
419
|
+
this.nextEffect = void 0;
|
|
430
420
|
/**
|
|
431
421
|
* @internal
|
|
432
422
|
*/
|
|
433
|
-
this.
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
438
|
-
this._dirtyLevel = 1;
|
|
439
|
-
pauseTracking();
|
|
440
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
441
|
-
const dep = this.deps[i];
|
|
442
|
-
if (dep.computed) {
|
|
443
|
-
triggerComputed(dep.computed);
|
|
444
|
-
if (this._dirtyLevel >= 4) {
|
|
445
|
-
break;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
if (this._dirtyLevel === 1) {
|
|
450
|
-
this._dirtyLevel = 0;
|
|
451
|
-
}
|
|
452
|
-
resetTracking();
|
|
423
|
+
this.cleanup = void 0;
|
|
424
|
+
this.scheduler = void 0;
|
|
425
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
426
|
+
activeEffectScope.effects.push(this);
|
|
453
427
|
}
|
|
454
|
-
return this._dirtyLevel >= 4;
|
|
455
428
|
}
|
|
456
|
-
|
|
457
|
-
|
|
429
|
+
/**
|
|
430
|
+
* @internal
|
|
431
|
+
*/
|
|
432
|
+
notify() {
|
|
433
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (this.flags & 64) {
|
|
437
|
+
return this.trigger();
|
|
438
|
+
}
|
|
439
|
+
if (!(this.flags & 8)) {
|
|
440
|
+
this.flags |= 8;
|
|
441
|
+
this.nextEffect = batchedEffect;
|
|
442
|
+
batchedEffect = this;
|
|
443
|
+
}
|
|
458
444
|
}
|
|
459
445
|
run() {
|
|
460
|
-
this.
|
|
461
|
-
if (!this.active) {
|
|
446
|
+
if (!(this.flags & 1)) {
|
|
462
447
|
return this.fn();
|
|
463
448
|
}
|
|
464
|
-
|
|
465
|
-
|
|
449
|
+
this.flags |= 2;
|
|
450
|
+
cleanupEffect(this);
|
|
451
|
+
prepareDeps(this);
|
|
452
|
+
const prevEffect = activeSub;
|
|
453
|
+
const prevShouldTrack = shouldTrack;
|
|
454
|
+
activeSub = this;
|
|
455
|
+
shouldTrack = true;
|
|
466
456
|
try {
|
|
467
|
-
shouldTrack = true;
|
|
468
|
-
activeEffect = this;
|
|
469
|
-
this._runnings++;
|
|
470
|
-
preCleanupEffect(this);
|
|
471
457
|
return this.fn();
|
|
472
458
|
} finally {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
459
|
+
if (!!(process.env.NODE_ENV !== "production") && activeSub !== this) {
|
|
460
|
+
warn$2(
|
|
461
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
cleanupDeps(this);
|
|
465
|
+
activeSub = prevEffect;
|
|
466
|
+
shouldTrack = prevShouldTrack;
|
|
467
|
+
this.flags &= ~2;
|
|
477
468
|
}
|
|
478
469
|
}
|
|
479
470
|
stop() {
|
|
480
|
-
if (this.
|
|
481
|
-
|
|
482
|
-
|
|
471
|
+
if (this.flags & 1) {
|
|
472
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
473
|
+
removeSub(link);
|
|
474
|
+
}
|
|
475
|
+
this.deps = this.depsTail = void 0;
|
|
476
|
+
cleanupEffect(this);
|
|
483
477
|
this.onStop && this.onStop();
|
|
484
|
-
this.
|
|
478
|
+
this.flags &= ~1;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
trigger() {
|
|
482
|
+
if (this.scheduler) {
|
|
483
|
+
this.scheduler();
|
|
484
|
+
} else {
|
|
485
|
+
this.runIfDirty();
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* @internal
|
|
490
|
+
*/
|
|
491
|
+
runIfDirty() {
|
|
492
|
+
if (isDirty(this)) {
|
|
493
|
+
this.run();
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
get dirty() {
|
|
497
|
+
return isDirty(this);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
let batchDepth = 0;
|
|
501
|
+
let batchedEffect;
|
|
502
|
+
function startBatch() {
|
|
503
|
+
batchDepth++;
|
|
504
|
+
}
|
|
505
|
+
function endBatch() {
|
|
506
|
+
if (batchDepth > 1) {
|
|
507
|
+
batchDepth--;
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
let error;
|
|
511
|
+
while (batchedEffect) {
|
|
512
|
+
let e = batchedEffect;
|
|
513
|
+
batchedEffect = void 0;
|
|
514
|
+
while (e) {
|
|
515
|
+
const next = e.nextEffect;
|
|
516
|
+
e.nextEffect = void 0;
|
|
517
|
+
e.flags &= ~8;
|
|
518
|
+
if (e.flags & 1) {
|
|
519
|
+
try {
|
|
520
|
+
e.trigger();
|
|
521
|
+
} catch (err) {
|
|
522
|
+
if (!error)
|
|
523
|
+
error = err;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
e = next;
|
|
485
527
|
}
|
|
486
528
|
}
|
|
529
|
+
batchDepth--;
|
|
530
|
+
if (error)
|
|
531
|
+
throw error;
|
|
532
|
+
}
|
|
533
|
+
function prepareDeps(sub) {
|
|
534
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
535
|
+
link.version = -1;
|
|
536
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
537
|
+
link.dep.activeLink = link;
|
|
538
|
+
}
|
|
487
539
|
}
|
|
488
|
-
function
|
|
489
|
-
|
|
540
|
+
function cleanupDeps(sub) {
|
|
541
|
+
let head;
|
|
542
|
+
let tail = sub.depsTail;
|
|
543
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
544
|
+
if (link.version === -1) {
|
|
545
|
+
if (link === tail)
|
|
546
|
+
tail = link.prevDep;
|
|
547
|
+
removeSub(link);
|
|
548
|
+
removeDep(link);
|
|
549
|
+
} else {
|
|
550
|
+
head = link;
|
|
551
|
+
}
|
|
552
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
553
|
+
link.prevActiveLink = void 0;
|
|
554
|
+
}
|
|
555
|
+
sub.deps = head;
|
|
556
|
+
sub.depsTail = tail;
|
|
490
557
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
493
|
-
|
|
558
|
+
function isDirty(sub) {
|
|
559
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
560
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
561
|
+
return true;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
if (sub._dirty) {
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
return false;
|
|
494
568
|
}
|
|
495
|
-
function
|
|
496
|
-
if (
|
|
497
|
-
|
|
498
|
-
|
|
569
|
+
function refreshComputed(computed) {
|
|
570
|
+
if (computed.flags & 2) {
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
computed.flags &= ~16;
|
|
577
|
+
if (computed.globalVersion === globalVersion) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
computed.globalVersion = globalVersion;
|
|
581
|
+
const dep = computed.dep;
|
|
582
|
+
computed.flags |= 2;
|
|
583
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
584
|
+
computed.flags &= ~2;
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
const prevSub = activeSub;
|
|
588
|
+
const prevShouldTrack = shouldTrack;
|
|
589
|
+
activeSub = computed;
|
|
590
|
+
shouldTrack = true;
|
|
591
|
+
try {
|
|
592
|
+
prepareDeps(computed);
|
|
593
|
+
const value = computed.fn();
|
|
594
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
595
|
+
computed._value = value;
|
|
596
|
+
dep.version++;
|
|
499
597
|
}
|
|
500
|
-
|
|
598
|
+
} catch (err) {
|
|
599
|
+
dep.version++;
|
|
600
|
+
throw err;
|
|
601
|
+
} finally {
|
|
602
|
+
activeSub = prevSub;
|
|
603
|
+
shouldTrack = prevShouldTrack;
|
|
604
|
+
cleanupDeps(computed);
|
|
605
|
+
computed.flags &= ~2;
|
|
501
606
|
}
|
|
502
607
|
}
|
|
503
|
-
function
|
|
504
|
-
const
|
|
505
|
-
if (
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
608
|
+
function removeSub(link) {
|
|
609
|
+
const { dep, prevSub, nextSub } = link;
|
|
610
|
+
if (prevSub) {
|
|
611
|
+
prevSub.nextSub = nextSub;
|
|
612
|
+
link.prevSub = void 0;
|
|
613
|
+
}
|
|
614
|
+
if (nextSub) {
|
|
615
|
+
nextSub.prevSub = prevSub;
|
|
616
|
+
link.nextSub = void 0;
|
|
617
|
+
}
|
|
618
|
+
if (dep.subs === link) {
|
|
619
|
+
dep.subs = prevSub;
|
|
620
|
+
}
|
|
621
|
+
if (!dep.subs && dep.computed) {
|
|
622
|
+
dep.computed.flags &= ~4;
|
|
623
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
624
|
+
removeSub(l);
|
|
509
625
|
}
|
|
510
626
|
}
|
|
511
627
|
}
|
|
628
|
+
function removeDep(link) {
|
|
629
|
+
const { prevDep, nextDep } = link;
|
|
630
|
+
if (prevDep) {
|
|
631
|
+
prevDep.nextDep = nextDep;
|
|
632
|
+
link.prevDep = void 0;
|
|
633
|
+
}
|
|
634
|
+
if (nextDep) {
|
|
635
|
+
nextDep.prevDep = prevDep;
|
|
636
|
+
link.nextDep = void 0;
|
|
637
|
+
}
|
|
638
|
+
}
|
|
512
639
|
function effect(fn, options) {
|
|
513
640
|
if (fn.effect instanceof ReactiveEffect) {
|
|
514
641
|
fn = fn.effect.fn;
|
|
515
642
|
}
|
|
516
|
-
const
|
|
517
|
-
if (_effect.dirty) {
|
|
518
|
-
_effect.run();
|
|
519
|
-
}
|
|
520
|
-
});
|
|
643
|
+
const e = new ReactiveEffect(fn);
|
|
521
644
|
if (options) {
|
|
522
|
-
extend(
|
|
523
|
-
if (options.scope)
|
|
524
|
-
recordEffectScope(_effect, options.scope);
|
|
645
|
+
extend(e, options);
|
|
525
646
|
}
|
|
526
|
-
|
|
527
|
-
|
|
647
|
+
try {
|
|
648
|
+
e.run();
|
|
649
|
+
} catch (err) {
|
|
650
|
+
e.stop();
|
|
651
|
+
throw err;
|
|
528
652
|
}
|
|
529
|
-
const runner =
|
|
530
|
-
runner.effect =
|
|
653
|
+
const runner = e.run.bind(e);
|
|
654
|
+
runner.effect = e;
|
|
531
655
|
return runner;
|
|
532
656
|
}
|
|
533
657
|
function stop(runner) {
|
|
534
658
|
runner.effect.stop();
|
|
535
659
|
}
|
|
536
660
|
let shouldTrack = true;
|
|
537
|
-
let pauseScheduleStack = 0;
|
|
538
661
|
const trackStack = [];
|
|
539
662
|
function pauseTracking() {
|
|
540
663
|
trackStack.push(shouldTrack);
|
|
@@ -544,192 +667,418 @@ function resetTracking() {
|
|
|
544
667
|
const last = trackStack.pop();
|
|
545
668
|
shouldTrack = last === void 0 ? true : last;
|
|
546
669
|
}
|
|
547
|
-
function
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
670
|
+
function cleanupEffect(e) {
|
|
671
|
+
const { cleanup } = e;
|
|
672
|
+
e.cleanup = void 0;
|
|
673
|
+
if (cleanup) {
|
|
674
|
+
const prevSub = activeSub;
|
|
675
|
+
activeSub = void 0;
|
|
676
|
+
try {
|
|
677
|
+
cleanup();
|
|
678
|
+
} finally {
|
|
679
|
+
activeSub = prevSub;
|
|
680
|
+
}
|
|
554
681
|
}
|
|
555
682
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
683
|
+
|
|
684
|
+
let globalVersion = 0;
|
|
685
|
+
class Dep {
|
|
686
|
+
constructor(computed) {
|
|
687
|
+
this.computed = computed;
|
|
688
|
+
this.version = 0;
|
|
689
|
+
/**
|
|
690
|
+
* Link between this dep and the current active effect
|
|
691
|
+
*/
|
|
692
|
+
this.activeLink = void 0;
|
|
693
|
+
/**
|
|
694
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
695
|
+
*/
|
|
696
|
+
this.subs = void 0;
|
|
569
697
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
570
|
-
|
|
698
|
+
this.subsHead = void 0;
|
|
571
699
|
}
|
|
572
700
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
701
|
+
track(debugInfo) {
|
|
702
|
+
if (!activeSub || !shouldTrack) {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
let link = this.activeLink;
|
|
706
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
707
|
+
link = this.activeLink = {
|
|
708
|
+
dep: this,
|
|
709
|
+
sub: activeSub,
|
|
710
|
+
version: this.version,
|
|
711
|
+
nextDep: void 0,
|
|
712
|
+
prevDep: void 0,
|
|
713
|
+
nextSub: void 0,
|
|
714
|
+
prevSub: void 0,
|
|
715
|
+
prevActiveLink: void 0
|
|
716
|
+
};
|
|
717
|
+
if (!activeSub.deps) {
|
|
718
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
719
|
+
} else {
|
|
720
|
+
link.prevDep = activeSub.depsTail;
|
|
721
|
+
activeSub.depsTail.nextDep = link;
|
|
722
|
+
activeSub.depsTail = link;
|
|
723
|
+
}
|
|
724
|
+
if (activeSub.flags & 4) {
|
|
725
|
+
addSub(link);
|
|
587
726
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
727
|
+
} else if (link.version === -1) {
|
|
728
|
+
link.version = this.version;
|
|
729
|
+
if (link.nextDep) {
|
|
730
|
+
const next = link.nextDep;
|
|
731
|
+
next.prevDep = link.prevDep;
|
|
732
|
+
if (link.prevDep) {
|
|
733
|
+
link.prevDep.nextDep = next;
|
|
734
|
+
}
|
|
735
|
+
link.prevDep = activeSub.depsTail;
|
|
736
|
+
link.nextDep = void 0;
|
|
737
|
+
activeSub.depsTail.nextDep = link;
|
|
738
|
+
activeSub.depsTail = link;
|
|
739
|
+
if (activeSub.deps === link) {
|
|
740
|
+
activeSub.deps = next;
|
|
593
741
|
}
|
|
594
742
|
}
|
|
595
743
|
}
|
|
744
|
+
if (!!(process.env.NODE_ENV !== "production") && activeSub.onTrack) {
|
|
745
|
+
activeSub.onTrack(
|
|
746
|
+
extend(
|
|
747
|
+
{
|
|
748
|
+
effect: activeSub
|
|
749
|
+
},
|
|
750
|
+
debugInfo
|
|
751
|
+
)
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
return link;
|
|
755
|
+
}
|
|
756
|
+
trigger(debugInfo) {
|
|
757
|
+
this.version++;
|
|
758
|
+
globalVersion++;
|
|
759
|
+
this.notify(debugInfo);
|
|
760
|
+
}
|
|
761
|
+
notify(debugInfo) {
|
|
762
|
+
startBatch();
|
|
763
|
+
try {
|
|
764
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
765
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
766
|
+
if (!!(process.env.NODE_ENV !== "production") && head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
767
|
+
head.sub.onTrigger(
|
|
768
|
+
extend(
|
|
769
|
+
{
|
|
770
|
+
effect: head.sub
|
|
771
|
+
},
|
|
772
|
+
debugInfo
|
|
773
|
+
)
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
779
|
+
link.sub.notify();
|
|
780
|
+
}
|
|
781
|
+
} finally {
|
|
782
|
+
endBatch();
|
|
783
|
+
}
|
|
596
784
|
}
|
|
597
|
-
resetScheduling();
|
|
598
785
|
}
|
|
599
|
-
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
|
|
786
|
+
function addSub(link) {
|
|
787
|
+
const computed = link.dep.computed;
|
|
788
|
+
if (computed && !link.dep.subs) {
|
|
789
|
+
computed.flags |= 4 | 16;
|
|
790
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
791
|
+
addSub(l);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
const currentTail = link.dep.subs;
|
|
795
|
+
if (currentTail !== link) {
|
|
796
|
+
link.prevSub = currentTail;
|
|
797
|
+
if (currentTail)
|
|
798
|
+
currentTail.nextSub = link;
|
|
799
|
+
}
|
|
800
|
+
if (!!(process.env.NODE_ENV !== "production") && link.dep.subsHead === void 0) {
|
|
801
|
+
link.dep.subsHead = link;
|
|
802
|
+
}
|
|
803
|
+
link.dep.subs = link;
|
|
804
|
+
}
|
|
607
805
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
608
|
-
const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "iterate" : "");
|
|
609
|
-
const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map
|
|
806
|
+
const ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Object iterate" : "");
|
|
807
|
+
const MAP_KEY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Map keys iterate" : "");
|
|
808
|
+
const ARRAY_ITERATE_KEY = Symbol(!!(process.env.NODE_ENV !== "production") ? "Array iterate" : "");
|
|
610
809
|
function track(target, type, key) {
|
|
611
|
-
if (shouldTrack &&
|
|
810
|
+
if (shouldTrack && activeSub) {
|
|
612
811
|
let depsMap = targetMap.get(target);
|
|
613
812
|
if (!depsMap) {
|
|
614
813
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
615
814
|
}
|
|
616
815
|
let dep = depsMap.get(key);
|
|
617
816
|
if (!dep) {
|
|
618
|
-
depsMap.set(key, dep =
|
|
817
|
+
depsMap.set(key, dep = new Dep());
|
|
619
818
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
dep,
|
|
623
|
-
!!(process.env.NODE_ENV !== "production") ? {
|
|
819
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
820
|
+
dep.track({
|
|
624
821
|
target,
|
|
625
822
|
type,
|
|
626
823
|
key
|
|
627
|
-
}
|
|
628
|
-
|
|
824
|
+
});
|
|
825
|
+
} else {
|
|
826
|
+
dep.track();
|
|
827
|
+
}
|
|
629
828
|
}
|
|
630
829
|
}
|
|
631
830
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
632
831
|
const depsMap = targetMap.get(target);
|
|
633
832
|
if (!depsMap) {
|
|
833
|
+
globalVersion++;
|
|
634
834
|
return;
|
|
635
835
|
}
|
|
636
836
|
let deps = [];
|
|
637
837
|
if (type === "clear") {
|
|
638
838
|
deps = [...depsMap.values()];
|
|
639
|
-
} else if (key === "length" && isArray(target)) {
|
|
640
|
-
const newLength = Number(newValue);
|
|
641
|
-
depsMap.forEach((dep, key2) => {
|
|
642
|
-
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
|
643
|
-
deps.push(dep);
|
|
644
|
-
}
|
|
645
|
-
});
|
|
646
839
|
} else {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (!
|
|
653
|
-
deps.push(
|
|
654
|
-
if (isMap(target)) {
|
|
655
|
-
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
656
|
-
}
|
|
657
|
-
} else if (isIntegerKey(key)) {
|
|
658
|
-
deps.push(depsMap.get("length"));
|
|
840
|
+
const targetIsArray = isArray(target);
|
|
841
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
842
|
+
if (targetIsArray && key === "length") {
|
|
843
|
+
const newLength = Number(newValue);
|
|
844
|
+
depsMap.forEach((dep, key2) => {
|
|
845
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
846
|
+
deps.push(dep);
|
|
659
847
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
848
|
+
});
|
|
849
|
+
} else {
|
|
850
|
+
const push = (dep) => dep && deps.push(dep);
|
|
851
|
+
if (key !== void 0) {
|
|
852
|
+
push(depsMap.get(key));
|
|
853
|
+
}
|
|
854
|
+
if (isArrayIndex) {
|
|
855
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
856
|
+
}
|
|
857
|
+
switch (type) {
|
|
858
|
+
case "add":
|
|
859
|
+
if (!targetIsArray) {
|
|
860
|
+
push(depsMap.get(ITERATE_KEY));
|
|
861
|
+
if (isMap(target)) {
|
|
862
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
863
|
+
}
|
|
864
|
+
} else if (isArrayIndex) {
|
|
865
|
+
push(depsMap.get("length"));
|
|
866
|
+
}
|
|
867
|
+
break;
|
|
868
|
+
case "delete":
|
|
869
|
+
if (!targetIsArray) {
|
|
870
|
+
push(depsMap.get(ITERATE_KEY));
|
|
871
|
+
if (isMap(target)) {
|
|
872
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
873
|
+
}
|
|
874
|
+
}
|
|
875
|
+
break;
|
|
876
|
+
case "set":
|
|
664
877
|
if (isMap(target)) {
|
|
665
|
-
|
|
878
|
+
push(depsMap.get(ITERATE_KEY));
|
|
666
879
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
case "set":
|
|
670
|
-
if (isMap(target)) {
|
|
671
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
672
|
-
}
|
|
673
|
-
break;
|
|
880
|
+
break;
|
|
881
|
+
}
|
|
674
882
|
}
|
|
675
883
|
}
|
|
676
|
-
|
|
884
|
+
startBatch();
|
|
677
885
|
for (const dep of deps) {
|
|
678
|
-
if (
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
} : void 0
|
|
690
|
-
);
|
|
886
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
887
|
+
dep.trigger({
|
|
888
|
+
target,
|
|
889
|
+
type,
|
|
890
|
+
key,
|
|
891
|
+
newValue,
|
|
892
|
+
oldValue,
|
|
893
|
+
oldTarget
|
|
894
|
+
});
|
|
895
|
+
} else {
|
|
896
|
+
dep.trigger();
|
|
691
897
|
}
|
|
692
898
|
}
|
|
693
|
-
|
|
899
|
+
endBatch();
|
|
694
900
|
}
|
|
695
901
|
function getDepFromReactive(object, key) {
|
|
696
|
-
|
|
697
|
-
return
|
|
902
|
+
var _a;
|
|
903
|
+
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
function reactiveReadArray(array) {
|
|
907
|
+
const raw = toRaw(array);
|
|
908
|
+
if (raw === array)
|
|
909
|
+
return raw;
|
|
910
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
911
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
912
|
+
}
|
|
913
|
+
function shallowReadArray(arr) {
|
|
914
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
915
|
+
return arr;
|
|
916
|
+
}
|
|
917
|
+
const arrayInstrumentations = {
|
|
918
|
+
__proto__: null,
|
|
919
|
+
[Symbol.iterator]() {
|
|
920
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
921
|
+
},
|
|
922
|
+
concat(...args) {
|
|
923
|
+
return reactiveReadArray(this).concat(
|
|
924
|
+
...args.map((x) => reactiveReadArray(x))
|
|
925
|
+
);
|
|
926
|
+
},
|
|
927
|
+
entries() {
|
|
928
|
+
return iterator(this, "entries", (value) => {
|
|
929
|
+
value[1] = toReactive(value[1]);
|
|
930
|
+
return value;
|
|
931
|
+
});
|
|
932
|
+
},
|
|
933
|
+
every(fn, thisArg) {
|
|
934
|
+
return apply(this, "every", fn, thisArg);
|
|
935
|
+
},
|
|
936
|
+
filter(fn, thisArg) {
|
|
937
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
938
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
939
|
+
},
|
|
940
|
+
find(fn, thisArg) {
|
|
941
|
+
const result = apply(this, "find", fn, thisArg);
|
|
942
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
943
|
+
},
|
|
944
|
+
findIndex(fn, thisArg) {
|
|
945
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
946
|
+
},
|
|
947
|
+
findLast(fn, thisArg) {
|
|
948
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
949
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
950
|
+
},
|
|
951
|
+
findLastIndex(fn, thisArg) {
|
|
952
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
953
|
+
},
|
|
954
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
955
|
+
forEach(fn, thisArg) {
|
|
956
|
+
return apply(this, "forEach", fn, thisArg);
|
|
957
|
+
},
|
|
958
|
+
includes(...args) {
|
|
959
|
+
return searchProxy(this, "includes", args);
|
|
960
|
+
},
|
|
961
|
+
indexOf(...args) {
|
|
962
|
+
return searchProxy(this, "indexOf", args);
|
|
963
|
+
},
|
|
964
|
+
join(separator) {
|
|
965
|
+
return reactiveReadArray(this).join(separator);
|
|
966
|
+
},
|
|
967
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
968
|
+
lastIndexOf(...args) {
|
|
969
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
970
|
+
},
|
|
971
|
+
map(fn, thisArg) {
|
|
972
|
+
return apply(this, "map", fn, thisArg);
|
|
973
|
+
},
|
|
974
|
+
pop() {
|
|
975
|
+
return noTracking(this, "pop");
|
|
976
|
+
},
|
|
977
|
+
push(...args) {
|
|
978
|
+
return noTracking(this, "push", args);
|
|
979
|
+
},
|
|
980
|
+
reduce(fn, ...args) {
|
|
981
|
+
return reduce(this, "reduce", fn, args);
|
|
982
|
+
},
|
|
983
|
+
reduceRight(fn, ...args) {
|
|
984
|
+
return reduce(this, "reduceRight", fn, args);
|
|
985
|
+
},
|
|
986
|
+
shift() {
|
|
987
|
+
return noTracking(this, "shift");
|
|
988
|
+
},
|
|
989
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
990
|
+
some(fn, thisArg) {
|
|
991
|
+
return apply(this, "some", fn, thisArg);
|
|
992
|
+
},
|
|
993
|
+
splice(...args) {
|
|
994
|
+
return noTracking(this, "splice", args);
|
|
995
|
+
},
|
|
996
|
+
toReversed() {
|
|
997
|
+
return reactiveReadArray(this).toReversed();
|
|
998
|
+
},
|
|
999
|
+
toSorted(comparer) {
|
|
1000
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
1001
|
+
},
|
|
1002
|
+
toSpliced(...args) {
|
|
1003
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1004
|
+
},
|
|
1005
|
+
unshift(...args) {
|
|
1006
|
+
return noTracking(this, "unshift", args);
|
|
1007
|
+
},
|
|
1008
|
+
values() {
|
|
1009
|
+
return iterator(this, "values", toReactive);
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
function iterator(self, method, wrapValue) {
|
|
1013
|
+
const arr = shallowReadArray(self);
|
|
1014
|
+
const iter = arr[method]();
|
|
1015
|
+
if (arr !== self && !isShallow(self)) {
|
|
1016
|
+
iter._next = iter.next;
|
|
1017
|
+
iter.next = () => {
|
|
1018
|
+
const result = iter._next();
|
|
1019
|
+
if (result.value) {
|
|
1020
|
+
result.value = wrapValue(result.value);
|
|
1021
|
+
}
|
|
1022
|
+
return result;
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
return iter;
|
|
1026
|
+
}
|
|
1027
|
+
function apply(self, method, fn, thisArg) {
|
|
1028
|
+
const arr = shallowReadArray(self);
|
|
1029
|
+
let wrappedFn = fn;
|
|
1030
|
+
if (arr !== self) {
|
|
1031
|
+
if (!isShallow(self)) {
|
|
1032
|
+
wrappedFn = function(item, index) {
|
|
1033
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1034
|
+
};
|
|
1035
|
+
} else if (fn.length > 2) {
|
|
1036
|
+
wrappedFn = function(item, index) {
|
|
1037
|
+
return fn.call(this, item, index, self);
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
return arr[method](wrappedFn, thisArg);
|
|
1042
|
+
}
|
|
1043
|
+
function reduce(self, method, fn, args) {
|
|
1044
|
+
const arr = shallowReadArray(self);
|
|
1045
|
+
let wrappedFn = fn;
|
|
1046
|
+
if (arr !== self) {
|
|
1047
|
+
if (!isShallow(self)) {
|
|
1048
|
+
wrappedFn = function(acc, item, index) {
|
|
1049
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1050
|
+
};
|
|
1051
|
+
} else if (fn.length > 3) {
|
|
1052
|
+
wrappedFn = function(acc, item, index) {
|
|
1053
|
+
return fn.call(this, acc, item, index, self);
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
return arr[method](wrappedFn, ...args);
|
|
1058
|
+
}
|
|
1059
|
+
function searchProxy(self, method, args) {
|
|
1060
|
+
const arr = toRaw(self);
|
|
1061
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1062
|
+
const res = arr[method](...args);
|
|
1063
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1064
|
+
args[0] = toRaw(args[0]);
|
|
1065
|
+
return arr[method](...args);
|
|
1066
|
+
}
|
|
1067
|
+
return res;
|
|
1068
|
+
}
|
|
1069
|
+
function noTracking(self, method, args = []) {
|
|
1070
|
+
pauseTracking();
|
|
1071
|
+
startBatch();
|
|
1072
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1073
|
+
endBatch();
|
|
1074
|
+
resetTracking();
|
|
1075
|
+
return res;
|
|
698
1076
|
}
|
|
699
1077
|
|
|
700
1078
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
701
1079
|
const builtInSymbols = new Set(
|
|
702
1080
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
703
1081
|
);
|
|
704
|
-
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
705
|
-
function createArrayInstrumentations() {
|
|
706
|
-
const instrumentations = {};
|
|
707
|
-
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
708
|
-
instrumentations[key] = function(...args) {
|
|
709
|
-
const arr = toRaw(this);
|
|
710
|
-
for (let i = 0, l = this.length; i < l; i++) {
|
|
711
|
-
track(arr, "get", i + "");
|
|
712
|
-
}
|
|
713
|
-
const res = arr[key](...args);
|
|
714
|
-
if (res === -1 || res === false) {
|
|
715
|
-
return arr[key](...args.map(toRaw));
|
|
716
|
-
} else {
|
|
717
|
-
return res;
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
});
|
|
721
|
-
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
722
|
-
instrumentations[key] = function(...args) {
|
|
723
|
-
pauseTracking();
|
|
724
|
-
pauseScheduling();
|
|
725
|
-
const res = toRaw(this)[key].apply(this, args);
|
|
726
|
-
resetScheduling();
|
|
727
|
-
resetTracking();
|
|
728
|
-
return res;
|
|
729
|
-
};
|
|
730
|
-
});
|
|
731
|
-
return instrumentations;
|
|
732
|
-
}
|
|
733
1082
|
function hasOwnProperty(key) {
|
|
734
1083
|
if (!isSymbol(key))
|
|
735
1084
|
key = String(key);
|
|
@@ -760,14 +1109,22 @@ class BaseReactiveHandler {
|
|
|
760
1109
|
}
|
|
761
1110
|
const targetIsArray = isArray(target);
|
|
762
1111
|
if (!isReadonly2) {
|
|
763
|
-
|
|
764
|
-
|
|
1112
|
+
let fn;
|
|
1113
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1114
|
+
return fn;
|
|
765
1115
|
}
|
|
766
1116
|
if (key === "hasOwnProperty") {
|
|
767
1117
|
return hasOwnProperty;
|
|
768
1118
|
}
|
|
769
1119
|
}
|
|
770
|
-
const res = Reflect.get(
|
|
1120
|
+
const res = Reflect.get(
|
|
1121
|
+
target,
|
|
1122
|
+
key,
|
|
1123
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1124
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1125
|
+
// its class methods
|
|
1126
|
+
isRef(target) ? target : receiver
|
|
1127
|
+
);
|
|
771
1128
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
772
1129
|
return res;
|
|
773
1130
|
}
|
|
@@ -1266,110 +1623,8 @@ function markRaw(value) {
|
|
|
1266
1623
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1267
1624
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1268
1625
|
|
|
1269
|
-
const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
|
|
1270
|
-
class ComputedRefImpl {
|
|
1271
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1272
|
-
this.getter = getter;
|
|
1273
|
-
this._setter = _setter;
|
|
1274
|
-
this.dep = void 0;
|
|
1275
|
-
this.__v_isRef = true;
|
|
1276
|
-
this["__v_isReadonly"] = false;
|
|
1277
|
-
this.effect = new ReactiveEffect(
|
|
1278
|
-
() => getter(this._value),
|
|
1279
|
-
() => triggerRefValue(
|
|
1280
|
-
this,
|
|
1281
|
-
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1282
|
-
)
|
|
1283
|
-
);
|
|
1284
|
-
this.effect.computed = this;
|
|
1285
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1286
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1287
|
-
}
|
|
1288
|
-
get value() {
|
|
1289
|
-
const self = toRaw(this);
|
|
1290
|
-
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
|
1291
|
-
triggerRefValue(self, 4);
|
|
1292
|
-
}
|
|
1293
|
-
trackRefValue(self);
|
|
1294
|
-
if (self.effect._dirtyLevel >= 2) {
|
|
1295
|
-
if (!!(process.env.NODE_ENV !== "production") && this._warnRecursive) {
|
|
1296
|
-
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1297
|
-
|
|
1298
|
-
getter: `, this.getter);
|
|
1299
|
-
}
|
|
1300
|
-
triggerRefValue(self, 2);
|
|
1301
|
-
}
|
|
1302
|
-
return self._value;
|
|
1303
|
-
}
|
|
1304
|
-
set value(newValue) {
|
|
1305
|
-
this._setter(newValue);
|
|
1306
|
-
}
|
|
1307
|
-
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1308
|
-
get _dirty() {
|
|
1309
|
-
return this.effect.dirty;
|
|
1310
|
-
}
|
|
1311
|
-
set _dirty(v) {
|
|
1312
|
-
this.effect.dirty = v;
|
|
1313
|
-
}
|
|
1314
|
-
// #endregion
|
|
1315
|
-
}
|
|
1316
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1317
|
-
let getter;
|
|
1318
|
-
let setter;
|
|
1319
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1320
|
-
if (onlyGetter) {
|
|
1321
|
-
getter = getterOrOptions;
|
|
1322
|
-
setter = !!(process.env.NODE_ENV !== "production") ? () => {
|
|
1323
|
-
warn$2("Write operation failed: computed value is readonly");
|
|
1324
|
-
} : NOOP;
|
|
1325
|
-
} else {
|
|
1326
|
-
getter = getterOrOptions.get;
|
|
1327
|
-
setter = getterOrOptions.set;
|
|
1328
|
-
}
|
|
1329
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1330
|
-
if (!!(process.env.NODE_ENV !== "production") && debugOptions && !isSSR) {
|
|
1331
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1332
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1333
|
-
}
|
|
1334
|
-
return cRef;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
function trackRefValue(ref2) {
|
|
1338
|
-
var _a;
|
|
1339
|
-
if (shouldTrack && activeEffect) {
|
|
1340
|
-
ref2 = toRaw(ref2);
|
|
1341
|
-
trackEffect(
|
|
1342
|
-
activeEffect,
|
|
1343
|
-
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1344
|
-
() => ref2.dep = void 0,
|
|
1345
|
-
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1346
|
-
),
|
|
1347
|
-
!!(process.env.NODE_ENV !== "production") ? {
|
|
1348
|
-
target: ref2,
|
|
1349
|
-
type: "get",
|
|
1350
|
-
key: "value"
|
|
1351
|
-
} : void 0
|
|
1352
|
-
);
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
|
1356
|
-
ref2 = toRaw(ref2);
|
|
1357
|
-
const dep = ref2.dep;
|
|
1358
|
-
if (dep) {
|
|
1359
|
-
triggerEffects(
|
|
1360
|
-
dep,
|
|
1361
|
-
dirtyLevel,
|
|
1362
|
-
!!(process.env.NODE_ENV !== "production") ? {
|
|
1363
|
-
target: ref2,
|
|
1364
|
-
type: "set",
|
|
1365
|
-
key: "value",
|
|
1366
|
-
newValue: newVal
|
|
1367
|
-
} : void 0
|
|
1368
|
-
);
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
1626
|
function isRef(r) {
|
|
1372
|
-
return
|
|
1627
|
+
return r ? r.__v_isRef === true : false;
|
|
1373
1628
|
}
|
|
1374
1629
|
function ref(value) {
|
|
1375
1630
|
return createRef(value, false);
|
|
@@ -1386,27 +1641,55 @@ function createRef(rawValue, shallow) {
|
|
|
1386
1641
|
class RefImpl {
|
|
1387
1642
|
constructor(value, __v_isShallow) {
|
|
1388
1643
|
this.__v_isShallow = __v_isShallow;
|
|
1389
|
-
this.dep =
|
|
1644
|
+
this.dep = new Dep();
|
|
1390
1645
|
this.__v_isRef = true;
|
|
1391
1646
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1392
1647
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1393
1648
|
}
|
|
1394
1649
|
get value() {
|
|
1395
|
-
|
|
1650
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1651
|
+
this.dep.track({
|
|
1652
|
+
target: this,
|
|
1653
|
+
type: "get",
|
|
1654
|
+
key: "value"
|
|
1655
|
+
});
|
|
1656
|
+
} else {
|
|
1657
|
+
this.dep.track();
|
|
1658
|
+
}
|
|
1396
1659
|
return this._value;
|
|
1397
1660
|
}
|
|
1398
|
-
set value(
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
this.
|
|
1404
|
-
|
|
1661
|
+
set value(newValue) {
|
|
1662
|
+
const oldValue = this._rawValue;
|
|
1663
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1664
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1665
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1666
|
+
this._rawValue = newValue;
|
|
1667
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1668
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1669
|
+
this.dep.trigger({
|
|
1670
|
+
target: this,
|
|
1671
|
+
type: "set",
|
|
1672
|
+
key: "value",
|
|
1673
|
+
newValue,
|
|
1674
|
+
oldValue
|
|
1675
|
+
});
|
|
1676
|
+
} else {
|
|
1677
|
+
this.dep.trigger();
|
|
1678
|
+
}
|
|
1405
1679
|
}
|
|
1406
1680
|
}
|
|
1407
1681
|
}
|
|
1408
1682
|
function triggerRef(ref2) {
|
|
1409
|
-
|
|
1683
|
+
if (!!(process.env.NODE_ENV !== "production")) {
|
|
1684
|
+
ref2.dep.trigger({
|
|
1685
|
+
target: ref2,
|
|
1686
|
+
type: "set",
|
|
1687
|
+
key: "value",
|
|
1688
|
+
newValue: ref2._value
|
|
1689
|
+
});
|
|
1690
|
+
} else {
|
|
1691
|
+
ref2.dep.trigger();
|
|
1692
|
+
}
|
|
1410
1693
|
}
|
|
1411
1694
|
function unref(ref2) {
|
|
1412
1695
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1431,12 +1714,9 @@ function proxyRefs(objectWithRefs) {
|
|
|
1431
1714
|
}
|
|
1432
1715
|
class CustomRefImpl {
|
|
1433
1716
|
constructor(factory) {
|
|
1434
|
-
this.dep = void 0;
|
|
1435
1717
|
this.__v_isRef = true;
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
() => triggerRefValue(this)
|
|
1439
|
-
);
|
|
1718
|
+
const dep = this.dep = new Dep();
|
|
1719
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1440
1720
|
this._get = get;
|
|
1441
1721
|
this._set = set;
|
|
1442
1722
|
}
|
|
@@ -1504,6 +1784,90 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1504
1784
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1505
1785
|
}
|
|
1506
1786
|
|
|
1787
|
+
class ComputedRefImpl {
|
|
1788
|
+
constructor(fn, setter, isSSR) {
|
|
1789
|
+
this.fn = fn;
|
|
1790
|
+
this.setter = setter;
|
|
1791
|
+
/**
|
|
1792
|
+
* @internal
|
|
1793
|
+
*/
|
|
1794
|
+
this._value = void 0;
|
|
1795
|
+
/**
|
|
1796
|
+
* @internal
|
|
1797
|
+
*/
|
|
1798
|
+
this.dep = new Dep(this);
|
|
1799
|
+
/**
|
|
1800
|
+
* @internal
|
|
1801
|
+
*/
|
|
1802
|
+
this.__v_isRef = true;
|
|
1803
|
+
// A computed is also a subscriber that tracks other deps
|
|
1804
|
+
/**
|
|
1805
|
+
* @internal
|
|
1806
|
+
*/
|
|
1807
|
+
this.deps = void 0;
|
|
1808
|
+
/**
|
|
1809
|
+
* @internal
|
|
1810
|
+
*/
|
|
1811
|
+
this.depsTail = void 0;
|
|
1812
|
+
/**
|
|
1813
|
+
* @internal
|
|
1814
|
+
*/
|
|
1815
|
+
this.flags = 16;
|
|
1816
|
+
/**
|
|
1817
|
+
* @internal
|
|
1818
|
+
*/
|
|
1819
|
+
this.globalVersion = globalVersion - 1;
|
|
1820
|
+
// for backwards compat
|
|
1821
|
+
this.effect = this;
|
|
1822
|
+
this.__v_isReadonly = !setter;
|
|
1823
|
+
this.isSSR = isSSR;
|
|
1824
|
+
}
|
|
1825
|
+
/**
|
|
1826
|
+
* @internal
|
|
1827
|
+
*/
|
|
1828
|
+
notify() {
|
|
1829
|
+
if (activeSub !== this) {
|
|
1830
|
+
this.flags |= 16;
|
|
1831
|
+
this.dep.notify();
|
|
1832
|
+
} else if (!!(process.env.NODE_ENV !== "production")) ;
|
|
1833
|
+
}
|
|
1834
|
+
get value() {
|
|
1835
|
+
const link = !!(process.env.NODE_ENV !== "production") ? this.dep.track({
|
|
1836
|
+
target: this,
|
|
1837
|
+
type: "get",
|
|
1838
|
+
key: "value"
|
|
1839
|
+
}) : this.dep.track();
|
|
1840
|
+
refreshComputed(this);
|
|
1841
|
+
if (link) {
|
|
1842
|
+
link.version = this.dep.version;
|
|
1843
|
+
}
|
|
1844
|
+
return this._value;
|
|
1845
|
+
}
|
|
1846
|
+
set value(newValue) {
|
|
1847
|
+
if (this.setter) {
|
|
1848
|
+
this.setter(newValue);
|
|
1849
|
+
} else if (!!(process.env.NODE_ENV !== "production")) {
|
|
1850
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
}
|
|
1854
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1855
|
+
let getter;
|
|
1856
|
+
let setter;
|
|
1857
|
+
if (isFunction(getterOrOptions)) {
|
|
1858
|
+
getter = getterOrOptions;
|
|
1859
|
+
} else {
|
|
1860
|
+
getter = getterOrOptions.get;
|
|
1861
|
+
setter = getterOrOptions.set;
|
|
1862
|
+
}
|
|
1863
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1864
|
+
if (!!(process.env.NODE_ENV !== "production") && debugOptions && !isSSR) {
|
|
1865
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1866
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1867
|
+
}
|
|
1868
|
+
return cRef;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1507
1871
|
const TrackOpTypes = {
|
|
1508
1872
|
"GET": "get",
|
|
1509
1873
|
"HAS": "has",
|
|
@@ -1800,7 +2164,7 @@ function findInsertionIndex(id) {
|
|
|
1800
2164
|
const middle = start + end >>> 1;
|
|
1801
2165
|
const middleJob = queue[middle];
|
|
1802
2166
|
const middleJobId = getId(middleJob);
|
|
1803
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2167
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1804
2168
|
start = middle + 1;
|
|
1805
2169
|
} else {
|
|
1806
2170
|
end = middle;
|
|
@@ -1809,15 +2173,21 @@ function findInsertionIndex(id) {
|
|
|
1809
2173
|
return start;
|
|
1810
2174
|
}
|
|
1811
2175
|
function queueJob(job) {
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1815
|
-
)) {
|
|
2176
|
+
var _a;
|
|
2177
|
+
if (!(job.flags & 1)) {
|
|
1816
2178
|
if (job.id == null) {
|
|
1817
2179
|
queue.push(job);
|
|
2180
|
+
} else if (
|
|
2181
|
+
// fast path when the job id is larger than the tail
|
|
2182
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2183
|
+
) {
|
|
2184
|
+
queue.push(job);
|
|
1818
2185
|
} else {
|
|
1819
2186
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1820
2187
|
}
|
|
2188
|
+
if (!(job.flags & 4)) {
|
|
2189
|
+
job.flags |= 1;
|
|
2190
|
+
}
|
|
1821
2191
|
queueFlush();
|
|
1822
2192
|
}
|
|
1823
2193
|
}
|
|
@@ -1835,11 +2205,11 @@ function invalidateJob(job) {
|
|
|
1835
2205
|
}
|
|
1836
2206
|
function queuePostFlushCb(cb) {
|
|
1837
2207
|
if (!isArray(cb)) {
|
|
1838
|
-
if (!
|
|
1839
|
-
cb,
|
|
1840
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1841
|
-
)) {
|
|
2208
|
+
if (!(cb.flags & 1)) {
|
|
1842
2209
|
pendingPostFlushCbs.push(cb);
|
|
2210
|
+
if (!(cb.flags & 4)) {
|
|
2211
|
+
cb.flags |= 1;
|
|
2212
|
+
}
|
|
1843
2213
|
}
|
|
1844
2214
|
} else {
|
|
1845
2215
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1852,7 +2222,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1852
2222
|
}
|
|
1853
2223
|
for (; i < queue.length; i++) {
|
|
1854
2224
|
const cb = queue[i];
|
|
1855
|
-
if (cb && cb.
|
|
2225
|
+
if (cb && cb.flags & 2) {
|
|
1856
2226
|
if (instance && cb.id !== instance.uid) {
|
|
1857
2227
|
continue;
|
|
1858
2228
|
}
|
|
@@ -1862,6 +2232,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1862
2232
|
queue.splice(i, 1);
|
|
1863
2233
|
i--;
|
|
1864
2234
|
cb();
|
|
2235
|
+
cb.flags &= ~1;
|
|
1865
2236
|
}
|
|
1866
2237
|
}
|
|
1867
2238
|
}
|
|
@@ -1884,6 +2255,7 @@ function flushPostFlushCbs(seen) {
|
|
|
1884
2255
|
continue;
|
|
1885
2256
|
}
|
|
1886
2257
|
activePostFlushCbs[postFlushIndex]();
|
|
2258
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1887
2259
|
}
|
|
1888
2260
|
activePostFlushCbs = null;
|
|
1889
2261
|
postFlushIndex = 0;
|
|
@@ -1893,9 +2265,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
|
|
|
1893
2265
|
const comparator = (a, b) => {
|
|
1894
2266
|
const diff = getId(a) - getId(b);
|
|
1895
2267
|
if (diff === 0) {
|
|
1896
|
-
|
|
2268
|
+
const isAPre = a.flags & 2;
|
|
2269
|
+
const isBPre = b.flags & 2;
|
|
2270
|
+
if (isAPre && !isBPre)
|
|
1897
2271
|
return -1;
|
|
1898
|
-
if (
|
|
2272
|
+
if (isBPre && !isAPre)
|
|
1899
2273
|
return 1;
|
|
1900
2274
|
}
|
|
1901
2275
|
return diff;
|
|
@@ -1911,11 +2285,12 @@ function flushJobs(seen) {
|
|
|
1911
2285
|
try {
|
|
1912
2286
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1913
2287
|
const job = queue[flushIndex];
|
|
1914
|
-
if (job && job.
|
|
2288
|
+
if (job && !(job.flags & 8)) {
|
|
1915
2289
|
if (!!(process.env.NODE_ENV !== "production") && check(job)) {
|
|
1916
2290
|
continue;
|
|
1917
2291
|
}
|
|
1918
2292
|
callWithErrorHandling(job, null, 14);
|
|
2293
|
+
job.flags &= ~1;
|
|
1919
2294
|
}
|
|
1920
2295
|
}
|
|
1921
2296
|
} finally {
|
|
@@ -1997,7 +2372,6 @@ function rerender(id, newRender) {
|
|
|
1997
2372
|
}
|
|
1998
2373
|
instance.renderCache = [];
|
|
1999
2374
|
isHmrUpdating = true;
|
|
2000
|
-
instance.effect.dirty = true;
|
|
2001
2375
|
instance.update();
|
|
2002
2376
|
isHmrUpdating = false;
|
|
2003
2377
|
});
|
|
@@ -2025,7 +2399,6 @@ function reload(id, newComp) {
|
|
|
2025
2399
|
instance.ceReload(newComp.styles);
|
|
2026
2400
|
hmrDirtyComponents.delete(oldComp);
|
|
2027
2401
|
} else if (instance.parent) {
|
|
2028
|
-
instance.parent.effect.dirty = true;
|
|
2029
2402
|
queueJob(instance.parent.update);
|
|
2030
2403
|
} else if (instance.appContext.reload) {
|
|
2031
2404
|
instance.appContext.reload();
|
|
@@ -2913,7 +3286,7 @@ function renderComponentRoot(instance) {
|
|
|
2913
3286
|
!!(process.env.NODE_ENV !== "production") ? {
|
|
2914
3287
|
get attrs() {
|
|
2915
3288
|
markAttrsAccessed();
|
|
2916
|
-
return
|
|
3289
|
+
return attrs;
|
|
2917
3290
|
},
|
|
2918
3291
|
slots,
|
|
2919
3292
|
emit
|
|
@@ -2946,7 +3319,7 @@ function renderComponentRoot(instance) {
|
|
|
2946
3319
|
propsOptions
|
|
2947
3320
|
);
|
|
2948
3321
|
}
|
|
2949
|
-
root = cloneVNode(root, fallthroughAttrs
|
|
3322
|
+
root = cloneVNode(root, fallthroughAttrs);
|
|
2950
3323
|
} else if (!!(process.env.NODE_ENV !== "production") && !accessedAttrs && root.type !== Comment) {
|
|
2951
3324
|
const allAttrs = Object.keys(attrs);
|
|
2952
3325
|
const eventAttrs = [];
|
|
@@ -2984,15 +3357,10 @@ function renderComponentRoot(instance) {
|
|
|
2984
3357
|
getComponentName(instance.type)
|
|
2985
3358
|
);
|
|
2986
3359
|
}
|
|
2987
|
-
root = cloneVNode(
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
2991
|
-
style
|
|
2992
|
-
},
|
|
2993
|
-
false,
|
|
2994
|
-
true
|
|
2995
|
-
);
|
|
3360
|
+
root = cloneVNode(root, {
|
|
3361
|
+
class: cls,
|
|
3362
|
+
style
|
|
3363
|
+
});
|
|
2996
3364
|
}
|
|
2997
3365
|
}
|
|
2998
3366
|
if (vnode.dirs) {
|
|
@@ -3001,7 +3369,7 @@ function renderComponentRoot(instance) {
|
|
|
3001
3369
|
`Runtime directive used on component with non-element root node. The directives will not function as intended.`
|
|
3002
3370
|
);
|
|
3003
3371
|
}
|
|
3004
|
-
root = cloneVNode(root
|
|
3372
|
+
root = cloneVNode(root);
|
|
3005
3373
|
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
3006
3374
|
}
|
|
3007
3375
|
if (vnode.transition) {
|
|
@@ -3496,7 +3864,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
3496
3864
|
let parentSuspenseId;
|
|
3497
3865
|
const isSuspensible = isVNodeSuspensible(vnode);
|
|
3498
3866
|
if (isSuspensible) {
|
|
3499
|
-
if (parentSuspense
|
|
3867
|
+
if (parentSuspense == null ? void 0 : parentSuspense.pendingBranch) {
|
|
3500
3868
|
parentSuspenseId = parentSuspense.pendingId;
|
|
3501
3869
|
parentSuspense.deps++;
|
|
3502
3870
|
}
|
|
@@ -3808,8 +4176,8 @@ function setActiveBranch(suspense, branch) {
|
|
|
3808
4176
|
}
|
|
3809
4177
|
}
|
|
3810
4178
|
function isVNodeSuspensible(vnode) {
|
|
3811
|
-
|
|
3812
|
-
return suspensible != null && suspensible !== false;
|
|
4179
|
+
var _a;
|
|
4180
|
+
return ((_a = vnode.props) == null ? void 0 : _a.suspensible) != null && vnode.props.suspensible !== false;
|
|
3813
4181
|
}
|
|
3814
4182
|
|
|
3815
4183
|
const legacyDirectiveHookMap = {
|
|
@@ -4022,8 +4390,8 @@ function doWatch(source, cb, {
|
|
|
4022
4390
|
}
|
|
4023
4391
|
}
|
|
4024
4392
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
4025
|
-
const job = () => {
|
|
4026
|
-
if (!effect.
|
|
4393
|
+
const job = (immediateFirstRun) => {
|
|
4394
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
4027
4395
|
return;
|
|
4028
4396
|
}
|
|
4029
4397
|
if (cb) {
|
|
@@ -4044,19 +4412,22 @@ function doWatch(source, cb, {
|
|
|
4044
4412
|
effect.run();
|
|
4045
4413
|
}
|
|
4046
4414
|
};
|
|
4047
|
-
|
|
4415
|
+
if (cb)
|
|
4416
|
+
job.flags |= 4;
|
|
4417
|
+
const effect = new ReactiveEffect(getter);
|
|
4048
4418
|
let scheduler;
|
|
4049
4419
|
if (flush === "sync") {
|
|
4420
|
+
effect.flags |= 64;
|
|
4050
4421
|
scheduler = job;
|
|
4051
4422
|
} else if (flush === "post") {
|
|
4052
4423
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
4053
4424
|
} else {
|
|
4054
|
-
job.
|
|
4425
|
+
job.flags |= 2;
|
|
4055
4426
|
if (instance)
|
|
4056
4427
|
job.id = instance.uid;
|
|
4057
4428
|
scheduler = () => queueJob(job);
|
|
4058
4429
|
}
|
|
4059
|
-
|
|
4430
|
+
effect.scheduler = scheduler;
|
|
4060
4431
|
const scope = getCurrentScope();
|
|
4061
4432
|
const unwatch = () => {
|
|
4062
4433
|
effect.stop();
|
|
@@ -4070,7 +4441,7 @@ function doWatch(source, cb, {
|
|
|
4070
4441
|
}
|
|
4071
4442
|
if (cb) {
|
|
4072
4443
|
if (immediate) {
|
|
4073
|
-
job();
|
|
4444
|
+
job(true);
|
|
4074
4445
|
} else {
|
|
4075
4446
|
oldValue = effect.run();
|
|
4076
4447
|
}
|
|
@@ -4111,29 +4482,34 @@ function createPathGetter(ctx, path) {
|
|
|
4111
4482
|
return cur;
|
|
4112
4483
|
};
|
|
4113
4484
|
}
|
|
4114
|
-
function traverse(value, depth =
|
|
4115
|
-
if (
|
|
4485
|
+
function traverse(value, depth, currentDepth = 0, seen) {
|
|
4486
|
+
if (!isObject(value) || value["__v_skip"]) {
|
|
4116
4487
|
return value;
|
|
4117
4488
|
}
|
|
4489
|
+
if (depth && depth > 0) {
|
|
4490
|
+
if (currentDepth >= depth) {
|
|
4491
|
+
return value;
|
|
4492
|
+
}
|
|
4493
|
+
currentDepth++;
|
|
4494
|
+
}
|
|
4118
4495
|
seen = seen || /* @__PURE__ */ new Set();
|
|
4119
4496
|
if (seen.has(value)) {
|
|
4120
4497
|
return value;
|
|
4121
4498
|
}
|
|
4122
4499
|
seen.add(value);
|
|
4123
|
-
depth--;
|
|
4124
4500
|
if (isRef(value)) {
|
|
4125
|
-
traverse(value.value, depth, seen);
|
|
4501
|
+
traverse(value.value, depth, currentDepth, seen);
|
|
4126
4502
|
} else if (isArray(value)) {
|
|
4127
4503
|
for (let i = 0; i < value.length; i++) {
|
|
4128
|
-
traverse(value[i], depth, seen);
|
|
4504
|
+
traverse(value[i], depth, currentDepth, seen);
|
|
4129
4505
|
}
|
|
4130
4506
|
} else if (isSet(value) || isMap(value)) {
|
|
4131
4507
|
value.forEach((v) => {
|
|
4132
|
-
traverse(v, depth, seen);
|
|
4508
|
+
traverse(v, depth, currentDepth, seen);
|
|
4133
4509
|
});
|
|
4134
4510
|
} else if (isPlainObject(value)) {
|
|
4135
4511
|
for (const key in value) {
|
|
4136
|
-
traverse(value[key], depth, seen);
|
|
4512
|
+
traverse(value[key], depth, currentDepth, seen);
|
|
4137
4513
|
}
|
|
4138
4514
|
}
|
|
4139
4515
|
return value;
|
|
@@ -4249,24 +4625,7 @@ const BaseTransitionImpl = {
|
|
|
4249
4625
|
if (!children || !children.length) {
|
|
4250
4626
|
return;
|
|
4251
4627
|
}
|
|
4252
|
-
|
|
4253
|
-
if (children.length > 1) {
|
|
4254
|
-
let hasFound = false;
|
|
4255
|
-
for (const c of children) {
|
|
4256
|
-
if (c.type !== Comment) {
|
|
4257
|
-
if (!!(process.env.NODE_ENV !== "production") && hasFound) {
|
|
4258
|
-
warn$1(
|
|
4259
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4260
|
-
);
|
|
4261
|
-
break;
|
|
4262
|
-
}
|
|
4263
|
-
child = c;
|
|
4264
|
-
hasFound = true;
|
|
4265
|
-
if (!!!(process.env.NODE_ENV !== "production"))
|
|
4266
|
-
break;
|
|
4267
|
-
}
|
|
4268
|
-
}
|
|
4269
|
-
}
|
|
4628
|
+
const child = findNonCommentChild(children);
|
|
4270
4629
|
const rawProps = toRaw(props);
|
|
4271
4630
|
const { mode } = rawProps;
|
|
4272
4631
|
if (!!(process.env.NODE_ENV !== "production") && mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -4275,7 +4634,7 @@ const BaseTransitionImpl = {
|
|
|
4275
4634
|
if (state.isLeaving) {
|
|
4276
4635
|
return emptyPlaceholder(child);
|
|
4277
4636
|
}
|
|
4278
|
-
const innerChild =
|
|
4637
|
+
const innerChild = getInnerChild$1(child);
|
|
4279
4638
|
if (!innerChild) {
|
|
4280
4639
|
return emptyPlaceholder(child);
|
|
4281
4640
|
}
|
|
@@ -4287,7 +4646,7 @@ const BaseTransitionImpl = {
|
|
|
4287
4646
|
);
|
|
4288
4647
|
setTransitionHooks(innerChild, enterHooks);
|
|
4289
4648
|
const oldChild = instance.subTree;
|
|
4290
|
-
const oldInnerChild = oldChild &&
|
|
4649
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
4291
4650
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
4292
4651
|
const leavingHooks = resolveTransitionHooks(
|
|
4293
4652
|
oldInnerChild,
|
|
@@ -4296,12 +4655,11 @@ const BaseTransitionImpl = {
|
|
|
4296
4655
|
instance
|
|
4297
4656
|
);
|
|
4298
4657
|
setTransitionHooks(oldInnerChild, leavingHooks);
|
|
4299
|
-
if (mode === "out-in"
|
|
4658
|
+
if (mode === "out-in") {
|
|
4300
4659
|
state.isLeaving = true;
|
|
4301
4660
|
leavingHooks.afterLeave = () => {
|
|
4302
4661
|
state.isLeaving = false;
|
|
4303
|
-
if (instance.
|
|
4304
|
-
instance.effect.dirty = true;
|
|
4662
|
+
if (!(instance.job.flags & 8)) {
|
|
4305
4663
|
instance.update();
|
|
4306
4664
|
}
|
|
4307
4665
|
};
|
|
@@ -4329,6 +4687,27 @@ const BaseTransitionImpl = {
|
|
|
4329
4687
|
{
|
|
4330
4688
|
BaseTransitionImpl.__isBuiltIn = true;
|
|
4331
4689
|
}
|
|
4690
|
+
function findNonCommentChild(children) {
|
|
4691
|
+
let child = children[0];
|
|
4692
|
+
if (children.length > 1) {
|
|
4693
|
+
let hasFound = false;
|
|
4694
|
+
for (const c of children) {
|
|
4695
|
+
if (c.type !== Comment) {
|
|
4696
|
+
if (!!(process.env.NODE_ENV !== "production") && hasFound) {
|
|
4697
|
+
warn$1(
|
|
4698
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4699
|
+
);
|
|
4700
|
+
break;
|
|
4701
|
+
}
|
|
4702
|
+
child = c;
|
|
4703
|
+
hasFound = true;
|
|
4704
|
+
if (!!!(process.env.NODE_ENV !== "production"))
|
|
4705
|
+
break;
|
|
4706
|
+
}
|
|
4707
|
+
}
|
|
4708
|
+
}
|
|
4709
|
+
return child;
|
|
4710
|
+
}
|
|
4332
4711
|
const BaseTransition = BaseTransitionImpl;
|
|
4333
4712
|
function getLeavingNodesForType(state, vnode) {
|
|
4334
4713
|
const { leavingVNodes } = state;
|
|
@@ -4483,8 +4862,11 @@ function emptyPlaceholder(vnode) {
|
|
|
4483
4862
|
return vnode;
|
|
4484
4863
|
}
|
|
4485
4864
|
}
|
|
4486
|
-
function
|
|
4865
|
+
function getInnerChild$1(vnode) {
|
|
4487
4866
|
if (!isKeepAlive(vnode)) {
|
|
4867
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4868
|
+
return findNonCommentChild(vnode.children);
|
|
4869
|
+
}
|
|
4488
4870
|
return vnode;
|
|
4489
4871
|
}
|
|
4490
4872
|
if (!!(process.env.NODE_ENV !== "production") && vnode.component) {
|
|
@@ -4653,7 +5035,6 @@ function defineAsyncComponent(source) {
|
|
|
4653
5035
|
load().then(() => {
|
|
4654
5036
|
loaded.value = true;
|
|
4655
5037
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4656
|
-
instance.parent.effect.dirty = true;
|
|
4657
5038
|
queueJob(instance.parent.update);
|
|
4658
5039
|
}
|
|
4659
5040
|
}).catch((err) => {
|
|
@@ -4820,7 +5201,7 @@ const KeepAliveImpl = {
|
|
|
4820
5201
|
return () => {
|
|
4821
5202
|
pendingCacheKey = null;
|
|
4822
5203
|
if (!slots.default) {
|
|
4823
|
-
return null;
|
|
5204
|
+
return current = null;
|
|
4824
5205
|
}
|
|
4825
5206
|
const children = slots.default();
|
|
4826
5207
|
const rawVNode = children[0];
|
|
@@ -5271,10 +5652,20 @@ function convertLegacyFunctionalComponent(comp) {
|
|
|
5271
5652
|
function renderList(source, renderItem, cache, index) {
|
|
5272
5653
|
let ret;
|
|
5273
5654
|
const cached = cache && cache[index];
|
|
5274
|
-
|
|
5655
|
+
const sourceIsArray = isArray(source);
|
|
5656
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
5657
|
+
if (sourceIsArray || isString(source)) {
|
|
5658
|
+
if (sourceIsReactiveArray) {
|
|
5659
|
+
source = shallowReadArray(source);
|
|
5660
|
+
}
|
|
5275
5661
|
ret = new Array(source.length);
|
|
5276
5662
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
5277
|
-
ret[i] = renderItem(
|
|
5663
|
+
ret[i] = renderItem(
|
|
5664
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
5665
|
+
i,
|
|
5666
|
+
void 0,
|
|
5667
|
+
cached && cached[i]
|
|
5668
|
+
);
|
|
5278
5669
|
}
|
|
5279
5670
|
} else if (typeof source === "number") {
|
|
5280
5671
|
if (!!(process.env.NODE_ENV !== "production") && !Number.isInteger(source)) {
|
|
@@ -5645,7 +6036,6 @@ const publicPropertiesMap = (
|
|
|
5645
6036
|
$emit: (i) => i.emit,
|
|
5646
6037
|
$options: (i) => __VUE_OPTIONS_API__ ? resolveMergedOptions(i) : i.type,
|
|
5647
6038
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
5648
|
-
i.effect.dirty = true;
|
|
5649
6039
|
queueJob(i.update);
|
|
5650
6040
|
}),
|
|
5651
6041
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -6518,13 +6908,13 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6518
6908
|
return vm;
|
|
6519
6909
|
}
|
|
6520
6910
|
}
|
|
6521
|
-
Vue.version = `2.6.14-compat:${"3.
|
|
6911
|
+
Vue.version = `2.6.14-compat:${"3.5.0-alpha.1"}`;
|
|
6522
6912
|
Vue.config = singletonApp.config;
|
|
6523
|
-
Vue.use = (
|
|
6524
|
-
if (
|
|
6525
|
-
|
|
6526
|
-
} else if (isFunction(
|
|
6527
|
-
|
|
6913
|
+
Vue.use = (p, ...options) => {
|
|
6914
|
+
if (p && isFunction(p.install)) {
|
|
6915
|
+
p.install(Vue, ...options);
|
|
6916
|
+
} else if (isFunction(p)) {
|
|
6917
|
+
p(Vue, ...options);
|
|
6528
6918
|
}
|
|
6529
6919
|
return Vue;
|
|
6530
6920
|
};
|
|
@@ -7539,7 +7929,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
|
|
|
7539
7929
|
function assertType(value, type) {
|
|
7540
7930
|
let valid;
|
|
7541
7931
|
const expectedType = getType(type);
|
|
7542
|
-
if (
|
|
7932
|
+
if (expectedType === "null") {
|
|
7933
|
+
valid = value === null;
|
|
7934
|
+
} else if (isSimpleType(expectedType)) {
|
|
7543
7935
|
const t = typeof value;
|
|
7544
7936
|
valid = t === expectedType.toLowerCase();
|
|
7545
7937
|
if (!valid && t === "object") {
|
|
@@ -7549,8 +7941,6 @@ function assertType(value, type) {
|
|
|
7549
7941
|
valid = isObject(value);
|
|
7550
7942
|
} else if (expectedType === "Array") {
|
|
7551
7943
|
valid = isArray(value);
|
|
7552
|
-
} else if (expectedType === "null") {
|
|
7553
|
-
valid = value === null;
|
|
7554
7944
|
} else {
|
|
7555
7945
|
valid = value instanceof type;
|
|
7556
7946
|
}
|
|
@@ -7645,7 +8035,7 @@ const initSlots = (instance, children) => {
|
|
|
7645
8035
|
const type = children._;
|
|
7646
8036
|
if (type) {
|
|
7647
8037
|
extend(slots, children);
|
|
7648
|
-
def(slots, "_", type
|
|
8038
|
+
def(slots, "_", type);
|
|
7649
8039
|
} else {
|
|
7650
8040
|
normalizeObjectSlots(children, slots, instance);
|
|
7651
8041
|
}
|
|
@@ -9123,7 +9513,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9123
9513
|
} else {
|
|
9124
9514
|
instance.next = n2;
|
|
9125
9515
|
invalidateJob(instance.update);
|
|
9126
|
-
instance.effect.dirty = true;
|
|
9127
9516
|
instance.update();
|
|
9128
9517
|
}
|
|
9129
9518
|
} else {
|
|
@@ -9330,24 +9719,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9330
9719
|
}
|
|
9331
9720
|
}
|
|
9332
9721
|
};
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
);
|
|
9340
|
-
const update = instance.update = () => {
|
|
9341
|
-
if (effect.dirty) {
|
|
9342
|
-
effect.run();
|
|
9343
|
-
}
|
|
9344
|
-
};
|
|
9345
|
-
update.id = instance.uid;
|
|
9722
|
+
instance.scope.on();
|
|
9723
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
9724
|
+
instance.scope.off();
|
|
9725
|
+
const update = instance.update = effect.run.bind(effect);
|
|
9726
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
9727
|
+
job.id = instance.uid;
|
|
9728
|
+
effect.scheduler = () => queueJob(job);
|
|
9346
9729
|
toggleRecurse(instance, true);
|
|
9347
9730
|
if (!!(process.env.NODE_ENV !== "production")) {
|
|
9348
9731
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
9349
9732
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
9350
|
-
|
|
9733
|
+
job.ownerInstance = instance;
|
|
9351
9734
|
}
|
|
9352
9735
|
update();
|
|
9353
9736
|
};
|
|
@@ -9814,7 +10197,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9814
10197
|
if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
|
|
9815
10198
|
unregisterHMR(instance);
|
|
9816
10199
|
}
|
|
9817
|
-
const { bum, scope,
|
|
10200
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
9818
10201
|
if (bum) {
|
|
9819
10202
|
invokeArrayFns(bum);
|
|
9820
10203
|
}
|
|
@@ -9822,8 +10205,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9822
10205
|
instance.emit("hook:beforeDestroy");
|
|
9823
10206
|
}
|
|
9824
10207
|
scope.stop();
|
|
9825
|
-
if (
|
|
9826
|
-
|
|
10208
|
+
if (job) {
|
|
10209
|
+
job.flags |= 8;
|
|
9827
10210
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
9828
10211
|
}
|
|
9829
10212
|
if (um) {
|
|
@@ -9915,8 +10298,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9915
10298
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
9916
10299
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
9917
10300
|
}
|
|
9918
|
-
function toggleRecurse({ effect,
|
|
9919
|
-
|
|
10301
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
10302
|
+
if (allowed) {
|
|
10303
|
+
effect.flags |= 32;
|
|
10304
|
+
job.flags |= 4;
|
|
10305
|
+
} else {
|
|
10306
|
+
effect.flags &= ~32;
|
|
10307
|
+
job.flags &= ~4;
|
|
10308
|
+
}
|
|
9920
10309
|
}
|
|
9921
10310
|
function needTransition(parentSuspense, transition) {
|
|
9922
10311
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -10532,8 +10921,8 @@ function guardReactiveProps(props) {
|
|
|
10532
10921
|
return null;
|
|
10533
10922
|
return isProxy(props) || isInternalObject(props) ? extend({}, props) : props;
|
|
10534
10923
|
}
|
|
10535
|
-
function cloneVNode(vnode, extraProps, mergeRef = false
|
|
10536
|
-
const { props, ref, patchFlag, children
|
|
10924
|
+
function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
10925
|
+
const { props, ref, patchFlag, children } = vnode;
|
|
10537
10926
|
const mergedProps = extraProps ? mergeProps(props || {}, extraProps) : props;
|
|
10538
10927
|
const cloned = {
|
|
10539
10928
|
__v_isVNode: true,
|
|
@@ -10563,7 +10952,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
10563
10952
|
dynamicChildren: vnode.dynamicChildren,
|
|
10564
10953
|
appContext: vnode.appContext,
|
|
10565
10954
|
dirs: vnode.dirs,
|
|
10566
|
-
transition,
|
|
10955
|
+
transition: vnode.transition,
|
|
10567
10956
|
// These should technically only be non-null on mounted VNodes. However,
|
|
10568
10957
|
// they *should* be copied for kept-alive vnodes. So we just always copy
|
|
10569
10958
|
// them since them being non-null during a mount doesn't affect the logic as
|
|
@@ -10577,9 +10966,6 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
10577
10966
|
ctx: vnode.ctx,
|
|
10578
10967
|
ce: vnode.ce
|
|
10579
10968
|
};
|
|
10580
|
-
if (transition && cloneTransition) {
|
|
10581
|
-
cloned.transition = transition.clone(cloned);
|
|
10582
|
-
}
|
|
10583
10969
|
{
|
|
10584
10970
|
defineLegacyVNodeProperties(cloned);
|
|
10585
10971
|
}
|
|
@@ -10717,6 +11103,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
10717
11103
|
effect: null,
|
|
10718
11104
|
update: null,
|
|
10719
11105
|
// will be set synchronously right after creation
|
|
11106
|
+
job: null,
|
|
10720
11107
|
scope: new EffectScope(
|
|
10721
11108
|
true
|
|
10722
11109
|
/* detached */
|
|
@@ -11253,7 +11640,8 @@ function initCustomFormatter() {
|
|
|
11253
11640
|
{},
|
|
11254
11641
|
["span", vueStyle, genRefFlag(obj)],
|
|
11255
11642
|
"<",
|
|
11256
|
-
|
|
11643
|
+
// avoid debugger accessing value affecting behavior
|
|
11644
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
11257
11645
|
`>`
|
|
11258
11646
|
];
|
|
11259
11647
|
} else if (isReactive(obj)) {
|
|
@@ -11433,7 +11821,7 @@ function isMemoSame(cached, memo) {
|
|
|
11433
11821
|
return true;
|
|
11434
11822
|
}
|
|
11435
11823
|
|
|
11436
|
-
const version = "3.
|
|
11824
|
+
const version = "3.5.0-alpha.1";
|
|
11437
11825
|
const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
|
|
11438
11826
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
11439
11827
|
const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
|
|
@@ -13049,7 +13437,9 @@ const withKeys = (fn, modifiers) => {
|
|
|
13049
13437
|
return;
|
|
13050
13438
|
}
|
|
13051
13439
|
const eventKey = hyphenate(event.key);
|
|
13052
|
-
if (modifiers.some(
|
|
13440
|
+
if (modifiers.some(
|
|
13441
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
13442
|
+
)) {
|
|
13053
13443
|
return fn(event);
|
|
13054
13444
|
}
|
|
13055
13445
|
{
|