@vue/runtime-dom 3.2.35 → 3.2.38
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 +7 -7
- package/dist/runtime-dom.cjs.prod.js +7 -7
- package/dist/runtime-dom.esm-browser.js +404 -372
- package/dist/runtime-dom.esm-browser.prod.js +1 -1
- package/dist/runtime-dom.esm-bundler.js +9 -9
- package/dist/runtime-dom.global.js +404 -372
- package/dist/runtime-dom.global.prod.js +1 -1
- package/package.json +3 -3
|
@@ -638,7 +638,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
638
638
|
return;
|
|
639
639
|
}
|
|
640
640
|
let deps = [];
|
|
641
|
-
if (type === "clear" /* CLEAR */) {
|
|
641
|
+
if (type === "clear" /* TriggerOpTypes.CLEAR */) {
|
|
642
642
|
// collection being cleared
|
|
643
643
|
// trigger all effects for target
|
|
644
644
|
deps = [...depsMap.values()];
|
|
@@ -657,7 +657,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
657
657
|
}
|
|
658
658
|
// also run for iteration key on ADD | DELETE | Map.SET
|
|
659
659
|
switch (type) {
|
|
660
|
-
case "add" /* ADD */:
|
|
660
|
+
case "add" /* TriggerOpTypes.ADD */:
|
|
661
661
|
if (!isArray(target)) {
|
|
662
662
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
663
663
|
if (isMap(target)) {
|
|
@@ -669,7 +669,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
669
669
|
deps.push(depsMap.get('length'));
|
|
670
670
|
}
|
|
671
671
|
break;
|
|
672
|
-
case "delete" /* DELETE */:
|
|
672
|
+
case "delete" /* TriggerOpTypes.DELETE */:
|
|
673
673
|
if (!isArray(target)) {
|
|
674
674
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
675
675
|
if (isMap(target)) {
|
|
@@ -677,7 +677,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
break;
|
|
680
|
-
case "set" /* SET */:
|
|
680
|
+
case "set" /* TriggerOpTypes.SET */:
|
|
681
681
|
if (isMap(target)) {
|
|
682
682
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
683
683
|
}
|
|
@@ -754,7 +754,7 @@ function createArrayInstrumentations() {
|
|
|
754
754
|
instrumentations[key] = function (...args) {
|
|
755
755
|
const arr = toRaw(this);
|
|
756
756
|
for (let i = 0, l = this.length; i < l; i++) {
|
|
757
|
-
track(arr, "get" /* GET */, i + '');
|
|
757
|
+
track(arr, "get" /* TrackOpTypes.GET */, i + '');
|
|
758
758
|
}
|
|
759
759
|
// we run the method using the original args first (which may be reactive)
|
|
760
760
|
const res = arr[key](...args);
|
|
@@ -779,16 +779,16 @@ function createArrayInstrumentations() {
|
|
|
779
779
|
}
|
|
780
780
|
function createGetter(isReadonly = false, shallow = false) {
|
|
781
781
|
return function get(target, key, receiver) {
|
|
782
|
-
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
|
782
|
+
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
783
783
|
return !isReadonly;
|
|
784
784
|
}
|
|
785
|
-
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
|
785
|
+
else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
|
|
786
786
|
return isReadonly;
|
|
787
787
|
}
|
|
788
|
-
else if (key === "__v_isShallow" /* IS_SHALLOW */) {
|
|
788
|
+
else if (key === "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */) {
|
|
789
789
|
return shallow;
|
|
790
790
|
}
|
|
791
|
-
else if (key === "__v_raw" /* RAW */ &&
|
|
791
|
+
else if (key === "__v_raw" /* ReactiveFlags.RAW */ &&
|
|
792
792
|
receiver ===
|
|
793
793
|
(isReadonly
|
|
794
794
|
? shallow
|
|
@@ -808,7 +808,7 @@ function createGetter(isReadonly = false, shallow = false) {
|
|
|
808
808
|
return res;
|
|
809
809
|
}
|
|
810
810
|
if (!isReadonly) {
|
|
811
|
-
track(target, "get" /* GET */, key);
|
|
811
|
+
track(target, "get" /* TrackOpTypes.GET */, key);
|
|
812
812
|
}
|
|
813
813
|
if (shallow) {
|
|
814
814
|
return res;
|
|
@@ -834,10 +834,10 @@ function createSetter(shallow = false) {
|
|
|
834
834
|
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
835
835
|
return false;
|
|
836
836
|
}
|
|
837
|
-
if (!shallow
|
|
838
|
-
if (!isShallow(value)) {
|
|
839
|
-
value = toRaw(value);
|
|
837
|
+
if (!shallow) {
|
|
838
|
+
if (!isShallow(value) && !isReadonly(value)) {
|
|
840
839
|
oldValue = toRaw(oldValue);
|
|
840
|
+
value = toRaw(value);
|
|
841
841
|
}
|
|
842
842
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
843
843
|
oldValue.value = value;
|
|
@@ -851,10 +851,10 @@ function createSetter(shallow = false) {
|
|
|
851
851
|
// don't trigger if target is something up in the prototype chain of original
|
|
852
852
|
if (target === toRaw(receiver)) {
|
|
853
853
|
if (!hadKey) {
|
|
854
|
-
trigger(target, "add" /* ADD */, key, value);
|
|
854
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
|
|
855
855
|
}
|
|
856
856
|
else if (hasChanged(value, oldValue)) {
|
|
857
|
-
trigger(target, "set" /* SET */, key, value, oldValue);
|
|
857
|
+
trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
|
|
858
858
|
}
|
|
859
859
|
}
|
|
860
860
|
return result;
|
|
@@ -865,19 +865,19 @@ function deleteProperty(target, key) {
|
|
|
865
865
|
const oldValue = target[key];
|
|
866
866
|
const result = Reflect.deleteProperty(target, key);
|
|
867
867
|
if (result && hadKey) {
|
|
868
|
-
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
|
868
|
+
trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
|
|
869
869
|
}
|
|
870
870
|
return result;
|
|
871
871
|
}
|
|
872
872
|
function has(target, key) {
|
|
873
873
|
const result = Reflect.has(target, key);
|
|
874
874
|
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
875
|
-
track(target, "has" /* HAS */, key);
|
|
875
|
+
track(target, "has" /* TrackOpTypes.HAS */, key);
|
|
876
876
|
}
|
|
877
877
|
return result;
|
|
878
878
|
}
|
|
879
879
|
function ownKeys(target) {
|
|
880
|
-
track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
|
880
|
+
track(target, "iterate" /* TrackOpTypes.ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
|
881
881
|
return Reflect.ownKeys(target);
|
|
882
882
|
}
|
|
883
883
|
const mutableHandlers = {
|
|
@@ -918,14 +918,14 @@ const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
|
918
918
|
function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
919
919
|
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
|
920
920
|
// of the value
|
|
921
|
-
target = target["__v_raw" /* RAW */];
|
|
921
|
+
target = target["__v_raw" /* ReactiveFlags.RAW */];
|
|
922
922
|
const rawTarget = toRaw(target);
|
|
923
923
|
const rawKey = toRaw(key);
|
|
924
924
|
if (!isReadonly) {
|
|
925
925
|
if (key !== rawKey) {
|
|
926
|
-
track(rawTarget, "get" /* GET */, key);
|
|
926
|
+
track(rawTarget, "get" /* TrackOpTypes.GET */, key);
|
|
927
927
|
}
|
|
928
|
-
track(rawTarget, "get" /* GET */, rawKey);
|
|
928
|
+
track(rawTarget, "get" /* TrackOpTypes.GET */, rawKey);
|
|
929
929
|
}
|
|
930
930
|
const { has } = getProto(rawTarget);
|
|
931
931
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
@@ -942,22 +942,22 @@ function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
|
942
942
|
}
|
|
943
943
|
}
|
|
944
944
|
function has$1(key, isReadonly = false) {
|
|
945
|
-
const target = this["__v_raw" /* RAW */];
|
|
945
|
+
const target = this["__v_raw" /* ReactiveFlags.RAW */];
|
|
946
946
|
const rawTarget = toRaw(target);
|
|
947
947
|
const rawKey = toRaw(key);
|
|
948
948
|
if (!isReadonly) {
|
|
949
949
|
if (key !== rawKey) {
|
|
950
|
-
track(rawTarget, "has" /* HAS */, key);
|
|
950
|
+
track(rawTarget, "has" /* TrackOpTypes.HAS */, key);
|
|
951
951
|
}
|
|
952
|
-
track(rawTarget, "has" /* HAS */, rawKey);
|
|
952
|
+
track(rawTarget, "has" /* TrackOpTypes.HAS */, rawKey);
|
|
953
953
|
}
|
|
954
954
|
return key === rawKey
|
|
955
955
|
? target.has(key)
|
|
956
956
|
: target.has(key) || target.has(rawKey);
|
|
957
957
|
}
|
|
958
958
|
function size(target, isReadonly = false) {
|
|
959
|
-
target = target["__v_raw" /* RAW */];
|
|
960
|
-
!isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
|
|
959
|
+
target = target["__v_raw" /* ReactiveFlags.RAW */];
|
|
960
|
+
!isReadonly && track(toRaw(target), "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
|
|
961
961
|
return Reflect.get(target, 'size', target);
|
|
962
962
|
}
|
|
963
963
|
function add(value) {
|
|
@@ -967,7 +967,7 @@ function add(value) {
|
|
|
967
967
|
const hadKey = proto.has.call(target, value);
|
|
968
968
|
if (!hadKey) {
|
|
969
969
|
target.add(value);
|
|
970
|
-
trigger(target, "add" /* ADD */, value, value);
|
|
970
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, value, value);
|
|
971
971
|
}
|
|
972
972
|
return this;
|
|
973
973
|
}
|
|
@@ -986,10 +986,10 @@ function set$1(key, value) {
|
|
|
986
986
|
const oldValue = get.call(target, key);
|
|
987
987
|
target.set(key, value);
|
|
988
988
|
if (!hadKey) {
|
|
989
|
-
trigger(target, "add" /* ADD */, key, value);
|
|
989
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
|
|
990
990
|
}
|
|
991
991
|
else if (hasChanged(value, oldValue)) {
|
|
992
|
-
trigger(target, "set" /* SET */, key, value, oldValue);
|
|
992
|
+
trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
|
|
993
993
|
}
|
|
994
994
|
return this;
|
|
995
995
|
}
|
|
@@ -1008,7 +1008,7 @@ function deleteEntry(key) {
|
|
|
1008
1008
|
// forward the operation before queueing reactions
|
|
1009
1009
|
const result = target.delete(key);
|
|
1010
1010
|
if (hadKey) {
|
|
1011
|
-
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
|
1011
|
+
trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
|
|
1012
1012
|
}
|
|
1013
1013
|
return result;
|
|
1014
1014
|
}
|
|
@@ -1022,17 +1022,17 @@ function clear() {
|
|
|
1022
1022
|
// forward the operation before queueing reactions
|
|
1023
1023
|
const result = target.clear();
|
|
1024
1024
|
if (hadItems) {
|
|
1025
|
-
trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
|
|
1025
|
+
trigger(target, "clear" /* TriggerOpTypes.CLEAR */, undefined, undefined, oldTarget);
|
|
1026
1026
|
}
|
|
1027
1027
|
return result;
|
|
1028
1028
|
}
|
|
1029
1029
|
function createForEach(isReadonly, isShallow) {
|
|
1030
1030
|
return function forEach(callback, thisArg) {
|
|
1031
1031
|
const observed = this;
|
|
1032
|
-
const target = observed["__v_raw" /* RAW */];
|
|
1032
|
+
const target = observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
1033
1033
|
const rawTarget = toRaw(target);
|
|
1034
1034
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
1035
|
-
!isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
|
|
1035
|
+
!isReadonly && track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
|
|
1036
1036
|
return target.forEach((value, key) => {
|
|
1037
1037
|
// important: make sure the callback is
|
|
1038
1038
|
// 1. invoked with the reactive map as `this` and 3rd arg
|
|
@@ -1043,7 +1043,7 @@ function createForEach(isReadonly, isShallow) {
|
|
|
1043
1043
|
}
|
|
1044
1044
|
function createIterableMethod(method, isReadonly, isShallow) {
|
|
1045
1045
|
return function (...args) {
|
|
1046
|
-
const target = this["__v_raw" /* RAW */];
|
|
1046
|
+
const target = this["__v_raw" /* ReactiveFlags.RAW */];
|
|
1047
1047
|
const rawTarget = toRaw(target);
|
|
1048
1048
|
const targetIsMap = isMap(rawTarget);
|
|
1049
1049
|
const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
|
@@ -1051,7 +1051,7 @@ function createIterableMethod(method, isReadonly, isShallow) {
|
|
|
1051
1051
|
const innerIterator = target[method](...args);
|
|
1052
1052
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
1053
1053
|
!isReadonly &&
|
|
1054
|
-
track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
1054
|
+
track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
1055
1055
|
// return a wrapped iterator which returns observed versions of the
|
|
1056
1056
|
// values emitted from the real iterator
|
|
1057
1057
|
return {
|
|
@@ -1078,7 +1078,7 @@ function createReadonlyMethod(type) {
|
|
|
1078
1078
|
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
1079
1079
|
console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
|
1080
1080
|
}
|
|
1081
|
-
return type === "delete" /* DELETE */ ? false : this;
|
|
1081
|
+
return type === "delete" /* TriggerOpTypes.DELETE */ ? false : this;
|
|
1082
1082
|
};
|
|
1083
1083
|
}
|
|
1084
1084
|
function createInstrumentations() {
|
|
@@ -1120,10 +1120,10 @@ function createInstrumentations() {
|
|
|
1120
1120
|
has(key) {
|
|
1121
1121
|
return has$1.call(this, key, true);
|
|
1122
1122
|
},
|
|
1123
|
-
add: createReadonlyMethod("add" /* ADD */),
|
|
1124
|
-
set: createReadonlyMethod("set" /* SET */),
|
|
1125
|
-
delete: createReadonlyMethod("delete" /* DELETE */),
|
|
1126
|
-
clear: createReadonlyMethod("clear" /* CLEAR */),
|
|
1123
|
+
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
1124
|
+
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
1125
|
+
delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
|
|
1126
|
+
clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
|
|
1127
1127
|
forEach: createForEach(true, false)
|
|
1128
1128
|
};
|
|
1129
1129
|
const shallowReadonlyInstrumentations = {
|
|
@@ -1136,10 +1136,10 @@ function createInstrumentations() {
|
|
|
1136
1136
|
has(key) {
|
|
1137
1137
|
return has$1.call(this, key, true);
|
|
1138
1138
|
},
|
|
1139
|
-
add: createReadonlyMethod("add" /* ADD */),
|
|
1140
|
-
set: createReadonlyMethod("set" /* SET */),
|
|
1141
|
-
delete: createReadonlyMethod("delete" /* DELETE */),
|
|
1142
|
-
clear: createReadonlyMethod("clear" /* CLEAR */),
|
|
1139
|
+
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
1140
|
+
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
1141
|
+
delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
|
|
1142
|
+
clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
|
|
1143
1143
|
forEach: createForEach(true, true)
|
|
1144
1144
|
};
|
|
1145
1145
|
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
|
@@ -1166,13 +1166,13 @@ function createInstrumentationGetter(isReadonly, shallow) {
|
|
|
1166
1166
|
? readonlyInstrumentations
|
|
1167
1167
|
: mutableInstrumentations;
|
|
1168
1168
|
return (target, key, receiver) => {
|
|
1169
|
-
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
|
1169
|
+
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
1170
1170
|
return !isReadonly;
|
|
1171
1171
|
}
|
|
1172
|
-
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
|
1172
|
+
else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
|
|
1173
1173
|
return isReadonly;
|
|
1174
1174
|
}
|
|
1175
|
-
else if (key === "__v_raw" /* RAW */) {
|
|
1175
|
+
else if (key === "__v_raw" /* ReactiveFlags.RAW */) {
|
|
1176
1176
|
return target;
|
|
1177
1177
|
}
|
|
1178
1178
|
return Reflect.get(hasOwn(instrumentations, key) && key in target
|
|
@@ -1212,19 +1212,19 @@ function targetTypeMap(rawType) {
|
|
|
1212
1212
|
switch (rawType) {
|
|
1213
1213
|
case 'Object':
|
|
1214
1214
|
case 'Array':
|
|
1215
|
-
return 1 /* COMMON */;
|
|
1215
|
+
return 1 /* TargetType.COMMON */;
|
|
1216
1216
|
case 'Map':
|
|
1217
1217
|
case 'Set':
|
|
1218
1218
|
case 'WeakMap':
|
|
1219
1219
|
case 'WeakSet':
|
|
1220
|
-
return 2 /* COLLECTION */;
|
|
1220
|
+
return 2 /* TargetType.COLLECTION */;
|
|
1221
1221
|
default:
|
|
1222
|
-
return 0 /* INVALID */;
|
|
1222
|
+
return 0 /* TargetType.INVALID */;
|
|
1223
1223
|
}
|
|
1224
1224
|
}
|
|
1225
1225
|
function getTargetType(value) {
|
|
1226
|
-
return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
|
|
1227
|
-
? 0 /* INVALID */
|
|
1226
|
+
return value["__v_skip" /* ReactiveFlags.SKIP */] || !Object.isExtensible(value)
|
|
1227
|
+
? 0 /* TargetType.INVALID */
|
|
1228
1228
|
: targetTypeMap(toRawType(value));
|
|
1229
1229
|
}
|
|
1230
1230
|
function reactive(target) {
|
|
@@ -1267,8 +1267,8 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1267
1267
|
}
|
|
1268
1268
|
// target is already a Proxy, return it.
|
|
1269
1269
|
// exception: calling readonly() on a reactive object
|
|
1270
|
-
if (target["__v_raw" /* RAW */] &&
|
|
1271
|
-
!(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
|
|
1270
|
+
if (target["__v_raw" /* ReactiveFlags.RAW */] &&
|
|
1271
|
+
!(isReadonly && target["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */])) {
|
|
1272
1272
|
return target;
|
|
1273
1273
|
}
|
|
1274
1274
|
// target already has corresponding Proxy
|
|
@@ -1278,34 +1278,34 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1278
1278
|
}
|
|
1279
1279
|
// only specific value types can be observed.
|
|
1280
1280
|
const targetType = getTargetType(target);
|
|
1281
|
-
if (targetType === 0 /* INVALID */) {
|
|
1281
|
+
if (targetType === 0 /* TargetType.INVALID */) {
|
|
1282
1282
|
return target;
|
|
1283
1283
|
}
|
|
1284
|
-
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
|
1284
|
+
const proxy = new Proxy(target, targetType === 2 /* TargetType.COLLECTION */ ? collectionHandlers : baseHandlers);
|
|
1285
1285
|
proxyMap.set(target, proxy);
|
|
1286
1286
|
return proxy;
|
|
1287
1287
|
}
|
|
1288
1288
|
function isReactive(value) {
|
|
1289
1289
|
if (isReadonly(value)) {
|
|
1290
|
-
return isReactive(value["__v_raw" /* RAW */]);
|
|
1290
|
+
return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
|
|
1291
1291
|
}
|
|
1292
|
-
return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
|
|
1292
|
+
return !!(value && value["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */]);
|
|
1293
1293
|
}
|
|
1294
1294
|
function isReadonly(value) {
|
|
1295
|
-
return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
|
|
1295
|
+
return !!(value && value["__v_isReadonly" /* ReactiveFlags.IS_READONLY */]);
|
|
1296
1296
|
}
|
|
1297
1297
|
function isShallow(value) {
|
|
1298
|
-
return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
|
|
1298
|
+
return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
|
|
1299
1299
|
}
|
|
1300
1300
|
function isProxy(value) {
|
|
1301
1301
|
return isReactive(value) || isReadonly(value);
|
|
1302
1302
|
}
|
|
1303
1303
|
function toRaw(observed) {
|
|
1304
|
-
const raw = observed && observed["__v_raw" /* RAW */];
|
|
1304
|
+
const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
1305
1305
|
return raw ? toRaw(raw) : observed;
|
|
1306
1306
|
}
|
|
1307
1307
|
function markRaw(value) {
|
|
1308
|
-
def(value, "__v_skip" /* SKIP */, true);
|
|
1308
|
+
def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
|
|
1309
1309
|
return value;
|
|
1310
1310
|
}
|
|
1311
1311
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
@@ -1317,7 +1317,7 @@ function trackRefValue(ref) {
|
|
|
1317
1317
|
{
|
|
1318
1318
|
trackEffects(ref.dep || (ref.dep = createDep()), {
|
|
1319
1319
|
target: ref,
|
|
1320
|
-
type: "get" /* GET */,
|
|
1320
|
+
type: "get" /* TrackOpTypes.GET */,
|
|
1321
1321
|
key: 'value'
|
|
1322
1322
|
});
|
|
1323
1323
|
}
|
|
@@ -1329,7 +1329,7 @@ function triggerRefValue(ref, newVal) {
|
|
|
1329
1329
|
{
|
|
1330
1330
|
triggerEffects(ref.dep, {
|
|
1331
1331
|
target: ref,
|
|
1332
|
-
type: "set" /* SET */,
|
|
1332
|
+
type: "set" /* TriggerOpTypes.SET */,
|
|
1333
1333
|
key: 'value',
|
|
1334
1334
|
newValue: newVal
|
|
1335
1335
|
});
|
|
@@ -1364,10 +1364,11 @@ class RefImpl {
|
|
|
1364
1364
|
return this._value;
|
|
1365
1365
|
}
|
|
1366
1366
|
set value(newVal) {
|
|
1367
|
-
|
|
1367
|
+
const useDirectValue = this.__v_isShallow || isShallow(newVal) || isReadonly(newVal);
|
|
1368
|
+
newVal = useDirectValue ? newVal : toRaw(newVal);
|
|
1368
1369
|
if (hasChanged(newVal, this._rawValue)) {
|
|
1369
1370
|
this._rawValue = newVal;
|
|
1370
|
-
this._value =
|
|
1371
|
+
this._value = useDirectValue ? newVal : toReactive(newVal);
|
|
1371
1372
|
triggerRefValue(this, newVal);
|
|
1372
1373
|
}
|
|
1373
1374
|
}
|
|
@@ -1446,11 +1447,13 @@ function toRef(object, key, defaultValue) {
|
|
|
1446
1447
|
: new ObjectRefImpl(object, key, defaultValue);
|
|
1447
1448
|
}
|
|
1448
1449
|
|
|
1450
|
+
var _a;
|
|
1449
1451
|
class ComputedRefImpl {
|
|
1450
1452
|
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1451
1453
|
this._setter = _setter;
|
|
1452
1454
|
this.dep = undefined;
|
|
1453
1455
|
this.__v_isRef = true;
|
|
1456
|
+
this[_a] = false;
|
|
1454
1457
|
this._dirty = true;
|
|
1455
1458
|
this.effect = new ReactiveEffect(getter, () => {
|
|
1456
1459
|
if (!this._dirty) {
|
|
@@ -1460,7 +1463,7 @@ class ComputedRefImpl {
|
|
|
1460
1463
|
});
|
|
1461
1464
|
this.effect.computed = this;
|
|
1462
1465
|
this.effect.active = this._cacheable = !isSSR;
|
|
1463
|
-
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
|
1466
|
+
this["__v_isReadonly" /* ReactiveFlags.IS_READONLY */] = isReadonly;
|
|
1464
1467
|
}
|
|
1465
1468
|
get value() {
|
|
1466
1469
|
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
|
|
@@ -1476,6 +1479,7 @@ class ComputedRefImpl {
|
|
|
1476
1479
|
this._setter(newValue);
|
|
1477
1480
|
}
|
|
1478
1481
|
}
|
|
1482
|
+
_a = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
|
|
1479
1483
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1480
1484
|
let getter;
|
|
1481
1485
|
let setter;
|
|
@@ -1514,7 +1518,7 @@ function warn$1(msg, ...args) {
|
|
|
1514
1518
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1515
1519
|
const trace = getComponentTrace();
|
|
1516
1520
|
if (appWarnHandler) {
|
|
1517
|
-
callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
|
|
1521
|
+
callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
|
|
1518
1522
|
msg + args.join(''),
|
|
1519
1523
|
instance && instance.proxy,
|
|
1520
1524
|
trace
|
|
@@ -1614,35 +1618,35 @@ function formatProp(key, value, raw) {
|
|
|
1614
1618
|
}
|
|
1615
1619
|
|
|
1616
1620
|
const ErrorTypeStrings = {
|
|
1617
|
-
["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
1618
|
-
["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
|
|
1619
|
-
["c" /* CREATED */]: 'created hook',
|
|
1620
|
-
["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
|
|
1621
|
-
["m" /* MOUNTED */]: 'mounted hook',
|
|
1622
|
-
["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
1623
|
-
["u" /* UPDATED */]: 'updated',
|
|
1624
|
-
["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
1625
|
-
["um" /* UNMOUNTED */]: 'unmounted hook',
|
|
1626
|
-
["a" /* ACTIVATED */]: 'activated hook',
|
|
1627
|
-
["da" /* DEACTIVATED */]: 'deactivated hook',
|
|
1628
|
-
["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
1629
|
-
["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
|
|
1630
|
-
["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
1631
|
-
[0 /* SETUP_FUNCTION */]: 'setup function',
|
|
1632
|
-
[1 /* RENDER_FUNCTION */]: 'render function',
|
|
1633
|
-
[2 /* WATCH_GETTER */]: 'watcher getter',
|
|
1634
|
-
[3 /* WATCH_CALLBACK */]: 'watcher callback',
|
|
1635
|
-
[4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
1636
|
-
[5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
1637
|
-
[6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
1638
|
-
[7 /* VNODE_HOOK */]: 'vnode hook',
|
|
1639
|
-
[8 /* DIRECTIVE_HOOK */]: 'directive hook',
|
|
1640
|
-
[9 /* TRANSITION_HOOK */]: 'transition hook',
|
|
1641
|
-
[10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
1642
|
-
[11 /* APP_WARN_HANDLER */]: 'app warnHandler',
|
|
1643
|
-
[12 /* FUNCTION_REF */]: 'ref function',
|
|
1644
|
-
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
1645
|
-
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
1621
|
+
["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
1622
|
+
["bc" /* LifecycleHooks.BEFORE_CREATE */]: 'beforeCreate hook',
|
|
1623
|
+
["c" /* LifecycleHooks.CREATED */]: 'created hook',
|
|
1624
|
+
["bm" /* LifecycleHooks.BEFORE_MOUNT */]: 'beforeMount hook',
|
|
1625
|
+
["m" /* LifecycleHooks.MOUNTED */]: 'mounted hook',
|
|
1626
|
+
["bu" /* LifecycleHooks.BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
1627
|
+
["u" /* LifecycleHooks.UPDATED */]: 'updated',
|
|
1628
|
+
["bum" /* LifecycleHooks.BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
1629
|
+
["um" /* LifecycleHooks.UNMOUNTED */]: 'unmounted hook',
|
|
1630
|
+
["a" /* LifecycleHooks.ACTIVATED */]: 'activated hook',
|
|
1631
|
+
["da" /* LifecycleHooks.DEACTIVATED */]: 'deactivated hook',
|
|
1632
|
+
["ec" /* LifecycleHooks.ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
1633
|
+
["rtc" /* LifecycleHooks.RENDER_TRACKED */]: 'renderTracked hook',
|
|
1634
|
+
["rtg" /* LifecycleHooks.RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
1635
|
+
[0 /* ErrorCodes.SETUP_FUNCTION */]: 'setup function',
|
|
1636
|
+
[1 /* ErrorCodes.RENDER_FUNCTION */]: 'render function',
|
|
1637
|
+
[2 /* ErrorCodes.WATCH_GETTER */]: 'watcher getter',
|
|
1638
|
+
[3 /* ErrorCodes.WATCH_CALLBACK */]: 'watcher callback',
|
|
1639
|
+
[4 /* ErrorCodes.WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
1640
|
+
[5 /* ErrorCodes.NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
1641
|
+
[6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
1642
|
+
[7 /* ErrorCodes.VNODE_HOOK */]: 'vnode hook',
|
|
1643
|
+
[8 /* ErrorCodes.DIRECTIVE_HOOK */]: 'directive hook',
|
|
1644
|
+
[9 /* ErrorCodes.TRANSITION_HOOK */]: 'transition hook',
|
|
1645
|
+
[10 /* ErrorCodes.APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
1646
|
+
[11 /* ErrorCodes.APP_WARN_HANDLER */]: 'app warnHandler',
|
|
1647
|
+
[12 /* ErrorCodes.FUNCTION_REF */]: 'ref function',
|
|
1648
|
+
[13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
1649
|
+
[14 /* ErrorCodes.SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
1646
1650
|
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
|
|
1647
1651
|
};
|
|
1648
1652
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
@@ -1693,7 +1697,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1693
1697
|
// app-level handling
|
|
1694
1698
|
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
1695
1699
|
if (appErrorHandler) {
|
|
1696
|
-
callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
1700
|
+
callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
1697
1701
|
return;
|
|
1698
1702
|
}
|
|
1699
1703
|
}
|
|
@@ -1723,15 +1727,11 @@ let isFlushing = false;
|
|
|
1723
1727
|
let isFlushPending = false;
|
|
1724
1728
|
const queue = [];
|
|
1725
1729
|
let flushIndex = 0;
|
|
1726
|
-
const pendingPreFlushCbs = [];
|
|
1727
|
-
let activePreFlushCbs = null;
|
|
1728
|
-
let preFlushIndex = 0;
|
|
1729
1730
|
const pendingPostFlushCbs = [];
|
|
1730
1731
|
let activePostFlushCbs = null;
|
|
1731
1732
|
let postFlushIndex = 0;
|
|
1732
1733
|
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
1733
1734
|
let currentFlushPromise = null;
|
|
1734
|
-
let currentPreFlushParentJob = null;
|
|
1735
1735
|
const RECURSION_LIMIT = 100;
|
|
1736
1736
|
function nextTick(fn) {
|
|
1737
1737
|
const p = currentFlushPromise || resolvedPromise;
|
|
@@ -1759,9 +1759,8 @@ function queueJob(job) {
|
|
|
1759
1759
|
// if the job is a watch() callback, the search will start with a +1 index to
|
|
1760
1760
|
// allow it recursively trigger itself - it is the user's responsibility to
|
|
1761
1761
|
// ensure it doesn't end up in an infinite loop.
|
|
1762
|
-
if (
|
|
1763
|
-
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex))
|
|
1764
|
-
job !== currentPreFlushParentJob) {
|
|
1762
|
+
if (!queue.length ||
|
|
1763
|
+
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
|
|
1765
1764
|
if (job.id == null) {
|
|
1766
1765
|
queue.push(job);
|
|
1767
1766
|
}
|
|
@@ -1783,51 +1782,38 @@ function invalidateJob(job) {
|
|
|
1783
1782
|
queue.splice(i, 1);
|
|
1784
1783
|
}
|
|
1785
1784
|
}
|
|
1786
|
-
function
|
|
1785
|
+
function queuePostFlushCb(cb) {
|
|
1787
1786
|
if (!isArray(cb)) {
|
|
1788
|
-
if (!
|
|
1789
|
-
!
|
|
1790
|
-
|
|
1787
|
+
if (!activePostFlushCbs ||
|
|
1788
|
+
!activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
|
|
1789
|
+
pendingPostFlushCbs.push(cb);
|
|
1791
1790
|
}
|
|
1792
1791
|
}
|
|
1793
1792
|
else {
|
|
1794
1793
|
// if cb is an array, it is a component lifecycle hook which can only be
|
|
1795
1794
|
// triggered by a job, which is already deduped in the main queue, so
|
|
1796
1795
|
// we can skip duplicate check here to improve perf
|
|
1797
|
-
|
|
1796
|
+
pendingPostFlushCbs.push(...cb);
|
|
1798
1797
|
}
|
|
1799
1798
|
queueFlush();
|
|
1800
1799
|
}
|
|
1801
|
-
function
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
currentPreFlushParentJob = parentJob;
|
|
1810
|
-
activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
|
|
1811
|
-
pendingPreFlushCbs.length = 0;
|
|
1812
|
-
{
|
|
1813
|
-
seen = seen || new Map();
|
|
1814
|
-
}
|
|
1815
|
-
for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
|
1816
|
-
if (checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])) {
|
|
1800
|
+
function flushPreFlushCbs(seen, i = flushIndex) {
|
|
1801
|
+
{
|
|
1802
|
+
seen = seen || new Map();
|
|
1803
|
+
}
|
|
1804
|
+
for (; i < queue.length; i++) {
|
|
1805
|
+
const cb = queue[i];
|
|
1806
|
+
if (cb && cb.pre) {
|
|
1807
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
1817
1808
|
continue;
|
|
1818
1809
|
}
|
|
1819
|
-
|
|
1810
|
+
queue.splice(i, 1);
|
|
1811
|
+
i--;
|
|
1812
|
+
cb();
|
|
1820
1813
|
}
|
|
1821
|
-
activePreFlushCbs = null;
|
|
1822
|
-
preFlushIndex = 0;
|
|
1823
|
-
currentPreFlushParentJob = null;
|
|
1824
|
-
// recursively flush until it drains
|
|
1825
|
-
flushPreFlushCbs(seen, parentJob);
|
|
1826
1814
|
}
|
|
1827
1815
|
}
|
|
1828
1816
|
function flushPostFlushCbs(seen) {
|
|
1829
|
-
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
1830
|
-
flushPreFlushCbs();
|
|
1831
1817
|
if (pendingPostFlushCbs.length) {
|
|
1832
1818
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
1833
1819
|
pendingPostFlushCbs.length = 0;
|
|
@@ -1852,13 +1838,22 @@ function flushPostFlushCbs(seen) {
|
|
|
1852
1838
|
}
|
|
1853
1839
|
}
|
|
1854
1840
|
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
1841
|
+
const comparator = (a, b) => {
|
|
1842
|
+
const diff = getId(a) - getId(b);
|
|
1843
|
+
if (diff === 0) {
|
|
1844
|
+
if (a.pre && !b.pre)
|
|
1845
|
+
return -1;
|
|
1846
|
+
if (b.pre && !a.pre)
|
|
1847
|
+
return 1;
|
|
1848
|
+
}
|
|
1849
|
+
return diff;
|
|
1850
|
+
};
|
|
1855
1851
|
function flushJobs(seen) {
|
|
1856
1852
|
isFlushPending = false;
|
|
1857
1853
|
isFlushing = true;
|
|
1858
1854
|
{
|
|
1859
1855
|
seen = seen || new Map();
|
|
1860
1856
|
}
|
|
1861
|
-
flushPreFlushCbs(seen);
|
|
1862
1857
|
// Sort queue before flush.
|
|
1863
1858
|
// This ensures that:
|
|
1864
1859
|
// 1. Components are updated from parent to child. (because parent is always
|
|
@@ -1866,7 +1861,7 @@ function flushJobs(seen) {
|
|
|
1866
1861
|
// priority number)
|
|
1867
1862
|
// 2. If a component is unmounted during a parent component's update,
|
|
1868
1863
|
// its update can be skipped.
|
|
1869
|
-
queue.sort(
|
|
1864
|
+
queue.sort(comparator);
|
|
1870
1865
|
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
1871
1866
|
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
1872
1867
|
// inside try-catch. This can leave all warning code unshaked. Although
|
|
@@ -1882,7 +1877,7 @@ function flushJobs(seen) {
|
|
|
1882
1877
|
continue;
|
|
1883
1878
|
}
|
|
1884
1879
|
// console.log(`running:`, job.id)
|
|
1885
|
-
callWithErrorHandling(job, null, 14 /* SCHEDULER */);
|
|
1880
|
+
callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
|
|
1886
1881
|
}
|
|
1887
1882
|
}
|
|
1888
1883
|
}
|
|
@@ -1894,9 +1889,7 @@ function flushJobs(seen) {
|
|
|
1894
1889
|
currentFlushPromise = null;
|
|
1895
1890
|
// some postFlushCb queued jobs!
|
|
1896
1891
|
// keep flushing until it drains.
|
|
1897
|
-
if (queue.length ||
|
|
1898
|
-
pendingPreFlushCbs.length ||
|
|
1899
|
-
pendingPostFlushCbs.length) {
|
|
1892
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
1900
1893
|
flushJobs(seen);
|
|
1901
1894
|
}
|
|
1902
1895
|
}
|
|
@@ -2114,7 +2107,7 @@ function setDevtoolsHook(hook, target) {
|
|
|
2114
2107
|
}
|
|
2115
2108
|
}
|
|
2116
2109
|
function devtoolsInitApp(app, version) {
|
|
2117
|
-
emit("app:init" /* APP_INIT */, app, version, {
|
|
2110
|
+
emit("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
|
|
2118
2111
|
Fragment,
|
|
2119
2112
|
Text,
|
|
2120
2113
|
Comment,
|
|
@@ -2122,27 +2115,27 @@ function devtoolsInitApp(app, version) {
|
|
|
2122
2115
|
});
|
|
2123
2116
|
}
|
|
2124
2117
|
function devtoolsUnmountApp(app) {
|
|
2125
|
-
emit("app:unmount" /* APP_UNMOUNT */, app);
|
|
2118
|
+
emit("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
|
|
2126
2119
|
}
|
|
2127
|
-
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
|
|
2120
|
+
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* DevtoolsHooks.COMPONENT_ADDED */);
|
|
2128
2121
|
const devtoolsComponentUpdated =
|
|
2129
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
|
|
2122
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* DevtoolsHooks.COMPONENT_UPDATED */);
|
|
2130
2123
|
const devtoolsComponentRemoved =
|
|
2131
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
|
|
2124
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* DevtoolsHooks.COMPONENT_REMOVED */);
|
|
2132
2125
|
function createDevtoolsComponentHook(hook) {
|
|
2133
2126
|
return (component) => {
|
|
2134
2127
|
emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
|
2135
2128
|
};
|
|
2136
2129
|
}
|
|
2137
|
-
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
|
|
2138
|
-
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
|
|
2130
|
+
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* DevtoolsHooks.PERFORMANCE_START */);
|
|
2131
|
+
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* DevtoolsHooks.PERFORMANCE_END */);
|
|
2139
2132
|
function createDevtoolsPerformanceHook(hook) {
|
|
2140
2133
|
return (component, type, time) => {
|
|
2141
2134
|
emit(hook, component.appContext.app, component.uid, component, type, time);
|
|
2142
2135
|
};
|
|
2143
2136
|
}
|
|
2144
2137
|
function devtoolsComponentEmit(component, event, params) {
|
|
2145
|
-
emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
2138
|
+
emit("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
2146
2139
|
}
|
|
2147
2140
|
|
|
2148
2141
|
function emit$1(instance, event, ...rawArgs) {
|
|
@@ -2207,7 +2200,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2207
2200
|
handler = props[(handlerName = toHandlerKey(hyphenate(event)))];
|
|
2208
2201
|
}
|
|
2209
2202
|
if (handler) {
|
|
2210
|
-
callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
2203
|
+
callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
2211
2204
|
}
|
|
2212
2205
|
const onceHandler = props[handlerName + `Once`];
|
|
2213
2206
|
if (onceHandler) {
|
|
@@ -2218,7 +2211,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2218
2211
|
return;
|
|
2219
2212
|
}
|
|
2220
2213
|
instance.emitted[handlerName] = true;
|
|
2221
|
-
callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
2214
|
+
callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
2222
2215
|
}
|
|
2223
2216
|
}
|
|
2224
2217
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
@@ -2250,7 +2243,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
2250
2243
|
}
|
|
2251
2244
|
}
|
|
2252
2245
|
if (!raw && !hasExtends) {
|
|
2253
|
-
|
|
2246
|
+
if (isObject(comp)) {
|
|
2247
|
+
cache.set(comp, null);
|
|
2248
|
+
}
|
|
2254
2249
|
return null;
|
|
2255
2250
|
}
|
|
2256
2251
|
if (isArray(raw)) {
|
|
@@ -2259,7 +2254,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
2259
2254
|
else {
|
|
2260
2255
|
extend(normalized, raw);
|
|
2261
2256
|
}
|
|
2262
|
-
|
|
2257
|
+
if (isObject(comp)) {
|
|
2258
|
+
cache.set(comp, normalized);
|
|
2259
|
+
}
|
|
2263
2260
|
return normalized;
|
|
2264
2261
|
}
|
|
2265
2262
|
// Check if an incoming prop key is a declared emit event listener.
|
|
@@ -2378,7 +2375,7 @@ function renderComponentRoot(instance) {
|
|
|
2378
2375
|
accessedAttrs = false;
|
|
2379
2376
|
}
|
|
2380
2377
|
try {
|
|
2381
|
-
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
2378
|
+
if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
|
|
2382
2379
|
// withProxy is a proxy with a different `has` trap only for
|
|
2383
2380
|
// runtime-compiled render functions using `with` block.
|
|
2384
2381
|
const proxyToUse = withProxy || proxy;
|
|
@@ -2411,7 +2408,7 @@ function renderComponentRoot(instance) {
|
|
|
2411
2408
|
}
|
|
2412
2409
|
catch (err) {
|
|
2413
2410
|
blockStack.length = 0;
|
|
2414
|
-
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
2411
|
+
handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
|
|
2415
2412
|
result = createVNode(Comment);
|
|
2416
2413
|
}
|
|
2417
2414
|
// attr merging
|
|
@@ -2420,14 +2417,14 @@ function renderComponentRoot(instance) {
|
|
|
2420
2417
|
let root = result;
|
|
2421
2418
|
let setRoot = undefined;
|
|
2422
2419
|
if (result.patchFlag > 0 &&
|
|
2423
|
-
result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
2420
|
+
result.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
2424
2421
|
[root, setRoot] = getChildRoot(result);
|
|
2425
2422
|
}
|
|
2426
2423
|
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
2427
2424
|
const keys = Object.keys(fallthroughAttrs);
|
|
2428
2425
|
const { shapeFlag } = root;
|
|
2429
2426
|
if (keys.length) {
|
|
2430
|
-
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
2427
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
|
|
2431
2428
|
if (propsOptions && keys.some(isModelListener)) {
|
|
2432
2429
|
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
2433
2430
|
// prop, it indicates this component expects to handle v-model and
|
|
@@ -2568,7 +2565,7 @@ const filterModelListeners = (attrs, props) => {
|
|
|
2568
2565
|
return res;
|
|
2569
2566
|
};
|
|
2570
2567
|
const isElementRoot = (vnode) => {
|
|
2571
|
-
return (vnode.shapeFlag & (6 /* COMPONENT */ | 1 /* ELEMENT */) ||
|
|
2568
|
+
return (vnode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 1 /* ShapeFlags.ELEMENT */) ||
|
|
2572
2569
|
vnode.type === Comment // potential v-if branch switch
|
|
2573
2570
|
);
|
|
2574
2571
|
};
|
|
@@ -2587,19 +2584,19 @@ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
|
2587
2584
|
return true;
|
|
2588
2585
|
}
|
|
2589
2586
|
if (optimized && patchFlag >= 0) {
|
|
2590
|
-
if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
|
|
2587
|
+
if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
|
|
2591
2588
|
// slot content that references values that might have changed,
|
|
2592
2589
|
// e.g. in a v-for
|
|
2593
2590
|
return true;
|
|
2594
2591
|
}
|
|
2595
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
2592
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
2596
2593
|
if (!prevProps) {
|
|
2597
2594
|
return !!nextProps;
|
|
2598
2595
|
}
|
|
2599
2596
|
// presence of this flag indicates props are always non-null
|
|
2600
2597
|
return hasPropsChanged(prevProps, nextProps, emits);
|
|
2601
2598
|
}
|
|
2602
|
-
else if (patchFlag & 8 /* PROPS */) {
|
|
2599
|
+
else if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
2603
2600
|
const dynamicProps = nextVNode.dynamicProps;
|
|
2604
2601
|
for (let i = 0; i < dynamicProps.length; i++) {
|
|
2605
2602
|
const key = dynamicProps[i];
|
|
@@ -2857,7 +2854,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
2857
2854
|
if (delayEnter) {
|
|
2858
2855
|
activeBranch.transition.afterLeave = () => {
|
|
2859
2856
|
if (pendingId === suspense.pendingId) {
|
|
2860
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
2857
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
2861
2858
|
}
|
|
2862
2859
|
};
|
|
2863
2860
|
}
|
|
@@ -2872,7 +2869,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
2872
2869
|
}
|
|
2873
2870
|
if (!delayEnter) {
|
|
2874
2871
|
// move content from off-dom container to actual container
|
|
2875
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
2872
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
2876
2873
|
}
|
|
2877
2874
|
}
|
|
2878
2875
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -2946,7 +2943,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
2946
2943
|
const hydratedEl = instance.vnode.el;
|
|
2947
2944
|
instance
|
|
2948
2945
|
.asyncDep.catch(err => {
|
|
2949
|
-
handleError(err, instance, 0 /* SETUP_FUNCTION */);
|
|
2946
|
+
handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
2950
2947
|
})
|
|
2951
2948
|
.then(asyncSetupResult => {
|
|
2952
2949
|
// retry when the setup() promise resolves.
|
|
@@ -3020,7 +3017,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
|
|
|
3020
3017
|
}
|
|
3021
3018
|
function normalizeSuspenseChildren(vnode) {
|
|
3022
3019
|
const { shapeFlag, children } = vnode;
|
|
3023
|
-
const isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */;
|
|
3020
|
+
const isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
3024
3021
|
vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
|
|
3025
3022
|
vnode.ssFallback = isSlotChildren
|
|
3026
3023
|
? normalizeSuspenseSlot(children.fallback)
|
|
@@ -3191,7 +3188,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3191
3188
|
return traverse(s);
|
|
3192
3189
|
}
|
|
3193
3190
|
else if (isFunction(s)) {
|
|
3194
|
-
return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
|
|
3191
|
+
return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
3195
3192
|
}
|
|
3196
3193
|
else {
|
|
3197
3194
|
warnInvalidSource(s);
|
|
@@ -3201,7 +3198,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3201
3198
|
else if (isFunction(source)) {
|
|
3202
3199
|
if (cb) {
|
|
3203
3200
|
// getter with cb
|
|
3204
|
-
getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
|
|
3201
|
+
getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
3205
3202
|
}
|
|
3206
3203
|
else {
|
|
3207
3204
|
// no cb -> simple effect
|
|
@@ -3212,7 +3209,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3212
3209
|
if (cleanup) {
|
|
3213
3210
|
cleanup();
|
|
3214
3211
|
}
|
|
3215
|
-
return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
|
|
3212
|
+
return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
|
|
3216
3213
|
};
|
|
3217
3214
|
}
|
|
3218
3215
|
}
|
|
@@ -3227,7 +3224,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3227
3224
|
let cleanup;
|
|
3228
3225
|
let onCleanup = (fn) => {
|
|
3229
3226
|
cleanup = effect.onStop = () => {
|
|
3230
|
-
callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
|
|
3227
|
+
callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
|
|
3231
3228
|
};
|
|
3232
3229
|
};
|
|
3233
3230
|
let oldValue = isMultiSource ? [] : INITIAL_WATCHER_VALUE;
|
|
@@ -3248,7 +3245,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3248
3245
|
if (cleanup) {
|
|
3249
3246
|
cleanup();
|
|
3250
3247
|
}
|
|
3251
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
3248
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
3252
3249
|
newValue,
|
|
3253
3250
|
// pass undefined as the old value when it's changed for the first time
|
|
3254
3251
|
oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
|
@@ -3274,7 +3271,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3274
3271
|
}
|
|
3275
3272
|
else {
|
|
3276
3273
|
// default: 'pre'
|
|
3277
|
-
|
|
3274
|
+
job.pre = true;
|
|
3275
|
+
if (instance)
|
|
3276
|
+
job.id = instance.uid;
|
|
3277
|
+
scheduler = () => queueJob(job);
|
|
3278
3278
|
}
|
|
3279
3279
|
const effect = new ReactiveEffect(getter, scheduler);
|
|
3280
3280
|
{
|
|
@@ -3341,7 +3341,7 @@ function createPathGetter(ctx, path) {
|
|
|
3341
3341
|
};
|
|
3342
3342
|
}
|
|
3343
3343
|
function traverse(value, seen) {
|
|
3344
|
-
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
3344
|
+
if (!isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
|
|
3345
3345
|
return value;
|
|
3346
3346
|
}
|
|
3347
3347
|
seen = seen || new Set();
|
|
@@ -3525,7 +3525,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
3525
3525
|
const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
|
3526
3526
|
const callHook = (hook, args) => {
|
|
3527
3527
|
hook &&
|
|
3528
|
-
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
3528
|
+
callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
|
|
3529
3529
|
};
|
|
3530
3530
|
const callAsyncHook = (hook, args) => {
|
|
3531
3531
|
const done = args[1];
|
|
@@ -3661,10 +3661,10 @@ function getKeepAliveChild(vnode) {
|
|
|
3661
3661
|
: vnode;
|
|
3662
3662
|
}
|
|
3663
3663
|
function setTransitionHooks(vnode, hooks) {
|
|
3664
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
|
|
3664
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
|
|
3665
3665
|
setTransitionHooks(vnode.component.subTree, hooks);
|
|
3666
3666
|
}
|
|
3667
|
-
else if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
3667
|
+
else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
3668
3668
|
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
3669
3669
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
3670
3670
|
}
|
|
@@ -3683,7 +3683,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
3683
3683
|
: String(parentKey) + String(child.key != null ? child.key : i);
|
|
3684
3684
|
// handle fragment children case, e.g. v-for
|
|
3685
3685
|
if (child.type === Fragment) {
|
|
3686
|
-
if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
|
|
3686
|
+
if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */)
|
|
3687
3687
|
keyedFragmentCount++;
|
|
3688
3688
|
ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
|
|
3689
3689
|
}
|
|
@@ -3698,7 +3698,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
3698
3698
|
// these children to force full diffs to ensure correct behavior.
|
|
3699
3699
|
if (keyedFragmentCount > 1) {
|
|
3700
3700
|
for (let i = 0; i < ret.length; i++) {
|
|
3701
|
-
ret[i].patchFlag = -2 /* BAIL */;
|
|
3701
|
+
ret[i].patchFlag = -2 /* PatchFlags.BAIL */;
|
|
3702
3702
|
}
|
|
3703
3703
|
}
|
|
3704
3704
|
return ret;
|
|
@@ -3776,7 +3776,7 @@ function defineAsyncComponent(source) {
|
|
|
3776
3776
|
}
|
|
3777
3777
|
const onError = (err) => {
|
|
3778
3778
|
pendingRequest = null;
|
|
3779
|
-
handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
3779
|
+
handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
3780
3780
|
};
|
|
3781
3781
|
// suspense-controlled or SSR.
|
|
3782
3782
|
if ((suspensible && instance.suspense) ||
|
|
@@ -3878,7 +3878,7 @@ const KeepAliveImpl = {
|
|
|
3878
3878
|
const storageContainer = createElement('div');
|
|
3879
3879
|
sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
|
3880
3880
|
const instance = vnode.component;
|
|
3881
|
-
move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
|
|
3881
|
+
move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
|
|
3882
3882
|
// in case props have changed
|
|
3883
3883
|
patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
|
|
3884
3884
|
queuePostRenderEffect(() => {
|
|
@@ -3898,7 +3898,7 @@ const KeepAliveImpl = {
|
|
|
3898
3898
|
};
|
|
3899
3899
|
sharedContext.deactivate = (vnode) => {
|
|
3900
3900
|
const instance = vnode.component;
|
|
3901
|
-
move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
|
|
3901
|
+
move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
|
|
3902
3902
|
queuePostRenderEffect(() => {
|
|
3903
3903
|
if (instance.da) {
|
|
3904
3904
|
invokeArrayFns(instance.da);
|
|
@@ -3987,8 +3987,8 @@ const KeepAliveImpl = {
|
|
|
3987
3987
|
return children;
|
|
3988
3988
|
}
|
|
3989
3989
|
else if (!isVNode(rawVNode) ||
|
|
3990
|
-
(!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&
|
|
3991
|
-
!(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {
|
|
3990
|
+
(!(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) &&
|
|
3991
|
+
!(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */))) {
|
|
3992
3992
|
current = null;
|
|
3993
3993
|
return rawVNode;
|
|
3994
3994
|
}
|
|
@@ -4010,7 +4010,7 @@ const KeepAliveImpl = {
|
|
|
4010
4010
|
// clone vnode if it's reused because we are going to mutate it
|
|
4011
4011
|
if (vnode.el) {
|
|
4012
4012
|
vnode = cloneVNode(vnode);
|
|
4013
|
-
if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
|
|
4013
|
+
if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4014
4014
|
rawVNode.ssContent = vnode;
|
|
4015
4015
|
}
|
|
4016
4016
|
}
|
|
@@ -4029,7 +4029,7 @@ const KeepAliveImpl = {
|
|
|
4029
4029
|
setTransitionHooks(vnode, vnode.transition);
|
|
4030
4030
|
}
|
|
4031
4031
|
// avoid vnode being mounted as fresh
|
|
4032
|
-
vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
4032
|
+
vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
4033
4033
|
// make this key the freshest
|
|
4034
4034
|
keys.delete(key);
|
|
4035
4035
|
keys.add(key);
|
|
@@ -4042,7 +4042,7 @@ const KeepAliveImpl = {
|
|
|
4042
4042
|
}
|
|
4043
4043
|
}
|
|
4044
4044
|
// avoid vnode being unmounted
|
|
4045
|
-
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4045
|
+
vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4046
4046
|
current = vnode;
|
|
4047
4047
|
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
4048
4048
|
};
|
|
@@ -4065,10 +4065,10 @@ function matches(pattern, name) {
|
|
|
4065
4065
|
return false;
|
|
4066
4066
|
}
|
|
4067
4067
|
function onActivated(hook, target) {
|
|
4068
|
-
registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
|
|
4068
|
+
registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
|
|
4069
4069
|
}
|
|
4070
4070
|
function onDeactivated(hook, target) {
|
|
4071
|
-
registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
|
|
4071
|
+
registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
|
|
4072
4072
|
}
|
|
4073
4073
|
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
4074
4074
|
// cache the deactivate branch check wrapper for injected hooks so the same
|
|
@@ -4112,16 +4112,16 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
|
4112
4112
|
}
|
|
4113
4113
|
function resetShapeFlag(vnode) {
|
|
4114
4114
|
let shapeFlag = vnode.shapeFlag;
|
|
4115
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
4116
|
-
shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4115
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
4116
|
+
shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4117
4117
|
}
|
|
4118
|
-
if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
4119
|
-
shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
4118
|
+
if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
4119
|
+
shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
4120
4120
|
}
|
|
4121
4121
|
vnode.shapeFlag = shapeFlag;
|
|
4122
4122
|
}
|
|
4123
4123
|
function getInnerChild(vnode) {
|
|
4124
|
-
return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
|
|
4124
|
+
return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
|
|
4125
4125
|
}
|
|
4126
4126
|
|
|
4127
4127
|
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
@@ -4167,19 +4167,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4167
4167
|
}
|
|
4168
4168
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
4169
4169
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
4170
|
-
(!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
|
|
4170
|
+
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
4171
4171
|
injectHook(lifecycle, hook, target);
|
|
4172
|
-
const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
|
|
4173
|
-
const onMounted = createHook("m" /* MOUNTED */);
|
|
4174
|
-
const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
|
|
4175
|
-
const onUpdated = createHook("u" /* UPDATED */);
|
|
4176
|
-
const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
|
|
4177
|
-
const onUnmounted = createHook("um" /* UNMOUNTED */);
|
|
4178
|
-
const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
|
|
4179
|
-
const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
|
|
4180
|
-
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
|
|
4172
|
+
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
4173
|
+
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
4174
|
+
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
4175
|
+
const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
|
|
4176
|
+
const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
|
|
4177
|
+
const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
|
|
4178
|
+
const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
|
|
4179
|
+
const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
|
|
4180
|
+
const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
|
|
4181
4181
|
function onErrorCaptured(hook, target = currentInstance) {
|
|
4182
|
-
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
4182
|
+
injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
|
|
4183
4183
|
}
|
|
4184
4184
|
|
|
4185
4185
|
/**
|
|
@@ -4246,7 +4246,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
4246
4246
|
// disable tracking inside all lifecycle hooks
|
|
4247
4247
|
// since they can potentially be called inside effects.
|
|
4248
4248
|
pauseTracking();
|
|
4249
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
4249
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [
|
|
4250
4250
|
vnode.el,
|
|
4251
4251
|
binding,
|
|
4252
4252
|
vnode,
|
|
@@ -4291,7 +4291,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
4291
4291
|
const Component = instance.type;
|
|
4292
4292
|
// explicit self name has highest priority
|
|
4293
4293
|
if (type === COMPONENTS) {
|
|
4294
|
-
const selfName = getComponentName(Component);
|
|
4294
|
+
const selfName = getComponentName(Component, false /* do not include inferred name to avoid breaking existing code */);
|
|
4295
4295
|
if (selfName &&
|
|
4296
4296
|
(selfName === name ||
|
|
4297
4297
|
selfName === camelize(name) ||
|
|
@@ -4388,7 +4388,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
4388
4388
|
}
|
|
4389
4389
|
else if (slot) {
|
|
4390
4390
|
// conditional single slot generated by <template v-if="..." #foo>
|
|
4391
|
-
slots[slot.name] = slot.
|
|
4391
|
+
slots[slot.name] = slot.key
|
|
4392
|
+
? (...args) => {
|
|
4393
|
+
const res = slot.fn(...args);
|
|
4394
|
+
res.key = slot.key;
|
|
4395
|
+
return res;
|
|
4396
|
+
}
|
|
4397
|
+
: slot.fn;
|
|
4392
4398
|
}
|
|
4393
4399
|
}
|
|
4394
4400
|
return slots;
|
|
@@ -4424,9 +4430,15 @@ fallback, noSlotted) {
|
|
|
4424
4430
|
}
|
|
4425
4431
|
openBlock();
|
|
4426
4432
|
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
4427
|
-
const rendered = createBlock(Fragment, {
|
|
4428
|
-
|
|
4429
|
-
|
|
4433
|
+
const rendered = createBlock(Fragment, {
|
|
4434
|
+
key: props.key ||
|
|
4435
|
+
// slot content array of a dynamic conditional slot may have a branch
|
|
4436
|
+
// key attached in the `createSlots` helper, respect that
|
|
4437
|
+
(validSlotContent && validSlotContent.key) ||
|
|
4438
|
+
`_${name}`
|
|
4439
|
+
}, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */
|
|
4440
|
+
? 64 /* PatchFlags.STABLE_FRAGMENT */
|
|
4441
|
+
: -2 /* PatchFlags.BAIL */);
|
|
4430
4442
|
if (!noSlotted && rendered.scopeId) {
|
|
4431
4443
|
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
4432
4444
|
}
|
|
@@ -4454,14 +4466,16 @@ function ensureValidVNode(vnodes) {
|
|
|
4454
4466
|
* For prefixing keys in v-on="obj" with "on"
|
|
4455
4467
|
* @private
|
|
4456
4468
|
*/
|
|
4457
|
-
function toHandlers(obj) {
|
|
4469
|
+
function toHandlers(obj, preserveCaseIfNecessary) {
|
|
4458
4470
|
const ret = {};
|
|
4459
4471
|
if (!isObject(obj)) {
|
|
4460
4472
|
warn$1(`v-on with no argument expects an object value.`);
|
|
4461
4473
|
return ret;
|
|
4462
4474
|
}
|
|
4463
4475
|
for (const key in obj) {
|
|
4464
|
-
ret[
|
|
4476
|
+
ret[preserveCaseIfNecessary && /[A-Z]/.test(key)
|
|
4477
|
+
? `on:${key}`
|
|
4478
|
+
: toHandlerKey(key)] = obj[key];
|
|
4465
4479
|
}
|
|
4466
4480
|
return ret;
|
|
4467
4481
|
}
|
|
@@ -4525,23 +4539,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
4525
4539
|
const n = accessCache[key];
|
|
4526
4540
|
if (n !== undefined) {
|
|
4527
4541
|
switch (n) {
|
|
4528
|
-
case 1 /* SETUP */:
|
|
4542
|
+
case 1 /* AccessTypes.SETUP */:
|
|
4529
4543
|
return setupState[key];
|
|
4530
|
-
case 2 /* DATA */:
|
|
4544
|
+
case 2 /* AccessTypes.DATA */:
|
|
4531
4545
|
return data[key];
|
|
4532
|
-
case 4 /* CONTEXT */:
|
|
4546
|
+
case 4 /* AccessTypes.CONTEXT */:
|
|
4533
4547
|
return ctx[key];
|
|
4534
|
-
case 3 /* PROPS */:
|
|
4548
|
+
case 3 /* AccessTypes.PROPS */:
|
|
4535
4549
|
return props[key];
|
|
4536
4550
|
// default: just fallthrough
|
|
4537
4551
|
}
|
|
4538
4552
|
}
|
|
4539
4553
|
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
4540
|
-
accessCache[key] = 1 /* SETUP */;
|
|
4554
|
+
accessCache[key] = 1 /* AccessTypes.SETUP */;
|
|
4541
4555
|
return setupState[key];
|
|
4542
4556
|
}
|
|
4543
4557
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4544
|
-
accessCache[key] = 2 /* DATA */;
|
|
4558
|
+
accessCache[key] = 2 /* AccessTypes.DATA */;
|
|
4545
4559
|
return data[key];
|
|
4546
4560
|
}
|
|
4547
4561
|
else if (
|
|
@@ -4549,15 +4563,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
4549
4563
|
// props
|
|
4550
4564
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
4551
4565
|
hasOwn(normalizedProps, key)) {
|
|
4552
|
-
accessCache[key] = 3 /* PROPS */;
|
|
4566
|
+
accessCache[key] = 3 /* AccessTypes.PROPS */;
|
|
4553
4567
|
return props[key];
|
|
4554
4568
|
}
|
|
4555
4569
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4556
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
4570
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
4557
4571
|
return ctx[key];
|
|
4558
4572
|
}
|
|
4559
4573
|
else if (shouldCacheAccess) {
|
|
4560
|
-
accessCache[key] = 0 /* OTHER */;
|
|
4574
|
+
accessCache[key] = 0 /* AccessTypes.OTHER */;
|
|
4561
4575
|
}
|
|
4562
4576
|
}
|
|
4563
4577
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -4565,7 +4579,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
4565
4579
|
// public $xxx properties
|
|
4566
4580
|
if (publicGetter) {
|
|
4567
4581
|
if (key === '$attrs') {
|
|
4568
|
-
track(instance, "get" /* GET */, key);
|
|
4582
|
+
track(instance, "get" /* TrackOpTypes.GET */, key);
|
|
4569
4583
|
markAttrsAccessed();
|
|
4570
4584
|
}
|
|
4571
4585
|
return publicGetter(instance);
|
|
@@ -4578,7 +4592,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
4578
4592
|
}
|
|
4579
4593
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4580
4594
|
// user may set custom properties to `this` that start with `$`
|
|
4581
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
4595
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
4582
4596
|
return ctx[key];
|
|
4583
4597
|
}
|
|
4584
4598
|
else if (
|
|
@@ -4761,7 +4775,7 @@ function applyOptions(instance) {
|
|
|
4761
4775
|
// call beforeCreate first before accessing other options since
|
|
4762
4776
|
// the hook may mutate resolved options (#2791)
|
|
4763
4777
|
if (options.beforeCreate) {
|
|
4764
|
-
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
4778
|
+
callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
|
|
4765
4779
|
}
|
|
4766
4780
|
const {
|
|
4767
4781
|
// state
|
|
@@ -4777,7 +4791,7 @@ function applyOptions(instance) {
|
|
|
4777
4791
|
const [propsOptions] = instance.propsOptions;
|
|
4778
4792
|
if (propsOptions) {
|
|
4779
4793
|
for (const key in propsOptions) {
|
|
4780
|
-
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
4794
|
+
checkDuplicateProperties("Props" /* OptionTypes.PROPS */, key);
|
|
4781
4795
|
}
|
|
4782
4796
|
}
|
|
4783
4797
|
}
|
|
@@ -4807,7 +4821,7 @@ function applyOptions(instance) {
|
|
|
4807
4821
|
});
|
|
4808
4822
|
}
|
|
4809
4823
|
{
|
|
4810
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
4824
|
+
checkDuplicateProperties("Methods" /* OptionTypes.METHODS */, key);
|
|
4811
4825
|
}
|
|
4812
4826
|
}
|
|
4813
4827
|
else {
|
|
@@ -4834,7 +4848,7 @@ function applyOptions(instance) {
|
|
|
4834
4848
|
instance.data = reactive(data);
|
|
4835
4849
|
{
|
|
4836
4850
|
for (const key in data) {
|
|
4837
|
-
checkDuplicateProperties("Data" /* DATA */, key);
|
|
4851
|
+
checkDuplicateProperties("Data" /* OptionTypes.DATA */, key);
|
|
4838
4852
|
// expose data on ctx during dev
|
|
4839
4853
|
if (!isReservedPrefix(key[0])) {
|
|
4840
4854
|
Object.defineProperty(ctx, key, {
|
|
@@ -4878,7 +4892,7 @@ function applyOptions(instance) {
|
|
|
4878
4892
|
set: v => (c.value = v)
|
|
4879
4893
|
});
|
|
4880
4894
|
{
|
|
4881
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
4895
|
+
checkDuplicateProperties("Computed" /* OptionTypes.COMPUTED */, key);
|
|
4882
4896
|
}
|
|
4883
4897
|
}
|
|
4884
4898
|
}
|
|
@@ -4896,7 +4910,7 @@ function applyOptions(instance) {
|
|
|
4896
4910
|
});
|
|
4897
4911
|
}
|
|
4898
4912
|
if (created) {
|
|
4899
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
4913
|
+
callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
|
|
4900
4914
|
}
|
|
4901
4915
|
function registerLifecycleHook(register, hook) {
|
|
4902
4916
|
if (isArray(hook)) {
|
|
@@ -4989,7 +5003,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
|
|
|
4989
5003
|
ctx[key] = injected;
|
|
4990
5004
|
}
|
|
4991
5005
|
{
|
|
4992
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
5006
|
+
checkDuplicateProperties("Inject" /* OptionTypes.INJECT */, key);
|
|
4993
5007
|
}
|
|
4994
5008
|
}
|
|
4995
5009
|
}
|
|
@@ -5060,7 +5074,9 @@ function resolveMergedOptions(instance) {
|
|
|
5060
5074
|
}
|
|
5061
5075
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
5062
5076
|
}
|
|
5063
|
-
|
|
5077
|
+
if (isObject(base)) {
|
|
5078
|
+
cache.set(base, resolved);
|
|
5079
|
+
}
|
|
5064
5080
|
return resolved;
|
|
5065
5081
|
}
|
|
5066
5082
|
function mergeOptions(to, from, strats, asMixin = false) {
|
|
@@ -5189,6 +5205,13 @@ isSSR = false) {
|
|
|
5189
5205
|
}
|
|
5190
5206
|
instance.attrs = attrs;
|
|
5191
5207
|
}
|
|
5208
|
+
function isInHmrContext(instance) {
|
|
5209
|
+
while (instance) {
|
|
5210
|
+
if (instance.type.__hmrId)
|
|
5211
|
+
return true;
|
|
5212
|
+
instance = instance.parent;
|
|
5213
|
+
}
|
|
5214
|
+
}
|
|
5192
5215
|
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
5193
5216
|
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
5194
5217
|
const rawCurrentProps = toRaw(props);
|
|
@@ -5198,11 +5221,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
5198
5221
|
// always force full diff in dev
|
|
5199
5222
|
// - #1942 if hmr is enabled with sfc component
|
|
5200
5223
|
// - vite#872 non-sfc component used by sfc component
|
|
5201
|
-
!((instance
|
|
5202
|
-
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
5224
|
+
!(isInHmrContext(instance)) &&
|
|
5203
5225
|
(optimized || patchFlag > 0) &&
|
|
5204
|
-
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
5205
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
5226
|
+
!(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
|
|
5227
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
5206
5228
|
// Compiler-generated props & no keys change, just set the updated
|
|
5207
5229
|
// the props.
|
|
5208
5230
|
const propsToUpdate = instance.vnode.dynamicProps;
|
|
@@ -5281,7 +5303,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
5281
5303
|
}
|
|
5282
5304
|
// trigger updates for $attrs in case it's used in component slots
|
|
5283
5305
|
if (hasAttrsChanged) {
|
|
5284
|
-
trigger(instance, "set" /* SET */, '$attrs');
|
|
5306
|
+
trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
|
|
5285
5307
|
}
|
|
5286
5308
|
{
|
|
5287
5309
|
validateProps(rawProps || {}, props, instance);
|
|
@@ -5350,11 +5372,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
5350
5372
|
}
|
|
5351
5373
|
}
|
|
5352
5374
|
// boolean casting
|
|
5353
|
-
if (opt[0 /* shouldCast */]) {
|
|
5375
|
+
if (opt[0 /* BooleanFlags.shouldCast */]) {
|
|
5354
5376
|
if (isAbsent && !hasDefault) {
|
|
5355
5377
|
value = false;
|
|
5356
5378
|
}
|
|
5357
|
-
else if (opt[1 /* shouldCastTrue */] &&
|
|
5379
|
+
else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
|
|
5358
5380
|
(value === '' || value === hyphenate(key))) {
|
|
5359
5381
|
value = true;
|
|
5360
5382
|
}
|
|
@@ -5392,7 +5414,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
5392
5414
|
}
|
|
5393
5415
|
}
|
|
5394
5416
|
if (!raw && !hasExtends) {
|
|
5395
|
-
|
|
5417
|
+
if (isObject(comp)) {
|
|
5418
|
+
cache.set(comp, EMPTY_ARR);
|
|
5419
|
+
}
|
|
5396
5420
|
return EMPTY_ARR;
|
|
5397
5421
|
}
|
|
5398
5422
|
if (isArray(raw)) {
|
|
@@ -5419,8 +5443,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
5419
5443
|
if (prop) {
|
|
5420
5444
|
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
5421
5445
|
const stringIndex = getTypeIndex(String, prop.type);
|
|
5422
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
5423
|
-
prop[1 /* shouldCastTrue */] =
|
|
5446
|
+
prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
|
|
5447
|
+
prop[1 /* BooleanFlags.shouldCastTrue */] =
|
|
5424
5448
|
stringIndex < 0 || booleanIndex < stringIndex;
|
|
5425
5449
|
// if the prop needs boolean casting or default value
|
|
5426
5450
|
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
@@ -5431,7 +5455,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
5431
5455
|
}
|
|
5432
5456
|
}
|
|
5433
5457
|
const res = [normalized, needCastKeys];
|
|
5434
|
-
|
|
5458
|
+
if (isObject(comp)) {
|
|
5459
|
+
cache.set(comp, res);
|
|
5460
|
+
}
|
|
5435
5461
|
return res;
|
|
5436
5462
|
}
|
|
5437
5463
|
function validatePropName(key) {
|
|
@@ -5641,7 +5667,7 @@ const normalizeVNodeSlots = (instance, children) => {
|
|
|
5641
5667
|
instance.slots.default = () => normalized;
|
|
5642
5668
|
};
|
|
5643
5669
|
const initSlots = (instance, children) => {
|
|
5644
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5670
|
+
if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
5645
5671
|
const type = children._;
|
|
5646
5672
|
if (type) {
|
|
5647
5673
|
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
@@ -5666,7 +5692,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
5666
5692
|
const { vnode, slots } = instance;
|
|
5667
5693
|
let needDeletionCheck = true;
|
|
5668
5694
|
let deletionComparisonTarget = EMPTY_OBJ;
|
|
5669
|
-
if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
5695
|
+
if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
5670
5696
|
const type = children._;
|
|
5671
5697
|
if (type) {
|
|
5672
5698
|
// compiled slots.
|
|
@@ -5675,7 +5701,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
5675
5701
|
// force update slots and mark instance for hmr as well
|
|
5676
5702
|
extend(slots, children);
|
|
5677
5703
|
}
|
|
5678
|
-
else if (optimized && type === 1 /* STABLE */) {
|
|
5704
|
+
else if (optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
5679
5705
|
// compiled AND stable.
|
|
5680
5706
|
// no need to update, and skip stale slots removal.
|
|
5681
5707
|
needDeletionCheck = false;
|
|
@@ -5688,7 +5714,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
5688
5714
|
// when rendering the optimized slots by manually written render function,
|
|
5689
5715
|
// we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
|
|
5690
5716
|
// i.e. let the `renderSlot` create the bailed Fragment
|
|
5691
|
-
if (!optimized && type === 1 /* STABLE */) {
|
|
5717
|
+
if (!optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
5692
5718
|
delete slots._;
|
|
5693
5719
|
}
|
|
5694
5720
|
}
|
|
@@ -5899,7 +5925,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
5899
5925
|
// because the template ref is forwarded to inner component
|
|
5900
5926
|
return;
|
|
5901
5927
|
}
|
|
5902
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
5928
|
+
const refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
5903
5929
|
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
5904
5930
|
: vnode.el;
|
|
5905
5931
|
const value = isUnmount ? null : refValue;
|
|
@@ -5925,7 +5951,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
5925
5951
|
}
|
|
5926
5952
|
}
|
|
5927
5953
|
if (isFunction(ref)) {
|
|
5928
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
5954
|
+
callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
|
|
5929
5955
|
}
|
|
5930
5956
|
else {
|
|
5931
5957
|
const _isString = isString(ref);
|
|
@@ -5962,7 +5988,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
5962
5988
|
setupState[ref] = value;
|
|
5963
5989
|
}
|
|
5964
5990
|
}
|
|
5965
|
-
else if (
|
|
5991
|
+
else if (_isRef) {
|
|
5966
5992
|
ref.value = value;
|
|
5967
5993
|
if (rawRef.k)
|
|
5968
5994
|
refs[rawRef.k] = value;
|
|
@@ -5987,7 +6013,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
5987
6013
|
|
|
5988
6014
|
let hasMismatch = false;
|
|
5989
6015
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
5990
|
-
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
6016
|
+
const isComment = (node) => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
|
|
5991
6017
|
// Note: hydration is DOM-specific
|
|
5992
6018
|
// But we have to place it in core due to tight coupling with core - splitting
|
|
5993
6019
|
// it out creates a ton of unnecessary complexity.
|
|
@@ -6001,11 +6027,13 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6001
6027
|
`Performing full mount instead.`);
|
|
6002
6028
|
patch(null, vnode, container);
|
|
6003
6029
|
flushPostFlushCbs();
|
|
6030
|
+
container._vnode = vnode;
|
|
6004
6031
|
return;
|
|
6005
6032
|
}
|
|
6006
6033
|
hasMismatch = false;
|
|
6007
6034
|
hydrateNode(container.firstChild, vnode, null, null, null);
|
|
6008
6035
|
flushPostFlushCbs();
|
|
6036
|
+
container._vnode = vnode;
|
|
6009
6037
|
if (hasMismatch && !false) {
|
|
6010
6038
|
// this error should show up in production
|
|
6011
6039
|
console.error(`Hydration completed but contains mismatches.`);
|
|
@@ -6017,14 +6045,14 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6017
6045
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
6018
6046
|
const domType = node.nodeType;
|
|
6019
6047
|
vnode.el = node;
|
|
6020
|
-
if (patchFlag === -2 /* BAIL */) {
|
|
6048
|
+
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
6021
6049
|
optimized = false;
|
|
6022
6050
|
vnode.dynamicChildren = null;
|
|
6023
6051
|
}
|
|
6024
6052
|
let nextNode = null;
|
|
6025
6053
|
switch (type) {
|
|
6026
6054
|
case Text:
|
|
6027
|
-
if (domType !== 3 /* TEXT */) {
|
|
6055
|
+
if (domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
6028
6056
|
// #5728 empty text node inside a slot can cause hydration failure
|
|
6029
6057
|
// because the server rendered HTML won't contain a text node
|
|
6030
6058
|
if (vnode.children === '') {
|
|
@@ -6047,7 +6075,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6047
6075
|
}
|
|
6048
6076
|
break;
|
|
6049
6077
|
case Comment:
|
|
6050
|
-
if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
6078
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
|
|
6051
6079
|
nextNode = onMismatch();
|
|
6052
6080
|
}
|
|
6053
6081
|
else {
|
|
@@ -6055,7 +6083,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6055
6083
|
}
|
|
6056
6084
|
break;
|
|
6057
6085
|
case Static:
|
|
6058
|
-
if (domType !== 1 /* ELEMENT */) {
|
|
6086
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
6059
6087
|
nextNode = onMismatch();
|
|
6060
6088
|
}
|
|
6061
6089
|
else {
|
|
@@ -6066,7 +6094,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6066
6094
|
const needToAdoptContent = !vnode.children.length;
|
|
6067
6095
|
for (let i = 0; i < vnode.staticCount; i++) {
|
|
6068
6096
|
if (needToAdoptContent)
|
|
6069
|
-
vnode.children +=
|
|
6097
|
+
vnode.children +=
|
|
6098
|
+
nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
|
|
6099
|
+
? nextNode.outerHTML
|
|
6100
|
+
: nextNode.data;
|
|
6070
6101
|
if (i === vnode.staticCount - 1) {
|
|
6071
6102
|
vnode.anchor = nextNode;
|
|
6072
6103
|
}
|
|
@@ -6084,8 +6115,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6084
6115
|
}
|
|
6085
6116
|
break;
|
|
6086
6117
|
default:
|
|
6087
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
6088
|
-
if (domType !== 1 /* ELEMENT */ ||
|
|
6118
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
6119
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
|
|
6089
6120
|
vnode.type.toLowerCase() !==
|
|
6090
6121
|
node.tagName.toLowerCase()) {
|
|
6091
6122
|
nextNode = onMismatch();
|
|
@@ -6094,7 +6125,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6094
6125
|
nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
6095
6126
|
}
|
|
6096
6127
|
}
|
|
6097
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
6128
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6098
6129
|
// when setting up the render effect, if the initial vnode already
|
|
6099
6130
|
// has .el set, the component will perform hydration instead of mount
|
|
6100
6131
|
// on its sub-tree.
|
|
@@ -6133,15 +6164,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6133
6164
|
vnode.component.subTree = subTree;
|
|
6134
6165
|
}
|
|
6135
6166
|
}
|
|
6136
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
6137
|
-
if (domType !== 8 /* COMMENT */) {
|
|
6167
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6168
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
|
|
6138
6169
|
nextNode = onMismatch();
|
|
6139
6170
|
}
|
|
6140
6171
|
else {
|
|
6141
6172
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
6142
6173
|
}
|
|
6143
6174
|
}
|
|
6144
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6175
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6145
6176
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
6146
6177
|
}
|
|
6147
6178
|
else {
|
|
@@ -6169,7 +6200,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6169
6200
|
if (props) {
|
|
6170
6201
|
if (forcePatchValue ||
|
|
6171
6202
|
!optimized ||
|
|
6172
|
-
patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
|
|
6203
|
+
patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
|
|
6173
6204
|
for (const key in props) {
|
|
6174
6205
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
6175
6206
|
(isOn(key) && !isReservedProp(key))) {
|
|
@@ -6198,7 +6229,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6198
6229
|
}, parentSuspense);
|
|
6199
6230
|
}
|
|
6200
6231
|
// children
|
|
6201
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
|
|
6232
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
|
|
6202
6233
|
// skip if element has innerHTML / textContent
|
|
6203
6234
|
!(props && (props.innerHTML || props.textContent))) {
|
|
6204
6235
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -6216,7 +6247,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6216
6247
|
remove(cur);
|
|
6217
6248
|
}
|
|
6218
6249
|
}
|
|
6219
|
-
else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
6250
|
+
else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
6220
6251
|
if (el.textContent !== vnode.children) {
|
|
6221
6252
|
hasMismatch = true;
|
|
6222
6253
|
warn$1(`Hydration text content mismatch in <${vnode.type}>:\n` +
|
|
@@ -6279,7 +6310,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6279
6310
|
};
|
|
6280
6311
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
6281
6312
|
hasMismatch = true;
|
|
6282
|
-
warn$1(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* TEXT */
|
|
6313
|
+
warn$1(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* DOMNodeTypes.TEXT */
|
|
6283
6314
|
? `(text)`
|
|
6284
6315
|
: isComment(node) && node.data === '['
|
|
6285
6316
|
? `(start of fragment)`
|
|
@@ -6410,7 +6441,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6410
6441
|
unmount(n1, parentComponent, parentSuspense, true);
|
|
6411
6442
|
n1 = null;
|
|
6412
6443
|
}
|
|
6413
|
-
if (n2.patchFlag === -2 /* BAIL */) {
|
|
6444
|
+
if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
6414
6445
|
optimized = false;
|
|
6415
6446
|
n2.dynamicChildren = null;
|
|
6416
6447
|
}
|
|
@@ -6434,16 +6465,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6434
6465
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6435
6466
|
break;
|
|
6436
6467
|
default:
|
|
6437
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
6468
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
6438
6469
|
processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6439
6470
|
}
|
|
6440
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
6471
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6441
6472
|
processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6442
6473
|
}
|
|
6443
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
6474
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6444
6475
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
6445
6476
|
}
|
|
6446
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6477
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6447
6478
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
6448
6479
|
}
|
|
6449
6480
|
else {
|
|
@@ -6529,10 +6560,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6529
6560
|
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
6530
6561
|
// mount children first, since some props may rely on child content
|
|
6531
6562
|
// being already rendered, e.g. `<select value>`
|
|
6532
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
6563
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
6533
6564
|
hostSetElementText(el, vnode.children);
|
|
6534
6565
|
}
|
|
6535
|
-
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6566
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6536
6567
|
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
6537
6568
|
}
|
|
6538
6569
|
if (dirs) {
|
|
@@ -6608,7 +6639,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6608
6639
|
if (parentComponent) {
|
|
6609
6640
|
let subTree = parentComponent.subTree;
|
|
6610
6641
|
if (subTree.patchFlag > 0 &&
|
|
6611
|
-
subTree.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
6642
|
+
subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
6612
6643
|
subTree =
|
|
6613
6644
|
filterSingleRoot(subTree.children) || subTree;
|
|
6614
6645
|
}
|
|
@@ -6631,7 +6662,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6631
6662
|
let { patchFlag, dynamicChildren, dirs } = n2;
|
|
6632
6663
|
// #1426 take the old vnode's patch flag into account since user may clone a
|
|
6633
6664
|
// compiler-generated vnode, which de-opts to FULL_PROPS
|
|
6634
|
-
patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
|
|
6665
|
+
patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
|
|
6635
6666
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
6636
6667
|
const newProps = n2.props || EMPTY_OBJ;
|
|
6637
6668
|
let vnodeHook;
|
|
@@ -6666,21 +6697,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6666
6697
|
// generated by the compiler and can take the fast path.
|
|
6667
6698
|
// in this path old node and new node are guaranteed to have the same shape
|
|
6668
6699
|
// (i.e. at the exact same position in the source template)
|
|
6669
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
6700
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
6670
6701
|
// element props contain dynamic keys, full diff needed
|
|
6671
6702
|
patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
|
6672
6703
|
}
|
|
6673
6704
|
else {
|
|
6674
6705
|
// class
|
|
6675
6706
|
// this flag is matched when the element has dynamic class bindings.
|
|
6676
|
-
if (patchFlag & 2 /* CLASS */) {
|
|
6707
|
+
if (patchFlag & 2 /* PatchFlags.CLASS */) {
|
|
6677
6708
|
if (oldProps.class !== newProps.class) {
|
|
6678
6709
|
hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
|
6679
6710
|
}
|
|
6680
6711
|
}
|
|
6681
6712
|
// style
|
|
6682
6713
|
// this flag is matched when the element has dynamic style bindings
|
|
6683
|
-
if (patchFlag & 4 /* STYLE */) {
|
|
6714
|
+
if (patchFlag & 4 /* PatchFlags.STYLE */) {
|
|
6684
6715
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
|
6685
6716
|
}
|
|
6686
6717
|
// props
|
|
@@ -6689,7 +6720,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6689
6720
|
// faster iteration.
|
|
6690
6721
|
// Note dynamic keys like :[foo]="bar" will cause this optimization to
|
|
6691
6722
|
// bail out and go through a full diff because we need to unset the old key
|
|
6692
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
6723
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
6693
6724
|
// if the flag is present then dynamicProps must be non-null
|
|
6694
6725
|
const propsToUpdate = n2.dynamicProps;
|
|
6695
6726
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
@@ -6705,7 +6736,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6705
6736
|
}
|
|
6706
6737
|
// text
|
|
6707
6738
|
// This flag is matched when the element has only dynamic text children.
|
|
6708
|
-
if (patchFlag & 1 /* TEXT */) {
|
|
6739
|
+
if (patchFlag & 1 /* PatchFlags.TEXT */) {
|
|
6709
6740
|
if (n1.children !== n2.children) {
|
|
6710
6741
|
hostSetElementText(el, n2.children);
|
|
6711
6742
|
}
|
|
@@ -6739,7 +6770,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6739
6770
|
// which also requires the correct parent container
|
|
6740
6771
|
!isSameVNodeType(oldVNode, newVNode) ||
|
|
6741
6772
|
// - In the case of a component, it could contain anything.
|
|
6742
|
-
oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
|
|
6773
|
+
oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
|
|
6743
6774
|
? hostParentNode(oldVNode.el)
|
|
6744
6775
|
: // In other cases, the parent container is not actually used so we
|
|
6745
6776
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -6777,7 +6808,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6777
6808
|
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
|
6778
6809
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
6779
6810
|
if (// #5523 dev root fragment may inherit directives
|
|
6780
|
-
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
6811
|
+
(isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */)) {
|
|
6781
6812
|
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
6782
6813
|
patchFlag = 0;
|
|
6783
6814
|
optimized = false;
|
|
@@ -6799,7 +6830,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6799
6830
|
}
|
|
6800
6831
|
else {
|
|
6801
6832
|
if (patchFlag > 0 &&
|
|
6802
|
-
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
6833
|
+
patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
|
|
6803
6834
|
dynamicChildren &&
|
|
6804
6835
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
6805
6836
|
// of renderSlot() with no valid children
|
|
@@ -6832,7 +6863,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6832
6863
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
6833
6864
|
n2.slotScopeIds = slotScopeIds;
|
|
6834
6865
|
if (n1 == null) {
|
|
6835
|
-
if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
6866
|
+
if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
6836
6867
|
parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
|
6837
6868
|
}
|
|
6838
6869
|
else {
|
|
@@ -6994,10 +7025,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6994
7025
|
// activated hook for keep-alive roots.
|
|
6995
7026
|
// #1742 activated hook must be accessed after first render
|
|
6996
7027
|
// since the hook may be injected by a child keep-alive
|
|
6997
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
7028
|
+
if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
6998
7029
|
(parent &&
|
|
6999
7030
|
isAsyncWrapper(parent.vnode) &&
|
|
7000
|
-
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
7031
|
+
parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
7001
7032
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
7002
7033
|
}
|
|
7003
7034
|
instance.isMounted = true;
|
|
@@ -7108,7 +7139,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7108
7139
|
pauseTracking();
|
|
7109
7140
|
// props update may have triggered pre-flush watchers.
|
|
7110
7141
|
// flush them before the render update.
|
|
7111
|
-
flushPreFlushCbs(
|
|
7142
|
+
flushPreFlushCbs();
|
|
7112
7143
|
resetTracking();
|
|
7113
7144
|
};
|
|
7114
7145
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
|
@@ -7118,22 +7149,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7118
7149
|
const { patchFlag, shapeFlag } = n2;
|
|
7119
7150
|
// fast path
|
|
7120
7151
|
if (patchFlag > 0) {
|
|
7121
|
-
if (patchFlag & 128 /* KEYED_FRAGMENT */) {
|
|
7152
|
+
if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
|
|
7122
7153
|
// this could be either fully-keyed or mixed (some keyed some not)
|
|
7123
7154
|
// presence of patchFlag means children are guaranteed to be arrays
|
|
7124
7155
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7125
7156
|
return;
|
|
7126
7157
|
}
|
|
7127
|
-
else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
|
|
7158
|
+
else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
|
|
7128
7159
|
// unkeyed
|
|
7129
7160
|
patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7130
7161
|
return;
|
|
7131
7162
|
}
|
|
7132
7163
|
}
|
|
7133
7164
|
// children has 3 possibilities: text, array or no children.
|
|
7134
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
7165
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
7135
7166
|
// text children fast path
|
|
7136
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7167
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7137
7168
|
unmountChildren(c1, parentComponent, parentSuspense);
|
|
7138
7169
|
}
|
|
7139
7170
|
if (c2 !== c1) {
|
|
@@ -7141,9 +7172,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7141
7172
|
}
|
|
7142
7173
|
}
|
|
7143
7174
|
else {
|
|
7144
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7175
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7145
7176
|
// prev children was array
|
|
7146
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7177
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7147
7178
|
// two arrays, cannot assume anything, do full diff
|
|
7148
7179
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7149
7180
|
}
|
|
@@ -7155,11 +7186,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7155
7186
|
else {
|
|
7156
7187
|
// prev children was text OR null
|
|
7157
7188
|
// new children is array OR null
|
|
7158
|
-
if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
7189
|
+
if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
7159
7190
|
hostSetElementText(container, '');
|
|
7160
7191
|
}
|
|
7161
7192
|
// mount new if array
|
|
7162
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7193
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7163
7194
|
mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7164
7195
|
}
|
|
7165
7196
|
}
|
|
@@ -7350,7 +7381,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7350
7381
|
// There is no stable subsequence (e.g. a reverse)
|
|
7351
7382
|
// OR current node is not among the stable sequence
|
|
7352
7383
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
7353
|
-
move(nextChild, container, anchor, 2 /* REORDER */);
|
|
7384
|
+
move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
|
|
7354
7385
|
}
|
|
7355
7386
|
else {
|
|
7356
7387
|
j--;
|
|
@@ -7361,15 +7392,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7361
7392
|
};
|
|
7362
7393
|
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
7363
7394
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
7364
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
7395
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
7365
7396
|
move(vnode.component.subTree, container, anchor, moveType);
|
|
7366
7397
|
return;
|
|
7367
7398
|
}
|
|
7368
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
7399
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
7369
7400
|
vnode.suspense.move(container, anchor, moveType);
|
|
7370
7401
|
return;
|
|
7371
7402
|
}
|
|
7372
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7403
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
7373
7404
|
type.move(vnode, container, anchor, internals);
|
|
7374
7405
|
return;
|
|
7375
7406
|
}
|
|
@@ -7386,11 +7417,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7386
7417
|
return;
|
|
7387
7418
|
}
|
|
7388
7419
|
// single nodes
|
|
7389
|
-
const needTransition = moveType !== 2 /* REORDER */ &&
|
|
7390
|
-
shapeFlag & 1 /* ELEMENT */ &&
|
|
7420
|
+
const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
|
|
7421
|
+
shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
7391
7422
|
transition;
|
|
7392
7423
|
if (needTransition) {
|
|
7393
|
-
if (moveType === 0 /* ENTER */) {
|
|
7424
|
+
if (moveType === 0 /* MoveType.ENTER */) {
|
|
7394
7425
|
transition.beforeEnter(el);
|
|
7395
7426
|
hostInsert(el, container, anchor);
|
|
7396
7427
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -7422,42 +7453,42 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7422
7453
|
if (ref != null) {
|
|
7423
7454
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
7424
7455
|
}
|
|
7425
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
7456
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
7426
7457
|
parentComponent.ctx.deactivate(vnode);
|
|
7427
7458
|
return;
|
|
7428
7459
|
}
|
|
7429
|
-
const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
|
|
7460
|
+
const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
|
|
7430
7461
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
7431
7462
|
let vnodeHook;
|
|
7432
7463
|
if (shouldInvokeVnodeHook &&
|
|
7433
7464
|
(vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
|
7434
7465
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7435
7466
|
}
|
|
7436
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
7467
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
7437
7468
|
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
7438
7469
|
}
|
|
7439
7470
|
else {
|
|
7440
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
7471
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
7441
7472
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
7442
7473
|
return;
|
|
7443
7474
|
}
|
|
7444
7475
|
if (shouldInvokeDirs) {
|
|
7445
7476
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
|
7446
7477
|
}
|
|
7447
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7478
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
7448
7479
|
vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
|
7449
7480
|
}
|
|
7450
7481
|
else if (dynamicChildren &&
|
|
7451
7482
|
// #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
7452
7483
|
(type !== Fragment ||
|
|
7453
|
-
(patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
|
|
7484
|
+
(patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
|
|
7454
7485
|
// fast path for block nodes: only need to unmount dynamic children.
|
|
7455
7486
|
unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
7456
7487
|
}
|
|
7457
7488
|
else if ((type === Fragment &&
|
|
7458
7489
|
patchFlag &
|
|
7459
|
-
(128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
|
|
7460
|
-
(!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
|
|
7490
|
+
(128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
|
|
7491
|
+
(!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
|
|
7461
7492
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
7462
7493
|
}
|
|
7463
7494
|
if (doRemove) {
|
|
@@ -7478,7 +7509,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7478
7509
|
const { type, el, anchor, transition } = vnode;
|
|
7479
7510
|
if (type === Fragment) {
|
|
7480
7511
|
if (vnode.patchFlag > 0 &&
|
|
7481
|
-
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
7512
|
+
vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ &&
|
|
7482
7513
|
transition &&
|
|
7483
7514
|
!transition.persisted) {
|
|
7484
7515
|
vnode.children.forEach(child => {
|
|
@@ -7505,7 +7536,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7505
7536
|
transition.afterLeave();
|
|
7506
7537
|
}
|
|
7507
7538
|
};
|
|
7508
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ &&
|
|
7539
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
7509
7540
|
transition &&
|
|
7510
7541
|
!transition.persisted) {
|
|
7511
7542
|
const { leave, delayLeave } = transition;
|
|
@@ -7581,10 +7612,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7581
7612
|
}
|
|
7582
7613
|
};
|
|
7583
7614
|
const getNextHostNode = vnode => {
|
|
7584
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */) {
|
|
7615
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
7585
7616
|
return getNextHostNode(vnode.component.subTree);
|
|
7586
7617
|
}
|
|
7587
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
7618
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
7588
7619
|
return vnode.suspense.next();
|
|
7589
7620
|
}
|
|
7590
7621
|
return hostNextSibling((vnode.anchor || vnode.el));
|
|
@@ -7598,6 +7629,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7598
7629
|
else {
|
|
7599
7630
|
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
|
7600
7631
|
}
|
|
7632
|
+
flushPreFlushCbs();
|
|
7601
7633
|
flushPostFlushCbs();
|
|
7602
7634
|
container._vnode = vnode;
|
|
7603
7635
|
};
|
|
@@ -7647,8 +7679,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
7647
7679
|
// guaranteed to be vnodes
|
|
7648
7680
|
const c1 = ch1[i];
|
|
7649
7681
|
let c2 = ch2[i];
|
|
7650
|
-
if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
|
|
7651
|
-
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
|
|
7682
|
+
if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
|
|
7683
|
+
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
7652
7684
|
c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
|
7653
7685
|
c2.el = c1.el;
|
|
7654
7686
|
}
|
|
@@ -7768,7 +7800,7 @@ const TeleportImpl = {
|
|
|
7768
7800
|
const mount = (container, anchor) => {
|
|
7769
7801
|
// Teleport *always* has Array children. This is enforced in both the
|
|
7770
7802
|
// compiler and vnode children normalization.
|
|
7771
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7803
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7772
7804
|
mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7773
7805
|
}
|
|
7774
7806
|
};
|
|
@@ -7804,7 +7836,7 @@ const TeleportImpl = {
|
|
|
7804
7836
|
if (!wasDisabled) {
|
|
7805
7837
|
// enabled -> disabled
|
|
7806
7838
|
// move into main container
|
|
7807
|
-
moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
|
|
7839
|
+
moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
7808
7840
|
}
|
|
7809
7841
|
}
|
|
7810
7842
|
else {
|
|
@@ -7812,7 +7844,7 @@ const TeleportImpl = {
|
|
|
7812
7844
|
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
7813
7845
|
const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
|
7814
7846
|
if (nextTarget) {
|
|
7815
|
-
moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
|
|
7847
|
+
moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
|
|
7816
7848
|
}
|
|
7817
7849
|
else {
|
|
7818
7850
|
warn$1('Invalid Teleport target on update:', target, `(${typeof target})`);
|
|
@@ -7821,7 +7853,7 @@ const TeleportImpl = {
|
|
|
7821
7853
|
else if (wasDisabled) {
|
|
7822
7854
|
// disabled -> enabled
|
|
7823
7855
|
// move into teleport target
|
|
7824
|
-
moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
|
|
7856
|
+
moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
7825
7857
|
}
|
|
7826
7858
|
}
|
|
7827
7859
|
}
|
|
@@ -7834,7 +7866,7 @@ const TeleportImpl = {
|
|
|
7834
7866
|
// an unmounted teleport should always remove its children if not disabled
|
|
7835
7867
|
if (doRemove || !isTeleportDisabled(props)) {
|
|
7836
7868
|
hostRemove(anchor);
|
|
7837
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7869
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7838
7870
|
for (let i = 0; i < children.length; i++) {
|
|
7839
7871
|
const child = children[i];
|
|
7840
7872
|
unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
|
|
@@ -7845,13 +7877,13 @@ const TeleportImpl = {
|
|
|
7845
7877
|
move: moveTeleport,
|
|
7846
7878
|
hydrate: hydrateTeleport
|
|
7847
7879
|
};
|
|
7848
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
|
|
7880
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* TeleportMoveTypes.REORDER */) {
|
|
7849
7881
|
// move target anchor if this is a target change.
|
|
7850
|
-
if (moveType === 0 /* TARGET_CHANGE */) {
|
|
7882
|
+
if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
|
|
7851
7883
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
7852
7884
|
}
|
|
7853
7885
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
7854
|
-
const isReorder = moveType === 2 /* REORDER */;
|
|
7886
|
+
const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
|
|
7855
7887
|
// move main view anchor if this is a re-order.
|
|
7856
7888
|
if (isReorder) {
|
|
7857
7889
|
insert(el, container, parentAnchor);
|
|
@@ -7861,9 +7893,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
7861
7893
|
// is not a reorder, or the teleport is disabled
|
|
7862
7894
|
if (!isReorder || isTeleportDisabled(props)) {
|
|
7863
7895
|
// Teleport has either Array children or no children.
|
|
7864
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7896
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7865
7897
|
for (let i = 0; i < children.length; i++) {
|
|
7866
|
-
move(children[i], container, parentAnchor, 2 /* REORDER */);
|
|
7898
|
+
move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
|
|
7867
7899
|
}
|
|
7868
7900
|
}
|
|
7869
7901
|
}
|
|
@@ -7878,7 +7910,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
7878
7910
|
// if multiple teleports rendered to the same target element, we need to
|
|
7879
7911
|
// pick up from where the last teleport finished instead of the first node
|
|
7880
7912
|
const targetNode = target._lpa || target.firstChild;
|
|
7881
|
-
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7913
|
+
if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7882
7914
|
if (isTeleportDisabled(vnode.props)) {
|
|
7883
7915
|
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
7884
7916
|
vnode.targetAnchor = targetNode;
|
|
@@ -8000,7 +8032,7 @@ function isVNode(value) {
|
|
|
8000
8032
|
return value ? value.__v_isVNode === true : false;
|
|
8001
8033
|
}
|
|
8002
8034
|
function isSameVNodeType(n1, n2) {
|
|
8003
|
-
if (n2.shapeFlag & 6 /* COMPONENT */ &&
|
|
8035
|
+
if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
8004
8036
|
hmrDirtyComponents.has(n2.type)) {
|
|
8005
8037
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
8006
8038
|
return false;
|
|
@@ -8031,7 +8063,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
8031
8063
|
: ref
|
|
8032
8064
|
: null);
|
|
8033
8065
|
};
|
|
8034
|
-
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
8066
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
8035
8067
|
const vnode = {
|
|
8036
8068
|
__v_isVNode: true,
|
|
8037
8069
|
__v_skip: true,
|
|
@@ -8062,7 +8094,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8062
8094
|
if (needFullChildrenNormalization) {
|
|
8063
8095
|
normalizeChildren(vnode, children);
|
|
8064
8096
|
// normalize suspense children
|
|
8065
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
8097
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
8066
8098
|
type.normalize(vnode);
|
|
8067
8099
|
}
|
|
8068
8100
|
}
|
|
@@ -8070,8 +8102,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8070
8102
|
// compiled element vnode - if children is passed, only possible types are
|
|
8071
8103
|
// string or Array.
|
|
8072
8104
|
vnode.shapeFlag |= isString(children)
|
|
8073
|
-
? 8 /* TEXT_CHILDREN */
|
|
8074
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
8105
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
8106
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
8075
8107
|
}
|
|
8076
8108
|
// validate key
|
|
8077
8109
|
if (vnode.key !== vnode.key) {
|
|
@@ -8087,10 +8119,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8087
8119
|
// component nodes also should always be patched, because even if the
|
|
8088
8120
|
// component doesn't need to update, it needs to persist the instance on to
|
|
8089
8121
|
// the next vnode so that it can be properly unmounted later.
|
|
8090
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
8122
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
8091
8123
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
8092
8124
|
// vnode should not be considered dynamic due to handler caching.
|
|
8093
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
8125
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
8094
8126
|
currentBlock.push(vnode);
|
|
8095
8127
|
}
|
|
8096
8128
|
return vnode;
|
|
@@ -8112,14 +8144,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
8112
8144
|
normalizeChildren(cloned, children);
|
|
8113
8145
|
}
|
|
8114
8146
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
8115
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
8147
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
8116
8148
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
8117
8149
|
}
|
|
8118
8150
|
else {
|
|
8119
8151
|
currentBlock.push(cloned);
|
|
8120
8152
|
}
|
|
8121
8153
|
}
|
|
8122
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
8154
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
8123
8155
|
return cloned;
|
|
8124
8156
|
}
|
|
8125
8157
|
// class component normalization.
|
|
@@ -8145,17 +8177,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
8145
8177
|
}
|
|
8146
8178
|
// encode the vnode type information into a bitmap
|
|
8147
8179
|
const shapeFlag = isString(type)
|
|
8148
|
-
? 1 /* ELEMENT */
|
|
8180
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
8149
8181
|
: isSuspense(type)
|
|
8150
|
-
? 128 /* SUSPENSE */
|
|
8182
|
+
? 128 /* ShapeFlags.SUSPENSE */
|
|
8151
8183
|
: isTeleport(type)
|
|
8152
|
-
? 64 /* TELEPORT */
|
|
8184
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
8153
8185
|
: isObject(type)
|
|
8154
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
8186
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
8155
8187
|
: isFunction(type)
|
|
8156
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
8188
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
8157
8189
|
: 0;
|
|
8158
|
-
if (shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
8190
|
+
if (shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
8159
8191
|
type = toRaw(type);
|
|
8160
8192
|
warn$1(`Vue received a Component which was made a reactive object. This can ` +
|
|
8161
8193
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
@@ -8194,7 +8226,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
8194
8226
|
: ref,
|
|
8195
8227
|
scopeId: vnode.scopeId,
|
|
8196
8228
|
slotScopeIds: vnode.slotScopeIds,
|
|
8197
|
-
children: patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
8229
|
+
children: patchFlag === -1 /* PatchFlags.HOISTED */ && isArray(children)
|
|
8198
8230
|
? children.map(deepCloneVNode)
|
|
8199
8231
|
: children,
|
|
8200
8232
|
target: vnode.target,
|
|
@@ -8207,8 +8239,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
8207
8239
|
// fast paths only.
|
|
8208
8240
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
8209
8241
|
? patchFlag === -1 // hoisted node
|
|
8210
|
-
? 16 /* FULL_PROPS */
|
|
8211
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
8242
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
8243
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
8212
8244
|
: patchFlag,
|
|
8213
8245
|
dynamicProps: vnode.dynamicProps,
|
|
8214
8246
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -8298,10 +8330,10 @@ function normalizeChildren(vnode, children) {
|
|
|
8298
8330
|
children = null;
|
|
8299
8331
|
}
|
|
8300
8332
|
else if (isArray(children)) {
|
|
8301
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
8333
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
8302
8334
|
}
|
|
8303
8335
|
else if (typeof children === 'object') {
|
|
8304
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
8336
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
8305
8337
|
// Normalize slot to plain children for plain element and Teleport
|
|
8306
8338
|
const slot = children.default;
|
|
8307
8339
|
if (slot) {
|
|
@@ -8313,37 +8345,37 @@ function normalizeChildren(vnode, children) {
|
|
|
8313
8345
|
return;
|
|
8314
8346
|
}
|
|
8315
8347
|
else {
|
|
8316
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
8348
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
8317
8349
|
const slotFlag = children._;
|
|
8318
8350
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
8319
8351
|
children._ctx = currentRenderingInstance;
|
|
8320
8352
|
}
|
|
8321
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
8353
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
8322
8354
|
// a child component receives forwarded slots from the parent.
|
|
8323
8355
|
// its slot type is determined by its parent's slot type.
|
|
8324
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
8325
|
-
children._ = 1 /* STABLE */;
|
|
8356
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
8357
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
8326
8358
|
}
|
|
8327
8359
|
else {
|
|
8328
|
-
children._ = 2 /* DYNAMIC */;
|
|
8329
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
8360
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
8361
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
8330
8362
|
}
|
|
8331
8363
|
}
|
|
8332
8364
|
}
|
|
8333
8365
|
}
|
|
8334
8366
|
else if (isFunction(children)) {
|
|
8335
8367
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
8336
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
8368
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
8337
8369
|
}
|
|
8338
8370
|
else {
|
|
8339
8371
|
children = String(children);
|
|
8340
8372
|
// force teleport children to array so it can be moved around
|
|
8341
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
8342
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
8373
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
8374
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
8343
8375
|
children = [createTextVNode(children)];
|
|
8344
8376
|
}
|
|
8345
8377
|
else {
|
|
8346
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
8378
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
8347
8379
|
}
|
|
8348
8380
|
}
|
|
8349
8381
|
vnode.children = children;
|
|
@@ -8381,7 +8413,7 @@ function mergeProps(...args) {
|
|
|
8381
8413
|
return ret;
|
|
8382
8414
|
}
|
|
8383
8415
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
8384
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
8416
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
|
|
8385
8417
|
vnode,
|
|
8386
8418
|
prevVNode
|
|
8387
8419
|
]);
|
|
@@ -8489,7 +8521,7 @@ function validateComponentName(name, config) {
|
|
|
8489
8521
|
}
|
|
8490
8522
|
}
|
|
8491
8523
|
function isStatefulComponent(instance) {
|
|
8492
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
8524
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
8493
8525
|
}
|
|
8494
8526
|
let isInSSRComponentSetup = false;
|
|
8495
8527
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -8544,7 +8576,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
8544
8576
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
8545
8577
|
setCurrentInstance(instance);
|
|
8546
8578
|
pauseTracking();
|
|
8547
|
-
const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [shallowReadonly(instance.props) , setupContext]);
|
|
8579
|
+
const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [shallowReadonly(instance.props) , setupContext]);
|
|
8548
8580
|
resetTracking();
|
|
8549
8581
|
unsetCurrentInstance();
|
|
8550
8582
|
if (isPromise(setupResult)) {
|
|
@@ -8556,7 +8588,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
8556
8588
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
8557
8589
|
})
|
|
8558
8590
|
.catch(e => {
|
|
8559
|
-
handleError(e, instance, 0 /* SETUP_FUNCTION */);
|
|
8591
|
+
handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
8560
8592
|
});
|
|
8561
8593
|
}
|
|
8562
8594
|
else {
|
|
@@ -8683,7 +8715,7 @@ function createAttrsProxy(instance) {
|
|
|
8683
8715
|
return new Proxy(instance.attrs, {
|
|
8684
8716
|
get(target, key) {
|
|
8685
8717
|
markAttrsAccessed();
|
|
8686
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
8718
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
8687
8719
|
return target[key];
|
|
8688
8720
|
},
|
|
8689
8721
|
set() {
|
|
@@ -8739,10 +8771,10 @@ function getExposeProxy(instance) {
|
|
|
8739
8771
|
}
|
|
8740
8772
|
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
8741
8773
|
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
8742
|
-
function getComponentName(Component) {
|
|
8774
|
+
function getComponentName(Component, includeInferred = true) {
|
|
8743
8775
|
return isFunction(Component)
|
|
8744
8776
|
? Component.displayName || Component.name
|
|
8745
|
-
: Component.name;
|
|
8777
|
+
: Component.name || (includeInferred && Component.__name);
|
|
8746
8778
|
}
|
|
8747
8779
|
/* istanbul ignore next */
|
|
8748
8780
|
function formatComponentName(instance, Component, isRoot = false) {
|
|
@@ -9186,9 +9218,9 @@ function isMemoSame(cached, memo) {
|
|
|
9186
9218
|
}
|
|
9187
9219
|
|
|
9188
9220
|
// Core API ------------------------------------------------------------------
|
|
9189
|
-
const version = "3.2.
|
|
9221
|
+
const version = "3.2.38";
|
|
9190
9222
|
/**
|
|
9191
|
-
* SSR utils for \@vue/server-renderer. Only exposed in
|
|
9223
|
+
* SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
|
|
9192
9224
|
* @internal
|
|
9193
9225
|
*/
|
|
9194
9226
|
const ssrUtils = (null);
|
|
@@ -9497,7 +9529,7 @@ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
|
|
|
9497
9529
|
// if the low-res timestamp which is bigger than the event timestamp
|
|
9498
9530
|
// (which is evaluated AFTER) it means the event is using a hi-res timestamp,
|
|
9499
9531
|
// and we need to use the hi-res version for event listeners as well.
|
|
9500
|
-
_getNow =
|
|
9532
|
+
_getNow = performance.now.bind(performance);
|
|
9501
9533
|
}
|
|
9502
9534
|
// #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
|
|
9503
9535
|
// and does not fire microtasks in between event propagation, so safe to exclude.
|
|
@@ -9553,7 +9585,8 @@ function parseName(name) {
|
|
|
9553
9585
|
options[m[0].toLowerCase()] = true;
|
|
9554
9586
|
}
|
|
9555
9587
|
}
|
|
9556
|
-
|
|
9588
|
+
const event = name[2] === ':' ? name.slice(3) : hyphenate(name.slice(2));
|
|
9589
|
+
return [event, options];
|
|
9557
9590
|
}
|
|
9558
9591
|
function createInvoker(initialValue, instance) {
|
|
9559
9592
|
const invoker = (e) => {
|
|
@@ -9565,7 +9598,7 @@ function createInvoker(initialValue, instance) {
|
|
|
9565
9598
|
// AFTER it was attached.
|
|
9566
9599
|
const timeStamp = e.timeStamp || _getNow();
|
|
9567
9600
|
if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
|
|
9568
|
-
callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* NATIVE_EVENT_HANDLER */, [e]);
|
|
9601
|
+
callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* ErrorCodes.NATIVE_EVENT_HANDLER */, [e]);
|
|
9569
9602
|
}
|
|
9570
9603
|
};
|
|
9571
9604
|
invoker.value = initialValue;
|
|
@@ -9920,7 +9953,7 @@ function useCssVars(getter) {
|
|
|
9920
9953
|
});
|
|
9921
9954
|
}
|
|
9922
9955
|
function setVarsOnVNode(vnode, vars) {
|
|
9923
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
9956
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
9924
9957
|
const suspense = vnode.suspense;
|
|
9925
9958
|
vnode = suspense.activeBranch;
|
|
9926
9959
|
if (suspense.pendingBranch && !suspense.isHydrating) {
|
|
@@ -9933,7 +9966,7 @@ function setVarsOnVNode(vnode, vars) {
|
|
|
9933
9966
|
while (vnode.component) {
|
|
9934
9967
|
vnode = vnode.component.subTree;
|
|
9935
9968
|
}
|
|
9936
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ && vnode.el) {
|
|
9969
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && vnode.el) {
|
|
9937
9970
|
setVarsOnNode(vnode.el, vars);
|
|
9938
9971
|
}
|
|
9939
9972
|
else if (vnode.type === Fragment) {
|
|
@@ -10027,9 +10060,8 @@ function resolveTransitionProps(rawProps) {
|
|
|
10027
10060
|
removeTransitionClass(el, isAppear ? appearActiveClass : enterActiveClass);
|
|
10028
10061
|
done && done();
|
|
10029
10062
|
};
|
|
10030
|
-
let isLeaving = false;
|
|
10031
10063
|
const finishLeave = (el, done) => {
|
|
10032
|
-
|
|
10064
|
+
el._isLeaving = false;
|
|
10033
10065
|
removeTransitionClass(el, leaveFromClass);
|
|
10034
10066
|
removeTransitionClass(el, leaveToClass);
|
|
10035
10067
|
removeTransitionClass(el, leaveActiveClass);
|
|
@@ -10063,14 +10095,14 @@ function resolveTransitionProps(rawProps) {
|
|
|
10063
10095
|
onEnter: makeEnterHook(false),
|
|
10064
10096
|
onAppear: makeEnterHook(true),
|
|
10065
10097
|
onLeave(el, done) {
|
|
10066
|
-
|
|
10098
|
+
el._isLeaving = true;
|
|
10067
10099
|
const resolve = () => finishLeave(el, done);
|
|
10068
10100
|
addTransitionClass(el, leaveFromClass);
|
|
10069
10101
|
// force reflow so *-leave-from classes immediately take effect (#2593)
|
|
10070
10102
|
forceReflow();
|
|
10071
10103
|
addTransitionClass(el, leaveActiveClass);
|
|
10072
10104
|
nextFrame(() => {
|
|
10073
|
-
if (!
|
|
10105
|
+
if (!el._isLeaving) {
|
|
10074
10106
|
// cancelled
|
|
10075
10107
|
return;
|
|
10076
10108
|
}
|