@vue/compat 3.3.7 → 3.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/vue.cjs.js +291 -227
- package/dist/vue.cjs.prod.js +245 -200
- package/dist/vue.esm-browser.js +292 -228
- package/dist/vue.esm-browser.prod.js +4 -4
- package/dist/vue.esm-bundler.js +293 -237
- package/dist/vue.global.js +291 -227
- package/dist/vue.global.prod.js +5 -5
- package/dist/vue.runtime.esm-browser.js +292 -228
- package/dist/vue.runtime.esm-browser.prod.js +5 -5
- package/dist/vue.runtime.esm-bundler.js +293 -237
- package/dist/vue.runtime.global.js +291 -227
- package/dist/vue.runtime.global.prod.js +5 -5
- package/package.json +2 -2
package/dist/vue.cjs.js
CHANGED
|
@@ -492,117 +492,120 @@ function onScopeDispose(fn) {
|
|
|
492
492
|
}
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
const createDep = (effects) => {
|
|
496
|
-
const dep = new Set(effects);
|
|
497
|
-
dep.w = 0;
|
|
498
|
-
dep.n = 0;
|
|
499
|
-
return dep;
|
|
500
|
-
};
|
|
501
|
-
const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
|
|
502
|
-
const newTracked = (dep) => (dep.n & trackOpBit) > 0;
|
|
503
|
-
const initDepMarkers = ({ deps }) => {
|
|
504
|
-
if (deps.length) {
|
|
505
|
-
for (let i = 0; i < deps.length; i++) {
|
|
506
|
-
deps[i].w |= trackOpBit;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
const finalizeDepMarkers = (effect) => {
|
|
511
|
-
const { deps } = effect;
|
|
512
|
-
if (deps.length) {
|
|
513
|
-
let ptr = 0;
|
|
514
|
-
for (let i = 0; i < deps.length; i++) {
|
|
515
|
-
const dep = deps[i];
|
|
516
|
-
if (wasTracked(dep) && !newTracked(dep)) {
|
|
517
|
-
dep.delete(effect);
|
|
518
|
-
} else {
|
|
519
|
-
deps[ptr++] = dep;
|
|
520
|
-
}
|
|
521
|
-
dep.w &= ~trackOpBit;
|
|
522
|
-
dep.n &= ~trackOpBit;
|
|
523
|
-
}
|
|
524
|
-
deps.length = ptr;
|
|
525
|
-
}
|
|
526
|
-
};
|
|
527
|
-
|
|
528
|
-
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
529
|
-
let effectTrackDepth = 0;
|
|
530
|
-
let trackOpBit = 1;
|
|
531
|
-
const maxMarkerBits = 30;
|
|
532
495
|
let activeEffect;
|
|
533
|
-
const ITERATE_KEY = Symbol("iterate" );
|
|
534
|
-
const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
|
|
535
496
|
class ReactiveEffect {
|
|
536
|
-
constructor(fn, scheduler
|
|
497
|
+
constructor(fn, trigger, scheduler, scope) {
|
|
537
498
|
this.fn = fn;
|
|
499
|
+
this.trigger = trigger;
|
|
538
500
|
this.scheduler = scheduler;
|
|
539
501
|
this.active = true;
|
|
540
502
|
this.deps = [];
|
|
541
|
-
|
|
503
|
+
/**
|
|
504
|
+
* @internal
|
|
505
|
+
*/
|
|
506
|
+
this._dirtyLevel = 3;
|
|
507
|
+
/**
|
|
508
|
+
* @internal
|
|
509
|
+
*/
|
|
510
|
+
this._trackId = 0;
|
|
511
|
+
/**
|
|
512
|
+
* @internal
|
|
513
|
+
*/
|
|
514
|
+
this._runnings = 0;
|
|
515
|
+
/**
|
|
516
|
+
* @internal
|
|
517
|
+
*/
|
|
518
|
+
this._queryings = 0;
|
|
519
|
+
/**
|
|
520
|
+
* @internal
|
|
521
|
+
*/
|
|
522
|
+
this._depsLength = 0;
|
|
542
523
|
recordEffectScope(this, scope);
|
|
543
524
|
}
|
|
525
|
+
get dirty() {
|
|
526
|
+
if (this._dirtyLevel === 1) {
|
|
527
|
+
this._dirtyLevel = 0;
|
|
528
|
+
this._queryings++;
|
|
529
|
+
pauseTracking();
|
|
530
|
+
for (const dep of this.deps) {
|
|
531
|
+
if (dep.computed) {
|
|
532
|
+
triggerComputed(dep.computed);
|
|
533
|
+
if (this._dirtyLevel >= 2) {
|
|
534
|
+
break;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
resetTracking();
|
|
539
|
+
this._queryings--;
|
|
540
|
+
}
|
|
541
|
+
return this._dirtyLevel >= 2;
|
|
542
|
+
}
|
|
543
|
+
set dirty(v) {
|
|
544
|
+
this._dirtyLevel = v ? 3 : 0;
|
|
545
|
+
}
|
|
544
546
|
run() {
|
|
547
|
+
this._dirtyLevel = 0;
|
|
545
548
|
if (!this.active) {
|
|
546
549
|
return this.fn();
|
|
547
550
|
}
|
|
548
|
-
let parent = activeEffect;
|
|
549
551
|
let lastShouldTrack = shouldTrack;
|
|
550
|
-
|
|
551
|
-
if (parent === this) {
|
|
552
|
-
return;
|
|
553
|
-
}
|
|
554
|
-
parent = parent.parent;
|
|
555
|
-
}
|
|
552
|
+
let lastEffect = activeEffect;
|
|
556
553
|
try {
|
|
557
|
-
this.parent = activeEffect;
|
|
558
|
-
activeEffect = this;
|
|
559
554
|
shouldTrack = true;
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
} else {
|
|
564
|
-
cleanupEffect(this);
|
|
565
|
-
}
|
|
555
|
+
activeEffect = this;
|
|
556
|
+
this._runnings++;
|
|
557
|
+
preCleanupEffect(this);
|
|
566
558
|
return this.fn();
|
|
567
559
|
} finally {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
trackOpBit = 1 << --effectTrackDepth;
|
|
572
|
-
activeEffect = this.parent;
|
|
560
|
+
postCleanupEffect(this);
|
|
561
|
+
this._runnings--;
|
|
562
|
+
activeEffect = lastEffect;
|
|
573
563
|
shouldTrack = lastShouldTrack;
|
|
574
|
-
this.parent = void 0;
|
|
575
|
-
if (this.deferStop) {
|
|
576
|
-
this.stop();
|
|
577
|
-
}
|
|
578
564
|
}
|
|
579
565
|
}
|
|
580
566
|
stop() {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
this.onStop();
|
|
587
|
-
}
|
|
567
|
+
var _a;
|
|
568
|
+
if (this.active) {
|
|
569
|
+
preCleanupEffect(this);
|
|
570
|
+
postCleanupEffect(this);
|
|
571
|
+
(_a = this.onStop) == null ? void 0 : _a.call(this);
|
|
588
572
|
this.active = false;
|
|
589
573
|
}
|
|
590
574
|
}
|
|
591
575
|
}
|
|
592
|
-
function
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
576
|
+
function triggerComputed(computed) {
|
|
577
|
+
return computed.value;
|
|
578
|
+
}
|
|
579
|
+
function preCleanupEffect(effect2) {
|
|
580
|
+
effect2._trackId++;
|
|
581
|
+
effect2._depsLength = 0;
|
|
582
|
+
}
|
|
583
|
+
function postCleanupEffect(effect2) {
|
|
584
|
+
if (effect2.deps && effect2.deps.length > effect2._depsLength) {
|
|
585
|
+
for (let i = effect2._depsLength; i < effect2.deps.length; i++) {
|
|
586
|
+
cleanupDepEffect(effect2.deps[i], effect2);
|
|
587
|
+
}
|
|
588
|
+
effect2.deps.length = effect2._depsLength;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
function cleanupDepEffect(dep, effect2) {
|
|
592
|
+
const trackId = dep.get(effect2);
|
|
593
|
+
if (trackId !== void 0 && effect2._trackId !== trackId) {
|
|
594
|
+
dep.delete(effect2);
|
|
595
|
+
if (dep.size === 0) {
|
|
596
|
+
dep.cleanup();
|
|
597
597
|
}
|
|
598
|
-
deps.length = 0;
|
|
599
598
|
}
|
|
600
599
|
}
|
|
601
600
|
function effect(fn, options) {
|
|
602
601
|
if (fn.effect instanceof ReactiveEffect) {
|
|
603
602
|
fn = fn.effect.fn;
|
|
604
603
|
}
|
|
605
|
-
const _effect = new ReactiveEffect(fn)
|
|
604
|
+
const _effect = new ReactiveEffect(fn, NOOP, () => {
|
|
605
|
+
if (_effect.dirty) {
|
|
606
|
+
_effect.run();
|
|
607
|
+
}
|
|
608
|
+
});
|
|
606
609
|
if (options) {
|
|
607
610
|
extend(_effect, options);
|
|
608
611
|
if (options.scope)
|
|
@@ -619,6 +622,7 @@ function stop(runner) {
|
|
|
619
622
|
runner.effect.stop();
|
|
620
623
|
}
|
|
621
624
|
let shouldTrack = true;
|
|
625
|
+
let pauseScheduleStack = 0;
|
|
622
626
|
const trackStack = [];
|
|
623
627
|
function pauseTracking() {
|
|
624
628
|
trackStack.push(shouldTrack);
|
|
@@ -628,6 +632,68 @@ function resetTracking() {
|
|
|
628
632
|
const last = trackStack.pop();
|
|
629
633
|
shouldTrack = last === void 0 ? true : last;
|
|
630
634
|
}
|
|
635
|
+
function pauseScheduling() {
|
|
636
|
+
pauseScheduleStack++;
|
|
637
|
+
}
|
|
638
|
+
function resetScheduling() {
|
|
639
|
+
pauseScheduleStack--;
|
|
640
|
+
while (!pauseScheduleStack && queueEffectSchedulers.length) {
|
|
641
|
+
queueEffectSchedulers.shift()();
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
function trackEffect(effect2, dep, debuggerEventExtraInfo) {
|
|
645
|
+
var _a;
|
|
646
|
+
if (dep.get(effect2) !== effect2._trackId) {
|
|
647
|
+
dep.set(effect2, effect2._trackId);
|
|
648
|
+
const oldDep = effect2.deps[effect2._depsLength];
|
|
649
|
+
if (oldDep !== dep) {
|
|
650
|
+
if (oldDep) {
|
|
651
|
+
cleanupDepEffect(oldDep, effect2);
|
|
652
|
+
}
|
|
653
|
+
effect2.deps[effect2._depsLength++] = dep;
|
|
654
|
+
} else {
|
|
655
|
+
effect2._depsLength++;
|
|
656
|
+
}
|
|
657
|
+
{
|
|
658
|
+
(_a = effect2.onTrack) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
const queueEffectSchedulers = [];
|
|
663
|
+
function triggerEffects(dep, dirtyLevel, debuggerEventExtraInfo) {
|
|
664
|
+
var _a;
|
|
665
|
+
pauseScheduling();
|
|
666
|
+
for (const effect2 of dep.keys()) {
|
|
667
|
+
if (!effect2.allowRecurse && effect2._runnings) {
|
|
668
|
+
continue;
|
|
669
|
+
}
|
|
670
|
+
if (effect2._dirtyLevel < dirtyLevel && (!effect2._runnings || dirtyLevel !== 2)) {
|
|
671
|
+
const lastDirtyLevel = effect2._dirtyLevel;
|
|
672
|
+
effect2._dirtyLevel = dirtyLevel;
|
|
673
|
+
if (lastDirtyLevel === 0 && (!effect2._queryings || dirtyLevel !== 2)) {
|
|
674
|
+
{
|
|
675
|
+
(_a = effect2.onTrigger) == null ? void 0 : _a.call(effect2, extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
676
|
+
}
|
|
677
|
+
effect2.trigger();
|
|
678
|
+
if (effect2.scheduler) {
|
|
679
|
+
queueEffectSchedulers.push(effect2.scheduler);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
resetScheduling();
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
const createDep = (cleanup, computed) => {
|
|
688
|
+
const dep = /* @__PURE__ */ new Map();
|
|
689
|
+
dep.cleanup = cleanup;
|
|
690
|
+
dep.computed = computed;
|
|
691
|
+
return dep;
|
|
692
|
+
};
|
|
693
|
+
|
|
694
|
+
const targetMap = /* @__PURE__ */ new WeakMap();
|
|
695
|
+
const ITERATE_KEY = Symbol("iterate" );
|
|
696
|
+
const MAP_KEY_ITERATE_KEY = Symbol("Map key iterate" );
|
|
631
697
|
function track(target, type, key) {
|
|
632
698
|
if (shouldTrack && activeEffect) {
|
|
633
699
|
let depsMap = targetMap.get(target);
|
|
@@ -636,35 +702,17 @@ function track(target, type, key) {
|
|
|
636
702
|
}
|
|
637
703
|
let dep = depsMap.get(key);
|
|
638
704
|
if (!dep) {
|
|
639
|
-
depsMap.set(key, dep = createDep());
|
|
640
|
-
}
|
|
641
|
-
const eventInfo = { effect: activeEffect, target, type, key } ;
|
|
642
|
-
trackEffects(dep, eventInfo);
|
|
643
|
-
}
|
|
644
|
-
}
|
|
645
|
-
function trackEffects(dep, debuggerEventExtraInfo) {
|
|
646
|
-
let shouldTrack2 = false;
|
|
647
|
-
if (effectTrackDepth <= maxMarkerBits) {
|
|
648
|
-
if (!newTracked(dep)) {
|
|
649
|
-
dep.n |= trackOpBit;
|
|
650
|
-
shouldTrack2 = !wasTracked(dep);
|
|
651
|
-
}
|
|
652
|
-
} else {
|
|
653
|
-
shouldTrack2 = !dep.has(activeEffect);
|
|
654
|
-
}
|
|
655
|
-
if (shouldTrack2) {
|
|
656
|
-
dep.add(activeEffect);
|
|
657
|
-
activeEffect.deps.push(dep);
|
|
658
|
-
if (activeEffect.onTrack) {
|
|
659
|
-
activeEffect.onTrack(
|
|
660
|
-
extend(
|
|
661
|
-
{
|
|
662
|
-
effect: activeEffect
|
|
663
|
-
},
|
|
664
|
-
debuggerEventExtraInfo
|
|
665
|
-
)
|
|
666
|
-
);
|
|
705
|
+
depsMap.set(key, dep = createDep(() => depsMap.delete(key)));
|
|
667
706
|
}
|
|
707
|
+
trackEffect(
|
|
708
|
+
activeEffect,
|
|
709
|
+
dep,
|
|
710
|
+
{
|
|
711
|
+
target,
|
|
712
|
+
type,
|
|
713
|
+
key
|
|
714
|
+
}
|
|
715
|
+
);
|
|
668
716
|
}
|
|
669
717
|
}
|
|
670
718
|
function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
@@ -712,49 +760,24 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
712
760
|
break;
|
|
713
761
|
}
|
|
714
762
|
}
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
if (
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
triggerEffects(createDep(effects), eventInfo);
|
|
731
|
-
}
|
|
732
|
-
}
|
|
733
|
-
}
|
|
734
|
-
function triggerEffects(dep, debuggerEventExtraInfo) {
|
|
735
|
-
const effects = isArray(dep) ? dep : [...dep];
|
|
736
|
-
for (const effect2 of effects) {
|
|
737
|
-
if (effect2.computed) {
|
|
738
|
-
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
for (const effect2 of effects) {
|
|
742
|
-
if (!effect2.computed) {
|
|
743
|
-
triggerEffect(effect2, debuggerEventExtraInfo);
|
|
744
|
-
}
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
function triggerEffect(effect2, debuggerEventExtraInfo) {
|
|
748
|
-
if (effect2 !== activeEffect || effect2.allowRecurse) {
|
|
749
|
-
if (effect2.onTrigger) {
|
|
750
|
-
effect2.onTrigger(extend({ effect: effect2 }, debuggerEventExtraInfo));
|
|
751
|
-
}
|
|
752
|
-
if (effect2.scheduler) {
|
|
753
|
-
effect2.scheduler();
|
|
754
|
-
} else {
|
|
755
|
-
effect2.run();
|
|
763
|
+
pauseScheduling();
|
|
764
|
+
for (const dep of deps) {
|
|
765
|
+
if (dep) {
|
|
766
|
+
triggerEffects(
|
|
767
|
+
dep,
|
|
768
|
+
3,
|
|
769
|
+
{
|
|
770
|
+
target,
|
|
771
|
+
type,
|
|
772
|
+
key,
|
|
773
|
+
newValue,
|
|
774
|
+
oldValue,
|
|
775
|
+
oldTarget
|
|
776
|
+
}
|
|
777
|
+
);
|
|
756
778
|
}
|
|
757
779
|
}
|
|
780
|
+
resetScheduling();
|
|
758
781
|
}
|
|
759
782
|
function getDepFromReactive(object, key) {
|
|
760
783
|
var _a;
|
|
@@ -785,7 +808,9 @@ function createArrayInstrumentations() {
|
|
|
785
808
|
["push", "pop", "shift", "unshift", "splice"].forEach((key) => {
|
|
786
809
|
instrumentations[key] = function(...args) {
|
|
787
810
|
pauseTracking();
|
|
811
|
+
pauseScheduling();
|
|
788
812
|
const res = toRaw(this)[key].apply(this, args);
|
|
813
|
+
resetScheduling();
|
|
789
814
|
resetTracking();
|
|
790
815
|
return res;
|
|
791
816
|
};
|
|
@@ -1324,30 +1349,93 @@ function markRaw(value) {
|
|
|
1324
1349
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
1325
1350
|
const toReadonly = (value) => isObject(value) ? readonly(value) : value;
|
|
1326
1351
|
|
|
1352
|
+
class ComputedRefImpl {
|
|
1353
|
+
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1354
|
+
this._setter = _setter;
|
|
1355
|
+
this.dep = void 0;
|
|
1356
|
+
this.__v_isRef = true;
|
|
1357
|
+
this["__v_isReadonly"] = false;
|
|
1358
|
+
this.effect = new ReactiveEffect(getter, () => {
|
|
1359
|
+
triggerRefValue(this, 1);
|
|
1360
|
+
});
|
|
1361
|
+
this.effect.computed = this;
|
|
1362
|
+
this.effect.active = this._cacheable = !isSSR;
|
|
1363
|
+
this["__v_isReadonly"] = isReadonly;
|
|
1364
|
+
}
|
|
1365
|
+
get value() {
|
|
1366
|
+
const self = toRaw(this);
|
|
1367
|
+
trackRefValue(self);
|
|
1368
|
+
if (!self._cacheable || self.effect.dirty) {
|
|
1369
|
+
if (hasChanged(self._value, self._value = self.effect.run())) {
|
|
1370
|
+
triggerRefValue(self, 2);
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
return self._value;
|
|
1374
|
+
}
|
|
1375
|
+
set value(newValue) {
|
|
1376
|
+
this._setter(newValue);
|
|
1377
|
+
}
|
|
1378
|
+
// #region polyfill _dirty for backward compatibility third party code for Vue <= 3.3.x
|
|
1379
|
+
get _dirty() {
|
|
1380
|
+
return this.effect.dirty;
|
|
1381
|
+
}
|
|
1382
|
+
set _dirty(v) {
|
|
1383
|
+
this.effect.dirty = v;
|
|
1384
|
+
}
|
|
1385
|
+
// #endregion
|
|
1386
|
+
}
|
|
1387
|
+
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1388
|
+
let getter;
|
|
1389
|
+
let setter;
|
|
1390
|
+
const onlyGetter = isFunction(getterOrOptions);
|
|
1391
|
+
if (onlyGetter) {
|
|
1392
|
+
getter = getterOrOptions;
|
|
1393
|
+
setter = () => {
|
|
1394
|
+
console.warn("Write operation failed: computed value is readonly");
|
|
1395
|
+
} ;
|
|
1396
|
+
} else {
|
|
1397
|
+
getter = getterOrOptions.get;
|
|
1398
|
+
setter = getterOrOptions.set;
|
|
1399
|
+
}
|
|
1400
|
+
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1401
|
+
if (debugOptions && !isSSR) {
|
|
1402
|
+
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1403
|
+
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1404
|
+
}
|
|
1405
|
+
return cRef;
|
|
1406
|
+
}
|
|
1407
|
+
|
|
1327
1408
|
function trackRefValue(ref2) {
|
|
1328
1409
|
if (shouldTrack && activeEffect) {
|
|
1329
1410
|
ref2 = toRaw(ref2);
|
|
1330
|
-
|
|
1331
|
-
|
|
1411
|
+
trackEffect(
|
|
1412
|
+
activeEffect,
|
|
1413
|
+
ref2.dep || (ref2.dep = createDep(
|
|
1414
|
+
() => ref2.dep = void 0,
|
|
1415
|
+
ref2 instanceof ComputedRefImpl ? ref2 : void 0
|
|
1416
|
+
)),
|
|
1417
|
+
{
|
|
1332
1418
|
target: ref2,
|
|
1333
1419
|
type: "get",
|
|
1334
1420
|
key: "value"
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1421
|
+
}
|
|
1422
|
+
);
|
|
1337
1423
|
}
|
|
1338
1424
|
}
|
|
1339
|
-
function triggerRefValue(ref2, newVal) {
|
|
1425
|
+
function triggerRefValue(ref2, dirtyLevel = 3, newVal) {
|
|
1340
1426
|
ref2 = toRaw(ref2);
|
|
1341
1427
|
const dep = ref2.dep;
|
|
1342
1428
|
if (dep) {
|
|
1343
|
-
|
|
1344
|
-
|
|
1429
|
+
triggerEffects(
|
|
1430
|
+
dep,
|
|
1431
|
+
dirtyLevel,
|
|
1432
|
+
{
|
|
1345
1433
|
target: ref2,
|
|
1346
1434
|
type: "set",
|
|
1347
1435
|
key: "value",
|
|
1348
1436
|
newValue: newVal
|
|
1349
|
-
}
|
|
1350
|
-
|
|
1437
|
+
}
|
|
1438
|
+
);
|
|
1351
1439
|
}
|
|
1352
1440
|
}
|
|
1353
1441
|
function isRef(r) {
|
|
@@ -1383,12 +1471,12 @@ class RefImpl {
|
|
|
1383
1471
|
if (hasChanged(newVal, this._rawValue)) {
|
|
1384
1472
|
this._rawValue = newVal;
|
|
1385
1473
|
this._value = useDirectValue ? newVal : toReactive(newVal);
|
|
1386
|
-
triggerRefValue(this, newVal);
|
|
1474
|
+
triggerRefValue(this, 3, newVal);
|
|
1387
1475
|
}
|
|
1388
1476
|
}
|
|
1389
1477
|
}
|
|
1390
1478
|
function triggerRef(ref2) {
|
|
1391
|
-
triggerRefValue(ref2, ref2.value );
|
|
1479
|
+
triggerRefValue(ref2, 3, ref2.value );
|
|
1392
1480
|
}
|
|
1393
1481
|
function unref(ref2) {
|
|
1394
1482
|
return isRef(ref2) ? ref2.value : ref2;
|
|
@@ -1486,57 +1574,6 @@ function propertyToRef(source, key, defaultValue) {
|
|
|
1486
1574
|
return isRef(val) ? val : new ObjectRefImpl(source, key, defaultValue);
|
|
1487
1575
|
}
|
|
1488
1576
|
|
|
1489
|
-
class ComputedRefImpl {
|
|
1490
|
-
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1491
|
-
this._setter = _setter;
|
|
1492
|
-
this.dep = void 0;
|
|
1493
|
-
this.__v_isRef = true;
|
|
1494
|
-
this["__v_isReadonly"] = false;
|
|
1495
|
-
this._dirty = true;
|
|
1496
|
-
this.effect = new ReactiveEffect(getter, () => {
|
|
1497
|
-
if (!this._dirty) {
|
|
1498
|
-
this._dirty = true;
|
|
1499
|
-
triggerRefValue(this);
|
|
1500
|
-
}
|
|
1501
|
-
});
|
|
1502
|
-
this.effect.computed = this;
|
|
1503
|
-
this.effect.active = this._cacheable = !isSSR;
|
|
1504
|
-
this["__v_isReadonly"] = isReadonly;
|
|
1505
|
-
}
|
|
1506
|
-
get value() {
|
|
1507
|
-
const self = toRaw(this);
|
|
1508
|
-
trackRefValue(self);
|
|
1509
|
-
if (self._dirty || !self._cacheable) {
|
|
1510
|
-
self._dirty = false;
|
|
1511
|
-
self._value = self.effect.run();
|
|
1512
|
-
}
|
|
1513
|
-
return self._value;
|
|
1514
|
-
}
|
|
1515
|
-
set value(newValue) {
|
|
1516
|
-
this._setter(newValue);
|
|
1517
|
-
}
|
|
1518
|
-
}
|
|
1519
|
-
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1520
|
-
let getter;
|
|
1521
|
-
let setter;
|
|
1522
|
-
const onlyGetter = isFunction(getterOrOptions);
|
|
1523
|
-
if (onlyGetter) {
|
|
1524
|
-
getter = getterOrOptions;
|
|
1525
|
-
setter = () => {
|
|
1526
|
-
console.warn("Write operation failed: computed value is readonly");
|
|
1527
|
-
} ;
|
|
1528
|
-
} else {
|
|
1529
|
-
getter = getterOrOptions.get;
|
|
1530
|
-
setter = getterOrOptions.set;
|
|
1531
|
-
}
|
|
1532
|
-
const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
|
|
1533
|
-
if (debugOptions && !isSSR) {
|
|
1534
|
-
cRef.effect.onTrack = debugOptions.onTrack;
|
|
1535
|
-
cRef.effect.onTrigger = debugOptions.onTrigger;
|
|
1536
|
-
}
|
|
1537
|
-
return cRef;
|
|
1538
|
-
}
|
|
1539
|
-
|
|
1540
1577
|
const stack = [];
|
|
1541
1578
|
function pushWarningContext(vnode) {
|
|
1542
1579
|
stack.push(vnode);
|
|
@@ -1651,7 +1688,7 @@ function assertNumber(val, type) {
|
|
|
1651
1688
|
}
|
|
1652
1689
|
}
|
|
1653
1690
|
|
|
1654
|
-
const ErrorTypeStrings = {
|
|
1691
|
+
const ErrorTypeStrings$1 = {
|
|
1655
1692
|
["sp"]: "serverPrefetch hook",
|
|
1656
1693
|
["bc"]: "beforeCreate hook",
|
|
1657
1694
|
["c"]: "created hook",
|
|
@@ -1712,7 +1749,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1712
1749
|
if (instance) {
|
|
1713
1750
|
let cur = instance.parent;
|
|
1714
1751
|
const exposedInstance = instance.proxy;
|
|
1715
|
-
const errorInfo = ErrorTypeStrings[type] ;
|
|
1752
|
+
const errorInfo = ErrorTypeStrings$1[type] ;
|
|
1716
1753
|
while (cur) {
|
|
1717
1754
|
const errorCapturedHooks = cur.ec;
|
|
1718
1755
|
if (errorCapturedHooks) {
|
|
@@ -1739,7 +1776,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1739
1776
|
}
|
|
1740
1777
|
function logError(err, type, contextVNode, throwInDev = true) {
|
|
1741
1778
|
{
|
|
1742
|
-
const info = ErrorTypeStrings[type];
|
|
1779
|
+
const info = ErrorTypeStrings$1[type];
|
|
1743
1780
|
if (contextVNode) {
|
|
1744
1781
|
pushWarningContext(contextVNode);
|
|
1745
1782
|
}
|
|
@@ -1967,6 +2004,7 @@ function rerender(id, newRender) {
|
|
|
1967
2004
|
}
|
|
1968
2005
|
instance.renderCache = [];
|
|
1969
2006
|
isHmrUpdating = true;
|
|
2007
|
+
instance.effect.dirty = true;
|
|
1970
2008
|
instance.update();
|
|
1971
2009
|
isHmrUpdating = false;
|
|
1972
2010
|
});
|
|
@@ -1994,6 +2032,7 @@ function reload(id, newComp) {
|
|
|
1994
2032
|
instance.ceReload(newComp.styles);
|
|
1995
2033
|
hmrDirtyComponents.delete(oldComp);
|
|
1996
2034
|
} else if (instance.parent) {
|
|
2035
|
+
instance.parent.effect.dirty = true;
|
|
1997
2036
|
queueJob(instance.parent.update);
|
|
1998
2037
|
} else if (instance.appContext.reload) {
|
|
1999
2038
|
instance.appContext.reload();
|
|
@@ -3689,8 +3728,15 @@ function watch(source, cb, options) {
|
|
|
3689
3728
|
}
|
|
3690
3729
|
return doWatch(source, cb, options);
|
|
3691
3730
|
}
|
|
3692
|
-
function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
3731
|
+
function doWatch(source, cb, { immediate, deep, flush, once, onTrack, onTrigger } = EMPTY_OBJ) {
|
|
3693
3732
|
var _a;
|
|
3733
|
+
if (cb && once) {
|
|
3734
|
+
const _cb = cb;
|
|
3735
|
+
cb = (...args) => {
|
|
3736
|
+
_cb(...args);
|
|
3737
|
+
unwatch();
|
|
3738
|
+
};
|
|
3739
|
+
}
|
|
3694
3740
|
if (!cb) {
|
|
3695
3741
|
if (immediate !== void 0) {
|
|
3696
3742
|
warn(
|
|
@@ -3702,6 +3748,11 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3702
3748
|
`watch() "deep" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3703
3749
|
);
|
|
3704
3750
|
}
|
|
3751
|
+
if (once !== void 0) {
|
|
3752
|
+
warn(
|
|
3753
|
+
`watch() "once" option is only respected when using the watch(source, callback, options?) signature.`
|
|
3754
|
+
);
|
|
3755
|
+
}
|
|
3705
3756
|
}
|
|
3706
3757
|
const warnInvalidSource = (s) => {
|
|
3707
3758
|
warn(
|
|
@@ -3798,7 +3849,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3798
3849
|
}
|
|
3799
3850
|
let oldValue = isMultiSource ? new Array(source.length).fill(INITIAL_WATCHER_VALUE) : INITIAL_WATCHER_VALUE;
|
|
3800
3851
|
const job = () => {
|
|
3801
|
-
if (!effect.active) {
|
|
3852
|
+
if (!effect.active || !effect.dirty) {
|
|
3802
3853
|
return;
|
|
3803
3854
|
}
|
|
3804
3855
|
if (cb) {
|
|
@@ -3831,7 +3882,13 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3831
3882
|
job.id = instance.uid;
|
|
3832
3883
|
scheduler = () => queueJob(job);
|
|
3833
3884
|
}
|
|
3834
|
-
const effect = new ReactiveEffect(getter, scheduler);
|
|
3885
|
+
const effect = new ReactiveEffect(getter, NOOP, scheduler);
|
|
3886
|
+
const unwatch = () => {
|
|
3887
|
+
effect.stop();
|
|
3888
|
+
if (instance && instance.scope) {
|
|
3889
|
+
remove(instance.scope.effects, effect);
|
|
3890
|
+
}
|
|
3891
|
+
};
|
|
3835
3892
|
{
|
|
3836
3893
|
effect.onTrack = onTrack;
|
|
3837
3894
|
effect.onTrigger = onTrigger;
|
|
@@ -3850,12 +3907,6 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3850
3907
|
} else {
|
|
3851
3908
|
effect.run();
|
|
3852
3909
|
}
|
|
3853
|
-
const unwatch = () => {
|
|
3854
|
-
effect.stop();
|
|
3855
|
-
if (instance && instance.scope) {
|
|
3856
|
-
remove(instance.scope.effects, effect);
|
|
3857
|
-
}
|
|
3858
|
-
};
|
|
3859
3910
|
if (ssrCleanup)
|
|
3860
3911
|
ssrCleanup.push(unwatch);
|
|
3861
3912
|
return unwatch;
|
|
@@ -4090,6 +4141,7 @@ const BaseTransitionImpl = {
|
|
|
4090
4141
|
leavingHooks.afterLeave = () => {
|
|
4091
4142
|
state.isLeaving = false;
|
|
4092
4143
|
if (instance.update.active !== false) {
|
|
4144
|
+
instance.effect.dirty = true;
|
|
4093
4145
|
instance.update();
|
|
4094
4146
|
}
|
|
4095
4147
|
};
|
|
@@ -4428,6 +4480,7 @@ function defineAsyncComponent(source) {
|
|
|
4428
4480
|
load().then(() => {
|
|
4429
4481
|
loaded.value = true;
|
|
4430
4482
|
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
4483
|
+
instance.parent.effect.dirty = true;
|
|
4431
4484
|
queueJob(instance.parent.update);
|
|
4432
4485
|
}
|
|
4433
4486
|
}).catch((err) => {
|
|
@@ -4731,7 +4784,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4731
4784
|
}
|
|
4732
4785
|
return wrappedHook;
|
|
4733
4786
|
} else {
|
|
4734
|
-
const apiName = toHandlerKey(ErrorTypeStrings[type].replace(/ hook$/, ""));
|
|
4787
|
+
const apiName = toHandlerKey(ErrorTypeStrings$1[type].replace(/ hook$/, ""));
|
|
4735
4788
|
warn(
|
|
4736
4789
|
`${apiName} is called when there is no active component instance to be associated with. Lifecycle injection APIs can only be used during execution of setup().` + (` If you are using async setup(), make sure to register lifecycle hooks before the first await statement.` )
|
|
4737
4790
|
);
|
|
@@ -5453,7 +5506,10 @@ const publicPropertiesMap = (
|
|
|
5453
5506
|
$root: (i) => getPublicInstance(i.root),
|
|
5454
5507
|
$emit: (i) => i.emit,
|
|
5455
5508
|
$options: (i) => resolveMergedOptions(i) ,
|
|
5456
|
-
$forceUpdate: (i) => i.f || (i.f = () =>
|
|
5509
|
+
$forceUpdate: (i) => i.f || (i.f = () => {
|
|
5510
|
+
i.effect.dirty = true;
|
|
5511
|
+
queueJob(i.update);
|
|
5512
|
+
}),
|
|
5457
5513
|
$nextTick: (i) => i.n || (i.n = nextTick.bind(i.proxy)),
|
|
5458
5514
|
$watch: (i) => instanceWatch.bind(i)
|
|
5459
5515
|
})
|
|
@@ -6354,7 +6410,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
|
|
|
6354
6410
|
return vm;
|
|
6355
6411
|
}
|
|
6356
6412
|
}
|
|
6357
|
-
Vue.version = `2.6.14-compat:${"3.
|
|
6413
|
+
Vue.version = `2.6.14-compat:${"3.4.0-alpha.1"}`;
|
|
6358
6414
|
Vue.config = singletonApp.config;
|
|
6359
6415
|
Vue.use = (p, ...options) => {
|
|
6360
6416
|
if (p && isFunction(p.install)) {
|
|
@@ -8760,6 +8816,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8760
8816
|
} else {
|
|
8761
8817
|
instance.next = n2;
|
|
8762
8818
|
invalidateJob(instance.update);
|
|
8819
|
+
instance.effect.dirty = true;
|
|
8763
8820
|
instance.update();
|
|
8764
8821
|
}
|
|
8765
8822
|
} else {
|
|
@@ -8953,11 +9010,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8953
9010
|
};
|
|
8954
9011
|
const effect = instance.effect = new ReactiveEffect(
|
|
8955
9012
|
componentUpdateFn,
|
|
9013
|
+
NOOP,
|
|
8956
9014
|
() => queueJob(update),
|
|
8957
9015
|
instance.scope
|
|
8958
9016
|
// track it in component's effect scope
|
|
8959
9017
|
);
|
|
8960
|
-
const update = instance.update = () =>
|
|
9018
|
+
const update = instance.update = () => {
|
|
9019
|
+
if (effect.dirty) {
|
|
9020
|
+
effect.run();
|
|
9021
|
+
}
|
|
9022
|
+
};
|
|
8961
9023
|
update.id = instance.uid;
|
|
8962
9024
|
toggleRecurse(instance, true);
|
|
8963
9025
|
{
|
|
@@ -10941,7 +11003,8 @@ function isMemoSame(cached, memo) {
|
|
|
10941
11003
|
return true;
|
|
10942
11004
|
}
|
|
10943
11005
|
|
|
10944
|
-
const version = "3.
|
|
11006
|
+
const version = "3.4.0-alpha.1";
|
|
11007
|
+
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
10945
11008
|
const _ssrUtils = {
|
|
10946
11009
|
createComponentInstance,
|
|
10947
11010
|
setupComponent,
|
|
@@ -12578,6 +12641,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
|
|
|
12578
12641
|
BaseTransitionPropsValidators: BaseTransitionPropsValidators,
|
|
12579
12642
|
Comment: Comment,
|
|
12580
12643
|
EffectScope: EffectScope,
|
|
12644
|
+
ErrorTypeStrings: ErrorTypeStrings,
|
|
12581
12645
|
Fragment: Fragment,
|
|
12582
12646
|
KeepAlive: KeepAlive,
|
|
12583
12647
|
ReactiveEffect: ReactiveEffect,
|