@vue/compat 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 +994 -419
- package/dist/vue.cjs.prod.js +780 -405
- package/dist/vue.esm-browser.js +994 -419
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +1006 -421
- package/dist/vue.global.js +994 -419
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +819 -418
- package/dist/vue.runtime.esm-browser.prod.js +6 -6
- package/dist/vue.runtime.esm-bundler.js +831 -420
- package/dist/vue.runtime.global.js +819 -418
- package/dist/vue.runtime.global.prod.js +6 -6
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/compat v3.
|
|
2
|
+
* @vue/compat v3.5.0-alpha.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -388,156 +388,280 @@ var Vue = (function () {
|
|
|
388
388
|
function effectScope(detached) {
|
|
389
389
|
return new EffectScope(detached);
|
|
390
390
|
}
|
|
391
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
392
|
-
if (scope && scope.active) {
|
|
393
|
-
scope.effects.push(effect);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
391
|
function getCurrentScope() {
|
|
397
392
|
return activeEffectScope;
|
|
398
393
|
}
|
|
399
|
-
function onScopeDispose(fn) {
|
|
394
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
400
395
|
if (activeEffectScope) {
|
|
401
396
|
activeEffectScope.cleanups.push(fn);
|
|
402
|
-
} else {
|
|
397
|
+
} else if (!failSilently) {
|
|
403
398
|
warn$2(
|
|
404
399
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
405
400
|
);
|
|
406
401
|
}
|
|
407
402
|
}
|
|
408
403
|
|
|
409
|
-
let
|
|
404
|
+
let activeSub;
|
|
410
405
|
class ReactiveEffect {
|
|
411
|
-
constructor(fn
|
|
406
|
+
constructor(fn) {
|
|
412
407
|
this.fn = fn;
|
|
413
|
-
this.trigger = trigger;
|
|
414
|
-
this.scheduler = scheduler;
|
|
415
|
-
this.active = true;
|
|
416
|
-
this.deps = [];
|
|
417
408
|
/**
|
|
418
409
|
* @internal
|
|
419
410
|
*/
|
|
420
|
-
this.
|
|
411
|
+
this.deps = void 0;
|
|
421
412
|
/**
|
|
422
413
|
* @internal
|
|
423
414
|
*/
|
|
424
|
-
this.
|
|
415
|
+
this.depsTail = void 0;
|
|
425
416
|
/**
|
|
426
417
|
* @internal
|
|
427
418
|
*/
|
|
428
|
-
this.
|
|
419
|
+
this.flags = 1 | 4;
|
|
429
420
|
/**
|
|
430
421
|
* @internal
|
|
431
422
|
*/
|
|
432
|
-
this.
|
|
423
|
+
this.nextEffect = void 0;
|
|
433
424
|
/**
|
|
434
425
|
* @internal
|
|
435
426
|
*/
|
|
436
|
-
this.
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
441
|
-
this._dirtyLevel = 1;
|
|
442
|
-
pauseTracking();
|
|
443
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
444
|
-
const dep = this.deps[i];
|
|
445
|
-
if (dep.computed) {
|
|
446
|
-
triggerComputed(dep.computed);
|
|
447
|
-
if (this._dirtyLevel >= 4) {
|
|
448
|
-
break;
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
if (this._dirtyLevel === 1) {
|
|
453
|
-
this._dirtyLevel = 0;
|
|
454
|
-
}
|
|
455
|
-
resetTracking();
|
|
427
|
+
this.cleanup = void 0;
|
|
428
|
+
this.scheduler = void 0;
|
|
429
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
430
|
+
activeEffectScope.effects.push(this);
|
|
456
431
|
}
|
|
457
|
-
return this._dirtyLevel >= 4;
|
|
458
432
|
}
|
|
459
|
-
|
|
460
|
-
|
|
433
|
+
/**
|
|
434
|
+
* @internal
|
|
435
|
+
*/
|
|
436
|
+
notify() {
|
|
437
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
if (this.flags & 64) {
|
|
441
|
+
return this.trigger();
|
|
442
|
+
}
|
|
443
|
+
if (!(this.flags & 8)) {
|
|
444
|
+
this.flags |= 8;
|
|
445
|
+
this.nextEffect = batchedEffect;
|
|
446
|
+
batchedEffect = this;
|
|
447
|
+
}
|
|
461
448
|
}
|
|
462
449
|
run() {
|
|
463
|
-
this.
|
|
464
|
-
if (!this.active) {
|
|
450
|
+
if (!(this.flags & 1)) {
|
|
465
451
|
return this.fn();
|
|
466
452
|
}
|
|
467
|
-
|
|
468
|
-
|
|
453
|
+
this.flags |= 2;
|
|
454
|
+
cleanupEffect(this);
|
|
455
|
+
prepareDeps(this);
|
|
456
|
+
const prevEffect = activeSub;
|
|
457
|
+
const prevShouldTrack = shouldTrack;
|
|
458
|
+
activeSub = this;
|
|
459
|
+
shouldTrack = true;
|
|
469
460
|
try {
|
|
470
|
-
shouldTrack = true;
|
|
471
|
-
activeEffect = this;
|
|
472
|
-
this._runnings++;
|
|
473
|
-
preCleanupEffect(this);
|
|
474
461
|
return this.fn();
|
|
475
462
|
} finally {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
463
|
+
if (activeSub !== this) {
|
|
464
|
+
warn$2(
|
|
465
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
cleanupDeps(this);
|
|
469
|
+
activeSub = prevEffect;
|
|
470
|
+
shouldTrack = prevShouldTrack;
|
|
471
|
+
this.flags &= ~2;
|
|
480
472
|
}
|
|
481
473
|
}
|
|
482
474
|
stop() {
|
|
483
|
-
if (this.
|
|
484
|
-
|
|
485
|
-
|
|
475
|
+
if (this.flags & 1) {
|
|
476
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
477
|
+
removeSub(link);
|
|
478
|
+
}
|
|
479
|
+
this.deps = this.depsTail = void 0;
|
|
480
|
+
cleanupEffect(this);
|
|
486
481
|
this.onStop && this.onStop();
|
|
487
|
-
this.
|
|
482
|
+
this.flags &= ~1;
|
|
488
483
|
}
|
|
489
484
|
}
|
|
485
|
+
trigger() {
|
|
486
|
+
if (this.scheduler) {
|
|
487
|
+
this.scheduler();
|
|
488
|
+
} else {
|
|
489
|
+
this.runIfDirty();
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* @internal
|
|
494
|
+
*/
|
|
495
|
+
runIfDirty() {
|
|
496
|
+
if (isDirty(this)) {
|
|
497
|
+
this.run();
|
|
498
|
+
}
|
|
499
|
+
}
|
|
500
|
+
get dirty() {
|
|
501
|
+
return isDirty(this);
|
|
502
|
+
}
|
|
490
503
|
}
|
|
491
|
-
|
|
492
|
-
|
|
504
|
+
let batchDepth = 0;
|
|
505
|
+
let batchedEffect;
|
|
506
|
+
function startBatch() {
|
|
507
|
+
batchDepth++;
|
|
493
508
|
}
|
|
494
|
-
function
|
|
495
|
-
|
|
496
|
-
|
|
509
|
+
function endBatch() {
|
|
510
|
+
if (batchDepth > 1) {
|
|
511
|
+
batchDepth--;
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
let error;
|
|
515
|
+
while (batchedEffect) {
|
|
516
|
+
let e = batchedEffect;
|
|
517
|
+
batchedEffect = void 0;
|
|
518
|
+
while (e) {
|
|
519
|
+
const next = e.nextEffect;
|
|
520
|
+
e.nextEffect = void 0;
|
|
521
|
+
e.flags &= ~8;
|
|
522
|
+
if (e.flags & 1) {
|
|
523
|
+
try {
|
|
524
|
+
e.trigger();
|
|
525
|
+
} catch (err) {
|
|
526
|
+
if (!error)
|
|
527
|
+
error = err;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
e = next;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
batchDepth--;
|
|
534
|
+
if (error)
|
|
535
|
+
throw error;
|
|
497
536
|
}
|
|
498
|
-
function
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
537
|
+
function prepareDeps(sub) {
|
|
538
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
539
|
+
link.version = -1;
|
|
540
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
541
|
+
link.dep.activeLink = link;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
function cleanupDeps(sub) {
|
|
545
|
+
let head;
|
|
546
|
+
let tail = sub.depsTail;
|
|
547
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
548
|
+
if (link.version === -1) {
|
|
549
|
+
if (link === tail)
|
|
550
|
+
tail = link.prevDep;
|
|
551
|
+
removeSub(link);
|
|
552
|
+
removeDep(link);
|
|
553
|
+
} else {
|
|
554
|
+
head = link;
|
|
502
555
|
}
|
|
503
|
-
|
|
556
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
557
|
+
link.prevActiveLink = void 0;
|
|
504
558
|
}
|
|
559
|
+
sub.deps = head;
|
|
560
|
+
sub.depsTail = tail;
|
|
505
561
|
}
|
|
506
|
-
function
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
if (dep.size === 0) {
|
|
511
|
-
dep.cleanup();
|
|
562
|
+
function isDirty(sub) {
|
|
563
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
564
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
565
|
+
return true;
|
|
512
566
|
}
|
|
513
567
|
}
|
|
568
|
+
if (sub._dirty) {
|
|
569
|
+
return true;
|
|
570
|
+
}
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
function refreshComputed(computed) {
|
|
574
|
+
if (computed.flags & 2) {
|
|
575
|
+
return false;
|
|
576
|
+
}
|
|
577
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
computed.flags &= ~16;
|
|
581
|
+
if (computed.globalVersion === globalVersion) {
|
|
582
|
+
return;
|
|
583
|
+
}
|
|
584
|
+
computed.globalVersion = globalVersion;
|
|
585
|
+
const dep = computed.dep;
|
|
586
|
+
computed.flags |= 2;
|
|
587
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
588
|
+
computed.flags &= ~2;
|
|
589
|
+
return;
|
|
590
|
+
}
|
|
591
|
+
const prevSub = activeSub;
|
|
592
|
+
const prevShouldTrack = shouldTrack;
|
|
593
|
+
activeSub = computed;
|
|
594
|
+
shouldTrack = true;
|
|
595
|
+
try {
|
|
596
|
+
prepareDeps(computed);
|
|
597
|
+
const value = computed.fn();
|
|
598
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
599
|
+
computed._value = value;
|
|
600
|
+
dep.version++;
|
|
601
|
+
}
|
|
602
|
+
} catch (err) {
|
|
603
|
+
dep.version++;
|
|
604
|
+
throw err;
|
|
605
|
+
} finally {
|
|
606
|
+
activeSub = prevSub;
|
|
607
|
+
shouldTrack = prevShouldTrack;
|
|
608
|
+
cleanupDeps(computed);
|
|
609
|
+
computed.flags &= ~2;
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
function removeSub(link) {
|
|
613
|
+
const { dep, prevSub, nextSub } = link;
|
|
614
|
+
if (prevSub) {
|
|
615
|
+
prevSub.nextSub = nextSub;
|
|
616
|
+
link.prevSub = void 0;
|
|
617
|
+
}
|
|
618
|
+
if (nextSub) {
|
|
619
|
+
nextSub.prevSub = prevSub;
|
|
620
|
+
link.nextSub = void 0;
|
|
621
|
+
}
|
|
622
|
+
if (dep.subs === link) {
|
|
623
|
+
dep.subs = prevSub;
|
|
624
|
+
}
|
|
625
|
+
if (!dep.subs && dep.computed) {
|
|
626
|
+
dep.computed.flags &= ~4;
|
|
627
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
628
|
+
removeSub(l);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
function removeDep(link) {
|
|
633
|
+
const { prevDep, nextDep } = link;
|
|
634
|
+
if (prevDep) {
|
|
635
|
+
prevDep.nextDep = nextDep;
|
|
636
|
+
link.prevDep = void 0;
|
|
637
|
+
}
|
|
638
|
+
if (nextDep) {
|
|
639
|
+
nextDep.prevDep = prevDep;
|
|
640
|
+
link.nextDep = void 0;
|
|
641
|
+
}
|
|
514
642
|
}
|
|
515
643
|
function effect(fn, options) {
|
|
516
644
|
if (fn.effect instanceof ReactiveEffect) {
|
|
517
645
|
fn = fn.effect.fn;
|
|
518
646
|
}
|
|
519
|
-
const
|
|
520
|
-
if (_effect.dirty) {
|
|
521
|
-
_effect.run();
|
|
522
|
-
}
|
|
523
|
-
});
|
|
647
|
+
const e = new ReactiveEffect(fn);
|
|
524
648
|
if (options) {
|
|
525
|
-
extend(
|
|
526
|
-
if (options.scope)
|
|
527
|
-
recordEffectScope(_effect, options.scope);
|
|
649
|
+
extend(e, options);
|
|
528
650
|
}
|
|
529
|
-
|
|
530
|
-
|
|
651
|
+
try {
|
|
652
|
+
e.run();
|
|
653
|
+
} catch (err) {
|
|
654
|
+
e.stop();
|
|
655
|
+
throw err;
|
|
531
656
|
}
|
|
532
|
-
const runner =
|
|
533
|
-
runner.effect =
|
|
657
|
+
const runner = e.run.bind(e);
|
|
658
|
+
runner.effect = e;
|
|
534
659
|
return runner;
|
|
535
660
|
}
|
|
536
661
|
function stop(runner) {
|
|
537
662
|
runner.effect.stop();
|
|
538
663
|
}
|
|
539
664
|
let shouldTrack = true;
|
|
540
|
-
let pauseScheduleStack = 0;
|
|
541
665
|
const trackStack = [];
|
|
542
666
|
function pauseTracking() {
|
|
543
667
|
trackStack.push(shouldTrack);
|
|
@@ -547,192 +671,414 @@ var Vue = (function () {
|
|
|
547
671
|
const last = trackStack.pop();
|
|
548
672
|
shouldTrack = last === void 0 ? true : last;
|
|
549
673
|
}
|
|
550
|
-
function
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
674
|
+
function cleanupEffect(e) {
|
|
675
|
+
const { cleanup } = e;
|
|
676
|
+
e.cleanup = void 0;
|
|
677
|
+
if (cleanup) {
|
|
678
|
+
const prevSub = activeSub;
|
|
679
|
+
activeSub = void 0;
|
|
680
|
+
try {
|
|
681
|
+
cleanup();
|
|
682
|
+
} finally {
|
|
683
|
+
activeSub = prevSub;
|
|
684
|
+
}
|
|
557
685
|
}
|
|
558
686
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
687
|
+
|
|
688
|
+
let globalVersion = 0;
|
|
689
|
+
class Dep {
|
|
690
|
+
constructor(computed) {
|
|
691
|
+
this.computed = computed;
|
|
692
|
+
this.version = 0;
|
|
693
|
+
/**
|
|
694
|
+
* Link between this dep and the current active effect
|
|
695
|
+
*/
|
|
696
|
+
this.activeLink = void 0;
|
|
697
|
+
/**
|
|
698
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
699
|
+
*/
|
|
700
|
+
this.subs = void 0;
|
|
572
701
|
{
|
|
573
|
-
|
|
702
|
+
this.subsHead = void 0;
|
|
574
703
|
}
|
|
575
704
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
705
|
+
track(debugInfo) {
|
|
706
|
+
if (!activeSub || !shouldTrack) {
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
let link = this.activeLink;
|
|
710
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
711
|
+
link = this.activeLink = {
|
|
712
|
+
dep: this,
|
|
713
|
+
sub: activeSub,
|
|
714
|
+
version: this.version,
|
|
715
|
+
nextDep: void 0,
|
|
716
|
+
prevDep: void 0,
|
|
717
|
+
nextSub: void 0,
|
|
718
|
+
prevSub: void 0,
|
|
719
|
+
prevActiveLink: void 0
|
|
720
|
+
};
|
|
721
|
+
if (!activeSub.deps) {
|
|
722
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
723
|
+
} else {
|
|
724
|
+
link.prevDep = activeSub.depsTail;
|
|
725
|
+
activeSub.depsTail.nextDep = link;
|
|
726
|
+
activeSub.depsTail = link;
|
|
727
|
+
}
|
|
728
|
+
if (activeSub.flags & 4) {
|
|
729
|
+
addSub(link);
|
|
590
730
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
731
|
+
} else if (link.version === -1) {
|
|
732
|
+
link.version = this.version;
|
|
733
|
+
if (link.nextDep) {
|
|
734
|
+
const next = link.nextDep;
|
|
735
|
+
next.prevDep = link.prevDep;
|
|
736
|
+
if (link.prevDep) {
|
|
737
|
+
link.prevDep.nextDep = next;
|
|
596
738
|
}
|
|
739
|
+
link.prevDep = activeSub.depsTail;
|
|
740
|
+
link.nextDep = void 0;
|
|
741
|
+
activeSub.depsTail.nextDep = link;
|
|
742
|
+
activeSub.depsTail = link;
|
|
743
|
+
if (activeSub.deps === link) {
|
|
744
|
+
activeSub.deps = next;
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
if (activeSub.onTrack) {
|
|
749
|
+
activeSub.onTrack(
|
|
750
|
+
extend(
|
|
751
|
+
{
|
|
752
|
+
effect: activeSub
|
|
753
|
+
},
|
|
754
|
+
debugInfo
|
|
755
|
+
)
|
|
756
|
+
);
|
|
757
|
+
}
|
|
758
|
+
return link;
|
|
759
|
+
}
|
|
760
|
+
trigger(debugInfo) {
|
|
761
|
+
this.version++;
|
|
762
|
+
globalVersion++;
|
|
763
|
+
this.notify(debugInfo);
|
|
764
|
+
}
|
|
765
|
+
notify(debugInfo) {
|
|
766
|
+
startBatch();
|
|
767
|
+
try {
|
|
768
|
+
if (true) {
|
|
769
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
770
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
771
|
+
head.sub.onTrigger(
|
|
772
|
+
extend(
|
|
773
|
+
{
|
|
774
|
+
effect: head.sub
|
|
775
|
+
},
|
|
776
|
+
debugInfo
|
|
777
|
+
)
|
|
778
|
+
);
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
783
|
+
link.sub.notify();
|
|
597
784
|
}
|
|
785
|
+
} finally {
|
|
786
|
+
endBatch();
|
|
598
787
|
}
|
|
599
788
|
}
|
|
600
|
-
resetScheduling();
|
|
601
789
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
790
|
+
function addSub(link) {
|
|
791
|
+
const computed = link.dep.computed;
|
|
792
|
+
if (computed && !link.dep.subs) {
|
|
793
|
+
computed.flags |= 4 | 16;
|
|
794
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
795
|
+
addSub(l);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
const currentTail = link.dep.subs;
|
|
799
|
+
if (currentTail !== link) {
|
|
800
|
+
link.prevSub = currentTail;
|
|
801
|
+
if (currentTail)
|
|
802
|
+
currentTail.nextSub = link;
|
|
803
|
+
}
|
|
804
|
+
if (link.dep.subsHead === void 0) {
|
|
805
|
+
link.dep.subsHead = link;
|
|
806
|
+
}
|
|
807
|
+
link.dep.subs = link;
|
|
808
|
+
}
|
|
610
809
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
611
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
612
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
810
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
811
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
812
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
613
813
|
function track(target, type, key) {
|
|
614
|
-
if (shouldTrack &&
|
|
814
|
+
if (shouldTrack && activeSub) {
|
|
615
815
|
let depsMap = targetMap.get(target);
|
|
616
816
|
if (!depsMap) {
|
|
617
817
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
618
818
|
}
|
|
619
819
|
let dep = depsMap.get(key);
|
|
620
820
|
if (!dep) {
|
|
621
|
-
depsMap.set(key, dep =
|
|
821
|
+
depsMap.set(key, dep = new Dep());
|
|
622
822
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
dep,
|
|
626
|
-
{
|
|
823
|
+
{
|
|
824
|
+
dep.track({
|
|
627
825
|
target,
|
|
628
826
|
type,
|
|
629
827
|
key
|
|
630
|
-
}
|
|
631
|
-
|
|
828
|
+
});
|
|
829
|
+
}
|
|
632
830
|
}
|
|
633
831
|
}
|
|
634
832
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
635
833
|
const depsMap = targetMap.get(target);
|
|
636
834
|
if (!depsMap) {
|
|
835
|
+
globalVersion++;
|
|
637
836
|
return;
|
|
638
837
|
}
|
|
639
838
|
let deps = [];
|
|
640
839
|
if (type === "clear") {
|
|
641
840
|
deps = [...depsMap.values()];
|
|
642
|
-
} else if (key === "length" && isArray(target)) {
|
|
643
|
-
const newLength = Number(newValue);
|
|
644
|
-
depsMap.forEach((dep, key2) => {
|
|
645
|
-
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
|
646
|
-
deps.push(dep);
|
|
647
|
-
}
|
|
648
|
-
});
|
|
649
841
|
} else {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
if (!
|
|
656
|
-
deps.push(
|
|
657
|
-
if (isMap(target)) {
|
|
658
|
-
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
659
|
-
}
|
|
660
|
-
} else if (isIntegerKey(key)) {
|
|
661
|
-
deps.push(depsMap.get("length"));
|
|
842
|
+
const targetIsArray = isArray(target);
|
|
843
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
844
|
+
if (targetIsArray && key === "length") {
|
|
845
|
+
const newLength = Number(newValue);
|
|
846
|
+
depsMap.forEach((dep, key2) => {
|
|
847
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
848
|
+
deps.push(dep);
|
|
662
849
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
850
|
+
});
|
|
851
|
+
} else {
|
|
852
|
+
const push = (dep) => dep && deps.push(dep);
|
|
853
|
+
if (key !== void 0) {
|
|
854
|
+
push(depsMap.get(key));
|
|
855
|
+
}
|
|
856
|
+
if (isArrayIndex) {
|
|
857
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
858
|
+
}
|
|
859
|
+
switch (type) {
|
|
860
|
+
case "add":
|
|
861
|
+
if (!targetIsArray) {
|
|
862
|
+
push(depsMap.get(ITERATE_KEY));
|
|
863
|
+
if (isMap(target)) {
|
|
864
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
865
|
+
}
|
|
866
|
+
} else if (isArrayIndex) {
|
|
867
|
+
push(depsMap.get("length"));
|
|
868
|
+
}
|
|
869
|
+
break;
|
|
870
|
+
case "delete":
|
|
871
|
+
if (!targetIsArray) {
|
|
872
|
+
push(depsMap.get(ITERATE_KEY));
|
|
873
|
+
if (isMap(target)) {
|
|
874
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
break;
|
|
878
|
+
case "set":
|
|
667
879
|
if (isMap(target)) {
|
|
668
|
-
|
|
880
|
+
push(depsMap.get(ITERATE_KEY));
|
|
669
881
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
case "set":
|
|
673
|
-
if (isMap(target)) {
|
|
674
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
675
|
-
}
|
|
676
|
-
break;
|
|
882
|
+
break;
|
|
883
|
+
}
|
|
677
884
|
}
|
|
678
885
|
}
|
|
679
|
-
|
|
886
|
+
startBatch();
|
|
680
887
|
for (const dep of deps) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
oldValue,
|
|
691
|
-
oldTarget
|
|
692
|
-
}
|
|
693
|
-
);
|
|
888
|
+
{
|
|
889
|
+
dep.trigger({
|
|
890
|
+
target,
|
|
891
|
+
type,
|
|
892
|
+
key,
|
|
893
|
+
newValue,
|
|
894
|
+
oldValue,
|
|
895
|
+
oldTarget
|
|
896
|
+
});
|
|
694
897
|
}
|
|
695
898
|
}
|
|
696
|
-
|
|
899
|
+
endBatch();
|
|
697
900
|
}
|
|
698
901
|
function getDepFromReactive(object, key) {
|
|
699
|
-
|
|
700
|
-
return
|
|
902
|
+
var _a;
|
|
903
|
+
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
function reactiveReadArray(array) {
|
|
907
|
+
const raw = toRaw(array);
|
|
908
|
+
if (raw === array)
|
|
909
|
+
return raw;
|
|
910
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
911
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
912
|
+
}
|
|
913
|
+
function shallowReadArray(arr) {
|
|
914
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
915
|
+
return arr;
|
|
916
|
+
}
|
|
917
|
+
const arrayInstrumentations = {
|
|
918
|
+
__proto__: null,
|
|
919
|
+
[Symbol.iterator]() {
|
|
920
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
921
|
+
},
|
|
922
|
+
concat(...args) {
|
|
923
|
+
return reactiveReadArray(this).concat(
|
|
924
|
+
...args.map((x) => reactiveReadArray(x))
|
|
925
|
+
);
|
|
926
|
+
},
|
|
927
|
+
entries() {
|
|
928
|
+
return iterator(this, "entries", (value) => {
|
|
929
|
+
value[1] = toReactive(value[1]);
|
|
930
|
+
return value;
|
|
931
|
+
});
|
|
932
|
+
},
|
|
933
|
+
every(fn, thisArg) {
|
|
934
|
+
return apply(this, "every", fn, thisArg);
|
|
935
|
+
},
|
|
936
|
+
filter(fn, thisArg) {
|
|
937
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
938
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
939
|
+
},
|
|
940
|
+
find(fn, thisArg) {
|
|
941
|
+
const result = apply(this, "find", fn, thisArg);
|
|
942
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
943
|
+
},
|
|
944
|
+
findIndex(fn, thisArg) {
|
|
945
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
946
|
+
},
|
|
947
|
+
findLast(fn, thisArg) {
|
|
948
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
949
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
950
|
+
},
|
|
951
|
+
findLastIndex(fn, thisArg) {
|
|
952
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
953
|
+
},
|
|
954
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
955
|
+
forEach(fn, thisArg) {
|
|
956
|
+
return apply(this, "forEach", fn, thisArg);
|
|
957
|
+
},
|
|
958
|
+
includes(...args) {
|
|
959
|
+
return searchProxy(this, "includes", args);
|
|
960
|
+
},
|
|
961
|
+
indexOf(...args) {
|
|
962
|
+
return searchProxy(this, "indexOf", args);
|
|
963
|
+
},
|
|
964
|
+
join(separator) {
|
|
965
|
+
return reactiveReadArray(this).join(separator);
|
|
966
|
+
},
|
|
967
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
968
|
+
lastIndexOf(...args) {
|
|
969
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
970
|
+
},
|
|
971
|
+
map(fn, thisArg) {
|
|
972
|
+
return apply(this, "map", fn, thisArg);
|
|
973
|
+
},
|
|
974
|
+
pop() {
|
|
975
|
+
return noTracking(this, "pop");
|
|
976
|
+
},
|
|
977
|
+
push(...args) {
|
|
978
|
+
return noTracking(this, "push", args);
|
|
979
|
+
},
|
|
980
|
+
reduce(fn, ...args) {
|
|
981
|
+
return reduce(this, "reduce", fn, args);
|
|
982
|
+
},
|
|
983
|
+
reduceRight(fn, ...args) {
|
|
984
|
+
return reduce(this, "reduceRight", fn, args);
|
|
985
|
+
},
|
|
986
|
+
shift() {
|
|
987
|
+
return noTracking(this, "shift");
|
|
988
|
+
},
|
|
989
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
990
|
+
some(fn, thisArg) {
|
|
991
|
+
return apply(this, "some", fn, thisArg);
|
|
992
|
+
},
|
|
993
|
+
splice(...args) {
|
|
994
|
+
return noTracking(this, "splice", args);
|
|
995
|
+
},
|
|
996
|
+
toReversed() {
|
|
997
|
+
return reactiveReadArray(this).toReversed();
|
|
998
|
+
},
|
|
999
|
+
toSorted(comparer) {
|
|
1000
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
1001
|
+
},
|
|
1002
|
+
toSpliced(...args) {
|
|
1003
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1004
|
+
},
|
|
1005
|
+
unshift(...args) {
|
|
1006
|
+
return noTracking(this, "unshift", args);
|
|
1007
|
+
},
|
|
1008
|
+
values() {
|
|
1009
|
+
return iterator(this, "values", toReactive);
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
function iterator(self, method, wrapValue) {
|
|
1013
|
+
const arr = shallowReadArray(self);
|
|
1014
|
+
const iter = arr[method]();
|
|
1015
|
+
if (arr !== self && !isShallow(self)) {
|
|
1016
|
+
iter._next = iter.next;
|
|
1017
|
+
iter.next = () => {
|
|
1018
|
+
const result = iter._next();
|
|
1019
|
+
if (result.value) {
|
|
1020
|
+
result.value = wrapValue(result.value);
|
|
1021
|
+
}
|
|
1022
|
+
return result;
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
return iter;
|
|
1026
|
+
}
|
|
1027
|
+
function apply(self, method, fn, thisArg) {
|
|
1028
|
+
const arr = shallowReadArray(self);
|
|
1029
|
+
let wrappedFn = fn;
|
|
1030
|
+
if (arr !== self) {
|
|
1031
|
+
if (!isShallow(self)) {
|
|
1032
|
+
wrappedFn = function(item, index) {
|
|
1033
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1034
|
+
};
|
|
1035
|
+
} else if (fn.length > 2) {
|
|
1036
|
+
wrappedFn = function(item, index) {
|
|
1037
|
+
return fn.call(this, item, index, self);
|
|
1038
|
+
};
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
return arr[method](wrappedFn, thisArg);
|
|
1042
|
+
}
|
|
1043
|
+
function reduce(self, method, fn, args) {
|
|
1044
|
+
const arr = shallowReadArray(self);
|
|
1045
|
+
let wrappedFn = fn;
|
|
1046
|
+
if (arr !== self) {
|
|
1047
|
+
if (!isShallow(self)) {
|
|
1048
|
+
wrappedFn = function(acc, item, index) {
|
|
1049
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1050
|
+
};
|
|
1051
|
+
} else if (fn.length > 3) {
|
|
1052
|
+
wrappedFn = function(acc, item, index) {
|
|
1053
|
+
return fn.call(this, acc, item, index, self);
|
|
1054
|
+
};
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
return arr[method](wrappedFn, ...args);
|
|
1058
|
+
}
|
|
1059
|
+
function searchProxy(self, method, args) {
|
|
1060
|
+
const arr = toRaw(self);
|
|
1061
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1062
|
+
const res = arr[method](...args);
|
|
1063
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1064
|
+
args[0] = toRaw(args[0]);
|
|
1065
|
+
return arr[method](...args);
|
|
1066
|
+
}
|
|
1067
|
+
return res;
|
|
1068
|
+
}
|
|
1069
|
+
function noTracking(self, method, args = []) {
|
|
1070
|
+
pauseTracking();
|
|
1071
|
+
startBatch();
|
|
1072
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1073
|
+
endBatch();
|
|
1074
|
+
resetTracking();
|
|
1075
|
+
return res;
|
|
701
1076
|
}
|
|
702
1077
|
|
|
703
1078
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
704
1079
|
const builtInSymbols = new Set(
|
|
705
1080
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
706
1081
|
);
|
|
707
|
-
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
708
|
-
function createArrayInstrumentations() {
|
|
709
|
-
const instrumentations = {};
|
|
710
|
-
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
711
|
-
instrumentations[key] = function(...args) {
|
|
712
|
-
const arr = toRaw(this);
|
|
713
|
-
for (let i = 0, l = this.length; i < l; i++) {
|
|
714
|
-
track(arr, "get", i + "");
|
|
715
|
-
}
|
|
716
|
-
const res = arr[key](...args);
|
|
717
|
-
if (res === -1 || res === false) {
|
|
718
|
-
return arr[key](...args.map(toRaw));
|
|
719
|
-
} else {
|
|
720
|
-
return res;
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
});
|
|
724
|
-
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
725
|
-
instrumentations[key] = function(...args) {
|
|
726
|
-
pauseTracking();
|
|
727
|
-
pauseScheduling();
|
|
728
|
-
const res = toRaw(this)[key].apply(this, args);
|
|
729
|
-
resetScheduling();
|
|
730
|
-
resetTracking();
|
|
731
|
-
return res;
|
|
732
|
-
};
|
|
733
|
-
});
|
|
734
|
-
return instrumentations;
|
|
735
|
-
}
|
|
736
1082
|
function hasOwnProperty(key) {
|
|
737
1083
|
if (!isSymbol(key))
|
|
738
1084
|
key = String(key);
|
|
@@ -763,14 +1109,22 @@ var Vue = (function () {
|
|
|
763
1109
|
}
|
|
764
1110
|
const targetIsArray = isArray(target);
|
|
765
1111
|
if (!isReadonly2) {
|
|
766
|
-
|
|
767
|
-
|
|
1112
|
+
let fn;
|
|
1113
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1114
|
+
return fn;
|
|
768
1115
|
}
|
|
769
1116
|
if (key === "hasOwnProperty") {
|
|
770
1117
|
return hasOwnProperty;
|
|
771
1118
|
}
|
|
772
1119
|
}
|
|
773
|
-
const res = Reflect.get(
|
|
1120
|
+
const res = Reflect.get(
|
|
1121
|
+
target,
|
|
1122
|
+
key,
|
|
1123
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1124
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1125
|
+
// its class methods
|
|
1126
|
+
isRef(target) ? target : receiver
|
|
1127
|
+
);
|
|
774
1128
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
775
1129
|
return res;
|
|
776
1130
|
}
|
|
@@ -1269,110 +1623,8 @@ var Vue = (function () {
|
|
|
1269
1623
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1270
1624
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1271
1625
|
|
|
1272
|
-
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`;
|
|
1273
|
-
class ComputedRefImpl {
|
|
1274
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1275
|
-
this.getter = getter;
|
|
1276
|
-
this._setter = _setter;
|
|
1277
|
-
this.dep = void 0;
|
|
1278
|
-
this.__v_isRef = true;
|
|
1279
|
-
this["__v_isReadonly"] = false;
|
|
1280
|
-
this.effect = new ReactiveEffect(
|
|
1281
|
-
() => getter(this._value),
|
|
1282
|
-
() => triggerRefValue(
|
|
1283
|
-
this,
|
|
1284
|
-
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1285
|
-
)
|
|
1286
|
-
);
|
|
1287
|
-
this.effect.computed = this;
|
|
1288
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1289
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1290
|
-
}
|
|
1291
|
-
get value() {
|
|
1292
|
-
const self = toRaw(this);
|
|
1293
|
-
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
|
1294
|
-
triggerRefValue(self, 4);
|
|
1295
|
-
}
|
|
1296
|
-
trackRefValue(self);
|
|
1297
|
-
if (self.effect._dirtyLevel >= 2) {
|
|
1298
|
-
if (this._warnRecursive) {
|
|
1299
|
-
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1300
|
-
|
|
1301
|
-
getter: `, this.getter);
|
|
1302
|
-
}
|
|
1303
|
-
triggerRefValue(self, 2);
|
|
1304
|
-
}
|
|
1305
|
-
return self._value;
|
|
1306
|
-
}
|
|
1307
|
-
set value(newValue) {
|
|
1308
|
-
this._setter(newValue);
|
|
1309
|
-
}
|
|
1310
|
-
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1311
|
-
get _dirty() {
|
|
1312
|
-
return this.effect.dirty;
|
|
1313
|
-
}
|
|
1314
|
-
set _dirty(v) {
|
|
1315
|
-
this.effect.dirty = v;
|
|
1316
|
-
}
|
|
1317
|
-
// #endregion
|
|
1318
|
-
}
|
|
1319
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1320
|
-
let getter;
|
|
1321
|
-
let setter;
|
|
1322
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1323
|
-
if (onlyGetter) {
|
|
1324
|
-
getter = getterOrOptions;
|
|
1325
|
-
setter = () => {
|
|
1326
|
-
warn$2("Write operation failed: computed value is readonly");
|
|
1327
|
-
} ;
|
|
1328
|
-
} else {
|
|
1329
|
-
getter = getterOrOptions.get;
|
|
1330
|
-
setter = getterOrOptions.set;
|
|
1331
|
-
}
|
|
1332
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1333
|
-
if (debugOptions && !isSSR) {
|
|
1334
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1335
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1336
|
-
}
|
|
1337
|
-
return cRef;
|
|
1338
|
-
}
|
|
1339
|
-
|
|
1340
|
-
function trackRefValue(ref2) {
|
|
1341
|
-
var _a;
|
|
1342
|
-
if (shouldTrack && activeEffect) {
|
|
1343
|
-
ref2 = toRaw(ref2);
|
|
1344
|
-
trackEffect(
|
|
1345
|
-
activeEffect,
|
|
1346
|
-
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1347
|
-
() => ref2.dep = void 0,
|
|
1348
|
-
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1349
|
-
),
|
|
1350
|
-
{
|
|
1351
|
-
target: ref2,
|
|
1352
|
-
type: "get",
|
|
1353
|
-
key: "value"
|
|
1354
|
-
}
|
|
1355
|
-
);
|
|
1356
|
-
}
|
|
1357
|
-
}
|
|
1358
|
-
function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
|
1359
|
-
ref2 = toRaw(ref2);
|
|
1360
|
-
const dep = ref2.dep;
|
|
1361
|
-
if (dep) {
|
|
1362
|
-
triggerEffects(
|
|
1363
|
-
dep,
|
|
1364
|
-
dirtyLevel,
|
|
1365
|
-
{
|
|
1366
|
-
target: ref2,
|
|
1367
|
-
type: "set",
|
|
1368
|
-
key: "value",
|
|
1369
|
-
newValue: newVal
|
|
1370
|
-
}
|
|
1371
|
-
);
|
|
1372
|
-
}
|
|
1373
|
-
}
|
|
1374
1626
|
function isRef(r) {
|
|
1375
|
-
return
|
|
1627
|
+
return r ? r.__v_isRef === true : false;
|
|
1376
1628
|
}
|
|
1377
1629
|
function ref(value) {
|
|
1378
1630
|
return createRef(value, false);
|
|
@@ -1389,27 +1641,49 @@ getter: `, this.getter);
|
|
|
1389
1641
|
class RefImpl {
|
|
1390
1642
|
constructor(value, __v_isShallow) {
|
|
1391
1643
|
this.__v_isShallow = __v_isShallow;
|
|
1392
|
-
this.dep =
|
|
1644
|
+
this.dep = new Dep();
|
|
1393
1645
|
this.__v_isRef = true;
|
|
1394
1646
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1395
1647
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1396
1648
|
}
|
|
1397
1649
|
get value() {
|
|
1398
|
-
|
|
1650
|
+
{
|
|
1651
|
+
this.dep.track({
|
|
1652
|
+
target: this,
|
|
1653
|
+
type: "get",
|
|
1654
|
+
key: "value"
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1399
1657
|
return this._value;
|
|
1400
1658
|
}
|
|
1401
|
-
set value(
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
this.
|
|
1407
|
-
|
|
1659
|
+
set value(newValue) {
|
|
1660
|
+
const oldValue = this._rawValue;
|
|
1661
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1662
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1663
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1664
|
+
this._rawValue = newValue;
|
|
1665
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1666
|
+
{
|
|
1667
|
+
this.dep.trigger({
|
|
1668
|
+
target: this,
|
|
1669
|
+
type: "set",
|
|
1670
|
+
key: "value",
|
|
1671
|
+
newValue,
|
|
1672
|
+
oldValue
|
|
1673
|
+
});
|
|
1674
|
+
}
|
|
1408
1675
|
}
|
|
1409
1676
|
}
|
|
1410
1677
|
}
|
|
1411
1678
|
function triggerRef(ref2) {
|
|
1412
|
-
|
|
1679
|
+
{
|
|
1680
|
+
ref2.dep.trigger({
|
|
1681
|
+
target: ref2,
|
|
1682
|
+
type: "set",
|
|
1683
|
+
key: "value",
|
|
1684
|
+
newValue: ref2._value
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1413
1687
|
}
|
|
1414
1688
|
function unref(ref2) {
|
|
1415
1689
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1434,12 +1708,9 @@ getter: `, this.getter);
|
|
|
1434
1708
|
}
|
|
1435
1709
|
class CustomRefImpl {
|
|
1436
1710
|
constructor(factory) {
|
|
1437
|
-
this.dep = void 0;
|
|
1438
1711
|
this.__v_isRef = true;
|
|
1439
|
-
const
|
|
1440
|
-
|
|
1441
|
-
() => triggerRefValue(this)
|
|
1442
|
-
);
|
|
1712
|
+
const dep = this.dep = new Dep();
|
|
1713
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1443
1714
|
this._get = get;
|
|
1444
1715
|
this._set = set;
|
|
1445
1716
|
}
|
|
@@ -1507,6 +1778,90 @@ getter: `, this.getter);
|
|
|
1507
1778
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1508
1779
|
}
|
|
1509
1780
|
|
|
1781
|
+
class ComputedRefImpl {
|
|
1782
|
+
constructor(fn, setter, isSSR) {
|
|
1783
|
+
this.fn = fn;
|
|
1784
|
+
this.setter = setter;
|
|
1785
|
+
/**
|
|
1786
|
+
* @internal
|
|
1787
|
+
*/
|
|
1788
|
+
this._value = void 0;
|
|
1789
|
+
/**
|
|
1790
|
+
* @internal
|
|
1791
|
+
*/
|
|
1792
|
+
this.dep = new Dep(this);
|
|
1793
|
+
/**
|
|
1794
|
+
* @internal
|
|
1795
|
+
*/
|
|
1796
|
+
this.__v_isRef = true;
|
|
1797
|
+
// A computed is also a subscriber that tracks other deps
|
|
1798
|
+
/**
|
|
1799
|
+
* @internal
|
|
1800
|
+
*/
|
|
1801
|
+
this.deps = void 0;
|
|
1802
|
+
/**
|
|
1803
|
+
* @internal
|
|
1804
|
+
*/
|
|
1805
|
+
this.depsTail = void 0;
|
|
1806
|
+
/**
|
|
1807
|
+
* @internal
|
|
1808
|
+
*/
|
|
1809
|
+
this.flags = 16;
|
|
1810
|
+
/**
|
|
1811
|
+
* @internal
|
|
1812
|
+
*/
|
|
1813
|
+
this.globalVersion = globalVersion - 1;
|
|
1814
|
+
// for backwards compat
|
|
1815
|
+
this.effect = this;
|
|
1816
|
+
this.__v_isReadonly = !setter;
|
|
1817
|
+
this.isSSR = isSSR;
|
|
1818
|
+
}
|
|
1819
|
+
/**
|
|
1820
|
+
* @internal
|
|
1821
|
+
*/
|
|
1822
|
+
notify() {
|
|
1823
|
+
if (activeSub !== this) {
|
|
1824
|
+
this.flags |= 16;
|
|
1825
|
+
this.dep.notify();
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
get value() {
|
|
1829
|
+
const link = this.dep.track({
|
|
1830
|
+
target: this,
|
|
1831
|
+
type: "get",
|
|
1832
|
+
key: "value"
|
|
1833
|
+
}) ;
|
|
1834
|
+
refreshComputed(this);
|
|
1835
|
+
if (link) {
|
|
1836
|
+
link.version = this.dep.version;
|
|
1837
|
+
}
|
|
1838
|
+
return this._value;
|
|
1839
|
+
}
|
|
1840
|
+
set value(newValue) {
|
|
1841
|
+
if (this.setter) {
|
|
1842
|
+
this.setter(newValue);
|
|
1843
|
+
} else {
|
|
1844
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
}
|
|
1848
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1849
|
+
let getter;
|
|
1850
|
+
let setter;
|
|
1851
|
+
if (isFunction(getterOrOptions)) {
|
|
1852
|
+
getter = getterOrOptions;
|
|
1853
|
+
} else {
|
|
1854
|
+
getter = getterOrOptions.get;
|
|
1855
|
+
setter = getterOrOptions.set;
|
|
1856
|
+
}
|
|
1857
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1858
|
+
if (debugOptions && !isSSR) {
|
|
1859
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1860
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1861
|
+
}
|
|
1862
|
+
return cRef;
|
|
1863
|
+
}
|
|
1864
|
+
|
|
1510
1865
|
const TrackOpTypes = {
|
|
1511
1866
|
"GET": "get",
|
|
1512
1867
|
"HAS": "has",
|
|
@@ -1666,7 +2021,9 @@ getter: `, this.getter);
|
|
|
1666
2021
|
"ASYNC_COMPONENT_LOADER": 13,
|
|
1667
2022
|
"13": "ASYNC_COMPONENT_LOADER",
|
|
1668
2023
|
"SCHEDULER": 14,
|
|
1669
|
-
"14": "SCHEDULER"
|
|
2024
|
+
"14": "SCHEDULER",
|
|
2025
|
+
"APP_UNMOUNT_CLEANUP": 15,
|
|
2026
|
+
"15": "APP_UNMOUNT_CLEANUP"
|
|
1670
2027
|
};
|
|
1671
2028
|
const ErrorTypeStrings$1 = {
|
|
1672
2029
|
["sp"]: "serverPrefetch hook",
|
|
@@ -1697,7 +2054,8 @@ getter: `, this.getter);
|
|
|
1697
2054
|
[11]: "app warnHandler",
|
|
1698
2055
|
[12]: "ref function",
|
|
1699
2056
|
[13]: "async component loader",
|
|
1700
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
2057
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core .",
|
|
2058
|
+
[15]: "app unmount cleanup function"
|
|
1701
2059
|
};
|
|
1702
2060
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1703
2061
|
try {
|
|
@@ -1799,7 +2157,7 @@ getter: `, this.getter);
|
|
|
1799
2157
|
const middle = start + end >>> 1;
|
|
1800
2158
|
const middleJob = queue[middle];
|
|
1801
2159
|
const middleJobId = getId(middleJob);
|
|
1802
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2160
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1803
2161
|
start = middle + 1;
|
|
1804
2162
|
} else {
|
|
1805
2163
|
end = middle;
|
|
@@ -1808,15 +2166,21 @@ getter: `, this.getter);
|
|
|
1808
2166
|
return start;
|
|
1809
2167
|
}
|
|
1810
2168
|
function queueJob(job) {
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1814
|
-
)) {
|
|
2169
|
+
var _a;
|
|
2170
|
+
if (!(job.flags & 1)) {
|
|
1815
2171
|
if (job.id == null) {
|
|
1816
2172
|
queue.push(job);
|
|
2173
|
+
} else if (
|
|
2174
|
+
// fast path when the job id is larger than the tail
|
|
2175
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2176
|
+
) {
|
|
2177
|
+
queue.push(job);
|
|
1817
2178
|
} else {
|
|
1818
2179
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1819
2180
|
}
|
|
2181
|
+
if (!(job.flags & 4)) {
|
|
2182
|
+
job.flags |= 1;
|
|
2183
|
+
}
|
|
1820
2184
|
queueFlush();
|
|
1821
2185
|
}
|
|
1822
2186
|
}
|
|
@@ -1834,11 +2198,11 @@ getter: `, this.getter);
|
|
|
1834
2198
|
}
|
|
1835
2199
|
function queuePostFlushCb(cb) {
|
|
1836
2200
|
if (!isArray(cb)) {
|
|
1837
|
-
if (!
|
|
1838
|
-
cb,
|
|
1839
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1840
|
-
)) {
|
|
2201
|
+
if (!(cb.flags & 1)) {
|
|
1841
2202
|
pendingPostFlushCbs.push(cb);
|
|
2203
|
+
if (!(cb.flags & 4)) {
|
|
2204
|
+
cb.flags |= 1;
|
|
2205
|
+
}
|
|
1842
2206
|
}
|
|
1843
2207
|
} else {
|
|
1844
2208
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1851,7 +2215,7 @@ getter: `, this.getter);
|
|
|
1851
2215
|
}
|
|
1852
2216
|
for (; i < queue.length; i++) {
|
|
1853
2217
|
const cb = queue[i];
|
|
1854
|
-
if (cb && cb.
|
|
2218
|
+
if (cb && cb.flags & 2) {
|
|
1855
2219
|
if (instance && cb.id !== instance.uid) {
|
|
1856
2220
|
continue;
|
|
1857
2221
|
}
|
|
@@ -1861,6 +2225,7 @@ getter: `, this.getter);
|
|
|
1861
2225
|
queue.splice(i, 1);
|
|
1862
2226
|
i--;
|
|
1863
2227
|
cb();
|
|
2228
|
+
cb.flags &= ~1;
|
|
1864
2229
|
}
|
|
1865
2230
|
}
|
|
1866
2231
|
}
|
|
@@ -1883,6 +2248,7 @@ getter: `, this.getter);
|
|
|
1883
2248
|
continue;
|
|
1884
2249
|
}
|
|
1885
2250
|
activePostFlushCbs[postFlushIndex]();
|
|
2251
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1886
2252
|
}
|
|
1887
2253
|
activePostFlushCbs = null;
|
|
1888
2254
|
postFlushIndex = 0;
|
|
@@ -1892,9 +2258,11 @@ getter: `, this.getter);
|
|
|
1892
2258
|
const comparator = (a, b) => {
|
|
1893
2259
|
const diff = getId(a) - getId(b);
|
|
1894
2260
|
if (diff === 0) {
|
|
1895
|
-
|
|
2261
|
+
const isAPre = a.flags & 2;
|
|
2262
|
+
const isBPre = b.flags & 2;
|
|
2263
|
+
if (isAPre && !isBPre)
|
|
1896
2264
|
return -1;
|
|
1897
|
-
if (
|
|
2265
|
+
if (isBPre && !isAPre)
|
|
1898
2266
|
return 1;
|
|
1899
2267
|
}
|
|
1900
2268
|
return diff;
|
|
@@ -1910,11 +2278,12 @@ getter: `, this.getter);
|
|
|
1910
2278
|
try {
|
|
1911
2279
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1912
2280
|
const job = queue[flushIndex];
|
|
1913
|
-
if (job && job.
|
|
2281
|
+
if (job && !(job.flags & 8)) {
|
|
1914
2282
|
if (check(job)) {
|
|
1915
2283
|
continue;
|
|
1916
2284
|
}
|
|
1917
2285
|
callWithErrorHandling(job, null, 14);
|
|
2286
|
+
job.flags &= ~1;
|
|
1918
2287
|
}
|
|
1919
2288
|
}
|
|
1920
2289
|
} finally {
|
|
@@ -1996,7 +2365,6 @@ getter: `, this.getter);
|
|
|
1996
2365
|
}
|
|
1997
2366
|
instance.renderCache = [];
|
|
1998
2367
|
isHmrUpdating = true;
|
|
1999
|
-
instance.effect.dirty = true;
|
|
2000
2368
|
instance.update();
|
|
2001
2369
|
isHmrUpdating = false;
|
|
2002
2370
|
});
|
|
@@ -2024,7 +2392,6 @@ getter: `, this.getter);
|
|
|
2024
2392
|
instance.ceReload(newComp.styles);
|
|
2025
2393
|
hmrDirtyComponents.delete(oldComp);
|
|
2026
2394
|
} else if (instance.parent) {
|
|
2027
|
-
instance.parent.effect.dirty = true;
|
|
2028
2395
|
queueJob(instance.parent.update);
|
|
2029
2396
|
} else if (instance.appContext.reload) {
|
|
2030
2397
|
instance.appContext.reload();
|
|
@@ -3993,8 +4360,8 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3993
4360
|
};
|
|
3994
4361
|
};
|
|
3995
4362
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3996
|
-
const job = () => {
|
|
3997
|
-
if (!effect.
|
|
4363
|
+
const job = (immediateFirstRun) => {
|
|
4364
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
3998
4365
|
return;
|
|
3999
4366
|
}
|
|
4000
4367
|
if (cb) {
|
|
@@ -4015,19 +4382,22 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4015
4382
|
effect.run();
|
|
4016
4383
|
}
|
|
4017
4384
|
};
|
|
4018
|
-
|
|
4385
|
+
if (cb)
|
|
4386
|
+
job.flags |= 4;
|
|
4387
|
+
const effect = new ReactiveEffect(getter);
|
|
4019
4388
|
let scheduler;
|
|
4020
4389
|
if (flush === "sync") {
|
|
4390
|
+
effect.flags |= 64;
|
|
4021
4391
|
scheduler = job;
|
|
4022
4392
|
} else if (flush === "post") {
|
|
4023
4393
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
4024
4394
|
} else {
|
|
4025
|
-
job.
|
|
4395
|
+
job.flags |= 2;
|
|
4026
4396
|
if (instance)
|
|
4027
4397
|
job.id = instance.uid;
|
|
4028
4398
|
scheduler = () => queueJob(job);
|
|
4029
4399
|
}
|
|
4030
|
-
|
|
4400
|
+
effect.scheduler = scheduler;
|
|
4031
4401
|
const scope = getCurrentScope();
|
|
4032
4402
|
const unwatch = () => {
|
|
4033
4403
|
effect.stop();
|
|
@@ -4041,7 +4411,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4041
4411
|
}
|
|
4042
4412
|
if (cb) {
|
|
4043
4413
|
if (immediate) {
|
|
4044
|
-
job();
|
|
4414
|
+
job(true);
|
|
4045
4415
|
} else {
|
|
4046
4416
|
oldValue = effect.run();
|
|
4047
4417
|
}
|
|
@@ -4218,22 +4588,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4218
4588
|
if (!children || !children.length) {
|
|
4219
4589
|
return;
|
|
4220
4590
|
}
|
|
4221
|
-
|
|
4222
|
-
if (children.length > 1) {
|
|
4223
|
-
let hasFound = false;
|
|
4224
|
-
for (const c of children) {
|
|
4225
|
-
if (c.type !== Comment) {
|
|
4226
|
-
if (hasFound) {
|
|
4227
|
-
warn$1(
|
|
4228
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4229
|
-
);
|
|
4230
|
-
break;
|
|
4231
|
-
}
|
|
4232
|
-
child = c;
|
|
4233
|
-
hasFound = true;
|
|
4234
|
-
}
|
|
4235
|
-
}
|
|
4236
|
-
}
|
|
4591
|
+
const child = findNonCommentChild(children);
|
|
4237
4592
|
const rawProps = toRaw(props);
|
|
4238
4593
|
const { mode } = rawProps;
|
|
4239
4594
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -4242,7 +4597,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4242
4597
|
if (state.isLeaving) {
|
|
4243
4598
|
return emptyPlaceholder(child);
|
|
4244
4599
|
}
|
|
4245
|
-
const innerChild =
|
|
4600
|
+
const innerChild = getInnerChild$1(child);
|
|
4246
4601
|
if (!innerChild) {
|
|
4247
4602
|
return emptyPlaceholder(child);
|
|
4248
4603
|
}
|
|
@@ -4254,7 +4609,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4254
4609
|
);
|
|
4255
4610
|
setTransitionHooks(innerChild, enterHooks);
|
|
4256
4611
|
const oldChild = instance.subTree;
|
|
4257
|
-
const oldInnerChild = oldChild &&
|
|
4612
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
4258
4613
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
4259
4614
|
const leavingHooks = resolveTransitionHooks(
|
|
4260
4615
|
oldInnerChild,
|
|
@@ -4267,8 +4622,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4267
4622
|
state.isLeaving = true;
|
|
4268
4623
|
leavingHooks.afterLeave = () => {
|
|
4269
4624
|
state.isLeaving = false;
|
|
4270
|
-
if (instance.
|
|
4271
|
-
instance.effect.dirty = true;
|
|
4625
|
+
if (!(instance.job.flags & 8)) {
|
|
4272
4626
|
instance.update();
|
|
4273
4627
|
}
|
|
4274
4628
|
};
|
|
@@ -4296,6 +4650,25 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4296
4650
|
{
|
|
4297
4651
|
BaseTransitionImpl.__isBuiltIn = true;
|
|
4298
4652
|
}
|
|
4653
|
+
function findNonCommentChild(children) {
|
|
4654
|
+
let child = children[0];
|
|
4655
|
+
if (children.length > 1) {
|
|
4656
|
+
let hasFound = false;
|
|
4657
|
+
for (const c of children) {
|
|
4658
|
+
if (c.type !== Comment) {
|
|
4659
|
+
if (hasFound) {
|
|
4660
|
+
warn$1(
|
|
4661
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4662
|
+
);
|
|
4663
|
+
break;
|
|
4664
|
+
}
|
|
4665
|
+
child = c;
|
|
4666
|
+
hasFound = true;
|
|
4667
|
+
}
|
|
4668
|
+
}
|
|
4669
|
+
}
|
|
4670
|
+
return child;
|
|
4671
|
+
}
|
|
4299
4672
|
const BaseTransition = BaseTransitionImpl;
|
|
4300
4673
|
function getLeavingNodesForType(state, vnode) {
|
|
4301
4674
|
const { leavingVNodes } = state;
|
|
@@ -4450,8 +4823,11 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4450
4823
|
return vnode;
|
|
4451
4824
|
}
|
|
4452
4825
|
}
|
|
4453
|
-
function
|
|
4826
|
+
function getInnerChild$1(vnode) {
|
|
4454
4827
|
if (!isKeepAlive(vnode)) {
|
|
4828
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4829
|
+
return findNonCommentChild(vnode.children);
|
|
4830
|
+
}
|
|
4455
4831
|
return vnode;
|
|
4456
4832
|
}
|
|
4457
4833
|
if (vnode.component) {
|
|
@@ -4620,7 +4996,6 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4620
4996
|
load().then(() => {
|
|
4621
4997
|
loaded.value = true;
|
|
4622
4998
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4623
|
-
instance.parent.effect.dirty = true;
|
|
4624
4999
|
queueJob(instance.parent.update);
|
|
4625
5000
|
}
|
|
4626
5001
|
}).catch((err) => {
|
|
@@ -5232,10 +5607,20 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5232
5607
|
function renderList(source, renderItem, cache, index) {
|
|
5233
5608
|
let ret;
|
|
5234
5609
|
const cached = cache && cache[index];
|
|
5235
|
-
|
|
5610
|
+
const sourceIsArray = isArray(source);
|
|
5611
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
5612
|
+
if (sourceIsArray || isString(source)) {
|
|
5613
|
+
if (sourceIsReactiveArray) {
|
|
5614
|
+
source = shallowReadArray(source);
|
|
5615
|
+
}
|
|
5236
5616
|
ret = new Array(source.length);
|
|
5237
5617
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
5238
|
-
ret[i] = renderItem(
|
|
5618
|
+
ret[i] = renderItem(
|
|
5619
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
5620
|
+
i,
|
|
5621
|
+
void 0,
|
|
5622
|
+
cached && cached[i]
|
|
5623
|
+
);
|
|
5239
5624
|
}
|
|
5240
5625
|
} else if (typeof source === "number") {
|
|
5241
5626
|
if (!Number.isInteger(source)) {
|
|
@@ -5606,7 +5991,6 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
5606
5991
|
$emit: (i) => i.emit,
|
|
5607
5992
|
$options: (i) => resolveMergedOptions(i) ,
|
|
5608
5993
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
5609
|
-
i.effect.dirty = true;
|
|
5610
5994
|
queueJob(i.update);
|
|
5611
5995
|
}),
|
|
5612
5996
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -6477,7 +6861,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
6477
6861
|
return vm;
|
|
6478
6862
|
}
|
|
6479
6863
|
}
|
|
6480
|
-
Vue.version = `2.6.14-compat:${"3.
|
|
6864
|
+
Vue.version = `2.6.14-compat:${"3.5.0-alpha.2"}`;
|
|
6481
6865
|
Vue.config = singletonApp.config;
|
|
6482
6866
|
Vue.use = (plugin, ...options) => {
|
|
6483
6867
|
if (plugin && isFunction(plugin.install)) {
|
|
@@ -6882,6 +7266,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
6882
7266
|
}
|
|
6883
7267
|
const context = createAppContext();
|
|
6884
7268
|
const installedPlugins = /* @__PURE__ */ new WeakSet();
|
|
7269
|
+
const pluginCleanupFns = [];
|
|
6885
7270
|
let isMounted = false;
|
|
6886
7271
|
const app = context.app = {
|
|
6887
7272
|
_uid: uid$1++,
|
|
@@ -6999,8 +7384,21 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
6999
7384
|
);
|
|
7000
7385
|
}
|
|
7001
7386
|
},
|
|
7387
|
+
onUnmount(cleanupFn) {
|
|
7388
|
+
if (typeof cleanupFn !== "function") {
|
|
7389
|
+
warn$1(
|
|
7390
|
+
`Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
|
|
7391
|
+
);
|
|
7392
|
+
}
|
|
7393
|
+
pluginCleanupFns.push(cleanupFn);
|
|
7394
|
+
},
|
|
7002
7395
|
unmount() {
|
|
7003
7396
|
if (isMounted) {
|
|
7397
|
+
callWithAsyncErrorHandling(
|
|
7398
|
+
pluginCleanupFns,
|
|
7399
|
+
app._instance,
|
|
7400
|
+
15
|
|
7401
|
+
);
|
|
7004
7402
|
render(null, app._container);
|
|
7005
7403
|
{
|
|
7006
7404
|
app._instance = null;
|
|
@@ -7495,7 +7893,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7495
7893
|
function assertType(value, type) {
|
|
7496
7894
|
let valid;
|
|
7497
7895
|
const expectedType = getType(type);
|
|
7498
|
-
if (
|
|
7896
|
+
if (expectedType === "null") {
|
|
7897
|
+
valid = value === null;
|
|
7898
|
+
} else if (isSimpleType(expectedType)) {
|
|
7499
7899
|
const t = typeof value;
|
|
7500
7900
|
valid = t === expectedType.toLowerCase();
|
|
7501
7901
|
if (!valid && t === "object") {
|
|
@@ -7505,8 +7905,6 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
7505
7905
|
valid = isObject(value);
|
|
7506
7906
|
} else if (expectedType === "Array") {
|
|
7507
7907
|
valid = isArray(value);
|
|
7508
|
-
} else if (expectedType === "null") {
|
|
7509
|
-
valid = value === null;
|
|
7510
7908
|
} else {
|
|
7511
7909
|
valid = value instanceof type;
|
|
7512
7910
|
}
|
|
@@ -9031,7 +9429,6 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
9031
9429
|
} else {
|
|
9032
9430
|
instance.next = n2;
|
|
9033
9431
|
invalidateJob(instance.update);
|
|
9034
|
-
instance.effect.dirty = true;
|
|
9035
9432
|
instance.update();
|
|
9036
9433
|
}
|
|
9037
9434
|
} else {
|
|
@@ -9238,24 +9635,18 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
9238
9635
|
}
|
|
9239
9636
|
}
|
|
9240
9637
|
};
|
|
9241
|
-
|
|
9242
|
-
|
|
9243
|
-
|
|
9244
|
-
|
|
9245
|
-
|
|
9246
|
-
|
|
9247
|
-
);
|
|
9248
|
-
const update = instance.update = () => {
|
|
9249
|
-
if (effect.dirty) {
|
|
9250
|
-
effect.run();
|
|
9251
|
-
}
|
|
9252
|
-
};
|
|
9253
|
-
update.id = instance.uid;
|
|
9638
|
+
instance.scope.on();
|
|
9639
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
9640
|
+
instance.scope.off();
|
|
9641
|
+
const update = instance.update = effect.run.bind(effect);
|
|
9642
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
9643
|
+
job.id = instance.uid;
|
|
9644
|
+
effect.scheduler = () => queueJob(job);
|
|
9254
9645
|
toggleRecurse(instance, true);
|
|
9255
9646
|
{
|
|
9256
9647
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
9257
9648
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
9258
|
-
|
|
9649
|
+
job.ownerInstance = instance;
|
|
9259
9650
|
}
|
|
9260
9651
|
update();
|
|
9261
9652
|
};
|
|
@@ -9722,7 +10113,7 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
9722
10113
|
if (instance.type.__hmrId) {
|
|
9723
10114
|
unregisterHMR(instance);
|
|
9724
10115
|
}
|
|
9725
|
-
const { bum, scope,
|
|
10116
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
9726
10117
|
if (bum) {
|
|
9727
10118
|
invokeArrayFns(bum);
|
|
9728
10119
|
}
|
|
@@ -9730,8 +10121,8 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
9730
10121
|
instance.emit("hook:beforeDestroy");
|
|
9731
10122
|
}
|
|
9732
10123
|
scope.stop();
|
|
9733
|
-
if (
|
|
9734
|
-
|
|
10124
|
+
if (job) {
|
|
10125
|
+
job.flags |= 8;
|
|
9735
10126
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
9736
10127
|
}
|
|
9737
10128
|
if (um) {
|
|
@@ -9823,8 +10214,14 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
9823
10214
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
9824
10215
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
9825
10216
|
}
|
|
9826
|
-
function toggleRecurse({ effect,
|
|
9827
|
-
|
|
10217
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
10218
|
+
if (allowed) {
|
|
10219
|
+
effect.flags |= 32;
|
|
10220
|
+
job.flags |= 4;
|
|
10221
|
+
} else {
|
|
10222
|
+
effect.flags &= ~32;
|
|
10223
|
+
job.flags &= ~4;
|
|
10224
|
+
}
|
|
9828
10225
|
}
|
|
9829
10226
|
function needTransition(parentSuspense, transition) {
|
|
9830
10227
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -10625,6 +11022,7 @@ Component that was made reactive: `,
|
|
|
10625
11022
|
effect: null,
|
|
10626
11023
|
update: null,
|
|
10627
11024
|
// will be set synchronously right after creation
|
|
11025
|
+
job: null,
|
|
10628
11026
|
scope: new EffectScope(
|
|
10629
11027
|
true
|
|
10630
11028
|
/* detached */
|
|
@@ -11130,7 +11528,8 @@ Component that was made reactive: `,
|
|
|
11130
11528
|
{},
|
|
11131
11529
|
["span", vueStyle, genRefFlag(obj)],
|
|
11132
11530
|
"<",
|
|
11133
|
-
|
|
11531
|
+
// avoid debugger accessing value affecting behavior
|
|
11532
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
11134
11533
|
`>`
|
|
11135
11534
|
];
|
|
11136
11535
|
} else if (isReactive(obj)) {
|
|
@@ -11310,7 +11709,7 @@ Component that was made reactive: `,
|
|
|
11310
11709
|
return true;
|
|
11311
11710
|
}
|
|
11312
11711
|
|
|
11313
|
-
const version = "3.
|
|
11712
|
+
const version = "3.5.0-alpha.2";
|
|
11314
11713
|
const warn = warn$1 ;
|
|
11315
11714
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
11316
11715
|
const devtools = devtools$1 ;
|
|
@@ -12865,7 +13264,9 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
12865
13264
|
return;
|
|
12866
13265
|
}
|
|
12867
13266
|
const eventKey = hyphenate(event.key);
|
|
12868
|
-
if (modifiers.some(
|
|
13267
|
+
if (modifiers.some(
|
|
13268
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
13269
|
+
)) {
|
|
12869
13270
|
return fn(event);
|
|
12870
13271
|
}
|
|
12871
13272
|
{
|