@vue/runtime-dom 3.4.25 → 3.5.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-dom.cjs.js +4 -2
- package/dist/runtime-dom.cjs.prod.js +4 -2
- package/dist/runtime-dom.d.ts +114 -76
- package/dist/runtime-dom.esm-browser.js +798 -415
- package/dist/runtime-dom.esm-browser.prod.js +6 -6
- package/dist/runtime-dom.esm-bundler.js +4 -2
- package/dist/runtime-dom.global.js +798 -415
- package/dist/runtime-dom.global.prod.js +6 -6
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-dom v3.
|
|
2
|
+
* @vue/runtime-dom v3.5.0-alpha.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -387,157 +387,280 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
387
387
|
function effectScope(detached) {
|
|
388
388
|
return new EffectScope(detached);
|
|
389
389
|
}
|
|
390
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
391
|
-
if (scope && scope.active) {
|
|
392
|
-
scope.effects.push(effect);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
390
|
function getCurrentScope() {
|
|
396
391
|
return activeEffectScope;
|
|
397
392
|
}
|
|
398
|
-
function onScopeDispose(fn) {
|
|
393
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
399
394
|
if (activeEffectScope) {
|
|
400
395
|
activeEffectScope.cleanups.push(fn);
|
|
401
|
-
} else {
|
|
396
|
+
} else if (!failSilently) {
|
|
402
397
|
warn$2(
|
|
403
398
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
404
399
|
);
|
|
405
400
|
}
|
|
406
401
|
}
|
|
407
402
|
|
|
408
|
-
let
|
|
403
|
+
let activeSub;
|
|
409
404
|
class ReactiveEffect {
|
|
410
|
-
constructor(fn
|
|
405
|
+
constructor(fn) {
|
|
411
406
|
this.fn = fn;
|
|
412
|
-
this.trigger = trigger;
|
|
413
|
-
this.scheduler = scheduler;
|
|
414
|
-
this.active = true;
|
|
415
|
-
this.deps = [];
|
|
416
407
|
/**
|
|
417
408
|
* @internal
|
|
418
409
|
*/
|
|
419
|
-
this.
|
|
410
|
+
this.deps = void 0;
|
|
420
411
|
/**
|
|
421
412
|
* @internal
|
|
422
413
|
*/
|
|
423
|
-
this.
|
|
414
|
+
this.depsTail = void 0;
|
|
424
415
|
/**
|
|
425
416
|
* @internal
|
|
426
417
|
*/
|
|
427
|
-
this.
|
|
418
|
+
this.flags = 1 | 4;
|
|
428
419
|
/**
|
|
429
420
|
* @internal
|
|
430
421
|
*/
|
|
431
|
-
this.
|
|
422
|
+
this.nextEffect = void 0;
|
|
432
423
|
/**
|
|
433
424
|
* @internal
|
|
434
425
|
*/
|
|
435
|
-
this.
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
440
|
-
this._dirtyLevel = 1;
|
|
441
|
-
pauseTracking();
|
|
442
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
443
|
-
const dep = this.deps[i];
|
|
444
|
-
if (dep.computed) {
|
|
445
|
-
triggerComputed(dep.computed);
|
|
446
|
-
if (this._dirtyLevel >= 4) {
|
|
447
|
-
break;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
if (this._dirtyLevel === 1) {
|
|
452
|
-
this._dirtyLevel = 0;
|
|
453
|
-
}
|
|
454
|
-
resetTracking();
|
|
426
|
+
this.cleanup = void 0;
|
|
427
|
+
this.scheduler = void 0;
|
|
428
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
429
|
+
activeEffectScope.effects.push(this);
|
|
455
430
|
}
|
|
456
|
-
return this._dirtyLevel >= 4;
|
|
457
431
|
}
|
|
458
|
-
|
|
459
|
-
|
|
432
|
+
/**
|
|
433
|
+
* @internal
|
|
434
|
+
*/
|
|
435
|
+
notify() {
|
|
436
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (this.flags & 64) {
|
|
440
|
+
return this.trigger();
|
|
441
|
+
}
|
|
442
|
+
if (!(this.flags & 8)) {
|
|
443
|
+
this.flags |= 8;
|
|
444
|
+
this.nextEffect = batchedEffect;
|
|
445
|
+
batchedEffect = this;
|
|
446
|
+
}
|
|
460
447
|
}
|
|
461
448
|
run() {
|
|
462
|
-
this.
|
|
463
|
-
if (!this.active) {
|
|
449
|
+
if (!(this.flags & 1)) {
|
|
464
450
|
return this.fn();
|
|
465
451
|
}
|
|
466
|
-
|
|
467
|
-
|
|
452
|
+
this.flags |= 2;
|
|
453
|
+
cleanupEffect(this);
|
|
454
|
+
prepareDeps(this);
|
|
455
|
+
const prevEffect = activeSub;
|
|
456
|
+
const prevShouldTrack = shouldTrack;
|
|
457
|
+
activeSub = this;
|
|
458
|
+
shouldTrack = true;
|
|
468
459
|
try {
|
|
469
|
-
shouldTrack = true;
|
|
470
|
-
activeEffect = this;
|
|
471
|
-
this._runnings++;
|
|
472
|
-
preCleanupEffect(this);
|
|
473
460
|
return this.fn();
|
|
474
461
|
} finally {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
462
|
+
if (activeSub !== this) {
|
|
463
|
+
warn$2(
|
|
464
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
cleanupDeps(this);
|
|
468
|
+
activeSub = prevEffect;
|
|
469
|
+
shouldTrack = prevShouldTrack;
|
|
470
|
+
this.flags &= ~2;
|
|
479
471
|
}
|
|
480
472
|
}
|
|
481
473
|
stop() {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
this
|
|
474
|
+
if (this.flags & 1) {
|
|
475
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
476
|
+
removeSub(link);
|
|
477
|
+
}
|
|
478
|
+
this.deps = this.depsTail = void 0;
|
|
479
|
+
cleanupEffect(this);
|
|
480
|
+
this.onStop && this.onStop();
|
|
481
|
+
this.flags &= ~1;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
trigger() {
|
|
485
|
+
if (this.scheduler) {
|
|
486
|
+
this.scheduler();
|
|
487
|
+
} else {
|
|
488
|
+
this.runIfDirty();
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* @internal
|
|
493
|
+
*/
|
|
494
|
+
runIfDirty() {
|
|
495
|
+
if (isDirty(this)) {
|
|
496
|
+
this.run();
|
|
488
497
|
}
|
|
489
498
|
}
|
|
499
|
+
get dirty() {
|
|
500
|
+
return isDirty(this);
|
|
501
|
+
}
|
|
490
502
|
}
|
|
491
|
-
|
|
492
|
-
|
|
503
|
+
let batchDepth = 0;
|
|
504
|
+
let batchedEffect;
|
|
505
|
+
function startBatch() {
|
|
506
|
+
batchDepth++;
|
|
493
507
|
}
|
|
494
|
-
function
|
|
495
|
-
|
|
496
|
-
|
|
508
|
+
function endBatch() {
|
|
509
|
+
if (batchDepth > 1) {
|
|
510
|
+
batchDepth--;
|
|
511
|
+
return;
|
|
512
|
+
}
|
|
513
|
+
let error;
|
|
514
|
+
while (batchedEffect) {
|
|
515
|
+
let e = batchedEffect;
|
|
516
|
+
batchedEffect = void 0;
|
|
517
|
+
while (e) {
|
|
518
|
+
const next = e.nextEffect;
|
|
519
|
+
e.nextEffect = void 0;
|
|
520
|
+
e.flags &= ~8;
|
|
521
|
+
if (e.flags & 1) {
|
|
522
|
+
try {
|
|
523
|
+
e.trigger();
|
|
524
|
+
} catch (err) {
|
|
525
|
+
if (!error)
|
|
526
|
+
error = err;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
e = next;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
batchDepth--;
|
|
533
|
+
if (error)
|
|
534
|
+
throw error;
|
|
535
|
+
}
|
|
536
|
+
function prepareDeps(sub) {
|
|
537
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
538
|
+
link.version = -1;
|
|
539
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
540
|
+
link.dep.activeLink = link;
|
|
541
|
+
}
|
|
497
542
|
}
|
|
498
|
-
function
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
543
|
+
function cleanupDeps(sub) {
|
|
544
|
+
let head;
|
|
545
|
+
let tail = sub.depsTail;
|
|
546
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
547
|
+
if (link.version === -1) {
|
|
548
|
+
if (link === tail)
|
|
549
|
+
tail = link.prevDep;
|
|
550
|
+
removeSub(link);
|
|
551
|
+
removeDep(link);
|
|
552
|
+
} else {
|
|
553
|
+
head = link;
|
|
502
554
|
}
|
|
503
|
-
|
|
555
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
556
|
+
link.prevActiveLink = void 0;
|
|
504
557
|
}
|
|
558
|
+
sub.deps = head;
|
|
559
|
+
sub.depsTail = tail;
|
|
505
560
|
}
|
|
506
|
-
function
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
if (dep.size === 0) {
|
|
511
|
-
dep.cleanup();
|
|
561
|
+
function isDirty(sub) {
|
|
562
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
563
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
564
|
+
return true;
|
|
512
565
|
}
|
|
513
566
|
}
|
|
567
|
+
if (sub._dirty) {
|
|
568
|
+
return true;
|
|
569
|
+
}
|
|
570
|
+
return false;
|
|
571
|
+
}
|
|
572
|
+
function refreshComputed(computed) {
|
|
573
|
+
if (computed.flags & 2) {
|
|
574
|
+
return false;
|
|
575
|
+
}
|
|
576
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
577
|
+
return;
|
|
578
|
+
}
|
|
579
|
+
computed.flags &= ~16;
|
|
580
|
+
if (computed.globalVersion === globalVersion) {
|
|
581
|
+
return;
|
|
582
|
+
}
|
|
583
|
+
computed.globalVersion = globalVersion;
|
|
584
|
+
const dep = computed.dep;
|
|
585
|
+
computed.flags |= 2;
|
|
586
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
587
|
+
computed.flags &= ~2;
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
590
|
+
const prevSub = activeSub;
|
|
591
|
+
const prevShouldTrack = shouldTrack;
|
|
592
|
+
activeSub = computed;
|
|
593
|
+
shouldTrack = true;
|
|
594
|
+
try {
|
|
595
|
+
prepareDeps(computed);
|
|
596
|
+
const value = computed.fn();
|
|
597
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
598
|
+
computed._value = value;
|
|
599
|
+
dep.version++;
|
|
600
|
+
}
|
|
601
|
+
} catch (err) {
|
|
602
|
+
dep.version++;
|
|
603
|
+
throw err;
|
|
604
|
+
} finally {
|
|
605
|
+
activeSub = prevSub;
|
|
606
|
+
shouldTrack = prevShouldTrack;
|
|
607
|
+
cleanupDeps(computed);
|
|
608
|
+
computed.flags &= ~2;
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
function removeSub(link) {
|
|
612
|
+
const { dep, prevSub, nextSub } = link;
|
|
613
|
+
if (prevSub) {
|
|
614
|
+
prevSub.nextSub = nextSub;
|
|
615
|
+
link.prevSub = void 0;
|
|
616
|
+
}
|
|
617
|
+
if (nextSub) {
|
|
618
|
+
nextSub.prevSub = prevSub;
|
|
619
|
+
link.nextSub = void 0;
|
|
620
|
+
}
|
|
621
|
+
if (dep.subs === link) {
|
|
622
|
+
dep.subs = prevSub;
|
|
623
|
+
}
|
|
624
|
+
if (!dep.subs && dep.computed) {
|
|
625
|
+
dep.computed.flags &= ~4;
|
|
626
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
627
|
+
removeSub(l);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
function removeDep(link) {
|
|
632
|
+
const { prevDep, nextDep } = link;
|
|
633
|
+
if (prevDep) {
|
|
634
|
+
prevDep.nextDep = nextDep;
|
|
635
|
+
link.prevDep = void 0;
|
|
636
|
+
}
|
|
637
|
+
if (nextDep) {
|
|
638
|
+
nextDep.prevDep = prevDep;
|
|
639
|
+
link.nextDep = void 0;
|
|
640
|
+
}
|
|
514
641
|
}
|
|
515
642
|
function effect(fn, options) {
|
|
516
643
|
if (fn.effect instanceof ReactiveEffect) {
|
|
517
644
|
fn = fn.effect.fn;
|
|
518
645
|
}
|
|
519
|
-
const
|
|
520
|
-
if (_effect.dirty) {
|
|
521
|
-
_effect.run();
|
|
522
|
-
}
|
|
523
|
-
});
|
|
646
|
+
const e = new ReactiveEffect(fn);
|
|
524
647
|
if (options) {
|
|
525
|
-
extend(
|
|
526
|
-
if (options.scope)
|
|
527
|
-
recordEffectScope(_effect, options.scope);
|
|
648
|
+
extend(e, options);
|
|
528
649
|
}
|
|
529
|
-
|
|
530
|
-
|
|
650
|
+
try {
|
|
651
|
+
e.run();
|
|
652
|
+
} catch (err) {
|
|
653
|
+
e.stop();
|
|
654
|
+
throw err;
|
|
531
655
|
}
|
|
532
|
-
const runner =
|
|
533
|
-
runner.effect =
|
|
656
|
+
const runner = e.run.bind(e);
|
|
657
|
+
runner.effect = e;
|
|
534
658
|
return runner;
|
|
535
659
|
}
|
|
536
660
|
function stop(runner) {
|
|
537
661
|
runner.effect.stop();
|
|
538
662
|
}
|
|
539
663
|
let shouldTrack = true;
|
|
540
|
-
let pauseScheduleStack = 0;
|
|
541
664
|
const trackStack = [];
|
|
542
665
|
function pauseTracking() {
|
|
543
666
|
trackStack.push(shouldTrack);
|
|
@@ -547,192 +670,414 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
547
670
|
const last = trackStack.pop();
|
|
548
671
|
shouldTrack = last === void 0 ? true : last;
|
|
549
672
|
}
|
|
550
|
-
function
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
673
|
+
function cleanupEffect(e) {
|
|
674
|
+
const { cleanup } = e;
|
|
675
|
+
e.cleanup = void 0;
|
|
676
|
+
if (cleanup) {
|
|
677
|
+
const prevSub = activeSub;
|
|
678
|
+
activeSub = void 0;
|
|
679
|
+
try {
|
|
680
|
+
cleanup();
|
|
681
|
+
} finally {
|
|
682
|
+
activeSub = prevSub;
|
|
683
|
+
}
|
|
557
684
|
}
|
|
558
685
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
686
|
+
|
|
687
|
+
let globalVersion = 0;
|
|
688
|
+
class Dep {
|
|
689
|
+
constructor(computed) {
|
|
690
|
+
this.computed = computed;
|
|
691
|
+
this.version = 0;
|
|
692
|
+
/**
|
|
693
|
+
* Link between this dep and the current active effect
|
|
694
|
+
*/
|
|
695
|
+
this.activeLink = void 0;
|
|
696
|
+
/**
|
|
697
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
698
|
+
*/
|
|
699
|
+
this.subs = void 0;
|
|
572
700
|
{
|
|
573
|
-
|
|
701
|
+
this.subsHead = void 0;
|
|
574
702
|
}
|
|
575
703
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
704
|
+
track(debugInfo) {
|
|
705
|
+
if (!activeSub || !shouldTrack) {
|
|
706
|
+
return;
|
|
707
|
+
}
|
|
708
|
+
let link = this.activeLink;
|
|
709
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
710
|
+
link = this.activeLink = {
|
|
711
|
+
dep: this,
|
|
712
|
+
sub: activeSub,
|
|
713
|
+
version: this.version,
|
|
714
|
+
nextDep: void 0,
|
|
715
|
+
prevDep: void 0,
|
|
716
|
+
nextSub: void 0,
|
|
717
|
+
prevSub: void 0,
|
|
718
|
+
prevActiveLink: void 0
|
|
719
|
+
};
|
|
720
|
+
if (!activeSub.deps) {
|
|
721
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
722
|
+
} else {
|
|
723
|
+
link.prevDep = activeSub.depsTail;
|
|
724
|
+
activeSub.depsTail.nextDep = link;
|
|
725
|
+
activeSub.depsTail = link;
|
|
726
|
+
}
|
|
727
|
+
if (activeSub.flags & 4) {
|
|
728
|
+
addSub(link);
|
|
590
729
|
}
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
730
|
+
} else if (link.version === -1) {
|
|
731
|
+
link.version = this.version;
|
|
732
|
+
if (link.nextDep) {
|
|
733
|
+
const next = link.nextDep;
|
|
734
|
+
next.prevDep = link.prevDep;
|
|
735
|
+
if (link.prevDep) {
|
|
736
|
+
link.prevDep.nextDep = next;
|
|
737
|
+
}
|
|
738
|
+
link.prevDep = activeSub.depsTail;
|
|
739
|
+
link.nextDep = void 0;
|
|
740
|
+
activeSub.depsTail.nextDep = link;
|
|
741
|
+
activeSub.depsTail = link;
|
|
742
|
+
if (activeSub.deps === link) {
|
|
743
|
+
activeSub.deps = next;
|
|
596
744
|
}
|
|
597
745
|
}
|
|
598
746
|
}
|
|
747
|
+
if (activeSub.onTrack) {
|
|
748
|
+
activeSub.onTrack(
|
|
749
|
+
extend(
|
|
750
|
+
{
|
|
751
|
+
effect: activeSub
|
|
752
|
+
},
|
|
753
|
+
debugInfo
|
|
754
|
+
)
|
|
755
|
+
);
|
|
756
|
+
}
|
|
757
|
+
return link;
|
|
758
|
+
}
|
|
759
|
+
trigger(debugInfo) {
|
|
760
|
+
this.version++;
|
|
761
|
+
globalVersion++;
|
|
762
|
+
this.notify(debugInfo);
|
|
763
|
+
}
|
|
764
|
+
notify(debugInfo) {
|
|
765
|
+
startBatch();
|
|
766
|
+
try {
|
|
767
|
+
if (true) {
|
|
768
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
769
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
770
|
+
head.sub.onTrigger(
|
|
771
|
+
extend(
|
|
772
|
+
{
|
|
773
|
+
effect: head.sub
|
|
774
|
+
},
|
|
775
|
+
debugInfo
|
|
776
|
+
)
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
782
|
+
link.sub.notify();
|
|
783
|
+
}
|
|
784
|
+
} finally {
|
|
785
|
+
endBatch();
|
|
786
|
+
}
|
|
599
787
|
}
|
|
600
|
-
resetScheduling();
|
|
601
788
|
}
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
789
|
+
function addSub(link) {
|
|
790
|
+
const computed = link.dep.computed;
|
|
791
|
+
if (computed && !link.dep.subs) {
|
|
792
|
+
computed.flags |= 4 | 16;
|
|
793
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
794
|
+
addSub(l);
|
|
795
|
+
}
|
|
796
|
+
}
|
|
797
|
+
const currentTail = link.dep.subs;
|
|
798
|
+
if (currentTail !== link) {
|
|
799
|
+
link.prevSub = currentTail;
|
|
800
|
+
if (currentTail)
|
|
801
|
+
currentTail.nextSub = link;
|
|
802
|
+
}
|
|
803
|
+
if (link.dep.subsHead === void 0) {
|
|
804
|
+
link.dep.subsHead = link;
|
|
805
|
+
}
|
|
806
|
+
link.dep.subs = link;
|
|
807
|
+
}
|
|
610
808
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
611
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
612
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
809
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
810
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
811
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
613
812
|
function track(target, type, key) {
|
|
614
|
-
if (shouldTrack &&
|
|
813
|
+
if (shouldTrack && activeSub) {
|
|
615
814
|
let depsMap = targetMap.get(target);
|
|
616
815
|
if (!depsMap) {
|
|
617
816
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
618
817
|
}
|
|
619
818
|
let dep = depsMap.get(key);
|
|
620
819
|
if (!dep) {
|
|
621
|
-
depsMap.set(key, dep =
|
|
820
|
+
depsMap.set(key, dep = new Dep());
|
|
622
821
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
dep,
|
|
626
|
-
{
|
|
822
|
+
{
|
|
823
|
+
dep.track({
|
|
627
824
|
target,
|
|
628
825
|
type,
|
|
629
826
|
key
|
|
630
|
-
}
|
|
631
|
-
|
|
827
|
+
});
|
|
828
|
+
}
|
|
632
829
|
}
|
|
633
830
|
}
|
|
634
831
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
635
832
|
const depsMap = targetMap.get(target);
|
|
636
833
|
if (!depsMap) {
|
|
834
|
+
globalVersion++;
|
|
637
835
|
return;
|
|
638
836
|
}
|
|
639
837
|
let deps = [];
|
|
640
838
|
if (type === "clear") {
|
|
641
839
|
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
840
|
} 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"));
|
|
841
|
+
const targetIsArray = isArray(target);
|
|
842
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
843
|
+
if (targetIsArray && key === "length") {
|
|
844
|
+
const newLength = Number(newValue);
|
|
845
|
+
depsMap.forEach((dep, key2) => {
|
|
846
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
847
|
+
deps.push(dep);
|
|
662
848
|
}
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
849
|
+
});
|
|
850
|
+
} else {
|
|
851
|
+
const push = (dep) => dep && deps.push(dep);
|
|
852
|
+
if (key !== void 0) {
|
|
853
|
+
push(depsMap.get(key));
|
|
854
|
+
}
|
|
855
|
+
if (isArrayIndex) {
|
|
856
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
857
|
+
}
|
|
858
|
+
switch (type) {
|
|
859
|
+
case "add":
|
|
860
|
+
if (!targetIsArray) {
|
|
861
|
+
push(depsMap.get(ITERATE_KEY));
|
|
862
|
+
if (isMap(target)) {
|
|
863
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
864
|
+
}
|
|
865
|
+
} else if (isArrayIndex) {
|
|
866
|
+
push(depsMap.get("length"));
|
|
867
|
+
}
|
|
868
|
+
break;
|
|
869
|
+
case "delete":
|
|
870
|
+
if (!targetIsArray) {
|
|
871
|
+
push(depsMap.get(ITERATE_KEY));
|
|
872
|
+
if (isMap(target)) {
|
|
873
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
874
|
+
}
|
|
875
|
+
}
|
|
876
|
+
break;
|
|
877
|
+
case "set":
|
|
667
878
|
if (isMap(target)) {
|
|
668
|
-
|
|
879
|
+
push(depsMap.get(ITERATE_KEY));
|
|
669
880
|
}
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
case "set":
|
|
673
|
-
if (isMap(target)) {
|
|
674
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
675
|
-
}
|
|
676
|
-
break;
|
|
881
|
+
break;
|
|
882
|
+
}
|
|
677
883
|
}
|
|
678
884
|
}
|
|
679
|
-
|
|
885
|
+
startBatch();
|
|
680
886
|
for (const dep of deps) {
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
oldValue,
|
|
691
|
-
oldTarget
|
|
692
|
-
}
|
|
693
|
-
);
|
|
887
|
+
{
|
|
888
|
+
dep.trigger({
|
|
889
|
+
target,
|
|
890
|
+
type,
|
|
891
|
+
key,
|
|
892
|
+
newValue,
|
|
893
|
+
oldValue,
|
|
894
|
+
oldTarget
|
|
895
|
+
});
|
|
694
896
|
}
|
|
695
897
|
}
|
|
696
|
-
|
|
898
|
+
endBatch();
|
|
697
899
|
}
|
|
698
900
|
function getDepFromReactive(object, key) {
|
|
699
901
|
var _a;
|
|
700
902
|
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
701
903
|
}
|
|
702
904
|
|
|
905
|
+
function reactiveReadArray(array) {
|
|
906
|
+
const raw = toRaw(array);
|
|
907
|
+
if (raw === array)
|
|
908
|
+
return raw;
|
|
909
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
910
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
911
|
+
}
|
|
912
|
+
function shallowReadArray(arr) {
|
|
913
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
914
|
+
return arr;
|
|
915
|
+
}
|
|
916
|
+
const arrayInstrumentations = {
|
|
917
|
+
__proto__: null,
|
|
918
|
+
[Symbol.iterator]() {
|
|
919
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
920
|
+
},
|
|
921
|
+
concat(...args) {
|
|
922
|
+
return reactiveReadArray(this).concat(
|
|
923
|
+
...args.map((x) => reactiveReadArray(x))
|
|
924
|
+
);
|
|
925
|
+
},
|
|
926
|
+
entries() {
|
|
927
|
+
return iterator(this, "entries", (value) => {
|
|
928
|
+
value[1] = toReactive(value[1]);
|
|
929
|
+
return value;
|
|
930
|
+
});
|
|
931
|
+
},
|
|
932
|
+
every(fn, thisArg) {
|
|
933
|
+
return apply(this, "every", fn, thisArg);
|
|
934
|
+
},
|
|
935
|
+
filter(fn, thisArg) {
|
|
936
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
937
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
938
|
+
},
|
|
939
|
+
find(fn, thisArg) {
|
|
940
|
+
const result = apply(this, "find", fn, thisArg);
|
|
941
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
942
|
+
},
|
|
943
|
+
findIndex(fn, thisArg) {
|
|
944
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
945
|
+
},
|
|
946
|
+
findLast(fn, thisArg) {
|
|
947
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
948
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
949
|
+
},
|
|
950
|
+
findLastIndex(fn, thisArg) {
|
|
951
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
952
|
+
},
|
|
953
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
954
|
+
forEach(fn, thisArg) {
|
|
955
|
+
return apply(this, "forEach", fn, thisArg);
|
|
956
|
+
},
|
|
957
|
+
includes(...args) {
|
|
958
|
+
return searchProxy(this, "includes", args);
|
|
959
|
+
},
|
|
960
|
+
indexOf(...args) {
|
|
961
|
+
return searchProxy(this, "indexOf", args);
|
|
962
|
+
},
|
|
963
|
+
join(separator) {
|
|
964
|
+
return reactiveReadArray(this).join(separator);
|
|
965
|
+
},
|
|
966
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
967
|
+
lastIndexOf(...args) {
|
|
968
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
969
|
+
},
|
|
970
|
+
map(fn, thisArg) {
|
|
971
|
+
return apply(this, "map", fn, thisArg);
|
|
972
|
+
},
|
|
973
|
+
pop() {
|
|
974
|
+
return noTracking(this, "pop");
|
|
975
|
+
},
|
|
976
|
+
push(...args) {
|
|
977
|
+
return noTracking(this, "push", args);
|
|
978
|
+
},
|
|
979
|
+
reduce(fn, ...args) {
|
|
980
|
+
return reduce(this, "reduce", fn, args);
|
|
981
|
+
},
|
|
982
|
+
reduceRight(fn, ...args) {
|
|
983
|
+
return reduce(this, "reduceRight", fn, args);
|
|
984
|
+
},
|
|
985
|
+
shift() {
|
|
986
|
+
return noTracking(this, "shift");
|
|
987
|
+
},
|
|
988
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
989
|
+
some(fn, thisArg) {
|
|
990
|
+
return apply(this, "some", fn, thisArg);
|
|
991
|
+
},
|
|
992
|
+
splice(...args) {
|
|
993
|
+
return noTracking(this, "splice", args);
|
|
994
|
+
},
|
|
995
|
+
toReversed() {
|
|
996
|
+
return reactiveReadArray(this).toReversed();
|
|
997
|
+
},
|
|
998
|
+
toSorted(comparer) {
|
|
999
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
1000
|
+
},
|
|
1001
|
+
toSpliced(...args) {
|
|
1002
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1003
|
+
},
|
|
1004
|
+
unshift(...args) {
|
|
1005
|
+
return noTracking(this, "unshift", args);
|
|
1006
|
+
},
|
|
1007
|
+
values() {
|
|
1008
|
+
return iterator(this, "values", toReactive);
|
|
1009
|
+
}
|
|
1010
|
+
};
|
|
1011
|
+
function iterator(self, method, wrapValue) {
|
|
1012
|
+
const arr = shallowReadArray(self);
|
|
1013
|
+
const iter = arr[method]();
|
|
1014
|
+
if (arr !== self && !isShallow(self)) {
|
|
1015
|
+
iter._next = iter.next;
|
|
1016
|
+
iter.next = () => {
|
|
1017
|
+
const result = iter._next();
|
|
1018
|
+
if (result.value) {
|
|
1019
|
+
result.value = wrapValue(result.value);
|
|
1020
|
+
}
|
|
1021
|
+
return result;
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
return iter;
|
|
1025
|
+
}
|
|
1026
|
+
function apply(self, method, fn, thisArg) {
|
|
1027
|
+
const arr = shallowReadArray(self);
|
|
1028
|
+
let wrappedFn = fn;
|
|
1029
|
+
if (arr !== self) {
|
|
1030
|
+
if (!isShallow(self)) {
|
|
1031
|
+
wrappedFn = function(item, index) {
|
|
1032
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1033
|
+
};
|
|
1034
|
+
} else if (fn.length > 2) {
|
|
1035
|
+
wrappedFn = function(item, index) {
|
|
1036
|
+
return fn.call(this, item, index, self);
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return arr[method](wrappedFn, thisArg);
|
|
1041
|
+
}
|
|
1042
|
+
function reduce(self, method, fn, args) {
|
|
1043
|
+
const arr = shallowReadArray(self);
|
|
1044
|
+
let wrappedFn = fn;
|
|
1045
|
+
if (arr !== self) {
|
|
1046
|
+
if (!isShallow(self)) {
|
|
1047
|
+
wrappedFn = function(acc, item, index) {
|
|
1048
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1049
|
+
};
|
|
1050
|
+
} else if (fn.length > 3) {
|
|
1051
|
+
wrappedFn = function(acc, item, index) {
|
|
1052
|
+
return fn.call(this, acc, item, index, self);
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
return arr[method](wrappedFn, ...args);
|
|
1057
|
+
}
|
|
1058
|
+
function searchProxy(self, method, args) {
|
|
1059
|
+
const arr = toRaw(self);
|
|
1060
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1061
|
+
const res = arr[method](...args);
|
|
1062
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1063
|
+
args[0] = toRaw(args[0]);
|
|
1064
|
+
return arr[method](...args);
|
|
1065
|
+
}
|
|
1066
|
+
return res;
|
|
1067
|
+
}
|
|
1068
|
+
function noTracking(self, method, args = []) {
|
|
1069
|
+
pauseTracking();
|
|
1070
|
+
startBatch();
|
|
1071
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1072
|
+
endBatch();
|
|
1073
|
+
resetTracking();
|
|
1074
|
+
return res;
|
|
1075
|
+
}
|
|
1076
|
+
|
|
703
1077
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
704
1078
|
const builtInSymbols = new Set(
|
|
705
1079
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
706
1080
|
);
|
|
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
1081
|
function hasOwnProperty(key) {
|
|
737
1082
|
if (!isSymbol(key))
|
|
738
1083
|
key = String(key);
|
|
@@ -763,14 +1108,22 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
763
1108
|
}
|
|
764
1109
|
const targetIsArray = isArray(target);
|
|
765
1110
|
if (!isReadonly2) {
|
|
766
|
-
|
|
767
|
-
|
|
1111
|
+
let fn;
|
|
1112
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1113
|
+
return fn;
|
|
768
1114
|
}
|
|
769
1115
|
if (key === "hasOwnProperty") {
|
|
770
1116
|
return hasOwnProperty;
|
|
771
1117
|
}
|
|
772
1118
|
}
|
|
773
|
-
const res = Reflect.get(
|
|
1119
|
+
const res = Reflect.get(
|
|
1120
|
+
target,
|
|
1121
|
+
key,
|
|
1122
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1123
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1124
|
+
// its class methods
|
|
1125
|
+
isRef(target) ? target : receiver
|
|
1126
|
+
);
|
|
774
1127
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
775
1128
|
return res;
|
|
776
1129
|
}
|
|
@@ -1269,110 +1622,8 @@ var VueRuntimeDOM = (function (exports) {
|
|
|
1269
1622
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1270
1623
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1271
1624
|
|
|
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
1625
|
function isRef(r) {
|
|
1375
|
-
return
|
|
1626
|
+
return r ? r.__v_isRef === true : false;
|
|
1376
1627
|
}
|
|
1377
1628
|
function ref(value) {
|
|
1378
1629
|
return createRef(value, false);
|
|
@@ -1389,27 +1640,49 @@ getter: `, this.getter);
|
|
|
1389
1640
|
class RefImpl {
|
|
1390
1641
|
constructor(value, __v_isShallow) {
|
|
1391
1642
|
this.__v_isShallow = __v_isShallow;
|
|
1392
|
-
this.dep =
|
|
1643
|
+
this.dep = new Dep();
|
|
1393
1644
|
this.__v_isRef = true;
|
|
1394
1645
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1395
1646
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1396
1647
|
}
|
|
1397
1648
|
get value() {
|
|
1398
|
-
|
|
1649
|
+
{
|
|
1650
|
+
this.dep.track({
|
|
1651
|
+
target: this,
|
|
1652
|
+
type: "get",
|
|
1653
|
+
key: "value"
|
|
1654
|
+
});
|
|
1655
|
+
}
|
|
1399
1656
|
return this._value;
|
|
1400
1657
|
}
|
|
1401
|
-
set value(
|
|
1402
|
-
const
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
this.
|
|
1407
|
-
|
|
1658
|
+
set value(newValue) {
|
|
1659
|
+
const oldValue = this._rawValue;
|
|
1660
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1661
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1662
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1663
|
+
this._rawValue = newValue;
|
|
1664
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1665
|
+
{
|
|
1666
|
+
this.dep.trigger({
|
|
1667
|
+
target: this,
|
|
1668
|
+
type: "set",
|
|
1669
|
+
key: "value",
|
|
1670
|
+
newValue,
|
|
1671
|
+
oldValue
|
|
1672
|
+
});
|
|
1673
|
+
}
|
|
1408
1674
|
}
|
|
1409
1675
|
}
|
|
1410
1676
|
}
|
|
1411
1677
|
function triggerRef(ref2) {
|
|
1412
|
-
|
|
1678
|
+
{
|
|
1679
|
+
ref2.dep.trigger({
|
|
1680
|
+
target: ref2,
|
|
1681
|
+
type: "set",
|
|
1682
|
+
key: "value",
|
|
1683
|
+
newValue: ref2._value
|
|
1684
|
+
});
|
|
1685
|
+
}
|
|
1413
1686
|
}
|
|
1414
1687
|
function unref(ref2) {
|
|
1415
1688
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1434,12 +1707,9 @@ getter: `, this.getter);
|
|
|
1434
1707
|
}
|
|
1435
1708
|
class CustomRefImpl {
|
|
1436
1709
|
constructor(factory) {
|
|
1437
|
-
this.dep = void 0;
|
|
1438
1710
|
this.__v_isRef = true;
|
|
1439
|
-
const
|
|
1440
|
-
|
|
1441
|
-
() => triggerRefValue(this)
|
|
1442
|
-
);
|
|
1711
|
+
const dep = this.dep = new Dep();
|
|
1712
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1443
1713
|
this._get = get;
|
|
1444
1714
|
this._set = set;
|
|
1445
1715
|
}
|
|
@@ -1507,6 +1777,90 @@ getter: `, this.getter);
|
|
|
1507
1777
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1508
1778
|
}
|
|
1509
1779
|
|
|
1780
|
+
class ComputedRefImpl {
|
|
1781
|
+
constructor(fn, setter, isSSR) {
|
|
1782
|
+
this.fn = fn;
|
|
1783
|
+
this.setter = setter;
|
|
1784
|
+
/**
|
|
1785
|
+
* @internal
|
|
1786
|
+
*/
|
|
1787
|
+
this._value = void 0;
|
|
1788
|
+
/**
|
|
1789
|
+
* @internal
|
|
1790
|
+
*/
|
|
1791
|
+
this.dep = new Dep(this);
|
|
1792
|
+
/**
|
|
1793
|
+
* @internal
|
|
1794
|
+
*/
|
|
1795
|
+
this.__v_isRef = true;
|
|
1796
|
+
// A computed is also a subscriber that tracks other deps
|
|
1797
|
+
/**
|
|
1798
|
+
* @internal
|
|
1799
|
+
*/
|
|
1800
|
+
this.deps = void 0;
|
|
1801
|
+
/**
|
|
1802
|
+
* @internal
|
|
1803
|
+
*/
|
|
1804
|
+
this.depsTail = void 0;
|
|
1805
|
+
/**
|
|
1806
|
+
* @internal
|
|
1807
|
+
*/
|
|
1808
|
+
this.flags = 16;
|
|
1809
|
+
/**
|
|
1810
|
+
* @internal
|
|
1811
|
+
*/
|
|
1812
|
+
this.globalVersion = globalVersion - 1;
|
|
1813
|
+
// for backwards compat
|
|
1814
|
+
this.effect = this;
|
|
1815
|
+
this.__v_isReadonly = !setter;
|
|
1816
|
+
this.isSSR = isSSR;
|
|
1817
|
+
}
|
|
1818
|
+
/**
|
|
1819
|
+
* @internal
|
|
1820
|
+
*/
|
|
1821
|
+
notify() {
|
|
1822
|
+
if (activeSub !== this) {
|
|
1823
|
+
this.flags |= 16;
|
|
1824
|
+
this.dep.notify();
|
|
1825
|
+
}
|
|
1826
|
+
}
|
|
1827
|
+
get value() {
|
|
1828
|
+
const link = this.dep.track({
|
|
1829
|
+
target: this,
|
|
1830
|
+
type: "get",
|
|
1831
|
+
key: "value"
|
|
1832
|
+
}) ;
|
|
1833
|
+
refreshComputed(this);
|
|
1834
|
+
if (link) {
|
|
1835
|
+
link.version = this.dep.version;
|
|
1836
|
+
}
|
|
1837
|
+
return this._value;
|
|
1838
|
+
}
|
|
1839
|
+
set value(newValue) {
|
|
1840
|
+
if (this.setter) {
|
|
1841
|
+
this.setter(newValue);
|
|
1842
|
+
} else {
|
|
1843
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1848
|
+
let getter;
|
|
1849
|
+
let setter;
|
|
1850
|
+
if (isFunction(getterOrOptions)) {
|
|
1851
|
+
getter = getterOrOptions;
|
|
1852
|
+
} else {
|
|
1853
|
+
getter = getterOrOptions.get;
|
|
1854
|
+
setter = getterOrOptions.set;
|
|
1855
|
+
}
|
|
1856
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1857
|
+
if (debugOptions && !isSSR) {
|
|
1858
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1859
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1860
|
+
}
|
|
1861
|
+
return cRef;
|
|
1862
|
+
}
|
|
1863
|
+
|
|
1510
1864
|
const TrackOpTypes = {
|
|
1511
1865
|
"GET": "get",
|
|
1512
1866
|
"HAS": "has",
|
|
@@ -1799,7 +2153,7 @@ getter: `, this.getter);
|
|
|
1799
2153
|
const middle = start + end >>> 1;
|
|
1800
2154
|
const middleJob = queue[middle];
|
|
1801
2155
|
const middleJobId = getId(middleJob);
|
|
1802
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2156
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1803
2157
|
start = middle + 1;
|
|
1804
2158
|
} else {
|
|
1805
2159
|
end = middle;
|
|
@@ -1808,15 +2162,21 @@ getter: `, this.getter);
|
|
|
1808
2162
|
return start;
|
|
1809
2163
|
}
|
|
1810
2164
|
function queueJob(job) {
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1814
|
-
)) {
|
|
2165
|
+
var _a;
|
|
2166
|
+
if (!(job.flags & 1)) {
|
|
1815
2167
|
if (job.id == null) {
|
|
1816
2168
|
queue.push(job);
|
|
2169
|
+
} else if (
|
|
2170
|
+
// fast path when the job id is larger than the tail
|
|
2171
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2172
|
+
) {
|
|
2173
|
+
queue.push(job);
|
|
1817
2174
|
} else {
|
|
1818
2175
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1819
2176
|
}
|
|
2177
|
+
if (!(job.flags & 4)) {
|
|
2178
|
+
job.flags |= 1;
|
|
2179
|
+
}
|
|
1820
2180
|
queueFlush();
|
|
1821
2181
|
}
|
|
1822
2182
|
}
|
|
@@ -1834,11 +2194,11 @@ getter: `, this.getter);
|
|
|
1834
2194
|
}
|
|
1835
2195
|
function queuePostFlushCb(cb) {
|
|
1836
2196
|
if (!isArray(cb)) {
|
|
1837
|
-
if (!
|
|
1838
|
-
cb,
|
|
1839
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1840
|
-
)) {
|
|
2197
|
+
if (!(cb.flags & 1)) {
|
|
1841
2198
|
pendingPostFlushCbs.push(cb);
|
|
2199
|
+
if (!(cb.flags & 4)) {
|
|
2200
|
+
cb.flags |= 1;
|
|
2201
|
+
}
|
|
1842
2202
|
}
|
|
1843
2203
|
} else {
|
|
1844
2204
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1851,7 +2211,7 @@ getter: `, this.getter);
|
|
|
1851
2211
|
}
|
|
1852
2212
|
for (; i < queue.length; i++) {
|
|
1853
2213
|
const cb = queue[i];
|
|
1854
|
-
if (cb && cb.
|
|
2214
|
+
if (cb && cb.flags & 2) {
|
|
1855
2215
|
if (instance && cb.id !== instance.uid) {
|
|
1856
2216
|
continue;
|
|
1857
2217
|
}
|
|
@@ -1861,6 +2221,7 @@ getter: `, this.getter);
|
|
|
1861
2221
|
queue.splice(i, 1);
|
|
1862
2222
|
i--;
|
|
1863
2223
|
cb();
|
|
2224
|
+
cb.flags &= ~1;
|
|
1864
2225
|
}
|
|
1865
2226
|
}
|
|
1866
2227
|
}
|
|
@@ -1883,6 +2244,7 @@ getter: `, this.getter);
|
|
|
1883
2244
|
continue;
|
|
1884
2245
|
}
|
|
1885
2246
|
activePostFlushCbs[postFlushIndex]();
|
|
2247
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1886
2248
|
}
|
|
1887
2249
|
activePostFlushCbs = null;
|
|
1888
2250
|
postFlushIndex = 0;
|
|
@@ -1892,9 +2254,11 @@ getter: `, this.getter);
|
|
|
1892
2254
|
const comparator = (a, b) => {
|
|
1893
2255
|
const diff = getId(a) - getId(b);
|
|
1894
2256
|
if (diff === 0) {
|
|
1895
|
-
|
|
2257
|
+
const isAPre = a.flags & 2;
|
|
2258
|
+
const isBPre = b.flags & 2;
|
|
2259
|
+
if (isAPre && !isBPre)
|
|
1896
2260
|
return -1;
|
|
1897
|
-
if (
|
|
2261
|
+
if (isBPre && !isAPre)
|
|
1898
2262
|
return 1;
|
|
1899
2263
|
}
|
|
1900
2264
|
return diff;
|
|
@@ -1910,11 +2274,12 @@ getter: `, this.getter);
|
|
|
1910
2274
|
try {
|
|
1911
2275
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1912
2276
|
const job = queue[flushIndex];
|
|
1913
|
-
if (job && job.
|
|
2277
|
+
if (job && !(job.flags & 8)) {
|
|
1914
2278
|
if (check(job)) {
|
|
1915
2279
|
continue;
|
|
1916
2280
|
}
|
|
1917
2281
|
callWithErrorHandling(job, null, 14);
|
|
2282
|
+
job.flags &= ~1;
|
|
1918
2283
|
}
|
|
1919
2284
|
}
|
|
1920
2285
|
} finally {
|
|
@@ -1996,7 +2361,6 @@ getter: `, this.getter);
|
|
|
1996
2361
|
}
|
|
1997
2362
|
instance.renderCache = [];
|
|
1998
2363
|
isHmrUpdating = true;
|
|
1999
|
-
instance.effect.dirty = true;
|
|
2000
2364
|
instance.update();
|
|
2001
2365
|
isHmrUpdating = false;
|
|
2002
2366
|
});
|
|
@@ -2024,7 +2388,6 @@ getter: `, this.getter);
|
|
|
2024
2388
|
instance.ceReload(newComp.styles);
|
|
2025
2389
|
hmrDirtyComponents.delete(oldComp);
|
|
2026
2390
|
} else if (instance.parent) {
|
|
2027
|
-
instance.parent.effect.dirty = true;
|
|
2028
2391
|
queueJob(instance.parent.update);
|
|
2029
2392
|
} else if (instance.appContext.reload) {
|
|
2030
2393
|
instance.appContext.reload();
|
|
@@ -3424,8 +3787,8 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3424
3787
|
};
|
|
3425
3788
|
};
|
|
3426
3789
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3427
|
-
const job = () => {
|
|
3428
|
-
if (!effect.
|
|
3790
|
+
const job = (immediateFirstRun) => {
|
|
3791
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
3429
3792
|
return;
|
|
3430
3793
|
}
|
|
3431
3794
|
if (cb) {
|
|
@@ -3446,19 +3809,22 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3446
3809
|
effect.run();
|
|
3447
3810
|
}
|
|
3448
3811
|
};
|
|
3449
|
-
|
|
3812
|
+
if (cb)
|
|
3813
|
+
job.flags |= 4;
|
|
3814
|
+
const effect = new ReactiveEffect(getter);
|
|
3450
3815
|
let scheduler;
|
|
3451
3816
|
if (flush === "sync") {
|
|
3817
|
+
effect.flags |= 64;
|
|
3452
3818
|
scheduler = job;
|
|
3453
3819
|
} else if (flush === "post") {
|
|
3454
3820
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
3455
3821
|
} else {
|
|
3456
|
-
job.
|
|
3822
|
+
job.flags |= 2;
|
|
3457
3823
|
if (instance)
|
|
3458
3824
|
job.id = instance.uid;
|
|
3459
3825
|
scheduler = () => queueJob(job);
|
|
3460
3826
|
}
|
|
3461
|
-
|
|
3827
|
+
effect.scheduler = scheduler;
|
|
3462
3828
|
const scope = getCurrentScope();
|
|
3463
3829
|
const unwatch = () => {
|
|
3464
3830
|
effect.stop();
|
|
@@ -3472,7 +3838,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3472
3838
|
}
|
|
3473
3839
|
if (cb) {
|
|
3474
3840
|
if (immediate) {
|
|
3475
|
-
job();
|
|
3841
|
+
job(true);
|
|
3476
3842
|
} else {
|
|
3477
3843
|
oldValue = effect.run();
|
|
3478
3844
|
}
|
|
@@ -3651,22 +4017,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3651
4017
|
if (!children || !children.length) {
|
|
3652
4018
|
return;
|
|
3653
4019
|
}
|
|
3654
|
-
|
|
3655
|
-
if (children.length > 1) {
|
|
3656
|
-
let hasFound = false;
|
|
3657
|
-
for (const c of children) {
|
|
3658
|
-
if (c.type !== Comment) {
|
|
3659
|
-
if (hasFound) {
|
|
3660
|
-
warn$1(
|
|
3661
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
3662
|
-
);
|
|
3663
|
-
break;
|
|
3664
|
-
}
|
|
3665
|
-
child = c;
|
|
3666
|
-
hasFound = true;
|
|
3667
|
-
}
|
|
3668
|
-
}
|
|
3669
|
-
}
|
|
4020
|
+
const child = findNonCommentChild(children);
|
|
3670
4021
|
const rawProps = toRaw(props);
|
|
3671
4022
|
const { mode } = rawProps;
|
|
3672
4023
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -3675,7 +4026,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3675
4026
|
if (state.isLeaving) {
|
|
3676
4027
|
return emptyPlaceholder(child);
|
|
3677
4028
|
}
|
|
3678
|
-
const innerChild =
|
|
4029
|
+
const innerChild = getInnerChild$1(child);
|
|
3679
4030
|
if (!innerChild) {
|
|
3680
4031
|
return emptyPlaceholder(child);
|
|
3681
4032
|
}
|
|
@@ -3687,7 +4038,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3687
4038
|
);
|
|
3688
4039
|
setTransitionHooks(innerChild, enterHooks);
|
|
3689
4040
|
const oldChild = instance.subTree;
|
|
3690
|
-
const oldInnerChild = oldChild &&
|
|
4041
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
3691
4042
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
3692
4043
|
const leavingHooks = resolveTransitionHooks(
|
|
3693
4044
|
oldInnerChild,
|
|
@@ -3700,8 +4051,7 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3700
4051
|
state.isLeaving = true;
|
|
3701
4052
|
leavingHooks.afterLeave = () => {
|
|
3702
4053
|
state.isLeaving = false;
|
|
3703
|
-
if (instance.
|
|
3704
|
-
instance.effect.dirty = true;
|
|
4054
|
+
if (!(instance.job.flags & 8)) {
|
|
3705
4055
|
instance.update();
|
|
3706
4056
|
}
|
|
3707
4057
|
};
|
|
@@ -3726,6 +4076,25 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3726
4076
|
};
|
|
3727
4077
|
}
|
|
3728
4078
|
};
|
|
4079
|
+
function findNonCommentChild(children) {
|
|
4080
|
+
let child = children[0];
|
|
4081
|
+
if (children.length > 1) {
|
|
4082
|
+
let hasFound = false;
|
|
4083
|
+
for (const c of children) {
|
|
4084
|
+
if (c.type !== Comment) {
|
|
4085
|
+
if (hasFound) {
|
|
4086
|
+
warn$1(
|
|
4087
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4088
|
+
);
|
|
4089
|
+
break;
|
|
4090
|
+
}
|
|
4091
|
+
child = c;
|
|
4092
|
+
hasFound = true;
|
|
4093
|
+
}
|
|
4094
|
+
}
|
|
4095
|
+
}
|
|
4096
|
+
return child;
|
|
4097
|
+
}
|
|
3729
4098
|
const BaseTransition = BaseTransitionImpl;
|
|
3730
4099
|
function getLeavingNodesForType(state, vnode) {
|
|
3731
4100
|
const { leavingVNodes } = state;
|
|
@@ -3880,8 +4249,11 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
3880
4249
|
return vnode;
|
|
3881
4250
|
}
|
|
3882
4251
|
}
|
|
3883
|
-
function
|
|
4252
|
+
function getInnerChild$1(vnode) {
|
|
3884
4253
|
if (!isKeepAlive(vnode)) {
|
|
4254
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4255
|
+
return findNonCommentChild(vnode.children);
|
|
4256
|
+
}
|
|
3885
4257
|
return vnode;
|
|
3886
4258
|
}
|
|
3887
4259
|
if (vnode.component) {
|
|
@@ -4050,7 +4422,6 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4050
4422
|
load().then(() => {
|
|
4051
4423
|
loaded.value = true;
|
|
4052
4424
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4053
|
-
instance.parent.effect.dirty = true;
|
|
4054
4425
|
queueJob(instance.parent.update);
|
|
4055
4426
|
}
|
|
4056
4427
|
}).catch((err) => {
|
|
@@ -4375,10 +4746,20 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4375
4746
|
function renderList(source, renderItem, cache, index) {
|
|
4376
4747
|
let ret;
|
|
4377
4748
|
const cached = cache && cache[index];
|
|
4378
|
-
|
|
4749
|
+
const sourceIsArray = isArray(source);
|
|
4750
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
4751
|
+
if (sourceIsArray || isString(source)) {
|
|
4752
|
+
if (sourceIsReactiveArray) {
|
|
4753
|
+
source = shallowReadArray(source);
|
|
4754
|
+
}
|
|
4379
4755
|
ret = new Array(source.length);
|
|
4380
4756
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
4381
|
-
ret[i] = renderItem(
|
|
4757
|
+
ret[i] = renderItem(
|
|
4758
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
4759
|
+
i,
|
|
4760
|
+
void 0,
|
|
4761
|
+
cached && cached[i]
|
|
4762
|
+
);
|
|
4382
4763
|
}
|
|
4383
4764
|
} else if (typeof source === "number") {
|
|
4384
4765
|
if (!Number.isInteger(source)) {
|
|
@@ -4513,7 +4894,6 @@ If this is a native custom element, make sure to exclude it from component resol
|
|
|
4513
4894
|
$emit: (i) => i.emit,
|
|
4514
4895
|
$options: (i) => resolveMergedOptions(i) ,
|
|
4515
4896
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
4516
|
-
i.effect.dirty = true;
|
|
4517
4897
|
queueJob(i.update);
|
|
4518
4898
|
}),
|
|
4519
4899
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -5846,7 +6226,9 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
5846
6226
|
function assertType(value, type) {
|
|
5847
6227
|
let valid;
|
|
5848
6228
|
const expectedType = getType(type);
|
|
5849
|
-
if (
|
|
6229
|
+
if (expectedType === "null") {
|
|
6230
|
+
valid = value === null;
|
|
6231
|
+
} else if (isSimpleType(expectedType)) {
|
|
5850
6232
|
const t = typeof value;
|
|
5851
6233
|
valid = t === expectedType.toLowerCase();
|
|
5852
6234
|
if (!valid && t === "object") {
|
|
@@ -5856,8 +6238,6 @@ If you want to remount the same app, move your app creation logic into a factory
|
|
|
5856
6238
|
valid = isObject(value);
|
|
5857
6239
|
} else if (expectedType === "Array") {
|
|
5858
6240
|
valid = isArray(value);
|
|
5859
|
-
} else if (expectedType === "null") {
|
|
5860
|
-
valid = value === null;
|
|
5861
6241
|
} else {
|
|
5862
6242
|
valid = value instanceof type;
|
|
5863
6243
|
}
|
|
@@ -7381,7 +7761,6 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
7381
7761
|
} else {
|
|
7382
7762
|
instance.next = n2;
|
|
7383
7763
|
invalidateJob(instance.update);
|
|
7384
|
-
instance.effect.dirty = true;
|
|
7385
7764
|
instance.update();
|
|
7386
7765
|
}
|
|
7387
7766
|
} else {
|
|
@@ -7564,24 +7943,18 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
7564
7943
|
}
|
|
7565
7944
|
}
|
|
7566
7945
|
};
|
|
7567
|
-
|
|
7568
|
-
|
|
7569
|
-
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
);
|
|
7574
|
-
const update = instance.update = () => {
|
|
7575
|
-
if (effect.dirty) {
|
|
7576
|
-
effect.run();
|
|
7577
|
-
}
|
|
7578
|
-
};
|
|
7579
|
-
update.id = instance.uid;
|
|
7946
|
+
instance.scope.on();
|
|
7947
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
7948
|
+
instance.scope.off();
|
|
7949
|
+
const update = instance.update = effect.run.bind(effect);
|
|
7950
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
7951
|
+
job.id = instance.uid;
|
|
7952
|
+
effect.scheduler = () => queueJob(job);
|
|
7580
7953
|
toggleRecurse(instance, true);
|
|
7581
7954
|
{
|
|
7582
7955
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7583
7956
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7584
|
-
|
|
7957
|
+
job.ownerInstance = instance;
|
|
7585
7958
|
}
|
|
7586
7959
|
update();
|
|
7587
7960
|
};
|
|
@@ -8048,13 +8421,13 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
8048
8421
|
if (instance.type.__hmrId) {
|
|
8049
8422
|
unregisterHMR(instance);
|
|
8050
8423
|
}
|
|
8051
|
-
const { bum, scope,
|
|
8424
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
8052
8425
|
if (bum) {
|
|
8053
8426
|
invokeArrayFns(bum);
|
|
8054
8427
|
}
|
|
8055
8428
|
scope.stop();
|
|
8056
|
-
if (
|
|
8057
|
-
|
|
8429
|
+
if (job) {
|
|
8430
|
+
job.flags |= 8;
|
|
8058
8431
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
8059
8432
|
}
|
|
8060
8433
|
if (um) {
|
|
@@ -8140,8 +8513,14 @@ Server rendered element contains fewer child nodes than client vdom.`
|
|
|
8140
8513
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
8141
8514
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
8142
8515
|
}
|
|
8143
|
-
function toggleRecurse({ effect,
|
|
8144
|
-
|
|
8516
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
8517
|
+
if (allowed) {
|
|
8518
|
+
effect.flags |= 32;
|
|
8519
|
+
job.flags |= 4;
|
|
8520
|
+
} else {
|
|
8521
|
+
effect.flags &= ~32;
|
|
8522
|
+
job.flags &= ~4;
|
|
8523
|
+
}
|
|
8145
8524
|
}
|
|
8146
8525
|
function needTransition(parentSuspense, transition) {
|
|
8147
8526
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -8878,6 +9257,7 @@ Component that was made reactive: `,
|
|
|
8878
9257
|
effect: null,
|
|
8879
9258
|
update: null,
|
|
8880
9259
|
// will be set synchronously right after creation
|
|
9260
|
+
job: null,
|
|
8881
9261
|
scope: new EffectScope(
|
|
8882
9262
|
true
|
|
8883
9263
|
/* detached */
|
|
@@ -9371,7 +9751,8 @@ Component that was made reactive: `,
|
|
|
9371
9751
|
{},
|
|
9372
9752
|
["span", vueStyle, genRefFlag(obj)],
|
|
9373
9753
|
"<",
|
|
9374
|
-
|
|
9754
|
+
// avoid debugger accessing value affecting behavior
|
|
9755
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
9375
9756
|
`>`
|
|
9376
9757
|
];
|
|
9377
9758
|
} else if (isReactive(obj)) {
|
|
@@ -9551,7 +9932,7 @@ Component that was made reactive: `,
|
|
|
9551
9932
|
return true;
|
|
9552
9933
|
}
|
|
9553
9934
|
|
|
9554
|
-
const version = "3.
|
|
9935
|
+
const version = "3.5.0-alpha.1";
|
|
9555
9936
|
const warn = warn$1 ;
|
|
9556
9937
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
9557
9938
|
const devtools = devtools$1 ;
|
|
@@ -10994,7 +11375,9 @@ Expected function or array of functions, received type ${typeof value}.`
|
|
|
10994
11375
|
return;
|
|
10995
11376
|
}
|
|
10996
11377
|
const eventKey = hyphenate(event.key);
|
|
10997
|
-
if (modifiers.some(
|
|
11378
|
+
if (modifiers.some(
|
|
11379
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
11380
|
+
)) {
|
|
10998
11381
|
return fn(event);
|
|
10999
11382
|
}
|
|
11000
11383
|
});
|