@vue/runtime-core 3.2.37 → 3.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-core.cjs.js +316 -293
- package/dist/runtime-core.cjs.prod.js +255 -238
- package/dist/runtime-core.d.ts +6 -4
- package/dist/runtime-core.esm-bundler.js +320 -299
- package/package.json +3 -3
|
@@ -14,7 +14,7 @@ function warn(msg, ...args) {
|
|
|
14
14
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
15
15
|
const trace = getComponentTrace();
|
|
16
16
|
if (appWarnHandler) {
|
|
17
|
-
callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
|
|
17
|
+
callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
|
|
18
18
|
msg + args.join(''),
|
|
19
19
|
instance && instance.proxy,
|
|
20
20
|
trace
|
|
@@ -161,7 +161,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
161
161
|
// app-level handling
|
|
162
162
|
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
163
163
|
if (appErrorHandler) {
|
|
164
|
-
callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
164
|
+
callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
165
165
|
return;
|
|
166
166
|
}
|
|
167
167
|
}
|
|
@@ -178,15 +178,11 @@ let isFlushing = false;
|
|
|
178
178
|
let isFlushPending = false;
|
|
179
179
|
const queue = [];
|
|
180
180
|
let flushIndex = 0;
|
|
181
|
-
const pendingPreFlushCbs = [];
|
|
182
|
-
let activePreFlushCbs = null;
|
|
183
|
-
let preFlushIndex = 0;
|
|
184
181
|
const pendingPostFlushCbs = [];
|
|
185
182
|
let activePostFlushCbs = null;
|
|
186
183
|
let postFlushIndex = 0;
|
|
187
184
|
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
188
185
|
let currentFlushPromise = null;
|
|
189
|
-
let currentPreFlushParentJob = null;
|
|
190
186
|
function nextTick(fn) {
|
|
191
187
|
const p = currentFlushPromise || resolvedPromise;
|
|
192
188
|
return fn ? p.then(this ? fn.bind(this) : fn) : p;
|
|
@@ -213,9 +209,8 @@ function queueJob(job) {
|
|
|
213
209
|
// if the job is a watch() callback, the search will start with a +1 index to
|
|
214
210
|
// allow it recursively trigger itself - it is the user's responsibility to
|
|
215
211
|
// ensure it doesn't end up in an infinite loop.
|
|
216
|
-
if (
|
|
217
|
-
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex))
|
|
218
|
-
job !== currentPreFlushParentJob) {
|
|
212
|
+
if (!queue.length ||
|
|
213
|
+
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
|
|
219
214
|
if (job.id == null) {
|
|
220
215
|
queue.push(job);
|
|
221
216
|
}
|
|
@@ -237,45 +232,32 @@ function invalidateJob(job) {
|
|
|
237
232
|
queue.splice(i, 1);
|
|
238
233
|
}
|
|
239
234
|
}
|
|
240
|
-
function
|
|
235
|
+
function queuePostFlushCb(cb) {
|
|
241
236
|
if (!shared.isArray(cb)) {
|
|
242
|
-
if (!
|
|
243
|
-
!
|
|
244
|
-
|
|
237
|
+
if (!activePostFlushCbs ||
|
|
238
|
+
!activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
|
|
239
|
+
pendingPostFlushCbs.push(cb);
|
|
245
240
|
}
|
|
246
241
|
}
|
|
247
242
|
else {
|
|
248
243
|
// if cb is an array, it is a component lifecycle hook which can only be
|
|
249
244
|
// triggered by a job, which is already deduped in the main queue, so
|
|
250
245
|
// we can skip duplicate check here to improve perf
|
|
251
|
-
|
|
246
|
+
pendingPostFlushCbs.push(...cb);
|
|
252
247
|
}
|
|
253
248
|
queueFlush();
|
|
254
249
|
}
|
|
255
|
-
function
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
if (pendingPreFlushCbs.length) {
|
|
263
|
-
currentPreFlushParentJob = parentJob;
|
|
264
|
-
activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
|
|
265
|
-
pendingPreFlushCbs.length = 0;
|
|
266
|
-
for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
|
267
|
-
activePreFlushCbs[preFlushIndex]();
|
|
250
|
+
function flushPreFlushCbs(seen, i = flushIndex) {
|
|
251
|
+
for (; i < queue.length; i++) {
|
|
252
|
+
const cb = queue[i];
|
|
253
|
+
if (cb && cb.pre) {
|
|
254
|
+
queue.splice(i, 1);
|
|
255
|
+
i--;
|
|
256
|
+
cb();
|
|
268
257
|
}
|
|
269
|
-
activePreFlushCbs = null;
|
|
270
|
-
preFlushIndex = 0;
|
|
271
|
-
currentPreFlushParentJob = null;
|
|
272
|
-
// recursively flush until it drains
|
|
273
|
-
flushPreFlushCbs(seen, parentJob);
|
|
274
258
|
}
|
|
275
259
|
}
|
|
276
260
|
function flushPostFlushCbs(seen) {
|
|
277
|
-
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
278
|
-
flushPreFlushCbs();
|
|
279
261
|
if (pendingPostFlushCbs.length) {
|
|
280
262
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
281
263
|
pendingPostFlushCbs.length = 0;
|
|
@@ -294,10 +276,19 @@ function flushPostFlushCbs(seen) {
|
|
|
294
276
|
}
|
|
295
277
|
}
|
|
296
278
|
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
279
|
+
const comparator = (a, b) => {
|
|
280
|
+
const diff = getId(a) - getId(b);
|
|
281
|
+
if (diff === 0) {
|
|
282
|
+
if (a.pre && !b.pre)
|
|
283
|
+
return -1;
|
|
284
|
+
if (b.pre && !a.pre)
|
|
285
|
+
return 1;
|
|
286
|
+
}
|
|
287
|
+
return diff;
|
|
288
|
+
};
|
|
297
289
|
function flushJobs(seen) {
|
|
298
290
|
isFlushPending = false;
|
|
299
291
|
isFlushing = true;
|
|
300
|
-
flushPreFlushCbs(seen);
|
|
301
292
|
// Sort queue before flush.
|
|
302
293
|
// This ensures that:
|
|
303
294
|
// 1. Components are updated from parent to child. (because parent is always
|
|
@@ -305,7 +296,7 @@ function flushJobs(seen) {
|
|
|
305
296
|
// priority number)
|
|
306
297
|
// 2. If a component is unmounted during a parent component's update,
|
|
307
298
|
// its update can be skipped.
|
|
308
|
-
queue.sort(
|
|
299
|
+
queue.sort(comparator);
|
|
309
300
|
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
310
301
|
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
311
302
|
// inside try-catch. This can leave all warning code unshaked. Although
|
|
@@ -318,7 +309,7 @@ function flushJobs(seen) {
|
|
|
318
309
|
if (job && job.active !== false) {
|
|
319
310
|
if (false && check(job)) ;
|
|
320
311
|
// console.log(`running:`, job.id)
|
|
321
|
-
callWithErrorHandling(job, null, 14 /* SCHEDULER */);
|
|
312
|
+
callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
|
|
322
313
|
}
|
|
323
314
|
}
|
|
324
315
|
}
|
|
@@ -330,10 +321,8 @@ function flushJobs(seen) {
|
|
|
330
321
|
currentFlushPromise = null;
|
|
331
322
|
// some postFlushCb queued jobs!
|
|
332
323
|
// keep flushing until it drains.
|
|
333
|
-
if (queue.length ||
|
|
334
|
-
|
|
335
|
-
pendingPostFlushCbs.length) {
|
|
336
|
-
flushJobs(seen);
|
|
324
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
325
|
+
flushJobs();
|
|
337
326
|
}
|
|
338
327
|
}
|
|
339
328
|
}
|
|
@@ -403,7 +392,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
403
392
|
handler = props[(handlerName = shared.toHandlerKey(shared.hyphenate(event)))];
|
|
404
393
|
}
|
|
405
394
|
if (handler) {
|
|
406
|
-
callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
395
|
+
callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
407
396
|
}
|
|
408
397
|
const onceHandler = props[handlerName + `Once`];
|
|
409
398
|
if (onceHandler) {
|
|
@@ -414,7 +403,7 @@ function emit(instance, event, ...rawArgs) {
|
|
|
414
403
|
return;
|
|
415
404
|
}
|
|
416
405
|
instance.emitted[handlerName] = true;
|
|
417
|
-
callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
406
|
+
callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
418
407
|
}
|
|
419
408
|
}
|
|
420
409
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
@@ -446,7 +435,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
446
435
|
}
|
|
447
436
|
}
|
|
448
437
|
if (!raw && !hasExtends) {
|
|
449
|
-
|
|
438
|
+
if (shared.isObject(comp)) {
|
|
439
|
+
cache.set(comp, null);
|
|
440
|
+
}
|
|
450
441
|
return null;
|
|
451
442
|
}
|
|
452
443
|
if (shared.isArray(raw)) {
|
|
@@ -455,7 +446,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
455
446
|
else {
|
|
456
447
|
shared.extend(normalized, raw);
|
|
457
448
|
}
|
|
458
|
-
|
|
449
|
+
if (shared.isObject(comp)) {
|
|
450
|
+
cache.set(comp, normalized);
|
|
451
|
+
}
|
|
459
452
|
return normalized;
|
|
460
453
|
}
|
|
461
454
|
// Check if an incoming prop key is a declared emit event listener.
|
|
@@ -561,7 +554,7 @@ function renderComponentRoot(instance) {
|
|
|
561
554
|
let fallthroughAttrs;
|
|
562
555
|
const prev = setCurrentRenderingInstance(instance);
|
|
563
556
|
try {
|
|
564
|
-
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
557
|
+
if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
|
|
565
558
|
// withProxy is a proxy with a different `has` trap only for
|
|
566
559
|
// runtime-compiled render functions using `with` block.
|
|
567
560
|
const proxyToUse = withProxy || proxy;
|
|
@@ -592,7 +585,7 @@ function renderComponentRoot(instance) {
|
|
|
592
585
|
}
|
|
593
586
|
catch (err) {
|
|
594
587
|
blockStack.length = 0;
|
|
595
|
-
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
588
|
+
handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
|
|
596
589
|
result = createVNode(Comment);
|
|
597
590
|
}
|
|
598
591
|
// attr merging
|
|
@@ -603,7 +596,7 @@ function renderComponentRoot(instance) {
|
|
|
603
596
|
const keys = Object.keys(fallthroughAttrs);
|
|
604
597
|
const { shapeFlag } = root;
|
|
605
598
|
if (keys.length) {
|
|
606
|
-
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
599
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
|
|
607
600
|
if (propsOptions && keys.some(shared.isModelListener)) {
|
|
608
601
|
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
609
602
|
// prop, it indicates this component expects to handle v-model and
|
|
@@ -680,19 +673,19 @@ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
|
680
673
|
return true;
|
|
681
674
|
}
|
|
682
675
|
if (optimized && patchFlag >= 0) {
|
|
683
|
-
if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
|
|
676
|
+
if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
|
|
684
677
|
// slot content that references values that might have changed,
|
|
685
678
|
// e.g. in a v-for
|
|
686
679
|
return true;
|
|
687
680
|
}
|
|
688
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
681
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
689
682
|
if (!prevProps) {
|
|
690
683
|
return !!nextProps;
|
|
691
684
|
}
|
|
692
685
|
// presence of this flag indicates props are always non-null
|
|
693
686
|
return hasPropsChanged(prevProps, nextProps, emits);
|
|
694
687
|
}
|
|
695
|
-
else if (patchFlag & 8 /* PROPS */) {
|
|
688
|
+
else if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
696
689
|
const dynamicProps = nextVNode.dynamicProps;
|
|
697
690
|
for (let i = 0; i < dynamicProps.length; i++) {
|
|
698
691
|
const key = dynamicProps[i];
|
|
@@ -935,7 +928,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
935
928
|
if (delayEnter) {
|
|
936
929
|
activeBranch.transition.afterLeave = () => {
|
|
937
930
|
if (pendingId === suspense.pendingId) {
|
|
938
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
931
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
939
932
|
}
|
|
940
933
|
};
|
|
941
934
|
}
|
|
@@ -950,7 +943,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
950
943
|
}
|
|
951
944
|
if (!delayEnter) {
|
|
952
945
|
// move content from off-dom container to actual container
|
|
953
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
946
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
954
947
|
}
|
|
955
948
|
}
|
|
956
949
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -1024,7 +1017,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1024
1017
|
const hydratedEl = instance.vnode.el;
|
|
1025
1018
|
instance
|
|
1026
1019
|
.asyncDep.catch(err => {
|
|
1027
|
-
handleError(err, instance, 0 /* SETUP_FUNCTION */);
|
|
1020
|
+
handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
1028
1021
|
})
|
|
1029
1022
|
.then(asyncSetupResult => {
|
|
1030
1023
|
// retry when the setup() promise resolves.
|
|
@@ -1092,7 +1085,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
|
|
|
1092
1085
|
}
|
|
1093
1086
|
function normalizeSuspenseChildren(vnode) {
|
|
1094
1087
|
const { shapeFlag, children } = vnode;
|
|
1095
|
-
const isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */;
|
|
1088
|
+
const isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
1096
1089
|
vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
|
|
1097
1090
|
vnode.ssFallback = isSlotChildren
|
|
1098
1091
|
? normalizeSuspenseSlot(children.fallback)
|
|
@@ -1232,7 +1225,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1232
1225
|
return traverse(s);
|
|
1233
1226
|
}
|
|
1234
1227
|
else if (shared.isFunction(s)) {
|
|
1235
|
-
return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
|
|
1228
|
+
return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
1236
1229
|
}
|
|
1237
1230
|
else ;
|
|
1238
1231
|
});
|
|
@@ -1240,7 +1233,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1240
1233
|
else if (shared.isFunction(source)) {
|
|
1241
1234
|
if (cb) {
|
|
1242
1235
|
// getter with cb
|
|
1243
|
-
getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
|
|
1236
|
+
getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
1244
1237
|
}
|
|
1245
1238
|
else {
|
|
1246
1239
|
// no cb -> simple effect
|
|
@@ -1251,7 +1244,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1251
1244
|
if (cleanup) {
|
|
1252
1245
|
cleanup();
|
|
1253
1246
|
}
|
|
1254
|
-
return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
|
|
1247
|
+
return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
|
|
1255
1248
|
};
|
|
1256
1249
|
}
|
|
1257
1250
|
}
|
|
@@ -1265,7 +1258,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1265
1258
|
let cleanup;
|
|
1266
1259
|
let onCleanup = (fn) => {
|
|
1267
1260
|
cleanup = effect.onStop = () => {
|
|
1268
|
-
callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
|
|
1261
|
+
callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
|
|
1269
1262
|
};
|
|
1270
1263
|
};
|
|
1271
1264
|
// in SSR there is no need to setup an actual effect, and it should be noop
|
|
@@ -1277,7 +1270,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1277
1270
|
getter();
|
|
1278
1271
|
}
|
|
1279
1272
|
else if (immediate) {
|
|
1280
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
1273
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
1281
1274
|
getter(),
|
|
1282
1275
|
isMultiSource ? [] : undefined,
|
|
1283
1276
|
onCleanup
|
|
@@ -1303,7 +1296,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1303
1296
|
if (cleanup) {
|
|
1304
1297
|
cleanup();
|
|
1305
1298
|
}
|
|
1306
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
1299
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
1307
1300
|
newValue,
|
|
1308
1301
|
// pass undefined as the old value when it's changed for the first time
|
|
1309
1302
|
oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
|
@@ -1329,7 +1322,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1329
1322
|
}
|
|
1330
1323
|
else {
|
|
1331
1324
|
// default: 'pre'
|
|
1332
|
-
|
|
1325
|
+
job.pre = true;
|
|
1326
|
+
if (instance)
|
|
1327
|
+
job.id = instance.uid;
|
|
1328
|
+
scheduler = () => queueJob(job);
|
|
1333
1329
|
}
|
|
1334
1330
|
const effect = new reactivity.ReactiveEffect(getter, scheduler);
|
|
1335
1331
|
// initial run
|
|
@@ -1392,7 +1388,7 @@ function createPathGetter(ctx, path) {
|
|
|
1392
1388
|
};
|
|
1393
1389
|
}
|
|
1394
1390
|
function traverse(value, seen) {
|
|
1395
|
-
if (!shared.isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
1391
|
+
if (!shared.isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
|
|
1396
1392
|
return value;
|
|
1397
1393
|
}
|
|
1398
1394
|
seen = seen || new Set();
|
|
@@ -1562,7 +1558,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
1562
1558
|
const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
|
1563
1559
|
const callHook = (hook, args) => {
|
|
1564
1560
|
hook &&
|
|
1565
|
-
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
1561
|
+
callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
|
|
1566
1562
|
};
|
|
1567
1563
|
const callAsyncHook = (hook, args) => {
|
|
1568
1564
|
const done = args[1];
|
|
@@ -1698,10 +1694,10 @@ function getKeepAliveChild(vnode) {
|
|
|
1698
1694
|
: vnode;
|
|
1699
1695
|
}
|
|
1700
1696
|
function setTransitionHooks(vnode, hooks) {
|
|
1701
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
|
|
1697
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
|
|
1702
1698
|
setTransitionHooks(vnode.component.subTree, hooks);
|
|
1703
1699
|
}
|
|
1704
|
-
else if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
1700
|
+
else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
1705
1701
|
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
1706
1702
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
1707
1703
|
}
|
|
@@ -1720,7 +1716,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
1720
1716
|
: String(parentKey) + String(child.key != null ? child.key : i);
|
|
1721
1717
|
// handle fragment children case, e.g. v-for
|
|
1722
1718
|
if (child.type === Fragment) {
|
|
1723
|
-
if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
|
|
1719
|
+
if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */)
|
|
1724
1720
|
keyedFragmentCount++;
|
|
1725
1721
|
ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
|
|
1726
1722
|
}
|
|
@@ -1735,7 +1731,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
1735
1731
|
// these children to force full diffs to ensure correct behavior.
|
|
1736
1732
|
if (keyedFragmentCount > 1) {
|
|
1737
1733
|
for (let i = 0; i < ret.length; i++) {
|
|
1738
|
-
ret[i].patchFlag = -2 /* BAIL */;
|
|
1734
|
+
ret[i].patchFlag = -2 /* PatchFlags.BAIL */;
|
|
1739
1735
|
}
|
|
1740
1736
|
}
|
|
1741
1737
|
return ret;
|
|
@@ -1806,7 +1802,7 @@ function defineAsyncComponent(source) {
|
|
|
1806
1802
|
}
|
|
1807
1803
|
const onError = (err) => {
|
|
1808
1804
|
pendingRequest = null;
|
|
1809
|
-
handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
1805
|
+
handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
1810
1806
|
};
|
|
1811
1807
|
// suspense-controlled or SSR.
|
|
1812
1808
|
if ((suspensible && instance.suspense) ||
|
|
@@ -1913,7 +1909,7 @@ const KeepAliveImpl = {
|
|
|
1913
1909
|
const storageContainer = createElement('div');
|
|
1914
1910
|
sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
|
1915
1911
|
const instance = vnode.component;
|
|
1916
|
-
move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
|
|
1912
|
+
move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
|
|
1917
1913
|
// in case props have changed
|
|
1918
1914
|
patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
|
|
1919
1915
|
queuePostRenderEffect(() => {
|
|
@@ -1929,7 +1925,7 @@ const KeepAliveImpl = {
|
|
|
1929
1925
|
};
|
|
1930
1926
|
sharedContext.deactivate = (vnode) => {
|
|
1931
1927
|
const instance = vnode.component;
|
|
1932
|
-
move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
|
|
1928
|
+
move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
|
|
1933
1929
|
queuePostRenderEffect(() => {
|
|
1934
1930
|
if (instance.da) {
|
|
1935
1931
|
shared.invokeArrayFns(instance.da);
|
|
@@ -2011,8 +2007,8 @@ const KeepAliveImpl = {
|
|
|
2011
2007
|
return children;
|
|
2012
2008
|
}
|
|
2013
2009
|
else if (!isVNode(rawVNode) ||
|
|
2014
|
-
(!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&
|
|
2015
|
-
!(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {
|
|
2010
|
+
(!(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) &&
|
|
2011
|
+
!(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */))) {
|
|
2016
2012
|
current = null;
|
|
2017
2013
|
return rawVNode;
|
|
2018
2014
|
}
|
|
@@ -2034,7 +2030,7 @@ const KeepAliveImpl = {
|
|
|
2034
2030
|
// clone vnode if it's reused because we are going to mutate it
|
|
2035
2031
|
if (vnode.el) {
|
|
2036
2032
|
vnode = cloneVNode(vnode);
|
|
2037
|
-
if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
|
|
2033
|
+
if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
2038
2034
|
rawVNode.ssContent = vnode;
|
|
2039
2035
|
}
|
|
2040
2036
|
}
|
|
@@ -2053,7 +2049,7 @@ const KeepAliveImpl = {
|
|
|
2053
2049
|
setTransitionHooks(vnode, vnode.transition);
|
|
2054
2050
|
}
|
|
2055
2051
|
// avoid vnode being mounted as fresh
|
|
2056
|
-
vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
2052
|
+
vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
2057
2053
|
// make this key the freshest
|
|
2058
2054
|
keys.delete(key);
|
|
2059
2055
|
keys.add(key);
|
|
@@ -2066,7 +2062,7 @@ const KeepAliveImpl = {
|
|
|
2066
2062
|
}
|
|
2067
2063
|
}
|
|
2068
2064
|
// avoid vnode being unmounted
|
|
2069
|
-
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2065
|
+
vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2070
2066
|
current = vnode;
|
|
2071
2067
|
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
2072
2068
|
};
|
|
@@ -2089,10 +2085,10 @@ function matches(pattern, name) {
|
|
|
2089
2085
|
return false;
|
|
2090
2086
|
}
|
|
2091
2087
|
function onActivated(hook, target) {
|
|
2092
|
-
registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
|
|
2088
|
+
registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
|
|
2093
2089
|
}
|
|
2094
2090
|
function onDeactivated(hook, target) {
|
|
2095
|
-
registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
|
|
2091
|
+
registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
|
|
2096
2092
|
}
|
|
2097
2093
|
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
2098
2094
|
// cache the deactivate branch check wrapper for injected hooks so the same
|
|
@@ -2136,16 +2132,16 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
|
2136
2132
|
}
|
|
2137
2133
|
function resetShapeFlag(vnode) {
|
|
2138
2134
|
let shapeFlag = vnode.shapeFlag;
|
|
2139
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
2140
|
-
shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2135
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
2136
|
+
shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2141
2137
|
}
|
|
2142
|
-
if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
2143
|
-
shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
2138
|
+
if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
2139
|
+
shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
2144
2140
|
}
|
|
2145
2141
|
vnode.shapeFlag = shapeFlag;
|
|
2146
2142
|
}
|
|
2147
2143
|
function getInnerChild(vnode) {
|
|
2148
|
-
return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
|
|
2144
|
+
return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
|
|
2149
2145
|
}
|
|
2150
2146
|
|
|
2151
2147
|
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
@@ -2182,19 +2178,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2182
2178
|
}
|
|
2183
2179
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
2184
2180
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
2185
|
-
(!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
|
|
2181
|
+
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
2186
2182
|
injectHook(lifecycle, hook, target);
|
|
2187
|
-
const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
|
|
2188
|
-
const onMounted = createHook("m" /* MOUNTED */);
|
|
2189
|
-
const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
|
|
2190
|
-
const onUpdated = createHook("u" /* UPDATED */);
|
|
2191
|
-
const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
|
|
2192
|
-
const onUnmounted = createHook("um" /* UNMOUNTED */);
|
|
2193
|
-
const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
|
|
2194
|
-
const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
|
|
2195
|
-
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
|
|
2183
|
+
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
2184
|
+
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
2185
|
+
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
2186
|
+
const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
|
|
2187
|
+
const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
|
|
2188
|
+
const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
|
|
2189
|
+
const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
|
|
2190
|
+
const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
|
|
2191
|
+
const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
|
|
2196
2192
|
function onErrorCaptured(hook, target = currentInstance) {
|
|
2197
|
-
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
2193
|
+
injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
|
|
2198
2194
|
}
|
|
2199
2195
|
|
|
2200
2196
|
/**
|
|
@@ -2255,7 +2251,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
2255
2251
|
// disable tracking inside all lifecycle hooks
|
|
2256
2252
|
// since they can potentially be called inside effects.
|
|
2257
2253
|
reactivity.pauseTracking();
|
|
2258
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
2254
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [
|
|
2259
2255
|
vnode.el,
|
|
2260
2256
|
binding,
|
|
2261
2257
|
vnode,
|
|
@@ -2383,7 +2379,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2383
2379
|
}
|
|
2384
2380
|
else if (slot) {
|
|
2385
2381
|
// conditional single slot generated by <template v-if="..." #foo>
|
|
2386
|
-
slots[slot.name] = slot.
|
|
2382
|
+
slots[slot.name] = slot.key
|
|
2383
|
+
? (...args) => {
|
|
2384
|
+
const res = slot.fn(...args);
|
|
2385
|
+
res.key = slot.key;
|
|
2386
|
+
return res;
|
|
2387
|
+
}
|
|
2388
|
+
: slot.fn;
|
|
2387
2389
|
}
|
|
2388
2390
|
}
|
|
2389
2391
|
return slots;
|
|
@@ -2413,9 +2415,15 @@ fallback, noSlotted) {
|
|
|
2413
2415
|
}
|
|
2414
2416
|
openBlock();
|
|
2415
2417
|
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
2416
|
-
const rendered = createBlock(Fragment, {
|
|
2417
|
-
|
|
2418
|
-
|
|
2418
|
+
const rendered = createBlock(Fragment, {
|
|
2419
|
+
key: props.key ||
|
|
2420
|
+
// slot content array of a dynamic conditional slot may have a branch
|
|
2421
|
+
// key attached in the `createSlots` helper, respect that
|
|
2422
|
+
(validSlotContent && validSlotContent.key) ||
|
|
2423
|
+
`_${name}`
|
|
2424
|
+
}, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */
|
|
2425
|
+
? 64 /* PatchFlags.STABLE_FRAGMENT */
|
|
2426
|
+
: -2 /* PatchFlags.BAIL */);
|
|
2419
2427
|
if (!noSlotted && rendered.scopeId) {
|
|
2420
2428
|
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
2421
2429
|
}
|
|
@@ -2443,10 +2451,12 @@ function ensureValidVNode(vnodes) {
|
|
|
2443
2451
|
* For prefixing keys in v-on="obj" with "on"
|
|
2444
2452
|
* @private
|
|
2445
2453
|
*/
|
|
2446
|
-
function toHandlers(obj) {
|
|
2454
|
+
function toHandlers(obj, preserveCaseIfNecessary) {
|
|
2447
2455
|
const ret = {};
|
|
2448
2456
|
for (const key in obj) {
|
|
2449
|
-
ret[
|
|
2457
|
+
ret[preserveCaseIfNecessary && /[A-Z]/.test(key)
|
|
2458
|
+
? `on:${key}`
|
|
2459
|
+
: shared.toHandlerKey(key)] = obj[key];
|
|
2450
2460
|
}
|
|
2451
2461
|
return ret;
|
|
2452
2462
|
}
|
|
@@ -2496,23 +2506,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
2496
2506
|
const n = accessCache[key];
|
|
2497
2507
|
if (n !== undefined) {
|
|
2498
2508
|
switch (n) {
|
|
2499
|
-
case 1 /* SETUP */:
|
|
2509
|
+
case 1 /* AccessTypes.SETUP */:
|
|
2500
2510
|
return setupState[key];
|
|
2501
|
-
case 2 /* DATA */:
|
|
2511
|
+
case 2 /* AccessTypes.DATA */:
|
|
2502
2512
|
return data[key];
|
|
2503
|
-
case 4 /* CONTEXT */:
|
|
2513
|
+
case 4 /* AccessTypes.CONTEXT */:
|
|
2504
2514
|
return ctx[key];
|
|
2505
|
-
case 3 /* PROPS */:
|
|
2515
|
+
case 3 /* AccessTypes.PROPS */:
|
|
2506
2516
|
return props[key];
|
|
2507
2517
|
// default: just fallthrough
|
|
2508
2518
|
}
|
|
2509
2519
|
}
|
|
2510
2520
|
else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
2511
|
-
accessCache[key] = 1 /* SETUP */;
|
|
2521
|
+
accessCache[key] = 1 /* AccessTypes.SETUP */;
|
|
2512
2522
|
return setupState[key];
|
|
2513
2523
|
}
|
|
2514
2524
|
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
2515
|
-
accessCache[key] = 2 /* DATA */;
|
|
2525
|
+
accessCache[key] = 2 /* AccessTypes.DATA */;
|
|
2516
2526
|
return data[key];
|
|
2517
2527
|
}
|
|
2518
2528
|
else if (
|
|
@@ -2520,15 +2530,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
2520
2530
|
// props
|
|
2521
2531
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
2522
2532
|
shared.hasOwn(normalizedProps, key)) {
|
|
2523
|
-
accessCache[key] = 3 /* PROPS */;
|
|
2533
|
+
accessCache[key] = 3 /* AccessTypes.PROPS */;
|
|
2524
2534
|
return props[key];
|
|
2525
2535
|
}
|
|
2526
2536
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
2527
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
2537
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
2528
2538
|
return ctx[key];
|
|
2529
2539
|
}
|
|
2530
2540
|
else if (shouldCacheAccess) {
|
|
2531
|
-
accessCache[key] = 0 /* OTHER */;
|
|
2541
|
+
accessCache[key] = 0 /* AccessTypes.OTHER */;
|
|
2532
2542
|
}
|
|
2533
2543
|
}
|
|
2534
2544
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -2536,7 +2546,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
2536
2546
|
// public $xxx properties
|
|
2537
2547
|
if (publicGetter) {
|
|
2538
2548
|
if (key === '$attrs') {
|
|
2539
|
-
reactivity.track(instance, "get" /* GET */, key);
|
|
2549
|
+
reactivity.track(instance, "get" /* TrackOpTypes.GET */, key);
|
|
2540
2550
|
}
|
|
2541
2551
|
return publicGetter(instance);
|
|
2542
2552
|
}
|
|
@@ -2548,7 +2558,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
2548
2558
|
}
|
|
2549
2559
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
2550
2560
|
// user may set custom properties to `this` that start with `$`
|
|
2551
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
2561
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
2552
2562
|
return ctx[key];
|
|
2553
2563
|
}
|
|
2554
2564
|
else if (
|
|
@@ -2629,7 +2639,7 @@ function applyOptions(instance) {
|
|
|
2629
2639
|
// call beforeCreate first before accessing other options since
|
|
2630
2640
|
// the hook may mutate resolved options (#2791)
|
|
2631
2641
|
if (options.beforeCreate) {
|
|
2632
|
-
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
2642
|
+
callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
|
|
2633
2643
|
}
|
|
2634
2644
|
const {
|
|
2635
2645
|
// state
|
|
@@ -2710,7 +2720,7 @@ function applyOptions(instance) {
|
|
|
2710
2720
|
});
|
|
2711
2721
|
}
|
|
2712
2722
|
if (created) {
|
|
2713
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
2723
|
+
callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
|
|
2714
2724
|
}
|
|
2715
2725
|
function registerLifecycleHook(register, hook) {
|
|
2716
2726
|
if (shared.isArray(hook)) {
|
|
@@ -2856,7 +2866,9 @@ function resolveMergedOptions(instance) {
|
|
|
2856
2866
|
}
|
|
2857
2867
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
2858
2868
|
}
|
|
2859
|
-
|
|
2869
|
+
if (shared.isObject(base)) {
|
|
2870
|
+
cache.set(base, resolved);
|
|
2871
|
+
}
|
|
2860
2872
|
return resolved;
|
|
2861
2873
|
}
|
|
2862
2874
|
function mergeOptions(to, from, strats, asMixin = false) {
|
|
@@ -2988,8 +3000,8 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
2988
3000
|
// - #1942 if hmr is enabled with sfc component
|
|
2989
3001
|
// - vite#872 non-sfc component used by sfc component
|
|
2990
3002
|
(optimized || patchFlag > 0) &&
|
|
2991
|
-
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
2992
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
3003
|
+
!(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
|
|
3004
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
2993
3005
|
// Compiler-generated props & no keys change, just set the updated
|
|
2994
3006
|
// the props.
|
|
2995
3007
|
const propsToUpdate = instance.vnode.dynamicProps;
|
|
@@ -3068,7 +3080,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3068
3080
|
}
|
|
3069
3081
|
// trigger updates for $attrs in case it's used in component slots
|
|
3070
3082
|
if (hasAttrsChanged) {
|
|
3071
|
-
reactivity.trigger(instance, "set" /* SET */, '$attrs');
|
|
3083
|
+
reactivity.trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
|
|
3072
3084
|
}
|
|
3073
3085
|
}
|
|
3074
3086
|
function setFullProps(instance, rawProps, props, attrs) {
|
|
@@ -3134,11 +3146,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
3134
3146
|
}
|
|
3135
3147
|
}
|
|
3136
3148
|
// boolean casting
|
|
3137
|
-
if (opt[0 /* shouldCast */]) {
|
|
3149
|
+
if (opt[0 /* BooleanFlags.shouldCast */]) {
|
|
3138
3150
|
if (isAbsent && !hasDefault) {
|
|
3139
3151
|
value = false;
|
|
3140
3152
|
}
|
|
3141
|
-
else if (opt[1 /* shouldCastTrue */] &&
|
|
3153
|
+
else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
|
|
3142
3154
|
(value === '' || value === shared.hyphenate(key))) {
|
|
3143
3155
|
value = true;
|
|
3144
3156
|
}
|
|
@@ -3176,7 +3188,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3176
3188
|
}
|
|
3177
3189
|
}
|
|
3178
3190
|
if (!raw && !hasExtends) {
|
|
3179
|
-
|
|
3191
|
+
if (shared.isObject(comp)) {
|
|
3192
|
+
cache.set(comp, shared.EMPTY_ARR);
|
|
3193
|
+
}
|
|
3180
3194
|
return shared.EMPTY_ARR;
|
|
3181
3195
|
}
|
|
3182
3196
|
if (shared.isArray(raw)) {
|
|
@@ -3197,8 +3211,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3197
3211
|
if (prop) {
|
|
3198
3212
|
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
3199
3213
|
const stringIndex = getTypeIndex(String, prop.type);
|
|
3200
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
3201
|
-
prop[1 /* shouldCastTrue */] =
|
|
3214
|
+
prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
|
|
3215
|
+
prop[1 /* BooleanFlags.shouldCastTrue */] =
|
|
3202
3216
|
stringIndex < 0 || booleanIndex < stringIndex;
|
|
3203
3217
|
// if the prop needs boolean casting or default value
|
|
3204
3218
|
if (booleanIndex > -1 || shared.hasOwn(prop, 'default')) {
|
|
@@ -3209,7 +3223,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3209
3223
|
}
|
|
3210
3224
|
}
|
|
3211
3225
|
const res = [normalized, needCastKeys];
|
|
3212
|
-
|
|
3226
|
+
if (shared.isObject(comp)) {
|
|
3227
|
+
cache.set(comp, res);
|
|
3228
|
+
}
|
|
3213
3229
|
return res;
|
|
3214
3230
|
}
|
|
3215
3231
|
function validatePropName(key) {
|
|
@@ -3272,7 +3288,7 @@ const normalizeVNodeSlots = (instance, children) => {
|
|
|
3272
3288
|
instance.slots.default = () => normalized;
|
|
3273
3289
|
};
|
|
3274
3290
|
const initSlots = (instance, children) => {
|
|
3275
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
3291
|
+
if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
3276
3292
|
const type = children._;
|
|
3277
3293
|
if (type) {
|
|
3278
3294
|
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
@@ -3297,11 +3313,11 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
3297
3313
|
const { vnode, slots } = instance;
|
|
3298
3314
|
let needDeletionCheck = true;
|
|
3299
3315
|
let deletionComparisonTarget = shared.EMPTY_OBJ;
|
|
3300
|
-
if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
3316
|
+
if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
3301
3317
|
const type = children._;
|
|
3302
3318
|
if (type) {
|
|
3303
3319
|
// compiled slots.
|
|
3304
|
-
if (optimized && type === 1 /* STABLE */) {
|
|
3320
|
+
if (optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
3305
3321
|
// compiled AND stable.
|
|
3306
3322
|
// no need to update, and skip stale slots removal.
|
|
3307
3323
|
needDeletionCheck = false;
|
|
@@ -3314,7 +3330,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
3314
3330
|
// when rendering the optimized slots by manually written render function,
|
|
3315
3331
|
// we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
|
|
3316
3332
|
// i.e. let the `renderSlot` create the bailed Fragment
|
|
3317
|
-
if (!optimized && type === 1 /* STABLE */) {
|
|
3333
|
+
if (!optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
3318
3334
|
delete slots._;
|
|
3319
3335
|
}
|
|
3320
3336
|
}
|
|
@@ -3467,7 +3483,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
3467
3483
|
// because the template ref is forwarded to inner component
|
|
3468
3484
|
return;
|
|
3469
3485
|
}
|
|
3470
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
3486
|
+
const refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
3471
3487
|
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
3472
3488
|
: vnode.el;
|
|
3473
3489
|
const value = isUnmount ? null : refValue;
|
|
@@ -3488,7 +3504,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
3488
3504
|
}
|
|
3489
3505
|
}
|
|
3490
3506
|
if (shared.isFunction(ref)) {
|
|
3491
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
3507
|
+
callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
|
|
3492
3508
|
}
|
|
3493
3509
|
else {
|
|
3494
3510
|
const _isString = shared.isString(ref);
|
|
@@ -3545,7 +3561,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
3545
3561
|
|
|
3546
3562
|
let hasMismatch = false;
|
|
3547
3563
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
3548
|
-
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
3564
|
+
const isComment = (node) => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
|
|
3549
3565
|
// Note: hydration is DOM-specific
|
|
3550
3566
|
// But we have to place it in core due to tight coupling with core - splitting
|
|
3551
3567
|
// it out creates a ton of unnecessary complexity.
|
|
@@ -3575,14 +3591,14 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3575
3591
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
3576
3592
|
const domType = node.nodeType;
|
|
3577
3593
|
vnode.el = node;
|
|
3578
|
-
if (patchFlag === -2 /* BAIL */) {
|
|
3594
|
+
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
3579
3595
|
optimized = false;
|
|
3580
3596
|
vnode.dynamicChildren = null;
|
|
3581
3597
|
}
|
|
3582
3598
|
let nextNode = null;
|
|
3583
3599
|
switch (type) {
|
|
3584
3600
|
case Text:
|
|
3585
|
-
if (domType !== 3 /* TEXT */) {
|
|
3601
|
+
if (domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
3586
3602
|
// #5728 empty text node inside a slot can cause hydration failure
|
|
3587
3603
|
// because the server rendered HTML won't contain a text node
|
|
3588
3604
|
if (vnode.children === '') {
|
|
@@ -3602,7 +3618,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3602
3618
|
}
|
|
3603
3619
|
break;
|
|
3604
3620
|
case Comment:
|
|
3605
|
-
if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
3621
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
|
|
3606
3622
|
nextNode = onMismatch();
|
|
3607
3623
|
}
|
|
3608
3624
|
else {
|
|
@@ -3610,7 +3626,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3610
3626
|
}
|
|
3611
3627
|
break;
|
|
3612
3628
|
case Static:
|
|
3613
|
-
if (domType !== 1 /* ELEMENT */ && domType !== 3 /* TEXT */) {
|
|
3629
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
3614
3630
|
nextNode = onMismatch();
|
|
3615
3631
|
}
|
|
3616
3632
|
else {
|
|
@@ -3622,7 +3638,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3622
3638
|
for (let i = 0; i < vnode.staticCount; i++) {
|
|
3623
3639
|
if (needToAdoptContent)
|
|
3624
3640
|
vnode.children +=
|
|
3625
|
-
nextNode.nodeType === 1 /* ELEMENT */
|
|
3641
|
+
nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
|
|
3626
3642
|
? nextNode.outerHTML
|
|
3627
3643
|
: nextNode.data;
|
|
3628
3644
|
if (i === vnode.staticCount - 1) {
|
|
@@ -3642,8 +3658,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3642
3658
|
}
|
|
3643
3659
|
break;
|
|
3644
3660
|
default:
|
|
3645
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
3646
|
-
if (domType !== 1 /* ELEMENT */ ||
|
|
3661
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
3662
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
|
|
3647
3663
|
vnode.type.toLowerCase() !==
|
|
3648
3664
|
node.tagName.toLowerCase()) {
|
|
3649
3665
|
nextNode = onMismatch();
|
|
@@ -3652,7 +3668,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3652
3668
|
nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
3653
3669
|
}
|
|
3654
3670
|
}
|
|
3655
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
3671
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
3656
3672
|
// when setting up the render effect, if the initial vnode already
|
|
3657
3673
|
// has .el set, the component will perform hydration instead of mount
|
|
3658
3674
|
// on its sub-tree.
|
|
@@ -3691,15 +3707,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3691
3707
|
vnode.component.subTree = subTree;
|
|
3692
3708
|
}
|
|
3693
3709
|
}
|
|
3694
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
3695
|
-
if (domType !== 8 /* COMMENT */) {
|
|
3710
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
3711
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
|
|
3696
3712
|
nextNode = onMismatch();
|
|
3697
3713
|
}
|
|
3698
3714
|
else {
|
|
3699
3715
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
3700
3716
|
}
|
|
3701
3717
|
}
|
|
3702
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
3718
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
3703
3719
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
3704
3720
|
}
|
|
3705
3721
|
else ;
|
|
@@ -3717,7 +3733,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3717
3733
|
const forcePatchValue = (type === 'input' && dirs) || type === 'option';
|
|
3718
3734
|
// skip props & children if this is hoisted static nodes
|
|
3719
3735
|
// #5405 in dev, always hydrate children for HMR
|
|
3720
|
-
if (forcePatchValue || patchFlag !== -1 /* HOISTED */) {
|
|
3736
|
+
if (forcePatchValue || patchFlag !== -1 /* PatchFlags.HOISTED */) {
|
|
3721
3737
|
if (dirs) {
|
|
3722
3738
|
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
|
3723
3739
|
}
|
|
@@ -3725,7 +3741,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3725
3741
|
if (props) {
|
|
3726
3742
|
if (forcePatchValue ||
|
|
3727
3743
|
!optimized ||
|
|
3728
|
-
patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
|
|
3744
|
+
patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
|
|
3729
3745
|
for (const key in props) {
|
|
3730
3746
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
3731
3747
|
(shared.isOn(key) && !shared.isReservedProp(key))) {
|
|
@@ -3754,7 +3770,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3754
3770
|
}, parentSuspense);
|
|
3755
3771
|
}
|
|
3756
3772
|
// children
|
|
3757
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
|
|
3773
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
|
|
3758
3774
|
// skip if element has innerHTML / textContent
|
|
3759
3775
|
!(props && (props.innerHTML || props.textContent))) {
|
|
3760
3776
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -3766,7 +3782,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3766
3782
|
remove(cur);
|
|
3767
3783
|
}
|
|
3768
3784
|
}
|
|
3769
|
-
else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
3785
|
+
else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
3770
3786
|
if (el.textContent !== vnode.children) {
|
|
3771
3787
|
hasMismatch = true;
|
|
3772
3788
|
el.textContent = vnode.children;
|
|
@@ -3905,7 +3921,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3905
3921
|
unmount(n1, parentComponent, parentSuspense, true);
|
|
3906
3922
|
n1 = null;
|
|
3907
3923
|
}
|
|
3908
|
-
if (n2.patchFlag === -2 /* BAIL */) {
|
|
3924
|
+
if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
3909
3925
|
optimized = false;
|
|
3910
3926
|
n2.dynamicChildren = null;
|
|
3911
3927
|
}
|
|
@@ -3926,16 +3942,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3926
3942
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
3927
3943
|
break;
|
|
3928
3944
|
default:
|
|
3929
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
3945
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
3930
3946
|
processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
3931
3947
|
}
|
|
3932
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
3948
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
3933
3949
|
processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
3934
3950
|
}
|
|
3935
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
3951
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
3936
3952
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
3937
3953
|
}
|
|
3938
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
3954
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
3939
3955
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
3940
3956
|
}
|
|
3941
3957
|
else ;
|
|
@@ -4001,7 +4017,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4001
4017
|
const { type, props, shapeFlag, transition, patchFlag, dirs } = vnode;
|
|
4002
4018
|
if (vnode.el &&
|
|
4003
4019
|
hostCloneNode !== undefined &&
|
|
4004
|
-
patchFlag === -1 /* HOISTED */) {
|
|
4020
|
+
patchFlag === -1 /* PatchFlags.HOISTED */) {
|
|
4005
4021
|
// If a vnode has non-null el, it means it's being reused.
|
|
4006
4022
|
// Only static vnodes can be reused, so its mounted DOM nodes should be
|
|
4007
4023
|
// exactly the same, and we can simply do a clone here.
|
|
@@ -4012,10 +4028,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4012
4028
|
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
4013
4029
|
// mount children first, since some props may rely on child content
|
|
4014
4030
|
// being already rendered, e.g. `<select value>`
|
|
4015
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
4031
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
4016
4032
|
hostSetElementText(el, vnode.children);
|
|
4017
4033
|
}
|
|
4018
|
-
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
4034
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
4019
4035
|
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
4020
4036
|
}
|
|
4021
4037
|
if (dirs) {
|
|
@@ -4099,7 +4115,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4099
4115
|
let { patchFlag, dynamicChildren, dirs } = n2;
|
|
4100
4116
|
// #1426 take the old vnode's patch flag into account since user may clone a
|
|
4101
4117
|
// compiler-generated vnode, which de-opts to FULL_PROPS
|
|
4102
|
-
patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
|
|
4118
|
+
patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
|
|
4103
4119
|
const oldProps = n1.props || shared.EMPTY_OBJ;
|
|
4104
4120
|
const newProps = n2.props || shared.EMPTY_OBJ;
|
|
4105
4121
|
let vnodeHook;
|
|
@@ -4125,21 +4141,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4125
4141
|
// generated by the compiler and can take the fast path.
|
|
4126
4142
|
// in this path old node and new node are guaranteed to have the same shape
|
|
4127
4143
|
// (i.e. at the exact same position in the source template)
|
|
4128
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
4144
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
4129
4145
|
// element props contain dynamic keys, full diff needed
|
|
4130
4146
|
patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
|
4131
4147
|
}
|
|
4132
4148
|
else {
|
|
4133
4149
|
// class
|
|
4134
4150
|
// this flag is matched when the element has dynamic class bindings.
|
|
4135
|
-
if (patchFlag & 2 /* CLASS */) {
|
|
4151
|
+
if (patchFlag & 2 /* PatchFlags.CLASS */) {
|
|
4136
4152
|
if (oldProps.class !== newProps.class) {
|
|
4137
4153
|
hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
|
4138
4154
|
}
|
|
4139
4155
|
}
|
|
4140
4156
|
// style
|
|
4141
4157
|
// this flag is matched when the element has dynamic style bindings
|
|
4142
|
-
if (patchFlag & 4 /* STYLE */) {
|
|
4158
|
+
if (patchFlag & 4 /* PatchFlags.STYLE */) {
|
|
4143
4159
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
|
4144
4160
|
}
|
|
4145
4161
|
// props
|
|
@@ -4148,7 +4164,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4148
4164
|
// faster iteration.
|
|
4149
4165
|
// Note dynamic keys like :[foo]="bar" will cause this optimization to
|
|
4150
4166
|
// bail out and go through a full diff because we need to unset the old key
|
|
4151
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
4167
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
4152
4168
|
// if the flag is present then dynamicProps must be non-null
|
|
4153
4169
|
const propsToUpdate = n2.dynamicProps;
|
|
4154
4170
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
@@ -4164,7 +4180,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4164
4180
|
}
|
|
4165
4181
|
// text
|
|
4166
4182
|
// This flag is matched when the element has only dynamic text children.
|
|
4167
|
-
if (patchFlag & 1 /* TEXT */) {
|
|
4183
|
+
if (patchFlag & 1 /* PatchFlags.TEXT */) {
|
|
4168
4184
|
if (n1.children !== n2.children) {
|
|
4169
4185
|
hostSetElementText(el, n2.children);
|
|
4170
4186
|
}
|
|
@@ -4198,7 +4214,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4198
4214
|
// which also requires the correct parent container
|
|
4199
4215
|
!isSameVNodeType(oldVNode, newVNode) ||
|
|
4200
4216
|
// - In the case of a component, it could contain anything.
|
|
4201
|
-
oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
|
|
4217
|
+
oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
|
|
4202
4218
|
? hostParentNode(oldVNode.el)
|
|
4203
4219
|
: // In other cases, the parent container is not actually used so we
|
|
4204
4220
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -4251,7 +4267,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4251
4267
|
}
|
|
4252
4268
|
else {
|
|
4253
4269
|
if (patchFlag > 0 &&
|
|
4254
|
-
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
4270
|
+
patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
|
|
4255
4271
|
dynamicChildren &&
|
|
4256
4272
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
4257
4273
|
// of renderSlot() with no valid children
|
|
@@ -4281,7 +4297,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4281
4297
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
4282
4298
|
n2.slotScopeIds = slotScopeIds;
|
|
4283
4299
|
if (n1 == null) {
|
|
4284
|
-
if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
4300
|
+
if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
4285
4301
|
parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
|
4286
4302
|
}
|
|
4287
4303
|
else {
|
|
@@ -4394,10 +4410,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4394
4410
|
// activated hook for keep-alive roots.
|
|
4395
4411
|
// #1742 activated hook must be accessed after first render
|
|
4396
4412
|
// since the hook may be injected by a child keep-alive
|
|
4397
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
4413
|
+
if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
4398
4414
|
(parent &&
|
|
4399
4415
|
isAsyncWrapper(parent.vnode) &&
|
|
4400
|
-
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
4416
|
+
parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
4401
4417
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
4402
4418
|
}
|
|
4403
4419
|
instance.isMounted = true;
|
|
@@ -4474,7 +4490,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4474
4490
|
reactivity.pauseTracking();
|
|
4475
4491
|
// props update may have triggered pre-flush watchers.
|
|
4476
4492
|
// flush them before the render update.
|
|
4477
|
-
flushPreFlushCbs(
|
|
4493
|
+
flushPreFlushCbs();
|
|
4478
4494
|
reactivity.resetTracking();
|
|
4479
4495
|
};
|
|
4480
4496
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
|
@@ -4484,22 +4500,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4484
4500
|
const { patchFlag, shapeFlag } = n2;
|
|
4485
4501
|
// fast path
|
|
4486
4502
|
if (patchFlag > 0) {
|
|
4487
|
-
if (patchFlag & 128 /* KEYED_FRAGMENT */) {
|
|
4503
|
+
if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
|
|
4488
4504
|
// this could be either fully-keyed or mixed (some keyed some not)
|
|
4489
4505
|
// presence of patchFlag means children are guaranteed to be arrays
|
|
4490
4506
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4491
4507
|
return;
|
|
4492
4508
|
}
|
|
4493
|
-
else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
|
|
4509
|
+
else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
|
|
4494
4510
|
// unkeyed
|
|
4495
4511
|
patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4496
4512
|
return;
|
|
4497
4513
|
}
|
|
4498
4514
|
}
|
|
4499
4515
|
// children has 3 possibilities: text, array or no children.
|
|
4500
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
4516
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
4501
4517
|
// text children fast path
|
|
4502
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
4518
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
4503
4519
|
unmountChildren(c1, parentComponent, parentSuspense);
|
|
4504
4520
|
}
|
|
4505
4521
|
if (c2 !== c1) {
|
|
@@ -4507,9 +4523,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4507
4523
|
}
|
|
4508
4524
|
}
|
|
4509
4525
|
else {
|
|
4510
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
4526
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
4511
4527
|
// prev children was array
|
|
4512
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
4528
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
4513
4529
|
// two arrays, cannot assume anything, do full diff
|
|
4514
4530
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4515
4531
|
}
|
|
@@ -4521,11 +4537,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4521
4537
|
else {
|
|
4522
4538
|
// prev children was text OR null
|
|
4523
4539
|
// new children is array OR null
|
|
4524
|
-
if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
4540
|
+
if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
4525
4541
|
hostSetElementText(container, '');
|
|
4526
4542
|
}
|
|
4527
4543
|
// mount new if array
|
|
4528
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
4544
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
4529
4545
|
mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4530
4546
|
}
|
|
4531
4547
|
}
|
|
@@ -4713,7 +4729,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4713
4729
|
// There is no stable subsequence (e.g. a reverse)
|
|
4714
4730
|
// OR current node is not among the stable sequence
|
|
4715
4731
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
4716
|
-
move(nextChild, container, anchor, 2 /* REORDER */);
|
|
4732
|
+
move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
|
|
4717
4733
|
}
|
|
4718
4734
|
else {
|
|
4719
4735
|
j--;
|
|
@@ -4724,15 +4740,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4724
4740
|
};
|
|
4725
4741
|
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
4726
4742
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
4727
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
4743
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4728
4744
|
move(vnode.component.subTree, container, anchor, moveType);
|
|
4729
4745
|
return;
|
|
4730
4746
|
}
|
|
4731
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
4747
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4732
4748
|
vnode.suspense.move(container, anchor, moveType);
|
|
4733
4749
|
return;
|
|
4734
4750
|
}
|
|
4735
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
4751
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
4736
4752
|
type.move(vnode, container, anchor, internals);
|
|
4737
4753
|
return;
|
|
4738
4754
|
}
|
|
@@ -4749,11 +4765,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4749
4765
|
return;
|
|
4750
4766
|
}
|
|
4751
4767
|
// single nodes
|
|
4752
|
-
const needTransition = moveType !== 2 /* REORDER */ &&
|
|
4753
|
-
shapeFlag & 1 /* ELEMENT */ &&
|
|
4768
|
+
const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
|
|
4769
|
+
shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
4754
4770
|
transition;
|
|
4755
4771
|
if (needTransition) {
|
|
4756
|
-
if (moveType === 0 /* ENTER */) {
|
|
4772
|
+
if (moveType === 0 /* MoveType.ENTER */) {
|
|
4757
4773
|
transition.beforeEnter(el);
|
|
4758
4774
|
hostInsert(el, container, anchor);
|
|
4759
4775
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -4785,42 +4801,42 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4785
4801
|
if (ref != null) {
|
|
4786
4802
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
4787
4803
|
}
|
|
4788
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
4804
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
4789
4805
|
parentComponent.ctx.deactivate(vnode);
|
|
4790
4806
|
return;
|
|
4791
4807
|
}
|
|
4792
|
-
const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
|
|
4808
|
+
const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
|
|
4793
4809
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
4794
4810
|
let vnodeHook;
|
|
4795
4811
|
if (shouldInvokeVnodeHook &&
|
|
4796
4812
|
(vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
|
4797
4813
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4798
4814
|
}
|
|
4799
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
4815
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4800
4816
|
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
4801
4817
|
}
|
|
4802
4818
|
else {
|
|
4803
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
4819
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4804
4820
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
4805
4821
|
return;
|
|
4806
4822
|
}
|
|
4807
4823
|
if (shouldInvokeDirs) {
|
|
4808
4824
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
|
4809
4825
|
}
|
|
4810
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
4826
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
4811
4827
|
vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
|
4812
4828
|
}
|
|
4813
4829
|
else if (dynamicChildren &&
|
|
4814
4830
|
// #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
4815
4831
|
(type !== Fragment ||
|
|
4816
|
-
(patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
|
|
4832
|
+
(patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
|
|
4817
4833
|
// fast path for block nodes: only need to unmount dynamic children.
|
|
4818
4834
|
unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
4819
4835
|
}
|
|
4820
4836
|
else if ((type === Fragment &&
|
|
4821
4837
|
patchFlag &
|
|
4822
|
-
(128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
|
|
4823
|
-
(!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
|
|
4838
|
+
(128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
|
|
4839
|
+
(!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
|
|
4824
4840
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
4825
4841
|
}
|
|
4826
4842
|
if (doRemove) {
|
|
@@ -4855,7 +4871,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4855
4871
|
transition.afterLeave();
|
|
4856
4872
|
}
|
|
4857
4873
|
};
|
|
4858
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ &&
|
|
4874
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
4859
4875
|
transition &&
|
|
4860
4876
|
!transition.persisted) {
|
|
4861
4877
|
const { leave, delayLeave } = transition;
|
|
@@ -4925,10 +4941,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4925
4941
|
}
|
|
4926
4942
|
};
|
|
4927
4943
|
const getNextHostNode = vnode => {
|
|
4928
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */) {
|
|
4944
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4929
4945
|
return getNextHostNode(vnode.component.subTree);
|
|
4930
4946
|
}
|
|
4931
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
4947
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4932
4948
|
return vnode.suspense.next();
|
|
4933
4949
|
}
|
|
4934
4950
|
return hostNextSibling((vnode.anchor || vnode.el));
|
|
@@ -4942,6 +4958,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4942
4958
|
else {
|
|
4943
4959
|
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
|
4944
4960
|
}
|
|
4961
|
+
flushPreFlushCbs();
|
|
4945
4962
|
flushPostFlushCbs();
|
|
4946
4963
|
container._vnode = vnode;
|
|
4947
4964
|
};
|
|
@@ -4991,8 +5008,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
4991
5008
|
// guaranteed to be vnodes
|
|
4992
5009
|
const c1 = ch1[i];
|
|
4993
5010
|
let c2 = ch2[i];
|
|
4994
|
-
if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
|
|
4995
|
-
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
|
|
5011
|
+
if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
|
|
5012
|
+
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
4996
5013
|
c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
|
4997
5014
|
c2.el = c1.el;
|
|
4998
5015
|
}
|
|
@@ -5085,7 +5102,7 @@ const TeleportImpl = {
|
|
|
5085
5102
|
const mount = (container, anchor) => {
|
|
5086
5103
|
// Teleport *always* has Array children. This is enforced in both the
|
|
5087
5104
|
// compiler and vnode children normalization.
|
|
5088
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5105
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5089
5106
|
mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5090
5107
|
}
|
|
5091
5108
|
};
|
|
@@ -5121,7 +5138,7 @@ const TeleportImpl = {
|
|
|
5121
5138
|
if (!wasDisabled) {
|
|
5122
5139
|
// enabled -> disabled
|
|
5123
5140
|
// move into main container
|
|
5124
|
-
moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
|
|
5141
|
+
moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
5125
5142
|
}
|
|
5126
5143
|
}
|
|
5127
5144
|
else {
|
|
@@ -5129,13 +5146,13 @@ const TeleportImpl = {
|
|
|
5129
5146
|
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
5130
5147
|
const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
|
5131
5148
|
if (nextTarget) {
|
|
5132
|
-
moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
|
|
5149
|
+
moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
|
|
5133
5150
|
}
|
|
5134
5151
|
}
|
|
5135
5152
|
else if (wasDisabled) {
|
|
5136
5153
|
// disabled -> enabled
|
|
5137
5154
|
// move into teleport target
|
|
5138
|
-
moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
|
|
5155
|
+
moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
5139
5156
|
}
|
|
5140
5157
|
}
|
|
5141
5158
|
}
|
|
@@ -5148,7 +5165,7 @@ const TeleportImpl = {
|
|
|
5148
5165
|
// an unmounted teleport should always remove its children if not disabled
|
|
5149
5166
|
if (doRemove || !isTeleportDisabled(props)) {
|
|
5150
5167
|
hostRemove(anchor);
|
|
5151
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5168
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5152
5169
|
for (let i = 0; i < children.length; i++) {
|
|
5153
5170
|
const child = children[i];
|
|
5154
5171
|
unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
|
|
@@ -5159,13 +5176,13 @@ const TeleportImpl = {
|
|
|
5159
5176
|
move: moveTeleport,
|
|
5160
5177
|
hydrate: hydrateTeleport
|
|
5161
5178
|
};
|
|
5162
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
|
|
5179
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* TeleportMoveTypes.REORDER */) {
|
|
5163
5180
|
// move target anchor if this is a target change.
|
|
5164
|
-
if (moveType === 0 /* TARGET_CHANGE */) {
|
|
5181
|
+
if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
|
|
5165
5182
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
5166
5183
|
}
|
|
5167
5184
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
5168
|
-
const isReorder = moveType === 2 /* REORDER */;
|
|
5185
|
+
const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
|
|
5169
5186
|
// move main view anchor if this is a re-order.
|
|
5170
5187
|
if (isReorder) {
|
|
5171
5188
|
insert(el, container, parentAnchor);
|
|
@@ -5175,9 +5192,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
5175
5192
|
// is not a reorder, or the teleport is disabled
|
|
5176
5193
|
if (!isReorder || isTeleportDisabled(props)) {
|
|
5177
5194
|
// Teleport has either Array children or no children.
|
|
5178
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5195
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5179
5196
|
for (let i = 0; i < children.length; i++) {
|
|
5180
|
-
move(children[i], container, parentAnchor, 2 /* REORDER */);
|
|
5197
|
+
move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
|
|
5181
5198
|
}
|
|
5182
5199
|
}
|
|
5183
5200
|
}
|
|
@@ -5192,7 +5209,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
5192
5209
|
// if multiple teleports rendered to the same target element, we need to
|
|
5193
5210
|
// pick up from where the last teleport finished instead of the first node
|
|
5194
5211
|
const targetNode = target._lpa || target.firstChild;
|
|
5195
|
-
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5212
|
+
if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5196
5213
|
if (isTeleportDisabled(vnode.props)) {
|
|
5197
5214
|
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
5198
5215
|
vnode.targetAnchor = targetNode;
|
|
@@ -5333,7 +5350,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
5333
5350
|
: ref
|
|
5334
5351
|
: null);
|
|
5335
5352
|
};
|
|
5336
|
-
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
5353
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
5337
5354
|
const vnode = {
|
|
5338
5355
|
__v_isVNode: true,
|
|
5339
5356
|
__v_skip: true,
|
|
@@ -5364,7 +5381,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
5364
5381
|
if (needFullChildrenNormalization) {
|
|
5365
5382
|
normalizeChildren(vnode, children);
|
|
5366
5383
|
// normalize suspense children
|
|
5367
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5384
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5368
5385
|
type.normalize(vnode);
|
|
5369
5386
|
}
|
|
5370
5387
|
}
|
|
@@ -5372,8 +5389,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
5372
5389
|
// compiled element vnode - if children is passed, only possible types are
|
|
5373
5390
|
// string or Array.
|
|
5374
5391
|
vnode.shapeFlag |= shared.isString(children)
|
|
5375
|
-
? 8 /* TEXT_CHILDREN */
|
|
5376
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
5392
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
5393
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
5377
5394
|
}
|
|
5378
5395
|
// track vnode for block tree
|
|
5379
5396
|
if (isBlockTreeEnabled > 0 &&
|
|
@@ -5385,10 +5402,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
5385
5402
|
// component nodes also should always be patched, because even if the
|
|
5386
5403
|
// component doesn't need to update, it needs to persist the instance on to
|
|
5387
5404
|
// the next vnode so that it can be properly unmounted later.
|
|
5388
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
5405
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
5389
5406
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
5390
5407
|
// vnode should not be considered dynamic due to handler caching.
|
|
5391
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
5408
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
5392
5409
|
currentBlock.push(vnode);
|
|
5393
5410
|
}
|
|
5394
5411
|
return vnode;
|
|
@@ -5407,14 +5424,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5407
5424
|
normalizeChildren(cloned, children);
|
|
5408
5425
|
}
|
|
5409
5426
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
5410
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
5427
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5411
5428
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
5412
5429
|
}
|
|
5413
5430
|
else {
|
|
5414
5431
|
currentBlock.push(cloned);
|
|
5415
5432
|
}
|
|
5416
5433
|
}
|
|
5417
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
5434
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
5418
5435
|
return cloned;
|
|
5419
5436
|
}
|
|
5420
5437
|
// class component normalization.
|
|
@@ -5440,15 +5457,15 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
5440
5457
|
}
|
|
5441
5458
|
// encode the vnode type information into a bitmap
|
|
5442
5459
|
const shapeFlag = shared.isString(type)
|
|
5443
|
-
? 1 /* ELEMENT */
|
|
5460
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
5444
5461
|
: isSuspense(type)
|
|
5445
|
-
? 128 /* SUSPENSE */
|
|
5462
|
+
? 128 /* ShapeFlags.SUSPENSE */
|
|
5446
5463
|
: isTeleport(type)
|
|
5447
|
-
? 64 /* TELEPORT */
|
|
5464
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
5448
5465
|
: shared.isObject(type)
|
|
5449
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
5466
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
5450
5467
|
: shared.isFunction(type)
|
|
5451
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
5468
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
5452
5469
|
: 0;
|
|
5453
5470
|
return createBaseVNode(type, props, children, patchFlag, dynamicProps, shapeFlag, isBlockNode, true);
|
|
5454
5471
|
}
|
|
@@ -5493,8 +5510,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
5493
5510
|
// fast paths only.
|
|
5494
5511
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
5495
5512
|
? patchFlag === -1 // hoisted node
|
|
5496
|
-
? 16 /* FULL_PROPS */
|
|
5497
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
5513
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
5514
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
5498
5515
|
: patchFlag,
|
|
5499
5516
|
dynamicProps: vnode.dynamicProps,
|
|
5500
5517
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -5573,10 +5590,10 @@ function normalizeChildren(vnode, children) {
|
|
|
5573
5590
|
children = null;
|
|
5574
5591
|
}
|
|
5575
5592
|
else if (shared.isArray(children)) {
|
|
5576
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
5593
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
5577
5594
|
}
|
|
5578
5595
|
else if (typeof children === 'object') {
|
|
5579
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
5596
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
5580
5597
|
// Normalize slot to plain children for plain element and Teleport
|
|
5581
5598
|
const slot = children.default;
|
|
5582
5599
|
if (slot) {
|
|
@@ -5588,37 +5605,37 @@ function normalizeChildren(vnode, children) {
|
|
|
5588
5605
|
return;
|
|
5589
5606
|
}
|
|
5590
5607
|
else {
|
|
5591
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
5608
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
5592
5609
|
const slotFlag = children._;
|
|
5593
5610
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
5594
5611
|
children._ctx = currentRenderingInstance;
|
|
5595
5612
|
}
|
|
5596
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
5613
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
5597
5614
|
// a child component receives forwarded slots from the parent.
|
|
5598
5615
|
// its slot type is determined by its parent's slot type.
|
|
5599
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
5600
|
-
children._ = 1 /* STABLE */;
|
|
5616
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
5617
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
5601
5618
|
}
|
|
5602
5619
|
else {
|
|
5603
|
-
children._ = 2 /* DYNAMIC */;
|
|
5604
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
5620
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
5621
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
5605
5622
|
}
|
|
5606
5623
|
}
|
|
5607
5624
|
}
|
|
5608
5625
|
}
|
|
5609
5626
|
else if (shared.isFunction(children)) {
|
|
5610
5627
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
5611
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
5628
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
5612
5629
|
}
|
|
5613
5630
|
else {
|
|
5614
5631
|
children = String(children);
|
|
5615
5632
|
// force teleport children to array so it can be moved around
|
|
5616
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
5617
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
5633
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5634
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
5618
5635
|
children = [createTextVNode(children)];
|
|
5619
5636
|
}
|
|
5620
5637
|
else {
|
|
5621
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
5638
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
5622
5639
|
}
|
|
5623
5640
|
}
|
|
5624
5641
|
vnode.children = children;
|
|
@@ -5656,7 +5673,7 @@ function mergeProps(...args) {
|
|
|
5656
5673
|
return ret;
|
|
5657
5674
|
}
|
|
5658
5675
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
5659
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
5676
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
|
|
5660
5677
|
vnode,
|
|
5661
5678
|
prevVNode
|
|
5662
5679
|
]);
|
|
@@ -5757,7 +5774,7 @@ const unsetCurrentInstance = () => {
|
|
|
5757
5774
|
currentInstance = null;
|
|
5758
5775
|
};
|
|
5759
5776
|
function isStatefulComponent(instance) {
|
|
5760
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
5777
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
5761
5778
|
}
|
|
5762
5779
|
let isInSSRComponentSetup = false;
|
|
5763
5780
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -5786,7 +5803,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
5786
5803
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
5787
5804
|
setCurrentInstance(instance);
|
|
5788
5805
|
reactivity.pauseTracking();
|
|
5789
|
-
const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [instance.props, setupContext]);
|
|
5806
|
+
const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [instance.props, setupContext]);
|
|
5790
5807
|
reactivity.resetTracking();
|
|
5791
5808
|
unsetCurrentInstance();
|
|
5792
5809
|
if (shared.isPromise(setupResult)) {
|
|
@@ -5798,7 +5815,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
5798
5815
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
5799
5816
|
})
|
|
5800
5817
|
.catch(e => {
|
|
5801
|
-
handleError(e, instance, 0 /* SETUP_FUNCTION */);
|
|
5818
|
+
handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
5802
5819
|
});
|
|
5803
5820
|
}
|
|
5804
5821
|
else {
|
|
@@ -5888,7 +5905,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
5888
5905
|
function createAttrsProxy(instance) {
|
|
5889
5906
|
return new Proxy(instance.attrs, {
|
|
5890
5907
|
get(target, key) {
|
|
5891
|
-
reactivity.track(instance, "get" /* GET */, '$attrs');
|
|
5908
|
+
reactivity.track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
5892
5909
|
return target[key];
|
|
5893
5910
|
}
|
|
5894
5911
|
});
|
|
@@ -6166,7 +6183,7 @@ function isMemoSame(cached, memo) {
|
|
|
6166
6183
|
}
|
|
6167
6184
|
|
|
6168
6185
|
// Core API ------------------------------------------------------------------
|
|
6169
|
-
const version = "3.2.
|
|
6186
|
+
const version = "3.2.38";
|
|
6170
6187
|
const _ssrUtils = {
|
|
6171
6188
|
createComponentInstance,
|
|
6172
6189
|
setupComponent,
|