@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
|
**/
|
|
@@ -384,157 +384,280 @@ class EffectScope {
|
|
|
384
384
|
function effectScope(detached) {
|
|
385
385
|
return new EffectScope(detached);
|
|
386
386
|
}
|
|
387
|
-
function recordEffectScope(effect, scope = activeEffectScope) {
|
|
388
|
-
if (scope && scope.active) {
|
|
389
|
-
scope.effects.push(effect);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
387
|
function getCurrentScope() {
|
|
393
388
|
return activeEffectScope;
|
|
394
389
|
}
|
|
395
|
-
function onScopeDispose(fn) {
|
|
390
|
+
function onScopeDispose(fn, failSilently = false) {
|
|
396
391
|
if (activeEffectScope) {
|
|
397
392
|
activeEffectScope.cleanups.push(fn);
|
|
398
|
-
} else {
|
|
393
|
+
} else if (!failSilently) {
|
|
399
394
|
warn$2(
|
|
400
395
|
`onScopeDispose() is called when there is no active effect scope to be associated with.`
|
|
401
396
|
);
|
|
402
397
|
}
|
|
403
398
|
}
|
|
404
399
|
|
|
405
|
-
let
|
|
400
|
+
let activeSub;
|
|
406
401
|
class ReactiveEffect {
|
|
407
|
-
constructor(fn
|
|
402
|
+
constructor(fn) {
|
|
408
403
|
this.fn = fn;
|
|
409
|
-
this.trigger = trigger;
|
|
410
|
-
this.scheduler = scheduler;
|
|
411
|
-
this.active = true;
|
|
412
|
-
this.deps = [];
|
|
413
404
|
/**
|
|
414
405
|
* @internal
|
|
415
406
|
*/
|
|
416
|
-
this.
|
|
407
|
+
this.deps = void 0;
|
|
417
408
|
/**
|
|
418
409
|
* @internal
|
|
419
410
|
*/
|
|
420
|
-
this.
|
|
411
|
+
this.depsTail = void 0;
|
|
421
412
|
/**
|
|
422
413
|
* @internal
|
|
423
414
|
*/
|
|
424
|
-
this.
|
|
415
|
+
this.flags = 1 | 4;
|
|
425
416
|
/**
|
|
426
417
|
* @internal
|
|
427
418
|
*/
|
|
428
|
-
this.
|
|
419
|
+
this.nextEffect = void 0;
|
|
429
420
|
/**
|
|
430
421
|
* @internal
|
|
431
422
|
*/
|
|
432
|
-
this.
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
if (this._dirtyLevel === 2 || this._dirtyLevel === 3) {
|
|
437
|
-
this._dirtyLevel = 1;
|
|
438
|
-
pauseTracking();
|
|
439
|
-
for (let i = 0; i < this._depsLength; i++) {
|
|
440
|
-
const dep = this.deps[i];
|
|
441
|
-
if (dep.computed) {
|
|
442
|
-
triggerComputed(dep.computed);
|
|
443
|
-
if (this._dirtyLevel >= 4) {
|
|
444
|
-
break;
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
if (this._dirtyLevel === 1) {
|
|
449
|
-
this._dirtyLevel = 0;
|
|
450
|
-
}
|
|
451
|
-
resetTracking();
|
|
423
|
+
this.cleanup = void 0;
|
|
424
|
+
this.scheduler = void 0;
|
|
425
|
+
if (activeEffectScope && activeEffectScope.active) {
|
|
426
|
+
activeEffectScope.effects.push(this);
|
|
452
427
|
}
|
|
453
|
-
return this._dirtyLevel >= 4;
|
|
454
428
|
}
|
|
455
|
-
|
|
456
|
-
|
|
429
|
+
/**
|
|
430
|
+
* @internal
|
|
431
|
+
*/
|
|
432
|
+
notify() {
|
|
433
|
+
if (this.flags & 2 && !(this.flags & 32)) {
|
|
434
|
+
return;
|
|
435
|
+
}
|
|
436
|
+
if (this.flags & 64) {
|
|
437
|
+
return this.trigger();
|
|
438
|
+
}
|
|
439
|
+
if (!(this.flags & 8)) {
|
|
440
|
+
this.flags |= 8;
|
|
441
|
+
this.nextEffect = batchedEffect;
|
|
442
|
+
batchedEffect = this;
|
|
443
|
+
}
|
|
457
444
|
}
|
|
458
445
|
run() {
|
|
459
|
-
this.
|
|
460
|
-
if (!this.active) {
|
|
446
|
+
if (!(this.flags & 1)) {
|
|
461
447
|
return this.fn();
|
|
462
448
|
}
|
|
463
|
-
|
|
464
|
-
|
|
449
|
+
this.flags |= 2;
|
|
450
|
+
cleanupEffect(this);
|
|
451
|
+
prepareDeps(this);
|
|
452
|
+
const prevEffect = activeSub;
|
|
453
|
+
const prevShouldTrack = shouldTrack;
|
|
454
|
+
activeSub = this;
|
|
455
|
+
shouldTrack = true;
|
|
465
456
|
try {
|
|
466
|
-
shouldTrack = true;
|
|
467
|
-
activeEffect = this;
|
|
468
|
-
this._runnings++;
|
|
469
|
-
preCleanupEffect(this);
|
|
470
457
|
return this.fn();
|
|
471
458
|
} finally {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
459
|
+
if (activeSub !== this) {
|
|
460
|
+
warn$2(
|
|
461
|
+
"Active effect was not restored correctly - this is likely a Vue internal bug."
|
|
462
|
+
);
|
|
463
|
+
}
|
|
464
|
+
cleanupDeps(this);
|
|
465
|
+
activeSub = prevEffect;
|
|
466
|
+
shouldTrack = prevShouldTrack;
|
|
467
|
+
this.flags &= ~2;
|
|
476
468
|
}
|
|
477
469
|
}
|
|
478
470
|
stop() {
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
this
|
|
471
|
+
if (this.flags & 1) {
|
|
472
|
+
for (let link = this.deps; link; link = link.nextDep) {
|
|
473
|
+
removeSub(link);
|
|
474
|
+
}
|
|
475
|
+
this.deps = this.depsTail = void 0;
|
|
476
|
+
cleanupEffect(this);
|
|
477
|
+
this.onStop && this.onStop();
|
|
478
|
+
this.flags &= ~1;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
trigger() {
|
|
482
|
+
if (this.scheduler) {
|
|
483
|
+
this.scheduler();
|
|
484
|
+
} else {
|
|
485
|
+
this.runIfDirty();
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
/**
|
|
489
|
+
* @internal
|
|
490
|
+
*/
|
|
491
|
+
runIfDirty() {
|
|
492
|
+
if (isDirty(this)) {
|
|
493
|
+
this.run();
|
|
485
494
|
}
|
|
486
495
|
}
|
|
496
|
+
get dirty() {
|
|
497
|
+
return isDirty(this);
|
|
498
|
+
}
|
|
487
499
|
}
|
|
488
|
-
|
|
489
|
-
|
|
500
|
+
let batchDepth = 0;
|
|
501
|
+
let batchedEffect;
|
|
502
|
+
function startBatch() {
|
|
503
|
+
batchDepth++;
|
|
490
504
|
}
|
|
491
|
-
function
|
|
492
|
-
|
|
493
|
-
|
|
505
|
+
function endBatch() {
|
|
506
|
+
if (batchDepth > 1) {
|
|
507
|
+
batchDepth--;
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
let error;
|
|
511
|
+
while (batchedEffect) {
|
|
512
|
+
let e = batchedEffect;
|
|
513
|
+
batchedEffect = void 0;
|
|
514
|
+
while (e) {
|
|
515
|
+
const next = e.nextEffect;
|
|
516
|
+
e.nextEffect = void 0;
|
|
517
|
+
e.flags &= ~8;
|
|
518
|
+
if (e.flags & 1) {
|
|
519
|
+
try {
|
|
520
|
+
e.trigger();
|
|
521
|
+
} catch (err) {
|
|
522
|
+
if (!error)
|
|
523
|
+
error = err;
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
e = next;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
batchDepth--;
|
|
530
|
+
if (error)
|
|
531
|
+
throw error;
|
|
532
|
+
}
|
|
533
|
+
function prepareDeps(sub) {
|
|
534
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
535
|
+
link.version = -1;
|
|
536
|
+
link.prevActiveLink = link.dep.activeLink;
|
|
537
|
+
link.dep.activeLink = link;
|
|
538
|
+
}
|
|
494
539
|
}
|
|
495
|
-
function
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
540
|
+
function cleanupDeps(sub) {
|
|
541
|
+
let head;
|
|
542
|
+
let tail = sub.depsTail;
|
|
543
|
+
for (let link = tail; link; link = link.prevDep) {
|
|
544
|
+
if (link.version === -1) {
|
|
545
|
+
if (link === tail)
|
|
546
|
+
tail = link.prevDep;
|
|
547
|
+
removeSub(link);
|
|
548
|
+
removeDep(link);
|
|
549
|
+
} else {
|
|
550
|
+
head = link;
|
|
499
551
|
}
|
|
500
|
-
|
|
552
|
+
link.dep.activeLink = link.prevActiveLink;
|
|
553
|
+
link.prevActiveLink = void 0;
|
|
501
554
|
}
|
|
555
|
+
sub.deps = head;
|
|
556
|
+
sub.depsTail = tail;
|
|
502
557
|
}
|
|
503
|
-
function
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
if (dep.size === 0) {
|
|
508
|
-
dep.cleanup();
|
|
558
|
+
function isDirty(sub) {
|
|
559
|
+
for (let link = sub.deps; link; link = link.nextDep) {
|
|
560
|
+
if (link.dep.version !== link.version || link.dep.computed && refreshComputed(link.dep.computed) === false || link.dep.version !== link.version) {
|
|
561
|
+
return true;
|
|
509
562
|
}
|
|
510
563
|
}
|
|
564
|
+
if (sub._dirty) {
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
return false;
|
|
568
|
+
}
|
|
569
|
+
function refreshComputed(computed) {
|
|
570
|
+
if (computed.flags & 2) {
|
|
571
|
+
return false;
|
|
572
|
+
}
|
|
573
|
+
if (computed.flags & 4 && !(computed.flags & 16)) {
|
|
574
|
+
return;
|
|
575
|
+
}
|
|
576
|
+
computed.flags &= ~16;
|
|
577
|
+
if (computed.globalVersion === globalVersion) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
computed.globalVersion = globalVersion;
|
|
581
|
+
const dep = computed.dep;
|
|
582
|
+
computed.flags |= 2;
|
|
583
|
+
if (dep.version > 0 && !computed.isSSR && !isDirty(computed)) {
|
|
584
|
+
computed.flags &= ~2;
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
const prevSub = activeSub;
|
|
588
|
+
const prevShouldTrack = shouldTrack;
|
|
589
|
+
activeSub = computed;
|
|
590
|
+
shouldTrack = true;
|
|
591
|
+
try {
|
|
592
|
+
prepareDeps(computed);
|
|
593
|
+
const value = computed.fn();
|
|
594
|
+
if (dep.version === 0 || hasChanged(value, computed._value)) {
|
|
595
|
+
computed._value = value;
|
|
596
|
+
dep.version++;
|
|
597
|
+
}
|
|
598
|
+
} catch (err) {
|
|
599
|
+
dep.version++;
|
|
600
|
+
throw err;
|
|
601
|
+
} finally {
|
|
602
|
+
activeSub = prevSub;
|
|
603
|
+
shouldTrack = prevShouldTrack;
|
|
604
|
+
cleanupDeps(computed);
|
|
605
|
+
computed.flags &= ~2;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
function removeSub(link) {
|
|
609
|
+
const { dep, prevSub, nextSub } = link;
|
|
610
|
+
if (prevSub) {
|
|
611
|
+
prevSub.nextSub = nextSub;
|
|
612
|
+
link.prevSub = void 0;
|
|
613
|
+
}
|
|
614
|
+
if (nextSub) {
|
|
615
|
+
nextSub.prevSub = prevSub;
|
|
616
|
+
link.nextSub = void 0;
|
|
617
|
+
}
|
|
618
|
+
if (dep.subs === link) {
|
|
619
|
+
dep.subs = prevSub;
|
|
620
|
+
}
|
|
621
|
+
if (!dep.subs && dep.computed) {
|
|
622
|
+
dep.computed.flags &= ~4;
|
|
623
|
+
for (let l = dep.computed.deps; l; l = l.nextDep) {
|
|
624
|
+
removeSub(l);
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
function removeDep(link) {
|
|
629
|
+
const { prevDep, nextDep } = link;
|
|
630
|
+
if (prevDep) {
|
|
631
|
+
prevDep.nextDep = nextDep;
|
|
632
|
+
link.prevDep = void 0;
|
|
633
|
+
}
|
|
634
|
+
if (nextDep) {
|
|
635
|
+
nextDep.prevDep = prevDep;
|
|
636
|
+
link.nextDep = void 0;
|
|
637
|
+
}
|
|
511
638
|
}
|
|
512
639
|
function effect(fn, options) {
|
|
513
640
|
if (fn.effect instanceof ReactiveEffect) {
|
|
514
641
|
fn = fn.effect.fn;
|
|
515
642
|
}
|
|
516
|
-
const
|
|
517
|
-
if (_effect.dirty) {
|
|
518
|
-
_effect.run();
|
|
519
|
-
}
|
|
520
|
-
});
|
|
643
|
+
const e = new ReactiveEffect(fn);
|
|
521
644
|
if (options) {
|
|
522
|
-
extend(
|
|
523
|
-
if (options.scope)
|
|
524
|
-
recordEffectScope(_effect, options.scope);
|
|
645
|
+
extend(e, options);
|
|
525
646
|
}
|
|
526
|
-
|
|
527
|
-
|
|
647
|
+
try {
|
|
648
|
+
e.run();
|
|
649
|
+
} catch (err) {
|
|
650
|
+
e.stop();
|
|
651
|
+
throw err;
|
|
528
652
|
}
|
|
529
|
-
const runner =
|
|
530
|
-
runner.effect =
|
|
653
|
+
const runner = e.run.bind(e);
|
|
654
|
+
runner.effect = e;
|
|
531
655
|
return runner;
|
|
532
656
|
}
|
|
533
657
|
function stop(runner) {
|
|
534
658
|
runner.effect.stop();
|
|
535
659
|
}
|
|
536
660
|
let shouldTrack = true;
|
|
537
|
-
let pauseScheduleStack = 0;
|
|
538
661
|
const trackStack = [];
|
|
539
662
|
function pauseTracking() {
|
|
540
663
|
trackStack.push(shouldTrack);
|
|
@@ -544,192 +667,414 @@ function resetTracking() {
|
|
|
544
667
|
const last = trackStack.pop();
|
|
545
668
|
shouldTrack = last === void 0 ? true : last;
|
|
546
669
|
}
|
|
547
|
-
function
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
670
|
+
function cleanupEffect(e) {
|
|
671
|
+
const { cleanup } = e;
|
|
672
|
+
e.cleanup = void 0;
|
|
673
|
+
if (cleanup) {
|
|
674
|
+
const prevSub = activeSub;
|
|
675
|
+
activeSub = void 0;
|
|
676
|
+
try {
|
|
677
|
+
cleanup();
|
|
678
|
+
} finally {
|
|
679
|
+
activeSub = prevSub;
|
|
680
|
+
}
|
|
554
681
|
}
|
|
555
682
|
}
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
683
|
+
|
|
684
|
+
let globalVersion = 0;
|
|
685
|
+
class Dep {
|
|
686
|
+
constructor(computed) {
|
|
687
|
+
this.computed = computed;
|
|
688
|
+
this.version = 0;
|
|
689
|
+
/**
|
|
690
|
+
* Link between this dep and the current active effect
|
|
691
|
+
*/
|
|
692
|
+
this.activeLink = void 0;
|
|
693
|
+
/**
|
|
694
|
+
* Doubly linked list representing the subscribing effects (tail)
|
|
695
|
+
*/
|
|
696
|
+
this.subs = void 0;
|
|
569
697
|
{
|
|
570
|
-
|
|
698
|
+
this.subsHead = void 0;
|
|
571
699
|
}
|
|
572
700
|
}
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
701
|
+
track(debugInfo) {
|
|
702
|
+
if (!activeSub || !shouldTrack) {
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
let link = this.activeLink;
|
|
706
|
+
if (link === void 0 || link.sub !== activeSub) {
|
|
707
|
+
link = this.activeLink = {
|
|
708
|
+
dep: this,
|
|
709
|
+
sub: activeSub,
|
|
710
|
+
version: this.version,
|
|
711
|
+
nextDep: void 0,
|
|
712
|
+
prevDep: void 0,
|
|
713
|
+
nextSub: void 0,
|
|
714
|
+
prevSub: void 0,
|
|
715
|
+
prevActiveLink: void 0
|
|
716
|
+
};
|
|
717
|
+
if (!activeSub.deps) {
|
|
718
|
+
activeSub.deps = activeSub.depsTail = link;
|
|
719
|
+
} else {
|
|
720
|
+
link.prevDep = activeSub.depsTail;
|
|
721
|
+
activeSub.depsTail.nextDep = link;
|
|
722
|
+
activeSub.depsTail = link;
|
|
723
|
+
}
|
|
724
|
+
if (activeSub.flags & 4) {
|
|
725
|
+
addSub(link);
|
|
587
726
|
}
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
727
|
+
} else if (link.version === -1) {
|
|
728
|
+
link.version = this.version;
|
|
729
|
+
if (link.nextDep) {
|
|
730
|
+
const next = link.nextDep;
|
|
731
|
+
next.prevDep = link.prevDep;
|
|
732
|
+
if (link.prevDep) {
|
|
733
|
+
link.prevDep.nextDep = next;
|
|
734
|
+
}
|
|
735
|
+
link.prevDep = activeSub.depsTail;
|
|
736
|
+
link.nextDep = void 0;
|
|
737
|
+
activeSub.depsTail.nextDep = link;
|
|
738
|
+
activeSub.depsTail = link;
|
|
739
|
+
if (activeSub.deps === link) {
|
|
740
|
+
activeSub.deps = next;
|
|
593
741
|
}
|
|
594
742
|
}
|
|
595
743
|
}
|
|
744
|
+
if (activeSub.onTrack) {
|
|
745
|
+
activeSub.onTrack(
|
|
746
|
+
extend(
|
|
747
|
+
{
|
|
748
|
+
effect: activeSub
|
|
749
|
+
},
|
|
750
|
+
debugInfo
|
|
751
|
+
)
|
|
752
|
+
);
|
|
753
|
+
}
|
|
754
|
+
return link;
|
|
755
|
+
}
|
|
756
|
+
trigger(debugInfo) {
|
|
757
|
+
this.version++;
|
|
758
|
+
globalVersion++;
|
|
759
|
+
this.notify(debugInfo);
|
|
760
|
+
}
|
|
761
|
+
notify(debugInfo) {
|
|
762
|
+
startBatch();
|
|
763
|
+
try {
|
|
764
|
+
if (true) {
|
|
765
|
+
for (let head = this.subsHead; head; head = head.nextSub) {
|
|
766
|
+
if (head.sub.onTrigger && !(head.sub.flags & 8)) {
|
|
767
|
+
head.sub.onTrigger(
|
|
768
|
+
extend(
|
|
769
|
+
{
|
|
770
|
+
effect: head.sub
|
|
771
|
+
},
|
|
772
|
+
debugInfo
|
|
773
|
+
)
|
|
774
|
+
);
|
|
775
|
+
}
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
for (let link = this.subs; link; link = link.prevSub) {
|
|
779
|
+
link.sub.notify();
|
|
780
|
+
}
|
|
781
|
+
} finally {
|
|
782
|
+
endBatch();
|
|
783
|
+
}
|
|
596
784
|
}
|
|
597
|
-
resetScheduling();
|
|
598
785
|
}
|
|
599
|
-
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
}
|
|
606
|
-
|
|
786
|
+
function addSub(link) {
|
|
787
|
+
const computed = link.dep.computed;
|
|
788
|
+
if (computed && !link.dep.subs) {
|
|
789
|
+
computed.flags |= 4 | 16;
|
|
790
|
+
for (let l = computed.deps; l; l = l.nextDep) {
|
|
791
|
+
addSub(l);
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
const currentTail = link.dep.subs;
|
|
795
|
+
if (currentTail !== link) {
|
|
796
|
+
link.prevSub = currentTail;
|
|
797
|
+
if (currentTail)
|
|
798
|
+
currentTail.nextSub = link;
|
|
799
|
+
}
|
|
800
|
+
if (link.dep.subsHead === void 0) {
|
|
801
|
+
link.dep.subsHead = link;
|
|
802
|
+
}
|
|
803
|
+
link.dep.subs = link;
|
|
804
|
+
}
|
|
607
805
|
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
608
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
609
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map
|
|
806
|
+
const ITERATE_KEY = Symbol("Object iterate" );
|
|
807
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map keys iterate" );
|
|
808
|
+
const ARRAY_ITERATE_KEY = Symbol("Array iterate" );
|
|
610
809
|
function track(target, type, key) {
|
|
611
|
-
if (shouldTrack &&
|
|
810
|
+
if (shouldTrack && activeSub) {
|
|
612
811
|
let depsMap = targetMap.get(target);
|
|
613
812
|
if (!depsMap) {
|
|
614
813
|
targetMap.set(target, depsMap = /* @__PURE__ */ new Map());
|
|
615
814
|
}
|
|
616
815
|
let dep = depsMap.get(key);
|
|
617
816
|
if (!dep) {
|
|
618
|
-
depsMap.set(key, dep =
|
|
817
|
+
depsMap.set(key, dep = new Dep());
|
|
619
818
|
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
dep,
|
|
623
|
-
{
|
|
819
|
+
{
|
|
820
|
+
dep.track({
|
|
624
821
|
target,
|
|
625
822
|
type,
|
|
626
823
|
key
|
|
627
|
-
}
|
|
628
|
-
|
|
824
|
+
});
|
|
825
|
+
}
|
|
629
826
|
}
|
|
630
827
|
}
|
|
631
828
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
632
829
|
const depsMap = targetMap.get(target);
|
|
633
830
|
if (!depsMap) {
|
|
831
|
+
globalVersion++;
|
|
634
832
|
return;
|
|
635
833
|
}
|
|
636
834
|
let deps = [];
|
|
637
835
|
if (type === "clear") {
|
|
638
836
|
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
837
|
} 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"));
|
|
838
|
+
const targetIsArray = isArray(target);
|
|
839
|
+
const isArrayIndex = targetIsArray && isIntegerKey(key);
|
|
840
|
+
if (targetIsArray && key === "length") {
|
|
841
|
+
const newLength = Number(newValue);
|
|
842
|
+
depsMap.forEach((dep, key2) => {
|
|
843
|
+
if (key2 === "length" || key2 === ARRAY_ITERATE_KEY || !isSymbol(key2) && key2 >= newLength) {
|
|
844
|
+
deps.push(dep);
|
|
659
845
|
}
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
846
|
+
});
|
|
847
|
+
} else {
|
|
848
|
+
const push = (dep) => dep && deps.push(dep);
|
|
849
|
+
if (key !== void 0) {
|
|
850
|
+
push(depsMap.get(key));
|
|
851
|
+
}
|
|
852
|
+
if (isArrayIndex) {
|
|
853
|
+
push(depsMap.get(ARRAY_ITERATE_KEY));
|
|
854
|
+
}
|
|
855
|
+
switch (type) {
|
|
856
|
+
case "add":
|
|
857
|
+
if (!targetIsArray) {
|
|
858
|
+
push(depsMap.get(ITERATE_KEY));
|
|
859
|
+
if (isMap(target)) {
|
|
860
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
861
|
+
}
|
|
862
|
+
} else if (isArrayIndex) {
|
|
863
|
+
push(depsMap.get("length"));
|
|
864
|
+
}
|
|
865
|
+
break;
|
|
866
|
+
case "delete":
|
|
867
|
+
if (!targetIsArray) {
|
|
868
|
+
push(depsMap.get(ITERATE_KEY));
|
|
869
|
+
if (isMap(target)) {
|
|
870
|
+
push(depsMap.get(MAP_KEY_ITERATE_KEY));
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
break;
|
|
874
|
+
case "set":
|
|
664
875
|
if (isMap(target)) {
|
|
665
|
-
|
|
876
|
+
push(depsMap.get(ITERATE_KEY));
|
|
666
877
|
}
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
case "set":
|
|
670
|
-
if (isMap(target)) {
|
|
671
|
-
deps.push(depsMap.get(ITERATE_KEY));
|
|
672
|
-
}
|
|
673
|
-
break;
|
|
878
|
+
break;
|
|
879
|
+
}
|
|
674
880
|
}
|
|
675
881
|
}
|
|
676
|
-
|
|
882
|
+
startBatch();
|
|
677
883
|
for (const dep of deps) {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
oldValue,
|
|
688
|
-
oldTarget
|
|
689
|
-
}
|
|
690
|
-
);
|
|
884
|
+
{
|
|
885
|
+
dep.trigger({
|
|
886
|
+
target,
|
|
887
|
+
type,
|
|
888
|
+
key,
|
|
889
|
+
newValue,
|
|
890
|
+
oldValue,
|
|
891
|
+
oldTarget
|
|
892
|
+
});
|
|
691
893
|
}
|
|
692
894
|
}
|
|
693
|
-
|
|
895
|
+
endBatch();
|
|
694
896
|
}
|
|
695
897
|
function getDepFromReactive(object, key) {
|
|
696
898
|
var _a;
|
|
697
899
|
return (_a = targetMap.get(object)) == null ? void 0 : _a.get(key);
|
|
698
900
|
}
|
|
699
901
|
|
|
902
|
+
function reactiveReadArray(array) {
|
|
903
|
+
const raw = toRaw(array);
|
|
904
|
+
if (raw === array)
|
|
905
|
+
return raw;
|
|
906
|
+
track(raw, "iterate", ARRAY_ITERATE_KEY);
|
|
907
|
+
return isShallow(array) ? raw : raw.map(toReactive);
|
|
908
|
+
}
|
|
909
|
+
function shallowReadArray(arr) {
|
|
910
|
+
track(arr = toRaw(arr), "iterate", ARRAY_ITERATE_KEY);
|
|
911
|
+
return arr;
|
|
912
|
+
}
|
|
913
|
+
const arrayInstrumentations = {
|
|
914
|
+
__proto__: null,
|
|
915
|
+
[Symbol.iterator]() {
|
|
916
|
+
return iterator(this, Symbol.iterator, toReactive);
|
|
917
|
+
},
|
|
918
|
+
concat(...args) {
|
|
919
|
+
return reactiveReadArray(this).concat(
|
|
920
|
+
...args.map((x) => reactiveReadArray(x))
|
|
921
|
+
);
|
|
922
|
+
},
|
|
923
|
+
entries() {
|
|
924
|
+
return iterator(this, "entries", (value) => {
|
|
925
|
+
value[1] = toReactive(value[1]);
|
|
926
|
+
return value;
|
|
927
|
+
});
|
|
928
|
+
},
|
|
929
|
+
every(fn, thisArg) {
|
|
930
|
+
return apply(this, "every", fn, thisArg);
|
|
931
|
+
},
|
|
932
|
+
filter(fn, thisArg) {
|
|
933
|
+
const result = apply(this, "filter", fn, thisArg);
|
|
934
|
+
return isProxy(this) && !isShallow(this) ? result.map(toReactive) : result;
|
|
935
|
+
},
|
|
936
|
+
find(fn, thisArg) {
|
|
937
|
+
const result = apply(this, "find", fn, thisArg);
|
|
938
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
939
|
+
},
|
|
940
|
+
findIndex(fn, thisArg) {
|
|
941
|
+
return apply(this, "findIndex", fn, thisArg);
|
|
942
|
+
},
|
|
943
|
+
findLast(fn, thisArg) {
|
|
944
|
+
const result = apply(this, "findLast", fn, thisArg);
|
|
945
|
+
return isProxy(this) && !isShallow(this) ? toReactive(result) : result;
|
|
946
|
+
},
|
|
947
|
+
findLastIndex(fn, thisArg) {
|
|
948
|
+
return apply(this, "findLastIndex", fn, thisArg);
|
|
949
|
+
},
|
|
950
|
+
// flat, flatMap could benefit from ARRAY_ITERATE but are not straight-forward to implement
|
|
951
|
+
forEach(fn, thisArg) {
|
|
952
|
+
return apply(this, "forEach", fn, thisArg);
|
|
953
|
+
},
|
|
954
|
+
includes(...args) {
|
|
955
|
+
return searchProxy(this, "includes", args);
|
|
956
|
+
},
|
|
957
|
+
indexOf(...args) {
|
|
958
|
+
return searchProxy(this, "indexOf", args);
|
|
959
|
+
},
|
|
960
|
+
join(separator) {
|
|
961
|
+
return reactiveReadArray(this).join(separator);
|
|
962
|
+
},
|
|
963
|
+
// keys() iterator only reads `length`, no optimisation required
|
|
964
|
+
lastIndexOf(...args) {
|
|
965
|
+
return searchProxy(this, "lastIndexOf", args);
|
|
966
|
+
},
|
|
967
|
+
map(fn, thisArg) {
|
|
968
|
+
return apply(this, "map", fn, thisArg);
|
|
969
|
+
},
|
|
970
|
+
pop() {
|
|
971
|
+
return noTracking(this, "pop");
|
|
972
|
+
},
|
|
973
|
+
push(...args) {
|
|
974
|
+
return noTracking(this, "push", args);
|
|
975
|
+
},
|
|
976
|
+
reduce(fn, ...args) {
|
|
977
|
+
return reduce(this, "reduce", fn, args);
|
|
978
|
+
},
|
|
979
|
+
reduceRight(fn, ...args) {
|
|
980
|
+
return reduce(this, "reduceRight", fn, args);
|
|
981
|
+
},
|
|
982
|
+
shift() {
|
|
983
|
+
return noTracking(this, "shift");
|
|
984
|
+
},
|
|
985
|
+
// slice could use ARRAY_ITERATE but also seems to beg for range tracking
|
|
986
|
+
some(fn, thisArg) {
|
|
987
|
+
return apply(this, "some", fn, thisArg);
|
|
988
|
+
},
|
|
989
|
+
splice(...args) {
|
|
990
|
+
return noTracking(this, "splice", args);
|
|
991
|
+
},
|
|
992
|
+
toReversed() {
|
|
993
|
+
return reactiveReadArray(this).toReversed();
|
|
994
|
+
},
|
|
995
|
+
toSorted(comparer) {
|
|
996
|
+
return reactiveReadArray(this).toSorted(comparer);
|
|
997
|
+
},
|
|
998
|
+
toSpliced(...args) {
|
|
999
|
+
return reactiveReadArray(this).toSpliced(...args);
|
|
1000
|
+
},
|
|
1001
|
+
unshift(...args) {
|
|
1002
|
+
return noTracking(this, "unshift", args);
|
|
1003
|
+
},
|
|
1004
|
+
values() {
|
|
1005
|
+
return iterator(this, "values", toReactive);
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
function iterator(self, method, wrapValue) {
|
|
1009
|
+
const arr = shallowReadArray(self);
|
|
1010
|
+
const iter = arr[method]();
|
|
1011
|
+
if (arr !== self && !isShallow(self)) {
|
|
1012
|
+
iter._next = iter.next;
|
|
1013
|
+
iter.next = () => {
|
|
1014
|
+
const result = iter._next();
|
|
1015
|
+
if (result.value) {
|
|
1016
|
+
result.value = wrapValue(result.value);
|
|
1017
|
+
}
|
|
1018
|
+
return result;
|
|
1019
|
+
};
|
|
1020
|
+
}
|
|
1021
|
+
return iter;
|
|
1022
|
+
}
|
|
1023
|
+
function apply(self, method, fn, thisArg) {
|
|
1024
|
+
const arr = shallowReadArray(self);
|
|
1025
|
+
let wrappedFn = fn;
|
|
1026
|
+
if (arr !== self) {
|
|
1027
|
+
if (!isShallow(self)) {
|
|
1028
|
+
wrappedFn = function(item, index) {
|
|
1029
|
+
return fn.call(this, toReactive(item), index, self);
|
|
1030
|
+
};
|
|
1031
|
+
} else if (fn.length > 2) {
|
|
1032
|
+
wrappedFn = function(item, index) {
|
|
1033
|
+
return fn.call(this, item, index, self);
|
|
1034
|
+
};
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
return arr[method](wrappedFn, thisArg);
|
|
1038
|
+
}
|
|
1039
|
+
function reduce(self, method, fn, args) {
|
|
1040
|
+
const arr = shallowReadArray(self);
|
|
1041
|
+
let wrappedFn = fn;
|
|
1042
|
+
if (arr !== self) {
|
|
1043
|
+
if (!isShallow(self)) {
|
|
1044
|
+
wrappedFn = function(acc, item, index) {
|
|
1045
|
+
return fn.call(this, acc, toReactive(item), index, self);
|
|
1046
|
+
};
|
|
1047
|
+
} else if (fn.length > 3) {
|
|
1048
|
+
wrappedFn = function(acc, item, index) {
|
|
1049
|
+
return fn.call(this, acc, item, index, self);
|
|
1050
|
+
};
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
return arr[method](wrappedFn, ...args);
|
|
1054
|
+
}
|
|
1055
|
+
function searchProxy(self, method, args) {
|
|
1056
|
+
const arr = toRaw(self);
|
|
1057
|
+
track(arr, "iterate", ARRAY_ITERATE_KEY);
|
|
1058
|
+
const res = arr[method](...args);
|
|
1059
|
+
if ((res === -1 || res === false) && isProxy(args[0])) {
|
|
1060
|
+
args[0] = toRaw(args[0]);
|
|
1061
|
+
return arr[method](...args);
|
|
1062
|
+
}
|
|
1063
|
+
return res;
|
|
1064
|
+
}
|
|
1065
|
+
function noTracking(self, method, args = []) {
|
|
1066
|
+
pauseTracking();
|
|
1067
|
+
startBatch();
|
|
1068
|
+
const res = toRaw(self)[method].apply(self, args);
|
|
1069
|
+
endBatch();
|
|
1070
|
+
resetTracking();
|
|
1071
|
+
return res;
|
|
1072
|
+
}
|
|
1073
|
+
|
|
700
1074
|
const isNonTrackableKeys = /* @__PURE__ */ makeMap(`__proto__,__v_isRef,__isVue`);
|
|
701
1075
|
const builtInSymbols = new Set(
|
|
702
1076
|
/* @__PURE__ */ Object.getOwnPropertyNames(Symbol).filter((key) => key !== "arguments" && key !== "caller").map((key) => Symbol[key]).filter(isSymbol)
|
|
703
1077
|
);
|
|
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
1078
|
function hasOwnProperty(key) {
|
|
734
1079
|
if (!isSymbol(key))
|
|
735
1080
|
key = String(key);
|
|
@@ -760,14 +1105,22 @@ class BaseReactiveHandler {
|
|
|
760
1105
|
}
|
|
761
1106
|
const targetIsArray = isArray(target);
|
|
762
1107
|
if (!isReadonly2) {
|
|
763
|
-
|
|
764
|
-
|
|
1108
|
+
let fn;
|
|
1109
|
+
if (targetIsArray && (fn = arrayInstrumentations[key])) {
|
|
1110
|
+
return fn;
|
|
765
1111
|
}
|
|
766
1112
|
if (key === "hasOwnProperty") {
|
|
767
1113
|
return hasOwnProperty;
|
|
768
1114
|
}
|
|
769
1115
|
}
|
|
770
|
-
const res = Reflect.get(
|
|
1116
|
+
const res = Reflect.get(
|
|
1117
|
+
target,
|
|
1118
|
+
key,
|
|
1119
|
+
// if this is a proxy wrapping a ref, return methods using the raw ref
|
|
1120
|
+
// as receiver so that we don't have to call `toRaw` on the ref in all
|
|
1121
|
+
// its class methods
|
|
1122
|
+
isRef(target) ? target : receiver
|
|
1123
|
+
);
|
|
771
1124
|
if (isSymbol(key) ? builtInSymbols.has(key) : isNonTrackableKeys(key)) {
|
|
772
1125
|
return res;
|
|
773
1126
|
}
|
|
@@ -1266,110 +1619,8 @@ function markRaw(value) {
|
|
|
1266
1619
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1267
1620
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1268
1621
|
|
|
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
1622
|
function isRef(r) {
|
|
1372
|
-
return
|
|
1623
|
+
return r ? r.__v_isRef === true : false;
|
|
1373
1624
|
}
|
|
1374
1625
|
function ref(value) {
|
|
1375
1626
|
return createRef(value, false);
|
|
@@ -1386,27 +1637,49 @@ function createRef(rawValue, shallow) {
|
|
|
1386
1637
|
class RefImpl {
|
|
1387
1638
|
constructor(value, __v_isShallow) {
|
|
1388
1639
|
this.__v_isShallow = __v_isShallow;
|
|
1389
|
-
this.dep =
|
|
1640
|
+
this.dep = new Dep();
|
|
1390
1641
|
this.__v_isRef = true;
|
|
1391
1642
|
this._rawValue = __v_isShallow ? value : toRaw(value);
|
|
1392
1643
|
this._value = __v_isShallow ? value : toReactive(value);
|
|
1393
1644
|
}
|
|
1394
1645
|
get value() {
|
|
1395
|
-
|
|
1646
|
+
{
|
|
1647
|
+
this.dep.track({
|
|
1648
|
+
target: this,
|
|
1649
|
+
type: "get",
|
|
1650
|
+
key: "value"
|
|
1651
|
+
});
|
|
1652
|
+
}
|
|
1396
1653
|
return this._value;
|
|
1397
1654
|
}
|
|
1398
|
-
set value(
|
|
1399
|
-
const
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
this.
|
|
1404
|
-
|
|
1655
|
+
set value(newValue) {
|
|
1656
|
+
const oldValue = this._rawValue;
|
|
1657
|
+
const useDirectValue = this.__v_isShallow || isShallow(newValue) || isReadonly(newValue);
|
|
1658
|
+
newValue = useDirectValue ? newValue : toRaw(newValue);
|
|
1659
|
+
if (hasChanged(newValue, oldValue)) {
|
|
1660
|
+
this._rawValue = newValue;
|
|
1661
|
+
this._value = useDirectValue ? newValue : toReactive(newValue);
|
|
1662
|
+
{
|
|
1663
|
+
this.dep.trigger({
|
|
1664
|
+
target: this,
|
|
1665
|
+
type: "set",
|
|
1666
|
+
key: "value",
|
|
1667
|
+
newValue,
|
|
1668
|
+
oldValue
|
|
1669
|
+
});
|
|
1670
|
+
}
|
|
1405
1671
|
}
|
|
1406
1672
|
}
|
|
1407
1673
|
}
|
|
1408
1674
|
function triggerRef(ref2) {
|
|
1409
|
-
|
|
1675
|
+
{
|
|
1676
|
+
ref2.dep.trigger({
|
|
1677
|
+
target: ref2,
|
|
1678
|
+
type: "set",
|
|
1679
|
+
key: "value",
|
|
1680
|
+
newValue: ref2._value
|
|
1681
|
+
});
|
|
1682
|
+
}
|
|
1410
1683
|
}
|
|
1411
1684
|
function unref(ref2) {
|
|
1412
1685
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1431,12 +1704,9 @@ function proxyRefs(objectWithRefs) {
|
|
|
1431
1704
|
}
|
|
1432
1705
|
class CustomRefImpl {
|
|
1433
1706
|
constructor(factory) {
|
|
1434
|
-
this.dep = void 0;
|
|
1435
1707
|
this.__v_isRef = true;
|
|
1436
|
-
const
|
|
1437
|
-
|
|
1438
|
-
() => triggerRefValue(this)
|
|
1439
|
-
);
|
|
1708
|
+
const dep = this.dep = new Dep();
|
|
1709
|
+
const { get, set } = factory(dep.track.bind(dep), dep.trigger.bind(dep));
|
|
1440
1710
|
this._get = get;
|
|
1441
1711
|
this._set = set;
|
|
1442
1712
|
}
|
|
@@ -1504,6 +1774,90 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1504
1774
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1505
1775
|
}
|
|
1506
1776
|
|
|
1777
|
+
class ComputedRefImpl {
|
|
1778
|
+
constructor(fn, setter, isSSR) {
|
|
1779
|
+
this.fn = fn;
|
|
1780
|
+
this.setter = setter;
|
|
1781
|
+
/**
|
|
1782
|
+
* @internal
|
|
1783
|
+
*/
|
|
1784
|
+
this._value = void 0;
|
|
1785
|
+
/**
|
|
1786
|
+
* @internal
|
|
1787
|
+
*/
|
|
1788
|
+
this.dep = new Dep(this);
|
|
1789
|
+
/**
|
|
1790
|
+
* @internal
|
|
1791
|
+
*/
|
|
1792
|
+
this.__v_isRef = true;
|
|
1793
|
+
// A computed is also a subscriber that tracks other deps
|
|
1794
|
+
/**
|
|
1795
|
+
* @internal
|
|
1796
|
+
*/
|
|
1797
|
+
this.deps = void 0;
|
|
1798
|
+
/**
|
|
1799
|
+
* @internal
|
|
1800
|
+
*/
|
|
1801
|
+
this.depsTail = void 0;
|
|
1802
|
+
/**
|
|
1803
|
+
* @internal
|
|
1804
|
+
*/
|
|
1805
|
+
this.flags = 16;
|
|
1806
|
+
/**
|
|
1807
|
+
* @internal
|
|
1808
|
+
*/
|
|
1809
|
+
this.globalVersion = globalVersion - 1;
|
|
1810
|
+
// for backwards compat
|
|
1811
|
+
this.effect = this;
|
|
1812
|
+
this.__v_isReadonly = !setter;
|
|
1813
|
+
this.isSSR = isSSR;
|
|
1814
|
+
}
|
|
1815
|
+
/**
|
|
1816
|
+
* @internal
|
|
1817
|
+
*/
|
|
1818
|
+
notify() {
|
|
1819
|
+
if (activeSub !== this) {
|
|
1820
|
+
this.flags |= 16;
|
|
1821
|
+
this.dep.notify();
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
get value() {
|
|
1825
|
+
const link = this.dep.track({
|
|
1826
|
+
target: this,
|
|
1827
|
+
type: "get",
|
|
1828
|
+
key: "value"
|
|
1829
|
+
}) ;
|
|
1830
|
+
refreshComputed(this);
|
|
1831
|
+
if (link) {
|
|
1832
|
+
link.version = this.dep.version;
|
|
1833
|
+
}
|
|
1834
|
+
return this._value;
|
|
1835
|
+
}
|
|
1836
|
+
set value(newValue) {
|
|
1837
|
+
if (this.setter) {
|
|
1838
|
+
this.setter(newValue);
|
|
1839
|
+
} else {
|
|
1840
|
+
warn$2("Write operation failed: computed value is readonly");
|
|
1841
|
+
}
|
|
1842
|
+
}
|
|
1843
|
+
}
|
|
1844
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1845
|
+
let getter;
|
|
1846
|
+
let setter;
|
|
1847
|
+
if (isFunction(getterOrOptions)) {
|
|
1848
|
+
getter = getterOrOptions;
|
|
1849
|
+
} else {
|
|
1850
|
+
getter = getterOrOptions.get;
|
|
1851
|
+
setter = getterOrOptions.set;
|
|
1852
|
+
}
|
|
1853
|
+
const cRef = new ComputedRefImpl(getter, setter, isSSR);
|
|
1854
|
+
if (debugOptions && !isSSR) {
|
|
1855
|
+
cRef.onTrack = debugOptions.onTrack;
|
|
1856
|
+
cRef.onTrigger = debugOptions.onTrigger;
|
|
1857
|
+
}
|
|
1858
|
+
return cRef;
|
|
1859
|
+
}
|
|
1860
|
+
|
|
1507
1861
|
const TrackOpTypes = {
|
|
1508
1862
|
"GET": "get",
|
|
1509
1863
|
"HAS": "has",
|
|
@@ -1796,7 +2150,7 @@ function findInsertionIndex(id) {
|
|
|
1796
2150
|
const middle = start + end >>> 1;
|
|
1797
2151
|
const middleJob = queue[middle];
|
|
1798
2152
|
const middleJobId = getId(middleJob);
|
|
1799
|
-
if (middleJobId < id || middleJobId === id && middleJob.
|
|
2153
|
+
if (middleJobId < id || middleJobId === id && middleJob.flags & 2) {
|
|
1800
2154
|
start = middle + 1;
|
|
1801
2155
|
} else {
|
|
1802
2156
|
end = middle;
|
|
@@ -1805,15 +2159,21 @@ function findInsertionIndex(id) {
|
|
|
1805
2159
|
return start;
|
|
1806
2160
|
}
|
|
1807
2161
|
function queueJob(job) {
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex
|
|
1811
|
-
)) {
|
|
2162
|
+
var _a;
|
|
2163
|
+
if (!(job.flags & 1)) {
|
|
1812
2164
|
if (job.id == null) {
|
|
1813
2165
|
queue.push(job);
|
|
2166
|
+
} else if (
|
|
2167
|
+
// fast path when the job id is larger than the tail
|
|
2168
|
+
!(job.flags & 2) && job.id >= (((_a = queue[queue.length - 1]) == null ? void 0 : _a.id) || 0)
|
|
2169
|
+
) {
|
|
2170
|
+
queue.push(job);
|
|
1814
2171
|
} else {
|
|
1815
2172
|
queue.splice(findInsertionIndex(job.id), 0, job);
|
|
1816
2173
|
}
|
|
2174
|
+
if (!(job.flags & 4)) {
|
|
2175
|
+
job.flags |= 1;
|
|
2176
|
+
}
|
|
1817
2177
|
queueFlush();
|
|
1818
2178
|
}
|
|
1819
2179
|
}
|
|
@@ -1831,11 +2191,11 @@ function invalidateJob(job) {
|
|
|
1831
2191
|
}
|
|
1832
2192
|
function queuePostFlushCb(cb) {
|
|
1833
2193
|
if (!isArray(cb)) {
|
|
1834
|
-
if (!
|
|
1835
|
-
cb,
|
|
1836
|
-
cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex
|
|
1837
|
-
)) {
|
|
2194
|
+
if (!(cb.flags & 1)) {
|
|
1838
2195
|
pendingPostFlushCbs.push(cb);
|
|
2196
|
+
if (!(cb.flags & 4)) {
|
|
2197
|
+
cb.flags |= 1;
|
|
2198
|
+
}
|
|
1839
2199
|
}
|
|
1840
2200
|
} else {
|
|
1841
2201
|
pendingPostFlushCbs.push(...cb);
|
|
@@ -1848,7 +2208,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1848
2208
|
}
|
|
1849
2209
|
for (; i < queue.length; i++) {
|
|
1850
2210
|
const cb = queue[i];
|
|
1851
|
-
if (cb && cb.
|
|
2211
|
+
if (cb && cb.flags & 2) {
|
|
1852
2212
|
if (instance && cb.id !== instance.uid) {
|
|
1853
2213
|
continue;
|
|
1854
2214
|
}
|
|
@@ -1858,6 +2218,7 @@ function flushPreFlushCbs(instance, seen, i = isFlushing ? flushIndex + 1 : 0) {
|
|
|
1858
2218
|
queue.splice(i, 1);
|
|
1859
2219
|
i--;
|
|
1860
2220
|
cb();
|
|
2221
|
+
cb.flags &= ~1;
|
|
1861
2222
|
}
|
|
1862
2223
|
}
|
|
1863
2224
|
}
|
|
@@ -1880,6 +2241,7 @@ function flushPostFlushCbs(seen) {
|
|
|
1880
2241
|
continue;
|
|
1881
2242
|
}
|
|
1882
2243
|
activePostFlushCbs[postFlushIndex]();
|
|
2244
|
+
activePostFlushCbs[postFlushIndex].flags &= ~1;
|
|
1883
2245
|
}
|
|
1884
2246
|
activePostFlushCbs = null;
|
|
1885
2247
|
postFlushIndex = 0;
|
|
@@ -1889,9 +2251,11 @@ const getId = (job) => job.id == null ? Infinity : job.id;
|
|
|
1889
2251
|
const comparator = (a, b) => {
|
|
1890
2252
|
const diff = getId(a) - getId(b);
|
|
1891
2253
|
if (diff === 0) {
|
|
1892
|
-
|
|
2254
|
+
const isAPre = a.flags & 2;
|
|
2255
|
+
const isBPre = b.flags & 2;
|
|
2256
|
+
if (isAPre && !isBPre)
|
|
1893
2257
|
return -1;
|
|
1894
|
-
if (
|
|
2258
|
+
if (isBPre && !isAPre)
|
|
1895
2259
|
return 1;
|
|
1896
2260
|
}
|
|
1897
2261
|
return diff;
|
|
@@ -1907,11 +2271,12 @@ function flushJobs(seen) {
|
|
|
1907
2271
|
try {
|
|
1908
2272
|
for (flushIndex = 0; flushIndex < queue.length; flushIndex++) {
|
|
1909
2273
|
const job = queue[flushIndex];
|
|
1910
|
-
if (job && job.
|
|
2274
|
+
if (job && !(job.flags & 8)) {
|
|
1911
2275
|
if (check(job)) {
|
|
1912
2276
|
continue;
|
|
1913
2277
|
}
|
|
1914
2278
|
callWithErrorHandling(job, null, 14);
|
|
2279
|
+
job.flags &= ~1;
|
|
1915
2280
|
}
|
|
1916
2281
|
}
|
|
1917
2282
|
} finally {
|
|
@@ -1993,7 +2358,6 @@ function rerender(id, newRender) {
|
|
|
1993
2358
|
}
|
|
1994
2359
|
instance.renderCache = [];
|
|
1995
2360
|
isHmrUpdating = true;
|
|
1996
|
-
instance.effect.dirty = true;
|
|
1997
2361
|
instance.update();
|
|
1998
2362
|
isHmrUpdating = false;
|
|
1999
2363
|
});
|
|
@@ -2021,7 +2385,6 @@ function reload(id, newComp) {
|
|
|
2021
2385
|
instance.ceReload(newComp.styles);
|
|
2022
2386
|
hmrDirtyComponents.delete(oldComp);
|
|
2023
2387
|
} else if (instance.parent) {
|
|
2024
|
-
instance.parent.effect.dirty = true;
|
|
2025
2388
|
queueJob(instance.parent.update);
|
|
2026
2389
|
} else if (instance.appContext.reload) {
|
|
2027
2390
|
instance.appContext.reload();
|
|
@@ -3427,8 +3790,8 @@ function doWatch(source, cb, {
|
|
|
3427
3790
|
};
|
|
3428
3791
|
};
|
|
3429
3792
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3430
|
-
const job = () => {
|
|
3431
|
-
if (!effect.
|
|
3793
|
+
const job = (immediateFirstRun) => {
|
|
3794
|
+
if (!(effect.flags & 1) || !effect.dirty && !immediateFirstRun) {
|
|
3432
3795
|
return;
|
|
3433
3796
|
}
|
|
3434
3797
|
if (cb) {
|
|
@@ -3449,19 +3812,22 @@ function doWatch(source, cb, {
|
|
|
3449
3812
|
effect.run();
|
|
3450
3813
|
}
|
|
3451
3814
|
};
|
|
3452
|
-
|
|
3815
|
+
if (cb)
|
|
3816
|
+
job.flags |= 4;
|
|
3817
|
+
const effect = new ReactiveEffect(getter);
|
|
3453
3818
|
let scheduler;
|
|
3454
3819
|
if (flush === "sync") {
|
|
3820
|
+
effect.flags |= 64;
|
|
3455
3821
|
scheduler = job;
|
|
3456
3822
|
} else if (flush === "post") {
|
|
3457
3823
|
scheduler = () => queuePostRenderEffect(job, instance && instance.suspense);
|
|
3458
3824
|
} else {
|
|
3459
|
-
job.
|
|
3825
|
+
job.flags |= 2;
|
|
3460
3826
|
if (instance)
|
|
3461
3827
|
job.id = instance.uid;
|
|
3462
3828
|
scheduler = () => queueJob(job);
|
|
3463
3829
|
}
|
|
3464
|
-
|
|
3830
|
+
effect.scheduler = scheduler;
|
|
3465
3831
|
const scope = getCurrentScope();
|
|
3466
3832
|
const unwatch = () => {
|
|
3467
3833
|
effect.stop();
|
|
@@ -3475,7 +3841,7 @@ function doWatch(source, cb, {
|
|
|
3475
3841
|
}
|
|
3476
3842
|
if (cb) {
|
|
3477
3843
|
if (immediate) {
|
|
3478
|
-
job();
|
|
3844
|
+
job(true);
|
|
3479
3845
|
} else {
|
|
3480
3846
|
oldValue = effect.run();
|
|
3481
3847
|
}
|
|
@@ -3654,22 +4020,7 @@ const BaseTransitionImpl = {
|
|
|
3654
4020
|
if (!children || !children.length) {
|
|
3655
4021
|
return;
|
|
3656
4022
|
}
|
|
3657
|
-
|
|
3658
|
-
if (children.length > 1) {
|
|
3659
|
-
let hasFound = false;
|
|
3660
|
-
for (const c of children) {
|
|
3661
|
-
if (c.type !== Comment) {
|
|
3662
|
-
if (hasFound) {
|
|
3663
|
-
warn$1(
|
|
3664
|
-
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
3665
|
-
);
|
|
3666
|
-
break;
|
|
3667
|
-
}
|
|
3668
|
-
child = c;
|
|
3669
|
-
hasFound = true;
|
|
3670
|
-
}
|
|
3671
|
-
}
|
|
3672
|
-
}
|
|
4023
|
+
const child = findNonCommentChild(children);
|
|
3673
4024
|
const rawProps = toRaw(props);
|
|
3674
4025
|
const { mode } = rawProps;
|
|
3675
4026
|
if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
|
|
@@ -3678,7 +4029,7 @@ const BaseTransitionImpl = {
|
|
|
3678
4029
|
if (state.isLeaving) {
|
|
3679
4030
|
return emptyPlaceholder(child);
|
|
3680
4031
|
}
|
|
3681
|
-
const innerChild =
|
|
4032
|
+
const innerChild = getInnerChild$1(child);
|
|
3682
4033
|
if (!innerChild) {
|
|
3683
4034
|
return emptyPlaceholder(child);
|
|
3684
4035
|
}
|
|
@@ -3690,7 +4041,7 @@ const BaseTransitionImpl = {
|
|
|
3690
4041
|
);
|
|
3691
4042
|
setTransitionHooks(innerChild, enterHooks);
|
|
3692
4043
|
const oldChild = instance.subTree;
|
|
3693
|
-
const oldInnerChild = oldChild &&
|
|
4044
|
+
const oldInnerChild = oldChild && getInnerChild$1(oldChild);
|
|
3694
4045
|
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild)) {
|
|
3695
4046
|
const leavingHooks = resolveTransitionHooks(
|
|
3696
4047
|
oldInnerChild,
|
|
@@ -3703,8 +4054,7 @@ const BaseTransitionImpl = {
|
|
|
3703
4054
|
state.isLeaving = true;
|
|
3704
4055
|
leavingHooks.afterLeave = () => {
|
|
3705
4056
|
state.isLeaving = false;
|
|
3706
|
-
if (instance.
|
|
3707
|
-
instance.effect.dirty = true;
|
|
4057
|
+
if (!(instance.job.flags & 8)) {
|
|
3708
4058
|
instance.update();
|
|
3709
4059
|
}
|
|
3710
4060
|
};
|
|
@@ -3729,6 +4079,25 @@ const BaseTransitionImpl = {
|
|
|
3729
4079
|
};
|
|
3730
4080
|
}
|
|
3731
4081
|
};
|
|
4082
|
+
function findNonCommentChild(children) {
|
|
4083
|
+
let child = children[0];
|
|
4084
|
+
if (children.length > 1) {
|
|
4085
|
+
let hasFound = false;
|
|
4086
|
+
for (const c of children) {
|
|
4087
|
+
if (c.type !== Comment) {
|
|
4088
|
+
if (hasFound) {
|
|
4089
|
+
warn$1(
|
|
4090
|
+
"<transition> can only be used on a single element or component. Use <transition-group> for lists."
|
|
4091
|
+
);
|
|
4092
|
+
break;
|
|
4093
|
+
}
|
|
4094
|
+
child = c;
|
|
4095
|
+
hasFound = true;
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
4099
|
+
return child;
|
|
4100
|
+
}
|
|
3732
4101
|
const BaseTransition = BaseTransitionImpl;
|
|
3733
4102
|
function getLeavingNodesForType(state, vnode) {
|
|
3734
4103
|
const { leavingVNodes } = state;
|
|
@@ -3883,8 +4252,11 @@ function emptyPlaceholder(vnode) {
|
|
|
3883
4252
|
return vnode;
|
|
3884
4253
|
}
|
|
3885
4254
|
}
|
|
3886
|
-
function
|
|
4255
|
+
function getInnerChild$1(vnode) {
|
|
3887
4256
|
if (!isKeepAlive(vnode)) {
|
|
4257
|
+
if (isTeleport(vnode.type) && vnode.children) {
|
|
4258
|
+
return findNonCommentChild(vnode.children);
|
|
4259
|
+
}
|
|
3888
4260
|
return vnode;
|
|
3889
4261
|
}
|
|
3890
4262
|
if (vnode.component) {
|
|
@@ -4053,7 +4425,6 @@ function defineAsyncComponent(source) {
|
|
|
4053
4425
|
load().then(() => {
|
|
4054
4426
|
loaded.value = true;
|
|
4055
4427
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4056
|
-
instance.parent.effect.dirty = true;
|
|
4057
4428
|
queueJob(instance.parent.update);
|
|
4058
4429
|
}
|
|
4059
4430
|
}).catch((err) => {
|
|
@@ -4378,10 +4749,20 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
4378
4749
|
function renderList(source, renderItem, cache, index) {
|
|
4379
4750
|
let ret;
|
|
4380
4751
|
const cached = cache && cache[index];
|
|
4381
|
-
|
|
4752
|
+
const sourceIsArray = isArray(source);
|
|
4753
|
+
const sourceIsReactiveArray = sourceIsArray && isReactive(source);
|
|
4754
|
+
if (sourceIsArray || isString(source)) {
|
|
4755
|
+
if (sourceIsReactiveArray) {
|
|
4756
|
+
source = shallowReadArray(source);
|
|
4757
|
+
}
|
|
4382
4758
|
ret = new Array(source.length);
|
|
4383
4759
|
for (let i = 0, l = source.length; i < l; i++) {
|
|
4384
|
-
ret[i] = renderItem(
|
|
4760
|
+
ret[i] = renderItem(
|
|
4761
|
+
sourceIsReactiveArray ? toReactive(source[i]) : source[i],
|
|
4762
|
+
i,
|
|
4763
|
+
void 0,
|
|
4764
|
+
cached && cached[i]
|
|
4765
|
+
);
|
|
4385
4766
|
}
|
|
4386
4767
|
} else if (typeof source === "number") {
|
|
4387
4768
|
if (!Number.isInteger(source)) {
|
|
@@ -4516,7 +4897,6 @@ const publicPropertiesMap = (
|
|
|
4516
4897
|
$emit: (i) => i.emit,
|
|
4517
4898
|
$options: (i) => resolveMergedOptions(i) ,
|
|
4518
4899
|
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
4519
|
-
i.effect.dirty = true;
|
|
4520
4900
|
queueJob(i.update);
|
|
4521
4901
|
}),
|
|
4522
4902
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
@@ -5849,7 +6229,9 @@ const isSimpleType = /* @__PURE__ */ makeMap(
|
|
|
5849
6229
|
function assertType(value, type) {
|
|
5850
6230
|
let valid;
|
|
5851
6231
|
const expectedType = getType(type);
|
|
5852
|
-
if (
|
|
6232
|
+
if (expectedType === "null") {
|
|
6233
|
+
valid = value === null;
|
|
6234
|
+
} else if (isSimpleType(expectedType)) {
|
|
5853
6235
|
const t = typeof value;
|
|
5854
6236
|
valid = t === expectedType.toLowerCase();
|
|
5855
6237
|
if (!valid && t === "object") {
|
|
@@ -5859,8 +6241,6 @@ function assertType(value, type) {
|
|
|
5859
6241
|
valid = isObject(value);
|
|
5860
6242
|
} else if (expectedType === "Array") {
|
|
5861
6243
|
valid = isArray(value);
|
|
5862
|
-
} else if (expectedType === "null") {
|
|
5863
|
-
valid = value === null;
|
|
5864
6244
|
} else {
|
|
5865
6245
|
valid = value instanceof type;
|
|
5866
6246
|
}
|
|
@@ -7384,7 +7764,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7384
7764
|
} else {
|
|
7385
7765
|
instance.next = n2;
|
|
7386
7766
|
invalidateJob(instance.update);
|
|
7387
|
-
instance.effect.dirty = true;
|
|
7388
7767
|
instance.update();
|
|
7389
7768
|
}
|
|
7390
7769
|
} else {
|
|
@@ -7567,24 +7946,18 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7567
7946
|
}
|
|
7568
7947
|
}
|
|
7569
7948
|
};
|
|
7570
|
-
|
|
7571
|
-
|
|
7572
|
-
|
|
7573
|
-
|
|
7574
|
-
|
|
7575
|
-
|
|
7576
|
-
);
|
|
7577
|
-
const update = instance.update = () => {
|
|
7578
|
-
if (effect.dirty) {
|
|
7579
|
-
effect.run();
|
|
7580
|
-
}
|
|
7581
|
-
};
|
|
7582
|
-
update.id = instance.uid;
|
|
7949
|
+
instance.scope.on();
|
|
7950
|
+
const effect = instance.effect = new ReactiveEffect(componentUpdateFn);
|
|
7951
|
+
instance.scope.off();
|
|
7952
|
+
const update = instance.update = effect.run.bind(effect);
|
|
7953
|
+
const job = instance.job = effect.runIfDirty.bind(effect);
|
|
7954
|
+
job.id = instance.uid;
|
|
7955
|
+
effect.scheduler = () => queueJob(job);
|
|
7583
7956
|
toggleRecurse(instance, true);
|
|
7584
7957
|
{
|
|
7585
7958
|
effect.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
|
|
7586
7959
|
effect.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
|
|
7587
|
-
|
|
7960
|
+
job.ownerInstance = instance;
|
|
7588
7961
|
}
|
|
7589
7962
|
update();
|
|
7590
7963
|
};
|
|
@@ -8051,13 +8424,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8051
8424
|
if (instance.type.__hmrId) {
|
|
8052
8425
|
unregisterHMR(instance);
|
|
8053
8426
|
}
|
|
8054
|
-
const { bum, scope,
|
|
8427
|
+
const { bum, scope, job, subTree, um } = instance;
|
|
8055
8428
|
if (bum) {
|
|
8056
8429
|
invokeArrayFns(bum);
|
|
8057
8430
|
}
|
|
8058
8431
|
scope.stop();
|
|
8059
|
-
if (
|
|
8060
|
-
|
|
8432
|
+
if (job) {
|
|
8433
|
+
job.flags |= 8;
|
|
8061
8434
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
8062
8435
|
}
|
|
8063
8436
|
if (um) {
|
|
@@ -8143,8 +8516,14 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8143
8516
|
function resolveChildrenNamespace({ type, props }, currentNamespace) {
|
|
8144
8517
|
return currentNamespace === "svg" && type === "foreignObject" || currentNamespace === "mathml" && type === "annotation-xml" && props && props.encoding && props.encoding.includes("html") ? void 0 : currentNamespace;
|
|
8145
8518
|
}
|
|
8146
|
-
function toggleRecurse({ effect,
|
|
8147
|
-
|
|
8519
|
+
function toggleRecurse({ effect, job }, allowed) {
|
|
8520
|
+
if (allowed) {
|
|
8521
|
+
effect.flags |= 32;
|
|
8522
|
+
job.flags |= 4;
|
|
8523
|
+
} else {
|
|
8524
|
+
effect.flags &= ~32;
|
|
8525
|
+
job.flags &= ~4;
|
|
8526
|
+
}
|
|
8148
8527
|
}
|
|
8149
8528
|
function needTransition(parentSuspense, transition) {
|
|
8150
8529
|
return (!parentSuspense || parentSuspense && !parentSuspense.pendingBranch) && transition && !transition.persisted;
|
|
@@ -8881,6 +9260,7 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
8881
9260
|
effect: null,
|
|
8882
9261
|
update: null,
|
|
8883
9262
|
// will be set synchronously right after creation
|
|
9263
|
+
job: null,
|
|
8884
9264
|
scope: new EffectScope(
|
|
8885
9265
|
true
|
|
8886
9266
|
/* detached */
|
|
@@ -9374,7 +9754,8 @@ function initCustomFormatter() {
|
|
|
9374
9754
|
{},
|
|
9375
9755
|
["span", vueStyle, genRefFlag(obj)],
|
|
9376
9756
|
"<",
|
|
9377
|
-
|
|
9757
|
+
// avoid debugger accessing value affecting behavior
|
|
9758
|
+
formatValue("_value" in obj ? obj._value : obj),
|
|
9378
9759
|
`>`
|
|
9379
9760
|
];
|
|
9380
9761
|
} else if (isReactive(obj)) {
|
|
@@ -9554,7 +9935,7 @@ function isMemoSame(cached, memo) {
|
|
|
9554
9935
|
return true;
|
|
9555
9936
|
}
|
|
9556
9937
|
|
|
9557
|
-
const version = "3.
|
|
9938
|
+
const version = "3.5.0-alpha.1";
|
|
9558
9939
|
const warn = warn$1 ;
|
|
9559
9940
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
9560
9941
|
const devtools = devtools$1 ;
|
|
@@ -11009,7 +11390,9 @@ const withKeys = (fn, modifiers) => {
|
|
|
11009
11390
|
return;
|
|
11010
11391
|
}
|
|
11011
11392
|
const eventKey = hyphenate(event.key);
|
|
11012
|
-
if (modifiers.some(
|
|
11393
|
+
if (modifiers.some(
|
|
11394
|
+
(k) => k === eventKey || keyNames[k] === eventKey
|
|
11395
|
+
)) {
|
|
11013
11396
|
return fn(event);
|
|
11014
11397
|
}
|
|
11015
11398
|
});
|