vue 3.4.26 → 3.5.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue.cjs.js +1 -1
- package/dist/vue.cjs.prod.js +1 -1
- package/dist/vue.esm-browser.js +993 -418
- package/dist/vue.esm-browser.prod.js +6 -6
- package/dist/vue.esm-bundler.js +1 -1
- package/dist/vue.global.js +993 -418
- package/dist/vue.global.prod.js +6 -6
- package/dist/vue.runtime.esm-browser.js +818 -417
- package/dist/vue.runtime.esm-browser.prod.js +6 -6
- package/dist/vue.runtime.esm-bundler.js +1 -1
- package/dist/vue.runtime.global.js +818 -417
- package/dist/vue.runtime.global.prod.js +6 -6
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* vue v3.
|
|
2
|
+
* vue v3.5.0-alpha.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -385,156 +385,280 @@ class EffectScope {
|
|
|
385
385
|
function effectScope(detached) {
|
|
386
386
|
return new EffectScope(detached);
|
|
387
387
|
}
|
|
388
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
389
|
-
if (scope && scope.active) {
|
|
390
|
-
scope.effects.push(effect);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
388
|
function getCurrentScope() {
|
|
394
389
|
return activeEffectScope;
|
|
395
390
|
}
|
|
396
|
-
function onScopeDispose(fn) {
|
|
391
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
397
392
|
if (activeEffectScope) {
|
|
398
393
|
activeEffectScope.cleanups.push(fn);
|
|
399
|
-
} else {
|
|
394
|
+
} else if (!failSilently) {
|
|
400
395
|
warn$2(
|
|
401
396
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
402
397
|
);
|
|
403
398
|
}
|
|
404
399
|
}
|
|
405
400
|
|
|
406
|
-
let
|
|
401
|
+
let activeSub;
|
|
407
402
|
class ReactiveEffect {
|
|
408
|
-
constructor(fn
|
|
403
|
+
constructor(fn) {
|
|
409
404
|
this.fn = fn;
|
|
410
|
-
this.trigger = trigger;
|
|
411
|
-
this.scheduler = scheduler;
|
|
412
|
-
this.active = true;
|
|
413
|
-
this.deps = [];
|
|
414
405
|
/**
|
|
415
406
|
* @internal
|
|
416
407
|
*/
|
|
417
|
-
this.
|
|
408
|
+
this.deps = void 0;
|
|
418
409
|
/**
|
|
419
410
|
* @internal
|
|
420
411
|
*/
|
|
421
|
-
this.
|
|
412
|
+
this.depsTail = void 0;
|
|
422
413
|
/**
|
|
423
414
|
* @internal
|
|
424
415
|
*/
|
|
425
|
-
this.
|
|
416
|
+
this.flags = 1 | 4;
|
|
426
417
|
/**
|
|
427
418
|
* @internal
|
|
428
419
|
*/
|
|
429
|
-
this.
|
|
420
|
+
this.nextEffect = void 0;
|
|
430
421
|
/**
|
|
431
422
|
* @internal
|
|
432
423
|
*/
|
|
433
|
-
this.
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
438
|
-
this._dirtyLevel = 1;
|
|
439
|
-
pauseTracking();
|
|
440
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
441
|
-
const dep = this.deps[i];
|
|
442
|
-
if (dep.computed) {
|
|
443
|
-
triggerComputed(dep.computed);
|
|
444
|
-
if (this._dirtyLevel >= 4) {
|
|
445
|
-
break;
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
if (this._dirtyLevel === 1) {
|
|
450
|
-
this._dirtyLevel = 0;
|
|
451
|
-
}
|
|
452
|
-
resetTracking();
|
|
424
|
+
this.cleanup = void 0;
|
|
425
|
+
this.scheduler = void 0;
|
|
426
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
427
|
+
activeEffectScope.effects.push(this);
|
|
453
428
|
}
|
|
454
|
-
return this._dirtyLevel >= 4;
|
|
455
429
|
}
|
|
456
|
-
|
|
457
|
-
|
|
430
|
+
/**
|
|
431
|
+
* @internal
|
|
432
|
+
*/
|
|
433
|
+
notify() {
|
|
434
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
if (this.flags & 64) {
|
|
438
|
+
return this.trigger();
|
|
439
|
+
}
|
|
440
|
+
if (!(this.flags & 8)) {
|
|
441
|
+
this.flags |= 8;
|
|
442
|
+
this.nextEffect = batchedEffect;
|
|
443
|
+
batchedEffect = this;
|
|
444
|
+
}
|
|
458
445
|
}
|
|
459
446
|
run() {
|
|
460
|
-
this.
|
|
461
|
-
if (!this.active) {
|
|
447
|
+
if (!(this.flags & 1)) {
|
|
462
448
|
return this.fn();
|
|
463
449
|
}
|
|
464
|
-
|
|
465
|
-
|
|
450
|
+
this.flags |= 2;
|
|
451
|
+
cleanupEffect(this);
|
|
452
|
+
prepareDeps(this);
|
|
453
|
+
const prevEffect = activeSub;
|
|
454
|
+
const prevShouldTrack = shouldTrack;
|
|
455
|
+
activeSub = this;
|
|
456
|
+
shouldTrack = true;
|
|
466
457
|
try {
|
|
467
|
-
shouldTrack = true;
|
|
468
|
-
activeEffect = this;
|
|
469
|
-
this._runnings++;
|
|
470
|
-
preCleanupEffect(this);
|
|
471
458
|
return this.fn();
|
|
472
459
|
} finally {
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
460
|
+
if (activeSub !== this) {
|
|
461
|
+
warn$2(
|
|
462
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
cleanupDeps(this);
|
|
466
|
+
activeSub = prevEffect;
|
|
467
|
+
shouldTrack = prevShouldTrack;
|
|
468
|
+
this.flags &= ~2;
|
|
477
469
|
}
|
|
478
470
|
}
|
|
479
471
|
stop() {
|
|
480
|
-
if (this.
|
|
481
|
-
|
|
482
|
-
|
|
472
|
+
if (this.flags & 1) {
|
|
473
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
474
|
+
removeSub(link);
|
|
475
|
+
}
|
|
476
|
+
this.deps = this.depsTail = void 0;
|
|
477
|
+
cleanupEffect(this);
|
|
483
478
|
this.onStop && this.onStop();
|
|
484
|
-
this.
|
|
479
|
+
this.flags &= ~1;
|
|
485
480
|
}
|
|
486
481
|
}
|
|
482
|
+
trigger() {
|
|
483
|
+
if (this.scheduler) {
|
|
484
|
+
this.scheduler();
|
|
485
|
+
} else {
|
|
486
|
+
this.runIfDirty();
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* @internal
|
|
491
|
+
*/
|
|
492
|
+
runIfDirty() {
|
|
493
|
+
if (isDirty(this)) {
|
|
494
|
+
this.run();
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
get dirty() {
|
|
498
|
+
return isDirty(this);
|
|
499
|
+
}
|
|
487
500
|
}
|
|
488
|
-
|
|
489
|
-
|
|
501
|
+
let batchDepth = 0;
|
|
502
|
+
let batchedEffect;
|
|
503
|
+
function startBatch() {
|
|
504
|
+
batchDepth++;
|
|
490
505
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
493
|
-
|
|
506
|
+
function endBatch() {
|
|
507
|
+
if (batchDepth > 1) {
|
|
508
|
+
batchDepth--;
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
let error;
|
|
512
|
+
while (batchedEffect) {
|
|
513
|
+
let e = batchedEffect;
|
|
514
|
+
batchedEffect = void 0;
|
|
515
|
+
while (e) {
|
|
516
|
+
const next = e.nextEffect;
|
|
517
|
+
e.nextEffect = void 0;
|
|
518
|
+
e.flags &= ~8;
|
|
519
|
+
if (e.flags & 1) {
|
|
520
|
+
try {
|
|
521
|
+
e.trigger();
|
|
522
|
+
} catch (err) {
|
|
523
|
+
if (!error)
|
|
524
|
+
error = err;
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
e = next;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
batchDepth--;
|
|
531
|
+
if (error)
|
|
532
|
+
throw error;
|
|
494
533
|
}
|
|
495
|
-
function
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
534
|
+
function prepareDeps(sub) {
|
|
535
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
536
|
+
link.version = -1;
|
|
537
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
538
|
+
link.dep.activeLink = link;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
function cleanupDeps(sub) {
|
|
542
|
+
let head;
|
|
543
|
+
let tail = sub.depsTail;
|
|
544
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
545
|
+
if (link.version === -1) {
|
|
546
|
+
if (link === tail)
|
|
547
|
+
tail = link.prevDep;
|
|
548
|
+
removeSub(link);
|
|
549
|
+
removeDep(link);
|
|
550
|
+
} else {
|
|
551
|
+
head = link;
|
|
499
552
|
}
|
|
500
|
-
|
|
553
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
554
|
+
link.prevActiveLink = void 0;
|
|
501
555
|
}
|
|
556
|
+
sub.deps = head;
|
|
557
|
+
sub.depsTail = tail;
|
|
502
558
|
}
|
|
503
|
-
function
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
if (dep.size === 0) {
|
|
508
|
-
dep.cleanup();
|
|
559
|
+
function isDirty(sub) {
|
|
560
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
561
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
562
|
+
return true;
|
|
509
563
|
}
|
|
510
564
|
}
|
|
565
|
+
if (sub._dirty) {
|
|
566
|
+
return true;
|
|
567
|
+
}
|
|
568
|
+
return false;
|
|
569
|
+
}
|
|
570
|
+
function refreshComputed(computed) {
|
|
571
|
+
if (computed.flags & 2) {
|
|
572
|
+
return false;
|
|
573
|
+
}
|
|
574
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
575
|
+
return;
|
|
576
|
+
}
|
|
577
|
+
computed.flags &= ~16;
|
|
578
|
+
if (computed.globalVersion === globalVersion) {
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
computed.globalVersion = globalVersion;
|
|
582
|
+
const dep = computed.dep;
|
|
583
|
+
computed.flags |= 2;
|
|
584
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
585
|
+
computed.flags &= ~2;
|
|
586
|
+
return;
|
|
587
|
+
}
|
|
588
|
+
const prevSub = activeSub;
|
|
589
|
+
const prevShouldTrack = shouldTrack;
|
|
590
|
+
activeSub = computed;
|
|
591
|
+
shouldTrack = true;
|
|
592
|
+
try {
|
|
593
|
+
prepareDeps(computed);
|
|
594
|
+
const value = computed.fn();
|
|
595
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
596
|
+
computed._value = value;
|
|
597
|
+
dep.version++;
|
|
598
|
+
}
|
|
599
|
+
} catch (err) {
|
|
600
|
+
dep.version++;
|
|
601
|
+
throw err;
|
|
602
|
+
} finally {
|
|
603
|
+
activeSub = prevSub;
|
|
604
|
+
shouldTrack = prevShouldTrack;
|
|
605
|
+
cleanupDeps(computed);
|
|
606
|
+
computed.flags &= ~2;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
function removeSub(link) {
|
|
610
|
+
const { dep, prevSub, nextSub } = link;
|
|
611
|
+
if (prevSub) {
|
|
612
|
+
prevSub.nextSub = nextSub;
|
|
613
|
+
link.prevSub = void 0;
|
|
614
|
+
}
|
|
615
|
+
if (nextSub) {
|
|
616
|
+
nextSub.prevSub = prevSub;
|
|
617
|
+
link.nextSub = void 0;
|
|
618
|
+
}
|
|
619
|
+
if (dep.subs === link) {
|
|
620
|
+
dep.subs = prevSub;
|
|
621
|
+
}
|
|
622
|
+
if (!dep.subs && dep.computed) {
|
|
623
|
+
dep.computed.flags &= ~4;
|
|
624
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
625
|
+
removeSub(l);
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
function removeDep(link) {
|
|
630
|
+
const { prevDep, nextDep } = link;
|
|
631
|
+
if (prevDep) {
|
|
632
|
+
prevDep.nextDep = nextDep;
|
|
633
|
+
link.prevDep = void 0;
|
|
634
|
+
}
|
|
635
|
+
if (nextDep) {
|
|
636
|
+
nextDep.prevDep = prevDep;
|
|
637
|
+
link.nextDep = void 0;
|
|
638
|
+
}
|
|
511
639
|
}
|
|
512
640
|
function effect(fn, options) {
|
|
513
641
|
if (fn.effect instanceof ReactiveEffect) {
|
|
514
642
|
fn = fn.effect.fn;
|
|
515
643
|
}
|
|
516
|
-
const
|
|
517
|
-
if (_effect.dirty) {
|
|
518
|
-
_effect.run();
|
|
519
|
-
}
|
|
520
|
-
});
|
|
644
|
+
const e = new ReactiveEffect(fn);
|
|
521
645
|
if (options) {
|
|
522
|
-
extend(
|
|
523
|
-
if (options.scope)
|
|
524
|
-
recordEffectScope(_effect, options.scope);
|
|
646
|
+
extend(e, options);
|
|
525
647
|
}
|
|
526
|
-
|
|
527
|
-
|
|
648
|
+
try {
|
|
649
|
+
e.run();
|
|
650
|
+
} catch (err) {
|
|
651
|
+
e.stop();
|
|
652
|
+
throw err;
|
|
528
653
|
}
|
|
529
|
-
const runner =
|
|
530
|
-
runner.effect =
|
|
654
|
+
const runner = e.run.bind(e);
|
|
655
|
+
runner.effect = e;
|
|
531
656
|
return runner;
|
|
532
657
|
}
|
|
533
658
|
function stop(runner) {
|
|
534
659
|
runner.effect.stop();
|
|
535
660
|
}
|
|
536
661
|
let shouldTrack = true;
|
|
537
|
-
let pauseScheduleStack = 0;
|
|
538
662
|
const trackStack = [];
|
|
539
663
|
function pauseTracking() {
|
|
540
664
|
trackStack.push(shouldTrack);
|
|
@@ -544,192 +668,414 @@ function resetTracking() {
|
|
|
544
668
|
const last = trackStack.pop();
|
|
545
669
|
shouldTrack = last === void 0 ? true : last;
|
|
546
670
|
}
|
|
547
|
-
function
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
671
|
+
function cleanupEffect(e) {
|
|
672
|
+
const { cleanup } = e;
|
|
673
|
+
e.cleanup = void 0;
|
|
674
|
+
if (cleanup) {
|
|
675
|
+
const prevSub = activeSub;
|
|
676
|
+
activeSub = void 0;
|
|
677
|
+
try {
|
|
678
|
+
cleanup();
|
|
679
|
+
} finally {
|
|
680
|
+
activeSub = prevSub;
|
|
681
|
+
}
|
|
554
682
|
}
|
|
555
683
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
684
|
+
|
|
685
|
+
let globalVersion = 0;
|
|
686
|
+
class Dep {
|
|
687
|
+
constructor(computed) {
|
|
688
|
+
this.computed = computed;
|
|
689
|
+
this.version = 0;
|
|
690
|
+
/**
|
|
691
|
+
* Link between this dep and the current active effect
|
|
692
|
+
*/
|
|
693
|
+
this.activeLink = void 0;
|
|
694
|
+
/**
|
|
695
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
696
|
+
*/
|
|
697
|
+
this.subs = void 0;
|
|
569
698
|
{
|
|
570
|
-
|
|
699
|
+
this.subsHead = void 0;
|
|
571
700
|
}
|
|
572
701
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
702
|
+
track(debugInfo) {
|
|
703
|
+
if (!activeSub || !shouldTrack) {
|
|
704
|
+
return;
|
|
705
|
+
}
|
|
706
|
+
let link = this.activeLink;
|
|
707
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
708
|
+
link = this.activeLink = {
|
|
709
|
+
dep: this,
|
|
710
|
+
sub: activeSub,
|
|
711
|
+
version: this.version,
|
|
712
|
+
nextDep: void 0,
|
|
713
|
+
prevDep: void 0,
|
|
714
|
+
nextSub: void 0,
|
|
715
|
+
prevSub: void 0,
|
|
716
|
+
prevActiveLink: void 0
|
|
717
|
+
};
|
|
718
|
+
if (!activeSub.deps) {
|
|
719
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
720
|
+
} else {
|
|
721
|
+
link.prevDep = activeSub.depsTail;
|
|
722
|
+
activeSub.depsTail.nextDep = link;
|
|
723
|
+
activeSub.depsTail = link;
|
|
724
|
+
}
|
|
725
|
+
if (activeSub.flags & 4) {
|
|
726
|
+
addSub(link);
|
|
587
727
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
728
|
+
} else if (link.version === -1) {
|
|
729
|
+
link.version = this.version;
|
|
730
|
+
if (link.nextDep) {
|
|
731
|
+
const next = link.nextDep;
|
|
732
|
+
next.prevDep = link.prevDep;
|
|
733
|
+
if (link.prevDep) {
|
|
734
|
+
link.prevDep.nextDep = next;
|
|
735
|
+
}
|
|
736
|
+
link.prevDep = activeSub.depsTail;
|
|
737
|
+
link.nextDep = void 0;
|
|
738
|
+
activeSub.depsTail.nextDep = link;
|
|
739
|
+
activeSub.depsTail = link;
|
|
740
|
+
if (activeSub.deps === link) {
|
|
741
|
+
activeSub.deps = next;
|
|
593
742
|
}
|
|
594
743
|
}
|
|
595
744
|
}
|
|
745
|
+
if (activeSub.onTrack) {
|
|
746
|
+
activeSub.onTrack(
|
|
747
|
+
extend(
|
|
748
|
+
{
|
|
749
|
+
effect: activeSub
|
|
750
|
+
},
|
|
751
|
+
debugInfo
|
|
752
|
+
)
|
|
753
|
+
);
|
|
754
|
+
}
|
|
755
|
+
return link;
|
|
756
|
+
}
|
|
757
|
+
trigger(debugInfo) {
|
|
758
|
+
this.version++;
|
|
759
|
+
globalVersion++;
|
|
760
|
+
this.notify(debugInfo);
|
|
761
|
+
}
|
|
762
|
+
notify(debugInfo) {
|
|
763
|
+
startBatch();
|
|
764
|
+
try {
|
|
765
|
+
if (true) {
|
|
766
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
767
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
768
|
+
head.sub.onTrigger(
|
|
769
|
+
extend(
|
|
770
|
+
{
|
|
771
|
+
effect: head.sub
|
|
772
|
+
},
|
|
773
|
+
debugInfo
|
|
774
|
+
)
|
|
775
|
+
);
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
780
|
+
link.sub.notify();
|
|
781
|
+
}
|
|
782
|
+
} finally {
|
|
783
|
+
endBatch();
|
|
784
|
+
}
|
|
596
785
|
}
|
|
597
|
-
resetScheduling();
|
|
598
786
|
}
|
|
599
|
-
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
|
|
787
|
+
function addSub(link) {
|
|
788
|
+
const computed = link.dep.computed;
|
|
789
|
+
if (computed && !link.dep.subs) {
|
|
790
|
+
computed.flags |= 4 | 16;
|
|
791
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
792
|
+
addSub(l);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
const currentTail = link.dep.subs;
|
|
796
|
+
if (currentTail !== link) {
|
|
797
|
+
link.prevSub = currentTail;
|
|
798
|
+
if (currentTail)
|
|
799
|
+
currentTail.nextSub = link;
|
|
800
|
+
}
|
|
801
|
+
if (link.dep.subsHead === void 0) {
|
|
802
|
+
link.dep.subsHead = link;
|
|
803
|
+
}
|
|
804
|
+
link.dep.subs = link;
|
|
805
|
+
}
|
|
607
806
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
608
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
609
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
807
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
808
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
809
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
610
810
|
function track(target, type, key) {
|
|
611
|
-
if (shouldTrack &&
|
|
811
|
+
if (shouldTrack && activeSub) {
|
|
612
812
|
let depsMap = targetMap.get(target);
|
|
613
813
|
if (!depsMap) {
|
|
614
814
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
615
815
|
}
|
|
616
816
|
let dep = depsMap.get(key);
|
|
617
817
|
if (!dep) {
|
|
618
|
-
depsMap.set(key, dep =
|
|
818
|
+
depsMap.set(key, dep = new Dep());
|
|
619
819
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
dep,
|
|
623
|
-
{
|
|
820
|
+
{
|
|
821
|
+
dep.track({
|
|
624
822
|
target,
|
|
625
823
|
type,
|
|
626
824
|
key
|
|
627
|
-
}
|
|
628
|
-
|
|
825
|
+
});
|
|
826
|
+
}
|
|
629
827
|
}
|
|
630
828
|
}
|
|
631
829
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
632
830
|
const depsMap = targetMap.get(target);
|
|
633
831
|
if (!depsMap) {
|
|
832
|
+
globalVersion++;
|
|
634
833
|
return;
|
|
635
834
|
}
|
|
636
835
|
let deps = [];
|
|
637
836
|
if (type === "clear") {
|
|
638
837
|
deps = [...depsMap.values()];
|
|
639
|
-
} else if (key === "length" && isArray(target)) {
|
|
640
|
-
const newLength = Number(newValue);
|
|
641
|
-
depsMap.forEach((dep, key2) => {
|
|
642
|
-
if (key2 === "length" || !isSymbol(key2) && key2 >= newLength) {
|
|
643
|
-
deps.push(dep);
|
|
644
|
-
}
|
|
645
|
-
});
|
|
646
838
|
} else {
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
if (!
|
|
653
|
-
deps.push(
|
|
654
|
-
if (isMap(target)) {
|
|
655
|
-
deps.push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
656
|
-
}
|
|
657
|
-
} else if (isIntegerKey(key)) {
|
|
658
|
-
deps.push(depsMap.get("length"));
|
|
839
|
+
const targetIsArray = isArray(target);
|
|
840
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
841
|
+
if (targetIsArray && key === "length") {
|
|
842
|
+
const newLength = Number(newValue);
|
|
843
|
+
depsMap.forEach((dep, key2) => {
|
|
844
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
845
|
+
deps.push(dep);
|
|
659
846
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
847
|
+
});
|
|
848
|
+
} else {
|
|
849
|
+
const push = (dep) => dep && deps.push(dep);
|
|
850
|
+
if (key !== void 0) {
|
|
851
|
+
push(depsMap.get(key));
|
|
852
|
+
}
|
|
853
|
+
if (isArrayIndex) {
|
|
854
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
855
|
+
}
|
|
856
|
+
switch (type) {
|
|
857
|
+
case "add":
|
|
858
|
+
if (!targetIsArray) {
|
|
859
|
+
push(depsMap.get(ITERATE_KEY));
|
|
860
|
+
if (isMap(target)) {
|
|
861
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
862
|
+
}
|
|
863
|
+
} else if (isArrayIndex) {
|
|
864
|
+
push(depsMap.get("length"));
|
|
865
|
+
}
|
|
866
|
+
break;
|
|
867
|
+
case "delete":
|
|
868
|
+
if (!targetIsArray) {
|
|
869
|
+
push(depsMap.get(ITERATE_KEY));
|
|
870
|
+
if (isMap(target)) {
|
|
871
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
break;
|
|
875
|
+
case "set":
|
|
664
876
|
if (isMap(target)) {
|
|
665
|
-
|
|
877
|
+
push(depsMap.get(ITERATE_KEY));
|
|
666
878
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
case "set":
|
|
670
|
-
if (isMap(target)) {
|
|
671
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
672
|
-
}
|
|
673
|
-
break;
|
|
879
|
+
break;
|
|
880
|
+
}
|
|
674
881
|
}
|
|
675
882
|
}
|
|
676
|
-
|
|
883
|
+
startBatch();
|
|
677
884
|
for (const dep of deps) {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
oldValue,
|
|
688
|
-
oldTarget
|
|
689
|
-
}
|
|
690
|
-
);
|
|
885
|
+
{
|
|
886
|
+
dep.trigger({
|
|
887
|
+
target,
|
|
888
|
+
type,
|
|
889
|
+
key,
|
|
890
|
+
newValue,
|
|
891
|
+
oldValue,
|
|
892
|
+
oldTarget
|
|
893
|
+
});
|
|
691
894
|
}
|
|
692
895
|
}
|
|
693
|
-
|
|
896
|
+
endBatch();
|
|
694
897
|
}
|
|
695
898
|
function getDepFromReactive(object, key) {
|
|
696
|
-
|
|
697
|
-
return
|
|
899
|
+
var _a;
|
|
900
|
+
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
function reactiveReadArray(array) {
|
|
904
|
+
const raw = toRaw(array);
|
|
905
|
+
if (raw === array)
|
|
906
|
+
return raw;
|
|
907
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
908
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
909
|
+
}
|
|
910
|
+
function shallowReadArray(arr) {
|
|
911
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
912
|
+
return arr;
|
|
913
|
+
}
|
|
914
|
+
const arrayInstrumentations = {
|
|
915
|
+
__proto__: null,
|
|
916
|
+
[Symbol.iterator]() {
|
|
917
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
918
|
+
},
|
|
919
|
+
concat(...args) {
|
|
920
|
+
return reactiveReadArray(this).concat(
|
|
921
|
+
...args.map((x) => reactiveReadArray(x))
|
|
922
|
+
);
|
|
923
|
+
},
|
|
924
|
+
entries() {
|
|
925
|
+
return iterator(this, "entries", (value) => {
|
|
926
|
+
value[1] = toReactive(value[1]);
|
|
927
|
+
return value;
|
|
928
|
+
});
|
|
929
|
+
},
|
|
930
|
+
every(fn, thisArg) {
|
|
931
|
+
return apply(this, "every", fn, thisArg);
|
|
932
|
+
},
|
|
933
|
+
filter(fn, thisArg) {
|
|
934
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
935
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
936
|
+
},
|
|
937
|
+
find(fn, thisArg) {
|
|
938
|
+
const result = apply(this, "find", fn, thisArg);
|
|
939
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
940
|
+
},
|
|
941
|
+
findIndex(fn, thisArg) {
|
|
942
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
943
|
+
},
|
|
944
|
+
findLast(fn, thisArg) {
|
|
945
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
946
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
947
|
+
},
|
|
948
|
+
findLastIndex(fn, thisArg) {
|
|
949
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
950
|
+
},
|
|
951
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
952
|
+
forEach(fn, thisArg) {
|
|
953
|
+
return apply(this, "forEach", fn, thisArg);
|
|
954
|
+
},
|
|
955
|
+
includes(...args) {
|
|
956
|
+
return searchProxy(this, "includes", args);
|
|
957
|
+
},
|
|
958
|
+
indexOf(...args) {
|
|
959
|
+
return searchProxy(this, "indexOf", args);
|
|
960
|
+
},
|
|
961
|
+
join(separator) {
|
|
962
|
+
return reactiveReadArray(this).join(separator);
|
|
963
|
+
},
|
|
964
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
965
|
+
lastIndexOf(...args) {
|
|
966
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
967
|
+
},
|
|
968
|
+
map(fn, thisArg) {
|
|
969
|
+
return apply(this, "map", fn, thisArg);
|
|
970
|
+
},
|
|
971
|
+
pop() {
|
|
972
|
+
return noTracking(this, "pop");
|
|
973
|
+
},
|
|
974
|
+
push(...args) {
|
|
975
|
+
return noTracking(this, "push", args);
|
|
976
|
+
},
|
|
977
|
+
reduce(fn, ...args) {
|
|
978
|
+
return reduce(this, "reduce", fn, args);
|
|
979
|
+
},
|
|
980
|
+
reduceRight(fn, ...args) {
|
|
981
|
+
return reduce(this, "reduceRight", fn, args);
|
|
982
|
+
},
|
|
983
|
+
shift() {
|
|
984
|
+
return noTracking(this, "shift");
|
|
985
|
+
},
|
|
986
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
987
|
+
some(fn, thisArg) {
|
|
988
|
+
return apply(this, "some", fn, thisArg);
|
|
989
|
+
},
|
|
990
|
+
splice(...args) {
|
|
991
|
+
return noTracking(this, "splice", args);
|
|
992
|
+
},
|
|
993
|
+
toReversed() {
|
|
994
|
+
return reactiveReadArray(this).toReversed();
|
|
995
|
+
},
|
|
996
|
+
toSorted(comparer) {
|
|
997
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
998
|
+
},
|
|
999
|
+
toSpliced(...args) {
|
|
1000
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1001
|
+
},
|
|
1002
|
+
unshift(...args) {
|
|
1003
|
+
return noTracking(this, "unshift", args);
|
|
1004
|
+
},
|
|
1005
|
+
values() {
|
|
1006
|
+
return iterator(this, "values", toReactive);
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
function iterator(self, method, wrapValue) {
|
|
1010
|
+
const arr = shallowReadArray(self);
|
|
1011
|
+
const iter = arr[method]();
|
|
1012
|
+
if (arr !== self && !isShallow(self)) {
|
|
1013
|
+
iter._next = iter.next;
|
|
1014
|
+
iter.next = () => {
|
|
1015
|
+
const result = iter._next();
|
|
1016
|
+
if (result.value) {
|
|
1017
|
+
result.value = wrapValue(result.value);
|
|
1018
|
+
}
|
|
1019
|
+
return result;
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
return iter;
|
|
1023
|
+
}
|
|
1024
|
+
function apply(self, method, fn, thisArg) {
|
|
1025
|
+
const arr = shallowReadArray(self);
|
|
1026
|
+
let wrappedFn = fn;
|
|
1027
|
+
if (arr !== self) {
|
|
1028
|
+
if (!isShallow(self)) {
|
|
1029
|
+
wrappedFn = function(item, index) {
|
|
1030
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1031
|
+
};
|
|
1032
|
+
} else if (fn.length > 2) {
|
|
1033
|
+
wrappedFn = function(item, index) {
|
|
1034
|
+
return fn.call(this, item, index, self);
|
|
1035
|
+
};
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return arr[method](wrappedFn, thisArg);
|
|
1039
|
+
}
|
|
1040
|
+
function reduce(self, method, fn, args) {
|
|
1041
|
+
const arr = shallowReadArray(self);
|
|
1042
|
+
let wrappedFn = fn;
|
|
1043
|
+
if (arr !== self) {
|
|
1044
|
+
if (!isShallow(self)) {
|
|
1045
|
+
wrappedFn = function(acc, item, index) {
|
|
1046
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1047
|
+
};
|
|
1048
|
+
} else if (fn.length > 3) {
|
|
1049
|
+
wrappedFn = function(acc, item, index) {
|
|
1050
|
+
return fn.call(this, acc, item, index, self);
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
return arr[method](wrappedFn, ...args);
|
|
1055
|
+
}
|
|
1056
|
+
function searchProxy(self, method, args) {
|
|
1057
|
+
const arr = toRaw(self);
|
|
1058
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1059
|
+
const res = arr[method](...args);
|
|
1060
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1061
|
+
args[0] = toRaw(args[0]);
|
|
1062
|
+
return arr[method](...args);
|
|
1063
|
+
}
|
|
1064
|
+
return res;
|
|
1065
|
+
}
|
|
1066
|
+
function noTracking(self, method, args = []) {
|
|
1067
|
+
pauseTracking();
|
|
1068
|
+
startBatch();
|
|
1069
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1070
|
+
endBatch();
|
|
1071
|
+
resetTracking();
|
|
1072
|
+
return res;
|
|
698
1073
|
}
|
|
699
1074
|
|
|
700
1075
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
701
1076
|
const builtInSymbols = new Set(
|
|
702
1077
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
703
1078
|
);
|
|
704
|
-
const arrayInstrumentations = /* @__PURE__ */ createArrayInstrumentations();
|
|
705
|
-
function createArrayInstrumentations() {
|
|
706
|
-
const instrumentations = {};
|
|
707
|
-
["includes", "indexOf", "lastIndexOf"].forEach((key) => {
|
|
708
|
-
instrumentations[key] = function(...args) {
|
|
709
|
-
const arr = toRaw(this);
|
|
710
|
-
for (let i = 0, l = this.length; i < l; i++) {
|
|
711
|
-
track(arr, "get", i + "");
|
|
712
|
-
}
|
|
713
|
-
const res = arr[key](...args);
|
|
714
|
-
if (res === -1 || res === false) {
|
|
715
|
-
return arr[key](...args.map(toRaw));
|
|
716
|
-
} else {
|
|
717
|
-
return res;
|
|
718
|
-
}
|
|
719
|
-
};
|
|
720
|
-
});
|
|
721
|
-
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
722
|
-
instrumentations[key] = function(...args) {
|
|
723
|
-
pauseTracking();
|
|
724
|
-
pauseScheduling();
|
|
725
|
-
const res = toRaw(this)[key].apply(this, args);
|
|
726
|
-
resetScheduling();
|
|
727
|
-
resetTracking();
|
|
728
|
-
return res;
|
|
729
|
-
};
|
|
730
|
-
});
|
|
731
|
-
return instrumentations;
|
|
732
|
-
}
|
|
733
1079
|
function hasOwnProperty(key) {
|
|
734
1080
|
if (!isSymbol(key))
|
|
735
1081
|
key = String(key);
|
|
@@ -760,14 +1106,22 @@ class BaseReactiveHandler {
|
|
|
760
1106
|
}
|
|
761
1107
|
const targetIsArray = isArray(target);
|
|
762
1108
|
if (!isReadonly2) {
|
|
763
|
-
|
|
764
|
-
|
|
1109
|
+
let fn;
|
|
1110
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1111
|
+
return fn;
|
|
765
1112
|
}
|
|
766
1113
|
if (key === "hasOwnProperty") {
|
|
767
1114
|
return hasOwnProperty;
|
|
768
1115
|
}
|
|
769
1116
|
}
|
|
770
|
-
const res = Reflect.get(
|
|
1117
|
+
const res = Reflect.get(
|
|
1118
|
+
target,
|
|
1119
|
+
key,
|
|
1120
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1121
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1122
|
+
// its class methods
|
|
1123
|
+
isRef(target) ? target : receiver
|
|
1124
|
+
);
|
|
771
1125
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
772
1126
|
return res;
|
|
773
1127
|
}
|
|
@@ -1266,110 +1620,8 @@ function markRaw(value) {
|
|
|
1266
1620
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1267
1621
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1268
1622
|
|
|
1269
|
-
const COMPUTED_SIDE_EFFECT_WARN = `Computed is still dirty after getter evaluation, likely because a computed is mutating its own dependency in its getter. State mutations in computed getters should be avoided. Check the docs for more details: https://vuejs.org/guide/essentials/computed.html#getters-should-be-side-effect-free`;
|
|
1270
|
-
class ComputedRefImpl {
|
|
1271
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1272
|
-
this.getter = getter;
|
|
1273
|
-
this._setter = _setter;
|
|
1274
|
-
this.dep = void 0;
|
|
1275
|
-
this.__v_isRef = true;
|
|
1276
|
-
this["__v_isReadonly"] = false;
|
|
1277
|
-
this.effect = new ReactiveEffect(
|
|
1278
|
-
() => getter(this._value),
|
|
1279
|
-
() => triggerRefValue(
|
|
1280
|
-
this,
|
|
1281
|
-
this.effect._dirtyLevel === 2 ? 2 : 3
|
|
1282
|
-
)
|
|
1283
|
-
);
|
|
1284
|
-
this.effect.computed = this;
|
|
1285
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1286
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1287
|
-
}
|
|
1288
|
-
get value() {
|
|
1289
|
-
const self = toRaw(this);
|
|
1290
|
-
if ((!self._cacheable || self.effect.dirty) && hasChanged(self._value, self._value = self.effect.run())) {
|
|
1291
|
-
triggerRefValue(self, 4);
|
|
1292
|
-
}
|
|
1293
|
-
trackRefValue(self);
|
|
1294
|
-
if (self.effect._dirtyLevel >= 2) {
|
|
1295
|
-
if (this._warnRecursive) {
|
|
1296
|
-
warn$2(COMPUTED_SIDE_EFFECT_WARN, `
|
|
1297
|
-
|
|
1298
|
-
getter: `, this.getter);
|
|
1299
|
-
}
|
|
1300
|
-
triggerRefValue(self, 2);
|
|
1301
|
-
}
|
|
1302
|
-
return self._value;
|
|
1303
|
-
}
|
|
1304
|
-
set value(newValue) {
|
|
1305
|
-
this._setter(newValue);
|
|
1306
|
-
}
|
|
1307
|
-
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1308
|
-
get _dirty() {
|
|
1309
|
-
return this.effect.dirty;
|
|
1310
|
-
}
|
|
1311
|
-
set _dirty(v) {
|
|
1312
|
-
this.effect.dirty = v;
|
|
1313
|
-
}
|
|
1314
|
-
// #endregion
|
|
1315
|
-
}
|
|
1316
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1317
|
-
let getter;
|
|
1318
|
-
let setter;
|
|
1319
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1320
|
-
if (onlyGetter) {
|
|
1321
|
-
getter = getterOrOptions;
|
|
1322
|
-
setter = () => {
|
|
1323
|
-
warn$2("Write operation failed: computed value is readonly");
|
|
1324
|
-
} ;
|
|
1325
|
-
} else {
|
|
1326
|
-
getter = getterOrOptions.get;
|
|
1327
|
-
setter = getterOrOptions.set;
|
|
1328
|
-
}
|
|
1329
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1330
|
-
if (debugOptions && !isSSR) {
|
|
1331
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1332
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1333
|
-
}
|
|
1334
|
-
return cRef;
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
function trackRefValue(ref2) {
|
|
1338
|
-
var _a;
|
|
1339
|
-
if (shouldTrack && activeEffect) {
|
|
1340
|
-
ref2 = toRaw(ref2);
|
|
1341
|
-
trackEffect(
|
|
1342
|
-
activeEffect,
|
|
1343
|
-
(_a = ref2.dep) != null ? _a : ref2.dep = createDep(
|
|
1344
|
-
() => ref2.dep = void 0,
|
|
1345
|
-
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1346
|
-
),
|
|
1347
|
-
{
|
|
1348
|
-
target: ref2,
|
|
1349
|
-
type: "get",
|
|
1350
|
-
key: "value"
|
|
1351
|
-
}
|
|
1352
|
-
);
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
function triggerRefValue(ref2, dirtyLevel = 4, newVal) {
|
|
1356
|
-
ref2 = toRaw(ref2);
|
|
1357
|
-
const dep = ref2.dep;
|
|
1358
|
-
if (dep) {
|
|
1359
|
-
triggerEffects(
|
|
1360
|
-
dep,
|
|
1361
|
-
dirtyLevel,
|
|
1362
|
-
{
|
|
1363
|
-
target: ref2,
|
|
1364
|
-
type: "set",
|
|
1365
|
-
key: "value",
|
|
1366
|
-
newValue: newVal
|
|
1367
|
-
}
|
|
1368
|
-
);
|
|
1369
|
-
}
|
|
1370
|
-
}
|
|
1371
1623
|
function isRef(r) {
|
|
1372
|
-
return
|
|
1624
|
+
return r ? r.__v_isRef === true : false;
|
|
1373
1625
|
}
|
|
1374
1626
|
function ref(value) {
|
|
1375
1627
|
return createRef(value, false);
|
|
@@ -1386,27 +1638,49 @@ function createRef(rawValue, shallow) {
|
|
|
1386
1638
|
class RefImpl {
|
|
1387
1639
|
constructor(value, __v_isShallow) {
|
|
1388
1640
|
this.__v_isShallow = __v_isShallow;
|
|
1389
|
-
this.dep =
|
|
1641
|
+
this.dep = new Dep();
|
|
1390
1642
|
this.__v_isRef = true;
|
|
1391
1643
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1392
1644
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1393
1645
|
}
|
|
1394
1646
|
get value() {
|
|
1395
|
-
|
|
1647
|
+
{
|
|
1648
|
+
this.dep.track({
|
|
1649
|
+
target: this,
|
|
1650
|
+
type: "get",
|
|
1651
|
+
key: "value"
|
|
1652
|
+
});
|
|
1653
|
+
}
|
|
1396
1654
|
return this._value;
|
|
1397
1655
|
}
|
|
1398
|
-
set value(
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
this.
|
|
1404
|
-
|
|
1656
|
+
set value(newValue) {
|
|
1657
|
+
const oldValue = this._rawValue;
|
|
1658
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1659
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1660
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1661
|
+
this._rawValue = newValue;
|
|
1662
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1663
|
+
{
|
|
1664
|
+
this.dep.trigger({
|
|
1665
|
+
target: this,
|
|
1666
|
+
type: "set",
|
|
1667
|
+
key: "value",
|
|
1668
|
+
newValue,
|
|
1669
|
+
oldValue
|
|
1670
|
+
});
|
|
1671
|
+
}
|
|
1405
1672
|
}
|
|
1406
1673
|
}
|
|
1407
1674
|
}
|
|
1408
1675
|
function triggerRef(ref2) {
|
|
1409
|
-
|
|
1676
|
+
{
|
|
1677
|
+
ref2.dep.trigger({
|
|
1678
|
+
target: ref2,
|
|
1679
|
+
type: "set",
|
|
1680
|
+
key: "value",
|
|
1681
|
+
newValue: ref2._value
|
|
1682
|
+
});
|
|
1683
|
+
}
|
|
1410
1684
|
}
|
|
1411
1685
|
function unref(ref2) {
|
|
1412
1686
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1431,12 +1705,9 @@ function proxyRefs(objectWithRefs) {
|
|
|
1431
1705
|
}
|
|
1432
1706
|
class CustomRefImpl {
|
|
1433
1707
|
constructor(factory) {
|
|
1434
|
-
this.dep = void 0;
|
|
1435
1708
|
this.__v_isRef = true;
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
() => triggerRefValue(this)
|
|
1439
|
-
);
|
|
1709
|
+
const dep = this.dep = new Dep();
|
|
1710
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1440
1711
|
this._get = get;
|
|
1441
1712
|
this._set = set;
|
|
1442
1713
|
}
|
|
@@ -1504,6 +1775,90 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1504
1775
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1505
1776
|
}
|
|
1506
1777
|
|
|
1778
|
+
class ComputedRefImpl {
|
|
1779
|
+
constructor(fn, setter, isSSR) {
|
|
1780
|
+
this.fn = fn;
|
|
1781
|
+
this.setter = setter;
|
|
1782
|
+
/**
|
|
1783
|
+
* @internal
|
|
1784
|
+
*/
|
|
1785
|
+
this._value = void 0;
|
|
1786
|
+
/**
|
|
1787
|
+
* @internal
|
|
1788
|
+
*/
|
|
1789
|
+
this.dep = new Dep(this);
|
|
1790
|
+
/**
|
|
1791
|
+
* @internal
|
|
1792
|
+
*/
|
|
1793
|
+
this.__v_isRef = true;
|
|
1794
|
+
// A computed is also a subscriber that tracks other deps
|
|
1795
|
+
/**
|
|
1796
|
+
* @internal
|
|
1797
|
+
*/
|
|
1798
|
+
this.deps = void 0;
|
|
1799
|
+
/**
|
|
1800
|
+
* @internal
|
|
1801
|
+
*/
|
|
1802
|
+
this.depsTail = void 0;
|
|
1803
|
+
/**
|
|
1804
|
+
* @internal
|
|
1805
|
+
*/
|
|
1806
|
+
this.flags = 16;
|
|
1807
|
+
/**
|
|
1808
|
+
* @internal
|
|
1809
|
+
*/
|
|
1810
|
+
this.globalVersion = globalVersion - 1;
|
|
1811
|
+
// for backwards compat
|
|
1812
|
+
this.effect = this;
|
|
1813
|
+
this.__v_isReadonly = !setter;
|
|
1814
|
+
this.isSSR = isSSR;
|
|
1815
|
+
}
|
|
1816
|
+
/**
|
|
1817
|
+
* @internal
|
|
1818
|
+
*/
|
|
1819
|
+
notify() {
|
|
1820
|
+
if (activeSub !== this) {
|
|
1821
|
+
this.flags |= 16;
|
|
1822
|
+
this.dep.notify();
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
get value() {
|
|
1826
|
+
const link = this.dep.track({
|
|
1827
|
+
target: this,
|
|
1828
|
+
type: "get",
|
|
1829
|
+
key: "value"
|
|
1830
|
+
}) ;
|
|
1831
|
+
refreshComputed(this);
|
|
1832
|
+
if (link) {
|
|
1833
|
+
link.version = this.dep.version;
|
|
1834
|
+
}
|
|
1835
|
+
return this._value;
|
|
1836
|
+
}
|
|
1837
|
+
set value(newValue) {
|
|
1838
|
+
if (this.setter) {
|
|
1839
|
+
this.setter(newValue);
|
|
1840
|
+
} else {
|
|
1841
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
}
|
|
1845
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1846
|
+
let getter;
|
|
1847
|
+
let setter;
|
|
1848
|
+
if (isFunction(getterOrOptions)) {
|
|
1849
|
+
getter = getterOrOptions;
|
|
1850
|
+
} else {
|
|
1851
|
+
getter = getterOrOptions.get;
|
|
1852
|
+
setter = getterOrOptions.set;
|
|
1853
|
+
}
|
|
1854
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1855
|
+
if (debugOptions && !isSSR) {
|
|
1856
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1857
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1858
|
+
}
|
|
1859
|
+
return cRef;
|
|
1860
|
+
}
|
|
1861
|
+
|
|
1507
1862
|
const TrackOpTypes = {
|
|
1508
1863
|
"GET": "get",
|
|
1509
1864
|
"HAS": "has",
|
|
@@ -1663,7 +2018,9 @@ const ErrorCodes = {
|
|
|
1663
2018
|
"ASYNC_COMPONENT_LOADER": 13,
|
|
1664
2019
|
"13": "ASYNC_COMPONENT_LOADER",
|
|
1665
2020
|
"SCHEDULER": 14,
|
|
1666
|
-
"14": "SCHEDULER"
|
|
2021
|
+
"14": "SCHEDULER",
|
|
2022
|
+
"APP_UNMOUNT_CLEANUP": 15,
|
|
2023
|
+
"15": "APP_UNMOUNT_CLEANUP"
|
|
1667
2024
|
};
|
|
1668
2025
|
const ErrorTypeStrings$1 = {
|
|
1669
2026
|
["sp"]: "serverPrefetch hook",
|
|
@@ -1694,7 +2051,8 @@ const ErrorTypeStrings$1 = {
|
|
|
1694
2051
|
[11]: "app warnHandler",
|
|
1695
2052
|
[12]: "ref function",
|
|
1696
2053
|
[13]: "async component loader",
|
|
1697
|
-
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core ."
|
|
2054
|
+
[14]: "scheduler flush. This is likely a Vue internals bug. Please open an issue at https://github.com/vuejs/core .",
|
|
2055
|
+
[15]: "app unmount cleanup function"
|
|
1698
2056
|
};
|
|
1699
2057
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
1700
2058
|
try {
|
|
@@ -1796,7 +2154,7 @@ function findInsertionIndex(id) {
|
|
|
1796
2154
|
const middle = start + end >>> 1;
|
|
1797
2155
|
const middleJob = queue[middle];
|
|
1798
2156
|
const middleJobId = getId(middleJob);
|
|
1799
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2157
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1800
2158
|
start = middle + 1;
|
|
1801
2159
|
} else {
|
|
1802
2160
|
end = middle;
|
|
@@ -1805,15 +2163,21 @@ function findInsertionIndex(id) {
|
|
|
1805
2163
|
return start;
|
|
1806
2164
|
}
|
|
1807
2165
|
function queueJob(job) {
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1811
|
-
)) {
|
|
2166
|
+
var _a;
|
|
2167
|
+
if (!(job.flags & 1)) {
|
|
1812
2168
|
if (job.id == null) {
|
|
1813
2169
|
queue.push(job);
|
|
2170
|
+
} else if (
|
|
2171
|
+
// fast path when the job id is larger than the tail
|
|
2172
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2173
|
+
) {
|
|
2174
|
+
queue.push(job);
|
|
1814
2175
|
} else {
|
|
1815
2176
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1816
2177
|
}
|
|
2178
|
+
if (!(job.flags & 4)) {
|
|
2179
|
+
job.flags |= 1;
|
|
2180
|
+
}
|
|
1817
2181
|
queueFlush();
|
|
1818
2182
|
}
|
|
1819
2183
|
}
|
|
@@ -1831,11 +2195,11 @@ function invalidateJob(job) {
|
|
|
1831
2195
|
}
|
|
1832
2196
|
function queuePostFlushCb(cb) {
|
|
1833
2197
|
if (!isArray(cb)) {
|
|
1834
|
-
if (!
|
|
1835
|
-
cb,
|
|
1836
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1837
|
-
)) {
|
|
2198
|
+
if (!(cb.flags & 1)) {
|
|
1838
2199
|
pendingPostFlushCbs.push(cb);
|
|
2200
|
+
if (!(cb.flags & 4)) {
|
|
2201
|
+
cb.flags |= 1;
|
|
2202
|
+
}
|
|
1839
2203
|
}
|
|
1840
2204
|
} else {
|
|
1841
2205
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1848,7 +2212,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1848
2212
|
}
|
|
1849
2213
|
for (; i < queue.length; i++) {
|
|
1850
2214
|
const cb = queue[i];
|
|
1851
|
-
if (cb && cb.
|
|
2215
|
+
if (cb && cb.flags & 2) {
|
|
1852
2216
|
if (instance && cb.id !== instance.uid) {
|
|
1853
2217
|
continue;
|
|
1854
2218
|
}
|
|
@@ -1858,6 +2222,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1858
2222
|
queue.splice(i, 1);
|
|
1859
2223
|
i--;
|
|
1860
2224
|
cb();
|
|
2225
|
+
cb.flags &= ~1;
|
|
1861
2226
|
}
|
|
1862
2227
|
}
|
|
1863
2228
|
}
|
|
@@ -1880,6 +2245,7 @@ function flushPostFlushCbs(seen) {
|
|
|
1880
2245
|
continue;
|
|
1881
2246
|
}
|
|
1882
2247
|
activePostFlushCbs[postFlushIndex]();
|
|
2248
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1883
2249
|
}
|
|
1884
2250
|
activePostFlushCbs = null;
|
|
1885
2251
|
postFlushIndex = 0;
|
|
@@ -1889,9 +2255,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
|
|
|
1889
2255
|
const comparator = (a, b) => {
|
|
1890
2256
|
const diff = getId(a) - getId(b);
|
|
1891
2257
|
if (diff === 0) {
|
|
1892
|
-
|
|
2258
|
+
const isAPre = a.flags & 2;
|
|
2259
|
+
const isBPre = b.flags & 2;
|
|
2260
|
+
if (isAPre && !isBPre)
|
|
1893
2261
|
return -1;
|
|
1894
|
-
if (
|
|
2262
|
+
if (isBPre && !isAPre)
|
|
1895
2263
|
return 1;
|
|
1896
2264
|
}
|
|
1897
2265
|
return diff;
|
|
@@ -1907,11 +2275,12 @@ function flushJobs(seen) {
|
|
|
1907
2275
|
try {
|
|
1908
2276
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1909
2277
|
const job = queue[flushIndex];
|
|
1910
|
-
if (job && job.
|
|
2278
|
+
if (job && !(job.flags & 8)) {
|
|
1911
2279
|
if (check(job)) {
|
|
1912
2280
|
continue;
|
|
1913
2281
|
}
|
|
1914
2282
|
callWithErrorHandling(job, null, 14);
|
|
2283
|
+
job.flags &= ~1;
|
|
1915
2284
|
}
|
|
1916
2285
|
}
|
|
1917
2286
|
} finally {
|
|
@@ -1993,7 +2362,6 @@ function rerender(id, newRender) {
|
|
|
1993
2362
|
}
|
|
1994
2363
|
instance.renderCache = [];
|
|
1995
2364
|
isHmrUpdating = true;
|
|
1996
|
-
instance.effect.dirty = true;
|
|
1997
2365
|
instance.update();
|
|
1998
2366
|
isHmrUpdating = false;
|
|
1999
2367
|
});
|
|
@@ -2021,7 +2389,6 @@ function reload(id, newComp) {
|
|
|
2021
2389
|
instance.ceReload(newComp.styles);
|
|
2022
2390
|
hmrDirtyComponents.delete(oldComp);
|
|
2023
2391
|
} else if (instance.parent) {
|
|
2024
|
-
instance.parent.effect.dirty = true;
|
|
2025
2392
|
queueJob(instance.parent.update);
|
|
2026
2393
|
} else if (instance.appContext.reload) {
|
|
2027
2394
|
instance.appContext.reload();
|
|
@@ -3427,8 +3794,8 @@ function doWatch(source, cb, {
|
|
|
3427
3794
|
};
|
|
3428
3795
|
};
|
|
3429
3796
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3430
|
-
const job = () => {
|
|
3431
|
-
if (!effect.
|
|
3797
|
+
const job = (immediateFirstRun) => {
|
|
3798
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
3432
3799
|
return;
|
|
3433
3800
|
}
|
|
3434
3801
|
if (cb) {
|
|
@@ -3449,19 +3816,22 @@ function doWatch(source, cb, {
|
|
|
3449
3816
|
effect.run();
|
|
3450
3817
|
}
|
|
3451
3818
|
};
|
|
3452
|
-
|
|
3819
|
+
if (cb)
|
|
3820
|
+
job.flags |= 4;
|
|
3821
|
+
const effect = new ReactiveEffect(getter);
|
|
3453
3822
|
let scheduler;
|
|
3454
3823
|
if (flush === "sync") {
|
|
3824
|
+
effect.flags |= 64;
|
|
3455
3825
|
scheduler = job;
|
|
3456
3826
|
} else if (flush === "post") {
|
|
3457
3827
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
3458
3828
|
} else {
|
|
3459
|
-
job.
|
|
3829
|
+
job.flags |= 2;
|
|
3460
3830
|
if (instance)
|
|
3461
3831
|
job.id = instance.uid;
|
|
3462
3832
|
scheduler = () => queueJob(job);
|
|
3463
3833
|
}
|
|
3464
|
-
|
|
3834
|
+
effect.scheduler = scheduler;
|
|
3465
3835
|
const scope = getCurrentScope();
|
|
3466
3836
|
const unwatch = () => {
|
|
3467
3837
|
effect.stop();
|
|
@@ -3475,7 +3845,7 @@ function doWatch(source, cb, {
|
|
|
3475
3845
|
}
|
|
3476
3846
|
if (cb) {
|
|
3477
3847
|
if (immediate) {
|
|
3478
|
-
job();
|
|
3848
|
+
job(true);
|
|
3479
3849
|
} else {
|
|
3480
3850
|
oldValue = effect.run();
|
|
3481
3851
|
}
|
|
@@ -3649,22 +4019,7 @@ const BaseTransitionImpl = {
|
|
|
3649
4019
|
if (!children || !children.length) {
|
|
3650
4020
|
return;
|
|
3651
4021
|
}
|
|
3652
|
-
|
|
3653
|
-
if (children.length > 1) {
|
|
3654
|
-
let hasFound = false;
|
|
3655
|
-
for (const c of children) {
|
|
3656
|
-
if (c.type !== Comment) {
|
|
3657
|
-
if (hasFound) {
|
|
3658
|
-
warn$1(
|
|
3659
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
3660
|
-
);
|
|
3661
|
-
break;
|
|
3662
|
-
}
|
|
3663
|
-
child = c;
|
|
3664
|
-
hasFound = true;
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
}
|
|
4022
|
+
const child = findNonCommentChild(children);
|
|
3668
4023
|
const rawProps = toRaw(props);
|
|
3669
4024
|
const { mode } = rawProps;
|
|
3670
4025
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -3673,7 +4028,7 @@ const BaseTransitionImpl = {
|
|
|
3673
4028
|
if (state.isLeaving) {
|
|
3674
4029
|
return emptyPlaceholder(child);
|
|
3675
4030
|
}
|
|
3676
|
-
const innerChild =
|
|
4031
|
+
const innerChild = getInnerChild$1(child);
|
|
3677
4032
|
if (!innerChild) {
|
|
3678
4033
|
return emptyPlaceholder(child);
|
|
3679
4034
|
}
|
|
@@ -3685,7 +4040,7 @@ const BaseTransitionImpl = {
|
|
|
3685
4040
|
);
|
|
3686
4041
|
setTransitionHooks(innerChild, enterHooks);
|
|
3687
4042
|
const oldChild = instance.subTree;
|
|
3688
|
-
const oldInnerChild = oldChild &&
|
|
4043
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
3689
4044
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
3690
4045
|
const leavingHooks = resolveTransitionHooks(
|
|
3691
4046
|
oldInnerChild,
|
|
@@ -3698,8 +4053,7 @@ const BaseTransitionImpl = {
|
|
|
3698
4053
|
state.isLeaving = true;
|
|
3699
4054
|
leavingHooks.afterLeave = () => {
|
|
3700
4055
|
state.isLeaving = false;
|
|
3701
|
-
if (instance.
|
|
3702
|
-
instance.effect.dirty = true;
|
|
4056
|
+
if (!(instance.job.flags & 8)) {
|
|
3703
4057
|
instance.update();
|
|
3704
4058
|
}
|
|
3705
4059
|
};
|
|
@@ -3724,6 +4078,25 @@ const BaseTransitionImpl = {
|
|
|
3724
4078
|
};
|
|
3725
4079
|
}
|
|
3726
4080
|
};
|
|
4081
|
+
function findNonCommentChild(children) {
|
|
4082
|
+
let child = children[0];
|
|
4083
|
+
if (children.length > 1) {
|
|
4084
|
+
let hasFound = false;
|
|
4085
|
+
for (const c of children) {
|
|
4086
|
+
if (c.type !== Comment) {
|
|
4087
|
+
if (hasFound) {
|
|
4088
|
+
warn$1(
|
|
4089
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4090
|
+
);
|
|
4091
|
+
break;
|
|
4092
|
+
}
|
|
4093
|
+
child = c;
|
|
4094
|
+
hasFound = true;
|
|
4095
|
+
}
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
return child;
|
|
4099
|
+
}
|
|
3727
4100
|
const BaseTransition = BaseTransitionImpl;
|
|
3728
4101
|
function getLeavingNodesForType(state, vnode) {
|
|
3729
4102
|
const { leavingVNodes } = state;
|
|
@@ -3878,8 +4251,11 @@ function emptyPlaceholder(vnode) {
|
|
|
3878
4251
|
return vnode;
|
|
3879
4252
|
}
|
|
3880
4253
|
}
|
|
3881
|
-
function
|
|
4254
|
+
function getInnerChild$1(vnode) {
|
|
3882
4255
|
if (!isKeepAlive(vnode)) {
|
|
4256
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4257
|
+
return findNonCommentChild(vnode.children);
|
|
4258
|
+
}
|
|
3883
4259
|
return vnode;
|
|
3884
4260
|
}
|
|
3885
4261
|
if (vnode.component) {
|
|
@@ -4048,7 +4424,6 @@ function defineAsyncComponent(source) {
|
|
|
4048
4424
|
load().then(() => {
|
|
4049
4425
|
loaded.value = true;
|
|
4050
4426
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4051
|
-
instance.parent.effect.dirty = true;
|
|
4052
4427
|
queueJob(instance.parent.update);
|
|
4053
4428
|
}
|
|
4054
4429
|
}).catch((err) => {
|
|
@@ -4373,10 +4748,20 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
4373
4748
|
function renderList(source, renderItem, cache, index) {
|
|
4374
4749
|
let ret;
|
|
4375
4750
|
const cached = cache && cache[index];
|
|
4376
|
-
|
|
4751
|
+
const sourceIsArray = isArray(source);
|
|
4752
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
4753
|
+
if (sourceIsArray || isString(source)) {
|
|
4754
|
+
if (sourceIsReactiveArray) {
|
|
4755
|
+
source = shallowReadArray(source);
|
|
4756
|
+
}
|
|
4377
4757
|
ret = new Array(source.length);
|
|
4378
4758
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
4379
|
-
ret[i] = renderItem(
|
|
4759
|
+
ret[i] = renderItem(
|
|
4760
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
4761
|
+
i,
|
|
4762
|
+
void 0,
|
|
4763
|
+
cached && cached[i]
|
|
4764
|
+
);
|
|
4380
4765
|
}
|
|
4381
4766
|
} else if (typeof source === "number") {
|
|
4382
4767
|
if (!Number.isInteger(source)) {
|
|
@@ -4511,7 +4896,6 @@ const publicPropertiesMap = (
|
|
|
4511
4896
|
$emit: (i) => i.emit,
|
|
4512
4897
|
$options: (i) => resolveMergedOptions(i) ,
|
|
4513
4898
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
4514
|
-
i.effect.dirty = true;
|
|
4515
4899
|
queueJob(i.update);
|
|
4516
4900
|
}),
|
|
4517
4901
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -5306,6 +5690,7 @@ function createAppAPI(render, hydrate) {
|
|
|
5306
5690
|
}
|
|
5307
5691
|
const context = createAppContext();
|
|
5308
5692
|
const installedPlugins = /* @__PURE__ */ new WeakSet();
|
|
5693
|
+
const pluginCleanupFns = [];
|
|
5309
5694
|
let isMounted = false;
|
|
5310
5695
|
const app = context.app = {
|
|
5311
5696
|
_uid: uid$1++,
|
|
@@ -5423,8 +5808,21 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
5423
5808
|
);
|
|
5424
5809
|
}
|
|
5425
5810
|
},
|
|
5811
|
+
onUnmount(cleanupFn) {
|
|
5812
|
+
if (typeof cleanupFn !== "function") {
|
|
5813
|
+
warn$1(
|
|
5814
|
+
`Expected function as first argument to app.onUnmount(), but got ${typeof cleanupFn}`
|
|
5815
|
+
);
|
|
5816
|
+
}
|
|
5817
|
+
pluginCleanupFns.push(cleanupFn);
|
|
5818
|
+
},
|
|
5426
5819
|
unmount() {
|
|
5427
5820
|
if (isMounted) {
|
|
5821
|
+
callWithAsyncErrorHandling(
|
|
5822
|
+
pluginCleanupFns,
|
|
5823
|
+
app._instance,
|
|
5824
|
+
15
|
|
5825
|
+
);
|
|
5428
5826
|
render(null, app._container);
|
|
5429
5827
|
{
|
|
5430
5828
|
app._instance = null;
|
|
@@ -5844,7 +6242,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
|
|
|
5844
6242
|
function assertType(value, type) {
|
|
5845
6243
|
let valid;
|
|
5846
6244
|
const expectedType = getType(type);
|
|
5847
|
-
if (
|
|
6245
|
+
if (expectedType === "null") {
|
|
6246
|
+
valid = value === null;
|
|
6247
|
+
} else if (isSimpleType(expectedType)) {
|
|
5848
6248
|
const t = typeof value;
|
|
5849
6249
|
valid = t === expectedType.toLowerCase();
|
|
5850
6250
|
if (!valid && t === "object") {
|
|
@@ -5854,8 +6254,6 @@ function assertType(value, type) {
|
|
|
5854
6254
|
valid = isObject(value);
|
|
5855
6255
|
} else if (expectedType === "Array") {
|
|
5856
6256
|
valid = isArray(value);
|
|
5857
|
-
} else if (expectedType === "null") {
|
|
5858
|
-
valid = value === null;
|
|
5859
6257
|
} else {
|
|
5860
6258
|
valid = value instanceof type;
|
|
5861
6259
|
}
|
|
@@ -7379,7 +7777,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7379
7777
|
} else {
|
|
7380
7778
|
instance.next = n2;
|
|
7381
7779
|
invalidateJob(instance.update);
|
|
7382
|
-
instance.effect.dirty = true;
|
|
7383
7780
|
instance.update();
|
|
7384
7781
|
}
|
|
7385
7782
|
} else {
|
|
@@ -7562,24 +7959,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7562
7959
|
}
|
|
7563
7960
|
}
|
|
7564
7961
|
};
|
|
7565
|
-
|
|
7566
|
-
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
);
|
|
7572
|
-
const update = instance.update = () => {
|
|
7573
|
-
if (effect.dirty) {
|
|
7574
|
-
effect.run();
|
|
7575
|
-
}
|
|
7576
|
-
};
|
|
7577
|
-
update.id = instance.uid;
|
|
7962
|
+
instance.scope.on();
|
|
7963
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
7964
|
+
instance.scope.off();
|
|
7965
|
+
const update = instance.update = effect.run.bind(effect);
|
|
7966
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
7967
|
+
job.id = instance.uid;
|
|
7968
|
+
effect.scheduler = () => queueJob(job);
|
|
7578
7969
|
toggleRecurse(instance, true);
|
|
7579
7970
|
{
|
|
7580
7971
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7581
7972
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7582
|
-
|
|
7973
|
+
job.ownerInstance = instance;
|
|
7583
7974
|
}
|
|
7584
7975
|
update();
|
|
7585
7976
|
};
|
|
@@ -8046,13 +8437,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8046
8437
|
if (instance.type.__hmrId) {
|
|
8047
8438
|
unregisterHMR(instance);
|
|
8048
8439
|
}
|
|
8049
|
-
const { bum, scope,
|
|
8440
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
8050
8441
|
if (bum) {
|
|
8051
8442
|
invokeArrayFns(bum);
|
|
8052
8443
|
}
|
|
8053
8444
|
scope.stop();
|
|
8054
|
-
if (
|
|
8055
|
-
|
|
8445
|
+
if (job) {
|
|
8446
|
+
job.flags |= 8;
|
|
8056
8447
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
8057
8448
|
}
|
|
8058
8449
|
if (um) {
|
|
@@ -8138,8 +8529,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8138
8529
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
8139
8530
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
8140
8531
|
}
|
|
8141
|
-
function toggleRecurse({ effect,
|
|
8142
|
-
|
|
8532
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
8533
|
+
if (allowed) {
|
|
8534
|
+
effect.flags |= 32;
|
|
8535
|
+
job.flags |= 4;
|
|
8536
|
+
} else {
|
|
8537
|
+
effect.flags &= ~32;
|
|
8538
|
+
job.flags &= ~4;
|
|
8539
|
+
}
|
|
8143
8540
|
}
|
|
8144
8541
|
function needTransition(parentSuspense, transition) {
|
|
8145
8542
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -8879,6 +9276,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
8879
9276
|
effect: null,
|
|
8880
9277
|
update: null,
|
|
8881
9278
|
// will be set synchronously right after creation
|
|
9279
|
+
job: null,
|
|
8882
9280
|
scope: new EffectScope(
|
|
8883
9281
|
true
|
|
8884
9282
|
/* detached */
|
|
@@ -9372,7 +9770,8 @@ function initCustomFormatter() {
|
|
|
9372
9770
|
{},
|
|
9373
9771
|
["span", vueStyle, genRefFlag(obj)],
|
|
9374
9772
|
"<",
|
|
9375
|
-
|
|
9773
|
+
// avoid debugger accessing value affecting behavior
|
|
9774
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
9376
9775
|
`>`
|
|
9377
9776
|
];
|
|
9378
9777
|
} else if (isReactive(obj)) {
|
|
@@ -9552,7 +9951,7 @@ function isMemoSame(cached, memo) {
|
|
|
9552
9951
|
return true;
|
|
9553
9952
|
}
|
|
9554
9953
|
|
|
9555
|
-
const version = "3.
|
|
9954
|
+
const version = "3.5.0-alpha.2";
|
|
9556
9955
|
const warn = warn$1 ;
|
|
9557
9956
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
9558
9957
|
const devtools = devtools$1 ;
|
|
@@ -11007,7 +11406,9 @@ const withKeys = (fn, modifiers) => {
|
|
|
11007
11406
|
return;
|
|
11008
11407
|
}
|
|
11009
11408
|
const eventKey = hyphenate(event.key);
|
|
11010
|
-
if (modifiers.some(
|
|
11409
|
+
if (modifiers.some(
|
|
11410
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
11411
|
+
)) {
|
|
11011
11412
|
return fn(event);
|
|
11012
11413
|
}
|
|
11013
11414
|
});
|