@vue/server-renderer 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.
|
@@ -693,7 +693,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
693
693
|
return;
|
|
694
694
|
}
|
|
695
695
|
let deps = [];
|
|
696
|
-
if (type === "clear" /* CLEAR */) {
|
|
696
|
+
if (type === "clear" /* TriggerOpTypes.CLEAR */) {
|
|
697
697
|
// collection being cleared
|
|
698
698
|
// trigger all effects for target
|
|
699
699
|
deps = [...depsMap.values()];
|
|
@@ -712,7 +712,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
712
712
|
}
|
|
713
713
|
// also run for iteration key on ADD | DELETE | Map.SET
|
|
714
714
|
switch (type) {
|
|
715
|
-
case "add" /* ADD */:
|
|
715
|
+
case "add" /* TriggerOpTypes.ADD */:
|
|
716
716
|
if (!isArray(target)) {
|
|
717
717
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
718
718
|
if (isMap(target)) {
|
|
@@ -724,7 +724,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
724
724
|
deps.push(depsMap.get('length'));
|
|
725
725
|
}
|
|
726
726
|
break;
|
|
727
|
-
case "delete" /* DELETE */:
|
|
727
|
+
case "delete" /* TriggerOpTypes.DELETE */:
|
|
728
728
|
if (!isArray(target)) {
|
|
729
729
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
730
730
|
if (isMap(target)) {
|
|
@@ -732,7 +732,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
732
732
|
}
|
|
733
733
|
}
|
|
734
734
|
break;
|
|
735
|
-
case "set" /* SET */:
|
|
735
|
+
case "set" /* TriggerOpTypes.SET */:
|
|
736
736
|
if (isMap(target)) {
|
|
737
737
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
738
738
|
}
|
|
@@ -809,7 +809,7 @@ function createArrayInstrumentations() {
|
|
|
809
809
|
instrumentations[key] = function (...args) {
|
|
810
810
|
const arr = toRaw(this);
|
|
811
811
|
for (let i = 0, l = this.length; i < l; i++) {
|
|
812
|
-
track(arr, "get" /* GET */, i + '');
|
|
812
|
+
track(arr, "get" /* TrackOpTypes.GET */, i + '');
|
|
813
813
|
}
|
|
814
814
|
// we run the method using the original args first (which may be reactive)
|
|
815
815
|
const res = arr[key](...args);
|
|
@@ -834,16 +834,16 @@ function createArrayInstrumentations() {
|
|
|
834
834
|
}
|
|
835
835
|
function createGetter(isReadonly = false, shallow = false) {
|
|
836
836
|
return function get(target, key, receiver) {
|
|
837
|
-
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
|
837
|
+
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
838
838
|
return !isReadonly;
|
|
839
839
|
}
|
|
840
|
-
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
|
840
|
+
else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
|
|
841
841
|
return isReadonly;
|
|
842
842
|
}
|
|
843
|
-
else if (key === "__v_isShallow" /* IS_SHALLOW */) {
|
|
843
|
+
else if (key === "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */) {
|
|
844
844
|
return shallow;
|
|
845
845
|
}
|
|
846
|
-
else if (key === "__v_raw" /* RAW */ &&
|
|
846
|
+
else if (key === "__v_raw" /* ReactiveFlags.RAW */ &&
|
|
847
847
|
receiver ===
|
|
848
848
|
(isReadonly
|
|
849
849
|
? shallow
|
|
@@ -863,7 +863,7 @@ function createGetter(isReadonly = false, shallow = false) {
|
|
|
863
863
|
return res;
|
|
864
864
|
}
|
|
865
865
|
if (!isReadonly) {
|
|
866
|
-
track(target, "get" /* GET */, key);
|
|
866
|
+
track(target, "get" /* TrackOpTypes.GET */, key);
|
|
867
867
|
}
|
|
868
868
|
if (shallow) {
|
|
869
869
|
return res;
|
|
@@ -889,10 +889,10 @@ function createSetter(shallow = false) {
|
|
|
889
889
|
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
890
890
|
return false;
|
|
891
891
|
}
|
|
892
|
-
if (!shallow
|
|
893
|
-
if (!isShallow(value)) {
|
|
894
|
-
value = toRaw(value);
|
|
892
|
+
if (!shallow) {
|
|
893
|
+
if (!isShallow(value) && !isReadonly(value)) {
|
|
895
894
|
oldValue = toRaw(oldValue);
|
|
895
|
+
value = toRaw(value);
|
|
896
896
|
}
|
|
897
897
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
898
898
|
oldValue.value = value;
|
|
@@ -906,10 +906,10 @@ function createSetter(shallow = false) {
|
|
|
906
906
|
// don't trigger if target is something up in the prototype chain of original
|
|
907
907
|
if (target === toRaw(receiver)) {
|
|
908
908
|
if (!hadKey) {
|
|
909
|
-
trigger(target, "add" /* ADD */, key, value);
|
|
909
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
|
|
910
910
|
}
|
|
911
911
|
else if (hasChanged(value, oldValue)) {
|
|
912
|
-
trigger(target, "set" /* SET */, key, value, oldValue);
|
|
912
|
+
trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
|
|
913
913
|
}
|
|
914
914
|
}
|
|
915
915
|
return result;
|
|
@@ -920,19 +920,19 @@ function deleteProperty(target, key) {
|
|
|
920
920
|
const oldValue = target[key];
|
|
921
921
|
const result = Reflect.deleteProperty(target, key);
|
|
922
922
|
if (result && hadKey) {
|
|
923
|
-
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
|
923
|
+
trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
|
|
924
924
|
}
|
|
925
925
|
return result;
|
|
926
926
|
}
|
|
927
927
|
function has(target, key) {
|
|
928
928
|
const result = Reflect.has(target, key);
|
|
929
929
|
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
930
|
-
track(target, "has" /* HAS */, key);
|
|
930
|
+
track(target, "has" /* TrackOpTypes.HAS */, key);
|
|
931
931
|
}
|
|
932
932
|
return result;
|
|
933
933
|
}
|
|
934
934
|
function ownKeys(target) {
|
|
935
|
-
track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
|
935
|
+
track(target, "iterate" /* TrackOpTypes.ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
|
936
936
|
return Reflect.ownKeys(target);
|
|
937
937
|
}
|
|
938
938
|
const mutableHandlers = {
|
|
@@ -973,14 +973,14 @@ const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
|
973
973
|
function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
974
974
|
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
|
975
975
|
// of the value
|
|
976
|
-
target = target["__v_raw" /* RAW */];
|
|
976
|
+
target = target["__v_raw" /* ReactiveFlags.RAW */];
|
|
977
977
|
const rawTarget = toRaw(target);
|
|
978
978
|
const rawKey = toRaw(key);
|
|
979
979
|
if (!isReadonly) {
|
|
980
980
|
if (key !== rawKey) {
|
|
981
|
-
track(rawTarget, "get" /* GET */, key);
|
|
981
|
+
track(rawTarget, "get" /* TrackOpTypes.GET */, key);
|
|
982
982
|
}
|
|
983
|
-
track(rawTarget, "get" /* GET */, rawKey);
|
|
983
|
+
track(rawTarget, "get" /* TrackOpTypes.GET */, rawKey);
|
|
984
984
|
}
|
|
985
985
|
const { has } = getProto(rawTarget);
|
|
986
986
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
@@ -997,22 +997,22 @@ function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
|
997
997
|
}
|
|
998
998
|
}
|
|
999
999
|
function has$1(key, isReadonly = false) {
|
|
1000
|
-
const target = this["__v_raw" /* RAW */];
|
|
1000
|
+
const target = this["__v_raw" /* ReactiveFlags.RAW */];
|
|
1001
1001
|
const rawTarget = toRaw(target);
|
|
1002
1002
|
const rawKey = toRaw(key);
|
|
1003
1003
|
if (!isReadonly) {
|
|
1004
1004
|
if (key !== rawKey) {
|
|
1005
|
-
track(rawTarget, "has" /* HAS */, key);
|
|
1005
|
+
track(rawTarget, "has" /* TrackOpTypes.HAS */, key);
|
|
1006
1006
|
}
|
|
1007
|
-
track(rawTarget, "has" /* HAS */, rawKey);
|
|
1007
|
+
track(rawTarget, "has" /* TrackOpTypes.HAS */, rawKey);
|
|
1008
1008
|
}
|
|
1009
1009
|
return key === rawKey
|
|
1010
1010
|
? target.has(key)
|
|
1011
1011
|
: target.has(key) || target.has(rawKey);
|
|
1012
1012
|
}
|
|
1013
1013
|
function size(target, isReadonly = false) {
|
|
1014
|
-
target = target["__v_raw" /* RAW */];
|
|
1015
|
-
!isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
|
|
1014
|
+
target = target["__v_raw" /* ReactiveFlags.RAW */];
|
|
1015
|
+
!isReadonly && track(toRaw(target), "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
|
|
1016
1016
|
return Reflect.get(target, 'size', target);
|
|
1017
1017
|
}
|
|
1018
1018
|
function add(value) {
|
|
@@ -1022,7 +1022,7 @@ function add(value) {
|
|
|
1022
1022
|
const hadKey = proto.has.call(target, value);
|
|
1023
1023
|
if (!hadKey) {
|
|
1024
1024
|
target.add(value);
|
|
1025
|
-
trigger(target, "add" /* ADD */, value, value);
|
|
1025
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, value, value);
|
|
1026
1026
|
}
|
|
1027
1027
|
return this;
|
|
1028
1028
|
}
|
|
@@ -1041,10 +1041,10 @@ function set$1(key, value) {
|
|
|
1041
1041
|
const oldValue = get.call(target, key);
|
|
1042
1042
|
target.set(key, value);
|
|
1043
1043
|
if (!hadKey) {
|
|
1044
|
-
trigger(target, "add" /* ADD */, key, value);
|
|
1044
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
|
|
1045
1045
|
}
|
|
1046
1046
|
else if (hasChanged(value, oldValue)) {
|
|
1047
|
-
trigger(target, "set" /* SET */, key, value, oldValue);
|
|
1047
|
+
trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
|
|
1048
1048
|
}
|
|
1049
1049
|
return this;
|
|
1050
1050
|
}
|
|
@@ -1063,7 +1063,7 @@ function deleteEntry(key) {
|
|
|
1063
1063
|
// forward the operation before queueing reactions
|
|
1064
1064
|
const result = target.delete(key);
|
|
1065
1065
|
if (hadKey) {
|
|
1066
|
-
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
|
1066
|
+
trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
|
|
1067
1067
|
}
|
|
1068
1068
|
return result;
|
|
1069
1069
|
}
|
|
@@ -1077,17 +1077,17 @@ function clear() {
|
|
|
1077
1077
|
// forward the operation before queueing reactions
|
|
1078
1078
|
const result = target.clear();
|
|
1079
1079
|
if (hadItems) {
|
|
1080
|
-
trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
|
|
1080
|
+
trigger(target, "clear" /* TriggerOpTypes.CLEAR */, undefined, undefined, oldTarget);
|
|
1081
1081
|
}
|
|
1082
1082
|
return result;
|
|
1083
1083
|
}
|
|
1084
1084
|
function createForEach(isReadonly, isShallow) {
|
|
1085
1085
|
return function forEach(callback, thisArg) {
|
|
1086
1086
|
const observed = this;
|
|
1087
|
-
const target = observed["__v_raw" /* RAW */];
|
|
1087
|
+
const target = observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
1088
1088
|
const rawTarget = toRaw(target);
|
|
1089
1089
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
1090
|
-
!isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
|
|
1090
|
+
!isReadonly && track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
|
|
1091
1091
|
return target.forEach((value, key) => {
|
|
1092
1092
|
// important: make sure the callback is
|
|
1093
1093
|
// 1. invoked with the reactive map as `this` and 3rd arg
|
|
@@ -1098,7 +1098,7 @@ function createForEach(isReadonly, isShallow) {
|
|
|
1098
1098
|
}
|
|
1099
1099
|
function createIterableMethod(method, isReadonly, isShallow) {
|
|
1100
1100
|
return function (...args) {
|
|
1101
|
-
const target = this["__v_raw" /* RAW */];
|
|
1101
|
+
const target = this["__v_raw" /* ReactiveFlags.RAW */];
|
|
1102
1102
|
const rawTarget = toRaw(target);
|
|
1103
1103
|
const targetIsMap = isMap(rawTarget);
|
|
1104
1104
|
const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
|
@@ -1106,7 +1106,7 @@ function createIterableMethod(method, isReadonly, isShallow) {
|
|
|
1106
1106
|
const innerIterator = target[method](...args);
|
|
1107
1107
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
1108
1108
|
!isReadonly &&
|
|
1109
|
-
track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
1109
|
+
track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
1110
1110
|
// return a wrapped iterator which returns observed versions of the
|
|
1111
1111
|
// values emitted from the real iterator
|
|
1112
1112
|
return {
|
|
@@ -1133,7 +1133,7 @@ function createReadonlyMethod(type) {
|
|
|
1133
1133
|
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
1134
1134
|
console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
|
1135
1135
|
}
|
|
1136
|
-
return type === "delete" /* DELETE */ ? false : this;
|
|
1136
|
+
return type === "delete" /* TriggerOpTypes.DELETE */ ? false : this;
|
|
1137
1137
|
};
|
|
1138
1138
|
}
|
|
1139
1139
|
function createInstrumentations() {
|
|
@@ -1175,10 +1175,10 @@ function createInstrumentations() {
|
|
|
1175
1175
|
has(key) {
|
|
1176
1176
|
return has$1.call(this, key, true);
|
|
1177
1177
|
},
|
|
1178
|
-
add: createReadonlyMethod("add" /* ADD */),
|
|
1179
|
-
set: createReadonlyMethod("set" /* SET */),
|
|
1180
|
-
delete: createReadonlyMethod("delete" /* DELETE */),
|
|
1181
|
-
clear: createReadonlyMethod("clear" /* CLEAR */),
|
|
1178
|
+
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
1179
|
+
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
1180
|
+
delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
|
|
1181
|
+
clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
|
|
1182
1182
|
forEach: createForEach(true, false)
|
|
1183
1183
|
};
|
|
1184
1184
|
const shallowReadonlyInstrumentations = {
|
|
@@ -1191,10 +1191,10 @@ function createInstrumentations() {
|
|
|
1191
1191
|
has(key) {
|
|
1192
1192
|
return has$1.call(this, key, true);
|
|
1193
1193
|
},
|
|
1194
|
-
add: createReadonlyMethod("add" /* ADD */),
|
|
1195
|
-
set: createReadonlyMethod("set" /* SET */),
|
|
1196
|
-
delete: createReadonlyMethod("delete" /* DELETE */),
|
|
1197
|
-
clear: createReadonlyMethod("clear" /* CLEAR */),
|
|
1194
|
+
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
1195
|
+
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
1196
|
+
delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
|
|
1197
|
+
clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
|
|
1198
1198
|
forEach: createForEach(true, true)
|
|
1199
1199
|
};
|
|
1200
1200
|
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
|
@@ -1221,13 +1221,13 @@ function createInstrumentationGetter(isReadonly, shallow) {
|
|
|
1221
1221
|
? readonlyInstrumentations
|
|
1222
1222
|
: mutableInstrumentations;
|
|
1223
1223
|
return (target, key, receiver) => {
|
|
1224
|
-
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
|
1224
|
+
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
1225
1225
|
return !isReadonly;
|
|
1226
1226
|
}
|
|
1227
|
-
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
|
1227
|
+
else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
|
|
1228
1228
|
return isReadonly;
|
|
1229
1229
|
}
|
|
1230
|
-
else if (key === "__v_raw" /* RAW */) {
|
|
1230
|
+
else if (key === "__v_raw" /* ReactiveFlags.RAW */) {
|
|
1231
1231
|
return target;
|
|
1232
1232
|
}
|
|
1233
1233
|
return Reflect.get(hasOwn(instrumentations, key) && key in target
|
|
@@ -1267,19 +1267,19 @@ function targetTypeMap(rawType) {
|
|
|
1267
1267
|
switch (rawType) {
|
|
1268
1268
|
case 'Object':
|
|
1269
1269
|
case 'Array':
|
|
1270
|
-
return 1 /* COMMON */;
|
|
1270
|
+
return 1 /* TargetType.COMMON */;
|
|
1271
1271
|
case 'Map':
|
|
1272
1272
|
case 'Set':
|
|
1273
1273
|
case 'WeakMap':
|
|
1274
1274
|
case 'WeakSet':
|
|
1275
|
-
return 2 /* COLLECTION */;
|
|
1275
|
+
return 2 /* TargetType.COLLECTION */;
|
|
1276
1276
|
default:
|
|
1277
|
-
return 0 /* INVALID */;
|
|
1277
|
+
return 0 /* TargetType.INVALID */;
|
|
1278
1278
|
}
|
|
1279
1279
|
}
|
|
1280
1280
|
function getTargetType(value) {
|
|
1281
|
-
return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
|
|
1282
|
-
? 0 /* INVALID */
|
|
1281
|
+
return value["__v_skip" /* ReactiveFlags.SKIP */] || !Object.isExtensible(value)
|
|
1282
|
+
? 0 /* TargetType.INVALID */
|
|
1283
1283
|
: targetTypeMap(toRawType(value));
|
|
1284
1284
|
}
|
|
1285
1285
|
function reactive(target) {
|
|
@@ -1322,8 +1322,8 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1322
1322
|
}
|
|
1323
1323
|
// target is already a Proxy, return it.
|
|
1324
1324
|
// exception: calling readonly() on a reactive object
|
|
1325
|
-
if (target["__v_raw" /* RAW */] &&
|
|
1326
|
-
!(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
|
|
1325
|
+
if (target["__v_raw" /* ReactiveFlags.RAW */] &&
|
|
1326
|
+
!(isReadonly && target["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */])) {
|
|
1327
1327
|
return target;
|
|
1328
1328
|
}
|
|
1329
1329
|
// target already has corresponding Proxy
|
|
@@ -1333,34 +1333,34 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1333
1333
|
}
|
|
1334
1334
|
// only specific value types can be observed.
|
|
1335
1335
|
const targetType = getTargetType(target);
|
|
1336
|
-
if (targetType === 0 /* INVALID */) {
|
|
1336
|
+
if (targetType === 0 /* TargetType.INVALID */) {
|
|
1337
1337
|
return target;
|
|
1338
1338
|
}
|
|
1339
|
-
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
|
1339
|
+
const proxy = new Proxy(target, targetType === 2 /* TargetType.COLLECTION */ ? collectionHandlers : baseHandlers);
|
|
1340
1340
|
proxyMap.set(target, proxy);
|
|
1341
1341
|
return proxy;
|
|
1342
1342
|
}
|
|
1343
1343
|
function isReactive(value) {
|
|
1344
1344
|
if (isReadonly(value)) {
|
|
1345
|
-
return isReactive(value["__v_raw" /* RAW */]);
|
|
1345
|
+
return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
|
|
1346
1346
|
}
|
|
1347
|
-
return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
|
|
1347
|
+
return !!(value && value["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */]);
|
|
1348
1348
|
}
|
|
1349
1349
|
function isReadonly(value) {
|
|
1350
|
-
return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
|
|
1350
|
+
return !!(value && value["__v_isReadonly" /* ReactiveFlags.IS_READONLY */]);
|
|
1351
1351
|
}
|
|
1352
1352
|
function isShallow(value) {
|
|
1353
|
-
return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
|
|
1353
|
+
return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
|
|
1354
1354
|
}
|
|
1355
1355
|
function isProxy(value) {
|
|
1356
1356
|
return isReactive(value) || isReadonly(value);
|
|
1357
1357
|
}
|
|
1358
1358
|
function toRaw(observed) {
|
|
1359
|
-
const raw = observed && observed["__v_raw" /* RAW */];
|
|
1359
|
+
const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
1360
1360
|
return raw ? toRaw(raw) : observed;
|
|
1361
1361
|
}
|
|
1362
1362
|
function markRaw(value) {
|
|
1363
|
-
def(value, "__v_skip" /* SKIP */, true);
|
|
1363
|
+
def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
|
|
1364
1364
|
return value;
|
|
1365
1365
|
}
|
|
1366
1366
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
@@ -1372,7 +1372,7 @@ function trackRefValue(ref) {
|
|
|
1372
1372
|
{
|
|
1373
1373
|
trackEffects(ref.dep || (ref.dep = createDep()), {
|
|
1374
1374
|
target: ref,
|
|
1375
|
-
type: "get" /* GET */,
|
|
1375
|
+
type: "get" /* TrackOpTypes.GET */,
|
|
1376
1376
|
key: 'value'
|
|
1377
1377
|
});
|
|
1378
1378
|
}
|
|
@@ -1384,7 +1384,7 @@ function triggerRefValue(ref, newVal) {
|
|
|
1384
1384
|
{
|
|
1385
1385
|
triggerEffects(ref.dep, {
|
|
1386
1386
|
target: ref,
|
|
1387
|
-
type: "set" /* SET */,
|
|
1387
|
+
type: "set" /* TriggerOpTypes.SET */,
|
|
1388
1388
|
key: 'value',
|
|
1389
1389
|
newValue: newVal
|
|
1390
1390
|
});
|
|
@@ -1416,11 +1416,13 @@ function proxyRefs(objectWithRefs) {
|
|
|
1416
1416
|
: new Proxy(objectWithRefs, shallowUnwrapHandlers);
|
|
1417
1417
|
}
|
|
1418
1418
|
|
|
1419
|
+
var _a;
|
|
1419
1420
|
class ComputedRefImpl {
|
|
1420
1421
|
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1421
1422
|
this._setter = _setter;
|
|
1422
1423
|
this.dep = undefined;
|
|
1423
1424
|
this.__v_isRef = true;
|
|
1425
|
+
this[_a] = false;
|
|
1424
1426
|
this._dirty = true;
|
|
1425
1427
|
this.effect = new ReactiveEffect(getter, () => {
|
|
1426
1428
|
if (!this._dirty) {
|
|
@@ -1430,7 +1432,7 @@ class ComputedRefImpl {
|
|
|
1430
1432
|
});
|
|
1431
1433
|
this.effect.computed = this;
|
|
1432
1434
|
this.effect.active = this._cacheable = !isSSR;
|
|
1433
|
-
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
|
1435
|
+
this["__v_isReadonly" /* ReactiveFlags.IS_READONLY */] = isReadonly;
|
|
1434
1436
|
}
|
|
1435
1437
|
get value() {
|
|
1436
1438
|
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
|
|
@@ -1446,6 +1448,7 @@ class ComputedRefImpl {
|
|
|
1446
1448
|
this._setter(newValue);
|
|
1447
1449
|
}
|
|
1448
1450
|
}
|
|
1451
|
+
_a = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
|
|
1449
1452
|
function computed(getterOrOptions, debugOptions, isSSR = false) {
|
|
1450
1453
|
let getter;
|
|
1451
1454
|
let setter;
|
|
@@ -1484,7 +1487,7 @@ function warn$1(msg, ...args) {
|
|
|
1484
1487
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1485
1488
|
const trace = getComponentTrace();
|
|
1486
1489
|
if (appWarnHandler) {
|
|
1487
|
-
callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
|
|
1490
|
+
callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
|
|
1488
1491
|
msg + args.join(''),
|
|
1489
1492
|
instance && instance.proxy,
|
|
1490
1493
|
trace
|
|
@@ -1584,35 +1587,35 @@ function formatProp(key, value, raw) {
|
|
|
1584
1587
|
}
|
|
1585
1588
|
|
|
1586
1589
|
const ErrorTypeStrings = {
|
|
1587
|
-
["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
1588
|
-
["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
|
|
1589
|
-
["c" /* CREATED */]: 'created hook',
|
|
1590
|
-
["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
|
|
1591
|
-
["m" /* MOUNTED */]: 'mounted hook',
|
|
1592
|
-
["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
1593
|
-
["u" /* UPDATED */]: 'updated',
|
|
1594
|
-
["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
1595
|
-
["um" /* UNMOUNTED */]: 'unmounted hook',
|
|
1596
|
-
["a" /* ACTIVATED */]: 'activated hook',
|
|
1597
|
-
["da" /* DEACTIVATED */]: 'deactivated hook',
|
|
1598
|
-
["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
1599
|
-
["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
|
|
1600
|
-
["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
1601
|
-
[0 /* SETUP_FUNCTION */]: 'setup function',
|
|
1602
|
-
[1 /* RENDER_FUNCTION */]: 'render function',
|
|
1603
|
-
[2 /* WATCH_GETTER */]: 'watcher getter',
|
|
1604
|
-
[3 /* WATCH_CALLBACK */]: 'watcher callback',
|
|
1605
|
-
[4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
1606
|
-
[5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
1607
|
-
[6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
1608
|
-
[7 /* VNODE_HOOK */]: 'vnode hook',
|
|
1609
|
-
[8 /* DIRECTIVE_HOOK */]: 'directive hook',
|
|
1610
|
-
[9 /* TRANSITION_HOOK */]: 'transition hook',
|
|
1611
|
-
[10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
1612
|
-
[11 /* APP_WARN_HANDLER */]: 'app warnHandler',
|
|
1613
|
-
[12 /* FUNCTION_REF */]: 'ref function',
|
|
1614
|
-
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
1615
|
-
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
1590
|
+
["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
1591
|
+
["bc" /* LifecycleHooks.BEFORE_CREATE */]: 'beforeCreate hook',
|
|
1592
|
+
["c" /* LifecycleHooks.CREATED */]: 'created hook',
|
|
1593
|
+
["bm" /* LifecycleHooks.BEFORE_MOUNT */]: 'beforeMount hook',
|
|
1594
|
+
["m" /* LifecycleHooks.MOUNTED */]: 'mounted hook',
|
|
1595
|
+
["bu" /* LifecycleHooks.BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
1596
|
+
["u" /* LifecycleHooks.UPDATED */]: 'updated',
|
|
1597
|
+
["bum" /* LifecycleHooks.BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
1598
|
+
["um" /* LifecycleHooks.UNMOUNTED */]: 'unmounted hook',
|
|
1599
|
+
["a" /* LifecycleHooks.ACTIVATED */]: 'activated hook',
|
|
1600
|
+
["da" /* LifecycleHooks.DEACTIVATED */]: 'deactivated hook',
|
|
1601
|
+
["ec" /* LifecycleHooks.ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
1602
|
+
["rtc" /* LifecycleHooks.RENDER_TRACKED */]: 'renderTracked hook',
|
|
1603
|
+
["rtg" /* LifecycleHooks.RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
1604
|
+
[0 /* ErrorCodes.SETUP_FUNCTION */]: 'setup function',
|
|
1605
|
+
[1 /* ErrorCodes.RENDER_FUNCTION */]: 'render function',
|
|
1606
|
+
[2 /* ErrorCodes.WATCH_GETTER */]: 'watcher getter',
|
|
1607
|
+
[3 /* ErrorCodes.WATCH_CALLBACK */]: 'watcher callback',
|
|
1608
|
+
[4 /* ErrorCodes.WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
1609
|
+
[5 /* ErrorCodes.NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
1610
|
+
[6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
1611
|
+
[7 /* ErrorCodes.VNODE_HOOK */]: 'vnode hook',
|
|
1612
|
+
[8 /* ErrorCodes.DIRECTIVE_HOOK */]: 'directive hook',
|
|
1613
|
+
[9 /* ErrorCodes.TRANSITION_HOOK */]: 'transition hook',
|
|
1614
|
+
[10 /* ErrorCodes.APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
1615
|
+
[11 /* ErrorCodes.APP_WARN_HANDLER */]: 'app warnHandler',
|
|
1616
|
+
[12 /* ErrorCodes.FUNCTION_REF */]: 'ref function',
|
|
1617
|
+
[13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
1618
|
+
[14 /* ErrorCodes.SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
1616
1619
|
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
|
|
1617
1620
|
};
|
|
1618
1621
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
@@ -1663,7 +1666,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
1663
1666
|
// app-level handling
|
|
1664
1667
|
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
1665
1668
|
if (appErrorHandler) {
|
|
1666
|
-
callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
1669
|
+
callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
1667
1670
|
return;
|
|
1668
1671
|
}
|
|
1669
1672
|
}
|
|
@@ -1693,15 +1696,11 @@ let isFlushing = false;
|
|
|
1693
1696
|
let isFlushPending = false;
|
|
1694
1697
|
const queue = [];
|
|
1695
1698
|
let flushIndex = 0;
|
|
1696
|
-
const pendingPreFlushCbs = [];
|
|
1697
|
-
let activePreFlushCbs = null;
|
|
1698
|
-
let preFlushIndex = 0;
|
|
1699
1699
|
const pendingPostFlushCbs = [];
|
|
1700
1700
|
let activePostFlushCbs = null;
|
|
1701
1701
|
let postFlushIndex = 0;
|
|
1702
1702
|
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
1703
1703
|
let currentFlushPromise = null;
|
|
1704
|
-
let currentPreFlushParentJob = null;
|
|
1705
1704
|
const RECURSION_LIMIT = 100;
|
|
1706
1705
|
function nextTick(fn) {
|
|
1707
1706
|
const p = currentFlushPromise || resolvedPromise;
|
|
@@ -1729,9 +1728,8 @@ function queueJob(job) {
|
|
|
1729
1728
|
// if the job is a watch() callback, the search will start with a +1 index to
|
|
1730
1729
|
// allow it recursively trigger itself - it is the user's responsibility to
|
|
1731
1730
|
// ensure it doesn't end up in an infinite loop.
|
|
1732
|
-
if (
|
|
1733
|
-
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex))
|
|
1734
|
-
job !== currentPreFlushParentJob) {
|
|
1731
|
+
if (!queue.length ||
|
|
1732
|
+
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
|
|
1735
1733
|
if (job.id == null) {
|
|
1736
1734
|
queue.push(job);
|
|
1737
1735
|
}
|
|
@@ -1753,51 +1751,38 @@ function invalidateJob(job) {
|
|
|
1753
1751
|
queue.splice(i, 1);
|
|
1754
1752
|
}
|
|
1755
1753
|
}
|
|
1756
|
-
function
|
|
1754
|
+
function queuePostFlushCb(cb) {
|
|
1757
1755
|
if (!isArray(cb)) {
|
|
1758
|
-
if (!
|
|
1759
|
-
!
|
|
1760
|
-
|
|
1756
|
+
if (!activePostFlushCbs ||
|
|
1757
|
+
!activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
|
|
1758
|
+
pendingPostFlushCbs.push(cb);
|
|
1761
1759
|
}
|
|
1762
1760
|
}
|
|
1763
1761
|
else {
|
|
1764
1762
|
// if cb is an array, it is a component lifecycle hook which can only be
|
|
1765
1763
|
// triggered by a job, which is already deduped in the main queue, so
|
|
1766
1764
|
// we can skip duplicate check here to improve perf
|
|
1767
|
-
|
|
1765
|
+
pendingPostFlushCbs.push(...cb);
|
|
1768
1766
|
}
|
|
1769
1767
|
queueFlush();
|
|
1770
1768
|
}
|
|
1771
|
-
function
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
currentPreFlushParentJob = parentJob;
|
|
1780
|
-
activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
|
|
1781
|
-
pendingPreFlushCbs.length = 0;
|
|
1782
|
-
{
|
|
1783
|
-
seen = seen || new Map();
|
|
1784
|
-
}
|
|
1785
|
-
for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
|
1786
|
-
if (checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])) {
|
|
1769
|
+
function flushPreFlushCbs(seen, i = flushIndex) {
|
|
1770
|
+
{
|
|
1771
|
+
seen = seen || new Map();
|
|
1772
|
+
}
|
|
1773
|
+
for (; i < queue.length; i++) {
|
|
1774
|
+
const cb = queue[i];
|
|
1775
|
+
if (cb && cb.pre) {
|
|
1776
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
1787
1777
|
continue;
|
|
1788
1778
|
}
|
|
1789
|
-
|
|
1779
|
+
queue.splice(i, 1);
|
|
1780
|
+
i--;
|
|
1781
|
+
cb();
|
|
1790
1782
|
}
|
|
1791
|
-
activePreFlushCbs = null;
|
|
1792
|
-
preFlushIndex = 0;
|
|
1793
|
-
currentPreFlushParentJob = null;
|
|
1794
|
-
// recursively flush until it drains
|
|
1795
|
-
flushPreFlushCbs(seen, parentJob);
|
|
1796
1783
|
}
|
|
1797
1784
|
}
|
|
1798
1785
|
function flushPostFlushCbs(seen) {
|
|
1799
|
-
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
1800
|
-
flushPreFlushCbs();
|
|
1801
1786
|
if (pendingPostFlushCbs.length) {
|
|
1802
1787
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
1803
1788
|
pendingPostFlushCbs.length = 0;
|
|
@@ -1822,13 +1807,22 @@ function flushPostFlushCbs(seen) {
|
|
|
1822
1807
|
}
|
|
1823
1808
|
}
|
|
1824
1809
|
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
1810
|
+
const comparator = (a, b) => {
|
|
1811
|
+
const diff = getId(a) - getId(b);
|
|
1812
|
+
if (diff === 0) {
|
|
1813
|
+
if (a.pre && !b.pre)
|
|
1814
|
+
return -1;
|
|
1815
|
+
if (b.pre && !a.pre)
|
|
1816
|
+
return 1;
|
|
1817
|
+
}
|
|
1818
|
+
return diff;
|
|
1819
|
+
};
|
|
1825
1820
|
function flushJobs(seen) {
|
|
1826
1821
|
isFlushPending = false;
|
|
1827
1822
|
isFlushing = true;
|
|
1828
1823
|
{
|
|
1829
1824
|
seen = seen || new Map();
|
|
1830
1825
|
}
|
|
1831
|
-
flushPreFlushCbs(seen);
|
|
1832
1826
|
// Sort queue before flush.
|
|
1833
1827
|
// This ensures that:
|
|
1834
1828
|
// 1. Components are updated from parent to child. (because parent is always
|
|
@@ -1836,7 +1830,7 @@ function flushJobs(seen) {
|
|
|
1836
1830
|
// priority number)
|
|
1837
1831
|
// 2. If a component is unmounted during a parent component's update,
|
|
1838
1832
|
// its update can be skipped.
|
|
1839
|
-
queue.sort(
|
|
1833
|
+
queue.sort(comparator);
|
|
1840
1834
|
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
1841
1835
|
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
1842
1836
|
// inside try-catch. This can leave all warning code unshaked. Although
|
|
@@ -1852,7 +1846,7 @@ function flushJobs(seen) {
|
|
|
1852
1846
|
continue;
|
|
1853
1847
|
}
|
|
1854
1848
|
// console.log(`running:`, job.id)
|
|
1855
|
-
callWithErrorHandling(job, null, 14 /* SCHEDULER */);
|
|
1849
|
+
callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
|
|
1856
1850
|
}
|
|
1857
1851
|
}
|
|
1858
1852
|
}
|
|
@@ -1864,9 +1858,7 @@ function flushJobs(seen) {
|
|
|
1864
1858
|
currentFlushPromise = null;
|
|
1865
1859
|
// some postFlushCb queued jobs!
|
|
1866
1860
|
// keep flushing until it drains.
|
|
1867
|
-
if (queue.length ||
|
|
1868
|
-
pendingPreFlushCbs.length ||
|
|
1869
|
-
pendingPostFlushCbs.length) {
|
|
1861
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
1870
1862
|
flushJobs(seen);
|
|
1871
1863
|
}
|
|
1872
1864
|
}
|
|
@@ -2084,7 +2076,7 @@ function setDevtoolsHook(hook, target) {
|
|
|
2084
2076
|
}
|
|
2085
2077
|
}
|
|
2086
2078
|
function devtoolsInitApp(app, version) {
|
|
2087
|
-
emit("app:init" /* APP_INIT */, app, version, {
|
|
2079
|
+
emit("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
|
|
2088
2080
|
Fragment,
|
|
2089
2081
|
Text,
|
|
2090
2082
|
Comment,
|
|
@@ -2092,27 +2084,27 @@ function devtoolsInitApp(app, version) {
|
|
|
2092
2084
|
});
|
|
2093
2085
|
}
|
|
2094
2086
|
function devtoolsUnmountApp(app) {
|
|
2095
|
-
emit("app:unmount" /* APP_UNMOUNT */, app);
|
|
2087
|
+
emit("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
|
|
2096
2088
|
}
|
|
2097
|
-
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
|
|
2089
|
+
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* DevtoolsHooks.COMPONENT_ADDED */);
|
|
2098
2090
|
const devtoolsComponentUpdated =
|
|
2099
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
|
|
2091
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* DevtoolsHooks.COMPONENT_UPDATED */);
|
|
2100
2092
|
const devtoolsComponentRemoved =
|
|
2101
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
|
|
2093
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* DevtoolsHooks.COMPONENT_REMOVED */);
|
|
2102
2094
|
function createDevtoolsComponentHook(hook) {
|
|
2103
2095
|
return (component) => {
|
|
2104
2096
|
emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
|
2105
2097
|
};
|
|
2106
2098
|
}
|
|
2107
|
-
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
|
|
2108
|
-
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
|
|
2099
|
+
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* DevtoolsHooks.PERFORMANCE_START */);
|
|
2100
|
+
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* DevtoolsHooks.PERFORMANCE_END */);
|
|
2109
2101
|
function createDevtoolsPerformanceHook(hook) {
|
|
2110
2102
|
return (component, type, time) => {
|
|
2111
2103
|
emit(hook, component.appContext.app, component.uid, component, type, time);
|
|
2112
2104
|
};
|
|
2113
2105
|
}
|
|
2114
2106
|
function devtoolsComponentEmit(component, event, params) {
|
|
2115
|
-
emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
2107
|
+
emit("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
2116
2108
|
}
|
|
2117
2109
|
|
|
2118
2110
|
function emit$1(instance, event, ...rawArgs) {
|
|
@@ -2177,7 +2169,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2177
2169
|
handler = props[(handlerName = toHandlerKey(hyphenate(event)))];
|
|
2178
2170
|
}
|
|
2179
2171
|
if (handler) {
|
|
2180
|
-
callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
2172
|
+
callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
2181
2173
|
}
|
|
2182
2174
|
const onceHandler = props[handlerName + `Once`];
|
|
2183
2175
|
if (onceHandler) {
|
|
@@ -2188,7 +2180,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2188
2180
|
return;
|
|
2189
2181
|
}
|
|
2190
2182
|
instance.emitted[handlerName] = true;
|
|
2191
|
-
callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
2183
|
+
callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
2192
2184
|
}
|
|
2193
2185
|
}
|
|
2194
2186
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
@@ -2220,7 +2212,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
2220
2212
|
}
|
|
2221
2213
|
}
|
|
2222
2214
|
if (!raw && !hasExtends) {
|
|
2223
|
-
|
|
2215
|
+
if (isObject(comp)) {
|
|
2216
|
+
cache.set(comp, null);
|
|
2217
|
+
}
|
|
2224
2218
|
return null;
|
|
2225
2219
|
}
|
|
2226
2220
|
if (isArray(raw)) {
|
|
@@ -2229,7 +2223,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
2229
2223
|
else {
|
|
2230
2224
|
extend(normalized, raw);
|
|
2231
2225
|
}
|
|
2232
|
-
|
|
2226
|
+
if (isObject(comp)) {
|
|
2227
|
+
cache.set(comp, normalized);
|
|
2228
|
+
}
|
|
2233
2229
|
return normalized;
|
|
2234
2230
|
}
|
|
2235
2231
|
// Check if an incoming prop key is a declared emit event listener.
|
|
@@ -2328,7 +2324,7 @@ function renderComponentRoot(instance) {
|
|
|
2328
2324
|
accessedAttrs = false;
|
|
2329
2325
|
}
|
|
2330
2326
|
try {
|
|
2331
|
-
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
2327
|
+
if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
|
|
2332
2328
|
// withProxy is a proxy with a different `has` trap only for
|
|
2333
2329
|
// runtime-compiled render functions using `with` block.
|
|
2334
2330
|
const proxyToUse = withProxy || proxy;
|
|
@@ -2361,7 +2357,7 @@ function renderComponentRoot(instance) {
|
|
|
2361
2357
|
}
|
|
2362
2358
|
catch (err) {
|
|
2363
2359
|
blockStack.length = 0;
|
|
2364
|
-
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
2360
|
+
handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
|
|
2365
2361
|
result = createVNode(Comment);
|
|
2366
2362
|
}
|
|
2367
2363
|
// attr merging
|
|
@@ -2370,14 +2366,14 @@ function renderComponentRoot(instance) {
|
|
|
2370
2366
|
let root = result;
|
|
2371
2367
|
let setRoot = undefined;
|
|
2372
2368
|
if (result.patchFlag > 0 &&
|
|
2373
|
-
result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
2369
|
+
result.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
2374
2370
|
[root, setRoot] = getChildRoot(result);
|
|
2375
2371
|
}
|
|
2376
2372
|
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
2377
2373
|
const keys = Object.keys(fallthroughAttrs);
|
|
2378
2374
|
const { shapeFlag } = root;
|
|
2379
2375
|
if (keys.length) {
|
|
2380
|
-
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
2376
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
|
|
2381
2377
|
if (propsOptions && keys.some(isModelListener)) {
|
|
2382
2378
|
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
2383
2379
|
// prop, it indicates this component expects to handle v-model and
|
|
@@ -2518,7 +2514,7 @@ const filterModelListeners = (attrs, props) => {
|
|
|
2518
2514
|
return res;
|
|
2519
2515
|
};
|
|
2520
2516
|
const isElementRoot = (vnode) => {
|
|
2521
|
-
return (vnode.shapeFlag & (6 /* COMPONENT */ | 1 /* ELEMENT */) ||
|
|
2517
|
+
return (vnode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 1 /* ShapeFlags.ELEMENT */) ||
|
|
2522
2518
|
vnode.type === Comment // potential v-if branch switch
|
|
2523
2519
|
);
|
|
2524
2520
|
};
|
|
@@ -2537,19 +2533,19 @@ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
|
2537
2533
|
return true;
|
|
2538
2534
|
}
|
|
2539
2535
|
if (optimized && patchFlag >= 0) {
|
|
2540
|
-
if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
|
|
2536
|
+
if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
|
|
2541
2537
|
// slot content that references values that might have changed,
|
|
2542
2538
|
// e.g. in a v-for
|
|
2543
2539
|
return true;
|
|
2544
2540
|
}
|
|
2545
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
2541
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
2546
2542
|
if (!prevProps) {
|
|
2547
2543
|
return !!nextProps;
|
|
2548
2544
|
}
|
|
2549
2545
|
// presence of this flag indicates props are always non-null
|
|
2550
2546
|
return hasPropsChanged(prevProps, nextProps, emits);
|
|
2551
2547
|
}
|
|
2552
|
-
else if (patchFlag & 8 /* PROPS */) {
|
|
2548
|
+
else if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
2553
2549
|
const dynamicProps = nextVNode.dynamicProps;
|
|
2554
2550
|
for (let i = 0; i < dynamicProps.length; i++) {
|
|
2555
2551
|
const key = dynamicProps[i];
|
|
@@ -2717,7 +2713,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
2717
2713
|
return traverse(s);
|
|
2718
2714
|
}
|
|
2719
2715
|
else if (isFunction(s)) {
|
|
2720
|
-
return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
|
|
2716
|
+
return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
2721
2717
|
}
|
|
2722
2718
|
else {
|
|
2723
2719
|
warnInvalidSource(s);
|
|
@@ -2727,7 +2723,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
2727
2723
|
else if (isFunction(source)) {
|
|
2728
2724
|
if (cb) {
|
|
2729
2725
|
// getter with cb
|
|
2730
|
-
getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
|
|
2726
|
+
getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
2731
2727
|
}
|
|
2732
2728
|
else {
|
|
2733
2729
|
// no cb -> simple effect
|
|
@@ -2738,7 +2734,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
2738
2734
|
if (cleanup) {
|
|
2739
2735
|
cleanup();
|
|
2740
2736
|
}
|
|
2741
|
-
return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
|
|
2737
|
+
return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
|
|
2742
2738
|
};
|
|
2743
2739
|
}
|
|
2744
2740
|
}
|
|
@@ -2753,7 +2749,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
2753
2749
|
let cleanup;
|
|
2754
2750
|
let onCleanup = (fn) => {
|
|
2755
2751
|
cleanup = effect.onStop = () => {
|
|
2756
|
-
callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
|
|
2752
|
+
callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
|
|
2757
2753
|
};
|
|
2758
2754
|
};
|
|
2759
2755
|
// in SSR there is no need to setup an actual effect, and it should be noop
|
|
@@ -2765,7 +2761,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
2765
2761
|
getter();
|
|
2766
2762
|
}
|
|
2767
2763
|
else if (immediate) {
|
|
2768
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
2764
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
2769
2765
|
getter(),
|
|
2770
2766
|
isMultiSource ? [] : undefined,
|
|
2771
2767
|
onCleanup
|
|
@@ -2791,7 +2787,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
2791
2787
|
if (cleanup) {
|
|
2792
2788
|
cleanup();
|
|
2793
2789
|
}
|
|
2794
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
2790
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
2795
2791
|
newValue,
|
|
2796
2792
|
// pass undefined as the old value when it's changed for the first time
|
|
2797
2793
|
oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
|
@@ -2817,7 +2813,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
2817
2813
|
}
|
|
2818
2814
|
else {
|
|
2819
2815
|
// default: 'pre'
|
|
2820
|
-
|
|
2816
|
+
job.pre = true;
|
|
2817
|
+
if (instance)
|
|
2818
|
+
job.id = instance.uid;
|
|
2819
|
+
scheduler = () => queueJob(job);
|
|
2821
2820
|
}
|
|
2822
2821
|
const effect = new ReactiveEffect(getter, scheduler);
|
|
2823
2822
|
{
|
|
@@ -2884,7 +2883,7 @@ function createPathGetter(ctx, path) {
|
|
|
2884
2883
|
};
|
|
2885
2884
|
}
|
|
2886
2885
|
function traverse(value, seen) {
|
|
2887
|
-
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
2886
|
+
if (!isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
|
|
2888
2887
|
return value;
|
|
2889
2888
|
}
|
|
2890
2889
|
seen = seen || new Set();
|
|
@@ -2917,10 +2916,10 @@ const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
|
2917
2916
|
|
|
2918
2917
|
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
|
2919
2918
|
function onActivated(hook, target) {
|
|
2920
|
-
registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
|
|
2919
|
+
registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
|
|
2921
2920
|
}
|
|
2922
2921
|
function onDeactivated(hook, target) {
|
|
2923
|
-
registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
|
|
2922
|
+
registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
|
|
2924
2923
|
}
|
|
2925
2924
|
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
2926
2925
|
// cache the deactivate branch check wrapper for injected hooks so the same
|
|
@@ -3006,19 +3005,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
3006
3005
|
}
|
|
3007
3006
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
3008
3007
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
3009
|
-
(!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
|
|
3008
|
+
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
3010
3009
|
injectHook(lifecycle, hook, target);
|
|
3011
|
-
const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
|
|
3012
|
-
const onMounted = createHook("m" /* MOUNTED */);
|
|
3013
|
-
const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
|
|
3014
|
-
const onUpdated = createHook("u" /* UPDATED */);
|
|
3015
|
-
const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
|
|
3016
|
-
const onUnmounted = createHook("um" /* UNMOUNTED */);
|
|
3017
|
-
const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
|
|
3018
|
-
const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
|
|
3019
|
-
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
|
|
3010
|
+
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
3011
|
+
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
3012
|
+
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
3013
|
+
const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
|
|
3014
|
+
const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
|
|
3015
|
+
const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
|
|
3016
|
+
const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
|
|
3017
|
+
const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
|
|
3018
|
+
const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
|
|
3020
3019
|
function onErrorCaptured(hook, target = currentInstance) {
|
|
3021
|
-
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
3020
|
+
injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
|
|
3022
3021
|
}
|
|
3023
3022
|
|
|
3024
3023
|
/**
|
|
@@ -3051,7 +3050,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
3051
3050
|
// disable tracking inside all lifecycle hooks
|
|
3052
3051
|
// since they can potentially be called inside effects.
|
|
3053
3052
|
pauseTracking();
|
|
3054
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
3053
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [
|
|
3055
3054
|
vnode.el,
|
|
3056
3055
|
binding,
|
|
3057
3056
|
vnode,
|
|
@@ -3123,23 +3122,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
3123
3122
|
const n = accessCache[key];
|
|
3124
3123
|
if (n !== undefined) {
|
|
3125
3124
|
switch (n) {
|
|
3126
|
-
case 1 /* SETUP */:
|
|
3125
|
+
case 1 /* AccessTypes.SETUP */:
|
|
3127
3126
|
return setupState[key];
|
|
3128
|
-
case 2 /* DATA */:
|
|
3127
|
+
case 2 /* AccessTypes.DATA */:
|
|
3129
3128
|
return data[key];
|
|
3130
|
-
case 4 /* CONTEXT */:
|
|
3129
|
+
case 4 /* AccessTypes.CONTEXT */:
|
|
3131
3130
|
return ctx[key];
|
|
3132
|
-
case 3 /* PROPS */:
|
|
3131
|
+
case 3 /* AccessTypes.PROPS */:
|
|
3133
3132
|
return props[key];
|
|
3134
3133
|
// default: just fallthrough
|
|
3135
3134
|
}
|
|
3136
3135
|
}
|
|
3137
3136
|
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
3138
|
-
accessCache[key] = 1 /* SETUP */;
|
|
3137
|
+
accessCache[key] = 1 /* AccessTypes.SETUP */;
|
|
3139
3138
|
return setupState[key];
|
|
3140
3139
|
}
|
|
3141
3140
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
3142
|
-
accessCache[key] = 2 /* DATA */;
|
|
3141
|
+
accessCache[key] = 2 /* AccessTypes.DATA */;
|
|
3143
3142
|
return data[key];
|
|
3144
3143
|
}
|
|
3145
3144
|
else if (
|
|
@@ -3147,15 +3146,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
3147
3146
|
// props
|
|
3148
3147
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
3149
3148
|
hasOwn(normalizedProps, key)) {
|
|
3150
|
-
accessCache[key] = 3 /* PROPS */;
|
|
3149
|
+
accessCache[key] = 3 /* AccessTypes.PROPS */;
|
|
3151
3150
|
return props[key];
|
|
3152
3151
|
}
|
|
3153
3152
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
3154
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
3153
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
3155
3154
|
return ctx[key];
|
|
3156
3155
|
}
|
|
3157
3156
|
else if (shouldCacheAccess) {
|
|
3158
|
-
accessCache[key] = 0 /* OTHER */;
|
|
3157
|
+
accessCache[key] = 0 /* AccessTypes.OTHER */;
|
|
3159
3158
|
}
|
|
3160
3159
|
}
|
|
3161
3160
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -3163,7 +3162,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
3163
3162
|
// public $xxx properties
|
|
3164
3163
|
if (publicGetter) {
|
|
3165
3164
|
if (key === '$attrs') {
|
|
3166
|
-
track(instance, "get" /* GET */, key);
|
|
3165
|
+
track(instance, "get" /* TrackOpTypes.GET */, key);
|
|
3167
3166
|
markAttrsAccessed();
|
|
3168
3167
|
}
|
|
3169
3168
|
return publicGetter(instance);
|
|
@@ -3176,7 +3175,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
3176
3175
|
}
|
|
3177
3176
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
3178
3177
|
// user may set custom properties to `this` that start with `$`
|
|
3179
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
3178
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
3180
3179
|
return ctx[key];
|
|
3181
3180
|
}
|
|
3182
3181
|
else if (
|
|
@@ -3343,7 +3342,7 @@ function applyOptions(instance) {
|
|
|
3343
3342
|
// call beforeCreate first before accessing other options since
|
|
3344
3343
|
// the hook may mutate resolved options (#2791)
|
|
3345
3344
|
if (options.beforeCreate) {
|
|
3346
|
-
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
3345
|
+
callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
|
|
3347
3346
|
}
|
|
3348
3347
|
const {
|
|
3349
3348
|
// state
|
|
@@ -3359,7 +3358,7 @@ function applyOptions(instance) {
|
|
|
3359
3358
|
const [propsOptions] = instance.propsOptions;
|
|
3360
3359
|
if (propsOptions) {
|
|
3361
3360
|
for (const key in propsOptions) {
|
|
3362
|
-
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
3361
|
+
checkDuplicateProperties("Props" /* OptionTypes.PROPS */, key);
|
|
3363
3362
|
}
|
|
3364
3363
|
}
|
|
3365
3364
|
}
|
|
@@ -3389,7 +3388,7 @@ function applyOptions(instance) {
|
|
|
3389
3388
|
});
|
|
3390
3389
|
}
|
|
3391
3390
|
{
|
|
3392
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
3391
|
+
checkDuplicateProperties("Methods" /* OptionTypes.METHODS */, key);
|
|
3393
3392
|
}
|
|
3394
3393
|
}
|
|
3395
3394
|
else {
|
|
@@ -3416,7 +3415,7 @@ function applyOptions(instance) {
|
|
|
3416
3415
|
instance.data = reactive(data);
|
|
3417
3416
|
{
|
|
3418
3417
|
for (const key in data) {
|
|
3419
|
-
checkDuplicateProperties("Data" /* DATA */, key);
|
|
3418
|
+
checkDuplicateProperties("Data" /* OptionTypes.DATA */, key);
|
|
3420
3419
|
// expose data on ctx during dev
|
|
3421
3420
|
if (!isReservedPrefix(key[0])) {
|
|
3422
3421
|
Object.defineProperty(ctx, key, {
|
|
@@ -3460,7 +3459,7 @@ function applyOptions(instance) {
|
|
|
3460
3459
|
set: v => (c.value = v)
|
|
3461
3460
|
});
|
|
3462
3461
|
{
|
|
3463
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
3462
|
+
checkDuplicateProperties("Computed" /* OptionTypes.COMPUTED */, key);
|
|
3464
3463
|
}
|
|
3465
3464
|
}
|
|
3466
3465
|
}
|
|
@@ -3478,7 +3477,7 @@ function applyOptions(instance) {
|
|
|
3478
3477
|
});
|
|
3479
3478
|
}
|
|
3480
3479
|
if (created) {
|
|
3481
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
3480
|
+
callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
|
|
3482
3481
|
}
|
|
3483
3482
|
function registerLifecycleHook(register, hook) {
|
|
3484
3483
|
if (isArray(hook)) {
|
|
@@ -3571,7 +3570,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
|
|
|
3571
3570
|
ctx[key] = injected;
|
|
3572
3571
|
}
|
|
3573
3572
|
{
|
|
3574
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
3573
|
+
checkDuplicateProperties("Inject" /* OptionTypes.INJECT */, key);
|
|
3575
3574
|
}
|
|
3576
3575
|
}
|
|
3577
3576
|
}
|
|
@@ -3642,7 +3641,9 @@ function resolveMergedOptions(instance) {
|
|
|
3642
3641
|
}
|
|
3643
3642
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
3644
3643
|
}
|
|
3645
|
-
|
|
3644
|
+
if (isObject(base)) {
|
|
3645
|
+
cache.set(base, resolved);
|
|
3646
|
+
}
|
|
3646
3647
|
return resolved;
|
|
3647
3648
|
}
|
|
3648
3649
|
function mergeOptions(to, from, strats, asMixin = false) {
|
|
@@ -3771,6 +3772,13 @@ isSSR = false) {
|
|
|
3771
3772
|
}
|
|
3772
3773
|
instance.attrs = attrs;
|
|
3773
3774
|
}
|
|
3775
|
+
function isInHmrContext(instance) {
|
|
3776
|
+
while (instance) {
|
|
3777
|
+
if (instance.type.__hmrId)
|
|
3778
|
+
return true;
|
|
3779
|
+
instance = instance.parent;
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3774
3782
|
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
3775
3783
|
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
3776
3784
|
const rawCurrentProps = toRaw(props);
|
|
@@ -3780,11 +3788,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3780
3788
|
// always force full diff in dev
|
|
3781
3789
|
// - #1942 if hmr is enabled with sfc component
|
|
3782
3790
|
// - vite#872 non-sfc component used by sfc component
|
|
3783
|
-
!((instance
|
|
3784
|
-
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
3791
|
+
!(isInHmrContext(instance)) &&
|
|
3785
3792
|
(optimized || patchFlag > 0) &&
|
|
3786
|
-
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
3787
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
3793
|
+
!(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
|
|
3794
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
3788
3795
|
// Compiler-generated props & no keys change, just set the updated
|
|
3789
3796
|
// the props.
|
|
3790
3797
|
const propsToUpdate = instance.vnode.dynamicProps;
|
|
@@ -3863,7 +3870,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3863
3870
|
}
|
|
3864
3871
|
// trigger updates for $attrs in case it's used in component slots
|
|
3865
3872
|
if (hasAttrsChanged) {
|
|
3866
|
-
trigger(instance, "set" /* SET */, '$attrs');
|
|
3873
|
+
trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
|
|
3867
3874
|
}
|
|
3868
3875
|
{
|
|
3869
3876
|
validateProps(rawProps || {}, props, instance);
|
|
@@ -3932,11 +3939,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
3932
3939
|
}
|
|
3933
3940
|
}
|
|
3934
3941
|
// boolean casting
|
|
3935
|
-
if (opt[0 /* shouldCast */]) {
|
|
3942
|
+
if (opt[0 /* BooleanFlags.shouldCast */]) {
|
|
3936
3943
|
if (isAbsent && !hasDefault) {
|
|
3937
3944
|
value = false;
|
|
3938
3945
|
}
|
|
3939
|
-
else if (opt[1 /* shouldCastTrue */] &&
|
|
3946
|
+
else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
|
|
3940
3947
|
(value === '' || value === hyphenate(key))) {
|
|
3941
3948
|
value = true;
|
|
3942
3949
|
}
|
|
@@ -3974,7 +3981,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3974
3981
|
}
|
|
3975
3982
|
}
|
|
3976
3983
|
if (!raw && !hasExtends) {
|
|
3977
|
-
|
|
3984
|
+
if (isObject(comp)) {
|
|
3985
|
+
cache.set(comp, EMPTY_ARR);
|
|
3986
|
+
}
|
|
3978
3987
|
return EMPTY_ARR;
|
|
3979
3988
|
}
|
|
3980
3989
|
if (isArray(raw)) {
|
|
@@ -4001,8 +4010,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
4001
4010
|
if (prop) {
|
|
4002
4011
|
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
4003
4012
|
const stringIndex = getTypeIndex(String, prop.type);
|
|
4004
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
4005
|
-
prop[1 /* shouldCastTrue */] =
|
|
4013
|
+
prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
|
|
4014
|
+
prop[1 /* BooleanFlags.shouldCastTrue */] =
|
|
4006
4015
|
stringIndex < 0 || booleanIndex < stringIndex;
|
|
4007
4016
|
// if the prop needs boolean casting or default value
|
|
4008
4017
|
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
@@ -4013,7 +4022,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
4013
4022
|
}
|
|
4014
4023
|
}
|
|
4015
4024
|
const res = [normalized, needCastKeys];
|
|
4016
|
-
|
|
4025
|
+
if (isObject(comp)) {
|
|
4026
|
+
cache.set(comp, res);
|
|
4027
|
+
}
|
|
4017
4028
|
return res;
|
|
4018
4029
|
}
|
|
4019
4030
|
function validatePropName(key) {
|
|
@@ -4223,7 +4234,7 @@ const normalizeVNodeSlots = (instance, children) => {
|
|
|
4223
4234
|
instance.slots.default = () => normalized;
|
|
4224
4235
|
};
|
|
4225
4236
|
const initSlots = (instance, children) => {
|
|
4226
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
4237
|
+
if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
4227
4238
|
const type = children._;
|
|
4228
4239
|
if (type) {
|
|
4229
4240
|
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
@@ -4248,7 +4259,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4248
4259
|
const { vnode, slots } = instance;
|
|
4249
4260
|
let needDeletionCheck = true;
|
|
4250
4261
|
let deletionComparisonTarget = EMPTY_OBJ;
|
|
4251
|
-
if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
4262
|
+
if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
4252
4263
|
const type = children._;
|
|
4253
4264
|
if (type) {
|
|
4254
4265
|
// compiled slots.
|
|
@@ -4257,7 +4268,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4257
4268
|
// force update slots and mark instance for hmr as well
|
|
4258
4269
|
extend(slots, children);
|
|
4259
4270
|
}
|
|
4260
|
-
else if (optimized && type === 1 /* STABLE */) {
|
|
4271
|
+
else if (optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
4261
4272
|
// compiled AND stable.
|
|
4262
4273
|
// no need to update, and skip stale slots removal.
|
|
4263
4274
|
needDeletionCheck = false;
|
|
@@ -4270,7 +4281,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4270
4281
|
// when rendering the optimized slots by manually written render function,
|
|
4271
4282
|
// we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
|
|
4272
4283
|
// i.e. let the `renderSlot` create the bailed Fragment
|
|
4273
|
-
if (!optimized && type === 1 /* STABLE */) {
|
|
4284
|
+
if (!optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
4274
4285
|
delete slots._;
|
|
4275
4286
|
}
|
|
4276
4287
|
}
|
|
@@ -4481,7 +4492,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4481
4492
|
// because the template ref is forwarded to inner component
|
|
4482
4493
|
return;
|
|
4483
4494
|
}
|
|
4484
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4495
|
+
const refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
4485
4496
|
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4486
4497
|
: vnode.el;
|
|
4487
4498
|
const value = isUnmount ? null : refValue;
|
|
@@ -4507,7 +4518,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4507
4518
|
}
|
|
4508
4519
|
}
|
|
4509
4520
|
if (isFunction(ref)) {
|
|
4510
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4521
|
+
callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
|
|
4511
4522
|
}
|
|
4512
4523
|
else {
|
|
4513
4524
|
const _isString = isString(ref);
|
|
@@ -4645,7 +4656,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4645
4656
|
unmount(n1, parentComponent, parentSuspense, true);
|
|
4646
4657
|
n1 = null;
|
|
4647
4658
|
}
|
|
4648
|
-
if (n2.patchFlag === -2 /* BAIL */) {
|
|
4659
|
+
if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
4649
4660
|
optimized = false;
|
|
4650
4661
|
n2.dynamicChildren = null;
|
|
4651
4662
|
}
|
|
@@ -4669,16 +4680,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4669
4680
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4670
4681
|
break;
|
|
4671
4682
|
default:
|
|
4672
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
4683
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
4673
4684
|
processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4674
4685
|
}
|
|
4675
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
4686
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4676
4687
|
processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4677
4688
|
}
|
|
4678
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
4689
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
4679
4690
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
4680
4691
|
}
|
|
4681
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
4692
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4682
4693
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
4683
4694
|
}
|
|
4684
4695
|
else {
|
|
@@ -4764,10 +4775,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4764
4775
|
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
4765
4776
|
// mount children first, since some props may rely on child content
|
|
4766
4777
|
// being already rendered, e.g. `<select value>`
|
|
4767
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
4778
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
4768
4779
|
hostSetElementText(el, vnode.children);
|
|
4769
4780
|
}
|
|
4770
|
-
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
4781
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
4771
4782
|
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
4772
4783
|
}
|
|
4773
4784
|
if (dirs) {
|
|
@@ -4843,7 +4854,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4843
4854
|
if (parentComponent) {
|
|
4844
4855
|
let subTree = parentComponent.subTree;
|
|
4845
4856
|
if (subTree.patchFlag > 0 &&
|
|
4846
|
-
subTree.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
4857
|
+
subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
4847
4858
|
subTree =
|
|
4848
4859
|
filterSingleRoot(subTree.children) || subTree;
|
|
4849
4860
|
}
|
|
@@ -4866,7 +4877,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4866
4877
|
let { patchFlag, dynamicChildren, dirs } = n2;
|
|
4867
4878
|
// #1426 take the old vnode's patch flag into account since user may clone a
|
|
4868
4879
|
// compiler-generated vnode, which de-opts to FULL_PROPS
|
|
4869
|
-
patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
|
|
4880
|
+
patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
|
|
4870
4881
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
4871
4882
|
const newProps = n2.props || EMPTY_OBJ;
|
|
4872
4883
|
let vnodeHook;
|
|
@@ -4901,21 +4912,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4901
4912
|
// generated by the compiler and can take the fast path.
|
|
4902
4913
|
// in this path old node and new node are guaranteed to have the same shape
|
|
4903
4914
|
// (i.e. at the exact same position in the source template)
|
|
4904
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
4915
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
4905
4916
|
// element props contain dynamic keys, full diff needed
|
|
4906
4917
|
patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
|
4907
4918
|
}
|
|
4908
4919
|
else {
|
|
4909
4920
|
// class
|
|
4910
4921
|
// this flag is matched when the element has dynamic class bindings.
|
|
4911
|
-
if (patchFlag & 2 /* CLASS */) {
|
|
4922
|
+
if (patchFlag & 2 /* PatchFlags.CLASS */) {
|
|
4912
4923
|
if (oldProps.class !== newProps.class) {
|
|
4913
4924
|
hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
|
4914
4925
|
}
|
|
4915
4926
|
}
|
|
4916
4927
|
// style
|
|
4917
4928
|
// this flag is matched when the element has dynamic style bindings
|
|
4918
|
-
if (patchFlag & 4 /* STYLE */) {
|
|
4929
|
+
if (patchFlag & 4 /* PatchFlags.STYLE */) {
|
|
4919
4930
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
|
4920
4931
|
}
|
|
4921
4932
|
// props
|
|
@@ -4924,7 +4935,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4924
4935
|
// faster iteration.
|
|
4925
4936
|
// Note dynamic keys like :[foo]="bar" will cause this optimization to
|
|
4926
4937
|
// bail out and go through a full diff because we need to unset the old key
|
|
4927
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
4938
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
4928
4939
|
// if the flag is present then dynamicProps must be non-null
|
|
4929
4940
|
const propsToUpdate = n2.dynamicProps;
|
|
4930
4941
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
@@ -4940,7 +4951,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4940
4951
|
}
|
|
4941
4952
|
// text
|
|
4942
4953
|
// This flag is matched when the element has only dynamic text children.
|
|
4943
|
-
if (patchFlag & 1 /* TEXT */) {
|
|
4954
|
+
if (patchFlag & 1 /* PatchFlags.TEXT */) {
|
|
4944
4955
|
if (n1.children !== n2.children) {
|
|
4945
4956
|
hostSetElementText(el, n2.children);
|
|
4946
4957
|
}
|
|
@@ -4974,7 +4985,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4974
4985
|
// which also requires the correct parent container
|
|
4975
4986
|
!isSameVNodeType(oldVNode, newVNode) ||
|
|
4976
4987
|
// - In the case of a component, it could contain anything.
|
|
4977
|
-
oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
|
|
4988
|
+
oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
|
|
4978
4989
|
? hostParentNode(oldVNode.el)
|
|
4979
4990
|
: // In other cases, the parent container is not actually used so we
|
|
4980
4991
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -5012,7 +5023,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5012
5023
|
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
|
5013
5024
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
5014
5025
|
if (// #5523 dev root fragment may inherit directives
|
|
5015
|
-
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
5026
|
+
(isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */)) {
|
|
5016
5027
|
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
5017
5028
|
patchFlag = 0;
|
|
5018
5029
|
optimized = false;
|
|
@@ -5034,7 +5045,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5034
5045
|
}
|
|
5035
5046
|
else {
|
|
5036
5047
|
if (patchFlag > 0 &&
|
|
5037
|
-
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
5048
|
+
patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
|
|
5038
5049
|
dynamicChildren &&
|
|
5039
5050
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
5040
5051
|
// of renderSlot() with no valid children
|
|
@@ -5067,7 +5078,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5067
5078
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
5068
5079
|
n2.slotScopeIds = slotScopeIds;
|
|
5069
5080
|
if (n1 == null) {
|
|
5070
|
-
if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
5081
|
+
if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
5071
5082
|
parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
|
5072
5083
|
}
|
|
5073
5084
|
else {
|
|
@@ -5229,10 +5240,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5229
5240
|
// activated hook for keep-alive roots.
|
|
5230
5241
|
// #1742 activated hook must be accessed after first render
|
|
5231
5242
|
// since the hook may be injected by a child keep-alive
|
|
5232
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5243
|
+
if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5233
5244
|
(parent &&
|
|
5234
5245
|
isAsyncWrapper(parent.vnode) &&
|
|
5235
|
-
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5246
|
+
parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5236
5247
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
5237
5248
|
}
|
|
5238
5249
|
instance.isMounted = true;
|
|
@@ -5343,7 +5354,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5343
5354
|
pauseTracking();
|
|
5344
5355
|
// props update may have triggered pre-flush watchers.
|
|
5345
5356
|
// flush them before the render update.
|
|
5346
|
-
flushPreFlushCbs(
|
|
5357
|
+
flushPreFlushCbs();
|
|
5347
5358
|
resetTracking();
|
|
5348
5359
|
};
|
|
5349
5360
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
|
@@ -5353,22 +5364,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5353
5364
|
const { patchFlag, shapeFlag } = n2;
|
|
5354
5365
|
// fast path
|
|
5355
5366
|
if (patchFlag > 0) {
|
|
5356
|
-
if (patchFlag & 128 /* KEYED_FRAGMENT */) {
|
|
5367
|
+
if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
|
|
5357
5368
|
// this could be either fully-keyed or mixed (some keyed some not)
|
|
5358
5369
|
// presence of patchFlag means children are guaranteed to be arrays
|
|
5359
5370
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5360
5371
|
return;
|
|
5361
5372
|
}
|
|
5362
|
-
else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
|
|
5373
|
+
else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
|
|
5363
5374
|
// unkeyed
|
|
5364
5375
|
patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5365
5376
|
return;
|
|
5366
5377
|
}
|
|
5367
5378
|
}
|
|
5368
5379
|
// children has 3 possibilities: text, array or no children.
|
|
5369
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5380
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5370
5381
|
// text children fast path
|
|
5371
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5382
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5372
5383
|
unmountChildren(c1, parentComponent, parentSuspense);
|
|
5373
5384
|
}
|
|
5374
5385
|
if (c2 !== c1) {
|
|
@@ -5376,9 +5387,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5376
5387
|
}
|
|
5377
5388
|
}
|
|
5378
5389
|
else {
|
|
5379
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5390
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5380
5391
|
// prev children was array
|
|
5381
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5392
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5382
5393
|
// two arrays, cannot assume anything, do full diff
|
|
5383
5394
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5384
5395
|
}
|
|
@@ -5390,11 +5401,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5390
5401
|
else {
|
|
5391
5402
|
// prev children was text OR null
|
|
5392
5403
|
// new children is array OR null
|
|
5393
|
-
if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5404
|
+
if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5394
5405
|
hostSetElementText(container, '');
|
|
5395
5406
|
}
|
|
5396
5407
|
// mount new if array
|
|
5397
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5408
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5398
5409
|
mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5399
5410
|
}
|
|
5400
5411
|
}
|
|
@@ -5585,7 +5596,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5585
5596
|
// There is no stable subsequence (e.g. a reverse)
|
|
5586
5597
|
// OR current node is not among the stable sequence
|
|
5587
5598
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
5588
|
-
move(nextChild, container, anchor, 2 /* REORDER */);
|
|
5599
|
+
move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
|
|
5589
5600
|
}
|
|
5590
5601
|
else {
|
|
5591
5602
|
j--;
|
|
@@ -5596,15 +5607,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5596
5607
|
};
|
|
5597
5608
|
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
5598
5609
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
5599
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
5610
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5600
5611
|
move(vnode.component.subTree, container, anchor, moveType);
|
|
5601
5612
|
return;
|
|
5602
5613
|
}
|
|
5603
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5614
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5604
5615
|
vnode.suspense.move(container, anchor, moveType);
|
|
5605
5616
|
return;
|
|
5606
5617
|
}
|
|
5607
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
5618
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5608
5619
|
type.move(vnode, container, anchor, internals);
|
|
5609
5620
|
return;
|
|
5610
5621
|
}
|
|
@@ -5621,11 +5632,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5621
5632
|
return;
|
|
5622
5633
|
}
|
|
5623
5634
|
// single nodes
|
|
5624
|
-
const needTransition = moveType !== 2 /* REORDER */ &&
|
|
5625
|
-
shapeFlag & 1 /* ELEMENT */ &&
|
|
5635
|
+
const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
|
|
5636
|
+
shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
5626
5637
|
transition;
|
|
5627
5638
|
if (needTransition) {
|
|
5628
|
-
if (moveType === 0 /* ENTER */) {
|
|
5639
|
+
if (moveType === 0 /* MoveType.ENTER */) {
|
|
5629
5640
|
transition.beforeEnter(el);
|
|
5630
5641
|
hostInsert(el, container, anchor);
|
|
5631
5642
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -5657,42 +5668,42 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5657
5668
|
if (ref != null) {
|
|
5658
5669
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
5659
5670
|
}
|
|
5660
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
5671
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
5661
5672
|
parentComponent.ctx.deactivate(vnode);
|
|
5662
5673
|
return;
|
|
5663
5674
|
}
|
|
5664
|
-
const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
|
|
5675
|
+
const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
|
|
5665
5676
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
5666
5677
|
let vnodeHook;
|
|
5667
5678
|
if (shouldInvokeVnodeHook &&
|
|
5668
5679
|
(vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
|
5669
5680
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
5670
5681
|
}
|
|
5671
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
5682
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5672
5683
|
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
5673
5684
|
}
|
|
5674
5685
|
else {
|
|
5675
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5686
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5676
5687
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
5677
5688
|
return;
|
|
5678
5689
|
}
|
|
5679
5690
|
if (shouldInvokeDirs) {
|
|
5680
5691
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
|
5681
5692
|
}
|
|
5682
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
5693
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5683
5694
|
vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
|
5684
5695
|
}
|
|
5685
5696
|
else if (dynamicChildren &&
|
|
5686
5697
|
// #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
5687
5698
|
(type !== Fragment ||
|
|
5688
|
-
(patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
|
|
5699
|
+
(patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
|
|
5689
5700
|
// fast path for block nodes: only need to unmount dynamic children.
|
|
5690
5701
|
unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
5691
5702
|
}
|
|
5692
5703
|
else if ((type === Fragment &&
|
|
5693
5704
|
patchFlag &
|
|
5694
|
-
(128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
|
|
5695
|
-
(!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
|
|
5705
|
+
(128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
|
|
5706
|
+
(!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
|
|
5696
5707
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
5697
5708
|
}
|
|
5698
5709
|
if (doRemove) {
|
|
@@ -5713,7 +5724,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5713
5724
|
const { type, el, anchor, transition } = vnode;
|
|
5714
5725
|
if (type === Fragment) {
|
|
5715
5726
|
if (vnode.patchFlag > 0 &&
|
|
5716
|
-
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
5727
|
+
vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ &&
|
|
5717
5728
|
transition &&
|
|
5718
5729
|
!transition.persisted) {
|
|
5719
5730
|
vnode.children.forEach(child => {
|
|
@@ -5740,7 +5751,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5740
5751
|
transition.afterLeave();
|
|
5741
5752
|
}
|
|
5742
5753
|
};
|
|
5743
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ &&
|
|
5754
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
5744
5755
|
transition &&
|
|
5745
5756
|
!transition.persisted) {
|
|
5746
5757
|
const { leave, delayLeave } = transition;
|
|
@@ -5816,10 +5827,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5816
5827
|
}
|
|
5817
5828
|
};
|
|
5818
5829
|
const getNextHostNode = vnode => {
|
|
5819
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */) {
|
|
5830
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5820
5831
|
return getNextHostNode(vnode.component.subTree);
|
|
5821
5832
|
}
|
|
5822
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
5833
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5823
5834
|
return vnode.suspense.next();
|
|
5824
5835
|
}
|
|
5825
5836
|
return hostNextSibling((vnode.anchor || vnode.el));
|
|
@@ -5833,6 +5844,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5833
5844
|
else {
|
|
5834
5845
|
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
|
5835
5846
|
}
|
|
5847
|
+
flushPreFlushCbs();
|
|
5836
5848
|
flushPostFlushCbs();
|
|
5837
5849
|
container._vnode = vnode;
|
|
5838
5850
|
};
|
|
@@ -5882,8 +5894,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
5882
5894
|
// guaranteed to be vnodes
|
|
5883
5895
|
const c1 = ch1[i];
|
|
5884
5896
|
let c2 = ch2[i];
|
|
5885
|
-
if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
|
|
5886
|
-
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
|
|
5897
|
+
if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
|
|
5898
|
+
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
5887
5899
|
c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
|
5888
5900
|
c2.el = c1.el;
|
|
5889
5901
|
}
|
|
@@ -5982,7 +5994,7 @@ function isVNode(value) {
|
|
|
5982
5994
|
return value ? value.__v_isVNode === true : false;
|
|
5983
5995
|
}
|
|
5984
5996
|
function isSameVNodeType(n1, n2) {
|
|
5985
|
-
if (n2.shapeFlag & 6 /* COMPONENT */ &&
|
|
5997
|
+
if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
5986
5998
|
hmrDirtyComponents.has(n2.type)) {
|
|
5987
5999
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
5988
6000
|
return false;
|
|
@@ -6001,7 +6013,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
6001
6013
|
: ref
|
|
6002
6014
|
: null);
|
|
6003
6015
|
};
|
|
6004
|
-
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
6016
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
6005
6017
|
const vnode = {
|
|
6006
6018
|
__v_isVNode: true,
|
|
6007
6019
|
__v_skip: true,
|
|
@@ -6032,7 +6044,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6032
6044
|
if (needFullChildrenNormalization) {
|
|
6033
6045
|
normalizeChildren(vnode, children);
|
|
6034
6046
|
// normalize suspense children
|
|
6035
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6047
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6036
6048
|
type.normalize(vnode);
|
|
6037
6049
|
}
|
|
6038
6050
|
}
|
|
@@ -6040,8 +6052,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6040
6052
|
// compiled element vnode - if children is passed, only possible types are
|
|
6041
6053
|
// string or Array.
|
|
6042
6054
|
vnode.shapeFlag |= isString(children)
|
|
6043
|
-
? 8 /* TEXT_CHILDREN */
|
|
6044
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
6055
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
6056
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6045
6057
|
}
|
|
6046
6058
|
// validate key
|
|
6047
6059
|
if (vnode.key !== vnode.key) {
|
|
@@ -6057,10 +6069,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6057
6069
|
// component nodes also should always be patched, because even if the
|
|
6058
6070
|
// component doesn't need to update, it needs to persist the instance on to
|
|
6059
6071
|
// the next vnode so that it can be properly unmounted later.
|
|
6060
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
6072
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
6061
6073
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
6062
6074
|
// vnode should not be considered dynamic due to handler caching.
|
|
6063
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
6075
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
6064
6076
|
currentBlock.push(vnode);
|
|
6065
6077
|
}
|
|
6066
6078
|
return vnode;
|
|
@@ -6082,14 +6094,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6082
6094
|
normalizeChildren(cloned, children);
|
|
6083
6095
|
}
|
|
6084
6096
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
6085
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
6097
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6086
6098
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
6087
6099
|
}
|
|
6088
6100
|
else {
|
|
6089
6101
|
currentBlock.push(cloned);
|
|
6090
6102
|
}
|
|
6091
6103
|
}
|
|
6092
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
6104
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
6093
6105
|
return cloned;
|
|
6094
6106
|
}
|
|
6095
6107
|
// class component normalization.
|
|
@@ -6115,17 +6127,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6115
6127
|
}
|
|
6116
6128
|
// encode the vnode type information into a bitmap
|
|
6117
6129
|
const shapeFlag = isString(type)
|
|
6118
|
-
? 1 /* ELEMENT */
|
|
6130
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
6119
6131
|
: isSuspense(type)
|
|
6120
|
-
? 128 /* SUSPENSE */
|
|
6132
|
+
? 128 /* ShapeFlags.SUSPENSE */
|
|
6121
6133
|
: isTeleport(type)
|
|
6122
|
-
? 64 /* TELEPORT */
|
|
6134
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
6123
6135
|
: isObject(type)
|
|
6124
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
6136
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
6125
6137
|
: isFunction(type)
|
|
6126
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
6138
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
6127
6139
|
: 0;
|
|
6128
|
-
if (shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
6140
|
+
if (shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
6129
6141
|
type = toRaw(type);
|
|
6130
6142
|
warn$1(`Vue received a Component which was made a reactive object. This can ` +
|
|
6131
6143
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
@@ -6164,7 +6176,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6164
6176
|
: ref,
|
|
6165
6177
|
scopeId: vnode.scopeId,
|
|
6166
6178
|
slotScopeIds: vnode.slotScopeIds,
|
|
6167
|
-
children: patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
6179
|
+
children: patchFlag === -1 /* PatchFlags.HOISTED */ && isArray(children)
|
|
6168
6180
|
? children.map(deepCloneVNode)
|
|
6169
6181
|
: children,
|
|
6170
6182
|
target: vnode.target,
|
|
@@ -6177,8 +6189,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6177
6189
|
// fast paths only.
|
|
6178
6190
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
6179
6191
|
? patchFlag === -1 // hoisted node
|
|
6180
|
-
? 16 /* FULL_PROPS */
|
|
6181
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
6192
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
6193
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
6182
6194
|
: patchFlag,
|
|
6183
6195
|
dynamicProps: vnode.dynamicProps,
|
|
6184
6196
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -6247,10 +6259,10 @@ function normalizeChildren(vnode, children) {
|
|
|
6247
6259
|
children = null;
|
|
6248
6260
|
}
|
|
6249
6261
|
else if (isArray(children)) {
|
|
6250
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6262
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6251
6263
|
}
|
|
6252
6264
|
else if (typeof children === 'object') {
|
|
6253
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
6265
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
6254
6266
|
// Normalize slot to plain children for plain element and Teleport
|
|
6255
6267
|
const slot = children.default;
|
|
6256
6268
|
if (slot) {
|
|
@@ -6262,37 +6274,37 @@ function normalizeChildren(vnode, children) {
|
|
|
6262
6274
|
return;
|
|
6263
6275
|
}
|
|
6264
6276
|
else {
|
|
6265
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6277
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6266
6278
|
const slotFlag = children._;
|
|
6267
6279
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
6268
6280
|
children._ctx = currentRenderingInstance;
|
|
6269
6281
|
}
|
|
6270
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
6282
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
6271
6283
|
// a child component receives forwarded slots from the parent.
|
|
6272
6284
|
// its slot type is determined by its parent's slot type.
|
|
6273
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
6274
|
-
children._ = 1 /* STABLE */;
|
|
6285
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
6286
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
6275
6287
|
}
|
|
6276
6288
|
else {
|
|
6277
|
-
children._ = 2 /* DYNAMIC */;
|
|
6278
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
6289
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
6290
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
6279
6291
|
}
|
|
6280
6292
|
}
|
|
6281
6293
|
}
|
|
6282
6294
|
}
|
|
6283
6295
|
else if (isFunction(children)) {
|
|
6284
6296
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
6285
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6297
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6286
6298
|
}
|
|
6287
6299
|
else {
|
|
6288
6300
|
children = String(children);
|
|
6289
6301
|
// force teleport children to array so it can be moved around
|
|
6290
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6291
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6302
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6303
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6292
6304
|
children = [createTextVNode(children)];
|
|
6293
6305
|
}
|
|
6294
6306
|
else {
|
|
6295
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
6307
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
6296
6308
|
}
|
|
6297
6309
|
}
|
|
6298
6310
|
vnode.children = children;
|
|
@@ -6330,7 +6342,7 @@ function mergeProps(...args) {
|
|
|
6330
6342
|
return ret;
|
|
6331
6343
|
}
|
|
6332
6344
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
6333
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
6345
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
|
|
6334
6346
|
vnode,
|
|
6335
6347
|
prevVNode
|
|
6336
6348
|
]);
|
|
@@ -6437,7 +6449,7 @@ function validateComponentName(name, config) {
|
|
|
6437
6449
|
}
|
|
6438
6450
|
}
|
|
6439
6451
|
function isStatefulComponent(instance) {
|
|
6440
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
6452
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
6441
6453
|
}
|
|
6442
6454
|
let isInSSRComponentSetup = false;
|
|
6443
6455
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -6492,7 +6504,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6492
6504
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
6493
6505
|
setCurrentInstance(instance);
|
|
6494
6506
|
pauseTracking();
|
|
6495
|
-
const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [shallowReadonly(instance.props) , setupContext]);
|
|
6507
|
+
const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [shallowReadonly(instance.props) , setupContext]);
|
|
6496
6508
|
resetTracking();
|
|
6497
6509
|
unsetCurrentInstance();
|
|
6498
6510
|
if (isPromise(setupResult)) {
|
|
@@ -6504,7 +6516,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
6504
6516
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
6505
6517
|
})
|
|
6506
6518
|
.catch(e => {
|
|
6507
|
-
handleError(e, instance, 0 /* SETUP_FUNCTION */);
|
|
6519
|
+
handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
6508
6520
|
});
|
|
6509
6521
|
}
|
|
6510
6522
|
else {
|
|
@@ -6617,7 +6629,7 @@ function createAttrsProxy(instance) {
|
|
|
6617
6629
|
return new Proxy(instance.attrs, {
|
|
6618
6630
|
get(target, key) {
|
|
6619
6631
|
markAttrsAccessed();
|
|
6620
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
6632
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
6621
6633
|
return target[key];
|
|
6622
6634
|
},
|
|
6623
6635
|
set() {
|
|
@@ -6714,7 +6726,7 @@ const computed$1 = ((getterOrOptions, debugOptions) => {
|
|
|
6714
6726
|
const ssrContextKey = Symbol(`ssrContext` );
|
|
6715
6727
|
|
|
6716
6728
|
// Core API ------------------------------------------------------------------
|
|
6717
|
-
const version = "3.2.
|
|
6729
|
+
const version = "3.2.38";
|
|
6718
6730
|
const _ssrUtils = {
|
|
6719
6731
|
createComponentInstance,
|
|
6720
6732
|
setupComponent,
|
|
@@ -7081,7 +7093,8 @@ function parseName(name) {
|
|
|
7081
7093
|
options[m[0].toLowerCase()] = true;
|
|
7082
7094
|
}
|
|
7083
7095
|
}
|
|
7084
|
-
|
|
7096
|
+
const event = name[2] === ':' ? name.slice(3) : hyphenate(name.slice(2));
|
|
7097
|
+
return [event, options];
|
|
7085
7098
|
}
|
|
7086
7099
|
function createInvoker(initialValue, instance) {
|
|
7087
7100
|
const invoker = (e) => {
|
|
@@ -7093,7 +7106,7 @@ function createInvoker(initialValue, instance) {
|
|
|
7093
7106
|
// AFTER it was attached.
|
|
7094
7107
|
const timeStamp = e.timeStamp || _getNow();
|
|
7095
7108
|
if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
|
|
7096
|
-
callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* NATIVE_EVENT_HANDLER */, [e]);
|
|
7109
|
+
callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* ErrorCodes.NATIVE_EVENT_HANDLER */, [e]);
|
|
7097
7110
|
}
|
|
7098
7111
|
};
|
|
7099
7112
|
invoker.value = initialValue;
|
|
@@ -7540,16 +7553,16 @@ function renderVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
7540
7553
|
push(`<!--]-->`); // close
|
|
7541
7554
|
break;
|
|
7542
7555
|
default:
|
|
7543
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
7556
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
7544
7557
|
renderElementVNode(push, vnode, parentComponent, slotScopeId);
|
|
7545
7558
|
}
|
|
7546
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
7559
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
7547
7560
|
push(renderComponentVNode(vnode, parentComponent, slotScopeId));
|
|
7548
7561
|
}
|
|
7549
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
7562
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
7550
7563
|
renderTeleportVNode(push, vnode, parentComponent, slotScopeId);
|
|
7551
7564
|
}
|
|
7552
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
7565
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
7553
7566
|
renderVNode(push, vnode.ssContent, parentComponent, slotScopeId);
|
|
7554
7567
|
}
|
|
7555
7568
|
else {
|
|
@@ -7606,10 +7619,10 @@ function renderElementVNode(push, vnode, parentComponent, slotScopeId) {
|
|
|
7606
7619
|
}
|
|
7607
7620
|
}
|
|
7608
7621
|
if (!hasChildrenOverride) {
|
|
7609
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
7622
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
7610
7623
|
push(escapeHtml(children));
|
|
7611
7624
|
}
|
|
7612
|
-
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7625
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7613
7626
|
renderVNodeChildren(push, children, parentComponent, slotScopeId);
|
|
7614
7627
|
}
|
|
7615
7628
|
}
|
|
@@ -7706,7 +7719,7 @@ async function resolveTeleports(context) {
|
|
|
7706
7719
|
for (const key in context.__teleportBuffers) {
|
|
7707
7720
|
// note: it's OK to await sequentially here because the Promises were
|
|
7708
7721
|
// created eagerly in parallel.
|
|
7709
|
-
context.teleports[key] = await unrollBuffer(
|
|
7722
|
+
context.teleports[key] = await unrollBuffer(await Promise.all([context.__teleportBuffers[key]]));
|
|
7710
7723
|
}
|
|
7711
7724
|
}
|
|
7712
7725
|
}
|
|
@@ -7907,11 +7920,15 @@ function ssrRenderSlotInner(slots, slotName, slotProps, fallbackRenderFn, push,
|
|
|
7907
7920
|
fallbackRenderFn();
|
|
7908
7921
|
}
|
|
7909
7922
|
}
|
|
7923
|
+
const commentTestRE = /^<!--.*-->$/s;
|
|
7910
7924
|
const commentRE = /<!--[^]*?-->/gm;
|
|
7911
7925
|
function isComment(item) {
|
|
7912
|
-
|
|
7913
|
-
|
|
7914
|
-
|
|
7926
|
+
if (typeof item !== 'string' || !commentTestRE.test(item))
|
|
7927
|
+
return false;
|
|
7928
|
+
// if item is '<!---->' or '<!--[-->' or '<!--]-->', return true directly
|
|
7929
|
+
if (item.length <= 8)
|
|
7930
|
+
return true;
|
|
7931
|
+
return !item.replace(commentRE, '').trim();
|
|
7915
7932
|
}
|
|
7916
7933
|
|
|
7917
7934
|
function ssrInterpolate(value) {
|