vue 3.4.26 → 3.5.0-alpha.2
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 +1 -1
- package/dist/vue.cjs.prod.js +1 -1
- package/dist/vue.esm-browser.js +993 -418
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +1 -1
- package/dist/vue.global.js +993 -418
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +818 -417
- package/dist/vue.runtime.esm-browser.prod.js +6 -6
- package/dist/vue.runtime.esm-bundler.js +1 -1
- package/dist/vue.runtime.global.js +818 -417
- package/dist/vue.runtime.global.prod.js +6 -6
- package/package.json +6 -6
package/dist/vue.global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vue v3.
|
|
2
|
+
* vue v3.5.0-alpha.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -453,156 +453,280 @@ var Vue = (function (exports) {
|
|
|
453
453
|
function effectScope(detached) {
|
|
454
454
|
return new EffectScope(detached);
|
|
455
455
|
}
|
|
456
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
457
|
-
if (scope && scope.active) {
|
|
458
|
-
scope.effects.push(effect);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
456
|
function getCurrentScope() {
|
|
462
457
|
return activeEffectScope;
|
|
463
458
|
}
|
|
464
|
-
function onScopeDispose(fn) {
|
|
459
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
465
460
|
if (activeEffectScope) {
|
|
466
461
|
activeEffectScope.cleanups.push(fn);
|
|
467
|
-
} else {
|
|
462
|
+
} else if (!failSilently) {
|
|
468
463
|
warn$2(
|
|
469
464
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
470
465
|
);
|
|
471
466
|
}
|
|
472
467
|
}
|
|
473
468
|
|
|
474
|
-
let
|
|
469
|
+
let activeSub;
|
|
475
470
|
class ReactiveEffect {
|
|
476
|
-
constructor(fn
|
|
471
|
+
constructor(fn) {
|
|
477
472
|
this.fn = fn;
|
|
478
|
-
this.trigger = trigger;
|
|
479
|
-
this.scheduler = scheduler;
|
|
480
|
-
this.active = true;
|
|
481
|
-
this.deps = [];
|
|
482
473
|
/**
|
|
483
474
|
* @internal
|
|
484
475
|
*/
|
|
485
|
-
this.
|
|
476
|
+
this.deps = void 0;
|
|
486
477
|
/**
|
|
487
478
|
* @internal
|
|
488
479
|
*/
|
|
489
|
-
this.
|
|
480
|
+
this.depsTail = void 0;
|
|
490
481
|
/**
|
|
491
482
|
* @internal
|
|
492
483
|
*/
|
|
493
|
-
this.
|
|
484
|
+
this.flags = 1 | 4;
|
|
494
485
|
/**
|
|
495
486
|
* @internal
|
|
496
487
|
*/
|
|
497
|
-
this.
|
|
488
|
+
this.nextEffect = void 0;
|
|
498
489
|
/**
|
|
499
490
|
* @internal
|
|
500
491
|
*/
|
|
501
|
-
this.
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
506
|
-
this._dirtyLevel = 1;
|
|
507
|
-
pauseTracking();
|
|
508
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
509
|
-
const dep = this.deps[i];
|
|
510
|
-
if (dep.computed) {
|
|
511
|
-
triggerComputed(dep.computed);
|
|
512
|
-
if (this._dirtyLevel >= 4) {
|
|
513
|
-
break;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
if (this._dirtyLevel === 1) {
|
|
518
|
-
this._dirtyLevel = 0;
|
|
519
|
-
}
|
|
520
|
-
resetTracking();
|
|
492
|
+
this.cleanup = void 0;
|
|
493
|
+
this.scheduler = void 0;
|
|
494
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
495
|
+
activeEffectScope.effects.push(this);
|
|
521
496
|
}
|
|
522
|
-
return this._dirtyLevel >= 4;
|
|
523
497
|
}
|
|
524
|
-
|
|
525
|
-
|
|
498
|
+
/**
|
|
499
|
+
* @internal
|
|
500
|
+
*/
|
|
501
|
+
notify() {
|
|
502
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
503
|
+
return;
|
|
504
|
+
}
|
|
505
|
+
if (this.flags & 64) {
|
|
506
|
+
return this.trigger();
|
|
507
|
+
}
|
|
508
|
+
if (!(this.flags & 8)) {
|
|
509
|
+
this.flags |= 8;
|
|
510
|
+
this.nextEffect = batchedEffect;
|
|
511
|
+
batchedEffect = this;
|
|
512
|
+
}
|
|
526
513
|
}
|
|
527
514
|
run() {
|
|
528
|
-
this.
|
|
529
|
-
if (!this.active) {
|
|
515
|
+
if (!(this.flags & 1)) {
|
|
530
516
|
return this.fn();
|
|
531
517
|
}
|
|
532
|
-
|
|
533
|
-
|
|
518
|
+
this.flags |= 2;
|
|
519
|
+
cleanupEffect(this);
|
|
520
|
+
prepareDeps(this);
|
|
521
|
+
const prevEffect = activeSub;
|
|
522
|
+
const prevShouldTrack = shouldTrack;
|
|
523
|
+
activeSub = this;
|
|
524
|
+
shouldTrack = true;
|
|
534
525
|
try {
|
|
535
|
-
shouldTrack = true;
|
|
536
|
-
activeEffect = this;
|
|
537
|
-
this._runnings++;
|
|
538
|
-
preCleanupEffect(this);
|
|
539
526
|
return this.fn();
|
|
540
527
|
} finally {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
528
|
+
if (activeSub !== this) {
|
|
529
|
+
warn$2(
|
|
530
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
531
|
+
);
|
|
532
|
+
}
|
|
533
|
+
cleanupDeps(this);
|
|
534
|
+
activeSub = prevEffect;
|
|
535
|
+
shouldTrack = prevShouldTrack;
|
|
536
|
+
this.flags &= ~2;
|
|
545
537
|
}
|
|
546
538
|
}
|
|
547
539
|
stop() {
|
|
548
|
-
if (this.
|
|
549
|
-
|
|
550
|
-
|
|
540
|
+
if (this.flags & 1) {
|
|
541
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
542
|
+
removeSub(link);
|
|
543
|
+
}
|
|
544
|
+
this.deps = this.depsTail = void 0;
|
|
545
|
+
cleanupEffect(this);
|
|
551
546
|
this.onStop && this.onStop();
|
|
552
|
-
this.
|
|
547
|
+
this.flags &= ~1;
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
trigger() {
|
|
551
|
+
if (this.scheduler) {
|
|
552
|
+
this.scheduler();
|
|
553
|
+
} else {
|
|
554
|
+
this.runIfDirty();
|
|
553
555
|
}
|
|
554
556
|
}
|
|
557
|
+
/**
|
|
558
|
+
* @internal
|
|
559
|
+
*/
|
|
560
|
+
runIfDirty() {
|
|
561
|
+
if (isDirty(this)) {
|
|
562
|
+
this.run();
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
get dirty() {
|
|
566
|
+
return isDirty(this);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
let batchDepth = 0;
|
|
570
|
+
let batchedEffect;
|
|
571
|
+
function startBatch() {
|
|
572
|
+
batchDepth++;
|
|
573
|
+
}
|
|
574
|
+
function endBatch() {
|
|
575
|
+
if (batchDepth > 1) {
|
|
576
|
+
batchDepth--;
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
let error;
|
|
580
|
+
while (batchedEffect) {
|
|
581
|
+
let e = batchedEffect;
|
|
582
|
+
batchedEffect = void 0;
|
|
583
|
+
while (e) {
|
|
584
|
+
const next = e.nextEffect;
|
|
585
|
+
e.nextEffect = void 0;
|
|
586
|
+
e.flags &= ~8;
|
|
587
|
+
if (e.flags & 1) {
|
|
588
|
+
try {
|
|
589
|
+
e.trigger();
|
|
590
|
+
} catch (err) {
|
|
591
|
+
if (!error)
|
|
592
|
+
error = err;
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
e = next;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
batchDepth--;
|
|
599
|
+
if (error)
|
|
600
|
+
throw error;
|
|
601
|
+
}
|
|
602
|
+
function prepareDeps(sub) {
|
|
603
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
604
|
+
link.version = -1;
|
|
605
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
606
|
+
link.dep.activeLink = link;
|
|
607
|
+
}
|
|
555
608
|
}
|
|
556
|
-
function
|
|
557
|
-
|
|
609
|
+
function cleanupDeps(sub) {
|
|
610
|
+
let head;
|
|
611
|
+
let tail = sub.depsTail;
|
|
612
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
613
|
+
if (link.version === -1) {
|
|
614
|
+
if (link === tail)
|
|
615
|
+
tail = link.prevDep;
|
|
616
|
+
removeSub(link);
|
|
617
|
+
removeDep(link);
|
|
618
|
+
} else {
|
|
619
|
+
head = link;
|
|
620
|
+
}
|
|
621
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
622
|
+
link.prevActiveLink = void 0;
|
|
623
|
+
}
|
|
624
|
+
sub.deps = head;
|
|
625
|
+
sub.depsTail = tail;
|
|
558
626
|
}
|
|
559
|
-
function
|
|
560
|
-
|
|
561
|
-
|
|
627
|
+
function isDirty(sub) {
|
|
628
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
629
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
630
|
+
return true;
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
if (sub._dirty) {
|
|
634
|
+
return true;
|
|
635
|
+
}
|
|
636
|
+
return false;
|
|
562
637
|
}
|
|
563
|
-
function
|
|
564
|
-
if (
|
|
565
|
-
|
|
566
|
-
|
|
638
|
+
function refreshComputed(computed) {
|
|
639
|
+
if (computed.flags & 2) {
|
|
640
|
+
return false;
|
|
641
|
+
}
|
|
642
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
computed.flags &= ~16;
|
|
646
|
+
if (computed.globalVersion === globalVersion) {
|
|
647
|
+
return;
|
|
648
|
+
}
|
|
649
|
+
computed.globalVersion = globalVersion;
|
|
650
|
+
const dep = computed.dep;
|
|
651
|
+
computed.flags |= 2;
|
|
652
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
653
|
+
computed.flags &= ~2;
|
|
654
|
+
return;
|
|
655
|
+
}
|
|
656
|
+
const prevSub = activeSub;
|
|
657
|
+
const prevShouldTrack = shouldTrack;
|
|
658
|
+
activeSub = computed;
|
|
659
|
+
shouldTrack = true;
|
|
660
|
+
try {
|
|
661
|
+
prepareDeps(computed);
|
|
662
|
+
const value = computed.fn();
|
|
663
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
664
|
+
computed._value = value;
|
|
665
|
+
dep.version++;
|
|
567
666
|
}
|
|
568
|
-
|
|
667
|
+
} catch (err) {
|
|
668
|
+
dep.version++;
|
|
669
|
+
throw err;
|
|
670
|
+
} finally {
|
|
671
|
+
activeSub = prevSub;
|
|
672
|
+
shouldTrack = prevShouldTrack;
|
|
673
|
+
cleanupDeps(computed);
|
|
674
|
+
computed.flags &= ~2;
|
|
569
675
|
}
|
|
570
676
|
}
|
|
571
|
-
function
|
|
572
|
-
const
|
|
573
|
-
if (
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
677
|
+
function removeSub(link) {
|
|
678
|
+
const { dep, prevSub, nextSub } = link;
|
|
679
|
+
if (prevSub) {
|
|
680
|
+
prevSub.nextSub = nextSub;
|
|
681
|
+
link.prevSub = void 0;
|
|
682
|
+
}
|
|
683
|
+
if (nextSub) {
|
|
684
|
+
nextSub.prevSub = prevSub;
|
|
685
|
+
link.nextSub = void 0;
|
|
686
|
+
}
|
|
687
|
+
if (dep.subs === link) {
|
|
688
|
+
dep.subs = prevSub;
|
|
689
|
+
}
|
|
690
|
+
if (!dep.subs && dep.computed) {
|
|
691
|
+
dep.computed.flags &= ~4;
|
|
692
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
693
|
+
removeSub(l);
|
|
577
694
|
}
|
|
578
695
|
}
|
|
579
696
|
}
|
|
697
|
+
function removeDep(link) {
|
|
698
|
+
const { prevDep, nextDep } = link;
|
|
699
|
+
if (prevDep) {
|
|
700
|
+
prevDep.nextDep = nextDep;
|
|
701
|
+
link.prevDep = void 0;
|
|
702
|
+
}
|
|
703
|
+
if (nextDep) {
|
|
704
|
+
nextDep.prevDep = prevDep;
|
|
705
|
+
link.nextDep = void 0;
|
|
706
|
+
}
|
|
707
|
+
}
|
|
580
708
|
function effect(fn, options) {
|
|
581
709
|
if (fn.effect instanceof ReactiveEffect) {
|
|
582
710
|
fn = fn.effect.fn;
|
|
583
711
|
}
|
|
584
|
-
const
|
|
585
|
-
if (_effect.dirty) {
|
|
586
|
-
_effect.run();
|
|
587
|
-
}
|
|
588
|
-
});
|
|
712
|
+
const e = new ReactiveEffect(fn);
|
|
589
713
|
if (options) {
|
|
590
|
-
extend(
|
|
591
|
-
if (options.scope)
|
|
592
|
-
recordEffectScope(_effect, options.scope);
|
|
714
|
+
extend(e, options);
|
|
593
715
|
}
|
|
594
|
-
|
|
595
|
-
|
|
716
|
+
try {
|
|
717
|
+
e.run();
|
|
718
|
+
} catch (err) {
|
|
719
|
+
e.stop();
|
|
720
|
+
throw err;
|
|
596
721
|
}
|
|
597
|
-
const runner =
|
|
598
|
-
runner.effect =
|
|
722
|
+
const runner = e.run.bind(e);
|
|
723
|
+
runner.effect = e;
|
|
599
724
|
return runner;
|
|
600
725
|
}
|
|
601
726
|
function stop(runner) {
|
|
602
727
|
runner.effect.stop();
|
|
603
728
|
}
|
|
604
729
|
let shouldTrack = true;
|
|
605
|
-
let pauseScheduleStack = 0;
|
|
606
730
|
const trackStack = [];
|
|
607
731
|
function pauseTracking() {
|
|
608
732
|
trackStack.push(shouldTrack);
|
|
@@ -612,192 +736,414 @@ var Vue = (function (exports) {
|
|
|
612
736
|
const last = trackStack.pop();
|
|
613
737
|
shouldTrack = last === void 0 ? true : last;
|
|
614
738
|
}
|
|
615
|
-
function
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
739
|
+
function cleanupEffect(e) {
|
|
740
|
+
const { cleanup } = e;
|
|
741
|
+
e.cleanup = void 0;
|
|
742
|
+
if (cleanup) {
|
|
743
|
+
const prevSub = activeSub;
|
|
744
|
+
activeSub = void 0;
|
|
745
|
+
try {
|
|
746
|
+
cleanup();
|
|
747
|
+
} finally {
|
|
748
|
+
activeSub = prevSub;
|
|
749
|
+
}
|
|
622
750
|
}
|
|
623
751
|
}
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
752
|
+
|
|
753
|
+
let globalVersion = 0;
|
|
754
|
+
class Dep {
|
|
755
|
+
constructor(computed) {
|
|
756
|
+
this.computed = computed;
|
|
757
|
+
this.version = 0;
|
|
758
|
+
/**
|
|
759
|
+
* Link between this dep and the current active effect
|
|
760
|
+
*/
|
|
761
|
+
this.activeLink = void 0;
|
|
762
|
+
/**
|
|
763
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
764
|
+
*/
|
|
765
|
+
this.subs = void 0;
|
|
637
766
|
{
|
|
638
|
-
|
|
767
|
+
this.subsHead = void 0;
|
|
639
768
|
}
|
|
640
769
|
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
770
|
+
track(debugInfo) {
|
|
771
|
+
if (!activeSub || !shouldTrack) {
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
let link = this.activeLink;
|
|
775
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
776
|
+
link = this.activeLink = {
|
|
777
|
+
dep: this,
|
|
778
|
+
sub: activeSub,
|
|
779
|
+
version: this.version,
|
|
780
|
+
nextDep: void 0,
|
|
781
|
+
prevDep: void 0,
|
|
782
|
+
nextSub: void 0,
|
|
783
|
+
prevSub: void 0,
|
|
784
|
+
prevActiveLink: void 0
|
|
785
|
+
};
|
|
786
|
+
if (!activeSub.deps) {
|
|
787
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
788
|
+
} else {
|
|
789
|
+
link.prevDep = activeSub.depsTail;
|
|
790
|
+
activeSub.depsTail.nextDep = link;
|
|
791
|
+
activeSub.depsTail = link;
|
|
655
792
|
}
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
793
|
+
if (activeSub.flags & 4) {
|
|
794
|
+
addSub(link);
|
|
795
|
+
}
|
|
796
|
+
} else if (link.version === -1) {
|
|
797
|
+
link.version = this.version;
|
|
798
|
+
if (link.nextDep) {
|
|
799
|
+
const next = link.nextDep;
|
|
800
|
+
next.prevDep = link.prevDep;
|
|
801
|
+
if (link.prevDep) {
|
|
802
|
+
link.prevDep.nextDep = next;
|
|
803
|
+
}
|
|
804
|
+
link.prevDep = activeSub.depsTail;
|
|
805
|
+
link.nextDep = void 0;
|
|
806
|
+
activeSub.depsTail.nextDep = link;
|
|
807
|
+
activeSub.depsTail = link;
|
|
808
|
+
if (activeSub.deps === link) {
|
|
809
|
+
activeSub.deps = next;
|
|
661
810
|
}
|
|
662
811
|
}
|
|
663
812
|
}
|
|
813
|
+
if (activeSub.onTrack) {
|
|
814
|
+
activeSub.onTrack(
|
|
815
|
+
extend(
|
|
816
|
+
{
|
|
817
|
+
effect: activeSub
|
|
818
|
+
},
|
|
819
|
+
debugInfo
|
|
820
|
+
)
|
|
821
|
+
);
|
|
822
|
+
}
|
|
823
|
+
return link;
|
|
824
|
+
}
|
|
825
|
+
trigger(debugInfo) {
|
|
826
|
+
this.version++;
|
|
827
|
+
globalVersion++;
|
|
828
|
+
this.notify(debugInfo);
|
|
829
|
+
}
|
|
830
|
+
notify(debugInfo) {
|
|
831
|
+
startBatch();
|
|
832
|
+
try {
|
|
833
|
+
if (true) {
|
|
834
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
835
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
836
|
+
head.sub.onTrigger(
|
|
837
|
+
extend(
|
|
838
|
+
{
|
|
839
|
+
effect: head.sub
|
|
840
|
+
},
|
|
841
|
+
debugInfo
|
|
842
|
+
)
|
|
843
|
+
);
|
|
844
|
+
}
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
848
|
+
link.sub.notify();
|
|
849
|
+
}
|
|
850
|
+
} finally {
|
|
851
|
+
endBatch();
|
|
852
|
+
}
|
|
664
853
|
}
|
|
665
|
-
resetScheduling();
|
|
666
854
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
855
|
+
function addSub(link) {
|
|
856
|
+
const computed = link.dep.computed;
|
|
857
|
+
if (computed && !link.dep.subs) {
|
|
858
|
+
computed.flags |= 4 | 16;
|
|
859
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
860
|
+
addSub(l);
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
const currentTail = link.dep.subs;
|
|
864
|
+
if (currentTail !== link) {
|
|
865
|
+
link.prevSub = currentTail;
|
|
866
|
+
if (currentTail)
|
|
867
|
+
currentTail.nextSub = link;
|
|
868
|
+
}
|
|
869
|
+
if (link.dep.subsHead === void 0) {
|
|
870
|
+
link.dep.subsHead = link;
|
|
871
|
+
}
|
|
872
|
+
link.dep.subs = link;
|
|
873
|
+
}
|
|
675
874
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
676
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
677
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
875
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
876
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
877
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
678
878
|
function track(target, type, key) {
|
|
679
|
-
if (shouldTrack &&
|
|
879
|
+
if (shouldTrack && activeSub) {
|
|
680
880
|
let depsMap = targetMap.get(target);
|
|
681
881
|
if (!depsMap) {
|
|
682
882
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
683
883
|
}
|
|
684
884
|
let dep = depsMap.get(key);
|
|
685
885
|
if (!dep) {
|
|
686
|
-
depsMap.set(key, dep =
|
|
886
|
+
depsMap.set(key, dep = new Dep());
|
|
687
887
|
}
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
dep,
|
|
691
|
-
{
|
|
888
|
+
{
|
|
889
|
+
dep.track({
|
|
692
890
|
target,
|
|
693
891
|
type,
|
|
694
892
|
key
|
|
695
|
-
}
|
|
696
|
-
|
|
893
|
+
});
|
|
894
|
+
}
|
|
697
895
|
}
|
|
698
896
|
}
|
|
699
897
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
700
898
|
const depsMap = targetMap.get(target);
|
|
701
899
|
if (!depsMap) {
|
|
900
|
+
globalVersion++;
|
|
702
901
|
return;
|
|
703
902
|
}
|
|
704
903
|
let deps = [];
|
|
705
904
|
if (type === "clear") {
|
|
706
905
|
deps = [...depsMap.values()];
|
|
707
|
-
} else if (key === "length" && isArray(target)) {
|
|
708
|
-
const newLength = Number(newValue);
|
|
709
|
-
depsMap.forEach((dep, key2) => {
|
|
710
|
-
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
|
711
|
-
deps.push(dep);
|
|
712
|
-
}
|
|
713
|
-
});
|
|
714
906
|
} else {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
if (!
|
|
721
|
-
deps.push(
|
|
722
|
-
if (isMap(target)) {
|
|
723
|
-
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
724
|
-
}
|
|
725
|
-
} else if (isIntegerKey(key)) {
|
|
726
|
-
deps.push(depsMap.get("length"));
|
|
907
|
+
const targetIsArray = isArray(target);
|
|
908
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
909
|
+
if (targetIsArray && key === "length") {
|
|
910
|
+
const newLength = Number(newValue);
|
|
911
|
+
depsMap.forEach((dep, key2) => {
|
|
912
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
913
|
+
deps.push(dep);
|
|
727
914
|
}
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
915
|
+
});
|
|
916
|
+
} else {
|
|
917
|
+
const push = (dep) => dep && deps.push(dep);
|
|
918
|
+
if (key !== void 0) {
|
|
919
|
+
push(depsMap.get(key));
|
|
920
|
+
}
|
|
921
|
+
if (isArrayIndex) {
|
|
922
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
923
|
+
}
|
|
924
|
+
switch (type) {
|
|
925
|
+
case "add":
|
|
926
|
+
if (!targetIsArray) {
|
|
927
|
+
push(depsMap.get(ITERATE_KEY));
|
|
928
|
+
if (isMap(target)) {
|
|
929
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
930
|
+
}
|
|
931
|
+
} else if (isArrayIndex) {
|
|
932
|
+
push(depsMap.get("length"));
|
|
933
|
+
}
|
|
934
|
+
break;
|
|
935
|
+
case "delete":
|
|
936
|
+
if (!targetIsArray) {
|
|
937
|
+
push(depsMap.get(ITERATE_KEY));
|
|
938
|
+
if (isMap(target)) {
|
|
939
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
940
|
+
}
|
|
941
|
+
}
|
|
942
|
+
break;
|
|
943
|
+
case "set":
|
|
732
944
|
if (isMap(target)) {
|
|
733
|
-
|
|
945
|
+
push(depsMap.get(ITERATE_KEY));
|
|
734
946
|
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
case "set":
|
|
738
|
-
if (isMap(target)) {
|
|
739
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
740
|
-
}
|
|
741
|
-
break;
|
|
947
|
+
break;
|
|
948
|
+
}
|
|
742
949
|
}
|
|
743
950
|
}
|
|
744
|
-
|
|
951
|
+
startBatch();
|
|
745
952
|
for (const dep of deps) {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
oldValue,
|
|
756
|
-
oldTarget
|
|
757
|
-
}
|
|
758
|
-
);
|
|
953
|
+
{
|
|
954
|
+
dep.trigger({
|
|
955
|
+
target,
|
|
956
|
+
type,
|
|
957
|
+
key,
|
|
958
|
+
newValue,
|
|
959
|
+
oldValue,
|
|
960
|
+
oldTarget
|
|
961
|
+
});
|
|
759
962
|
}
|
|
760
963
|
}
|
|
761
|
-
|
|
964
|
+
endBatch();
|
|
762
965
|
}
|
|
763
966
|
function getDepFromReactive(object, key) {
|
|
764
|
-
|
|
765
|
-
return
|
|
967
|
+
var _a;
|
|
968
|
+
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
function reactiveReadArray(array) {
|
|
972
|
+
const raw = toRaw(array);
|
|
973
|
+
if (raw === array)
|
|
974
|
+
return raw;
|
|
975
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
976
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
977
|
+
}
|
|
978
|
+
function shallowReadArray(arr) {
|
|
979
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
980
|
+
return arr;
|
|
981
|
+
}
|
|
982
|
+
const arrayInstrumentations = {
|
|
983
|
+
__proto__: null,
|
|
984
|
+
[Symbol.iterator]() {
|
|
985
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
986
|
+
},
|
|
987
|
+
concat(...args) {
|
|
988
|
+
return reactiveReadArray(this).concat(
|
|
989
|
+
...args.map((x) => reactiveReadArray(x))
|
|
990
|
+
);
|
|
991
|
+
},
|
|
992
|
+
entries() {
|
|
993
|
+
return iterator(this, "entries", (value) => {
|
|
994
|
+
value[1] = toReactive(value[1]);
|
|
995
|
+
return value;
|
|
996
|
+
});
|
|
997
|
+
},
|
|
998
|
+
every(fn, thisArg) {
|
|
999
|
+
return apply(this, "every", fn, thisArg);
|
|
1000
|
+
},
|
|
1001
|
+
filter(fn, thisArg) {
|
|
1002
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
1003
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
1004
|
+
},
|
|
1005
|
+
find(fn, thisArg) {
|
|
1006
|
+
const result = apply(this, "find", fn, thisArg);
|
|
1007
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1008
|
+
},
|
|
1009
|
+
findIndex(fn, thisArg) {
|
|
1010
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
1011
|
+
},
|
|
1012
|
+
findLast(fn, thisArg) {
|
|
1013
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
1014
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1015
|
+
},
|
|
1016
|
+
findLastIndex(fn, thisArg) {
|
|
1017
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
1018
|
+
},
|
|
1019
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
1020
|
+
forEach(fn, thisArg) {
|
|
1021
|
+
return apply(this, "forEach", fn, thisArg);
|
|
1022
|
+
},
|
|
1023
|
+
includes(...args) {
|
|
1024
|
+
return searchProxy(this, "includes", args);
|
|
1025
|
+
},
|
|
1026
|
+
indexOf(...args) {
|
|
1027
|
+
return searchProxy(this, "indexOf", args);
|
|
1028
|
+
},
|
|
1029
|
+
join(separator) {
|
|
1030
|
+
return reactiveReadArray(this).join(separator);
|
|
1031
|
+
},
|
|
1032
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
1033
|
+
lastIndexOf(...args) {
|
|
1034
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
1035
|
+
},
|
|
1036
|
+
map(fn, thisArg) {
|
|
1037
|
+
return apply(this, "map", fn, thisArg);
|
|
1038
|
+
},
|
|
1039
|
+
pop() {
|
|
1040
|
+
return noTracking(this, "pop");
|
|
1041
|
+
},
|
|
1042
|
+
push(...args) {
|
|
1043
|
+
return noTracking(this, "push", args);
|
|
1044
|
+
},
|
|
1045
|
+
reduce(fn, ...args) {
|
|
1046
|
+
return reduce(this, "reduce", fn, args);
|
|
1047
|
+
},
|
|
1048
|
+
reduceRight(fn, ...args) {
|
|
1049
|
+
return reduce(this, "reduceRight", fn, args);
|
|
1050
|
+
},
|
|
1051
|
+
shift() {
|
|
1052
|
+
return noTracking(this, "shift");
|
|
1053
|
+
},
|
|
1054
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
1055
|
+
some(fn, thisArg) {
|
|
1056
|
+
return apply(this, "some", fn, thisArg);
|
|
1057
|
+
},
|
|
1058
|
+
splice(...args) {
|
|
1059
|
+
return noTracking(this, "splice", args);
|
|
1060
|
+
},
|
|
1061
|
+
toReversed() {
|
|
1062
|
+
return reactiveReadArray(this).toReversed();
|
|
1063
|
+
},
|
|
1064
|
+
toSorted(comparer) {
|
|
1065
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
1066
|
+
},
|
|
1067
|
+
toSpliced(...args) {
|
|
1068
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1069
|
+
},
|
|
1070
|
+
unshift(...args) {
|
|
1071
|
+
return noTracking(this, "unshift", args);
|
|
1072
|
+
},
|
|
1073
|
+
values() {
|
|
1074
|
+
return iterator(this, "values", toReactive);
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
function iterator(self, method, wrapValue) {
|
|
1078
|
+
const arr = shallowReadArray(self);
|
|
1079
|
+
const iter = arr[method]();
|
|
1080
|
+
if (arr !== self && !isShallow(self)) {
|
|
1081
|
+
iter._next = iter.next;
|
|
1082
|
+
iter.next = () => {
|
|
1083
|
+
const result = iter._next();
|
|
1084
|
+
if (result.value) {
|
|
1085
|
+
result.value = wrapValue(result.value);
|
|
1086
|
+
}
|
|
1087
|
+
return result;
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
return iter;
|
|
1091
|
+
}
|
|
1092
|
+
function apply(self, method, fn, thisArg) {
|
|
1093
|
+
const arr = shallowReadArray(self);
|
|
1094
|
+
let wrappedFn = fn;
|
|
1095
|
+
if (arr !== self) {
|
|
1096
|
+
if (!isShallow(self)) {
|
|
1097
|
+
wrappedFn = function(item, index) {
|
|
1098
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1099
|
+
};
|
|
1100
|
+
} else if (fn.length > 2) {
|
|
1101
|
+
wrappedFn = function(item, index) {
|
|
1102
|
+
return fn.call(this, item, index, self);
|
|
1103
|
+
};
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
return arr[method](wrappedFn, thisArg);
|
|
1107
|
+
}
|
|
1108
|
+
function reduce(self, method, fn, args) {
|
|
1109
|
+
const arr = shallowReadArray(self);
|
|
1110
|
+
let wrappedFn = fn;
|
|
1111
|
+
if (arr !== self) {
|
|
1112
|
+
if (!isShallow(self)) {
|
|
1113
|
+
wrappedFn = function(acc, item, index) {
|
|
1114
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1115
|
+
};
|
|
1116
|
+
} else if (fn.length > 3) {
|
|
1117
|
+
wrappedFn = function(acc, item, index) {
|
|
1118
|
+
return fn.call(this, acc, item, index, self);
|
|
1119
|
+
};
|
|
1120
|
+
}
|
|
1121
|
+
}
|
|
1122
|
+
return arr[method](wrappedFn, ...args);
|
|
1123
|
+
}
|
|
1124
|
+
function searchProxy(self, method, args) {
|
|
1125
|
+
const arr = toRaw(self);
|
|
1126
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1127
|
+
const res = arr[method](...args);
|
|
1128
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1129
|
+
args[0] = toRaw(args[0]);
|
|
1130
|
+
return arr[method](...args);
|
|
1131
|
+
}
|
|
1132
|
+
return res;
|
|
1133
|
+
}
|
|
1134
|
+
function noTracking(self, method, args = []) {
|
|
1135
|
+
pauseTracking();
|
|
1136
|
+
startBatch();
|
|
1137
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1138
|
+
endBatch();
|
|
1139
|
+
resetTracking();
|
|
1140
|
+
return res;
|
|
766
1141
|
}
|
|
767
1142
|
|
|
768
1143
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
769
1144
|
const builtInSymbols = new Set(
|
|
770
1145
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
771
1146
|
);
|
|
772
|
-
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
773
|
-
function createArrayInstrumentations() {
|
|
774
|
-
const instrumentations = {};
|
|
775
|
-
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
776
|
-
instrumentations[key] = function(...args) {
|
|
777
|
-
const arr = toRaw(this);
|
|
778
|
-
for (let i = 0, l = this.length; i < l; i++) {
|
|
779
|
-
track(arr, "get", i + "");
|
|
780
|
-
}
|
|
781
|
-
const res = arr[key](...args);
|
|
782
|
-
if (res === -1 || res === false) {
|
|
783
|
-
return arr[key](...args.map(toRaw));
|
|
784
|
-
} else {
|
|
785
|
-
return res;
|
|
786
|
-
}
|
|
787
|
-
};
|
|
788
|
-
});
|
|
789
|
-
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
790
|
-
instrumentations[key] = function(...args) {
|
|
791
|
-
pauseTracking();
|
|
792
|
-
pauseScheduling();
|
|
793
|
-
const res = toRaw(this)[key].apply(this, args);
|
|
794
|
-
resetScheduling();
|
|
795
|
-
resetTracking();
|
|
796
|
-
return res;
|
|
797
|
-
};
|
|
798
|
-
});
|
|
799
|
-
return instrumentations;
|
|
800
|
-
}
|
|
801
1147
|
function hasOwnProperty(key) {
|
|
802
1148
|
if (!isSymbol(key))
|
|
803
1149
|
key = String(key);
|
|
@@ -828,14 +1174,22 @@ var Vue = (function (exports) {
|
|
|
828
1174
|
}
|
|
829
1175
|
const targetIsArray = isArray(target);
|
|
830
1176
|
if (!isReadonly2) {
|
|
831
|
-
|
|
832
|
-
|
|
1177
|
+
let fn;
|
|
1178
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1179
|
+
return fn;
|
|
833
1180
|
}
|
|
834
1181
|
if (key === "hasOwnProperty") {
|
|
835
1182
|
return hasOwnProperty;
|
|
836
1183
|
}
|
|
837
1184
|
}
|
|
838
|
-
const res = Reflect.get(
|
|
1185
|
+
const res = Reflect.get(
|
|
1186
|
+
target,
|
|
1187
|
+
key,
|
|
1188
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1189
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1190
|
+
// its class methods
|
|
1191
|
+
isRef(target) ? target : receiver
|
|
1192
|
+
);
|
|
839
1193
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
840
1194
|
return res;
|
|
841
1195
|
}
|
|
@@ -1334,110 +1688,8 @@ var Vue = (function (exports) {
|
|
|
1334
1688
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1335
1689
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1336
1690
|
|
|
1337
|
-
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`;
|
|
1338
|
-
class ComputedRefImpl {
|
|
1339
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1340
|
-
this.getter = getter;
|
|
1341
|
-
this._setter = _setter;
|
|
1342
|
-
this.dep = void 0;
|
|
1343
|
-
this.__v_isRef = true;
|
|
1344
|
-
this["__v_isReadonly"] = false;
|
|
1345
|
-
this.effect = new ReactiveEffect(
|
|
1346
|
-
() => getter(this._value),
|
|
1347
|
-
() => triggerRefValue(
|
|
1348
|
-
this,
|
|
1349
|
-
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1350
|
-
)
|
|
1351
|
-
);
|
|
1352
|
-
this.effect.computed = this;
|
|
1353
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1354
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1355
|
-
}
|
|
1356
|
-
get value() {
|
|
1357
|
-
const self = toRaw(this);
|
|
1358
|
-
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
|
1359
|
-
triggerRefValue(self, 4);
|
|
1360
|
-
}
|
|
1361
|
-
trackRefValue(self);
|
|
1362
|
-
if (self.effect._dirtyLevel >= 2) {
|
|
1363
|
-
if (this._warnRecursive) {
|
|
1364
|
-
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1365
|
-
|
|
1366
|
-
getter: `, this.getter);
|
|
1367
|
-
}
|
|
1368
|
-
triggerRefValue(self, 2);
|
|
1369
|
-
}
|
|
1370
|
-
return self._value;
|
|
1371
|
-
}
|
|
1372
|
-
set value(newValue) {
|
|
1373
|
-
this._setter(newValue);
|
|
1374
|
-
}
|
|
1375
|
-
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1376
|
-
get _dirty() {
|
|
1377
|
-
return this.effect.dirty;
|
|
1378
|
-
}
|
|
1379
|
-
set _dirty(v) {
|
|
1380
|
-
this.effect.dirty = v;
|
|
1381
|
-
}
|
|
1382
|
-
// #endregion
|
|
1383
|
-
}
|
|
1384
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1385
|
-
let getter;
|
|
1386
|
-
let setter;
|
|
1387
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1388
|
-
if (onlyGetter) {
|
|
1389
|
-
getter = getterOrOptions;
|
|
1390
|
-
setter = () => {
|
|
1391
|
-
warn$2("Write operation failed: computed value is readonly");
|
|
1392
|
-
} ;
|
|
1393
|
-
} else {
|
|
1394
|
-
getter = getterOrOptions.get;
|
|
1395
|
-
setter = getterOrOptions.set;
|
|
1396
|
-
}
|
|
1397
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1398
|
-
if (debugOptions && !isSSR) {
|
|
1399
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1400
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1401
|
-
}
|
|
1402
|
-
return cRef;
|
|
1403
|
-
}
|
|
1404
|
-
|
|
1405
|
-
function trackRefValue(ref2) {
|
|
1406
|
-
var _a;
|
|
1407
|
-
if (shouldTrack && activeEffect) {
|
|
1408
|
-
ref2 = toRaw(ref2);
|
|
1409
|
-
trackEffect(
|
|
1410
|
-
activeEffect,
|
|
1411
|
-
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1412
|
-
() => ref2.dep = void 0,
|
|
1413
|
-
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1414
|
-
),
|
|
1415
|
-
{
|
|
1416
|
-
target: ref2,
|
|
1417
|
-
type: "get",
|
|
1418
|
-
key: "value"
|
|
1419
|
-
}
|
|
1420
|
-
);
|
|
1421
|
-
}
|
|
1422
|
-
}
|
|
1423
|
-
function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
|
1424
|
-
ref2 = toRaw(ref2);
|
|
1425
|
-
const dep = ref2.dep;
|
|
1426
|
-
if (dep) {
|
|
1427
|
-
triggerEffects(
|
|
1428
|
-
dep,
|
|
1429
|
-
dirtyLevel,
|
|
1430
|
-
{
|
|
1431
|
-
target: ref2,
|
|
1432
|
-
type: "set",
|
|
1433
|
-
key: "value",
|
|
1434
|
-
newValue: newVal
|
|
1435
|
-
}
|
|
1436
|
-
);
|
|
1437
|
-
}
|
|
1438
|
-
}
|
|
1439
1691
|
function isRef(r) {
|
|
1440
|
-
return
|
|
1692
|
+
return r ? r.__v_isRef === true : false;
|
|
1441
1693
|
}
|
|
1442
1694
|
function ref(value) {
|
|
1443
1695
|
return createRef(value, false);
|
|
@@ -1454,27 +1706,49 @@ getter: `, this.getter);
|
|
|
1454
1706
|
class RefImpl {
|
|
1455
1707
|
constructor(value, __v_isShallow) {
|
|
1456
1708
|
this.__v_isShallow = __v_isShallow;
|
|
1457
|
-
this.dep =
|
|
1709
|
+
this.dep = new Dep();
|
|
1458
1710
|
this.__v_isRef = true;
|
|
1459
1711
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1460
1712
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1461
1713
|
}
|
|
1462
1714
|
get value() {
|
|
1463
|
-
|
|
1715
|
+
{
|
|
1716
|
+
this.dep.track({
|
|
1717
|
+
target: this,
|
|
1718
|
+
type: "get",
|
|
1719
|
+
key: "value"
|
|
1720
|
+
});
|
|
1721
|
+
}
|
|
1464
1722
|
return this._value;
|
|
1465
1723
|
}
|
|
1466
|
-
set value(
|
|
1467
|
-
const
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
this.
|
|
1472
|
-
|
|
1724
|
+
set value(newValue) {
|
|
1725
|
+
const oldValue = this._rawValue;
|
|
1726
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1727
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1728
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1729
|
+
this._rawValue = newValue;
|
|
1730
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1731
|
+
{
|
|
1732
|
+
this.dep.trigger({
|
|
1733
|
+
target: this,
|
|
1734
|
+
type: "set",
|
|
1735
|
+
key: "value",
|
|
1736
|
+
newValue,
|
|
1737
|
+
oldValue
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1473
1740
|
}
|
|
1474
1741
|
}
|
|
1475
1742
|
}
|
|
1476
1743
|
function triggerRef(ref2) {
|
|
1477
|
-
|
|
1744
|
+
{
|
|
1745
|
+
ref2.dep.trigger({
|
|
1746
|
+
target: ref2,
|
|
1747
|
+
type: "set",
|
|
1748
|
+
key: "value",
|
|
1749
|
+
newValue: ref2._value
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1478
1752
|
}
|
|
1479
1753
|
function unref(ref2) {
|
|
1480
1754
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1499,12 +1773,9 @@ getter: `, this.getter);
|
|
|
1499
1773
|
}
|
|
1500
1774
|
class CustomRefImpl {
|
|
1501
1775
|
constructor(factory) {
|
|
1502
|
-
this.dep = void 0;
|
|
1503
1776
|
this.__v_isRef = true;
|
|
1504
|
-
const
|
|
1505
|
-
|
|
1506
|
-
() => triggerRefValue(this)
|
|
1507
|
-
);
|
|
1777
|
+
const dep = this.dep = new Dep();
|
|
1778
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1508
1779
|
this._get = get;
|
|
1509
1780
|
this._set = set;
|
|
1510
1781
|
}
|
|
@@ -1572,6 +1843,90 @@ getter: `, this.getter);
|
|
|
1572
1843
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1573
1844
|
}
|
|
1574
1845
|
|
|
1846
|
+
class ComputedRefImpl {
|
|
1847
|
+
constructor(fn, setter, isSSR) {
|
|
1848
|
+
this.fn = fn;
|
|
1849
|
+
this.setter = setter;
|
|
1850
|
+
/**
|
|
1851
|
+
* @internal
|
|
1852
|
+
*/
|
|
1853
|
+
this._value = void 0;
|
|
1854
|
+
/**
|
|
1855
|
+
* @internal
|
|
1856
|
+
*/
|
|
1857
|
+
this.dep = new Dep(this);
|
|
1858
|
+
/**
|
|
1859
|
+
* @internal
|
|
1860
|
+
*/
|
|
1861
|
+
this.__v_isRef = true;
|
|
1862
|
+
// A computed is also a subscriber that tracks other deps
|
|
1863
|
+
/**
|
|
1864
|
+
* @internal
|
|
1865
|
+
*/
|
|
1866
|
+
this.deps = void 0;
|
|
1867
|
+
/**
|
|
1868
|
+
* @internal
|
|
1869
|
+
*/
|
|
1870
|
+
this.depsTail = void 0;
|
|
1871
|
+
/**
|
|
1872
|
+
* @internal
|
|
1873
|
+
*/
|
|
1874
|
+
this.flags = 16;
|
|
1875
|
+
/**
|
|
1876
|
+
* @internal
|
|
1877
|
+
*/
|
|
1878
|
+
this.globalVersion = globalVersion - 1;
|
|
1879
|
+
// for backwards compat
|
|
1880
|
+
this.effect = this;
|
|
1881
|
+
this.__v_isReadonly = !setter;
|
|
1882
|
+
this.isSSR = isSSR;
|
|
1883
|
+
}
|
|
1884
|
+
/**
|
|
1885
|
+
* @internal
|
|
1886
|
+
*/
|
|
1887
|
+
notify() {
|
|
1888
|
+
if (activeSub !== this) {
|
|
1889
|
+
this.flags |= 16;
|
|
1890
|
+
this.dep.notify();
|
|
1891
|
+
}
|
|
1892
|
+
}
|
|
1893
|
+
get value() {
|
|
1894
|
+
const link = this.dep.track({
|
|
1895
|
+
target: this,
|
|
1896
|
+
type: "get",
|
|
1897
|
+
key: "value"
|
|
1898
|
+
}) ;
|
|
1899
|
+
refreshComputed(this);
|
|
1900
|
+
if (link) {
|
|
1901
|
+
link.version = this.dep.version;
|
|
1902
|
+
}
|
|
1903
|
+
return this._value;
|
|
1904
|
+
}
|
|
1905
|
+
set value(newValue) {
|
|
1906
|
+
if (this.setter) {
|
|
1907
|
+
this.setter(newValue);
|
|
1908
|
+
} else {
|
|
1909
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1910
|
+
}
|
|
1911
|
+
}
|
|
1912
|
+
}
|
|
1913
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1914
|
+
let getter;
|
|
1915
|
+
let setter;
|
|
1916
|
+
if (isFunction(getterOrOptions)) {
|
|
1917
|
+
getter = getterOrOptions;
|
|
1918
|
+
} else {
|
|
1919
|
+
getter = getterOrOptions.get;
|
|
1920
|
+
setter = getterOrOptions.set;
|
|
1921
|
+
}
|
|
1922
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1923
|
+
if (debugOptions && !isSSR) {
|
|
1924
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1925
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1926
|
+
}
|
|
1927
|
+
return cRef;
|
|
1928
|
+
}
|
|
1929
|
+
|
|
1575
1930
|
const TrackOpTypes = {
|
|
1576
1931
|
"GET": "get",
|
|
1577
1932
|
"HAS": "has",
|
|
@@ -1731,7 +2086,9 @@ getter: `, this.getter);
|
|
|
1731
2086
|
"ASYNC_COMPONENT_LOADER": 13,
|
|
1732
2087
|
"13": "ASYNC_COMPONENT_LOADER",
|
|
1733
2088
|
"SCHEDULER": 14,
|
|
1734
|
-
"14": "SCHEDULER"
|
|
2089
|
+
"14": "SCHEDULER",
|
|
2090
|
+
"APP_UNMOUNT_CLEANUP": 15,
|
|
2091
|
+
"15": "APP_UNMOUNT_CLEANUP"
|
|
1735
2092
|
};
|
|
1736
2093
|
const ErrorTypeStrings$1 = {
|
|
1737
2094
|
["sp"]: "serverPrefetch hook",
|
|
@@ -1762,7 +2119,8 @@ getter: `, this.getter);
|
|
|
1762
2119
|
[11]: "app warnHandler",
|
|
1763
2120
|
[12]: "ref function",
|
|
1764
2121
|
[13]: "async component loader",
|
|
1765
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
2122
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core .",
|
|
2123
|
+
[15]: "app unmount cleanup function"
|
|
1766
2124
|
};
|
|
1767
2125
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1768
2126
|
try {
|
|
@@ -1864,7 +2222,7 @@ getter: `, this.getter);
|
|
|
1864
2222
|
const middle = start + end >>> 1;
|
|
1865
2223
|
const middleJob = queue[middle];
|
|
1866
2224
|
const middleJobId = getId(middleJob);
|
|
1867
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2225
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1868
2226
|
start = middle + 1;
|
|
1869
2227
|
} else {
|
|
1870
2228
|
end = middle;
|
|
@@ -1873,15 +2231,21 @@ getter: `, this.getter);
|
|
|
1873
2231
|
return start;
|
|
1874
2232
|
}
|
|
1875
2233
|
function queueJob(job) {
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1879
|
-
)) {
|
|
2234
|
+
var _a;
|
|
2235
|
+
if (!(job.flags & 1)) {
|
|
1880
2236
|
if (job.id == null) {
|
|
1881
2237
|
queue.push(job);
|
|
2238
|
+
} else if (
|
|
2239
|
+
// fast path when the job id is larger than the tail
|
|
2240
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2241
|
+
) {
|
|
2242
|
+
queue.push(job);
|
|
1882
2243
|
} else {
|
|
1883
2244
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1884
2245
|
}
|
|
2246
|
+
if (!(job.flags & 4)) {
|
|
2247
|
+
job.flags |= 1;
|
|
2248
|
+
}
|
|
1885
2249
|
queueFlush();
|
|
1886
2250
|
}
|
|
1887
2251
|
}
|
|
@@ -1899,11 +2263,11 @@ getter: `, this.getter);
|
|
|
1899
2263
|
}
|
|
1900
2264
|
function queuePostFlushCb(cb) {
|
|
1901
2265
|
if (!isArray(cb)) {
|
|
1902
|
-
if (!
|
|
1903
|
-
cb,
|
|
1904
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1905
|
-
)) {
|
|
2266
|
+
if (!(cb.flags & 1)) {
|
|
1906
2267
|
pendingPostFlushCbs.push(cb);
|
|
2268
|
+
if (!(cb.flags & 4)) {
|
|
2269
|
+
cb.flags |= 1;
|
|
2270
|
+
}
|
|
1907
2271
|
}
|
|
1908
2272
|
} else {
|
|
1909
2273
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1916,7 +2280,7 @@ getter: `, this.getter);
|
|
|
1916
2280
|
}
|
|
1917
2281
|
for (; i < queue.length; i++) {
|
|
1918
2282
|
const cb = queue[i];
|
|
1919
|
-
if (cb && cb.
|
|
2283
|
+
if (cb && cb.flags & 2) {
|
|
1920
2284
|
if (instance && cb.id !== instance.uid) {
|
|
1921
2285
|
continue;
|
|
1922
2286
|
}
|
|
@@ -1926,6 +2290,7 @@ getter: `, this.getter);
|
|
|
1926
2290
|
queue.splice(i, 1);
|
|
1927
2291
|
i--;
|
|
1928
2292
|
cb();
|
|
2293
|
+
cb.flags &= ~1;
|
|
1929
2294
|
}
|
|
1930
2295
|
}
|
|
1931
2296
|
}
|
|
@@ -1948,6 +2313,7 @@ getter: `, this.getter);
|
|
|
1948
2313
|
continue;
|
|
1949
2314
|
}
|
|
1950
2315
|
activePostFlushCbs[postFlushIndex]();
|
|
2316
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1951
2317
|
}
|
|
1952
2318
|
activePostFlushCbs = null;
|
|
1953
2319
|
postFlushIndex = 0;
|
|
@@ -1957,9 +2323,11 @@ getter: `, this.getter);
|
|
|
1957
2323
|
const comparator = (a, b) => {
|
|
1958
2324
|
const diff = getId(a) - getId(b);
|
|
1959
2325
|
if (diff === 0) {
|
|
1960
|
-
|
|
2326
|
+
const isAPre = a.flags & 2;
|
|
2327
|
+
const isBPre = b.flags & 2;
|
|
2328
|
+
if (isAPre && !isBPre)
|
|
1961
2329
|
return -1;
|
|
1962
|
-
if (
|
|
2330
|
+
if (isBPre && !isAPre)
|
|
1963
2331
|
return 1;
|
|
1964
2332
|
}
|
|
1965
2333
|
return diff;
|
|
@@ -1975,11 +2343,12 @@ getter: `, this.getter);
|
|
|
1975
2343
|
try {
|
|
1976
2344
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1977
2345
|
const job = queue[flushIndex];
|
|
1978
|
-
if (job && job.
|
|
2346
|
+
if (job && !(job.flags & 8)) {
|
|
1979
2347
|
if (check(job)) {
|
|
1980
2348
|
continue;
|
|
1981
2349
|
}
|
|
1982
2350
|
callWithErrorHandling(job, null, 14);
|
|
2351
|
+
job.flags &= ~1;
|
|
1983
2352
|
}
|
|
1984
2353
|
}
|
|
1985
2354
|
} finally {
|
|
@@ -2061,7 +2430,6 @@ getter: `, this.getter);
|
|
|
2061
2430
|
}
|
|
2062
2431
|
instance.renderCache = [];
|
|
2063
2432
|
isHmrUpdating = true;
|
|
2064
|
-
instance.effect.dirty = true;
|
|
2065
2433
|
instance.update();
|
|
2066
2434
|
isHmrUpdating = false;
|
|
2067
2435
|
});
|
|
@@ -2089,7 +2457,6 @@ getter: `, this.getter);
|
|
|
2089
2457
|
instance.ceReload(newComp.styles);
|
|
2090
2458
|
hmrDirtyComponents.delete(oldComp);
|
|
2091
2459
|
} else if (instance.parent) {
|
|
2092
|
-
instance.parent.effect.dirty = true;
|
|
2093
2460
|
queueJob(instance.parent.update);
|
|
2094
2461
|
} else if (instance.appContext.reload) {
|
|
2095
2462
|
instance.appContext.reload();
|
|
@@ -3489,8 +3856,8 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3489
3856
|
};
|
|
3490
3857
|
};
|
|
3491
3858
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3492
|
-
const job = () => {
|
|
3493
|
-
if (!effect.
|
|
3859
|
+
const job = (immediateFirstRun) => {
|
|
3860
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
3494
3861
|
return;
|
|
3495
3862
|
}
|
|
3496
3863
|
if (cb) {
|
|
@@ -3511,19 +3878,22 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3511
3878
|
effect.run();
|
|
3512
3879
|
}
|
|
3513
3880
|
};
|
|
3514
|
-
|
|
3881
|
+
if (cb)
|
|
3882
|
+
job.flags |= 4;
|
|
3883
|
+
const effect = new ReactiveEffect(getter);
|
|
3515
3884
|
let scheduler;
|
|
3516
3885
|
if (flush === "sync") {
|
|
3886
|
+
effect.flags |= 64;
|
|
3517
3887
|
scheduler = job;
|
|
3518
3888
|
} else if (flush === "post") {
|
|
3519
3889
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
3520
3890
|
} else {
|
|
3521
|
-
job.
|
|
3891
|
+
job.flags |= 2;
|
|
3522
3892
|
if (instance)
|
|
3523
3893
|
job.id = instance.uid;
|
|
3524
3894
|
scheduler = () => queueJob(job);
|
|
3525
3895
|
}
|
|
3526
|
-
|
|
3896
|
+
effect.scheduler = scheduler;
|
|
3527
3897
|
const scope = getCurrentScope();
|
|
3528
3898
|
const unwatch = () => {
|
|
3529
3899
|
effect.stop();
|
|
@@ -3537,7 +3907,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3537
3907
|
}
|
|
3538
3908
|
if (cb) {
|
|
3539
3909
|
if (immediate) {
|
|
3540
|
-
job();
|
|
3910
|
+
job(true);
|
|
3541
3911
|
} else {
|
|
3542
3912
|
oldValue = effect.run();
|
|
3543
3913
|
}
|
|
@@ -3711,22 +4081,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3711
4081
|
if (!children || !children.length) {
|
|
3712
4082
|
return;
|
|
3713
4083
|
}
|
|
3714
|
-
|
|
3715
|
-
if (children.length > 1) {
|
|
3716
|
-
let hasFound = false;
|
|
3717
|
-
for (const c of children) {
|
|
3718
|
-
if (c.type !== Comment) {
|
|
3719
|
-
if (hasFound) {
|
|
3720
|
-
warn$1(
|
|
3721
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
3722
|
-
);
|
|
3723
|
-
break;
|
|
3724
|
-
}
|
|
3725
|
-
child = c;
|
|
3726
|
-
hasFound = true;
|
|
3727
|
-
}
|
|
3728
|
-
}
|
|
3729
|
-
}
|
|
4084
|
+
const child = findNonCommentChild(children);
|
|
3730
4085
|
const rawProps = toRaw(props);
|
|
3731
4086
|
const { mode } = rawProps;
|
|
3732
4087
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -3735,7 +4090,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3735
4090
|
if (state.isLeaving) {
|
|
3736
4091
|
return emptyPlaceholder(child);
|
|
3737
4092
|
}
|
|
3738
|
-
const innerChild =
|
|
4093
|
+
const innerChild = getInnerChild$1(child);
|
|
3739
4094
|
if (!innerChild) {
|
|
3740
4095
|
return emptyPlaceholder(child);
|
|
3741
4096
|
}
|
|
@@ -3747,7 +4102,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3747
4102
|
);
|
|
3748
4103
|
setTransitionHooks(innerChild, enterHooks);
|
|
3749
4104
|
const oldChild = instance.subTree;
|
|
3750
|
-
const oldInnerChild = oldChild &&
|
|
4105
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
3751
4106
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
3752
4107
|
const leavingHooks = resolveTransitionHooks(
|
|
3753
4108
|
oldInnerChild,
|
|
@@ -3760,8 +4115,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3760
4115
|
state.isLeaving = true;
|
|
3761
4116
|
leavingHooks.afterLeave = () => {
|
|
3762
4117
|
state.isLeaving = false;
|
|
3763
|
-
if (instance.
|
|
3764
|
-
instance.effect.dirty = true;
|
|
4118
|
+
if (!(instance.job.flags & 8)) {
|
|
3765
4119
|
instance.update();
|
|
3766
4120
|
}
|
|
3767
4121
|
};
|
|
@@ -3786,6 +4140,25 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3786
4140
|
};
|
|
3787
4141
|
}
|
|
3788
4142
|
};
|
|
4143
|
+
function findNonCommentChild(children) {
|
|
4144
|
+
let child = children[0];
|
|
4145
|
+
if (children.length > 1) {
|
|
4146
|
+
let hasFound = false;
|
|
4147
|
+
for (const c of children) {
|
|
4148
|
+
if (c.type !== Comment) {
|
|
4149
|
+
if (hasFound) {
|
|
4150
|
+
warn$1(
|
|
4151
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4152
|
+
);
|
|
4153
|
+
break;
|
|
4154
|
+
}
|
|
4155
|
+
child = c;
|
|
4156
|
+
hasFound = true;
|
|
4157
|
+
}
|
|
4158
|
+
}
|
|
4159
|
+
}
|
|
4160
|
+
return child;
|
|
4161
|
+
}
|
|
3789
4162
|
const BaseTransition = BaseTransitionImpl;
|
|
3790
4163
|
function getLeavingNodesForType(state, vnode) {
|
|
3791
4164
|
const { leavingVNodes } = state;
|
|
@@ -3940,8 +4313,11 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3940
4313
|
return vnode;
|
|
3941
4314
|
}
|
|
3942
4315
|
}
|
|
3943
|
-
function
|
|
4316
|
+
function getInnerChild$1(vnode) {
|
|
3944
4317
|
if (!isKeepAlive(vnode)) {
|
|
4318
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4319
|
+
return findNonCommentChild(vnode.children);
|
|
4320
|
+
}
|
|
3945
4321
|
return vnode;
|
|
3946
4322
|
}
|
|
3947
4323
|
if (vnode.component) {
|
|
@@ -4110,7 +4486,6 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4110
4486
|
load().then(() => {
|
|
4111
4487
|
loaded.value = true;
|
|
4112
4488
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4113
|
-
instance.parent.effect.dirty = true;
|
|
4114
4489
|
queueJob(instance.parent.update);
|
|
4115
4490
|
}
|
|
4116
4491
|
}).catch((err) => {
|
|
@@ -4435,10 +4810,20 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4435
4810
|
function renderList(source, renderItem, cache, index) {
|
|
4436
4811
|
let ret;
|
|
4437
4812
|
const cached = cache && cache[index];
|
|
4438
|
-
|
|
4813
|
+
const sourceIsArray = isArray(source);
|
|
4814
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
4815
|
+
if (sourceIsArray || isString(source)) {
|
|
4816
|
+
if (sourceIsReactiveArray) {
|
|
4817
|
+
source = shallowReadArray(source);
|
|
4818
|
+
}
|
|
4439
4819
|
ret = new Array(source.length);
|
|
4440
4820
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
4441
|
-
ret[i] = renderItem(
|
|
4821
|
+
ret[i] = renderItem(
|
|
4822
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
4823
|
+
i,
|
|
4824
|
+
void 0,
|
|
4825
|
+
cached && cached[i]
|
|
4826
|
+
);
|
|
4442
4827
|
}
|
|
4443
4828
|
} else if (typeof source === "number") {
|
|
4444
4829
|
if (!Number.isInteger(source)) {
|
|
@@ -4573,7 +4958,6 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4573
4958
|
$emit: (i) => i.emit,
|
|
4574
4959
|
$options: (i) => resolveMergedOptions(i) ,
|
|
4575
4960
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
4576
|
-
i.effect.dirty = true;
|
|
4577
4961
|
queueJob(i.update);
|
|
4578
4962
|
}),
|
|
4579
4963
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -5368,6 +5752,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5368
5752
|
}
|
|
5369
5753
|
const context = createAppContext();
|
|
5370
5754
|
const installedPlugins = /* @__PURE__ */ new WeakSet();
|
|
5755
|
+
const pluginCleanupFns = [];
|
|
5371
5756
|
let isMounted = false;
|
|
5372
5757
|
const app = context.app = {
|
|
5373
5758
|
_uid: uid$1++,
|
|
@@ -5485,8 +5870,21 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
5485
5870
|
);
|
|
5486
5871
|
}
|
|
5487
5872
|
},
|
|
5873
|
+
onUnmount(cleanupFn) {
|
|
5874
|
+
if (typeof cleanupFn !== "function") {
|
|
5875
|
+
warn$1(
|
|
5876
|
+
`Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
|
|
5877
|
+
);
|
|
5878
|
+
}
|
|
5879
|
+
pluginCleanupFns.push(cleanupFn);
|
|
5880
|
+
},
|
|
5488
5881
|
unmount() {
|
|
5489
5882
|
if (isMounted) {
|
|
5883
|
+
callWithAsyncErrorHandling(
|
|
5884
|
+
pluginCleanupFns,
|
|
5885
|
+
app._instance,
|
|
5886
|
+
15
|
|
5887
|
+
);
|
|
5490
5888
|
render(null, app._container);
|
|
5491
5889
|
{
|
|
5492
5890
|
app._instance = null;
|
|
@@ -5906,7 +6304,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
5906
6304
|
function assertType(value, type) {
|
|
5907
6305
|
let valid;
|
|
5908
6306
|
const expectedType = getType(type);
|
|
5909
|
-
if (
|
|
6307
|
+
if (expectedType === "null") {
|
|
6308
|
+
valid = value === null;
|
|
6309
|
+
} else if (isSimpleType(expectedType)) {
|
|
5910
6310
|
const t = typeof value;
|
|
5911
6311
|
valid = t === expectedType.toLowerCase();
|
|
5912
6312
|
if (!valid && t === "object") {
|
|
@@ -5916,8 +6316,6 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
5916
6316
|
valid = isObject(value);
|
|
5917
6317
|
} else if (expectedType === "Array") {
|
|
5918
6318
|
valid = isArray(value);
|
|
5919
|
-
} else if (expectedType === "null") {
|
|
5920
|
-
valid = value === null;
|
|
5921
6319
|
} else {
|
|
5922
6320
|
valid = value instanceof type;
|
|
5923
6321
|
}
|
|
@@ -7441,7 +7839,6 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
7441
7839
|
} else {
|
|
7442
7840
|
instance.next = n2;
|
|
7443
7841
|
invalidateJob(instance.update);
|
|
7444
|
-
instance.effect.dirty = true;
|
|
7445
7842
|
instance.update();
|
|
7446
7843
|
}
|
|
7447
7844
|
} else {
|
|
@@ -7624,24 +8021,18 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
7624
8021
|
}
|
|
7625
8022
|
}
|
|
7626
8023
|
};
|
|
7627
|
-
|
|
7628
|
-
|
|
7629
|
-
|
|
7630
|
-
|
|
7631
|
-
|
|
7632
|
-
|
|
7633
|
-
);
|
|
7634
|
-
const update = instance.update = () => {
|
|
7635
|
-
if (effect.dirty) {
|
|
7636
|
-
effect.run();
|
|
7637
|
-
}
|
|
7638
|
-
};
|
|
7639
|
-
update.id = instance.uid;
|
|
8024
|
+
instance.scope.on();
|
|
8025
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
8026
|
+
instance.scope.off();
|
|
8027
|
+
const update = instance.update = effect.run.bind(effect);
|
|
8028
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
8029
|
+
job.id = instance.uid;
|
|
8030
|
+
effect.scheduler = () => queueJob(job);
|
|
7640
8031
|
toggleRecurse(instance, true);
|
|
7641
8032
|
{
|
|
7642
8033
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7643
8034
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7644
|
-
|
|
8035
|
+
job.ownerInstance = instance;
|
|
7645
8036
|
}
|
|
7646
8037
|
update();
|
|
7647
8038
|
};
|
|
@@ -8108,13 +8499,13 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
8108
8499
|
if (instance.type.__hmrId) {
|
|
8109
8500
|
unregisterHMR(instance);
|
|
8110
8501
|
}
|
|
8111
|
-
const { bum, scope,
|
|
8502
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
8112
8503
|
if (bum) {
|
|
8113
8504
|
invokeArrayFns(bum);
|
|
8114
8505
|
}
|
|
8115
8506
|
scope.stop();
|
|
8116
|
-
if (
|
|
8117
|
-
|
|
8507
|
+
if (job) {
|
|
8508
|
+
job.flags |= 8;
|
|
8118
8509
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
8119
8510
|
}
|
|
8120
8511
|
if (um) {
|
|
@@ -8200,8 +8591,14 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
8200
8591
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
8201
8592
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
8202
8593
|
}
|
|
8203
|
-
function toggleRecurse({ effect,
|
|
8204
|
-
|
|
8594
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
8595
|
+
if (allowed) {
|
|
8596
|
+
effect.flags |= 32;
|
|
8597
|
+
job.flags |= 4;
|
|
8598
|
+
} else {
|
|
8599
|
+
effect.flags &= ~32;
|
|
8600
|
+
job.flags &= ~4;
|
|
8601
|
+
}
|
|
8205
8602
|
}
|
|
8206
8603
|
function needTransition(parentSuspense, transition) {
|
|
8207
8604
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -8941,6 +9338,7 @@ Component that was made reactive: `,
|
|
|
8941
9338
|
effect: null,
|
|
8942
9339
|
update: null,
|
|
8943
9340
|
// will be set synchronously right after creation
|
|
9341
|
+
job: null,
|
|
8944
9342
|
scope: new EffectScope(
|
|
8945
9343
|
true
|
|
8946
9344
|
/* detached */
|
|
@@ -9434,7 +9832,8 @@ Component that was made reactive: `,
|
|
|
9434
9832
|
{},
|
|
9435
9833
|
["span", vueStyle, genRefFlag(obj)],
|
|
9436
9834
|
"<",
|
|
9437
|
-
|
|
9835
|
+
// avoid debugger accessing value affecting behavior
|
|
9836
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
9438
9837
|
`>`
|
|
9439
9838
|
];
|
|
9440
9839
|
} else if (isReactive(obj)) {
|
|
@@ -9614,7 +10013,7 @@ Component that was made reactive: `,
|
|
|
9614
10013
|
return true;
|
|
9615
10014
|
}
|
|
9616
10015
|
|
|
9617
|
-
const version = "3.
|
|
10016
|
+
const version = "3.5.0-alpha.2";
|
|
9618
10017
|
const warn = warn$1 ;
|
|
9619
10018
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
9620
10019
|
const devtools = devtools$1 ;
|
|
@@ -11057,7 +11456,9 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
11057
11456
|
return;
|
|
11058
11457
|
}
|
|
11059
11458
|
const eventKey = hyphenate(event.key);
|
|
11060
|
-
if (modifiers.some(
|
|
11459
|
+
if (modifiers.some(
|
|
11460
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
11461
|
+
)) {
|
|
11061
11462
|
return fn(event);
|
|
11062
11463
|
}
|
|
11063
11464
|
});
|
|
@@ -16462,9 +16863,183 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
|
|
|
16462
16863
|
}
|
|
16463
16864
|
};
|
|
16464
16865
|
|
|
16866
|
+
function isValidHTMLNesting(parent, child) {
|
|
16867
|
+
if (parent in onlyValidChildren) {
|
|
16868
|
+
return onlyValidChildren[parent].has(child);
|
|
16869
|
+
}
|
|
16870
|
+
if (child in onlyValidParents) {
|
|
16871
|
+
return onlyValidParents[child].has(parent);
|
|
16872
|
+
}
|
|
16873
|
+
if (parent in knownInvalidChildren) {
|
|
16874
|
+
if (knownInvalidChildren[parent].has(child))
|
|
16875
|
+
return false;
|
|
16876
|
+
}
|
|
16877
|
+
if (child in knownInvalidParents) {
|
|
16878
|
+
if (knownInvalidParents[child].has(parent))
|
|
16879
|
+
return false;
|
|
16880
|
+
}
|
|
16881
|
+
return true;
|
|
16882
|
+
}
|
|
16883
|
+
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
16884
|
+
const emptySet = /* @__PURE__ */ new Set([]);
|
|
16885
|
+
const onlyValidChildren = {
|
|
16886
|
+
head: /* @__PURE__ */ new Set([
|
|
16887
|
+
"base",
|
|
16888
|
+
"basefront",
|
|
16889
|
+
"bgsound",
|
|
16890
|
+
"link",
|
|
16891
|
+
"meta",
|
|
16892
|
+
"title",
|
|
16893
|
+
"noscript",
|
|
16894
|
+
"noframes",
|
|
16895
|
+
"style",
|
|
16896
|
+
"script",
|
|
16897
|
+
"template"
|
|
16898
|
+
]),
|
|
16899
|
+
optgroup: /* @__PURE__ */ new Set(["option"]),
|
|
16900
|
+
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
|
|
16901
|
+
// table
|
|
16902
|
+
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
|
|
16903
|
+
tr: /* @__PURE__ */ new Set(["td", "th"]),
|
|
16904
|
+
colgroup: /* @__PURE__ */ new Set(["col"]),
|
|
16905
|
+
tbody: /* @__PURE__ */ new Set(["tr"]),
|
|
16906
|
+
thead: /* @__PURE__ */ new Set(["tr"]),
|
|
16907
|
+
tfoot: /* @__PURE__ */ new Set(["tr"]),
|
|
16908
|
+
// these elements can not have any children elements
|
|
16909
|
+
script: emptySet,
|
|
16910
|
+
iframe: emptySet,
|
|
16911
|
+
option: emptySet,
|
|
16912
|
+
textarea: emptySet,
|
|
16913
|
+
style: emptySet,
|
|
16914
|
+
title: emptySet
|
|
16915
|
+
};
|
|
16916
|
+
const onlyValidParents = {
|
|
16917
|
+
// sections
|
|
16918
|
+
html: emptySet,
|
|
16919
|
+
body: /* @__PURE__ */ new Set(["html"]),
|
|
16920
|
+
head: /* @__PURE__ */ new Set(["html"]),
|
|
16921
|
+
// table
|
|
16922
|
+
td: /* @__PURE__ */ new Set(["tr"]),
|
|
16923
|
+
colgroup: /* @__PURE__ */ new Set(["table"]),
|
|
16924
|
+
caption: /* @__PURE__ */ new Set(["table"]),
|
|
16925
|
+
tbody: /* @__PURE__ */ new Set(["table"]),
|
|
16926
|
+
tfoot: /* @__PURE__ */ new Set(["table"]),
|
|
16927
|
+
col: /* @__PURE__ */ new Set(["colgroup"]),
|
|
16928
|
+
th: /* @__PURE__ */ new Set(["tr"]),
|
|
16929
|
+
thead: /* @__PURE__ */ new Set(["table"]),
|
|
16930
|
+
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
|
|
16931
|
+
// data list
|
|
16932
|
+
dd: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
16933
|
+
dt: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
16934
|
+
// other
|
|
16935
|
+
figcaption: /* @__PURE__ */ new Set(["figure"]),
|
|
16936
|
+
// li: new Set(["ul", "ol"]),
|
|
16937
|
+
summary: /* @__PURE__ */ new Set(["details"]),
|
|
16938
|
+
area: /* @__PURE__ */ new Set(["map"])
|
|
16939
|
+
};
|
|
16940
|
+
const knownInvalidChildren = {
|
|
16941
|
+
p: /* @__PURE__ */ new Set([
|
|
16942
|
+
"address",
|
|
16943
|
+
"article",
|
|
16944
|
+
"aside",
|
|
16945
|
+
"blockquote",
|
|
16946
|
+
"center",
|
|
16947
|
+
"details",
|
|
16948
|
+
"dialog",
|
|
16949
|
+
"dir",
|
|
16950
|
+
"div",
|
|
16951
|
+
"dl",
|
|
16952
|
+
"fieldset",
|
|
16953
|
+
"figure",
|
|
16954
|
+
"footer",
|
|
16955
|
+
"form",
|
|
16956
|
+
"h1",
|
|
16957
|
+
"h2",
|
|
16958
|
+
"h3",
|
|
16959
|
+
"h4",
|
|
16960
|
+
"h5",
|
|
16961
|
+
"h6",
|
|
16962
|
+
"header",
|
|
16963
|
+
"hgroup",
|
|
16964
|
+
"hr",
|
|
16965
|
+
"li",
|
|
16966
|
+
"main",
|
|
16967
|
+
"nav",
|
|
16968
|
+
"menu",
|
|
16969
|
+
"ol",
|
|
16970
|
+
"p",
|
|
16971
|
+
"pre",
|
|
16972
|
+
"section",
|
|
16973
|
+
"table",
|
|
16974
|
+
"ul"
|
|
16975
|
+
]),
|
|
16976
|
+
svg: /* @__PURE__ */ new Set([
|
|
16977
|
+
"b",
|
|
16978
|
+
"blockquote",
|
|
16979
|
+
"br",
|
|
16980
|
+
"code",
|
|
16981
|
+
"dd",
|
|
16982
|
+
"div",
|
|
16983
|
+
"dl",
|
|
16984
|
+
"dt",
|
|
16985
|
+
"em",
|
|
16986
|
+
"embed",
|
|
16987
|
+
"h1",
|
|
16988
|
+
"h2",
|
|
16989
|
+
"h3",
|
|
16990
|
+
"h4",
|
|
16991
|
+
"h5",
|
|
16992
|
+
"h6",
|
|
16993
|
+
"hr",
|
|
16994
|
+
"i",
|
|
16995
|
+
"img",
|
|
16996
|
+
"li",
|
|
16997
|
+
"menu",
|
|
16998
|
+
"meta",
|
|
16999
|
+
"ol",
|
|
17000
|
+
"p",
|
|
17001
|
+
"pre",
|
|
17002
|
+
"ruby",
|
|
17003
|
+
"s",
|
|
17004
|
+
"small",
|
|
17005
|
+
"span",
|
|
17006
|
+
"strong",
|
|
17007
|
+
"sub",
|
|
17008
|
+
"sup",
|
|
17009
|
+
"table",
|
|
17010
|
+
"u",
|
|
17011
|
+
"ul",
|
|
17012
|
+
"var"
|
|
17013
|
+
])
|
|
17014
|
+
};
|
|
17015
|
+
const knownInvalidParents = {
|
|
17016
|
+
a: /* @__PURE__ */ new Set(["a"]),
|
|
17017
|
+
button: /* @__PURE__ */ new Set(["button"]),
|
|
17018
|
+
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
17019
|
+
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
17020
|
+
form: /* @__PURE__ */ new Set(["form"]),
|
|
17021
|
+
li: /* @__PURE__ */ new Set(["li"]),
|
|
17022
|
+
h1: headings,
|
|
17023
|
+
h2: headings,
|
|
17024
|
+
h3: headings,
|
|
17025
|
+
h4: headings,
|
|
17026
|
+
h5: headings,
|
|
17027
|
+
h6: headings
|
|
17028
|
+
};
|
|
17029
|
+
|
|
17030
|
+
const validateHtmlNesting = (node, context) => {
|
|
17031
|
+
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
|
|
17032
|
+
const error = new SyntaxError(
|
|
17033
|
+
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
|
|
17034
|
+
);
|
|
17035
|
+
error.loc = node.loc;
|
|
17036
|
+
context.onWarn(error);
|
|
17037
|
+
}
|
|
17038
|
+
};
|
|
17039
|
+
|
|
16465
17040
|
const DOMNodeTransforms = [
|
|
16466
17041
|
transformStyle,
|
|
16467
|
-
...[transformTransition]
|
|
17042
|
+
...[transformTransition, validateHtmlNesting]
|
|
16468
17043
|
];
|
|
16469
17044
|
const DOMDirectiveTransforms = {
|
|
16470
17045
|
cloak: noopDirectiveTransform,
|