@vue/runtime-dom 3.2.37 → 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 +3 -2
- package/dist/runtime-dom.cjs.prod.js +3 -2
- package/dist/runtime-dom.esm-browser.js +390 -362
- package/dist/runtime-dom.esm-browser.prod.js +1 -1
- package/dist/runtime-dom.esm-bundler.js +5 -4
- package/dist/runtime-dom.global.js +390 -362
- 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,
|
|
@@ -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);
|
|
@@ -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.
|
|
@@ -6019,14 +6045,14 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6019
6045
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
6020
6046
|
const domType = node.nodeType;
|
|
6021
6047
|
vnode.el = node;
|
|
6022
|
-
if (patchFlag === -2 /* BAIL */) {
|
|
6048
|
+
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
6023
6049
|
optimized = false;
|
|
6024
6050
|
vnode.dynamicChildren = null;
|
|
6025
6051
|
}
|
|
6026
6052
|
let nextNode = null;
|
|
6027
6053
|
switch (type) {
|
|
6028
6054
|
case Text:
|
|
6029
|
-
if (domType !== 3 /* TEXT */) {
|
|
6055
|
+
if (domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
6030
6056
|
// #5728 empty text node inside a slot can cause hydration failure
|
|
6031
6057
|
// because the server rendered HTML won't contain a text node
|
|
6032
6058
|
if (vnode.children === '') {
|
|
@@ -6049,7 +6075,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6049
6075
|
}
|
|
6050
6076
|
break;
|
|
6051
6077
|
case Comment:
|
|
6052
|
-
if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
6078
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
|
|
6053
6079
|
nextNode = onMismatch();
|
|
6054
6080
|
}
|
|
6055
6081
|
else {
|
|
@@ -6057,7 +6083,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6057
6083
|
}
|
|
6058
6084
|
break;
|
|
6059
6085
|
case Static:
|
|
6060
|
-
if (domType !== 1 /* ELEMENT */ && domType !== 3 /* TEXT */) {
|
|
6086
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
6061
6087
|
nextNode = onMismatch();
|
|
6062
6088
|
}
|
|
6063
6089
|
else {
|
|
@@ -6069,7 +6095,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6069
6095
|
for (let i = 0; i < vnode.staticCount; i++) {
|
|
6070
6096
|
if (needToAdoptContent)
|
|
6071
6097
|
vnode.children +=
|
|
6072
|
-
nextNode.nodeType === 1 /* ELEMENT */
|
|
6098
|
+
nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
|
|
6073
6099
|
? nextNode.outerHTML
|
|
6074
6100
|
: nextNode.data;
|
|
6075
6101
|
if (i === vnode.staticCount - 1) {
|
|
@@ -6089,8 +6115,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6089
6115
|
}
|
|
6090
6116
|
break;
|
|
6091
6117
|
default:
|
|
6092
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
6093
|
-
if (domType !== 1 /* ELEMENT */ ||
|
|
6118
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
6119
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
|
|
6094
6120
|
vnode.type.toLowerCase() !==
|
|
6095
6121
|
node.tagName.toLowerCase()) {
|
|
6096
6122
|
nextNode = onMismatch();
|
|
@@ -6099,7 +6125,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6099
6125
|
nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
6100
6126
|
}
|
|
6101
6127
|
}
|
|
6102
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
6128
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6103
6129
|
// when setting up the render effect, if the initial vnode already
|
|
6104
6130
|
// has .el set, the component will perform hydration instead of mount
|
|
6105
6131
|
// on its sub-tree.
|
|
@@ -6138,15 +6164,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6138
6164
|
vnode.component.subTree = subTree;
|
|
6139
6165
|
}
|
|
6140
6166
|
}
|
|
6141
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
6142
|
-
if (domType !== 8 /* COMMENT */) {
|
|
6167
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6168
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
|
|
6143
6169
|
nextNode = onMismatch();
|
|
6144
6170
|
}
|
|
6145
6171
|
else {
|
|
6146
6172
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
6147
6173
|
}
|
|
6148
6174
|
}
|
|
6149
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6175
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6150
6176
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
6151
6177
|
}
|
|
6152
6178
|
else {
|
|
@@ -6174,7 +6200,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6174
6200
|
if (props) {
|
|
6175
6201
|
if (forcePatchValue ||
|
|
6176
6202
|
!optimized ||
|
|
6177
|
-
patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
|
|
6203
|
+
patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
|
|
6178
6204
|
for (const key in props) {
|
|
6179
6205
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
6180
6206
|
(isOn(key) && !isReservedProp(key))) {
|
|
@@ -6203,7 +6229,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6203
6229
|
}, parentSuspense);
|
|
6204
6230
|
}
|
|
6205
6231
|
// children
|
|
6206
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
|
|
6232
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
|
|
6207
6233
|
// skip if element has innerHTML / textContent
|
|
6208
6234
|
!(props && (props.innerHTML || props.textContent))) {
|
|
6209
6235
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -6221,7 +6247,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6221
6247
|
remove(cur);
|
|
6222
6248
|
}
|
|
6223
6249
|
}
|
|
6224
|
-
else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
6250
|
+
else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
6225
6251
|
if (el.textContent !== vnode.children) {
|
|
6226
6252
|
hasMismatch = true;
|
|
6227
6253
|
warn$1(`Hydration text content mismatch in <${vnode.type}>:\n` +
|
|
@@ -6284,7 +6310,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6284
6310
|
};
|
|
6285
6311
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
6286
6312
|
hasMismatch = true;
|
|
6287
|
-
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 */
|
|
6288
6314
|
? `(text)`
|
|
6289
6315
|
: isComment(node) && node.data === '['
|
|
6290
6316
|
? `(start of fragment)`
|
|
@@ -6415,7 +6441,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6415
6441
|
unmount(n1, parentComponent, parentSuspense, true);
|
|
6416
6442
|
n1 = null;
|
|
6417
6443
|
}
|
|
6418
|
-
if (n2.patchFlag === -2 /* BAIL */) {
|
|
6444
|
+
if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
6419
6445
|
optimized = false;
|
|
6420
6446
|
n2.dynamicChildren = null;
|
|
6421
6447
|
}
|
|
@@ -6439,16 +6465,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6439
6465
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6440
6466
|
break;
|
|
6441
6467
|
default:
|
|
6442
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
6468
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
6443
6469
|
processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6444
6470
|
}
|
|
6445
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
6471
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6446
6472
|
processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6447
6473
|
}
|
|
6448
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
6474
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6449
6475
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
6450
6476
|
}
|
|
6451
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6477
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6452
6478
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
6453
6479
|
}
|
|
6454
6480
|
else {
|
|
@@ -6534,10 +6560,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6534
6560
|
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
6535
6561
|
// mount children first, since some props may rely on child content
|
|
6536
6562
|
// being already rendered, e.g. `<select value>`
|
|
6537
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
6563
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
6538
6564
|
hostSetElementText(el, vnode.children);
|
|
6539
6565
|
}
|
|
6540
|
-
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6566
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6541
6567
|
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
6542
6568
|
}
|
|
6543
6569
|
if (dirs) {
|
|
@@ -6613,7 +6639,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6613
6639
|
if (parentComponent) {
|
|
6614
6640
|
let subTree = parentComponent.subTree;
|
|
6615
6641
|
if (subTree.patchFlag > 0 &&
|
|
6616
|
-
subTree.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
6642
|
+
subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
6617
6643
|
subTree =
|
|
6618
6644
|
filterSingleRoot(subTree.children) || subTree;
|
|
6619
6645
|
}
|
|
@@ -6636,7 +6662,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6636
6662
|
let { patchFlag, dynamicChildren, dirs } = n2;
|
|
6637
6663
|
// #1426 take the old vnode's patch flag into account since user may clone a
|
|
6638
6664
|
// compiler-generated vnode, which de-opts to FULL_PROPS
|
|
6639
|
-
patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
|
|
6665
|
+
patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
|
|
6640
6666
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
6641
6667
|
const newProps = n2.props || EMPTY_OBJ;
|
|
6642
6668
|
let vnodeHook;
|
|
@@ -6671,21 +6697,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6671
6697
|
// generated by the compiler and can take the fast path.
|
|
6672
6698
|
// in this path old node and new node are guaranteed to have the same shape
|
|
6673
6699
|
// (i.e. at the exact same position in the source template)
|
|
6674
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
6700
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
6675
6701
|
// element props contain dynamic keys, full diff needed
|
|
6676
6702
|
patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
|
6677
6703
|
}
|
|
6678
6704
|
else {
|
|
6679
6705
|
// class
|
|
6680
6706
|
// this flag is matched when the element has dynamic class bindings.
|
|
6681
|
-
if (patchFlag & 2 /* CLASS */) {
|
|
6707
|
+
if (patchFlag & 2 /* PatchFlags.CLASS */) {
|
|
6682
6708
|
if (oldProps.class !== newProps.class) {
|
|
6683
6709
|
hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
|
6684
6710
|
}
|
|
6685
6711
|
}
|
|
6686
6712
|
// style
|
|
6687
6713
|
// this flag is matched when the element has dynamic style bindings
|
|
6688
|
-
if (patchFlag & 4 /* STYLE */) {
|
|
6714
|
+
if (patchFlag & 4 /* PatchFlags.STYLE */) {
|
|
6689
6715
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
|
6690
6716
|
}
|
|
6691
6717
|
// props
|
|
@@ -6694,7 +6720,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6694
6720
|
// faster iteration.
|
|
6695
6721
|
// Note dynamic keys like :[foo]="bar" will cause this optimization to
|
|
6696
6722
|
// bail out and go through a full diff because we need to unset the old key
|
|
6697
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
6723
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
6698
6724
|
// if the flag is present then dynamicProps must be non-null
|
|
6699
6725
|
const propsToUpdate = n2.dynamicProps;
|
|
6700
6726
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
@@ -6710,7 +6736,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6710
6736
|
}
|
|
6711
6737
|
// text
|
|
6712
6738
|
// This flag is matched when the element has only dynamic text children.
|
|
6713
|
-
if (patchFlag & 1 /* TEXT */) {
|
|
6739
|
+
if (patchFlag & 1 /* PatchFlags.TEXT */) {
|
|
6714
6740
|
if (n1.children !== n2.children) {
|
|
6715
6741
|
hostSetElementText(el, n2.children);
|
|
6716
6742
|
}
|
|
@@ -6744,7 +6770,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6744
6770
|
// which also requires the correct parent container
|
|
6745
6771
|
!isSameVNodeType(oldVNode, newVNode) ||
|
|
6746
6772
|
// - In the case of a component, it could contain anything.
|
|
6747
|
-
oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
|
|
6773
|
+
oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
|
|
6748
6774
|
? hostParentNode(oldVNode.el)
|
|
6749
6775
|
: // In other cases, the parent container is not actually used so we
|
|
6750
6776
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -6782,7 +6808,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6782
6808
|
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
|
6783
6809
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
6784
6810
|
if (// #5523 dev root fragment may inherit directives
|
|
6785
|
-
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
6811
|
+
(isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */)) {
|
|
6786
6812
|
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
6787
6813
|
patchFlag = 0;
|
|
6788
6814
|
optimized = false;
|
|
@@ -6804,7 +6830,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6804
6830
|
}
|
|
6805
6831
|
else {
|
|
6806
6832
|
if (patchFlag > 0 &&
|
|
6807
|
-
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
6833
|
+
patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
|
|
6808
6834
|
dynamicChildren &&
|
|
6809
6835
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
6810
6836
|
// of renderSlot() with no valid children
|
|
@@ -6837,7 +6863,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6837
6863
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
6838
6864
|
n2.slotScopeIds = slotScopeIds;
|
|
6839
6865
|
if (n1 == null) {
|
|
6840
|
-
if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
6866
|
+
if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
6841
6867
|
parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
|
6842
6868
|
}
|
|
6843
6869
|
else {
|
|
@@ -6999,10 +7025,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6999
7025
|
// activated hook for keep-alive roots.
|
|
7000
7026
|
// #1742 activated hook must be accessed after first render
|
|
7001
7027
|
// since the hook may be injected by a child keep-alive
|
|
7002
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
7028
|
+
if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
7003
7029
|
(parent &&
|
|
7004
7030
|
isAsyncWrapper(parent.vnode) &&
|
|
7005
|
-
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
7031
|
+
parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
7006
7032
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
7007
7033
|
}
|
|
7008
7034
|
instance.isMounted = true;
|
|
@@ -7113,7 +7139,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7113
7139
|
pauseTracking();
|
|
7114
7140
|
// props update may have triggered pre-flush watchers.
|
|
7115
7141
|
// flush them before the render update.
|
|
7116
|
-
flushPreFlushCbs(
|
|
7142
|
+
flushPreFlushCbs();
|
|
7117
7143
|
resetTracking();
|
|
7118
7144
|
};
|
|
7119
7145
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
|
@@ -7123,22 +7149,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7123
7149
|
const { patchFlag, shapeFlag } = n2;
|
|
7124
7150
|
// fast path
|
|
7125
7151
|
if (patchFlag > 0) {
|
|
7126
|
-
if (patchFlag & 128 /* KEYED_FRAGMENT */) {
|
|
7152
|
+
if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
|
|
7127
7153
|
// this could be either fully-keyed or mixed (some keyed some not)
|
|
7128
7154
|
// presence of patchFlag means children are guaranteed to be arrays
|
|
7129
7155
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7130
7156
|
return;
|
|
7131
7157
|
}
|
|
7132
|
-
else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
|
|
7158
|
+
else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
|
|
7133
7159
|
// unkeyed
|
|
7134
7160
|
patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7135
7161
|
return;
|
|
7136
7162
|
}
|
|
7137
7163
|
}
|
|
7138
7164
|
// children has 3 possibilities: text, array or no children.
|
|
7139
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
7165
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
7140
7166
|
// text children fast path
|
|
7141
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7167
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7142
7168
|
unmountChildren(c1, parentComponent, parentSuspense);
|
|
7143
7169
|
}
|
|
7144
7170
|
if (c2 !== c1) {
|
|
@@ -7146,9 +7172,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7146
7172
|
}
|
|
7147
7173
|
}
|
|
7148
7174
|
else {
|
|
7149
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7175
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7150
7176
|
// prev children was array
|
|
7151
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7177
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7152
7178
|
// two arrays, cannot assume anything, do full diff
|
|
7153
7179
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7154
7180
|
}
|
|
@@ -7160,11 +7186,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7160
7186
|
else {
|
|
7161
7187
|
// prev children was text OR null
|
|
7162
7188
|
// new children is array OR null
|
|
7163
|
-
if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
7189
|
+
if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
7164
7190
|
hostSetElementText(container, '');
|
|
7165
7191
|
}
|
|
7166
7192
|
// mount new if array
|
|
7167
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7193
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7168
7194
|
mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7169
7195
|
}
|
|
7170
7196
|
}
|
|
@@ -7355,7 +7381,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7355
7381
|
// There is no stable subsequence (e.g. a reverse)
|
|
7356
7382
|
// OR current node is not among the stable sequence
|
|
7357
7383
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
7358
|
-
move(nextChild, container, anchor, 2 /* REORDER */);
|
|
7384
|
+
move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
|
|
7359
7385
|
}
|
|
7360
7386
|
else {
|
|
7361
7387
|
j--;
|
|
@@ -7366,15 +7392,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7366
7392
|
};
|
|
7367
7393
|
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
7368
7394
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
7369
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
7395
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
7370
7396
|
move(vnode.component.subTree, container, anchor, moveType);
|
|
7371
7397
|
return;
|
|
7372
7398
|
}
|
|
7373
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
7399
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
7374
7400
|
vnode.suspense.move(container, anchor, moveType);
|
|
7375
7401
|
return;
|
|
7376
7402
|
}
|
|
7377
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7403
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
7378
7404
|
type.move(vnode, container, anchor, internals);
|
|
7379
7405
|
return;
|
|
7380
7406
|
}
|
|
@@ -7391,11 +7417,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7391
7417
|
return;
|
|
7392
7418
|
}
|
|
7393
7419
|
// single nodes
|
|
7394
|
-
const needTransition = moveType !== 2 /* REORDER */ &&
|
|
7395
|
-
shapeFlag & 1 /* ELEMENT */ &&
|
|
7420
|
+
const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
|
|
7421
|
+
shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
7396
7422
|
transition;
|
|
7397
7423
|
if (needTransition) {
|
|
7398
|
-
if (moveType === 0 /* ENTER */) {
|
|
7424
|
+
if (moveType === 0 /* MoveType.ENTER */) {
|
|
7399
7425
|
transition.beforeEnter(el);
|
|
7400
7426
|
hostInsert(el, container, anchor);
|
|
7401
7427
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -7427,42 +7453,42 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7427
7453
|
if (ref != null) {
|
|
7428
7454
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
7429
7455
|
}
|
|
7430
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
7456
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
7431
7457
|
parentComponent.ctx.deactivate(vnode);
|
|
7432
7458
|
return;
|
|
7433
7459
|
}
|
|
7434
|
-
const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
|
|
7460
|
+
const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
|
|
7435
7461
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
7436
7462
|
let vnodeHook;
|
|
7437
7463
|
if (shouldInvokeVnodeHook &&
|
|
7438
7464
|
(vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
|
7439
7465
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7440
7466
|
}
|
|
7441
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
7467
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
7442
7468
|
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
7443
7469
|
}
|
|
7444
7470
|
else {
|
|
7445
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
7471
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
7446
7472
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
7447
7473
|
return;
|
|
7448
7474
|
}
|
|
7449
7475
|
if (shouldInvokeDirs) {
|
|
7450
7476
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
|
7451
7477
|
}
|
|
7452
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7478
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
7453
7479
|
vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
|
7454
7480
|
}
|
|
7455
7481
|
else if (dynamicChildren &&
|
|
7456
7482
|
// #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
7457
7483
|
(type !== Fragment ||
|
|
7458
|
-
(patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
|
|
7484
|
+
(patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
|
|
7459
7485
|
// fast path for block nodes: only need to unmount dynamic children.
|
|
7460
7486
|
unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
7461
7487
|
}
|
|
7462
7488
|
else if ((type === Fragment &&
|
|
7463
7489
|
patchFlag &
|
|
7464
|
-
(128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
|
|
7465
|
-
(!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
|
|
7490
|
+
(128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
|
|
7491
|
+
(!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
|
|
7466
7492
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
7467
7493
|
}
|
|
7468
7494
|
if (doRemove) {
|
|
@@ -7483,7 +7509,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7483
7509
|
const { type, el, anchor, transition } = vnode;
|
|
7484
7510
|
if (type === Fragment) {
|
|
7485
7511
|
if (vnode.patchFlag > 0 &&
|
|
7486
|
-
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
7512
|
+
vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ &&
|
|
7487
7513
|
transition &&
|
|
7488
7514
|
!transition.persisted) {
|
|
7489
7515
|
vnode.children.forEach(child => {
|
|
@@ -7510,7 +7536,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7510
7536
|
transition.afterLeave();
|
|
7511
7537
|
}
|
|
7512
7538
|
};
|
|
7513
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ &&
|
|
7539
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
7514
7540
|
transition &&
|
|
7515
7541
|
!transition.persisted) {
|
|
7516
7542
|
const { leave, delayLeave } = transition;
|
|
@@ -7586,10 +7612,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7586
7612
|
}
|
|
7587
7613
|
};
|
|
7588
7614
|
const getNextHostNode = vnode => {
|
|
7589
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */) {
|
|
7615
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
7590
7616
|
return getNextHostNode(vnode.component.subTree);
|
|
7591
7617
|
}
|
|
7592
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
7618
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
7593
7619
|
return vnode.suspense.next();
|
|
7594
7620
|
}
|
|
7595
7621
|
return hostNextSibling((vnode.anchor || vnode.el));
|
|
@@ -7603,6 +7629,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7603
7629
|
else {
|
|
7604
7630
|
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
|
7605
7631
|
}
|
|
7632
|
+
flushPreFlushCbs();
|
|
7606
7633
|
flushPostFlushCbs();
|
|
7607
7634
|
container._vnode = vnode;
|
|
7608
7635
|
};
|
|
@@ -7652,8 +7679,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
7652
7679
|
// guaranteed to be vnodes
|
|
7653
7680
|
const c1 = ch1[i];
|
|
7654
7681
|
let c2 = ch2[i];
|
|
7655
|
-
if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
|
|
7656
|
-
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 */) {
|
|
7657
7684
|
c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
|
7658
7685
|
c2.el = c1.el;
|
|
7659
7686
|
}
|
|
@@ -7773,7 +7800,7 @@ const TeleportImpl = {
|
|
|
7773
7800
|
const mount = (container, anchor) => {
|
|
7774
7801
|
// Teleport *always* has Array children. This is enforced in both the
|
|
7775
7802
|
// compiler and vnode children normalization.
|
|
7776
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7803
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7777
7804
|
mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7778
7805
|
}
|
|
7779
7806
|
};
|
|
@@ -7809,7 +7836,7 @@ const TeleportImpl = {
|
|
|
7809
7836
|
if (!wasDisabled) {
|
|
7810
7837
|
// enabled -> disabled
|
|
7811
7838
|
// move into main container
|
|
7812
|
-
moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
|
|
7839
|
+
moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
7813
7840
|
}
|
|
7814
7841
|
}
|
|
7815
7842
|
else {
|
|
@@ -7817,7 +7844,7 @@ const TeleportImpl = {
|
|
|
7817
7844
|
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
7818
7845
|
const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
|
7819
7846
|
if (nextTarget) {
|
|
7820
|
-
moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
|
|
7847
|
+
moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
|
|
7821
7848
|
}
|
|
7822
7849
|
else {
|
|
7823
7850
|
warn$1('Invalid Teleport target on update:', target, `(${typeof target})`);
|
|
@@ -7826,7 +7853,7 @@ const TeleportImpl = {
|
|
|
7826
7853
|
else if (wasDisabled) {
|
|
7827
7854
|
// disabled -> enabled
|
|
7828
7855
|
// move into teleport target
|
|
7829
|
-
moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
|
|
7856
|
+
moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
7830
7857
|
}
|
|
7831
7858
|
}
|
|
7832
7859
|
}
|
|
@@ -7839,7 +7866,7 @@ const TeleportImpl = {
|
|
|
7839
7866
|
// an unmounted teleport should always remove its children if not disabled
|
|
7840
7867
|
if (doRemove || !isTeleportDisabled(props)) {
|
|
7841
7868
|
hostRemove(anchor);
|
|
7842
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7869
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7843
7870
|
for (let i = 0; i < children.length; i++) {
|
|
7844
7871
|
const child = children[i];
|
|
7845
7872
|
unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
|
|
@@ -7850,13 +7877,13 @@ const TeleportImpl = {
|
|
|
7850
7877
|
move: moveTeleport,
|
|
7851
7878
|
hydrate: hydrateTeleport
|
|
7852
7879
|
};
|
|
7853
|
-
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 */) {
|
|
7854
7881
|
// move target anchor if this is a target change.
|
|
7855
|
-
if (moveType === 0 /* TARGET_CHANGE */) {
|
|
7882
|
+
if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
|
|
7856
7883
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
7857
7884
|
}
|
|
7858
7885
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
7859
|
-
const isReorder = moveType === 2 /* REORDER */;
|
|
7886
|
+
const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
|
|
7860
7887
|
// move main view anchor if this is a re-order.
|
|
7861
7888
|
if (isReorder) {
|
|
7862
7889
|
insert(el, container, parentAnchor);
|
|
@@ -7866,9 +7893,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
7866
7893
|
// is not a reorder, or the teleport is disabled
|
|
7867
7894
|
if (!isReorder || isTeleportDisabled(props)) {
|
|
7868
7895
|
// Teleport has either Array children or no children.
|
|
7869
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7896
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7870
7897
|
for (let i = 0; i < children.length; i++) {
|
|
7871
|
-
move(children[i], container, parentAnchor, 2 /* REORDER */);
|
|
7898
|
+
move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
|
|
7872
7899
|
}
|
|
7873
7900
|
}
|
|
7874
7901
|
}
|
|
@@ -7883,7 +7910,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
7883
7910
|
// if multiple teleports rendered to the same target element, we need to
|
|
7884
7911
|
// pick up from where the last teleport finished instead of the first node
|
|
7885
7912
|
const targetNode = target._lpa || target.firstChild;
|
|
7886
|
-
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7913
|
+
if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7887
7914
|
if (isTeleportDisabled(vnode.props)) {
|
|
7888
7915
|
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
7889
7916
|
vnode.targetAnchor = targetNode;
|
|
@@ -8005,7 +8032,7 @@ function isVNode(value) {
|
|
|
8005
8032
|
return value ? value.__v_isVNode === true : false;
|
|
8006
8033
|
}
|
|
8007
8034
|
function isSameVNodeType(n1, n2) {
|
|
8008
|
-
if (n2.shapeFlag & 6 /* COMPONENT */ &&
|
|
8035
|
+
if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
8009
8036
|
hmrDirtyComponents.has(n2.type)) {
|
|
8010
8037
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
8011
8038
|
return false;
|
|
@@ -8036,7 +8063,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
8036
8063
|
: ref
|
|
8037
8064
|
: null);
|
|
8038
8065
|
};
|
|
8039
|
-
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) {
|
|
8040
8067
|
const vnode = {
|
|
8041
8068
|
__v_isVNode: true,
|
|
8042
8069
|
__v_skip: true,
|
|
@@ -8067,7 +8094,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8067
8094
|
if (needFullChildrenNormalization) {
|
|
8068
8095
|
normalizeChildren(vnode, children);
|
|
8069
8096
|
// normalize suspense children
|
|
8070
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
8097
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
8071
8098
|
type.normalize(vnode);
|
|
8072
8099
|
}
|
|
8073
8100
|
}
|
|
@@ -8075,8 +8102,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8075
8102
|
// compiled element vnode - if children is passed, only possible types are
|
|
8076
8103
|
// string or Array.
|
|
8077
8104
|
vnode.shapeFlag |= isString(children)
|
|
8078
|
-
? 8 /* TEXT_CHILDREN */
|
|
8079
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
8105
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
8106
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
8080
8107
|
}
|
|
8081
8108
|
// validate key
|
|
8082
8109
|
if (vnode.key !== vnode.key) {
|
|
@@ -8092,10 +8119,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8092
8119
|
// component nodes also should always be patched, because even if the
|
|
8093
8120
|
// component doesn't need to update, it needs to persist the instance on to
|
|
8094
8121
|
// the next vnode so that it can be properly unmounted later.
|
|
8095
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
8122
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
8096
8123
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
8097
8124
|
// vnode should not be considered dynamic due to handler caching.
|
|
8098
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
8125
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
8099
8126
|
currentBlock.push(vnode);
|
|
8100
8127
|
}
|
|
8101
8128
|
return vnode;
|
|
@@ -8117,14 +8144,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
8117
8144
|
normalizeChildren(cloned, children);
|
|
8118
8145
|
}
|
|
8119
8146
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
8120
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
8147
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
8121
8148
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
8122
8149
|
}
|
|
8123
8150
|
else {
|
|
8124
8151
|
currentBlock.push(cloned);
|
|
8125
8152
|
}
|
|
8126
8153
|
}
|
|
8127
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
8154
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
8128
8155
|
return cloned;
|
|
8129
8156
|
}
|
|
8130
8157
|
// class component normalization.
|
|
@@ -8150,17 +8177,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
8150
8177
|
}
|
|
8151
8178
|
// encode the vnode type information into a bitmap
|
|
8152
8179
|
const shapeFlag = isString(type)
|
|
8153
|
-
? 1 /* ELEMENT */
|
|
8180
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
8154
8181
|
: isSuspense(type)
|
|
8155
|
-
? 128 /* SUSPENSE */
|
|
8182
|
+
? 128 /* ShapeFlags.SUSPENSE */
|
|
8156
8183
|
: isTeleport(type)
|
|
8157
|
-
? 64 /* TELEPORT */
|
|
8184
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
8158
8185
|
: isObject(type)
|
|
8159
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
8186
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
8160
8187
|
: isFunction(type)
|
|
8161
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
8188
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
8162
8189
|
: 0;
|
|
8163
|
-
if (shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
8190
|
+
if (shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
8164
8191
|
type = toRaw(type);
|
|
8165
8192
|
warn$1(`Vue received a Component which was made a reactive object. This can ` +
|
|
8166
8193
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
@@ -8199,7 +8226,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
8199
8226
|
: ref,
|
|
8200
8227
|
scopeId: vnode.scopeId,
|
|
8201
8228
|
slotScopeIds: vnode.slotScopeIds,
|
|
8202
|
-
children: patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
8229
|
+
children: patchFlag === -1 /* PatchFlags.HOISTED */ && isArray(children)
|
|
8203
8230
|
? children.map(deepCloneVNode)
|
|
8204
8231
|
: children,
|
|
8205
8232
|
target: vnode.target,
|
|
@@ -8212,8 +8239,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
8212
8239
|
// fast paths only.
|
|
8213
8240
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
8214
8241
|
? patchFlag === -1 // hoisted node
|
|
8215
|
-
? 16 /* FULL_PROPS */
|
|
8216
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
8242
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
8243
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
8217
8244
|
: patchFlag,
|
|
8218
8245
|
dynamicProps: vnode.dynamicProps,
|
|
8219
8246
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -8303,10 +8330,10 @@ function normalizeChildren(vnode, children) {
|
|
|
8303
8330
|
children = null;
|
|
8304
8331
|
}
|
|
8305
8332
|
else if (isArray(children)) {
|
|
8306
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
8333
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
8307
8334
|
}
|
|
8308
8335
|
else if (typeof children === 'object') {
|
|
8309
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
8336
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
8310
8337
|
// Normalize slot to plain children for plain element and Teleport
|
|
8311
8338
|
const slot = children.default;
|
|
8312
8339
|
if (slot) {
|
|
@@ -8318,37 +8345,37 @@ function normalizeChildren(vnode, children) {
|
|
|
8318
8345
|
return;
|
|
8319
8346
|
}
|
|
8320
8347
|
else {
|
|
8321
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
8348
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
8322
8349
|
const slotFlag = children._;
|
|
8323
8350
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
8324
8351
|
children._ctx = currentRenderingInstance;
|
|
8325
8352
|
}
|
|
8326
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
8353
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
8327
8354
|
// a child component receives forwarded slots from the parent.
|
|
8328
8355
|
// its slot type is determined by its parent's slot type.
|
|
8329
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
8330
|
-
children._ = 1 /* STABLE */;
|
|
8356
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
8357
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
8331
8358
|
}
|
|
8332
8359
|
else {
|
|
8333
|
-
children._ = 2 /* DYNAMIC */;
|
|
8334
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
8360
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
8361
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
8335
8362
|
}
|
|
8336
8363
|
}
|
|
8337
8364
|
}
|
|
8338
8365
|
}
|
|
8339
8366
|
else if (isFunction(children)) {
|
|
8340
8367
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
8341
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
8368
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
8342
8369
|
}
|
|
8343
8370
|
else {
|
|
8344
8371
|
children = String(children);
|
|
8345
8372
|
// force teleport children to array so it can be moved around
|
|
8346
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
8347
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
8373
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
8374
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
8348
8375
|
children = [createTextVNode(children)];
|
|
8349
8376
|
}
|
|
8350
8377
|
else {
|
|
8351
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
8378
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
8352
8379
|
}
|
|
8353
8380
|
}
|
|
8354
8381
|
vnode.children = children;
|
|
@@ -8386,7 +8413,7 @@ function mergeProps(...args) {
|
|
|
8386
8413
|
return ret;
|
|
8387
8414
|
}
|
|
8388
8415
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
8389
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
8416
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
|
|
8390
8417
|
vnode,
|
|
8391
8418
|
prevVNode
|
|
8392
8419
|
]);
|
|
@@ -8494,7 +8521,7 @@ function validateComponentName(name, config) {
|
|
|
8494
8521
|
}
|
|
8495
8522
|
}
|
|
8496
8523
|
function isStatefulComponent(instance) {
|
|
8497
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
8524
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
8498
8525
|
}
|
|
8499
8526
|
let isInSSRComponentSetup = false;
|
|
8500
8527
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -8549,7 +8576,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
8549
8576
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
8550
8577
|
setCurrentInstance(instance);
|
|
8551
8578
|
pauseTracking();
|
|
8552
|
-
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]);
|
|
8553
8580
|
resetTracking();
|
|
8554
8581
|
unsetCurrentInstance();
|
|
8555
8582
|
if (isPromise(setupResult)) {
|
|
@@ -8561,7 +8588,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
8561
8588
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
8562
8589
|
})
|
|
8563
8590
|
.catch(e => {
|
|
8564
|
-
handleError(e, instance, 0 /* SETUP_FUNCTION */);
|
|
8591
|
+
handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
8565
8592
|
});
|
|
8566
8593
|
}
|
|
8567
8594
|
else {
|
|
@@ -8688,7 +8715,7 @@ function createAttrsProxy(instance) {
|
|
|
8688
8715
|
return new Proxy(instance.attrs, {
|
|
8689
8716
|
get(target, key) {
|
|
8690
8717
|
markAttrsAccessed();
|
|
8691
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
8718
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
8692
8719
|
return target[key];
|
|
8693
8720
|
},
|
|
8694
8721
|
set() {
|
|
@@ -9191,7 +9218,7 @@ function isMemoSame(cached, memo) {
|
|
|
9191
9218
|
}
|
|
9192
9219
|
|
|
9193
9220
|
// Core API ------------------------------------------------------------------
|
|
9194
|
-
const version = "3.2.
|
|
9221
|
+
const version = "3.2.38";
|
|
9195
9222
|
/**
|
|
9196
9223
|
* SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
|
|
9197
9224
|
* @internal
|
|
@@ -9558,7 +9585,8 @@ function parseName(name) {
|
|
|
9558
9585
|
options[m[0].toLowerCase()] = true;
|
|
9559
9586
|
}
|
|
9560
9587
|
}
|
|
9561
|
-
|
|
9588
|
+
const event = name[2] === ':' ? name.slice(3) : hyphenate(name.slice(2));
|
|
9589
|
+
return [event, options];
|
|
9562
9590
|
}
|
|
9563
9591
|
function createInvoker(initialValue, instance) {
|
|
9564
9592
|
const invoker = (e) => {
|
|
@@ -9570,7 +9598,7 @@ function createInvoker(initialValue, instance) {
|
|
|
9570
9598
|
// AFTER it was attached.
|
|
9571
9599
|
const timeStamp = e.timeStamp || _getNow();
|
|
9572
9600
|
if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
|
|
9573
|
-
callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* NATIVE_EVENT_HANDLER */, [e]);
|
|
9601
|
+
callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* ErrorCodes.NATIVE_EVENT_HANDLER */, [e]);
|
|
9574
9602
|
}
|
|
9575
9603
|
};
|
|
9576
9604
|
invoker.value = initialValue;
|
|
@@ -9925,7 +9953,7 @@ function useCssVars(getter) {
|
|
|
9925
9953
|
});
|
|
9926
9954
|
}
|
|
9927
9955
|
function setVarsOnVNode(vnode, vars) {
|
|
9928
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
9956
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
9929
9957
|
const suspense = vnode.suspense;
|
|
9930
9958
|
vnode = suspense.activeBranch;
|
|
9931
9959
|
if (suspense.pendingBranch && !suspense.isHydrating) {
|
|
@@ -9938,7 +9966,7 @@ function setVarsOnVNode(vnode, vars) {
|
|
|
9938
9966
|
while (vnode.component) {
|
|
9939
9967
|
vnode = vnode.component.subTree;
|
|
9940
9968
|
}
|
|
9941
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ && vnode.el) {
|
|
9969
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && vnode.el) {
|
|
9942
9970
|
setVarsOnNode(vnode.el, vars);
|
|
9943
9971
|
}
|
|
9944
9972
|
else if (vnode.type === Fragment) {
|