@vue/compat 3.4.25 → 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 +974 -417
- package/dist/vue.cjs.prod.js +765 -403
- package/dist/vue.esm-browser.js +974 -417
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +986 -419
- package/dist/vue.global.js +974 -417
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +799 -416
- package/dist/vue.runtime.esm-browser.prod.js +6 -6
- package/dist/vue.runtime.esm-bundler.js +811 -418
- package/dist/vue.runtime.global.js +799 -416
- package/dist/vue.runtime.global.prod.js +6 -6
- package/package.json +2 -2
package/dist/vue.esm-browser.js
CHANGED
|
@@ -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
|
**/
|
|
@@ -449,157 +449,280 @@ class EffectScope {
|
|
|
449
449
|
function effectScope(detached) {
|
|
450
450
|
return new EffectScope(detached);
|
|
451
451
|
}
|
|
452
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
453
|
-
if (scope && scope.active) {
|
|
454
|
-
scope.effects.push(effect);
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
452
|
function getCurrentScope() {
|
|
458
453
|
return activeEffectScope;
|
|
459
454
|
}
|
|
460
|
-
function onScopeDispose(fn) {
|
|
455
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
461
456
|
if (activeEffectScope) {
|
|
462
457
|
activeEffectScope.cleanups.push(fn);
|
|
463
|
-
} else {
|
|
458
|
+
} else if (!failSilently) {
|
|
464
459
|
warn$2(
|
|
465
460
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
466
461
|
);
|
|
467
462
|
}
|
|
468
463
|
}
|
|
469
464
|
|
|
470
|
-
let
|
|
465
|
+
let activeSub;
|
|
471
466
|
class ReactiveEffect {
|
|
472
|
-
constructor(fn
|
|
467
|
+
constructor(fn) {
|
|
473
468
|
this.fn = fn;
|
|
474
|
-
this.trigger = trigger;
|
|
475
|
-
this.scheduler = scheduler;
|
|
476
|
-
this.active = true;
|
|
477
|
-
this.deps = [];
|
|
478
469
|
/**
|
|
479
470
|
* @internal
|
|
480
471
|
*/
|
|
481
|
-
this.
|
|
472
|
+
this.deps = void 0;
|
|
482
473
|
/**
|
|
483
474
|
* @internal
|
|
484
475
|
*/
|
|
485
|
-
this.
|
|
476
|
+
this.depsTail = void 0;
|
|
486
477
|
/**
|
|
487
478
|
* @internal
|
|
488
479
|
*/
|
|
489
|
-
this.
|
|
480
|
+
this.flags = 1 | 4;
|
|
490
481
|
/**
|
|
491
482
|
* @internal
|
|
492
483
|
*/
|
|
493
|
-
this.
|
|
484
|
+
this.nextEffect = void 0;
|
|
494
485
|
/**
|
|
495
486
|
* @internal
|
|
496
487
|
*/
|
|
497
|
-
this.
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
502
|
-
this._dirtyLevel = 1;
|
|
503
|
-
pauseTracking();
|
|
504
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
505
|
-
const dep = this.deps[i];
|
|
506
|
-
if (dep.computed) {
|
|
507
|
-
triggerComputed(dep.computed);
|
|
508
|
-
if (this._dirtyLevel >= 4) {
|
|
509
|
-
break;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
if (this._dirtyLevel === 1) {
|
|
514
|
-
this._dirtyLevel = 0;
|
|
515
|
-
}
|
|
516
|
-
resetTracking();
|
|
488
|
+
this.cleanup = void 0;
|
|
489
|
+
this.scheduler = void 0;
|
|
490
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
491
|
+
activeEffectScope.effects.push(this);
|
|
517
492
|
}
|
|
518
|
-
return this._dirtyLevel >= 4;
|
|
519
493
|
}
|
|
520
|
-
|
|
521
|
-
|
|
494
|
+
/**
|
|
495
|
+
* @internal
|
|
496
|
+
*/
|
|
497
|
+
notify() {
|
|
498
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
499
|
+
return;
|
|
500
|
+
}
|
|
501
|
+
if (this.flags & 64) {
|
|
502
|
+
return this.trigger();
|
|
503
|
+
}
|
|
504
|
+
if (!(this.flags & 8)) {
|
|
505
|
+
this.flags |= 8;
|
|
506
|
+
this.nextEffect = batchedEffect;
|
|
507
|
+
batchedEffect = this;
|
|
508
|
+
}
|
|
522
509
|
}
|
|
523
510
|
run() {
|
|
524
|
-
this.
|
|
525
|
-
if (!this.active) {
|
|
511
|
+
if (!(this.flags & 1)) {
|
|
526
512
|
return this.fn();
|
|
527
513
|
}
|
|
528
|
-
|
|
529
|
-
|
|
514
|
+
this.flags |= 2;
|
|
515
|
+
cleanupEffect(this);
|
|
516
|
+
prepareDeps(this);
|
|
517
|
+
const prevEffect = activeSub;
|
|
518
|
+
const prevShouldTrack = shouldTrack;
|
|
519
|
+
activeSub = this;
|
|
520
|
+
shouldTrack = true;
|
|
530
521
|
try {
|
|
531
|
-
shouldTrack = true;
|
|
532
|
-
activeEffect = this;
|
|
533
|
-
this._runnings++;
|
|
534
|
-
preCleanupEffect(this);
|
|
535
522
|
return this.fn();
|
|
536
523
|
} finally {
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
524
|
+
if (activeSub !== this) {
|
|
525
|
+
warn$2(
|
|
526
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
527
|
+
);
|
|
528
|
+
}
|
|
529
|
+
cleanupDeps(this);
|
|
530
|
+
activeSub = prevEffect;
|
|
531
|
+
shouldTrack = prevShouldTrack;
|
|
532
|
+
this.flags &= ~2;
|
|
541
533
|
}
|
|
542
534
|
}
|
|
543
535
|
stop() {
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
this
|
|
536
|
+
if (this.flags & 1) {
|
|
537
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
538
|
+
removeSub(link);
|
|
539
|
+
}
|
|
540
|
+
this.deps = this.depsTail = void 0;
|
|
541
|
+
cleanupEffect(this);
|
|
542
|
+
this.onStop && this.onStop();
|
|
543
|
+
this.flags &= ~1;
|
|
550
544
|
}
|
|
551
545
|
}
|
|
546
|
+
trigger() {
|
|
547
|
+
if (this.scheduler) {
|
|
548
|
+
this.scheduler();
|
|
549
|
+
} else {
|
|
550
|
+
this.runIfDirty();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
/**
|
|
554
|
+
* @internal
|
|
555
|
+
*/
|
|
556
|
+
runIfDirty() {
|
|
557
|
+
if (isDirty(this)) {
|
|
558
|
+
this.run();
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
get dirty() {
|
|
562
|
+
return isDirty(this);
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
let batchDepth = 0;
|
|
566
|
+
let batchedEffect;
|
|
567
|
+
function startBatch() {
|
|
568
|
+
batchDepth++;
|
|
552
569
|
}
|
|
553
|
-
function
|
|
554
|
-
|
|
570
|
+
function endBatch() {
|
|
571
|
+
if (batchDepth > 1) {
|
|
572
|
+
batchDepth--;
|
|
573
|
+
return;
|
|
574
|
+
}
|
|
575
|
+
let error;
|
|
576
|
+
while (batchedEffect) {
|
|
577
|
+
let e = batchedEffect;
|
|
578
|
+
batchedEffect = void 0;
|
|
579
|
+
while (e) {
|
|
580
|
+
const next = e.nextEffect;
|
|
581
|
+
e.nextEffect = void 0;
|
|
582
|
+
e.flags &= ~8;
|
|
583
|
+
if (e.flags & 1) {
|
|
584
|
+
try {
|
|
585
|
+
e.trigger();
|
|
586
|
+
} catch (err) {
|
|
587
|
+
if (!error)
|
|
588
|
+
error = err;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
e = next;
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
batchDepth--;
|
|
595
|
+
if (error)
|
|
596
|
+
throw error;
|
|
555
597
|
}
|
|
556
|
-
function
|
|
557
|
-
|
|
558
|
-
|
|
598
|
+
function prepareDeps(sub) {
|
|
599
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
600
|
+
link.version = -1;
|
|
601
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
602
|
+
link.dep.activeLink = link;
|
|
603
|
+
}
|
|
559
604
|
}
|
|
560
|
-
function
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
605
|
+
function cleanupDeps(sub) {
|
|
606
|
+
let head;
|
|
607
|
+
let tail = sub.depsTail;
|
|
608
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
609
|
+
if (link.version === -1) {
|
|
610
|
+
if (link === tail)
|
|
611
|
+
tail = link.prevDep;
|
|
612
|
+
removeSub(link);
|
|
613
|
+
removeDep(link);
|
|
614
|
+
} else {
|
|
615
|
+
head = link;
|
|
564
616
|
}
|
|
565
|
-
|
|
617
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
618
|
+
link.prevActiveLink = void 0;
|
|
566
619
|
}
|
|
620
|
+
sub.deps = head;
|
|
621
|
+
sub.depsTail = tail;
|
|
567
622
|
}
|
|
568
|
-
function
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
if (dep.size === 0) {
|
|
573
|
-
dep.cleanup();
|
|
623
|
+
function isDirty(sub) {
|
|
624
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
625
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
626
|
+
return true;
|
|
574
627
|
}
|
|
575
628
|
}
|
|
629
|
+
if (sub._dirty) {
|
|
630
|
+
return true;
|
|
631
|
+
}
|
|
632
|
+
return false;
|
|
633
|
+
}
|
|
634
|
+
function refreshComputed(computed) {
|
|
635
|
+
if (computed.flags & 2) {
|
|
636
|
+
return false;
|
|
637
|
+
}
|
|
638
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
computed.flags &= ~16;
|
|
642
|
+
if (computed.globalVersion === globalVersion) {
|
|
643
|
+
return;
|
|
644
|
+
}
|
|
645
|
+
computed.globalVersion = globalVersion;
|
|
646
|
+
const dep = computed.dep;
|
|
647
|
+
computed.flags |= 2;
|
|
648
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
649
|
+
computed.flags &= ~2;
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
const prevSub = activeSub;
|
|
653
|
+
const prevShouldTrack = shouldTrack;
|
|
654
|
+
activeSub = computed;
|
|
655
|
+
shouldTrack = true;
|
|
656
|
+
try {
|
|
657
|
+
prepareDeps(computed);
|
|
658
|
+
const value = computed.fn();
|
|
659
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
660
|
+
computed._value = value;
|
|
661
|
+
dep.version++;
|
|
662
|
+
}
|
|
663
|
+
} catch (err) {
|
|
664
|
+
dep.version++;
|
|
665
|
+
throw err;
|
|
666
|
+
} finally {
|
|
667
|
+
activeSub = prevSub;
|
|
668
|
+
shouldTrack = prevShouldTrack;
|
|
669
|
+
cleanupDeps(computed);
|
|
670
|
+
computed.flags &= ~2;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
function removeSub(link) {
|
|
674
|
+
const { dep, prevSub, nextSub } = link;
|
|
675
|
+
if (prevSub) {
|
|
676
|
+
prevSub.nextSub = nextSub;
|
|
677
|
+
link.prevSub = void 0;
|
|
678
|
+
}
|
|
679
|
+
if (nextSub) {
|
|
680
|
+
nextSub.prevSub = prevSub;
|
|
681
|
+
link.nextSub = void 0;
|
|
682
|
+
}
|
|
683
|
+
if (dep.subs === link) {
|
|
684
|
+
dep.subs = prevSub;
|
|
685
|
+
}
|
|
686
|
+
if (!dep.subs && dep.computed) {
|
|
687
|
+
dep.computed.flags &= ~4;
|
|
688
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
689
|
+
removeSub(l);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
function removeDep(link) {
|
|
694
|
+
const { prevDep, nextDep } = link;
|
|
695
|
+
if (prevDep) {
|
|
696
|
+
prevDep.nextDep = nextDep;
|
|
697
|
+
link.prevDep = void 0;
|
|
698
|
+
}
|
|
699
|
+
if (nextDep) {
|
|
700
|
+
nextDep.prevDep = prevDep;
|
|
701
|
+
link.nextDep = void 0;
|
|
702
|
+
}
|
|
576
703
|
}
|
|
577
704
|
function effect(fn, options) {
|
|
578
705
|
if (fn.effect instanceof ReactiveEffect) {
|
|
579
706
|
fn = fn.effect.fn;
|
|
580
707
|
}
|
|
581
|
-
const
|
|
582
|
-
if (_effect.dirty) {
|
|
583
|
-
_effect.run();
|
|
584
|
-
}
|
|
585
|
-
});
|
|
708
|
+
const e = new ReactiveEffect(fn);
|
|
586
709
|
if (options) {
|
|
587
|
-
extend(
|
|
588
|
-
if (options.scope)
|
|
589
|
-
recordEffectScope(_effect, options.scope);
|
|
710
|
+
extend(e, options);
|
|
590
711
|
}
|
|
591
|
-
|
|
592
|
-
|
|
712
|
+
try {
|
|
713
|
+
e.run();
|
|
714
|
+
} catch (err) {
|
|
715
|
+
e.stop();
|
|
716
|
+
throw err;
|
|
593
717
|
}
|
|
594
|
-
const runner =
|
|
595
|
-
runner.effect =
|
|
718
|
+
const runner = e.run.bind(e);
|
|
719
|
+
runner.effect = e;
|
|
596
720
|
return runner;
|
|
597
721
|
}
|
|
598
722
|
function stop(runner) {
|
|
599
723
|
runner.effect.stop();
|
|
600
724
|
}
|
|
601
725
|
let shouldTrack = true;
|
|
602
|
-
let pauseScheduleStack = 0;
|
|
603
726
|
const trackStack = [];
|
|
604
727
|
function pauseTracking() {
|
|
605
728
|
trackStack.push(shouldTrack);
|
|
@@ -609,192 +732,414 @@ function resetTracking() {
|
|
|
609
732
|
const last = trackStack.pop();
|
|
610
733
|
shouldTrack = last === void 0 ? true : last;
|
|
611
734
|
}
|
|
612
|
-
function
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
735
|
+
function cleanupEffect(e) {
|
|
736
|
+
const { cleanup } = e;
|
|
737
|
+
e.cleanup = void 0;
|
|
738
|
+
if (cleanup) {
|
|
739
|
+
const prevSub = activeSub;
|
|
740
|
+
activeSub = void 0;
|
|
741
|
+
try {
|
|
742
|
+
cleanup();
|
|
743
|
+
} finally {
|
|
744
|
+
activeSub = prevSub;
|
|
745
|
+
}
|
|
619
746
|
}
|
|
620
747
|
}
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
748
|
+
|
|
749
|
+
let globalVersion = 0;
|
|
750
|
+
class Dep {
|
|
751
|
+
constructor(computed) {
|
|
752
|
+
this.computed = computed;
|
|
753
|
+
this.version = 0;
|
|
754
|
+
/**
|
|
755
|
+
* Link between this dep and the current active effect
|
|
756
|
+
*/
|
|
757
|
+
this.activeLink = void 0;
|
|
758
|
+
/**
|
|
759
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
760
|
+
*/
|
|
761
|
+
this.subs = void 0;
|
|
634
762
|
{
|
|
635
|
-
|
|
763
|
+
this.subsHead = void 0;
|
|
636
764
|
}
|
|
637
765
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
766
|
+
track(debugInfo) {
|
|
767
|
+
if (!activeSub || !shouldTrack) {
|
|
768
|
+
return;
|
|
769
|
+
}
|
|
770
|
+
let link = this.activeLink;
|
|
771
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
772
|
+
link = this.activeLink = {
|
|
773
|
+
dep: this,
|
|
774
|
+
sub: activeSub,
|
|
775
|
+
version: this.version,
|
|
776
|
+
nextDep: void 0,
|
|
777
|
+
prevDep: void 0,
|
|
778
|
+
nextSub: void 0,
|
|
779
|
+
prevSub: void 0,
|
|
780
|
+
prevActiveLink: void 0
|
|
781
|
+
};
|
|
782
|
+
if (!activeSub.deps) {
|
|
783
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
784
|
+
} else {
|
|
785
|
+
link.prevDep = activeSub.depsTail;
|
|
786
|
+
activeSub.depsTail.nextDep = link;
|
|
787
|
+
activeSub.depsTail = link;
|
|
788
|
+
}
|
|
789
|
+
if (activeSub.flags & 4) {
|
|
790
|
+
addSub(link);
|
|
791
|
+
}
|
|
792
|
+
} else if (link.version === -1) {
|
|
793
|
+
link.version = this.version;
|
|
794
|
+
if (link.nextDep) {
|
|
795
|
+
const next = link.nextDep;
|
|
796
|
+
next.prevDep = link.prevDep;
|
|
797
|
+
if (link.prevDep) {
|
|
798
|
+
link.prevDep.nextDep = next;
|
|
799
|
+
}
|
|
800
|
+
link.prevDep = activeSub.depsTail;
|
|
801
|
+
link.nextDep = void 0;
|
|
802
|
+
activeSub.depsTail.nextDep = link;
|
|
803
|
+
activeSub.depsTail = link;
|
|
804
|
+
if (activeSub.deps === link) {
|
|
805
|
+
activeSub.deps = next;
|
|
806
|
+
}
|
|
652
807
|
}
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
808
|
+
}
|
|
809
|
+
if (activeSub.onTrack) {
|
|
810
|
+
activeSub.onTrack(
|
|
811
|
+
extend(
|
|
812
|
+
{
|
|
813
|
+
effect: activeSub
|
|
814
|
+
},
|
|
815
|
+
debugInfo
|
|
816
|
+
)
|
|
817
|
+
);
|
|
818
|
+
}
|
|
819
|
+
return link;
|
|
820
|
+
}
|
|
821
|
+
trigger(debugInfo) {
|
|
822
|
+
this.version++;
|
|
823
|
+
globalVersion++;
|
|
824
|
+
this.notify(debugInfo);
|
|
825
|
+
}
|
|
826
|
+
notify(debugInfo) {
|
|
827
|
+
startBatch();
|
|
828
|
+
try {
|
|
829
|
+
if (true) {
|
|
830
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
831
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
832
|
+
head.sub.onTrigger(
|
|
833
|
+
extend(
|
|
834
|
+
{
|
|
835
|
+
effect: head.sub
|
|
836
|
+
},
|
|
837
|
+
debugInfo
|
|
838
|
+
)
|
|
839
|
+
);
|
|
840
|
+
}
|
|
658
841
|
}
|
|
659
842
|
}
|
|
843
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
844
|
+
link.sub.notify();
|
|
845
|
+
}
|
|
846
|
+
} finally {
|
|
847
|
+
endBatch();
|
|
660
848
|
}
|
|
661
849
|
}
|
|
662
|
-
resetScheduling();
|
|
663
850
|
}
|
|
664
|
-
|
|
665
|
-
const
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
}
|
|
671
|
-
|
|
851
|
+
function addSub(link) {
|
|
852
|
+
const computed = link.dep.computed;
|
|
853
|
+
if (computed && !link.dep.subs) {
|
|
854
|
+
computed.flags |= 4 | 16;
|
|
855
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
856
|
+
addSub(l);
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
const currentTail = link.dep.subs;
|
|
860
|
+
if (currentTail !== link) {
|
|
861
|
+
link.prevSub = currentTail;
|
|
862
|
+
if (currentTail)
|
|
863
|
+
currentTail.nextSub = link;
|
|
864
|
+
}
|
|
865
|
+
if (link.dep.subsHead === void 0) {
|
|
866
|
+
link.dep.subsHead = link;
|
|
867
|
+
}
|
|
868
|
+
link.dep.subs = link;
|
|
869
|
+
}
|
|
672
870
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
673
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
674
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
871
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
872
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
873
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
675
874
|
function track(target, type, key) {
|
|
676
|
-
if (shouldTrack &&
|
|
875
|
+
if (shouldTrack && activeSub) {
|
|
677
876
|
let depsMap = targetMap.get(target);
|
|
678
877
|
if (!depsMap) {
|
|
679
878
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
680
879
|
}
|
|
681
880
|
let dep = depsMap.get(key);
|
|
682
881
|
if (!dep) {
|
|
683
|
-
depsMap.set(key, dep =
|
|
882
|
+
depsMap.set(key, dep = new Dep());
|
|
684
883
|
}
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
dep,
|
|
688
|
-
{
|
|
884
|
+
{
|
|
885
|
+
dep.track({
|
|
689
886
|
target,
|
|
690
887
|
type,
|
|
691
888
|
key
|
|
692
|
-
}
|
|
693
|
-
|
|
889
|
+
});
|
|
890
|
+
}
|
|
694
891
|
}
|
|
695
892
|
}
|
|
696
893
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
697
894
|
const depsMap = targetMap.get(target);
|
|
698
895
|
if (!depsMap) {
|
|
896
|
+
globalVersion++;
|
|
699
897
|
return;
|
|
700
898
|
}
|
|
701
899
|
let deps = [];
|
|
702
900
|
if (type === "clear") {
|
|
703
901
|
deps = [...depsMap.values()];
|
|
704
|
-
} else if (key === "length" && isArray(target)) {
|
|
705
|
-
const newLength = Number(newValue);
|
|
706
|
-
depsMap.forEach((dep, key2) => {
|
|
707
|
-
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
|
708
|
-
deps.push(dep);
|
|
709
|
-
}
|
|
710
|
-
});
|
|
711
902
|
} else {
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
if (!
|
|
718
|
-
deps.push(
|
|
719
|
-
if (isMap(target)) {
|
|
720
|
-
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
721
|
-
}
|
|
722
|
-
} else if (isIntegerKey(key)) {
|
|
723
|
-
deps.push(depsMap.get("length"));
|
|
903
|
+
const targetIsArray = isArray(target);
|
|
904
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
905
|
+
if (targetIsArray && key === "length") {
|
|
906
|
+
const newLength = Number(newValue);
|
|
907
|
+
depsMap.forEach((dep, key2) => {
|
|
908
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
909
|
+
deps.push(dep);
|
|
724
910
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
911
|
+
});
|
|
912
|
+
} else {
|
|
913
|
+
const push = (dep) => dep && deps.push(dep);
|
|
914
|
+
if (key !== void 0) {
|
|
915
|
+
push(depsMap.get(key));
|
|
916
|
+
}
|
|
917
|
+
if (isArrayIndex) {
|
|
918
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
919
|
+
}
|
|
920
|
+
switch (type) {
|
|
921
|
+
case "add":
|
|
922
|
+
if (!targetIsArray) {
|
|
923
|
+
push(depsMap.get(ITERATE_KEY));
|
|
924
|
+
if (isMap(target)) {
|
|
925
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
926
|
+
}
|
|
927
|
+
} else if (isArrayIndex) {
|
|
928
|
+
push(depsMap.get("length"));
|
|
929
|
+
}
|
|
930
|
+
break;
|
|
931
|
+
case "delete":
|
|
932
|
+
if (!targetIsArray) {
|
|
933
|
+
push(depsMap.get(ITERATE_KEY));
|
|
934
|
+
if (isMap(target)) {
|
|
935
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
break;
|
|
939
|
+
case "set":
|
|
729
940
|
if (isMap(target)) {
|
|
730
|
-
|
|
941
|
+
push(depsMap.get(ITERATE_KEY));
|
|
731
942
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
case "set":
|
|
735
|
-
if (isMap(target)) {
|
|
736
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
737
|
-
}
|
|
738
|
-
break;
|
|
943
|
+
break;
|
|
944
|
+
}
|
|
739
945
|
}
|
|
740
946
|
}
|
|
741
|
-
|
|
947
|
+
startBatch();
|
|
742
948
|
for (const dep of deps) {
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
oldValue,
|
|
753
|
-
oldTarget
|
|
754
|
-
}
|
|
755
|
-
);
|
|
949
|
+
{
|
|
950
|
+
dep.trigger({
|
|
951
|
+
target,
|
|
952
|
+
type,
|
|
953
|
+
key,
|
|
954
|
+
newValue,
|
|
955
|
+
oldValue,
|
|
956
|
+
oldTarget
|
|
957
|
+
});
|
|
756
958
|
}
|
|
757
959
|
}
|
|
758
|
-
|
|
960
|
+
endBatch();
|
|
759
961
|
}
|
|
760
962
|
function getDepFromReactive(object, key) {
|
|
761
963
|
var _a;
|
|
762
964
|
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
763
965
|
}
|
|
764
966
|
|
|
967
|
+
function reactiveReadArray(array) {
|
|
968
|
+
const raw = toRaw(array);
|
|
969
|
+
if (raw === array)
|
|
970
|
+
return raw;
|
|
971
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
972
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
973
|
+
}
|
|
974
|
+
function shallowReadArray(arr) {
|
|
975
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
976
|
+
return arr;
|
|
977
|
+
}
|
|
978
|
+
const arrayInstrumentations = {
|
|
979
|
+
__proto__: null,
|
|
980
|
+
[Symbol.iterator]() {
|
|
981
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
982
|
+
},
|
|
983
|
+
concat(...args) {
|
|
984
|
+
return reactiveReadArray(this).concat(
|
|
985
|
+
...args.map((x) => reactiveReadArray(x))
|
|
986
|
+
);
|
|
987
|
+
},
|
|
988
|
+
entries() {
|
|
989
|
+
return iterator(this, "entries", (value) => {
|
|
990
|
+
value[1] = toReactive(value[1]);
|
|
991
|
+
return value;
|
|
992
|
+
});
|
|
993
|
+
},
|
|
994
|
+
every(fn, thisArg) {
|
|
995
|
+
return apply(this, "every", fn, thisArg);
|
|
996
|
+
},
|
|
997
|
+
filter(fn, thisArg) {
|
|
998
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
999
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
1000
|
+
},
|
|
1001
|
+
find(fn, thisArg) {
|
|
1002
|
+
const result = apply(this, "find", fn, thisArg);
|
|
1003
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1004
|
+
},
|
|
1005
|
+
findIndex(fn, thisArg) {
|
|
1006
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
1007
|
+
},
|
|
1008
|
+
findLast(fn, thisArg) {
|
|
1009
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
1010
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
1011
|
+
},
|
|
1012
|
+
findLastIndex(fn, thisArg) {
|
|
1013
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
1014
|
+
},
|
|
1015
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
1016
|
+
forEach(fn, thisArg) {
|
|
1017
|
+
return apply(this, "forEach", fn, thisArg);
|
|
1018
|
+
},
|
|
1019
|
+
includes(...args) {
|
|
1020
|
+
return searchProxy(this, "includes", args);
|
|
1021
|
+
},
|
|
1022
|
+
indexOf(...args) {
|
|
1023
|
+
return searchProxy(this, "indexOf", args);
|
|
1024
|
+
},
|
|
1025
|
+
join(separator) {
|
|
1026
|
+
return reactiveReadArray(this).join(separator);
|
|
1027
|
+
},
|
|
1028
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
1029
|
+
lastIndexOf(...args) {
|
|
1030
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
1031
|
+
},
|
|
1032
|
+
map(fn, thisArg) {
|
|
1033
|
+
return apply(this, "map", fn, thisArg);
|
|
1034
|
+
},
|
|
1035
|
+
pop() {
|
|
1036
|
+
return noTracking(this, "pop");
|
|
1037
|
+
},
|
|
1038
|
+
push(...args) {
|
|
1039
|
+
return noTracking(this, "push", args);
|
|
1040
|
+
},
|
|
1041
|
+
reduce(fn, ...args) {
|
|
1042
|
+
return reduce(this, "reduce", fn, args);
|
|
1043
|
+
},
|
|
1044
|
+
reduceRight(fn, ...args) {
|
|
1045
|
+
return reduce(this, "reduceRight", fn, args);
|
|
1046
|
+
},
|
|
1047
|
+
shift() {
|
|
1048
|
+
return noTracking(this, "shift");
|
|
1049
|
+
},
|
|
1050
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
1051
|
+
some(fn, thisArg) {
|
|
1052
|
+
return apply(this, "some", fn, thisArg);
|
|
1053
|
+
},
|
|
1054
|
+
splice(...args) {
|
|
1055
|
+
return noTracking(this, "splice", args);
|
|
1056
|
+
},
|
|
1057
|
+
toReversed() {
|
|
1058
|
+
return reactiveReadArray(this).toReversed();
|
|
1059
|
+
},
|
|
1060
|
+
toSorted(comparer) {
|
|
1061
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
1062
|
+
},
|
|
1063
|
+
toSpliced(...args) {
|
|
1064
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1065
|
+
},
|
|
1066
|
+
unshift(...args) {
|
|
1067
|
+
return noTracking(this, "unshift", args);
|
|
1068
|
+
},
|
|
1069
|
+
values() {
|
|
1070
|
+
return iterator(this, "values", toReactive);
|
|
1071
|
+
}
|
|
1072
|
+
};
|
|
1073
|
+
function iterator(self, method, wrapValue) {
|
|
1074
|
+
const arr = shallowReadArray(self);
|
|
1075
|
+
const iter = arr[method]();
|
|
1076
|
+
if (arr !== self && !isShallow(self)) {
|
|
1077
|
+
iter._next = iter.next;
|
|
1078
|
+
iter.next = () => {
|
|
1079
|
+
const result = iter._next();
|
|
1080
|
+
if (result.value) {
|
|
1081
|
+
result.value = wrapValue(result.value);
|
|
1082
|
+
}
|
|
1083
|
+
return result;
|
|
1084
|
+
};
|
|
1085
|
+
}
|
|
1086
|
+
return iter;
|
|
1087
|
+
}
|
|
1088
|
+
function apply(self, method, fn, thisArg) {
|
|
1089
|
+
const arr = shallowReadArray(self);
|
|
1090
|
+
let wrappedFn = fn;
|
|
1091
|
+
if (arr !== self) {
|
|
1092
|
+
if (!isShallow(self)) {
|
|
1093
|
+
wrappedFn = function(item, index) {
|
|
1094
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1095
|
+
};
|
|
1096
|
+
} else if (fn.length > 2) {
|
|
1097
|
+
wrappedFn = function(item, index) {
|
|
1098
|
+
return fn.call(this, item, index, self);
|
|
1099
|
+
};
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
return arr[method](wrappedFn, thisArg);
|
|
1103
|
+
}
|
|
1104
|
+
function reduce(self, method, fn, args) {
|
|
1105
|
+
const arr = shallowReadArray(self);
|
|
1106
|
+
let wrappedFn = fn;
|
|
1107
|
+
if (arr !== self) {
|
|
1108
|
+
if (!isShallow(self)) {
|
|
1109
|
+
wrappedFn = function(acc, item, index) {
|
|
1110
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1111
|
+
};
|
|
1112
|
+
} else if (fn.length > 3) {
|
|
1113
|
+
wrappedFn = function(acc, item, index) {
|
|
1114
|
+
return fn.call(this, acc, item, index, self);
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
}
|
|
1118
|
+
return arr[method](wrappedFn, ...args);
|
|
1119
|
+
}
|
|
1120
|
+
function searchProxy(self, method, args) {
|
|
1121
|
+
const arr = toRaw(self);
|
|
1122
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1123
|
+
const res = arr[method](...args);
|
|
1124
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1125
|
+
args[0] = toRaw(args[0]);
|
|
1126
|
+
return arr[method](...args);
|
|
1127
|
+
}
|
|
1128
|
+
return res;
|
|
1129
|
+
}
|
|
1130
|
+
function noTracking(self, method, args = []) {
|
|
1131
|
+
pauseTracking();
|
|
1132
|
+
startBatch();
|
|
1133
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1134
|
+
endBatch();
|
|
1135
|
+
resetTracking();
|
|
1136
|
+
return res;
|
|
1137
|
+
}
|
|
1138
|
+
|
|
765
1139
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
766
1140
|
const builtInSymbols = new Set(
|
|
767
1141
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
768
1142
|
);
|
|
769
|
-
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
770
|
-
function createArrayInstrumentations() {
|
|
771
|
-
const instrumentations = {};
|
|
772
|
-
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
773
|
-
instrumentations[key] = function(...args) {
|
|
774
|
-
const arr = toRaw(this);
|
|
775
|
-
for (let i = 0, l = this.length; i < l; i++) {
|
|
776
|
-
track(arr, "get", i + "");
|
|
777
|
-
}
|
|
778
|
-
const res = arr[key](...args);
|
|
779
|
-
if (res === -1 || res === false) {
|
|
780
|
-
return arr[key](...args.map(toRaw));
|
|
781
|
-
} else {
|
|
782
|
-
return res;
|
|
783
|
-
}
|
|
784
|
-
};
|
|
785
|
-
});
|
|
786
|
-
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
787
|
-
instrumentations[key] = function(...args) {
|
|
788
|
-
pauseTracking();
|
|
789
|
-
pauseScheduling();
|
|
790
|
-
const res = toRaw(this)[key].apply(this, args);
|
|
791
|
-
resetScheduling();
|
|
792
|
-
resetTracking();
|
|
793
|
-
return res;
|
|
794
|
-
};
|
|
795
|
-
});
|
|
796
|
-
return instrumentations;
|
|
797
|
-
}
|
|
798
1143
|
function hasOwnProperty(key) {
|
|
799
1144
|
if (!isSymbol(key))
|
|
800
1145
|
key = String(key);
|
|
@@ -825,14 +1170,22 @@ class BaseReactiveHandler {
|
|
|
825
1170
|
}
|
|
826
1171
|
const targetIsArray = isArray(target);
|
|
827
1172
|
if (!isReadonly2) {
|
|
828
|
-
|
|
829
|
-
|
|
1173
|
+
let fn;
|
|
1174
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1175
|
+
return fn;
|
|
830
1176
|
}
|
|
831
1177
|
if (key === "hasOwnProperty") {
|
|
832
1178
|
return hasOwnProperty;
|
|
833
1179
|
}
|
|
834
1180
|
}
|
|
835
|
-
const res = Reflect.get(
|
|
1181
|
+
const res = Reflect.get(
|
|
1182
|
+
target,
|
|
1183
|
+
key,
|
|
1184
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1185
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1186
|
+
// its class methods
|
|
1187
|
+
isRef(target) ? target : receiver
|
|
1188
|
+
);
|
|
836
1189
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
837
1190
|
return res;
|
|
838
1191
|
}
|
|
@@ -1331,110 +1684,8 @@ function markRaw(value) {
|
|
|
1331
1684
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1332
1685
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1333
1686
|
|
|
1334
|
-
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`;
|
|
1335
|
-
class ComputedRefImpl {
|
|
1336
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1337
|
-
this.getter = getter;
|
|
1338
|
-
this._setter = _setter;
|
|
1339
|
-
this.dep = void 0;
|
|
1340
|
-
this.__v_isRef = true;
|
|
1341
|
-
this["__v_isReadonly"] = false;
|
|
1342
|
-
this.effect = new ReactiveEffect(
|
|
1343
|
-
() => getter(this._value),
|
|
1344
|
-
() => triggerRefValue(
|
|
1345
|
-
this,
|
|
1346
|
-
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1347
|
-
)
|
|
1348
|
-
);
|
|
1349
|
-
this.effect.computed = this;
|
|
1350
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1351
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1352
|
-
}
|
|
1353
|
-
get value() {
|
|
1354
|
-
const self = toRaw(this);
|
|
1355
|
-
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
|
1356
|
-
triggerRefValue(self, 4);
|
|
1357
|
-
}
|
|
1358
|
-
trackRefValue(self);
|
|
1359
|
-
if (self.effect._dirtyLevel >= 2) {
|
|
1360
|
-
if (this._warnRecursive) {
|
|
1361
|
-
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1362
|
-
|
|
1363
|
-
getter: `, this.getter);
|
|
1364
|
-
}
|
|
1365
|
-
triggerRefValue(self, 2);
|
|
1366
|
-
}
|
|
1367
|
-
return self._value;
|
|
1368
|
-
}
|
|
1369
|
-
set value(newValue) {
|
|
1370
|
-
this._setter(newValue);
|
|
1371
|
-
}
|
|
1372
|
-
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1373
|
-
get _dirty() {
|
|
1374
|
-
return this.effect.dirty;
|
|
1375
|
-
}
|
|
1376
|
-
set _dirty(v) {
|
|
1377
|
-
this.effect.dirty = v;
|
|
1378
|
-
}
|
|
1379
|
-
// #endregion
|
|
1380
|
-
}
|
|
1381
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1382
|
-
let getter;
|
|
1383
|
-
let setter;
|
|
1384
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1385
|
-
if (onlyGetter) {
|
|
1386
|
-
getter = getterOrOptions;
|
|
1387
|
-
setter = () => {
|
|
1388
|
-
warn$2("Write operation failed: computed value is readonly");
|
|
1389
|
-
} ;
|
|
1390
|
-
} else {
|
|
1391
|
-
getter = getterOrOptions.get;
|
|
1392
|
-
setter = getterOrOptions.set;
|
|
1393
|
-
}
|
|
1394
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1395
|
-
if (debugOptions && !isSSR) {
|
|
1396
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1397
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1398
|
-
}
|
|
1399
|
-
return cRef;
|
|
1400
|
-
}
|
|
1401
|
-
|
|
1402
|
-
function trackRefValue(ref2) {
|
|
1403
|
-
var _a;
|
|
1404
|
-
if (shouldTrack && activeEffect) {
|
|
1405
|
-
ref2 = toRaw(ref2);
|
|
1406
|
-
trackEffect(
|
|
1407
|
-
activeEffect,
|
|
1408
|
-
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1409
|
-
() => ref2.dep = void 0,
|
|
1410
|
-
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1411
|
-
),
|
|
1412
|
-
{
|
|
1413
|
-
target: ref2,
|
|
1414
|
-
type: "get",
|
|
1415
|
-
key: "value"
|
|
1416
|
-
}
|
|
1417
|
-
);
|
|
1418
|
-
}
|
|
1419
|
-
}
|
|
1420
|
-
function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
|
1421
|
-
ref2 = toRaw(ref2);
|
|
1422
|
-
const dep = ref2.dep;
|
|
1423
|
-
if (dep) {
|
|
1424
|
-
triggerEffects(
|
|
1425
|
-
dep,
|
|
1426
|
-
dirtyLevel,
|
|
1427
|
-
{
|
|
1428
|
-
target: ref2,
|
|
1429
|
-
type: "set",
|
|
1430
|
-
key: "value",
|
|
1431
|
-
newValue: newVal
|
|
1432
|
-
}
|
|
1433
|
-
);
|
|
1434
|
-
}
|
|
1435
|
-
}
|
|
1436
1687
|
function isRef(r) {
|
|
1437
|
-
return
|
|
1688
|
+
return r ? r.__v_isRef === true : false;
|
|
1438
1689
|
}
|
|
1439
1690
|
function ref(value) {
|
|
1440
1691
|
return createRef(value, false);
|
|
@@ -1451,27 +1702,49 @@ function createRef(rawValue, shallow) {
|
|
|
1451
1702
|
class RefImpl {
|
|
1452
1703
|
constructor(value, __v_isShallow) {
|
|
1453
1704
|
this.__v_isShallow = __v_isShallow;
|
|
1454
|
-
this.dep =
|
|
1705
|
+
this.dep = new Dep();
|
|
1455
1706
|
this.__v_isRef = true;
|
|
1456
1707
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1457
1708
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1458
1709
|
}
|
|
1459
1710
|
get value() {
|
|
1460
|
-
|
|
1711
|
+
{
|
|
1712
|
+
this.dep.track({
|
|
1713
|
+
target: this,
|
|
1714
|
+
type: "get",
|
|
1715
|
+
key: "value"
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1461
1718
|
return this._value;
|
|
1462
1719
|
}
|
|
1463
|
-
set value(
|
|
1464
|
-
const
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
this.
|
|
1469
|
-
|
|
1720
|
+
set value(newValue) {
|
|
1721
|
+
const oldValue = this._rawValue;
|
|
1722
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1723
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1724
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1725
|
+
this._rawValue = newValue;
|
|
1726
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1727
|
+
{
|
|
1728
|
+
this.dep.trigger({
|
|
1729
|
+
target: this,
|
|
1730
|
+
type: "set",
|
|
1731
|
+
key: "value",
|
|
1732
|
+
newValue,
|
|
1733
|
+
oldValue
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1470
1736
|
}
|
|
1471
1737
|
}
|
|
1472
1738
|
}
|
|
1473
1739
|
function triggerRef(ref2) {
|
|
1474
|
-
|
|
1740
|
+
{
|
|
1741
|
+
ref2.dep.trigger({
|
|
1742
|
+
target: ref2,
|
|
1743
|
+
type: "set",
|
|
1744
|
+
key: "value",
|
|
1745
|
+
newValue: ref2._value
|
|
1746
|
+
});
|
|
1747
|
+
}
|
|
1475
1748
|
}
|
|
1476
1749
|
function unref(ref2) {
|
|
1477
1750
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1496,12 +1769,9 @@ function proxyRefs(objectWithRefs) {
|
|
|
1496
1769
|
}
|
|
1497
1770
|
class CustomRefImpl {
|
|
1498
1771
|
constructor(factory) {
|
|
1499
|
-
this.dep = void 0;
|
|
1500
1772
|
this.__v_isRef = true;
|
|
1501
|
-
const
|
|
1502
|
-
|
|
1503
|
-
() => triggerRefValue(this)
|
|
1504
|
-
);
|
|
1773
|
+
const dep = this.dep = new Dep();
|
|
1774
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1505
1775
|
this._get = get;
|
|
1506
1776
|
this._set = set;
|
|
1507
1777
|
}
|
|
@@ -1569,6 +1839,90 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1569
1839
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1570
1840
|
}
|
|
1571
1841
|
|
|
1842
|
+
class ComputedRefImpl {
|
|
1843
|
+
constructor(fn, setter, isSSR) {
|
|
1844
|
+
this.fn = fn;
|
|
1845
|
+
this.setter = setter;
|
|
1846
|
+
/**
|
|
1847
|
+
* @internal
|
|
1848
|
+
*/
|
|
1849
|
+
this._value = void 0;
|
|
1850
|
+
/**
|
|
1851
|
+
* @internal
|
|
1852
|
+
*/
|
|
1853
|
+
this.dep = new Dep(this);
|
|
1854
|
+
/**
|
|
1855
|
+
* @internal
|
|
1856
|
+
*/
|
|
1857
|
+
this.__v_isRef = true;
|
|
1858
|
+
// A computed is also a subscriber that tracks other deps
|
|
1859
|
+
/**
|
|
1860
|
+
* @internal
|
|
1861
|
+
*/
|
|
1862
|
+
this.deps = void 0;
|
|
1863
|
+
/**
|
|
1864
|
+
* @internal
|
|
1865
|
+
*/
|
|
1866
|
+
this.depsTail = void 0;
|
|
1867
|
+
/**
|
|
1868
|
+
* @internal
|
|
1869
|
+
*/
|
|
1870
|
+
this.flags = 16;
|
|
1871
|
+
/**
|
|
1872
|
+
* @internal
|
|
1873
|
+
*/
|
|
1874
|
+
this.globalVersion = globalVersion - 1;
|
|
1875
|
+
// for backwards compat
|
|
1876
|
+
this.effect = this;
|
|
1877
|
+
this.__v_isReadonly = !setter;
|
|
1878
|
+
this.isSSR = isSSR;
|
|
1879
|
+
}
|
|
1880
|
+
/**
|
|
1881
|
+
* @internal
|
|
1882
|
+
*/
|
|
1883
|
+
notify() {
|
|
1884
|
+
if (activeSub !== this) {
|
|
1885
|
+
this.flags |= 16;
|
|
1886
|
+
this.dep.notify();
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
get value() {
|
|
1890
|
+
const link = this.dep.track({
|
|
1891
|
+
target: this,
|
|
1892
|
+
type: "get",
|
|
1893
|
+
key: "value"
|
|
1894
|
+
}) ;
|
|
1895
|
+
refreshComputed(this);
|
|
1896
|
+
if (link) {
|
|
1897
|
+
link.version = this.dep.version;
|
|
1898
|
+
}
|
|
1899
|
+
return this._value;
|
|
1900
|
+
}
|
|
1901
|
+
set value(newValue) {
|
|
1902
|
+
if (this.setter) {
|
|
1903
|
+
this.setter(newValue);
|
|
1904
|
+
} else {
|
|
1905
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
}
|
|
1909
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1910
|
+
let getter;
|
|
1911
|
+
let setter;
|
|
1912
|
+
if (isFunction(getterOrOptions)) {
|
|
1913
|
+
getter = getterOrOptions;
|
|
1914
|
+
} else {
|
|
1915
|
+
getter = getterOrOptions.get;
|
|
1916
|
+
setter = getterOrOptions.set;
|
|
1917
|
+
}
|
|
1918
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1919
|
+
if (debugOptions && !isSSR) {
|
|
1920
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1921
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1922
|
+
}
|
|
1923
|
+
return cRef;
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1572
1926
|
const TrackOpTypes = {
|
|
1573
1927
|
"GET": "get",
|
|
1574
1928
|
"HAS": "has",
|
|
@@ -1861,7 +2215,7 @@ function findInsertionIndex(id) {
|
|
|
1861
2215
|
const middle = start + end >>> 1;
|
|
1862
2216
|
const middleJob = queue[middle];
|
|
1863
2217
|
const middleJobId = getId(middleJob);
|
|
1864
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2218
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1865
2219
|
start = middle + 1;
|
|
1866
2220
|
} else {
|
|
1867
2221
|
end = middle;
|
|
@@ -1870,15 +2224,21 @@ function findInsertionIndex(id) {
|
|
|
1870
2224
|
return start;
|
|
1871
2225
|
}
|
|
1872
2226
|
function queueJob(job) {
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1876
|
-
)) {
|
|
2227
|
+
var _a;
|
|
2228
|
+
if (!(job.flags & 1)) {
|
|
1877
2229
|
if (job.id == null) {
|
|
1878
2230
|
queue.push(job);
|
|
2231
|
+
} else if (
|
|
2232
|
+
// fast path when the job id is larger than the tail
|
|
2233
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2234
|
+
) {
|
|
2235
|
+
queue.push(job);
|
|
1879
2236
|
} else {
|
|
1880
2237
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1881
2238
|
}
|
|
2239
|
+
if (!(job.flags & 4)) {
|
|
2240
|
+
job.flags |= 1;
|
|
2241
|
+
}
|
|
1882
2242
|
queueFlush();
|
|
1883
2243
|
}
|
|
1884
2244
|
}
|
|
@@ -1896,11 +2256,11 @@ function invalidateJob(job) {
|
|
|
1896
2256
|
}
|
|
1897
2257
|
function queuePostFlushCb(cb) {
|
|
1898
2258
|
if (!isArray(cb)) {
|
|
1899
|
-
if (!
|
|
1900
|
-
cb,
|
|
1901
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1902
|
-
)) {
|
|
2259
|
+
if (!(cb.flags & 1)) {
|
|
1903
2260
|
pendingPostFlushCbs.push(cb);
|
|
2261
|
+
if (!(cb.flags & 4)) {
|
|
2262
|
+
cb.flags |= 1;
|
|
2263
|
+
}
|
|
1904
2264
|
}
|
|
1905
2265
|
} else {
|
|
1906
2266
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1913,7 +2273,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1913
2273
|
}
|
|
1914
2274
|
for (; i < queue.length; i++) {
|
|
1915
2275
|
const cb = queue[i];
|
|
1916
|
-
if (cb && cb.
|
|
2276
|
+
if (cb && cb.flags & 2) {
|
|
1917
2277
|
if (instance && cb.id !== instance.uid) {
|
|
1918
2278
|
continue;
|
|
1919
2279
|
}
|
|
@@ -1923,6 +2283,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1923
2283
|
queue.splice(i, 1);
|
|
1924
2284
|
i--;
|
|
1925
2285
|
cb();
|
|
2286
|
+
cb.flags &= ~1;
|
|
1926
2287
|
}
|
|
1927
2288
|
}
|
|
1928
2289
|
}
|
|
@@ -1945,6 +2306,7 @@ function flushPostFlushCbs(seen) {
|
|
|
1945
2306
|
continue;
|
|
1946
2307
|
}
|
|
1947
2308
|
activePostFlushCbs[postFlushIndex]();
|
|
2309
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1948
2310
|
}
|
|
1949
2311
|
activePostFlushCbs = null;
|
|
1950
2312
|
postFlushIndex = 0;
|
|
@@ -1954,9 +2316,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
|
|
|
1954
2316
|
const comparator = (a, b) => {
|
|
1955
2317
|
const diff = getId(a) - getId(b);
|
|
1956
2318
|
if (diff === 0) {
|
|
1957
|
-
|
|
2319
|
+
const isAPre = a.flags & 2;
|
|
2320
|
+
const isBPre = b.flags & 2;
|
|
2321
|
+
if (isAPre && !isBPre)
|
|
1958
2322
|
return -1;
|
|
1959
|
-
if (
|
|
2323
|
+
if (isBPre && !isAPre)
|
|
1960
2324
|
return 1;
|
|
1961
2325
|
}
|
|
1962
2326
|
return diff;
|
|
@@ -1972,11 +2336,12 @@ function flushJobs(seen) {
|
|
|
1972
2336
|
try {
|
|
1973
2337
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1974
2338
|
const job = queue[flushIndex];
|
|
1975
|
-
if (job && job.
|
|
2339
|
+
if (job && !(job.flags & 8)) {
|
|
1976
2340
|
if (check(job)) {
|
|
1977
2341
|
continue;
|
|
1978
2342
|
}
|
|
1979
2343
|
callWithErrorHandling(job, null, 14);
|
|
2344
|
+
job.flags &= ~1;
|
|
1980
2345
|
}
|
|
1981
2346
|
}
|
|
1982
2347
|
} finally {
|
|
@@ -2058,7 +2423,6 @@ function rerender(id, newRender) {
|
|
|
2058
2423
|
}
|
|
2059
2424
|
instance.renderCache = [];
|
|
2060
2425
|
isHmrUpdating = true;
|
|
2061
|
-
instance.effect.dirty = true;
|
|
2062
2426
|
instance.update();
|
|
2063
2427
|
isHmrUpdating = false;
|
|
2064
2428
|
});
|
|
@@ -2086,7 +2450,6 @@ function reload(id, newComp) {
|
|
|
2086
2450
|
instance.ceReload(newComp.styles);
|
|
2087
2451
|
hmrDirtyComponents.delete(oldComp);
|
|
2088
2452
|
} else if (instance.parent) {
|
|
2089
|
-
instance.parent.effect.dirty = true;
|
|
2090
2453
|
queueJob(instance.parent.update);
|
|
2091
2454
|
} else if (instance.appContext.reload) {
|
|
2092
2455
|
instance.appContext.reload();
|
|
@@ -4056,8 +4419,8 @@ function doWatch(source, cb, {
|
|
|
4056
4419
|
};
|
|
4057
4420
|
};
|
|
4058
4421
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
4059
|
-
const job = () => {
|
|
4060
|
-
if (!effect.
|
|
4422
|
+
const job = (immediateFirstRun) => {
|
|
4423
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
4061
4424
|
return;
|
|
4062
4425
|
}
|
|
4063
4426
|
if (cb) {
|
|
@@ -4078,19 +4441,22 @@ function doWatch(source, cb, {
|
|
|
4078
4441
|
effect.run();
|
|
4079
4442
|
}
|
|
4080
4443
|
};
|
|
4081
|
-
|
|
4444
|
+
if (cb)
|
|
4445
|
+
job.flags |= 4;
|
|
4446
|
+
const effect = new ReactiveEffect(getter);
|
|
4082
4447
|
let scheduler;
|
|
4083
4448
|
if (flush === "sync") {
|
|
4449
|
+
effect.flags |= 64;
|
|
4084
4450
|
scheduler = job;
|
|
4085
4451
|
} else if (flush === "post") {
|
|
4086
4452
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
4087
4453
|
} else {
|
|
4088
|
-
job.
|
|
4454
|
+
job.flags |= 2;
|
|
4089
4455
|
if (instance)
|
|
4090
4456
|
job.id = instance.uid;
|
|
4091
4457
|
scheduler = () => queueJob(job);
|
|
4092
4458
|
}
|
|
4093
|
-
|
|
4459
|
+
effect.scheduler = scheduler;
|
|
4094
4460
|
const scope = getCurrentScope();
|
|
4095
4461
|
const unwatch = () => {
|
|
4096
4462
|
effect.stop();
|
|
@@ -4104,7 +4470,7 @@ function doWatch(source, cb, {
|
|
|
4104
4470
|
}
|
|
4105
4471
|
if (cb) {
|
|
4106
4472
|
if (immediate) {
|
|
4107
|
-
job();
|
|
4473
|
+
job(true);
|
|
4108
4474
|
} else {
|
|
4109
4475
|
oldValue = effect.run();
|
|
4110
4476
|
}
|
|
@@ -4286,22 +4652,7 @@ const BaseTransitionImpl = {
|
|
|
4286
4652
|
if (!children || !children.length) {
|
|
4287
4653
|
return;
|
|
4288
4654
|
}
|
|
4289
|
-
|
|
4290
|
-
if (children.length > 1) {
|
|
4291
|
-
let hasFound = false;
|
|
4292
|
-
for (const c of children) {
|
|
4293
|
-
if (c.type !== Comment) {
|
|
4294
|
-
if (hasFound) {
|
|
4295
|
-
warn$1(
|
|
4296
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4297
|
-
);
|
|
4298
|
-
break;
|
|
4299
|
-
}
|
|
4300
|
-
child = c;
|
|
4301
|
-
hasFound = true;
|
|
4302
|
-
}
|
|
4303
|
-
}
|
|
4304
|
-
}
|
|
4655
|
+
const child = findNonCommentChild(children);
|
|
4305
4656
|
const rawProps = toRaw(props);
|
|
4306
4657
|
const { mode } = rawProps;
|
|
4307
4658
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -4310,7 +4661,7 @@ const BaseTransitionImpl = {
|
|
|
4310
4661
|
if (state.isLeaving) {
|
|
4311
4662
|
return emptyPlaceholder(child);
|
|
4312
4663
|
}
|
|
4313
|
-
const innerChild =
|
|
4664
|
+
const innerChild = getInnerChild$1(child);
|
|
4314
4665
|
if (!innerChild) {
|
|
4315
4666
|
return emptyPlaceholder(child);
|
|
4316
4667
|
}
|
|
@@ -4322,7 +4673,7 @@ const BaseTransitionImpl = {
|
|
|
4322
4673
|
);
|
|
4323
4674
|
setTransitionHooks(innerChild, enterHooks);
|
|
4324
4675
|
const oldChild = instance.subTree;
|
|
4325
|
-
const oldInnerChild = oldChild &&
|
|
4676
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
4326
4677
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
4327
4678
|
const leavingHooks = resolveTransitionHooks(
|
|
4328
4679
|
oldInnerChild,
|
|
@@ -4335,8 +4686,7 @@ const BaseTransitionImpl = {
|
|
|
4335
4686
|
state.isLeaving = true;
|
|
4336
4687
|
leavingHooks.afterLeave = () => {
|
|
4337
4688
|
state.isLeaving = false;
|
|
4338
|
-
if (instance.
|
|
4339
|
-
instance.effect.dirty = true;
|
|
4689
|
+
if (!(instance.job.flags & 8)) {
|
|
4340
4690
|
instance.update();
|
|
4341
4691
|
}
|
|
4342
4692
|
};
|
|
@@ -4364,6 +4714,25 @@ const BaseTransitionImpl = {
|
|
|
4364
4714
|
{
|
|
4365
4715
|
BaseTransitionImpl.__isBuiltIn = true;
|
|
4366
4716
|
}
|
|
4717
|
+
function findNonCommentChild(children) {
|
|
4718
|
+
let child = children[0];
|
|
4719
|
+
if (children.length > 1) {
|
|
4720
|
+
let hasFound = false;
|
|
4721
|
+
for (const c of children) {
|
|
4722
|
+
if (c.type !== Comment) {
|
|
4723
|
+
if (hasFound) {
|
|
4724
|
+
warn$1(
|
|
4725
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4726
|
+
);
|
|
4727
|
+
break;
|
|
4728
|
+
}
|
|
4729
|
+
child = c;
|
|
4730
|
+
hasFound = true;
|
|
4731
|
+
}
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
return child;
|
|
4735
|
+
}
|
|
4367
4736
|
const BaseTransition = BaseTransitionImpl;
|
|
4368
4737
|
function getLeavingNodesForType(state, vnode) {
|
|
4369
4738
|
const { leavingVNodes } = state;
|
|
@@ -4518,8 +4887,11 @@ function emptyPlaceholder(vnode) {
|
|
|
4518
4887
|
return vnode;
|
|
4519
4888
|
}
|
|
4520
4889
|
}
|
|
4521
|
-
function
|
|
4890
|
+
function getInnerChild$1(vnode) {
|
|
4522
4891
|
if (!isKeepAlive(vnode)) {
|
|
4892
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4893
|
+
return findNonCommentChild(vnode.children);
|
|
4894
|
+
}
|
|
4523
4895
|
return vnode;
|
|
4524
4896
|
}
|
|
4525
4897
|
if (vnode.component) {
|
|
@@ -4688,7 +5060,6 @@ function defineAsyncComponent(source) {
|
|
|
4688
5060
|
load().then(() => {
|
|
4689
5061
|
loaded.value = true;
|
|
4690
5062
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4691
|
-
instance.parent.effect.dirty = true;
|
|
4692
5063
|
queueJob(instance.parent.update);
|
|
4693
5064
|
}
|
|
4694
5065
|
}).catch((err) => {
|
|
@@ -5300,10 +5671,20 @@ function convertLegacyFunctionalComponent(comp) {
|
|
|
5300
5671
|
function renderList(source, renderItem, cache, index) {
|
|
5301
5672
|
let ret;
|
|
5302
5673
|
const cached = cache && cache[index];
|
|
5303
|
-
|
|
5674
|
+
const sourceIsArray = isArray(source);
|
|
5675
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
5676
|
+
if (sourceIsArray || isString(source)) {
|
|
5677
|
+
if (sourceIsReactiveArray) {
|
|
5678
|
+
source = shallowReadArray(source);
|
|
5679
|
+
}
|
|
5304
5680
|
ret = new Array(source.length);
|
|
5305
5681
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
5306
|
-
ret[i] = renderItem(
|
|
5682
|
+
ret[i] = renderItem(
|
|
5683
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
5684
|
+
i,
|
|
5685
|
+
void 0,
|
|
5686
|
+
cached && cached[i]
|
|
5687
|
+
);
|
|
5307
5688
|
}
|
|
5308
5689
|
} else if (typeof source === "number") {
|
|
5309
5690
|
if (!Number.isInteger(source)) {
|
|
@@ -5674,7 +6055,6 @@ const publicPropertiesMap = (
|
|
|
5674
6055
|
$emit: (i) => i.emit,
|
|
5675
6056
|
$options: (i) => resolveMergedOptions(i) ,
|
|
5676
6057
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
5677
|
-
i.effect.dirty = true;
|
|
5678
6058
|
queueJob(i.update);
|
|
5679
6059
|
}),
|
|
5680
6060
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -6545,7 +6925,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6545
6925
|
return vm;
|
|
6546
6926
|
}
|
|
6547
6927
|
}
|
|
6548
|
-
Vue.version = `2.6.14-compat:${"3.
|
|
6928
|
+
Vue.version = `2.6.14-compat:${"3.5.0-alpha.1"}`;
|
|
6549
6929
|
Vue.config = singletonApp.config;
|
|
6550
6930
|
Vue.use = (p, ...options) => {
|
|
6551
6931
|
if (p && isFunction(p.install)) {
|
|
@@ -7563,7 +7943,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
|
|
|
7563
7943
|
function assertType(value, type) {
|
|
7564
7944
|
let valid;
|
|
7565
7945
|
const expectedType = getType(type);
|
|
7566
|
-
if (
|
|
7946
|
+
if (expectedType === "null") {
|
|
7947
|
+
valid = value === null;
|
|
7948
|
+
} else if (isSimpleType(expectedType)) {
|
|
7567
7949
|
const t = typeof value;
|
|
7568
7950
|
valid = t === expectedType.toLowerCase();
|
|
7569
7951
|
if (!valid && t === "object") {
|
|
@@ -7573,8 +7955,6 @@ function assertType(value, type) {
|
|
|
7573
7955
|
valid = isObject(value);
|
|
7574
7956
|
} else if (expectedType === "Array") {
|
|
7575
7957
|
valid = isArray(value);
|
|
7576
|
-
} else if (expectedType === "null") {
|
|
7577
|
-
valid = value === null;
|
|
7578
7958
|
} else {
|
|
7579
7959
|
valid = value instanceof type;
|
|
7580
7960
|
}
|
|
@@ -9099,7 +9479,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9099
9479
|
} else {
|
|
9100
9480
|
instance.next = n2;
|
|
9101
9481
|
invalidateJob(instance.update);
|
|
9102
|
-
instance.effect.dirty = true;
|
|
9103
9482
|
instance.update();
|
|
9104
9483
|
}
|
|
9105
9484
|
} else {
|
|
@@ -9306,24 +9685,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9306
9685
|
}
|
|
9307
9686
|
}
|
|
9308
9687
|
};
|
|
9309
|
-
|
|
9310
|
-
|
|
9311
|
-
|
|
9312
|
-
|
|
9313
|
-
|
|
9314
|
-
|
|
9315
|
-
);
|
|
9316
|
-
const update = instance.update = () => {
|
|
9317
|
-
if (effect.dirty) {
|
|
9318
|
-
effect.run();
|
|
9319
|
-
}
|
|
9320
|
-
};
|
|
9321
|
-
update.id = instance.uid;
|
|
9688
|
+
instance.scope.on();
|
|
9689
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
9690
|
+
instance.scope.off();
|
|
9691
|
+
const update = instance.update = effect.run.bind(effect);
|
|
9692
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
9693
|
+
job.id = instance.uid;
|
|
9694
|
+
effect.scheduler = () => queueJob(job);
|
|
9322
9695
|
toggleRecurse(instance, true);
|
|
9323
9696
|
{
|
|
9324
9697
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
9325
9698
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
9326
|
-
|
|
9699
|
+
job.ownerInstance = instance;
|
|
9327
9700
|
}
|
|
9328
9701
|
update();
|
|
9329
9702
|
};
|
|
@@ -9790,7 +10163,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9790
10163
|
if (instance.type.__hmrId) {
|
|
9791
10164
|
unregisterHMR(instance);
|
|
9792
10165
|
}
|
|
9793
|
-
const { bum, scope,
|
|
10166
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
9794
10167
|
if (bum) {
|
|
9795
10168
|
invokeArrayFns(bum);
|
|
9796
10169
|
}
|
|
@@ -9798,8 +10171,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9798
10171
|
instance.emit("hook:beforeDestroy");
|
|
9799
10172
|
}
|
|
9800
10173
|
scope.stop();
|
|
9801
|
-
if (
|
|
9802
|
-
|
|
10174
|
+
if (job) {
|
|
10175
|
+
job.flags |= 8;
|
|
9803
10176
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
9804
10177
|
}
|
|
9805
10178
|
if (um) {
|
|
@@ -9891,8 +10264,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
9891
10264
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
9892
10265
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
9893
10266
|
}
|
|
9894
|
-
function toggleRecurse({ effect,
|
|
9895
|
-
|
|
10267
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
10268
|
+
if (allowed) {
|
|
10269
|
+
effect.flags |= 32;
|
|
10270
|
+
job.flags |= 4;
|
|
10271
|
+
} else {
|
|
10272
|
+
effect.flags &= ~32;
|
|
10273
|
+
job.flags &= ~4;
|
|
10274
|
+
}
|
|
9896
10275
|
}
|
|
9897
10276
|
function needTransition(parentSuspense, transition) {
|
|
9898
10277
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -10690,6 +11069,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
10690
11069
|
effect: null,
|
|
10691
11070
|
update: null,
|
|
10692
11071
|
// will be set synchronously right after creation
|
|
11072
|
+
job: null,
|
|
10693
11073
|
scope: new EffectScope(
|
|
10694
11074
|
true
|
|
10695
11075
|
/* detached */
|
|
@@ -11195,7 +11575,8 @@ function initCustomFormatter() {
|
|
|
11195
11575
|
{},
|
|
11196
11576
|
["span", vueStyle, genRefFlag(obj)],
|
|
11197
11577
|
"<",
|
|
11198
|
-
|
|
11578
|
+
// avoid debugger accessing value affecting behavior
|
|
11579
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
11199
11580
|
`>`
|
|
11200
11581
|
];
|
|
11201
11582
|
} else if (isReactive(obj)) {
|
|
@@ -11375,7 +11756,7 @@ function isMemoSame(cached, memo) {
|
|
|
11375
11756
|
return true;
|
|
11376
11757
|
}
|
|
11377
11758
|
|
|
11378
|
-
const version = "3.
|
|
11759
|
+
const version = "3.5.0-alpha.1";
|
|
11379
11760
|
const warn = warn$1 ;
|
|
11380
11761
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
11381
11762
|
const devtools = devtools$1 ;
|
|
@@ -12942,7 +13323,9 @@ const withKeys = (fn, modifiers) => {
|
|
|
12942
13323
|
return;
|
|
12943
13324
|
}
|
|
12944
13325
|
const eventKey = hyphenate(event.key);
|
|
12945
|
-
if (modifiers.some(
|
|
13326
|
+
if (modifiers.some(
|
|
13327
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
13328
|
+
)) {
|
|
12946
13329
|
return fn(event);
|
|
12947
13330
|
}
|
|
12948
13331
|
{
|
|
@@ -18923,9 +19306,183 @@ const ignoreSideEffectTags = (node, context) => {
|
|
|
18923
19306
|
}
|
|
18924
19307
|
};
|
|
18925
19308
|
|
|
19309
|
+
function isValidHTMLNesting(parent, child) {
|
|
19310
|
+
if (parent in onlyValidChildren) {
|
|
19311
|
+
return onlyValidChildren[parent].has(child);
|
|
19312
|
+
}
|
|
19313
|
+
if (child in onlyValidParents) {
|
|
19314
|
+
return onlyValidParents[child].has(parent);
|
|
19315
|
+
}
|
|
19316
|
+
if (parent in knownInvalidChildren) {
|
|
19317
|
+
if (knownInvalidChildren[parent].has(child))
|
|
19318
|
+
return false;
|
|
19319
|
+
}
|
|
19320
|
+
if (child in knownInvalidParents) {
|
|
19321
|
+
if (knownInvalidParents[child].has(parent))
|
|
19322
|
+
return false;
|
|
19323
|
+
}
|
|
19324
|
+
return true;
|
|
19325
|
+
}
|
|
19326
|
+
const headings = /* @__PURE__ */ new Set(["h1", "h2", "h3", "h4", "h5", "h6"]);
|
|
19327
|
+
const emptySet = /* @__PURE__ */ new Set([]);
|
|
19328
|
+
const onlyValidChildren = {
|
|
19329
|
+
head: /* @__PURE__ */ new Set([
|
|
19330
|
+
"base",
|
|
19331
|
+
"basefront",
|
|
19332
|
+
"bgsound",
|
|
19333
|
+
"link",
|
|
19334
|
+
"meta",
|
|
19335
|
+
"title",
|
|
19336
|
+
"noscript",
|
|
19337
|
+
"noframes",
|
|
19338
|
+
"style",
|
|
19339
|
+
"script",
|
|
19340
|
+
"template"
|
|
19341
|
+
]),
|
|
19342
|
+
optgroup: /* @__PURE__ */ new Set(["option"]),
|
|
19343
|
+
select: /* @__PURE__ */ new Set(["optgroup", "option", "hr"]),
|
|
19344
|
+
// table
|
|
19345
|
+
table: /* @__PURE__ */ new Set(["caption", "colgroup", "tbody", "tfoot", "thead"]),
|
|
19346
|
+
tr: /* @__PURE__ */ new Set(["td", "th"]),
|
|
19347
|
+
colgroup: /* @__PURE__ */ new Set(["col"]),
|
|
19348
|
+
tbody: /* @__PURE__ */ new Set(["tr"]),
|
|
19349
|
+
thead: /* @__PURE__ */ new Set(["tr"]),
|
|
19350
|
+
tfoot: /* @__PURE__ */ new Set(["tr"]),
|
|
19351
|
+
// these elements can not have any children elements
|
|
19352
|
+
script: emptySet,
|
|
19353
|
+
iframe: emptySet,
|
|
19354
|
+
option: emptySet,
|
|
19355
|
+
textarea: emptySet,
|
|
19356
|
+
style: emptySet,
|
|
19357
|
+
title: emptySet
|
|
19358
|
+
};
|
|
19359
|
+
const onlyValidParents = {
|
|
19360
|
+
// sections
|
|
19361
|
+
html: emptySet,
|
|
19362
|
+
body: /* @__PURE__ */ new Set(["html"]),
|
|
19363
|
+
head: /* @__PURE__ */ new Set(["html"]),
|
|
19364
|
+
// table
|
|
19365
|
+
td: /* @__PURE__ */ new Set(["tr"]),
|
|
19366
|
+
colgroup: /* @__PURE__ */ new Set(["table"]),
|
|
19367
|
+
caption: /* @__PURE__ */ new Set(["table"]),
|
|
19368
|
+
tbody: /* @__PURE__ */ new Set(["table"]),
|
|
19369
|
+
tfoot: /* @__PURE__ */ new Set(["table"]),
|
|
19370
|
+
col: /* @__PURE__ */ new Set(["colgroup"]),
|
|
19371
|
+
th: /* @__PURE__ */ new Set(["tr"]),
|
|
19372
|
+
thead: /* @__PURE__ */ new Set(["table"]),
|
|
19373
|
+
tr: /* @__PURE__ */ new Set(["tbody", "thead", "tfoot"]),
|
|
19374
|
+
// data list
|
|
19375
|
+
dd: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
19376
|
+
dt: /* @__PURE__ */ new Set(["dl", "div"]),
|
|
19377
|
+
// other
|
|
19378
|
+
figcaption: /* @__PURE__ */ new Set(["figure"]),
|
|
19379
|
+
// li: new Set(["ul", "ol"]),
|
|
19380
|
+
summary: /* @__PURE__ */ new Set(["details"]),
|
|
19381
|
+
area: /* @__PURE__ */ new Set(["map"])
|
|
19382
|
+
};
|
|
19383
|
+
const knownInvalidChildren = {
|
|
19384
|
+
p: /* @__PURE__ */ new Set([
|
|
19385
|
+
"address",
|
|
19386
|
+
"article",
|
|
19387
|
+
"aside",
|
|
19388
|
+
"blockquote",
|
|
19389
|
+
"center",
|
|
19390
|
+
"details",
|
|
19391
|
+
"dialog",
|
|
19392
|
+
"dir",
|
|
19393
|
+
"div",
|
|
19394
|
+
"dl",
|
|
19395
|
+
"fieldset",
|
|
19396
|
+
"figure",
|
|
19397
|
+
"footer",
|
|
19398
|
+
"form",
|
|
19399
|
+
"h1",
|
|
19400
|
+
"h2",
|
|
19401
|
+
"h3",
|
|
19402
|
+
"h4",
|
|
19403
|
+
"h5",
|
|
19404
|
+
"h6",
|
|
19405
|
+
"header",
|
|
19406
|
+
"hgroup",
|
|
19407
|
+
"hr",
|
|
19408
|
+
"li",
|
|
19409
|
+
"main",
|
|
19410
|
+
"nav",
|
|
19411
|
+
"menu",
|
|
19412
|
+
"ol",
|
|
19413
|
+
"p",
|
|
19414
|
+
"pre",
|
|
19415
|
+
"section",
|
|
19416
|
+
"table",
|
|
19417
|
+
"ul"
|
|
19418
|
+
]),
|
|
19419
|
+
svg: /* @__PURE__ */ new Set([
|
|
19420
|
+
"b",
|
|
19421
|
+
"blockquote",
|
|
19422
|
+
"br",
|
|
19423
|
+
"code",
|
|
19424
|
+
"dd",
|
|
19425
|
+
"div",
|
|
19426
|
+
"dl",
|
|
19427
|
+
"dt",
|
|
19428
|
+
"em",
|
|
19429
|
+
"embed",
|
|
19430
|
+
"h1",
|
|
19431
|
+
"h2",
|
|
19432
|
+
"h3",
|
|
19433
|
+
"h4",
|
|
19434
|
+
"h5",
|
|
19435
|
+
"h6",
|
|
19436
|
+
"hr",
|
|
19437
|
+
"i",
|
|
19438
|
+
"img",
|
|
19439
|
+
"li",
|
|
19440
|
+
"menu",
|
|
19441
|
+
"meta",
|
|
19442
|
+
"ol",
|
|
19443
|
+
"p",
|
|
19444
|
+
"pre",
|
|
19445
|
+
"ruby",
|
|
19446
|
+
"s",
|
|
19447
|
+
"small",
|
|
19448
|
+
"span",
|
|
19449
|
+
"strong",
|
|
19450
|
+
"sub",
|
|
19451
|
+
"sup",
|
|
19452
|
+
"table",
|
|
19453
|
+
"u",
|
|
19454
|
+
"ul",
|
|
19455
|
+
"var"
|
|
19456
|
+
])
|
|
19457
|
+
};
|
|
19458
|
+
const knownInvalidParents = {
|
|
19459
|
+
a: /* @__PURE__ */ new Set(["a"]),
|
|
19460
|
+
button: /* @__PURE__ */ new Set(["button"]),
|
|
19461
|
+
dd: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
19462
|
+
dt: /* @__PURE__ */ new Set(["dd", "dt"]),
|
|
19463
|
+
form: /* @__PURE__ */ new Set(["form"]),
|
|
19464
|
+
li: /* @__PURE__ */ new Set(["li"]),
|
|
19465
|
+
h1: headings,
|
|
19466
|
+
h2: headings,
|
|
19467
|
+
h3: headings,
|
|
19468
|
+
h4: headings,
|
|
19469
|
+
h5: headings,
|
|
19470
|
+
h6: headings
|
|
19471
|
+
};
|
|
19472
|
+
|
|
19473
|
+
const validateHtmlNesting = (node, context) => {
|
|
19474
|
+
if (node.type === 1 && node.tagType === 0 && context.parent && context.parent.type === 1 && context.parent.tagType === 0 && !isValidHTMLNesting(context.parent.tag, node.tag)) {
|
|
19475
|
+
const error = new SyntaxError(
|
|
19476
|
+
`<${node.tag}> cannot be child of <${context.parent.tag}>, according to HTML specifications. This can cause hydration errors or potentially disrupt future functionality.`
|
|
19477
|
+
);
|
|
19478
|
+
error.loc = node.loc;
|
|
19479
|
+
context.onWarn(error);
|
|
19480
|
+
}
|
|
19481
|
+
};
|
|
19482
|
+
|
|
18926
19483
|
const DOMNodeTransforms = [
|
|
18927
19484
|
transformStyle,
|
|
18928
|
-
...[transformTransition]
|
|
19485
|
+
...[transformTransition, validateHtmlNesting]
|
|
18929
19486
|
];
|
|
18930
19487
|
const DOMDirectiveTransforms = {
|
|
18931
19488
|
cloak: noopDirectiveTransform,
|