@histoire/vendors 0.10.7 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/b-floating-vue.js +7 -2
- package/dist/client/b-pinia.js +12 -1
- package/dist/client/b-vue-router.js +11 -4
- package/dist/client/node_modules/@babel/parser/package.json +2 -2
- package/dist/client/node_modules/@babel/parser/typings/babel-parser.d.ts +2 -1
- package/dist/client/node_modules/@vue/compiler-core/package.json +2 -2
- package/dist/client/node_modules/@vue/compiler-dom/package.json +3 -3
- package/dist/client/node_modules/@vue/compiler-sfc/package.json +6 -6
- package/dist/client/node_modules/@vue/compiler-ssr/package.json +3 -3
- package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/component.d.ts +1 -0
- package/dist/client/node_modules/@vue/devtools-api/lib/esm/api/hooks.d.ts +1 -0
- package/dist/client/node_modules/@vue/devtools-api/package.json +1 -1
- package/dist/client/node_modules/@vue/reactivity/package.json +2 -2
- package/dist/client/node_modules/@vue/reactivity-transform/package.json +3 -3
- package/dist/client/node_modules/@vue/runtime-core/dist/runtime-core.d.ts +12 -8
- package/dist/client/node_modules/@vue/runtime-core/package.json +3 -3
- package/dist/client/node_modules/@vue/runtime-dom/package.json +3 -3
- package/dist/client/node_modules/@vue/server-renderer/package.json +4 -4
- package/dist/client/node_modules/@vue/shared/dist/shared.d.ts +3 -3
- package/dist/client/node_modules/@vue/shared/package.json +1 -1
- package/dist/client/node_modules/@vueuse/core/node_modules/vue-demi/package.json +1 -1
- package/dist/client/node_modules/csstype/index.d.ts +2399 -3213
- package/dist/client/node_modules/csstype/package.json +4 -5
- package/dist/client/node_modules/floating-vue/dist/components/Popper.d.ts +7 -0
- package/dist/client/node_modules/floating-vue/dist/components/Popper.vue.d.ts +7 -0
- package/dist/client/node_modules/floating-vue/dist/index.d.ts +7 -0
- package/dist/client/node_modules/floating-vue/package.json +2 -3
- package/dist/client/node_modules/pinia/node_modules/vue-demi/package.json +1 -1
- package/dist/client/node_modules/pinia/package.json +1 -2
- package/dist/client/node_modules/postcss/package.json +1 -1
- package/dist/client/node_modules/vue/package.json +10 -8
- package/dist/client/node_modules/vue-router/package.json +1 -1
- package/dist/client/vue.runtime.esm-bundler.js +476 -464
- package/package.json +1 -1
- package/tsconfig.json +0 -1
|
@@ -18,29 +18,29 @@ function makeMap(str, expectsLowerCase) {
|
|
|
18
18
|
* dev only flag -> name mapping
|
|
19
19
|
*/
|
|
20
20
|
const PatchFlagNames = {
|
|
21
|
-
[1 /* TEXT */]: `TEXT`,
|
|
22
|
-
[2 /* CLASS */]: `CLASS`,
|
|
23
|
-
[4 /* STYLE */]: `STYLE`,
|
|
24
|
-
[8 /* PROPS */]: `PROPS`,
|
|
25
|
-
[16 /* FULL_PROPS */]: `FULL_PROPS`,
|
|
26
|
-
[32 /* HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
|
27
|
-
[64 /* STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
|
28
|
-
[128 /* KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
|
29
|
-
[256 /* UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
|
30
|
-
[512 /* NEED_PATCH */]: `NEED_PATCH`,
|
|
31
|
-
[1024 /* DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
|
32
|
-
[2048 /* DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
|
|
33
|
-
[-1 /* HOISTED */]: `HOISTED`,
|
|
34
|
-
[-2 /* BAIL */]: `BAIL`
|
|
21
|
+
[1 /* PatchFlags.TEXT */]: `TEXT`,
|
|
22
|
+
[2 /* PatchFlags.CLASS */]: `CLASS`,
|
|
23
|
+
[4 /* PatchFlags.STYLE */]: `STYLE`,
|
|
24
|
+
[8 /* PatchFlags.PROPS */]: `PROPS`,
|
|
25
|
+
[16 /* PatchFlags.FULL_PROPS */]: `FULL_PROPS`,
|
|
26
|
+
[32 /* PatchFlags.HYDRATE_EVENTS */]: `HYDRATE_EVENTS`,
|
|
27
|
+
[64 /* PatchFlags.STABLE_FRAGMENT */]: `STABLE_FRAGMENT`,
|
|
28
|
+
[128 /* PatchFlags.KEYED_FRAGMENT */]: `KEYED_FRAGMENT`,
|
|
29
|
+
[256 /* PatchFlags.UNKEYED_FRAGMENT */]: `UNKEYED_FRAGMENT`,
|
|
30
|
+
[512 /* PatchFlags.NEED_PATCH */]: `NEED_PATCH`,
|
|
31
|
+
[1024 /* PatchFlags.DYNAMIC_SLOTS */]: `DYNAMIC_SLOTS`,
|
|
32
|
+
[2048 /* PatchFlags.DEV_ROOT_FRAGMENT */]: `DEV_ROOT_FRAGMENT`,
|
|
33
|
+
[-1 /* PatchFlags.HOISTED */]: `HOISTED`,
|
|
34
|
+
[-2 /* PatchFlags.BAIL */]: `BAIL`
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Dev only
|
|
39
39
|
*/
|
|
40
40
|
const slotFlagsText = {
|
|
41
|
-
[1 /* STABLE */]: 'STABLE',
|
|
42
|
-
[2 /* DYNAMIC */]: 'DYNAMIC',
|
|
43
|
-
[3 /* FORWARDED */]: 'FORWARDED'
|
|
41
|
+
[1 /* SlotFlags.STABLE */]: 'STABLE',
|
|
42
|
+
[2 /* SlotFlags.DYNAMIC */]: 'DYNAMIC',
|
|
43
|
+
[3 /* SlotFlags.FORWARDED */]: 'FORWARDED'
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
const GLOBALS_WHITE_LISTED = 'Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,' +
|
|
@@ -890,7 +890,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
890
890
|
return;
|
|
891
891
|
}
|
|
892
892
|
let deps = [];
|
|
893
|
-
if (type === "clear" /* CLEAR */) {
|
|
893
|
+
if (type === "clear" /* TriggerOpTypes.CLEAR */) {
|
|
894
894
|
// collection being cleared
|
|
895
895
|
// trigger all effects for target
|
|
896
896
|
deps = [...depsMap.values()];
|
|
@@ -909,7 +909,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
909
909
|
}
|
|
910
910
|
// also run for iteration key on ADD | DELETE | Map.SET
|
|
911
911
|
switch (type) {
|
|
912
|
-
case "add" /* ADD */:
|
|
912
|
+
case "add" /* TriggerOpTypes.ADD */:
|
|
913
913
|
if (!isArray(target)) {
|
|
914
914
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
915
915
|
if (isMap(target)) {
|
|
@@ -921,7 +921,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
921
921
|
deps.push(depsMap.get('length'));
|
|
922
922
|
}
|
|
923
923
|
break;
|
|
924
|
-
case "delete" /* DELETE */:
|
|
924
|
+
case "delete" /* TriggerOpTypes.DELETE */:
|
|
925
925
|
if (!isArray(target)) {
|
|
926
926
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
927
927
|
if (isMap(target)) {
|
|
@@ -929,7 +929,7 @@ function trigger(target, type, key, newValue, oldValue, oldTarget) {
|
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
break;
|
|
932
|
-
case "set" /* SET */:
|
|
932
|
+
case "set" /* TriggerOpTypes.SET */:
|
|
933
933
|
if (isMap(target)) {
|
|
934
934
|
deps.push(depsMap.get(ITERATE_KEY));
|
|
935
935
|
}
|
|
@@ -1013,7 +1013,7 @@ function createArrayInstrumentations() {
|
|
|
1013
1013
|
instrumentations[key] = function (...args) {
|
|
1014
1014
|
const arr = toRaw(this);
|
|
1015
1015
|
for (let i = 0, l = this.length; i < l; i++) {
|
|
1016
|
-
track(arr, "get" /* GET */, i + '');
|
|
1016
|
+
track(arr, "get" /* TrackOpTypes.GET */, i + '');
|
|
1017
1017
|
}
|
|
1018
1018
|
// we run the method using the original args first (which may be reactive)
|
|
1019
1019
|
const res = arr[key](...args);
|
|
@@ -1038,16 +1038,16 @@ function createArrayInstrumentations() {
|
|
|
1038
1038
|
}
|
|
1039
1039
|
function createGetter(isReadonly = false, shallow = false) {
|
|
1040
1040
|
return function get(target, key, receiver) {
|
|
1041
|
-
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
|
1041
|
+
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
1042
1042
|
return !isReadonly;
|
|
1043
1043
|
}
|
|
1044
|
-
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
|
1044
|
+
else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
|
|
1045
1045
|
return isReadonly;
|
|
1046
1046
|
}
|
|
1047
|
-
else if (key === "__v_isShallow" /* IS_SHALLOW */) {
|
|
1047
|
+
else if (key === "__v_isShallow" /* ReactiveFlags.IS_SHALLOW */) {
|
|
1048
1048
|
return shallow;
|
|
1049
1049
|
}
|
|
1050
|
-
else if (key === "__v_raw" /* RAW */ &&
|
|
1050
|
+
else if (key === "__v_raw" /* ReactiveFlags.RAW */ &&
|
|
1051
1051
|
receiver ===
|
|
1052
1052
|
(isReadonly
|
|
1053
1053
|
? shallow
|
|
@@ -1067,7 +1067,7 @@ function createGetter(isReadonly = false, shallow = false) {
|
|
|
1067
1067
|
return res;
|
|
1068
1068
|
}
|
|
1069
1069
|
if (!isReadonly) {
|
|
1070
|
-
track(target, "get" /* GET */, key);
|
|
1070
|
+
track(target, "get" /* TrackOpTypes.GET */, key);
|
|
1071
1071
|
}
|
|
1072
1072
|
if (shallow) {
|
|
1073
1073
|
return res;
|
|
@@ -1093,10 +1093,10 @@ function createSetter(shallow = false) {
|
|
|
1093
1093
|
if (isReadonly(oldValue) && isRef(oldValue) && !isRef(value)) {
|
|
1094
1094
|
return false;
|
|
1095
1095
|
}
|
|
1096
|
-
if (!shallow
|
|
1097
|
-
if (!isShallow$1(value)) {
|
|
1098
|
-
value = toRaw(value);
|
|
1096
|
+
if (!shallow) {
|
|
1097
|
+
if (!isShallow$1(value) && !isReadonly(value)) {
|
|
1099
1098
|
oldValue = toRaw(oldValue);
|
|
1099
|
+
value = toRaw(value);
|
|
1100
1100
|
}
|
|
1101
1101
|
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
|
|
1102
1102
|
oldValue.value = value;
|
|
@@ -1110,10 +1110,10 @@ function createSetter(shallow = false) {
|
|
|
1110
1110
|
// don't trigger if target is something up in the prototype chain of original
|
|
1111
1111
|
if (target === toRaw(receiver)) {
|
|
1112
1112
|
if (!hadKey) {
|
|
1113
|
-
trigger(target, "add" /* ADD */, key, value);
|
|
1113
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
|
|
1114
1114
|
}
|
|
1115
1115
|
else if (hasChanged(value, oldValue)) {
|
|
1116
|
-
trigger(target, "set" /* SET */, key, value, oldValue);
|
|
1116
|
+
trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
|
|
1117
1117
|
}
|
|
1118
1118
|
}
|
|
1119
1119
|
return result;
|
|
@@ -1124,19 +1124,19 @@ function deleteProperty(target, key) {
|
|
|
1124
1124
|
const oldValue = target[key];
|
|
1125
1125
|
const result = Reflect.deleteProperty(target, key);
|
|
1126
1126
|
if (result && hadKey) {
|
|
1127
|
-
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
|
1127
|
+
trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
|
|
1128
1128
|
}
|
|
1129
1129
|
return result;
|
|
1130
1130
|
}
|
|
1131
1131
|
function has(target, key) {
|
|
1132
1132
|
const result = Reflect.has(target, key);
|
|
1133
1133
|
if (!isSymbol(key) || !builtInSymbols.has(key)) {
|
|
1134
|
-
track(target, "has" /* HAS */, key);
|
|
1134
|
+
track(target, "has" /* TrackOpTypes.HAS */, key);
|
|
1135
1135
|
}
|
|
1136
1136
|
return result;
|
|
1137
1137
|
}
|
|
1138
1138
|
function ownKeys(target) {
|
|
1139
|
-
track(target, "iterate" /* ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
|
1139
|
+
track(target, "iterate" /* TrackOpTypes.ITERATE */, isArray(target) ? 'length' : ITERATE_KEY);
|
|
1140
1140
|
return Reflect.ownKeys(target);
|
|
1141
1141
|
}
|
|
1142
1142
|
const mutableHandlers = {
|
|
@@ -1177,14 +1177,14 @@ const getProto = (v) => Reflect.getPrototypeOf(v);
|
|
|
1177
1177
|
function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
1178
1178
|
// #1772: readonly(reactive(Map)) should return readonly + reactive version
|
|
1179
1179
|
// of the value
|
|
1180
|
-
target = target["__v_raw" /* RAW */];
|
|
1180
|
+
target = target["__v_raw" /* ReactiveFlags.RAW */];
|
|
1181
1181
|
const rawTarget = toRaw(target);
|
|
1182
1182
|
const rawKey = toRaw(key);
|
|
1183
1183
|
if (!isReadonly) {
|
|
1184
1184
|
if (key !== rawKey) {
|
|
1185
|
-
track(rawTarget, "get" /* GET */, key);
|
|
1185
|
+
track(rawTarget, "get" /* TrackOpTypes.GET */, key);
|
|
1186
1186
|
}
|
|
1187
|
-
track(rawTarget, "get" /* GET */, rawKey);
|
|
1187
|
+
track(rawTarget, "get" /* TrackOpTypes.GET */, rawKey);
|
|
1188
1188
|
}
|
|
1189
1189
|
const { has } = getProto(rawTarget);
|
|
1190
1190
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
@@ -1201,22 +1201,22 @@ function get$1(target, key, isReadonly = false, isShallow = false) {
|
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
1203
1203
|
function has$1(key, isReadonly = false) {
|
|
1204
|
-
const target = this["__v_raw" /* RAW */];
|
|
1204
|
+
const target = this["__v_raw" /* ReactiveFlags.RAW */];
|
|
1205
1205
|
const rawTarget = toRaw(target);
|
|
1206
1206
|
const rawKey = toRaw(key);
|
|
1207
1207
|
if (!isReadonly) {
|
|
1208
1208
|
if (key !== rawKey) {
|
|
1209
|
-
track(rawTarget, "has" /* HAS */, key);
|
|
1209
|
+
track(rawTarget, "has" /* TrackOpTypes.HAS */, key);
|
|
1210
1210
|
}
|
|
1211
|
-
track(rawTarget, "has" /* HAS */, rawKey);
|
|
1211
|
+
track(rawTarget, "has" /* TrackOpTypes.HAS */, rawKey);
|
|
1212
1212
|
}
|
|
1213
1213
|
return key === rawKey
|
|
1214
1214
|
? target.has(key)
|
|
1215
1215
|
: target.has(key) || target.has(rawKey);
|
|
1216
1216
|
}
|
|
1217
1217
|
function size(target, isReadonly = false) {
|
|
1218
|
-
target = target["__v_raw" /* RAW */];
|
|
1219
|
-
!isReadonly && track(toRaw(target), "iterate" /* ITERATE */, ITERATE_KEY);
|
|
1218
|
+
target = target["__v_raw" /* ReactiveFlags.RAW */];
|
|
1219
|
+
!isReadonly && track(toRaw(target), "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
|
|
1220
1220
|
return Reflect.get(target, 'size', target);
|
|
1221
1221
|
}
|
|
1222
1222
|
function add(value) {
|
|
@@ -1226,7 +1226,7 @@ function add(value) {
|
|
|
1226
1226
|
const hadKey = proto.has.call(target, value);
|
|
1227
1227
|
if (!hadKey) {
|
|
1228
1228
|
target.add(value);
|
|
1229
|
-
trigger(target, "add" /* ADD */, value, value);
|
|
1229
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, value, value);
|
|
1230
1230
|
}
|
|
1231
1231
|
return this;
|
|
1232
1232
|
}
|
|
@@ -1245,10 +1245,10 @@ function set$1(key, value) {
|
|
|
1245
1245
|
const oldValue = get.call(target, key);
|
|
1246
1246
|
target.set(key, value);
|
|
1247
1247
|
if (!hadKey) {
|
|
1248
|
-
trigger(target, "add" /* ADD */, key, value);
|
|
1248
|
+
trigger(target, "add" /* TriggerOpTypes.ADD */, key, value);
|
|
1249
1249
|
}
|
|
1250
1250
|
else if (hasChanged(value, oldValue)) {
|
|
1251
|
-
trigger(target, "set" /* SET */, key, value, oldValue);
|
|
1251
|
+
trigger(target, "set" /* TriggerOpTypes.SET */, key, value, oldValue);
|
|
1252
1252
|
}
|
|
1253
1253
|
return this;
|
|
1254
1254
|
}
|
|
@@ -1267,7 +1267,7 @@ function deleteEntry(key) {
|
|
|
1267
1267
|
// forward the operation before queueing reactions
|
|
1268
1268
|
const result = target.delete(key);
|
|
1269
1269
|
if (hadKey) {
|
|
1270
|
-
trigger(target, "delete" /* DELETE */, key, undefined, oldValue);
|
|
1270
|
+
trigger(target, "delete" /* TriggerOpTypes.DELETE */, key, undefined, oldValue);
|
|
1271
1271
|
}
|
|
1272
1272
|
return result;
|
|
1273
1273
|
}
|
|
@@ -1282,17 +1282,17 @@ function clear() {
|
|
|
1282
1282
|
// forward the operation before queueing reactions
|
|
1283
1283
|
const result = target.clear();
|
|
1284
1284
|
if (hadItems) {
|
|
1285
|
-
trigger(target, "clear" /* CLEAR */, undefined, undefined, oldTarget);
|
|
1285
|
+
trigger(target, "clear" /* TriggerOpTypes.CLEAR */, undefined, undefined, oldTarget);
|
|
1286
1286
|
}
|
|
1287
1287
|
return result;
|
|
1288
1288
|
}
|
|
1289
1289
|
function createForEach(isReadonly, isShallow) {
|
|
1290
1290
|
return function forEach(callback, thisArg) {
|
|
1291
1291
|
const observed = this;
|
|
1292
|
-
const target = observed["__v_raw" /* RAW */];
|
|
1292
|
+
const target = observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
1293
1293
|
const rawTarget = toRaw(target);
|
|
1294
1294
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
1295
|
-
!isReadonly && track(rawTarget, "iterate" /* ITERATE */, ITERATE_KEY);
|
|
1295
|
+
!isReadonly && track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, ITERATE_KEY);
|
|
1296
1296
|
return target.forEach((value, key) => {
|
|
1297
1297
|
// important: make sure the callback is
|
|
1298
1298
|
// 1. invoked with the reactive map as `this` and 3rd arg
|
|
@@ -1303,7 +1303,7 @@ function createForEach(isReadonly, isShallow) {
|
|
|
1303
1303
|
}
|
|
1304
1304
|
function createIterableMethod(method, isReadonly, isShallow) {
|
|
1305
1305
|
return function (...args) {
|
|
1306
|
-
const target = this["__v_raw" /* RAW */];
|
|
1306
|
+
const target = this["__v_raw" /* ReactiveFlags.RAW */];
|
|
1307
1307
|
const rawTarget = toRaw(target);
|
|
1308
1308
|
const targetIsMap = isMap(rawTarget);
|
|
1309
1309
|
const isPair = method === 'entries' || (method === Symbol.iterator && targetIsMap);
|
|
@@ -1311,7 +1311,7 @@ function createIterableMethod(method, isReadonly, isShallow) {
|
|
|
1311
1311
|
const innerIterator = target[method](...args);
|
|
1312
1312
|
const wrap = isShallow ? toShallow : isReadonly ? toReadonly : toReactive;
|
|
1313
1313
|
!isReadonly &&
|
|
1314
|
-
track(rawTarget, "iterate" /* ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
1314
|
+
track(rawTarget, "iterate" /* TrackOpTypes.ITERATE */, isKeyOnly ? MAP_KEY_ITERATE_KEY : ITERATE_KEY);
|
|
1315
1315
|
// return a wrapped iterator which returns observed versions of the
|
|
1316
1316
|
// values emitted from the real iterator
|
|
1317
1317
|
return {
|
|
@@ -1338,7 +1338,7 @@ function createReadonlyMethod(type) {
|
|
|
1338
1338
|
const key = args[0] ? `on key "${args[0]}" ` : ``;
|
|
1339
1339
|
console.warn(`${capitalize(type)} operation ${key}failed: target is readonly.`, toRaw(this));
|
|
1340
1340
|
}
|
|
1341
|
-
return type === "delete" /* DELETE */ ? false : this;
|
|
1341
|
+
return type === "delete" /* TriggerOpTypes.DELETE */ ? false : this;
|
|
1342
1342
|
};
|
|
1343
1343
|
}
|
|
1344
1344
|
function createInstrumentations() {
|
|
@@ -1380,10 +1380,10 @@ function createInstrumentations() {
|
|
|
1380
1380
|
has(key) {
|
|
1381
1381
|
return has$1.call(this, key, true);
|
|
1382
1382
|
},
|
|
1383
|
-
add: createReadonlyMethod("add" /* ADD */),
|
|
1384
|
-
set: createReadonlyMethod("set" /* SET */),
|
|
1385
|
-
delete: createReadonlyMethod("delete" /* DELETE */),
|
|
1386
|
-
clear: createReadonlyMethod("clear" /* CLEAR */),
|
|
1383
|
+
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
1384
|
+
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
1385
|
+
delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
|
|
1386
|
+
clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
|
|
1387
1387
|
forEach: createForEach(true, false)
|
|
1388
1388
|
};
|
|
1389
1389
|
const shallowReadonlyInstrumentations = {
|
|
@@ -1396,10 +1396,10 @@ function createInstrumentations() {
|
|
|
1396
1396
|
has(key) {
|
|
1397
1397
|
return has$1.call(this, key, true);
|
|
1398
1398
|
},
|
|
1399
|
-
add: createReadonlyMethod("add" /* ADD */),
|
|
1400
|
-
set: createReadonlyMethod("set" /* SET */),
|
|
1401
|
-
delete: createReadonlyMethod("delete" /* DELETE */),
|
|
1402
|
-
clear: createReadonlyMethod("clear" /* CLEAR */),
|
|
1399
|
+
add: createReadonlyMethod("add" /* TriggerOpTypes.ADD */),
|
|
1400
|
+
set: createReadonlyMethod("set" /* TriggerOpTypes.SET */),
|
|
1401
|
+
delete: createReadonlyMethod("delete" /* TriggerOpTypes.DELETE */),
|
|
1402
|
+
clear: createReadonlyMethod("clear" /* TriggerOpTypes.CLEAR */),
|
|
1403
1403
|
forEach: createForEach(true, true)
|
|
1404
1404
|
};
|
|
1405
1405
|
const iteratorMethods = ['keys', 'values', 'entries', Symbol.iterator];
|
|
@@ -1426,13 +1426,13 @@ function createInstrumentationGetter(isReadonly, shallow) {
|
|
|
1426
1426
|
? readonlyInstrumentations
|
|
1427
1427
|
: mutableInstrumentations;
|
|
1428
1428
|
return (target, key, receiver) => {
|
|
1429
|
-
if (key === "__v_isReactive" /* IS_REACTIVE */) {
|
|
1429
|
+
if (key === "__v_isReactive" /* ReactiveFlags.IS_REACTIVE */) {
|
|
1430
1430
|
return !isReadonly;
|
|
1431
1431
|
}
|
|
1432
|
-
else if (key === "__v_isReadonly" /* IS_READONLY */) {
|
|
1432
|
+
else if (key === "__v_isReadonly" /* ReactiveFlags.IS_READONLY */) {
|
|
1433
1433
|
return isReadonly;
|
|
1434
1434
|
}
|
|
1435
|
-
else if (key === "__v_raw" /* RAW */) {
|
|
1435
|
+
else if (key === "__v_raw" /* ReactiveFlags.RAW */) {
|
|
1436
1436
|
return target;
|
|
1437
1437
|
}
|
|
1438
1438
|
return Reflect.get(hasOwn(instrumentations, key) && key in target
|
|
@@ -1472,19 +1472,19 @@ function targetTypeMap(rawType) {
|
|
|
1472
1472
|
switch (rawType) {
|
|
1473
1473
|
case 'Object':
|
|
1474
1474
|
case 'Array':
|
|
1475
|
-
return 1 /* COMMON */;
|
|
1475
|
+
return 1 /* TargetType.COMMON */;
|
|
1476
1476
|
case 'Map':
|
|
1477
1477
|
case 'Set':
|
|
1478
1478
|
case 'WeakMap':
|
|
1479
1479
|
case 'WeakSet':
|
|
1480
|
-
return 2 /* COLLECTION */;
|
|
1480
|
+
return 2 /* TargetType.COLLECTION */;
|
|
1481
1481
|
default:
|
|
1482
|
-
return 0 /* INVALID */;
|
|
1482
|
+
return 0 /* TargetType.INVALID */;
|
|
1483
1483
|
}
|
|
1484
1484
|
}
|
|
1485
1485
|
function getTargetType(value) {
|
|
1486
|
-
return value["__v_skip" /* SKIP */] || !Object.isExtensible(value)
|
|
1487
|
-
? 0 /* INVALID */
|
|
1486
|
+
return value["__v_skip" /* ReactiveFlags.SKIP */] || !Object.isExtensible(value)
|
|
1487
|
+
? 0 /* TargetType.INVALID */
|
|
1488
1488
|
: targetTypeMap(toRawType(value));
|
|
1489
1489
|
}
|
|
1490
1490
|
function reactive(target) {
|
|
@@ -1527,8 +1527,8 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1527
1527
|
}
|
|
1528
1528
|
// target is already a Proxy, return it.
|
|
1529
1529
|
// exception: calling readonly() on a reactive object
|
|
1530
|
-
if (target["__v_raw" /* RAW */] &&
|
|
1531
|
-
!(isReadonly && target["__v_isReactive" /* IS_REACTIVE */])) {
|
|
1530
|
+
if (target["__v_raw" /* ReactiveFlags.RAW */] &&
|
|
1531
|
+
!(isReadonly && target["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */])) {
|
|
1532
1532
|
return target;
|
|
1533
1533
|
}
|
|
1534
1534
|
// target already has corresponding Proxy
|
|
@@ -1538,34 +1538,34 @@ function createReactiveObject(target, isReadonly, baseHandlers, collectionHandle
|
|
|
1538
1538
|
}
|
|
1539
1539
|
// only specific value types can be observed.
|
|
1540
1540
|
const targetType = getTargetType(target);
|
|
1541
|
-
if (targetType === 0 /* INVALID */) {
|
|
1541
|
+
if (targetType === 0 /* TargetType.INVALID */) {
|
|
1542
1542
|
return target;
|
|
1543
1543
|
}
|
|
1544
|
-
const proxy = new Proxy(target, targetType === 2 /* COLLECTION */ ? collectionHandlers : baseHandlers);
|
|
1544
|
+
const proxy = new Proxy(target, targetType === 2 /* TargetType.COLLECTION */ ? collectionHandlers : baseHandlers);
|
|
1545
1545
|
proxyMap.set(target, proxy);
|
|
1546
1546
|
return proxy;
|
|
1547
1547
|
}
|
|
1548
1548
|
function isReactive(value) {
|
|
1549
1549
|
if (isReadonly(value)) {
|
|
1550
|
-
return isReactive(value["__v_raw" /* RAW */]);
|
|
1550
|
+
return isReactive(value["__v_raw" /* ReactiveFlags.RAW */]);
|
|
1551
1551
|
}
|
|
1552
|
-
return !!(value && value["__v_isReactive" /* IS_REACTIVE */]);
|
|
1552
|
+
return !!(value && value["__v_isReactive" /* ReactiveFlags.IS_REACTIVE */]);
|
|
1553
1553
|
}
|
|
1554
1554
|
function isReadonly(value) {
|
|
1555
|
-
return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
|
|
1555
|
+
return !!(value && value["__v_isReadonly" /* ReactiveFlags.IS_READONLY */]);
|
|
1556
1556
|
}
|
|
1557
1557
|
function isShallow$1(value) {
|
|
1558
|
-
return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
|
|
1558
|
+
return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
|
|
1559
1559
|
}
|
|
1560
1560
|
function isProxy(value) {
|
|
1561
1561
|
return isReactive(value) || isReadonly(value);
|
|
1562
1562
|
}
|
|
1563
1563
|
function toRaw(observed) {
|
|
1564
|
-
const raw = observed && observed["__v_raw" /* RAW */];
|
|
1564
|
+
const raw = observed && observed["__v_raw" /* ReactiveFlags.RAW */];
|
|
1565
1565
|
return raw ? toRaw(raw) : observed;
|
|
1566
1566
|
}
|
|
1567
1567
|
function markRaw(value) {
|
|
1568
|
-
def(value, "__v_skip" /* SKIP */, true);
|
|
1568
|
+
def(value, "__v_skip" /* ReactiveFlags.SKIP */, true);
|
|
1569
1569
|
return value;
|
|
1570
1570
|
}
|
|
1571
1571
|
const toReactive = (value) => isObject(value) ? reactive(value) : value;
|
|
@@ -1577,7 +1577,7 @@ function trackRefValue(ref) {
|
|
|
1577
1577
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
1578
1578
|
trackEffects(ref.dep || (ref.dep = createDep()), {
|
|
1579
1579
|
target: ref,
|
|
1580
|
-
type: "get" /* GET */,
|
|
1580
|
+
type: "get" /* TrackOpTypes.GET */,
|
|
1581
1581
|
key: 'value'
|
|
1582
1582
|
});
|
|
1583
1583
|
}
|
|
@@ -1592,7 +1592,7 @@ function triggerRefValue(ref, newVal) {
|
|
|
1592
1592
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
1593
1593
|
triggerEffects(ref.dep, {
|
|
1594
1594
|
target: ref,
|
|
1595
|
-
type: "set" /* SET */,
|
|
1595
|
+
type: "set" /* TriggerOpTypes.SET */,
|
|
1596
1596
|
key: 'value',
|
|
1597
1597
|
newValue: newVal
|
|
1598
1598
|
});
|
|
@@ -1630,10 +1630,11 @@ class RefImpl {
|
|
|
1630
1630
|
return this._value;
|
|
1631
1631
|
}
|
|
1632
1632
|
set value(newVal) {
|
|
1633
|
-
|
|
1633
|
+
const useDirectValue = this.__v_isShallow || isShallow$1(newVal) || isReadonly(newVal);
|
|
1634
|
+
newVal = useDirectValue ? newVal : toRaw(newVal);
|
|
1634
1635
|
if (hasChanged(newVal, this._rawValue)) {
|
|
1635
1636
|
this._rawValue = newVal;
|
|
1636
|
-
this._value =
|
|
1637
|
+
this._value = useDirectValue ? newVal : toReactive(newVal);
|
|
1637
1638
|
triggerRefValue(this, newVal);
|
|
1638
1639
|
}
|
|
1639
1640
|
}
|
|
@@ -1712,11 +1713,13 @@ function toRef(object, key, defaultValue) {
|
|
|
1712
1713
|
: new ObjectRefImpl(object, key, defaultValue);
|
|
1713
1714
|
}
|
|
1714
1715
|
|
|
1716
|
+
var _a;
|
|
1715
1717
|
class ComputedRefImpl {
|
|
1716
1718
|
constructor(getter, _setter, isReadonly, isSSR) {
|
|
1717
1719
|
this._setter = _setter;
|
|
1718
1720
|
this.dep = undefined;
|
|
1719
1721
|
this.__v_isRef = true;
|
|
1722
|
+
this[_a] = false;
|
|
1720
1723
|
this._dirty = true;
|
|
1721
1724
|
this.effect = new ReactiveEffect(getter, () => {
|
|
1722
1725
|
if (!this._dirty) {
|
|
@@ -1726,7 +1729,7 @@ class ComputedRefImpl {
|
|
|
1726
1729
|
});
|
|
1727
1730
|
this.effect.computed = this;
|
|
1728
1731
|
this.effect.active = this._cacheable = !isSSR;
|
|
1729
|
-
this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
|
|
1732
|
+
this["__v_isReadonly" /* ReactiveFlags.IS_READONLY */] = isReadonly;
|
|
1730
1733
|
}
|
|
1731
1734
|
get value() {
|
|
1732
1735
|
// the computed ref may get wrapped by other proxies e.g. readonly() #3376
|
|
@@ -1742,6 +1745,7 @@ class ComputedRefImpl {
|
|
|
1742
1745
|
this._setter(newValue);
|
|
1743
1746
|
}
|
|
1744
1747
|
}
|
|
1748
|
+
_a = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
|
|
1745
1749
|
function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
1746
1750
|
let getter;
|
|
1747
1751
|
let setter;
|
|
@@ -1766,7 +1770,7 @@ function computed$1(getterOrOptions, debugOptions, isSSR = false) {
|
|
|
1766
1770
|
return cRef;
|
|
1767
1771
|
}
|
|
1768
1772
|
|
|
1769
|
-
var _a;
|
|
1773
|
+
var _a$1;
|
|
1770
1774
|
const tick = /*#__PURE__*/ Promise.resolve();
|
|
1771
1775
|
const queue$1 = [];
|
|
1772
1776
|
let queued = false;
|
|
@@ -1789,7 +1793,7 @@ class DeferredComputedRefImpl {
|
|
|
1789
1793
|
this.dep = undefined;
|
|
1790
1794
|
this._dirty = true;
|
|
1791
1795
|
this.__v_isRef = true;
|
|
1792
|
-
this[_a] = true;
|
|
1796
|
+
this[_a$1] = true;
|
|
1793
1797
|
let compareTarget;
|
|
1794
1798
|
let hasCompareTarget = false;
|
|
1795
1799
|
let scheduled = false;
|
|
@@ -1836,7 +1840,7 @@ class DeferredComputedRefImpl {
|
|
|
1836
1840
|
return toRaw(this)._get();
|
|
1837
1841
|
}
|
|
1838
1842
|
}
|
|
1839
|
-
_a = "__v_isReadonly" /* IS_READONLY */;
|
|
1843
|
+
_a$1 = "__v_isReadonly" /* ReactiveFlags.IS_READONLY */;
|
|
1840
1844
|
function deferredComputed(getter) {
|
|
1841
1845
|
return new DeferredComputedRefImpl(getter);
|
|
1842
1846
|
}
|
|
@@ -1856,7 +1860,7 @@ function warn(msg, ...args) {
|
|
|
1856
1860
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
1857
1861
|
const trace = getComponentTrace();
|
|
1858
1862
|
if (appWarnHandler) {
|
|
1859
|
-
callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
|
|
1863
|
+
callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
|
|
1860
1864
|
msg + args.join(''),
|
|
1861
1865
|
instance && instance.proxy,
|
|
1862
1866
|
trace
|
|
@@ -1956,35 +1960,35 @@ function formatProp(key, value, raw) {
|
|
|
1956
1960
|
}
|
|
1957
1961
|
|
|
1958
1962
|
const ErrorTypeStrings = {
|
|
1959
|
-
["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
1960
|
-
["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
|
|
1961
|
-
["c" /* CREATED */]: 'created hook',
|
|
1962
|
-
["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
|
|
1963
|
-
["m" /* MOUNTED */]: 'mounted hook',
|
|
1964
|
-
["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
1965
|
-
["u" /* UPDATED */]: 'updated',
|
|
1966
|
-
["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
1967
|
-
["um" /* UNMOUNTED */]: 'unmounted hook',
|
|
1968
|
-
["a" /* ACTIVATED */]: 'activated hook',
|
|
1969
|
-
["da" /* DEACTIVATED */]: 'deactivated hook',
|
|
1970
|
-
["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
1971
|
-
["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
|
|
1972
|
-
["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
1973
|
-
[0 /* SETUP_FUNCTION */]: 'setup function',
|
|
1974
|
-
[1 /* RENDER_FUNCTION */]: 'render function',
|
|
1975
|
-
[2 /* WATCH_GETTER */]: 'watcher getter',
|
|
1976
|
-
[3 /* WATCH_CALLBACK */]: 'watcher callback',
|
|
1977
|
-
[4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
1978
|
-
[5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
1979
|
-
[6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
1980
|
-
[7 /* VNODE_HOOK */]: 'vnode hook',
|
|
1981
|
-
[8 /* DIRECTIVE_HOOK */]: 'directive hook',
|
|
1982
|
-
[9 /* TRANSITION_HOOK */]: 'transition hook',
|
|
1983
|
-
[10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
1984
|
-
[11 /* APP_WARN_HANDLER */]: 'app warnHandler',
|
|
1985
|
-
[12 /* FUNCTION_REF */]: 'ref function',
|
|
1986
|
-
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
1987
|
-
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
1963
|
+
["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
1964
|
+
["bc" /* LifecycleHooks.BEFORE_CREATE */]: 'beforeCreate hook',
|
|
1965
|
+
["c" /* LifecycleHooks.CREATED */]: 'created hook',
|
|
1966
|
+
["bm" /* LifecycleHooks.BEFORE_MOUNT */]: 'beforeMount hook',
|
|
1967
|
+
["m" /* LifecycleHooks.MOUNTED */]: 'mounted hook',
|
|
1968
|
+
["bu" /* LifecycleHooks.BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
1969
|
+
["u" /* LifecycleHooks.UPDATED */]: 'updated',
|
|
1970
|
+
["bum" /* LifecycleHooks.BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
1971
|
+
["um" /* LifecycleHooks.UNMOUNTED */]: 'unmounted hook',
|
|
1972
|
+
["a" /* LifecycleHooks.ACTIVATED */]: 'activated hook',
|
|
1973
|
+
["da" /* LifecycleHooks.DEACTIVATED */]: 'deactivated hook',
|
|
1974
|
+
["ec" /* LifecycleHooks.ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
1975
|
+
["rtc" /* LifecycleHooks.RENDER_TRACKED */]: 'renderTracked hook',
|
|
1976
|
+
["rtg" /* LifecycleHooks.RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
1977
|
+
[0 /* ErrorCodes.SETUP_FUNCTION */]: 'setup function',
|
|
1978
|
+
[1 /* ErrorCodes.RENDER_FUNCTION */]: 'render function',
|
|
1979
|
+
[2 /* ErrorCodes.WATCH_GETTER */]: 'watcher getter',
|
|
1980
|
+
[3 /* ErrorCodes.WATCH_CALLBACK */]: 'watcher callback',
|
|
1981
|
+
[4 /* ErrorCodes.WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
1982
|
+
[5 /* ErrorCodes.NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
1983
|
+
[6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
1984
|
+
[7 /* ErrorCodes.VNODE_HOOK */]: 'vnode hook',
|
|
1985
|
+
[8 /* ErrorCodes.DIRECTIVE_HOOK */]: 'directive hook',
|
|
1986
|
+
[9 /* ErrorCodes.TRANSITION_HOOK */]: 'transition hook',
|
|
1987
|
+
[10 /* ErrorCodes.APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
1988
|
+
[11 /* ErrorCodes.APP_WARN_HANDLER */]: 'app warnHandler',
|
|
1989
|
+
[12 /* ErrorCodes.FUNCTION_REF */]: 'ref function',
|
|
1990
|
+
[13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
1991
|
+
[14 /* ErrorCodes.SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
1988
1992
|
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
|
|
1989
1993
|
};
|
|
1990
1994
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
@@ -2035,7 +2039,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
2035
2039
|
// app-level handling
|
|
2036
2040
|
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
2037
2041
|
if (appErrorHandler) {
|
|
2038
|
-
callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
2042
|
+
callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
2039
2043
|
return;
|
|
2040
2044
|
}
|
|
2041
2045
|
}
|
|
@@ -2069,15 +2073,11 @@ let isFlushing = false;
|
|
|
2069
2073
|
let isFlushPending = false;
|
|
2070
2074
|
const queue = [];
|
|
2071
2075
|
let flushIndex = 0;
|
|
2072
|
-
const pendingPreFlushCbs = [];
|
|
2073
|
-
let activePreFlushCbs = null;
|
|
2074
|
-
let preFlushIndex = 0;
|
|
2075
2076
|
const pendingPostFlushCbs = [];
|
|
2076
2077
|
let activePostFlushCbs = null;
|
|
2077
2078
|
let postFlushIndex = 0;
|
|
2078
2079
|
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
2079
2080
|
let currentFlushPromise = null;
|
|
2080
|
-
let currentPreFlushParentJob = null;
|
|
2081
2081
|
const RECURSION_LIMIT = 100;
|
|
2082
2082
|
function nextTick(fn) {
|
|
2083
2083
|
const p = currentFlushPromise || resolvedPromise;
|
|
@@ -2105,9 +2105,8 @@ function queueJob(job) {
|
|
|
2105
2105
|
// if the job is a watch() callback, the search will start with a +1 index to
|
|
2106
2106
|
// allow it recursively trigger itself - it is the user's responsibility to
|
|
2107
2107
|
// ensure it doesn't end up in an infinite loop.
|
|
2108
|
-
if (
|
|
2109
|
-
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex))
|
|
2110
|
-
job !== currentPreFlushParentJob) {
|
|
2108
|
+
if (!queue.length ||
|
|
2109
|
+
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
|
|
2111
2110
|
if (job.id == null) {
|
|
2112
2111
|
queue.push(job);
|
|
2113
2112
|
}
|
|
@@ -2129,52 +2128,40 @@ function invalidateJob(job) {
|
|
|
2129
2128
|
queue.splice(i, 1);
|
|
2130
2129
|
}
|
|
2131
2130
|
}
|
|
2132
|
-
function
|
|
2131
|
+
function queuePostFlushCb(cb) {
|
|
2133
2132
|
if (!isArray(cb)) {
|
|
2134
|
-
if (!
|
|
2135
|
-
!
|
|
2136
|
-
|
|
2133
|
+
if (!activePostFlushCbs ||
|
|
2134
|
+
!activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
|
|
2135
|
+
pendingPostFlushCbs.push(cb);
|
|
2137
2136
|
}
|
|
2138
2137
|
}
|
|
2139
2138
|
else {
|
|
2140
2139
|
// if cb is an array, it is a component lifecycle hook which can only be
|
|
2141
2140
|
// triggered by a job, which is already deduped in the main queue, so
|
|
2142
2141
|
// we can skip duplicate check here to improve perf
|
|
2143
|
-
|
|
2142
|
+
pendingPostFlushCbs.push(...cb);
|
|
2144
2143
|
}
|
|
2145
2144
|
queueFlush();
|
|
2146
2145
|
}
|
|
2147
|
-
function
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
}
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
pendingPreFlushCbs.length = 0;
|
|
2158
|
-
if ((process.env.NODE_ENV !== 'production')) {
|
|
2159
|
-
seen = seen || new Map();
|
|
2160
|
-
}
|
|
2161
|
-
for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
|
2162
|
-
if ((process.env.NODE_ENV !== 'production') &&
|
|
2163
|
-
checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])) {
|
|
2146
|
+
function flushPreFlushCbs(seen,
|
|
2147
|
+
// if currently flushing, skip the current job itself
|
|
2148
|
+
i = isFlushing ? flushIndex + 1 : 0) {
|
|
2149
|
+
if ((process.env.NODE_ENV !== 'production')) {
|
|
2150
|
+
seen = seen || new Map();
|
|
2151
|
+
}
|
|
2152
|
+
for (; i < queue.length; i++) {
|
|
2153
|
+
const cb = queue[i];
|
|
2154
|
+
if (cb && cb.pre) {
|
|
2155
|
+
if ((process.env.NODE_ENV !== 'production') && checkRecursiveUpdates(seen, cb)) {
|
|
2164
2156
|
continue;
|
|
2165
2157
|
}
|
|
2166
|
-
|
|
2158
|
+
queue.splice(i, 1);
|
|
2159
|
+
i--;
|
|
2160
|
+
cb();
|
|
2167
2161
|
}
|
|
2168
|
-
activePreFlushCbs = null;
|
|
2169
|
-
preFlushIndex = 0;
|
|
2170
|
-
currentPreFlushParentJob = null;
|
|
2171
|
-
// recursively flush until it drains
|
|
2172
|
-
flushPreFlushCbs(seen, parentJob);
|
|
2173
2162
|
}
|
|
2174
2163
|
}
|
|
2175
2164
|
function flushPostFlushCbs(seen) {
|
|
2176
|
-
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
2177
|
-
flushPreFlushCbs();
|
|
2178
2165
|
if (pendingPostFlushCbs.length) {
|
|
2179
2166
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
2180
2167
|
pendingPostFlushCbs.length = 0;
|
|
@@ -2200,13 +2187,22 @@ function flushPostFlushCbs(seen) {
|
|
|
2200
2187
|
}
|
|
2201
2188
|
}
|
|
2202
2189
|
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
2190
|
+
const comparator = (a, b) => {
|
|
2191
|
+
const diff = getId(a) - getId(b);
|
|
2192
|
+
if (diff === 0) {
|
|
2193
|
+
if (a.pre && !b.pre)
|
|
2194
|
+
return -1;
|
|
2195
|
+
if (b.pre && !a.pre)
|
|
2196
|
+
return 1;
|
|
2197
|
+
}
|
|
2198
|
+
return diff;
|
|
2199
|
+
};
|
|
2203
2200
|
function flushJobs(seen) {
|
|
2204
2201
|
isFlushPending = false;
|
|
2205
2202
|
isFlushing = true;
|
|
2206
2203
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
2207
2204
|
seen = seen || new Map();
|
|
2208
2205
|
}
|
|
2209
|
-
flushPreFlushCbs(seen);
|
|
2210
2206
|
// Sort queue before flush.
|
|
2211
2207
|
// This ensures that:
|
|
2212
2208
|
// 1. Components are updated from parent to child. (because parent is always
|
|
@@ -2214,7 +2210,7 @@ function flushJobs(seen) {
|
|
|
2214
2210
|
// priority number)
|
|
2215
2211
|
// 2. If a component is unmounted during a parent component's update,
|
|
2216
2212
|
// its update can be skipped.
|
|
2217
|
-
queue.sort(
|
|
2213
|
+
queue.sort(comparator);
|
|
2218
2214
|
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
2219
2215
|
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
2220
2216
|
// inside try-catch. This can leave all warning code unshaked. Although
|
|
@@ -2231,7 +2227,7 @@ function flushJobs(seen) {
|
|
|
2231
2227
|
continue;
|
|
2232
2228
|
}
|
|
2233
2229
|
// console.log(`running:`, job.id)
|
|
2234
|
-
callWithErrorHandling(job, null, 14 /* SCHEDULER */);
|
|
2230
|
+
callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
|
|
2235
2231
|
}
|
|
2236
2232
|
}
|
|
2237
2233
|
}
|
|
@@ -2243,9 +2239,7 @@ function flushJobs(seen) {
|
|
|
2243
2239
|
currentFlushPromise = null;
|
|
2244
2240
|
// some postFlushCb queued jobs!
|
|
2245
2241
|
// keep flushing until it drains.
|
|
2246
|
-
if (queue.length ||
|
|
2247
|
-
pendingPreFlushCbs.length ||
|
|
2248
|
-
pendingPostFlushCbs.length) {
|
|
2242
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
2249
2243
|
flushJobs(seen);
|
|
2250
2244
|
}
|
|
2251
2245
|
}
|
|
@@ -2463,7 +2457,7 @@ function setDevtoolsHook(hook, target) {
|
|
|
2463
2457
|
}
|
|
2464
2458
|
}
|
|
2465
2459
|
function devtoolsInitApp(app, version) {
|
|
2466
|
-
emit("app:init" /* APP_INIT */, app, version, {
|
|
2460
|
+
emit("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
|
|
2467
2461
|
Fragment,
|
|
2468
2462
|
Text,
|
|
2469
2463
|
Comment,
|
|
@@ -2471,27 +2465,27 @@ function devtoolsInitApp(app, version) {
|
|
|
2471
2465
|
});
|
|
2472
2466
|
}
|
|
2473
2467
|
function devtoolsUnmountApp(app) {
|
|
2474
|
-
emit("app:unmount" /* APP_UNMOUNT */, app);
|
|
2468
|
+
emit("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
|
|
2475
2469
|
}
|
|
2476
|
-
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
|
|
2470
|
+
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* DevtoolsHooks.COMPONENT_ADDED */);
|
|
2477
2471
|
const devtoolsComponentUpdated =
|
|
2478
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
|
|
2472
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* DevtoolsHooks.COMPONENT_UPDATED */);
|
|
2479
2473
|
const devtoolsComponentRemoved =
|
|
2480
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
|
|
2474
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* DevtoolsHooks.COMPONENT_REMOVED */);
|
|
2481
2475
|
function createDevtoolsComponentHook(hook) {
|
|
2482
2476
|
return (component) => {
|
|
2483
2477
|
emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
|
2484
2478
|
};
|
|
2485
2479
|
}
|
|
2486
|
-
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
|
|
2487
|
-
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
|
|
2480
|
+
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* DevtoolsHooks.PERFORMANCE_START */);
|
|
2481
|
+
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* DevtoolsHooks.PERFORMANCE_END */);
|
|
2488
2482
|
function createDevtoolsPerformanceHook(hook) {
|
|
2489
2483
|
return (component, type, time) => {
|
|
2490
2484
|
emit(hook, component.appContext.app, component.uid, component, type, time);
|
|
2491
2485
|
};
|
|
2492
2486
|
}
|
|
2493
2487
|
function devtoolsComponentEmit(component, event, params) {
|
|
2494
|
-
emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
2488
|
+
emit("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
2495
2489
|
}
|
|
2496
2490
|
|
|
2497
2491
|
function emit$1(instance, event, ...rawArgs) {
|
|
@@ -2556,7 +2550,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2556
2550
|
handler = props[(handlerName = toHandlerKey(hyphenate(event)))];
|
|
2557
2551
|
}
|
|
2558
2552
|
if (handler) {
|
|
2559
|
-
callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
2553
|
+
callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
2560
2554
|
}
|
|
2561
2555
|
const onceHandler = props[handlerName + `Once`];
|
|
2562
2556
|
if (onceHandler) {
|
|
@@ -2567,7 +2561,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
2567
2561
|
return;
|
|
2568
2562
|
}
|
|
2569
2563
|
instance.emitted[handlerName] = true;
|
|
2570
|
-
callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
2564
|
+
callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
2571
2565
|
}
|
|
2572
2566
|
}
|
|
2573
2567
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
@@ -2599,7 +2593,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
2599
2593
|
}
|
|
2600
2594
|
}
|
|
2601
2595
|
if (!raw && !hasExtends) {
|
|
2602
|
-
|
|
2596
|
+
if (isObject(comp)) {
|
|
2597
|
+
cache.set(comp, null);
|
|
2598
|
+
}
|
|
2603
2599
|
return null;
|
|
2604
2600
|
}
|
|
2605
2601
|
if (isArray(raw)) {
|
|
@@ -2608,7 +2604,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
2608
2604
|
else {
|
|
2609
2605
|
extend(normalized, raw);
|
|
2610
2606
|
}
|
|
2611
|
-
|
|
2607
|
+
if (isObject(comp)) {
|
|
2608
|
+
cache.set(comp, normalized);
|
|
2609
|
+
}
|
|
2612
2610
|
return normalized;
|
|
2613
2611
|
}
|
|
2614
2612
|
// Check if an incoming prop key is a declared emit event listener.
|
|
@@ -2727,7 +2725,7 @@ function renderComponentRoot(instance) {
|
|
|
2727
2725
|
accessedAttrs = false;
|
|
2728
2726
|
}
|
|
2729
2727
|
try {
|
|
2730
|
-
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
2728
|
+
if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
|
|
2731
2729
|
// withProxy is a proxy with a different `has` trap only for
|
|
2732
2730
|
// runtime-compiled render functions using `with` block.
|
|
2733
2731
|
const proxyToUse = withProxy || proxy;
|
|
@@ -2760,7 +2758,7 @@ function renderComponentRoot(instance) {
|
|
|
2760
2758
|
}
|
|
2761
2759
|
catch (err) {
|
|
2762
2760
|
blockStack.length = 0;
|
|
2763
|
-
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
2761
|
+
handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
|
|
2764
2762
|
result = createVNode(Comment);
|
|
2765
2763
|
}
|
|
2766
2764
|
// attr merging
|
|
@@ -2770,14 +2768,14 @@ function renderComponentRoot(instance) {
|
|
|
2770
2768
|
let setRoot = undefined;
|
|
2771
2769
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
2772
2770
|
result.patchFlag > 0 &&
|
|
2773
|
-
result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
2771
|
+
result.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
2774
2772
|
[root, setRoot] = getChildRoot(result);
|
|
2775
2773
|
}
|
|
2776
2774
|
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
2777
2775
|
const keys = Object.keys(fallthroughAttrs);
|
|
2778
2776
|
const { shapeFlag } = root;
|
|
2779
2777
|
if (keys.length) {
|
|
2780
|
-
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
2778
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
|
|
2781
2779
|
if (propsOptions && keys.some(isModelListener)) {
|
|
2782
2780
|
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
2783
2781
|
// prop, it indicates this component expects to handle v-model and
|
|
@@ -2918,7 +2916,7 @@ const filterModelListeners = (attrs, props) => {
|
|
|
2918
2916
|
return res;
|
|
2919
2917
|
};
|
|
2920
2918
|
const isElementRoot = (vnode) => {
|
|
2921
|
-
return (vnode.shapeFlag & (6 /* COMPONENT */ | 1 /* ELEMENT */) ||
|
|
2919
|
+
return (vnode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 1 /* ShapeFlags.ELEMENT */) ||
|
|
2922
2920
|
vnode.type === Comment // potential v-if branch switch
|
|
2923
2921
|
);
|
|
2924
2922
|
};
|
|
@@ -2937,19 +2935,19 @@ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
|
2937
2935
|
return true;
|
|
2938
2936
|
}
|
|
2939
2937
|
if (optimized && patchFlag >= 0) {
|
|
2940
|
-
if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
|
|
2938
|
+
if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
|
|
2941
2939
|
// slot content that references values that might have changed,
|
|
2942
2940
|
// e.g. in a v-for
|
|
2943
2941
|
return true;
|
|
2944
2942
|
}
|
|
2945
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
2943
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
2946
2944
|
if (!prevProps) {
|
|
2947
2945
|
return !!nextProps;
|
|
2948
2946
|
}
|
|
2949
2947
|
// presence of this flag indicates props are always non-null
|
|
2950
2948
|
return hasPropsChanged(prevProps, nextProps, emits);
|
|
2951
2949
|
}
|
|
2952
|
-
else if (patchFlag & 8 /* PROPS */) {
|
|
2950
|
+
else if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
2953
2951
|
const dynamicProps = nextVNode.dynamicProps;
|
|
2954
2952
|
for (let i = 0; i < dynamicProps.length; i++) {
|
|
2955
2953
|
const key = dynamicProps[i];
|
|
@@ -3207,7 +3205,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
3207
3205
|
if (delayEnter) {
|
|
3208
3206
|
activeBranch.transition.afterLeave = () => {
|
|
3209
3207
|
if (pendingId === suspense.pendingId) {
|
|
3210
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
3208
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
3211
3209
|
}
|
|
3212
3210
|
};
|
|
3213
3211
|
}
|
|
@@ -3222,7 +3220,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
3222
3220
|
}
|
|
3223
3221
|
if (!delayEnter) {
|
|
3224
3222
|
// move content from off-dom container to actual container
|
|
3225
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
3223
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
3226
3224
|
}
|
|
3227
3225
|
}
|
|
3228
3226
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -3296,7 +3294,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
3296
3294
|
const hydratedEl = instance.vnode.el;
|
|
3297
3295
|
instance
|
|
3298
3296
|
.asyncDep.catch(err => {
|
|
3299
|
-
handleError(err, instance, 0 /* SETUP_FUNCTION */);
|
|
3297
|
+
handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
3300
3298
|
})
|
|
3301
3299
|
.then(asyncSetupResult => {
|
|
3302
3300
|
// retry when the setup() promise resolves.
|
|
@@ -3370,7 +3368,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
|
|
|
3370
3368
|
}
|
|
3371
3369
|
function normalizeSuspenseChildren(vnode) {
|
|
3372
3370
|
const { shapeFlag, children } = vnode;
|
|
3373
|
-
const isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */;
|
|
3371
|
+
const isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
3374
3372
|
vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
|
|
3375
3373
|
vnode.ssFallback = isSlotChildren
|
|
3376
3374
|
? normalizeSuspenseSlot(children.fallback)
|
|
@@ -3543,7 +3541,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3543
3541
|
return traverse(s);
|
|
3544
3542
|
}
|
|
3545
3543
|
else if (isFunction(s)) {
|
|
3546
|
-
return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
|
|
3544
|
+
return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
3547
3545
|
}
|
|
3548
3546
|
else {
|
|
3549
3547
|
(process.env.NODE_ENV !== 'production') && warnInvalidSource(s);
|
|
@@ -3553,7 +3551,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3553
3551
|
else if (isFunction(source)) {
|
|
3554
3552
|
if (cb) {
|
|
3555
3553
|
// getter with cb
|
|
3556
|
-
getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
|
|
3554
|
+
getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
3557
3555
|
}
|
|
3558
3556
|
else {
|
|
3559
3557
|
// no cb -> simple effect
|
|
@@ -3564,7 +3562,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3564
3562
|
if (cleanup) {
|
|
3565
3563
|
cleanup();
|
|
3566
3564
|
}
|
|
3567
|
-
return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
|
|
3565
|
+
return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
|
|
3568
3566
|
};
|
|
3569
3567
|
}
|
|
3570
3568
|
}
|
|
@@ -3579,7 +3577,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3579
3577
|
let cleanup;
|
|
3580
3578
|
let onCleanup = (fn) => {
|
|
3581
3579
|
cleanup = effect.onStop = () => {
|
|
3582
|
-
callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
|
|
3580
|
+
callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
|
|
3583
3581
|
};
|
|
3584
3582
|
};
|
|
3585
3583
|
// in SSR there is no need to setup an actual effect, and it should be noop
|
|
@@ -3591,7 +3589,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3591
3589
|
getter();
|
|
3592
3590
|
}
|
|
3593
3591
|
else if (immediate) {
|
|
3594
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
3592
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
3595
3593
|
getter(),
|
|
3596
3594
|
isMultiSource ? [] : undefined,
|
|
3597
3595
|
onCleanup
|
|
@@ -3617,7 +3615,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3617
3615
|
if (cleanup) {
|
|
3618
3616
|
cleanup();
|
|
3619
3617
|
}
|
|
3620
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
3618
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
3621
3619
|
newValue,
|
|
3622
3620
|
// pass undefined as the old value when it's changed for the first time
|
|
3623
3621
|
oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
|
@@ -3643,7 +3641,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
3643
3641
|
}
|
|
3644
3642
|
else {
|
|
3645
3643
|
// default: 'pre'
|
|
3646
|
-
|
|
3644
|
+
job.pre = true;
|
|
3645
|
+
if (instance)
|
|
3646
|
+
job.id = instance.uid;
|
|
3647
|
+
scheduler = () => queueJob(job);
|
|
3647
3648
|
}
|
|
3648
3649
|
const effect = new ReactiveEffect(getter, scheduler);
|
|
3649
3650
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -3710,7 +3711,7 @@ function createPathGetter(ctx, path) {
|
|
|
3710
3711
|
};
|
|
3711
3712
|
}
|
|
3712
3713
|
function traverse(value, seen) {
|
|
3713
|
-
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
3714
|
+
if (!isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
|
|
3714
3715
|
return value;
|
|
3715
3716
|
}
|
|
3716
3717
|
seen = seen || new Set();
|
|
@@ -3897,7 +3898,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
3897
3898
|
const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
|
3898
3899
|
const callHook = (hook, args) => {
|
|
3899
3900
|
hook &&
|
|
3900
|
-
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
3901
|
+
callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
|
|
3901
3902
|
};
|
|
3902
3903
|
const callAsyncHook = (hook, args) => {
|
|
3903
3904
|
const done = args[1];
|
|
@@ -4033,10 +4034,10 @@ function getKeepAliveChild(vnode) {
|
|
|
4033
4034
|
: vnode;
|
|
4034
4035
|
}
|
|
4035
4036
|
function setTransitionHooks(vnode, hooks) {
|
|
4036
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
|
|
4037
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
|
|
4037
4038
|
setTransitionHooks(vnode.component.subTree, hooks);
|
|
4038
4039
|
}
|
|
4039
|
-
else if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
4040
|
+
else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4040
4041
|
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
4041
4042
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
4042
4043
|
}
|
|
@@ -4055,7 +4056,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
4055
4056
|
: String(parentKey) + String(child.key != null ? child.key : i);
|
|
4056
4057
|
// handle fragment children case, e.g. v-for
|
|
4057
4058
|
if (child.type === Fragment) {
|
|
4058
|
-
if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
|
|
4059
|
+
if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */)
|
|
4059
4060
|
keyedFragmentCount++;
|
|
4060
4061
|
ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
|
|
4061
4062
|
}
|
|
@@ -4070,7 +4071,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
4070
4071
|
// these children to force full diffs to ensure correct behavior.
|
|
4071
4072
|
if (keyedFragmentCount > 1) {
|
|
4072
4073
|
for (let i = 0; i < ret.length; i++) {
|
|
4073
|
-
ret[i].patchFlag = -2 /* BAIL */;
|
|
4074
|
+
ret[i].patchFlag = -2 /* PatchFlags.BAIL */;
|
|
4074
4075
|
}
|
|
4075
4076
|
}
|
|
4076
4077
|
return ret;
|
|
@@ -4148,7 +4149,7 @@ function defineAsyncComponent(source) {
|
|
|
4148
4149
|
}
|
|
4149
4150
|
const onError = (err) => {
|
|
4150
4151
|
pendingRequest = null;
|
|
4151
|
-
handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
4152
|
+
handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
4152
4153
|
};
|
|
4153
4154
|
// suspense-controlled or SSR.
|
|
4154
4155
|
if ((suspensible && instance.suspense) ||
|
|
@@ -4258,7 +4259,7 @@ const KeepAliveImpl = {
|
|
|
4258
4259
|
const storageContainer = createElement('div');
|
|
4259
4260
|
sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
|
4260
4261
|
const instance = vnode.component;
|
|
4261
|
-
move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
|
|
4262
|
+
move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
|
|
4262
4263
|
// in case props have changed
|
|
4263
4264
|
patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
|
|
4264
4265
|
queuePostRenderEffect(() => {
|
|
@@ -4278,7 +4279,7 @@ const KeepAliveImpl = {
|
|
|
4278
4279
|
};
|
|
4279
4280
|
sharedContext.deactivate = (vnode) => {
|
|
4280
4281
|
const instance = vnode.component;
|
|
4281
|
-
move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
|
|
4282
|
+
move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
|
|
4282
4283
|
queuePostRenderEffect(() => {
|
|
4283
4284
|
if (instance.da) {
|
|
4284
4285
|
invokeArrayFns(instance.da);
|
|
@@ -4367,8 +4368,8 @@ const KeepAliveImpl = {
|
|
|
4367
4368
|
return children;
|
|
4368
4369
|
}
|
|
4369
4370
|
else if (!isVNode(rawVNode) ||
|
|
4370
|
-
(!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&
|
|
4371
|
-
!(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {
|
|
4371
|
+
(!(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) &&
|
|
4372
|
+
!(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */))) {
|
|
4372
4373
|
current = null;
|
|
4373
4374
|
return rawVNode;
|
|
4374
4375
|
}
|
|
@@ -4390,7 +4391,7 @@ const KeepAliveImpl = {
|
|
|
4390
4391
|
// clone vnode if it's reused because we are going to mutate it
|
|
4391
4392
|
if (vnode.el) {
|
|
4392
4393
|
vnode = cloneVNode(vnode);
|
|
4393
|
-
if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
|
|
4394
|
+
if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4394
4395
|
rawVNode.ssContent = vnode;
|
|
4395
4396
|
}
|
|
4396
4397
|
}
|
|
@@ -4409,7 +4410,7 @@ const KeepAliveImpl = {
|
|
|
4409
4410
|
setTransitionHooks(vnode, vnode.transition);
|
|
4410
4411
|
}
|
|
4411
4412
|
// avoid vnode being mounted as fresh
|
|
4412
|
-
vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
4413
|
+
vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
4413
4414
|
// make this key the freshest
|
|
4414
4415
|
keys.delete(key);
|
|
4415
4416
|
keys.add(key);
|
|
@@ -4422,7 +4423,7 @@ const KeepAliveImpl = {
|
|
|
4422
4423
|
}
|
|
4423
4424
|
}
|
|
4424
4425
|
// avoid vnode being unmounted
|
|
4425
|
-
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4426
|
+
vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4426
4427
|
current = vnode;
|
|
4427
4428
|
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
4428
4429
|
};
|
|
@@ -4445,10 +4446,10 @@ function matches(pattern, name) {
|
|
|
4445
4446
|
return false;
|
|
4446
4447
|
}
|
|
4447
4448
|
function onActivated(hook, target) {
|
|
4448
|
-
registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
|
|
4449
|
+
registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
|
|
4449
4450
|
}
|
|
4450
4451
|
function onDeactivated(hook, target) {
|
|
4451
|
-
registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
|
|
4452
|
+
registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
|
|
4452
4453
|
}
|
|
4453
4454
|
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
4454
4455
|
// cache the deactivate branch check wrapper for injected hooks so the same
|
|
@@ -4492,16 +4493,16 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
|
4492
4493
|
}
|
|
4493
4494
|
function resetShapeFlag(vnode) {
|
|
4494
4495
|
let shapeFlag = vnode.shapeFlag;
|
|
4495
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
4496
|
-
shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4496
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
4497
|
+
shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
4497
4498
|
}
|
|
4498
|
-
if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
4499
|
-
shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
4499
|
+
if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
4500
|
+
shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
4500
4501
|
}
|
|
4501
4502
|
vnode.shapeFlag = shapeFlag;
|
|
4502
4503
|
}
|
|
4503
4504
|
function getInnerChild(vnode) {
|
|
4504
|
-
return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
|
|
4505
|
+
return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
|
|
4505
4506
|
}
|
|
4506
4507
|
|
|
4507
4508
|
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
@@ -4547,19 +4548,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
4547
4548
|
}
|
|
4548
4549
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
4549
4550
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
4550
|
-
(!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
|
|
4551
|
-
injectHook(lifecycle, hook, target);
|
|
4552
|
-
const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
|
|
4553
|
-
const onMounted = createHook("m" /* MOUNTED */);
|
|
4554
|
-
const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
|
|
4555
|
-
const onUpdated = createHook("u" /* UPDATED */);
|
|
4556
|
-
const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
|
|
4557
|
-
const onUnmounted = createHook("um" /* UNMOUNTED */);
|
|
4558
|
-
const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
|
|
4559
|
-
const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
|
|
4560
|
-
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
|
|
4551
|
+
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
4552
|
+
injectHook(lifecycle, (...args) => hook(...args), target);
|
|
4553
|
+
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
4554
|
+
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
4555
|
+
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
4556
|
+
const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
|
|
4557
|
+
const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
|
|
4558
|
+
const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
|
|
4559
|
+
const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
|
|
4560
|
+
const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
|
|
4561
|
+
const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
|
|
4561
4562
|
function onErrorCaptured(hook, target = currentInstance) {
|
|
4562
|
-
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
4563
|
+
injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
|
|
4563
4564
|
}
|
|
4564
4565
|
|
|
4565
4566
|
/**
|
|
@@ -4626,7 +4627,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
4626
4627
|
// disable tracking inside all lifecycle hooks
|
|
4627
4628
|
// since they can potentially be called inside effects.
|
|
4628
4629
|
pauseTracking();
|
|
4629
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
4630
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [
|
|
4630
4631
|
vnode.el,
|
|
4631
4632
|
binding,
|
|
4632
4633
|
vnode,
|
|
@@ -4768,7 +4769,16 @@ function createSlots(slots, dynamicSlots) {
|
|
|
4768
4769
|
}
|
|
4769
4770
|
else if (slot) {
|
|
4770
4771
|
// conditional single slot generated by <template v-if="..." #foo>
|
|
4771
|
-
slots[slot.name] = slot.
|
|
4772
|
+
slots[slot.name] = slot.key
|
|
4773
|
+
? (...args) => {
|
|
4774
|
+
const res = slot.fn(...args);
|
|
4775
|
+
// attach branch key so each conditional branch is considered a
|
|
4776
|
+
// different fragment
|
|
4777
|
+
if (res)
|
|
4778
|
+
res.key = slot.key;
|
|
4779
|
+
return res;
|
|
4780
|
+
}
|
|
4781
|
+
: slot.fn;
|
|
4772
4782
|
}
|
|
4773
4783
|
}
|
|
4774
4784
|
return slots;
|
|
@@ -4804,9 +4814,15 @@ fallback, noSlotted) {
|
|
|
4804
4814
|
}
|
|
4805
4815
|
openBlock();
|
|
4806
4816
|
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
4807
|
-
const rendered = createBlock(Fragment, {
|
|
4808
|
-
|
|
4809
|
-
|
|
4817
|
+
const rendered = createBlock(Fragment, {
|
|
4818
|
+
key: props.key ||
|
|
4819
|
+
// slot content array of a dynamic conditional slot may have a branch
|
|
4820
|
+
// key attached in the `createSlots` helper, respect that
|
|
4821
|
+
(validSlotContent && validSlotContent.key) ||
|
|
4822
|
+
`_${name}`
|
|
4823
|
+
}, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */
|
|
4824
|
+
? 64 /* PatchFlags.STABLE_FRAGMENT */
|
|
4825
|
+
: -2 /* PatchFlags.BAIL */);
|
|
4810
4826
|
if (!noSlotted && rendered.scopeId) {
|
|
4811
4827
|
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
4812
4828
|
}
|
|
@@ -4834,14 +4850,16 @@ function ensureValidVNode(vnodes) {
|
|
|
4834
4850
|
* For prefixing keys in v-on="obj" with "on"
|
|
4835
4851
|
* @private
|
|
4836
4852
|
*/
|
|
4837
|
-
function toHandlers(obj) {
|
|
4853
|
+
function toHandlers(obj, preserveCaseIfNecessary) {
|
|
4838
4854
|
const ret = {};
|
|
4839
4855
|
if ((process.env.NODE_ENV !== 'production') && !isObject(obj)) {
|
|
4840
4856
|
warn(`v-on with no argument expects an object value.`);
|
|
4841
4857
|
return ret;
|
|
4842
4858
|
}
|
|
4843
4859
|
for (const key in obj) {
|
|
4844
|
-
ret[
|
|
4860
|
+
ret[preserveCaseIfNecessary && /[A-Z]/.test(key)
|
|
4861
|
+
? `on:${key}`
|
|
4862
|
+
: toHandlerKey(key)] = obj[key];
|
|
4845
4863
|
}
|
|
4846
4864
|
return ret;
|
|
4847
4865
|
}
|
|
@@ -4906,23 +4924,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
4906
4924
|
const n = accessCache[key];
|
|
4907
4925
|
if (n !== undefined) {
|
|
4908
4926
|
switch (n) {
|
|
4909
|
-
case 1 /* SETUP */:
|
|
4927
|
+
case 1 /* AccessTypes.SETUP */:
|
|
4910
4928
|
return setupState[key];
|
|
4911
|
-
case 2 /* DATA */:
|
|
4929
|
+
case 2 /* AccessTypes.DATA */:
|
|
4912
4930
|
return data[key];
|
|
4913
|
-
case 4 /* CONTEXT */:
|
|
4931
|
+
case 4 /* AccessTypes.CONTEXT */:
|
|
4914
4932
|
return ctx[key];
|
|
4915
|
-
case 3 /* PROPS */:
|
|
4933
|
+
case 3 /* AccessTypes.PROPS */:
|
|
4916
4934
|
return props[key];
|
|
4917
4935
|
// default: just fallthrough
|
|
4918
4936
|
}
|
|
4919
4937
|
}
|
|
4920
4938
|
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
4921
|
-
accessCache[key] = 1 /* SETUP */;
|
|
4939
|
+
accessCache[key] = 1 /* AccessTypes.SETUP */;
|
|
4922
4940
|
return setupState[key];
|
|
4923
4941
|
}
|
|
4924
4942
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
4925
|
-
accessCache[key] = 2 /* DATA */;
|
|
4943
|
+
accessCache[key] = 2 /* AccessTypes.DATA */;
|
|
4926
4944
|
return data[key];
|
|
4927
4945
|
}
|
|
4928
4946
|
else if (
|
|
@@ -4930,15 +4948,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
4930
4948
|
// props
|
|
4931
4949
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
4932
4950
|
hasOwn(normalizedProps, key)) {
|
|
4933
|
-
accessCache[key] = 3 /* PROPS */;
|
|
4951
|
+
accessCache[key] = 3 /* AccessTypes.PROPS */;
|
|
4934
4952
|
return props[key];
|
|
4935
4953
|
}
|
|
4936
4954
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4937
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
4955
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
4938
4956
|
return ctx[key];
|
|
4939
4957
|
}
|
|
4940
4958
|
else if (!true || shouldCacheAccess) {
|
|
4941
|
-
accessCache[key] = 0 /* OTHER */;
|
|
4959
|
+
accessCache[key] = 0 /* AccessTypes.OTHER */;
|
|
4942
4960
|
}
|
|
4943
4961
|
}
|
|
4944
4962
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -4946,7 +4964,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
4946
4964
|
// public $xxx properties
|
|
4947
4965
|
if (publicGetter) {
|
|
4948
4966
|
if (key === '$attrs') {
|
|
4949
|
-
track(instance, "get" /* GET */, key);
|
|
4967
|
+
track(instance, "get" /* TrackOpTypes.GET */, key);
|
|
4950
4968
|
(process.env.NODE_ENV !== 'production') && markAttrsAccessed();
|
|
4951
4969
|
}
|
|
4952
4970
|
return publicGetter(instance);
|
|
@@ -4959,7 +4977,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
4959
4977
|
}
|
|
4960
4978
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
4961
4979
|
// user may set custom properties to `this` that start with `$`
|
|
4962
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
4980
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
4963
4981
|
return ctx[key];
|
|
4964
4982
|
}
|
|
4965
4983
|
else if (
|
|
@@ -5145,7 +5163,7 @@ function applyOptions(instance) {
|
|
|
5145
5163
|
// call beforeCreate first before accessing other options since
|
|
5146
5164
|
// the hook may mutate resolved options (#2791)
|
|
5147
5165
|
if (options.beforeCreate) {
|
|
5148
|
-
callHook$1(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
5166
|
+
callHook$1(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
|
|
5149
5167
|
}
|
|
5150
5168
|
const {
|
|
5151
5169
|
// state
|
|
@@ -5161,7 +5179,7 @@ function applyOptions(instance) {
|
|
|
5161
5179
|
const [propsOptions] = instance.propsOptions;
|
|
5162
5180
|
if (propsOptions) {
|
|
5163
5181
|
for (const key in propsOptions) {
|
|
5164
|
-
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
5182
|
+
checkDuplicateProperties("Props" /* OptionTypes.PROPS */, key);
|
|
5165
5183
|
}
|
|
5166
5184
|
}
|
|
5167
5185
|
}
|
|
@@ -5194,7 +5212,7 @@ function applyOptions(instance) {
|
|
|
5194
5212
|
ctx[key] = methodHandler.bind(publicThis);
|
|
5195
5213
|
}
|
|
5196
5214
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
5197
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
5215
|
+
checkDuplicateProperties("Methods" /* OptionTypes.METHODS */, key);
|
|
5198
5216
|
}
|
|
5199
5217
|
}
|
|
5200
5218
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -5221,7 +5239,7 @@ function applyOptions(instance) {
|
|
|
5221
5239
|
instance.data = reactive(data);
|
|
5222
5240
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
5223
5241
|
for (const key in data) {
|
|
5224
|
-
checkDuplicateProperties("Data" /* DATA */, key);
|
|
5242
|
+
checkDuplicateProperties("Data" /* OptionTypes.DATA */, key);
|
|
5225
5243
|
// expose data on ctx during dev
|
|
5226
5244
|
if (!isReservedPrefix(key[0])) {
|
|
5227
5245
|
Object.defineProperty(ctx, key, {
|
|
@@ -5266,7 +5284,7 @@ function applyOptions(instance) {
|
|
|
5266
5284
|
set: v => (c.value = v)
|
|
5267
5285
|
});
|
|
5268
5286
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
5269
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
5287
|
+
checkDuplicateProperties("Computed" /* OptionTypes.COMPUTED */, key);
|
|
5270
5288
|
}
|
|
5271
5289
|
}
|
|
5272
5290
|
}
|
|
@@ -5284,7 +5302,7 @@ function applyOptions(instance) {
|
|
|
5284
5302
|
});
|
|
5285
5303
|
}
|
|
5286
5304
|
if (created) {
|
|
5287
|
-
callHook$1(created, instance, "c" /* CREATED */);
|
|
5305
|
+
callHook$1(created, instance, "c" /* LifecycleHooks.CREATED */);
|
|
5288
5306
|
}
|
|
5289
5307
|
function registerLifecycleHook(register, hook) {
|
|
5290
5308
|
if (isArray(hook)) {
|
|
@@ -5377,7 +5395,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
|
|
|
5377
5395
|
ctx[key] = injected;
|
|
5378
5396
|
}
|
|
5379
5397
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
5380
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
5398
|
+
checkDuplicateProperties("Inject" /* OptionTypes.INJECT */, key);
|
|
5381
5399
|
}
|
|
5382
5400
|
}
|
|
5383
5401
|
}
|
|
@@ -5448,7 +5466,9 @@ function resolveMergedOptions(instance) {
|
|
|
5448
5466
|
}
|
|
5449
5467
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
5450
5468
|
}
|
|
5451
|
-
|
|
5469
|
+
if (isObject(base)) {
|
|
5470
|
+
cache.set(base, resolved);
|
|
5471
|
+
}
|
|
5452
5472
|
return resolved;
|
|
5453
5473
|
}
|
|
5454
5474
|
function mergeOptions(to, from, strats, asMixin = false) {
|
|
@@ -5578,6 +5598,13 @@ isSSR = false) {
|
|
|
5578
5598
|
}
|
|
5579
5599
|
instance.attrs = attrs;
|
|
5580
5600
|
}
|
|
5601
|
+
function isInHmrContext(instance) {
|
|
5602
|
+
while (instance) {
|
|
5603
|
+
if (instance.type.__hmrId)
|
|
5604
|
+
return true;
|
|
5605
|
+
instance = instance.parent;
|
|
5606
|
+
}
|
|
5607
|
+
}
|
|
5581
5608
|
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
5582
5609
|
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
5583
5610
|
const rawCurrentProps = toRaw(props);
|
|
@@ -5587,12 +5614,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
5587
5614
|
// always force full diff in dev
|
|
5588
5615
|
// - #1942 if hmr is enabled with sfc component
|
|
5589
5616
|
// - vite#872 non-sfc component used by sfc component
|
|
5590
|
-
!((process.env.NODE_ENV !== 'production') &&
|
|
5591
|
-
(instance.type.__hmrId ||
|
|
5592
|
-
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
5617
|
+
!((process.env.NODE_ENV !== 'production') && isInHmrContext(instance)) &&
|
|
5593
5618
|
(optimized || patchFlag > 0) &&
|
|
5594
|
-
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
5595
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
5619
|
+
!(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
|
|
5620
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
5596
5621
|
// Compiler-generated props & no keys change, just set the updated
|
|
5597
5622
|
// the props.
|
|
5598
5623
|
const propsToUpdate = instance.vnode.dynamicProps;
|
|
@@ -5671,7 +5696,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
5671
5696
|
}
|
|
5672
5697
|
// trigger updates for $attrs in case it's used in component slots
|
|
5673
5698
|
if (hasAttrsChanged) {
|
|
5674
|
-
trigger(instance, "set" /* SET */, '$attrs');
|
|
5699
|
+
trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
|
|
5675
5700
|
}
|
|
5676
5701
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
5677
5702
|
validateProps(rawProps || {}, props, instance);
|
|
@@ -5740,11 +5765,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
5740
5765
|
}
|
|
5741
5766
|
}
|
|
5742
5767
|
// boolean casting
|
|
5743
|
-
if (opt[0 /* shouldCast */]) {
|
|
5768
|
+
if (opt[0 /* BooleanFlags.shouldCast */]) {
|
|
5744
5769
|
if (isAbsent && !hasDefault) {
|
|
5745
5770
|
value = false;
|
|
5746
5771
|
}
|
|
5747
|
-
else if (opt[1 /* shouldCastTrue */] &&
|
|
5772
|
+
else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
|
|
5748
5773
|
(value === '' || value === hyphenate(key))) {
|
|
5749
5774
|
value = true;
|
|
5750
5775
|
}
|
|
@@ -5782,7 +5807,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
5782
5807
|
}
|
|
5783
5808
|
}
|
|
5784
5809
|
if (!raw && !hasExtends) {
|
|
5785
|
-
|
|
5810
|
+
if (isObject(comp)) {
|
|
5811
|
+
cache.set(comp, EMPTY_ARR);
|
|
5812
|
+
}
|
|
5786
5813
|
return EMPTY_ARR;
|
|
5787
5814
|
}
|
|
5788
5815
|
if (isArray(raw)) {
|
|
@@ -5809,8 +5836,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
5809
5836
|
if (prop) {
|
|
5810
5837
|
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
5811
5838
|
const stringIndex = getTypeIndex(String, prop.type);
|
|
5812
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
5813
|
-
prop[1 /* shouldCastTrue */] =
|
|
5839
|
+
prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
|
|
5840
|
+
prop[1 /* BooleanFlags.shouldCastTrue */] =
|
|
5814
5841
|
stringIndex < 0 || booleanIndex < stringIndex;
|
|
5815
5842
|
// if the prop needs boolean casting or default value
|
|
5816
5843
|
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
@@ -5821,7 +5848,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
5821
5848
|
}
|
|
5822
5849
|
}
|
|
5823
5850
|
const res = [normalized, needCastKeys];
|
|
5824
|
-
|
|
5851
|
+
if (isObject(comp)) {
|
|
5852
|
+
cache.set(comp, res);
|
|
5853
|
+
}
|
|
5825
5854
|
return res;
|
|
5826
5855
|
}
|
|
5827
5856
|
function validatePropName(key) {
|
|
@@ -6033,7 +6062,7 @@ const normalizeVNodeSlots = (instance, children) => {
|
|
|
6033
6062
|
instance.slots.default = () => normalized;
|
|
6034
6063
|
};
|
|
6035
6064
|
const initSlots = (instance, children) => {
|
|
6036
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
6065
|
+
if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
6037
6066
|
const type = children._;
|
|
6038
6067
|
if (type) {
|
|
6039
6068
|
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
@@ -6058,7 +6087,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
6058
6087
|
const { vnode, slots } = instance;
|
|
6059
6088
|
let needDeletionCheck = true;
|
|
6060
6089
|
let deletionComparisonTarget = EMPTY_OBJ;
|
|
6061
|
-
if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
6090
|
+
if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
6062
6091
|
const type = children._;
|
|
6063
6092
|
if (type) {
|
|
6064
6093
|
// compiled slots.
|
|
@@ -6067,7 +6096,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
6067
6096
|
// force update slots and mark instance for hmr as well
|
|
6068
6097
|
extend(slots, children);
|
|
6069
6098
|
}
|
|
6070
|
-
else if (optimized && type === 1 /* STABLE */) {
|
|
6099
|
+
else if (optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
6071
6100
|
// compiled AND stable.
|
|
6072
6101
|
// no need to update, and skip stale slots removal.
|
|
6073
6102
|
needDeletionCheck = false;
|
|
@@ -6080,7 +6109,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
6080
6109
|
// when rendering the optimized slots by manually written render function,
|
|
6081
6110
|
// we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
|
|
6082
6111
|
// i.e. let the `renderSlot` create the bailed Fragment
|
|
6083
|
-
if (!optimized && type === 1 /* STABLE */) {
|
|
6112
|
+
if (!optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
6084
6113
|
delete slots._;
|
|
6085
6114
|
}
|
|
6086
6115
|
}
|
|
@@ -6294,7 +6323,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
6294
6323
|
// because the template ref is forwarded to inner component
|
|
6295
6324
|
return;
|
|
6296
6325
|
}
|
|
6297
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
6326
|
+
const refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
6298
6327
|
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
6299
6328
|
: vnode.el;
|
|
6300
6329
|
const value = isUnmount ? null : refValue;
|
|
@@ -6320,7 +6349,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
6320
6349
|
}
|
|
6321
6350
|
}
|
|
6322
6351
|
if (isFunction(ref)) {
|
|
6323
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
6352
|
+
callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
|
|
6324
6353
|
}
|
|
6325
6354
|
else {
|
|
6326
6355
|
const _isString = isString(ref);
|
|
@@ -6382,7 +6411,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
6382
6411
|
|
|
6383
6412
|
let hasMismatch = false;
|
|
6384
6413
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
6385
|
-
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
6414
|
+
const isComment = (node) => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
|
|
6386
6415
|
// Note: hydration is DOM-specific
|
|
6387
6416
|
// But we have to place it in core due to tight coupling with core - splitting
|
|
6388
6417
|
// it out creates a ton of unnecessary complexity.
|
|
@@ -6413,16 +6442,16 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6413
6442
|
const isFragmentStart = isComment(node) && node.data === '[';
|
|
6414
6443
|
const onMismatch = () => handleMismatch(node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragmentStart);
|
|
6415
6444
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
6416
|
-
|
|
6445
|
+
let domType = node.nodeType;
|
|
6417
6446
|
vnode.el = node;
|
|
6418
|
-
if (patchFlag === -2 /* BAIL */) {
|
|
6447
|
+
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
6419
6448
|
optimized = false;
|
|
6420
6449
|
vnode.dynamicChildren = null;
|
|
6421
6450
|
}
|
|
6422
6451
|
let nextNode = null;
|
|
6423
6452
|
switch (type) {
|
|
6424
6453
|
case Text:
|
|
6425
|
-
if (domType !== 3 /* TEXT */) {
|
|
6454
|
+
if (domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
6426
6455
|
// #5728 empty text node inside a slot can cause hydration failure
|
|
6427
6456
|
// because the server rendered HTML won't contain a text node
|
|
6428
6457
|
if (vnode.children === '') {
|
|
@@ -6446,7 +6475,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6446
6475
|
}
|
|
6447
6476
|
break;
|
|
6448
6477
|
case Comment:
|
|
6449
|
-
if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
6478
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
|
|
6450
6479
|
nextNode = onMismatch();
|
|
6451
6480
|
}
|
|
6452
6481
|
else {
|
|
@@ -6454,10 +6483,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6454
6483
|
}
|
|
6455
6484
|
break;
|
|
6456
6485
|
case Static:
|
|
6457
|
-
if (
|
|
6458
|
-
|
|
6486
|
+
if (isFragmentStart) {
|
|
6487
|
+
// entire template is static but SSRed as a fragment
|
|
6488
|
+
node = nextSibling(node);
|
|
6489
|
+
domType = node.nodeType;
|
|
6459
6490
|
}
|
|
6460
|
-
|
|
6491
|
+
if (domType === 1 /* DOMNodeTypes.ELEMENT */ || domType === 3 /* DOMNodeTypes.TEXT */) {
|
|
6461
6492
|
// determine anchor, adopt content
|
|
6462
6493
|
nextNode = node;
|
|
6463
6494
|
// if the static vnode has its content stripped during build,
|
|
@@ -6466,7 +6497,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6466
6497
|
for (let i = 0; i < vnode.staticCount; i++) {
|
|
6467
6498
|
if (needToAdoptContent)
|
|
6468
6499
|
vnode.children +=
|
|
6469
|
-
nextNode.nodeType === 1 /* ELEMENT */
|
|
6500
|
+
nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
|
|
6470
6501
|
? nextNode.outerHTML
|
|
6471
6502
|
: nextNode.data;
|
|
6472
6503
|
if (i === vnode.staticCount - 1) {
|
|
@@ -6474,7 +6505,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6474
6505
|
}
|
|
6475
6506
|
nextNode = nextSibling(nextNode);
|
|
6476
6507
|
}
|
|
6477
|
-
return nextNode;
|
|
6508
|
+
return isFragmentStart ? nextSibling(nextNode) : nextNode;
|
|
6509
|
+
}
|
|
6510
|
+
else {
|
|
6511
|
+
onMismatch();
|
|
6478
6512
|
}
|
|
6479
6513
|
break;
|
|
6480
6514
|
case Fragment:
|
|
@@ -6486,8 +6520,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6486
6520
|
}
|
|
6487
6521
|
break;
|
|
6488
6522
|
default:
|
|
6489
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
6490
|
-
if (domType !== 1 /* ELEMENT */ ||
|
|
6523
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
6524
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
|
|
6491
6525
|
vnode.type.toLowerCase() !==
|
|
6492
6526
|
node.tagName.toLowerCase()) {
|
|
6493
6527
|
nextNode = onMismatch();
|
|
@@ -6496,7 +6530,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6496
6530
|
nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
6497
6531
|
}
|
|
6498
6532
|
}
|
|
6499
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
6533
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6500
6534
|
// when setting up the render effect, if the initial vnode already
|
|
6501
6535
|
// has .el set, the component will perform hydration instead of mount
|
|
6502
6536
|
// on its sub-tree.
|
|
@@ -6535,15 +6569,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6535
6569
|
vnode.component.subTree = subTree;
|
|
6536
6570
|
}
|
|
6537
6571
|
}
|
|
6538
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
6539
|
-
if (domType !== 8 /* COMMENT */) {
|
|
6572
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6573
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
|
|
6540
6574
|
nextNode = onMismatch();
|
|
6541
6575
|
}
|
|
6542
6576
|
else {
|
|
6543
6577
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
6544
6578
|
}
|
|
6545
6579
|
}
|
|
6546
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6580
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6547
6581
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
6548
6582
|
}
|
|
6549
6583
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -6563,7 +6597,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6563
6597
|
const forcePatchValue = (type === 'input' && dirs) || type === 'option';
|
|
6564
6598
|
// skip props & children if this is hoisted static nodes
|
|
6565
6599
|
// #5405 in dev, always hydrate children for HMR
|
|
6566
|
-
if ((process.env.NODE_ENV !== 'production') || forcePatchValue || patchFlag !== -1 /* HOISTED */) {
|
|
6600
|
+
if ((process.env.NODE_ENV !== 'production') || forcePatchValue || patchFlag !== -1 /* PatchFlags.HOISTED */) {
|
|
6567
6601
|
if (dirs) {
|
|
6568
6602
|
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
|
6569
6603
|
}
|
|
@@ -6571,7 +6605,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6571
6605
|
if (props) {
|
|
6572
6606
|
if (forcePatchValue ||
|
|
6573
6607
|
!optimized ||
|
|
6574
|
-
patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
|
|
6608
|
+
patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
|
|
6575
6609
|
for (const key in props) {
|
|
6576
6610
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
6577
6611
|
(isOn(key) && !isReservedProp(key))) {
|
|
@@ -6600,7 +6634,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6600
6634
|
}, parentSuspense);
|
|
6601
6635
|
}
|
|
6602
6636
|
// children
|
|
6603
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
|
|
6637
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
|
|
6604
6638
|
// skip if element has innerHTML / textContent
|
|
6605
6639
|
!(props && (props.innerHTML || props.textContent))) {
|
|
6606
6640
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -6618,7 +6652,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6618
6652
|
remove(cur);
|
|
6619
6653
|
}
|
|
6620
6654
|
}
|
|
6621
|
-
else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
6655
|
+
else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
6622
6656
|
if (el.textContent !== vnode.children) {
|
|
6623
6657
|
hasMismatch = true;
|
|
6624
6658
|
(process.env.NODE_ENV !== 'production') &&
|
|
@@ -6683,7 +6717,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
6683
6717
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
6684
6718
|
hasMismatch = true;
|
|
6685
6719
|
(process.env.NODE_ENV !== 'production') &&
|
|
6686
|
-
warn(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* TEXT */
|
|
6720
|
+
warn(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* DOMNodeTypes.TEXT */
|
|
6687
6721
|
? `(text)`
|
|
6688
6722
|
: isComment(node) && node.data === '['
|
|
6689
6723
|
? `(start of fragment)`
|
|
@@ -6832,7 +6866,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6832
6866
|
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
|
|
6833
6867
|
setDevtoolsHook(target.__VUE_DEVTOOLS_GLOBAL_HOOK__, target);
|
|
6834
6868
|
}
|
|
6835
|
-
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP,
|
|
6869
|
+
const { insert: hostInsert, remove: hostRemove, patchProp: hostPatchProp, createElement: hostCreateElement, createText: hostCreateText, createComment: hostCreateComment, setText: hostSetText, setElementText: hostSetElementText, parentNode: hostParentNode, nextSibling: hostNextSibling, setScopeId: hostSetScopeId = NOOP, insertStaticContent: hostInsertStaticContent } = options;
|
|
6836
6870
|
// Note: functions inside this closure should use `const xxx = () => {}`
|
|
6837
6871
|
// style in order to prevent being inlined by minifiers.
|
|
6838
6872
|
const patch = (n1, n2, container, anchor = null, parentComponent = null, parentSuspense = null, isSVG = false, slotScopeIds = null, optimized = (process.env.NODE_ENV !== 'production') && isHmrUpdating ? false : !!n2.dynamicChildren) => {
|
|
@@ -6845,7 +6879,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6845
6879
|
unmount(n1, parentComponent, parentSuspense, true);
|
|
6846
6880
|
n1 = null;
|
|
6847
6881
|
}
|
|
6848
|
-
if (n2.patchFlag === -2 /* BAIL */) {
|
|
6882
|
+
if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
6849
6883
|
optimized = false;
|
|
6850
6884
|
n2.dynamicChildren = null;
|
|
6851
6885
|
}
|
|
@@ -6869,16 +6903,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6869
6903
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6870
6904
|
break;
|
|
6871
6905
|
default:
|
|
6872
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
6906
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
6873
6907
|
processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6874
6908
|
}
|
|
6875
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
6909
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6876
6910
|
processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6877
6911
|
}
|
|
6878
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
6912
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6879
6913
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
6880
6914
|
}
|
|
6881
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6915
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6882
6916
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
6883
6917
|
}
|
|
6884
6918
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -6959,56 +6993,44 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6959
6993
|
const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
6960
6994
|
let el;
|
|
6961
6995
|
let vnodeHook;
|
|
6962
|
-
const { type, props, shapeFlag, transition,
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
// Only static vnodes can be reused, so its mounted DOM nodes should be
|
|
6969
|
-
// exactly the same, and we can simply do a clone here.
|
|
6970
|
-
// only do this in production since cloned trees cannot be HMR updated.
|
|
6971
|
-
el = vnode.el = hostCloneNode(vnode.el);
|
|
6996
|
+
const { type, props, shapeFlag, transition, dirs } = vnode;
|
|
6997
|
+
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
6998
|
+
// mount children first, since some props may rely on child content
|
|
6999
|
+
// being already rendered, e.g. `<select value>`
|
|
7000
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
7001
|
+
hostSetElementText(el, vnode.children);
|
|
6972
7002
|
}
|
|
6973
|
-
else {
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
7003
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7004
|
+
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
7005
|
+
}
|
|
7006
|
+
if (dirs) {
|
|
7007
|
+
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
|
7008
|
+
}
|
|
7009
|
+
// props
|
|
7010
|
+
if (props) {
|
|
7011
|
+
for (const key in props) {
|
|
7012
|
+
if (key !== 'value' && !isReservedProp(key)) {
|
|
7013
|
+
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
7014
|
+
}
|
|
6982
7015
|
}
|
|
6983
|
-
|
|
6984
|
-
|
|
7016
|
+
/**
|
|
7017
|
+
* Special case for setting value on DOM elements:
|
|
7018
|
+
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
|
|
7019
|
+
* - it needs to be forced (#1471)
|
|
7020
|
+
* #2353 proposes adding another renderer option to configure this, but
|
|
7021
|
+
* the properties affects are so finite it is worth special casing it
|
|
7022
|
+
* here to reduce the complexity. (Special casing it also should not
|
|
7023
|
+
* affect non-DOM renderers)
|
|
7024
|
+
*/
|
|
7025
|
+
if ('value' in props) {
|
|
7026
|
+
hostPatchProp(el, 'value', null, props.value);
|
|
6985
7027
|
}
|
|
6986
|
-
|
|
6987
|
-
|
|
6988
|
-
for (const key in props) {
|
|
6989
|
-
if (key !== 'value' && !isReservedProp(key)) {
|
|
6990
|
-
hostPatchProp(el, key, null, props[key], isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
6991
|
-
}
|
|
6992
|
-
}
|
|
6993
|
-
/**
|
|
6994
|
-
* Special case for setting value on DOM elements:
|
|
6995
|
-
* - it can be order-sensitive (e.g. should be set *after* min/max, #2325, #4024)
|
|
6996
|
-
* - it needs to be forced (#1471)
|
|
6997
|
-
* #2353 proposes adding another renderer option to configure this, but
|
|
6998
|
-
* the properties affects are so finite it is worth special casing it
|
|
6999
|
-
* here to reduce the complexity. (Special casing it also should not
|
|
7000
|
-
* affect non-DOM renderers)
|
|
7001
|
-
*/
|
|
7002
|
-
if ('value' in props) {
|
|
7003
|
-
hostPatchProp(el, 'value', null, props.value);
|
|
7004
|
-
}
|
|
7005
|
-
if ((vnodeHook = props.onVnodeBeforeMount)) {
|
|
7006
|
-
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7007
|
-
}
|
|
7028
|
+
if ((vnodeHook = props.onVnodeBeforeMount)) {
|
|
7029
|
+
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7008
7030
|
}
|
|
7009
|
-
// scopeId
|
|
7010
|
-
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
7011
7031
|
}
|
|
7032
|
+
// scopeId
|
|
7033
|
+
setScopeId(el, vnode, vnode.scopeId, slotScopeIds, parentComponent);
|
|
7012
7034
|
if ((process.env.NODE_ENV !== 'production') || __VUE_PROD_DEVTOOLS__) {
|
|
7013
7035
|
Object.defineProperty(el, '__vnode', {
|
|
7014
7036
|
value: vnode,
|
|
@@ -7054,7 +7076,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7054
7076
|
let subTree = parentComponent.subTree;
|
|
7055
7077
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
7056
7078
|
subTree.patchFlag > 0 &&
|
|
7057
|
-
subTree.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
7079
|
+
subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
7058
7080
|
subTree =
|
|
7059
7081
|
filterSingleRoot(subTree.children) || subTree;
|
|
7060
7082
|
}
|
|
@@ -7077,7 +7099,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7077
7099
|
let { patchFlag, dynamicChildren, dirs } = n2;
|
|
7078
7100
|
// #1426 take the old vnode's patch flag into account since user may clone a
|
|
7079
7101
|
// compiler-generated vnode, which de-opts to FULL_PROPS
|
|
7080
|
-
patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
|
|
7102
|
+
patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
|
|
7081
7103
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
7082
7104
|
const newProps = n2.props || EMPTY_OBJ;
|
|
7083
7105
|
let vnodeHook;
|
|
@@ -7112,21 +7134,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7112
7134
|
// generated by the compiler and can take the fast path.
|
|
7113
7135
|
// in this path old node and new node are guaranteed to have the same shape
|
|
7114
7136
|
// (i.e. at the exact same position in the source template)
|
|
7115
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
7137
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
7116
7138
|
// element props contain dynamic keys, full diff needed
|
|
7117
7139
|
patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
|
7118
7140
|
}
|
|
7119
7141
|
else {
|
|
7120
7142
|
// class
|
|
7121
7143
|
// this flag is matched when the element has dynamic class bindings.
|
|
7122
|
-
if (patchFlag & 2 /* CLASS */) {
|
|
7144
|
+
if (patchFlag & 2 /* PatchFlags.CLASS */) {
|
|
7123
7145
|
if (oldProps.class !== newProps.class) {
|
|
7124
7146
|
hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
|
7125
7147
|
}
|
|
7126
7148
|
}
|
|
7127
7149
|
// style
|
|
7128
7150
|
// this flag is matched when the element has dynamic style bindings
|
|
7129
|
-
if (patchFlag & 4 /* STYLE */) {
|
|
7151
|
+
if (patchFlag & 4 /* PatchFlags.STYLE */) {
|
|
7130
7152
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
|
7131
7153
|
}
|
|
7132
7154
|
// props
|
|
@@ -7135,7 +7157,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7135
7157
|
// faster iteration.
|
|
7136
7158
|
// Note dynamic keys like :[foo]="bar" will cause this optimization to
|
|
7137
7159
|
// bail out and go through a full diff because we need to unset the old key
|
|
7138
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
7160
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
7139
7161
|
// if the flag is present then dynamicProps must be non-null
|
|
7140
7162
|
const propsToUpdate = n2.dynamicProps;
|
|
7141
7163
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
@@ -7151,7 +7173,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7151
7173
|
}
|
|
7152
7174
|
// text
|
|
7153
7175
|
// This flag is matched when the element has only dynamic text children.
|
|
7154
|
-
if (patchFlag & 1 /* TEXT */) {
|
|
7176
|
+
if (patchFlag & 1 /* PatchFlags.TEXT */) {
|
|
7155
7177
|
if (n1.children !== n2.children) {
|
|
7156
7178
|
hostSetElementText(el, n2.children);
|
|
7157
7179
|
}
|
|
@@ -7185,7 +7207,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7185
7207
|
// which also requires the correct parent container
|
|
7186
7208
|
!isSameVNodeType(oldVNode, newVNode) ||
|
|
7187
7209
|
// - In the case of a component, it could contain anything.
|
|
7188
|
-
oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
|
|
7210
|
+
oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
|
|
7189
7211
|
? hostParentNode(oldVNode.el)
|
|
7190
7212
|
: // In other cases, the parent container is not actually used so we
|
|
7191
7213
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -7195,6 +7217,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7195
7217
|
};
|
|
7196
7218
|
const patchProps = (el, vnode, oldProps, newProps, parentComponent, parentSuspense, isSVG) => {
|
|
7197
7219
|
if (oldProps !== newProps) {
|
|
7220
|
+
if (oldProps !== EMPTY_OBJ) {
|
|
7221
|
+
for (const key in oldProps) {
|
|
7222
|
+
if (!isReservedProp(key) && !(key in newProps)) {
|
|
7223
|
+
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
7224
|
+
}
|
|
7225
|
+
}
|
|
7226
|
+
}
|
|
7198
7227
|
for (const key in newProps) {
|
|
7199
7228
|
// empty string is not valid prop
|
|
7200
7229
|
if (isReservedProp(key))
|
|
@@ -7206,13 +7235,6 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7206
7235
|
hostPatchProp(el, key, prev, next, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
7207
7236
|
}
|
|
7208
7237
|
}
|
|
7209
|
-
if (oldProps !== EMPTY_OBJ) {
|
|
7210
|
-
for (const key in oldProps) {
|
|
7211
|
-
if (!isReservedProp(key) && !(key in newProps)) {
|
|
7212
|
-
hostPatchProp(el, key, oldProps[key], null, isSVG, vnode.children, parentComponent, parentSuspense, unmountChildren);
|
|
7213
|
-
}
|
|
7214
|
-
}
|
|
7215
|
-
}
|
|
7216
7238
|
if ('value' in newProps) {
|
|
7217
7239
|
hostPatchProp(el, 'value', oldProps.value, newProps.value);
|
|
7218
7240
|
}
|
|
@@ -7224,7 +7246,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7224
7246
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
7225
7247
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
7226
7248
|
// #5523 dev root fragment may inherit directives
|
|
7227
|
-
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
7249
|
+
(isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */)) {
|
|
7228
7250
|
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
7229
7251
|
patchFlag = 0;
|
|
7230
7252
|
optimized = false;
|
|
@@ -7246,7 +7268,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7246
7268
|
}
|
|
7247
7269
|
else {
|
|
7248
7270
|
if (patchFlag > 0 &&
|
|
7249
|
-
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
7271
|
+
patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
|
|
7250
7272
|
dynamicChildren &&
|
|
7251
7273
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
7252
7274
|
// of renderSlot() with no valid children
|
|
@@ -7279,7 +7301,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7279
7301
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
7280
7302
|
n2.slotScopeIds = slotScopeIds;
|
|
7281
7303
|
if (n1 == null) {
|
|
7282
|
-
if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
7304
|
+
if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
7283
7305
|
parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
|
7284
7306
|
}
|
|
7285
7307
|
else {
|
|
@@ -7441,10 +7463,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7441
7463
|
// activated hook for keep-alive roots.
|
|
7442
7464
|
// #1742 activated hook must be accessed after first render
|
|
7443
7465
|
// since the hook may be injected by a child keep-alive
|
|
7444
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
7466
|
+
if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
7445
7467
|
(parent &&
|
|
7446
7468
|
isAsyncWrapper(parent.vnode) &&
|
|
7447
|
-
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
7469
|
+
parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
7448
7470
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
7449
7471
|
}
|
|
7450
7472
|
instance.isMounted = true;
|
|
@@ -7555,7 +7577,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7555
7577
|
pauseTracking();
|
|
7556
7578
|
// props update may have triggered pre-flush watchers.
|
|
7557
7579
|
// flush them before the render update.
|
|
7558
|
-
flushPreFlushCbs(
|
|
7580
|
+
flushPreFlushCbs();
|
|
7559
7581
|
resetTracking();
|
|
7560
7582
|
};
|
|
7561
7583
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
|
@@ -7565,22 +7587,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7565
7587
|
const { patchFlag, shapeFlag } = n2;
|
|
7566
7588
|
// fast path
|
|
7567
7589
|
if (patchFlag > 0) {
|
|
7568
|
-
if (patchFlag & 128 /* KEYED_FRAGMENT */) {
|
|
7590
|
+
if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
|
|
7569
7591
|
// this could be either fully-keyed or mixed (some keyed some not)
|
|
7570
7592
|
// presence of patchFlag means children are guaranteed to be arrays
|
|
7571
7593
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7572
7594
|
return;
|
|
7573
7595
|
}
|
|
7574
|
-
else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
|
|
7596
|
+
else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
|
|
7575
7597
|
// unkeyed
|
|
7576
7598
|
patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7577
7599
|
return;
|
|
7578
7600
|
}
|
|
7579
7601
|
}
|
|
7580
7602
|
// children has 3 possibilities: text, array or no children.
|
|
7581
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
7603
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
7582
7604
|
// text children fast path
|
|
7583
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7605
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7584
7606
|
unmountChildren(c1, parentComponent, parentSuspense);
|
|
7585
7607
|
}
|
|
7586
7608
|
if (c2 !== c1) {
|
|
@@ -7588,9 +7610,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7588
7610
|
}
|
|
7589
7611
|
}
|
|
7590
7612
|
else {
|
|
7591
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7613
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7592
7614
|
// prev children was array
|
|
7593
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7615
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7594
7616
|
// two arrays, cannot assume anything, do full diff
|
|
7595
7617
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7596
7618
|
}
|
|
@@ -7602,11 +7624,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7602
7624
|
else {
|
|
7603
7625
|
// prev children was text OR null
|
|
7604
7626
|
// new children is array OR null
|
|
7605
|
-
if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
7627
|
+
if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
7606
7628
|
hostSetElementText(container, '');
|
|
7607
7629
|
}
|
|
7608
7630
|
// mount new if array
|
|
7609
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
7631
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
7610
7632
|
mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
7611
7633
|
}
|
|
7612
7634
|
}
|
|
@@ -7797,7 +7819,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7797
7819
|
// There is no stable subsequence (e.g. a reverse)
|
|
7798
7820
|
// OR current node is not among the stable sequence
|
|
7799
7821
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
7800
|
-
move(nextChild, container, anchor, 2 /* REORDER */);
|
|
7822
|
+
move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
|
|
7801
7823
|
}
|
|
7802
7824
|
else {
|
|
7803
7825
|
j--;
|
|
@@ -7808,15 +7830,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7808
7830
|
};
|
|
7809
7831
|
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
7810
7832
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
7811
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
7833
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
7812
7834
|
move(vnode.component.subTree, container, anchor, moveType);
|
|
7813
7835
|
return;
|
|
7814
7836
|
}
|
|
7815
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
7837
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
7816
7838
|
vnode.suspense.move(container, anchor, moveType);
|
|
7817
7839
|
return;
|
|
7818
7840
|
}
|
|
7819
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7841
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
7820
7842
|
type.move(vnode, container, anchor, internals);
|
|
7821
7843
|
return;
|
|
7822
7844
|
}
|
|
@@ -7833,11 +7855,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7833
7855
|
return;
|
|
7834
7856
|
}
|
|
7835
7857
|
// single nodes
|
|
7836
|
-
const needTransition = moveType !== 2 /* REORDER */ &&
|
|
7837
|
-
shapeFlag & 1 /* ELEMENT */ &&
|
|
7858
|
+
const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
|
|
7859
|
+
shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
7838
7860
|
transition;
|
|
7839
7861
|
if (needTransition) {
|
|
7840
|
-
if (moveType === 0 /* ENTER */) {
|
|
7862
|
+
if (moveType === 0 /* MoveType.ENTER */) {
|
|
7841
7863
|
transition.beforeEnter(el);
|
|
7842
7864
|
hostInsert(el, container, anchor);
|
|
7843
7865
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -7869,42 +7891,42 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7869
7891
|
if (ref != null) {
|
|
7870
7892
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
7871
7893
|
}
|
|
7872
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
7894
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
7873
7895
|
parentComponent.ctx.deactivate(vnode);
|
|
7874
7896
|
return;
|
|
7875
7897
|
}
|
|
7876
|
-
const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
|
|
7898
|
+
const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
|
|
7877
7899
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
7878
7900
|
let vnodeHook;
|
|
7879
7901
|
if (shouldInvokeVnodeHook &&
|
|
7880
7902
|
(vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
|
7881
7903
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
7882
7904
|
}
|
|
7883
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
7905
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
7884
7906
|
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
7885
7907
|
}
|
|
7886
7908
|
else {
|
|
7887
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
7909
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
7888
7910
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
7889
7911
|
return;
|
|
7890
7912
|
}
|
|
7891
7913
|
if (shouldInvokeDirs) {
|
|
7892
7914
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
|
7893
7915
|
}
|
|
7894
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
7916
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
7895
7917
|
vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
|
7896
7918
|
}
|
|
7897
7919
|
else if (dynamicChildren &&
|
|
7898
7920
|
// #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
7899
7921
|
(type !== Fragment ||
|
|
7900
|
-
(patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
|
|
7922
|
+
(patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
|
|
7901
7923
|
// fast path for block nodes: only need to unmount dynamic children.
|
|
7902
7924
|
unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
7903
7925
|
}
|
|
7904
7926
|
else if ((type === Fragment &&
|
|
7905
7927
|
patchFlag &
|
|
7906
|
-
(128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
|
|
7907
|
-
(!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
|
|
7928
|
+
(128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
|
|
7929
|
+
(!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
|
|
7908
7930
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
7909
7931
|
}
|
|
7910
7932
|
if (doRemove) {
|
|
@@ -7926,7 +7948,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7926
7948
|
if (type === Fragment) {
|
|
7927
7949
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
7928
7950
|
vnode.patchFlag > 0 &&
|
|
7929
|
-
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
7951
|
+
vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ &&
|
|
7930
7952
|
transition &&
|
|
7931
7953
|
!transition.persisted) {
|
|
7932
7954
|
vnode.children.forEach(child => {
|
|
@@ -7953,7 +7975,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
7953
7975
|
transition.afterLeave();
|
|
7954
7976
|
}
|
|
7955
7977
|
};
|
|
7956
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ &&
|
|
7978
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
7957
7979
|
transition &&
|
|
7958
7980
|
!transition.persisted) {
|
|
7959
7981
|
const { leave, delayLeave } = transition;
|
|
@@ -8029,10 +8051,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8029
8051
|
}
|
|
8030
8052
|
};
|
|
8031
8053
|
const getNextHostNode = vnode => {
|
|
8032
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */) {
|
|
8054
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
8033
8055
|
return getNextHostNode(vnode.component.subTree);
|
|
8034
8056
|
}
|
|
8035
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
8057
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
8036
8058
|
return vnode.suspense.next();
|
|
8037
8059
|
}
|
|
8038
8060
|
return hostNextSibling((vnode.anchor || vnode.el));
|
|
@@ -8046,6 +8068,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
8046
8068
|
else {
|
|
8047
8069
|
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
|
8048
8070
|
}
|
|
8071
|
+
flushPreFlushCbs();
|
|
8049
8072
|
flushPostFlushCbs();
|
|
8050
8073
|
container._vnode = vnode;
|
|
8051
8074
|
};
|
|
@@ -8095,8 +8118,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
8095
8118
|
// guaranteed to be vnodes
|
|
8096
8119
|
const c1 = ch1[i];
|
|
8097
8120
|
let c2 = ch2[i];
|
|
8098
|
-
if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
|
|
8099
|
-
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
|
|
8121
|
+
if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
|
|
8122
|
+
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
8100
8123
|
c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
|
8101
8124
|
c2.el = c1.el;
|
|
8102
8125
|
}
|
|
@@ -8220,7 +8243,7 @@ const TeleportImpl = {
|
|
|
8220
8243
|
const mount = (container, anchor) => {
|
|
8221
8244
|
// Teleport *always* has Array children. This is enforced in both the
|
|
8222
8245
|
// compiler and vnode children normalization.
|
|
8223
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
8246
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
8224
8247
|
mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
8225
8248
|
}
|
|
8226
8249
|
};
|
|
@@ -8256,7 +8279,7 @@ const TeleportImpl = {
|
|
|
8256
8279
|
if (!wasDisabled) {
|
|
8257
8280
|
// enabled -> disabled
|
|
8258
8281
|
// move into main container
|
|
8259
|
-
moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
|
|
8282
|
+
moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
8260
8283
|
}
|
|
8261
8284
|
}
|
|
8262
8285
|
else {
|
|
@@ -8264,7 +8287,7 @@ const TeleportImpl = {
|
|
|
8264
8287
|
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
8265
8288
|
const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
|
8266
8289
|
if (nextTarget) {
|
|
8267
|
-
moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
|
|
8290
|
+
moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
|
|
8268
8291
|
}
|
|
8269
8292
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
8270
8293
|
warn('Invalid Teleport target on update:', target, `(${typeof target})`);
|
|
@@ -8273,7 +8296,7 @@ const TeleportImpl = {
|
|
|
8273
8296
|
else if (wasDisabled) {
|
|
8274
8297
|
// disabled -> enabled
|
|
8275
8298
|
// move into teleport target
|
|
8276
|
-
moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
|
|
8299
|
+
moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
8277
8300
|
}
|
|
8278
8301
|
}
|
|
8279
8302
|
}
|
|
@@ -8286,7 +8309,7 @@ const TeleportImpl = {
|
|
|
8286
8309
|
// an unmounted teleport should always remove its children if not disabled
|
|
8287
8310
|
if (doRemove || !isTeleportDisabled(props)) {
|
|
8288
8311
|
hostRemove(anchor);
|
|
8289
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
8312
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
8290
8313
|
for (let i = 0; i < children.length; i++) {
|
|
8291
8314
|
const child = children[i];
|
|
8292
8315
|
unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
|
|
@@ -8297,13 +8320,13 @@ const TeleportImpl = {
|
|
|
8297
8320
|
move: moveTeleport,
|
|
8298
8321
|
hydrate: hydrateTeleport
|
|
8299
8322
|
};
|
|
8300
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
|
|
8323
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* TeleportMoveTypes.REORDER */) {
|
|
8301
8324
|
// move target anchor if this is a target change.
|
|
8302
|
-
if (moveType === 0 /* TARGET_CHANGE */) {
|
|
8325
|
+
if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
|
|
8303
8326
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
8304
8327
|
}
|
|
8305
8328
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
8306
|
-
const isReorder = moveType === 2 /* REORDER */;
|
|
8329
|
+
const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
|
|
8307
8330
|
// move main view anchor if this is a re-order.
|
|
8308
8331
|
if (isReorder) {
|
|
8309
8332
|
insert(el, container, parentAnchor);
|
|
@@ -8313,9 +8336,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
8313
8336
|
// is not a reorder, or the teleport is disabled
|
|
8314
8337
|
if (!isReorder || isTeleportDisabled(props)) {
|
|
8315
8338
|
// Teleport has either Array children or no children.
|
|
8316
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
8339
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
8317
8340
|
for (let i = 0; i < children.length; i++) {
|
|
8318
|
-
move(children[i], container, parentAnchor, 2 /* REORDER */);
|
|
8341
|
+
move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
|
|
8319
8342
|
}
|
|
8320
8343
|
}
|
|
8321
8344
|
}
|
|
@@ -8330,7 +8353,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
8330
8353
|
// if multiple teleports rendered to the same target element, we need to
|
|
8331
8354
|
// pick up from where the last teleport finished instead of the first node
|
|
8332
8355
|
const targetNode = target._lpa || target.firstChild;
|
|
8333
|
-
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
8356
|
+
if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
8334
8357
|
if (isTeleportDisabled(vnode.props)) {
|
|
8335
8358
|
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
8336
8359
|
vnode.targetAnchor = targetNode;
|
|
@@ -8453,7 +8476,7 @@ function isVNode(value) {
|
|
|
8453
8476
|
}
|
|
8454
8477
|
function isSameVNodeType(n1, n2) {
|
|
8455
8478
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
8456
|
-
n2.shapeFlag & 6 /* COMPONENT */ &&
|
|
8479
|
+
n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
8457
8480
|
hmrDirtyComponents.has(n2.type)) {
|
|
8458
8481
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
8459
8482
|
return false;
|
|
@@ -8484,7 +8507,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
8484
8507
|
: ref
|
|
8485
8508
|
: null);
|
|
8486
8509
|
};
|
|
8487
|
-
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
8510
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
8488
8511
|
const vnode = {
|
|
8489
8512
|
__v_isVNode: true,
|
|
8490
8513
|
__v_skip: true,
|
|
@@ -8515,7 +8538,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8515
8538
|
if (needFullChildrenNormalization) {
|
|
8516
8539
|
normalizeChildren(vnode, children);
|
|
8517
8540
|
// normalize suspense children
|
|
8518
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
8541
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
8519
8542
|
type.normalize(vnode);
|
|
8520
8543
|
}
|
|
8521
8544
|
}
|
|
@@ -8523,8 +8546,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8523
8546
|
// compiled element vnode - if children is passed, only possible types are
|
|
8524
8547
|
// string or Array.
|
|
8525
8548
|
vnode.shapeFlag |= isString(children)
|
|
8526
|
-
? 8 /* TEXT_CHILDREN */
|
|
8527
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
8549
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
8550
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
8528
8551
|
}
|
|
8529
8552
|
// validate key
|
|
8530
8553
|
if ((process.env.NODE_ENV !== 'production') && vnode.key !== vnode.key) {
|
|
@@ -8540,10 +8563,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
8540
8563
|
// component nodes also should always be patched, because even if the
|
|
8541
8564
|
// component doesn't need to update, it needs to persist the instance on to
|
|
8542
8565
|
// the next vnode so that it can be properly unmounted later.
|
|
8543
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
8566
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
8544
8567
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
8545
8568
|
// vnode should not be considered dynamic due to handler caching.
|
|
8546
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
8569
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
8547
8570
|
currentBlock.push(vnode);
|
|
8548
8571
|
}
|
|
8549
8572
|
return vnode;
|
|
@@ -8565,14 +8588,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
8565
8588
|
normalizeChildren(cloned, children);
|
|
8566
8589
|
}
|
|
8567
8590
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
8568
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
8591
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
8569
8592
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
8570
8593
|
}
|
|
8571
8594
|
else {
|
|
8572
8595
|
currentBlock.push(cloned);
|
|
8573
8596
|
}
|
|
8574
8597
|
}
|
|
8575
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
8598
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
8576
8599
|
return cloned;
|
|
8577
8600
|
}
|
|
8578
8601
|
// class component normalization.
|
|
@@ -8598,17 +8621,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
8598
8621
|
}
|
|
8599
8622
|
// encode the vnode type information into a bitmap
|
|
8600
8623
|
const shapeFlag = isString(type)
|
|
8601
|
-
? 1 /* ELEMENT */
|
|
8624
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
8602
8625
|
: isSuspense(type)
|
|
8603
|
-
? 128 /* SUSPENSE */
|
|
8626
|
+
? 128 /* ShapeFlags.SUSPENSE */
|
|
8604
8627
|
: isTeleport(type)
|
|
8605
|
-
? 64 /* TELEPORT */
|
|
8628
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
8606
8629
|
: isObject(type)
|
|
8607
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
8630
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
8608
8631
|
: isFunction(type)
|
|
8609
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
8632
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
8610
8633
|
: 0;
|
|
8611
|
-
if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
8634
|
+
if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
8612
8635
|
type = toRaw(type);
|
|
8613
8636
|
warn(`Vue received a Component which was made a reactive object. This can ` +
|
|
8614
8637
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
@@ -8647,7 +8670,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
8647
8670
|
: ref,
|
|
8648
8671
|
scopeId: vnode.scopeId,
|
|
8649
8672
|
slotScopeIds: vnode.slotScopeIds,
|
|
8650
|
-
children: (process.env.NODE_ENV !== 'production') && patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
8673
|
+
children: (process.env.NODE_ENV !== 'production') && patchFlag === -1 /* PatchFlags.HOISTED */ && isArray(children)
|
|
8651
8674
|
? children.map(deepCloneVNode)
|
|
8652
8675
|
: children,
|
|
8653
8676
|
target: vnode.target,
|
|
@@ -8660,8 +8683,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
8660
8683
|
// fast paths only.
|
|
8661
8684
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
8662
8685
|
? patchFlag === -1 // hoisted node
|
|
8663
|
-
? 16 /* FULL_PROPS */
|
|
8664
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
8686
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
8687
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
8665
8688
|
: patchFlag,
|
|
8666
8689
|
dynamicProps: vnode.dynamicProps,
|
|
8667
8690
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -8742,7 +8765,10 @@ function normalizeVNode(child) {
|
|
|
8742
8765
|
}
|
|
8743
8766
|
// optimized normalization for template-compiled render fns
|
|
8744
8767
|
function cloneIfMounted(child) {
|
|
8745
|
-
return child.el === null
|
|
8768
|
+
return (child.el === null && child.patchFlag !== -1 /* PatchFlags.HOISTED */) ||
|
|
8769
|
+
child.memo
|
|
8770
|
+
? child
|
|
8771
|
+
: cloneVNode(child);
|
|
8746
8772
|
}
|
|
8747
8773
|
function normalizeChildren(vnode, children) {
|
|
8748
8774
|
let type = 0;
|
|
@@ -8751,10 +8777,10 @@ function normalizeChildren(vnode, children) {
|
|
|
8751
8777
|
children = null;
|
|
8752
8778
|
}
|
|
8753
8779
|
else if (isArray(children)) {
|
|
8754
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
8780
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
8755
8781
|
}
|
|
8756
8782
|
else if (typeof children === 'object') {
|
|
8757
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
8783
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
8758
8784
|
// Normalize slot to plain children for plain element and Teleport
|
|
8759
8785
|
const slot = children.default;
|
|
8760
8786
|
if (slot) {
|
|
@@ -8766,37 +8792,37 @@ function normalizeChildren(vnode, children) {
|
|
|
8766
8792
|
return;
|
|
8767
8793
|
}
|
|
8768
8794
|
else {
|
|
8769
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
8795
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
8770
8796
|
const slotFlag = children._;
|
|
8771
8797
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
8772
8798
|
children._ctx = currentRenderingInstance;
|
|
8773
8799
|
}
|
|
8774
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
8800
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
8775
8801
|
// a child component receives forwarded slots from the parent.
|
|
8776
8802
|
// its slot type is determined by its parent's slot type.
|
|
8777
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
8778
|
-
children._ = 1 /* STABLE */;
|
|
8803
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
8804
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
8779
8805
|
}
|
|
8780
8806
|
else {
|
|
8781
|
-
children._ = 2 /* DYNAMIC */;
|
|
8782
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
8807
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
8808
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
8783
8809
|
}
|
|
8784
8810
|
}
|
|
8785
8811
|
}
|
|
8786
8812
|
}
|
|
8787
8813
|
else if (isFunction(children)) {
|
|
8788
8814
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
8789
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
8815
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
8790
8816
|
}
|
|
8791
8817
|
else {
|
|
8792
8818
|
children = String(children);
|
|
8793
8819
|
// force teleport children to array so it can be moved around
|
|
8794
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
8795
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
8820
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
8821
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
8796
8822
|
children = [createTextVNode(children)];
|
|
8797
8823
|
}
|
|
8798
8824
|
else {
|
|
8799
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
8825
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
8800
8826
|
}
|
|
8801
8827
|
}
|
|
8802
8828
|
vnode.children = children;
|
|
@@ -8834,7 +8860,7 @@ function mergeProps(...args) {
|
|
|
8834
8860
|
return ret;
|
|
8835
8861
|
}
|
|
8836
8862
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
8837
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
8863
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
|
|
8838
8864
|
vnode,
|
|
8839
8865
|
prevVNode
|
|
8840
8866
|
]);
|
|
@@ -8945,7 +8971,7 @@ function validateComponentName(name, config) {
|
|
|
8945
8971
|
}
|
|
8946
8972
|
}
|
|
8947
8973
|
function isStatefulComponent(instance) {
|
|
8948
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
8974
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
8949
8975
|
}
|
|
8950
8976
|
let isInSSRComponentSetup = false;
|
|
8951
8977
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -9000,7 +9026,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
9000
9026
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
9001
9027
|
setCurrentInstance(instance);
|
|
9002
9028
|
pauseTracking();
|
|
9003
|
-
const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
|
|
9029
|
+
const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
|
|
9004
9030
|
resetTracking();
|
|
9005
9031
|
unsetCurrentInstance();
|
|
9006
9032
|
if (isPromise(setupResult)) {
|
|
@@ -9012,7 +9038,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
9012
9038
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
9013
9039
|
})
|
|
9014
9040
|
.catch(e => {
|
|
9015
|
-
handleError(e, instance, 0 /* SETUP_FUNCTION */);
|
|
9041
|
+
handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
9016
9042
|
});
|
|
9017
9043
|
}
|
|
9018
9044
|
else {
|
|
@@ -9092,7 +9118,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
9092
9118
|
// only do on-the-fly compile if not in SSR - SSR on-the-fly compilation
|
|
9093
9119
|
// is done by server-renderer
|
|
9094
9120
|
if (!isSSR && compile$1 && !Component.render) {
|
|
9095
|
-
const template = Component.template
|
|
9121
|
+
const template = Component.template ||
|
|
9122
|
+
resolveMergedOptions(instance).template;
|
|
9096
9123
|
if (template) {
|
|
9097
9124
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
9098
9125
|
startMeasure(instance, `compile`);
|
|
@@ -9145,7 +9172,7 @@ function createAttrsProxy(instance) {
|
|
|
9145
9172
|
? {
|
|
9146
9173
|
get(target, key) {
|
|
9147
9174
|
markAttrsAccessed();
|
|
9148
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
9175
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
9149
9176
|
return target[key];
|
|
9150
9177
|
},
|
|
9151
9178
|
set() {
|
|
@@ -9159,7 +9186,7 @@ function createAttrsProxy(instance) {
|
|
|
9159
9186
|
}
|
|
9160
9187
|
: {
|
|
9161
9188
|
get(target, key) {
|
|
9162
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
9189
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
9163
9190
|
return target[key];
|
|
9164
9191
|
}
|
|
9165
9192
|
});
|
|
@@ -9447,7 +9474,7 @@ const useSSRContext = () => {
|
|
|
9447
9474
|
};
|
|
9448
9475
|
|
|
9449
9476
|
function isShallow(value) {
|
|
9450
|
-
return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
|
|
9477
|
+
return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
|
|
9451
9478
|
}
|
|
9452
9479
|
|
|
9453
9480
|
function initCustomFormatter() {
|
|
@@ -9667,7 +9694,7 @@ function isMemoSame(cached, memo) {
|
|
|
9667
9694
|
}
|
|
9668
9695
|
|
|
9669
9696
|
// Core API ------------------------------------------------------------------
|
|
9670
|
-
const version = "3.2.
|
|
9697
|
+
const version = "3.2.40";
|
|
9671
9698
|
const _ssrUtils = {
|
|
9672
9699
|
createComponentInstance,
|
|
9673
9700
|
setupComponent,
|
|
@@ -9726,22 +9753,6 @@ const nodeOps = {
|
|
|
9726
9753
|
setScopeId(el, id) {
|
|
9727
9754
|
el.setAttribute(id, '');
|
|
9728
9755
|
},
|
|
9729
|
-
cloneNode(el) {
|
|
9730
|
-
const cloned = el.cloneNode(true);
|
|
9731
|
-
// #3072
|
|
9732
|
-
// - in `patchDOMProp`, we store the actual value in the `el._value` property.
|
|
9733
|
-
// - normally, elements using `:value` bindings will not be hoisted, but if
|
|
9734
|
-
// the bound value is a constant, e.g. `:value="true"` - they do get
|
|
9735
|
-
// hoisted.
|
|
9736
|
-
// - in production, hoisted nodes are cloned when subsequent inserts, but
|
|
9737
|
-
// cloneNode() does not copy the custom property we attached.
|
|
9738
|
-
// - This may need to account for other custom DOM properties we attach to
|
|
9739
|
-
// elements in addition to `_value` in the future.
|
|
9740
|
-
if (`_value` in el) {
|
|
9741
|
-
cloned._value = el._value;
|
|
9742
|
-
}
|
|
9743
|
-
return cloned;
|
|
9744
|
-
},
|
|
9745
9756
|
// __UNSAFE__
|
|
9746
9757
|
// Reason: innerHTML.
|
|
9747
9758
|
// Static content here can only come from compiled templates.
|
|
@@ -9953,7 +9964,6 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
9953
9964
|
}
|
|
9954
9965
|
else if (type === 'number') {
|
|
9955
9966
|
// e.g. <img :width="null">
|
|
9956
|
-
// the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
|
|
9957
9967
|
value = 0;
|
|
9958
9968
|
needRemove = true;
|
|
9959
9969
|
}
|
|
@@ -9965,7 +9975,8 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
|
|
|
9965
9975
|
el[key] = value;
|
|
9966
9976
|
}
|
|
9967
9977
|
catch (e) {
|
|
9968
|
-
if
|
|
9978
|
+
// do not warn if value is auto-coerced from nullish values
|
|
9979
|
+
if ((process.env.NODE_ENV !== 'production') && !needRemove) {
|
|
9969
9980
|
warn(`Failed setting prop "${key}" on <${el.tagName.toLowerCase()}>: ` +
|
|
9970
9981
|
`value ${value} is invalid.`, e);
|
|
9971
9982
|
}
|
|
@@ -10042,7 +10053,8 @@ function parseName(name) {
|
|
|
10042
10053
|
options[m[0].toLowerCase()] = true;
|
|
10043
10054
|
}
|
|
10044
10055
|
}
|
|
10045
|
-
|
|
10056
|
+
const event = name[2] === ':' ? name.slice(3) : hyphenate(name.slice(2));
|
|
10057
|
+
return [event, options];
|
|
10046
10058
|
}
|
|
10047
10059
|
function createInvoker(initialValue, instance) {
|
|
10048
10060
|
const invoker = (e) => {
|
|
@@ -10054,7 +10066,7 @@ function createInvoker(initialValue, instance) {
|
|
|
10054
10066
|
// AFTER it was attached.
|
|
10055
10067
|
const timeStamp = e.timeStamp || _getNow();
|
|
10056
10068
|
if (skipTimestampCheck || timeStamp >= invoker.attached - 1) {
|
|
10057
|
-
callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* NATIVE_EVENT_HANDLER */, [e]);
|
|
10069
|
+
callWithAsyncErrorHandling(patchStopImmediatePropagation(e, invoker.value), instance, 5 /* ErrorCodes.NATIVE_EVENT_HANDLER */, [e]);
|
|
10058
10070
|
}
|
|
10059
10071
|
};
|
|
10060
10072
|
invoker.value = initialValue;
|
|
@@ -10411,7 +10423,7 @@ function useCssVars(getter) {
|
|
|
10411
10423
|
});
|
|
10412
10424
|
}
|
|
10413
10425
|
function setVarsOnVNode(vnode, vars) {
|
|
10414
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
10426
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
10415
10427
|
const suspense = vnode.suspense;
|
|
10416
10428
|
vnode = suspense.activeBranch;
|
|
10417
10429
|
if (suspense.pendingBranch && !suspense.isHydrating) {
|
|
@@ -10424,7 +10436,7 @@ function setVarsOnVNode(vnode, vars) {
|
|
|
10424
10436
|
while (vnode.component) {
|
|
10425
10437
|
vnode = vnode.component.subTree;
|
|
10426
10438
|
}
|
|
10427
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ && vnode.el) {
|
|
10439
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && vnode.el) {
|
|
10428
10440
|
setVarsOnNode(vnode.el, vars);
|
|
10429
10441
|
}
|
|
10430
10442
|
else if (vnode.type === Fragment) {
|