@vue/runtime-core 3.2.35 → 3.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-core.cjs.js +326 -298
- package/dist/runtime-core.cjs.prod.js +265 -243
- package/dist/runtime-core.d.ts +14 -6
- package/dist/runtime-core.esm-bundler.js +330 -304
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -20,7 +20,7 @@ function warn(msg, ...args) {
|
|
|
20
20
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
21
21
|
const trace = getComponentTrace();
|
|
22
22
|
if (appWarnHandler) {
|
|
23
|
-
callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
|
|
23
|
+
callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
|
|
24
24
|
msg + args.join(''),
|
|
25
25
|
instance && instance.proxy,
|
|
26
26
|
trace
|
|
@@ -120,35 +120,35 @@ function formatProp(key, value, raw) {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
const ErrorTypeStrings = {
|
|
123
|
-
["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
124
|
-
["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
|
|
125
|
-
["c" /* CREATED */]: 'created hook',
|
|
126
|
-
["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
|
|
127
|
-
["m" /* MOUNTED */]: 'mounted hook',
|
|
128
|
-
["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
129
|
-
["u" /* UPDATED */]: 'updated',
|
|
130
|
-
["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
131
|
-
["um" /* UNMOUNTED */]: 'unmounted hook',
|
|
132
|
-
["a" /* ACTIVATED */]: 'activated hook',
|
|
133
|
-
["da" /* DEACTIVATED */]: 'deactivated hook',
|
|
134
|
-
["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
135
|
-
["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
|
|
136
|
-
["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
137
|
-
[0 /* SETUP_FUNCTION */]: 'setup function',
|
|
138
|
-
[1 /* RENDER_FUNCTION */]: 'render function',
|
|
139
|
-
[2 /* WATCH_GETTER */]: 'watcher getter',
|
|
140
|
-
[3 /* WATCH_CALLBACK */]: 'watcher callback',
|
|
141
|
-
[4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
142
|
-
[5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
143
|
-
[6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
144
|
-
[7 /* VNODE_HOOK */]: 'vnode hook',
|
|
145
|
-
[8 /* DIRECTIVE_HOOK */]: 'directive hook',
|
|
146
|
-
[9 /* TRANSITION_HOOK */]: 'transition hook',
|
|
147
|
-
[10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
148
|
-
[11 /* APP_WARN_HANDLER */]: 'app warnHandler',
|
|
149
|
-
[12 /* FUNCTION_REF */]: 'ref function',
|
|
150
|
-
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
151
|
-
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
123
|
+
["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
124
|
+
["bc" /* LifecycleHooks.BEFORE_CREATE */]: 'beforeCreate hook',
|
|
125
|
+
["c" /* LifecycleHooks.CREATED */]: 'created hook',
|
|
126
|
+
["bm" /* LifecycleHooks.BEFORE_MOUNT */]: 'beforeMount hook',
|
|
127
|
+
["m" /* LifecycleHooks.MOUNTED */]: 'mounted hook',
|
|
128
|
+
["bu" /* LifecycleHooks.BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
129
|
+
["u" /* LifecycleHooks.UPDATED */]: 'updated',
|
|
130
|
+
["bum" /* LifecycleHooks.BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
131
|
+
["um" /* LifecycleHooks.UNMOUNTED */]: 'unmounted hook',
|
|
132
|
+
["a" /* LifecycleHooks.ACTIVATED */]: 'activated hook',
|
|
133
|
+
["da" /* LifecycleHooks.DEACTIVATED */]: 'deactivated hook',
|
|
134
|
+
["ec" /* LifecycleHooks.ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
135
|
+
["rtc" /* LifecycleHooks.RENDER_TRACKED */]: 'renderTracked hook',
|
|
136
|
+
["rtg" /* LifecycleHooks.RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
137
|
+
[0 /* ErrorCodes.SETUP_FUNCTION */]: 'setup function',
|
|
138
|
+
[1 /* ErrorCodes.RENDER_FUNCTION */]: 'render function',
|
|
139
|
+
[2 /* ErrorCodes.WATCH_GETTER */]: 'watcher getter',
|
|
140
|
+
[3 /* ErrorCodes.WATCH_CALLBACK */]: 'watcher callback',
|
|
141
|
+
[4 /* ErrorCodes.WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
142
|
+
[5 /* ErrorCodes.NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
143
|
+
[6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
144
|
+
[7 /* ErrorCodes.VNODE_HOOK */]: 'vnode hook',
|
|
145
|
+
[8 /* ErrorCodes.DIRECTIVE_HOOK */]: 'directive hook',
|
|
146
|
+
[9 /* ErrorCodes.TRANSITION_HOOK */]: 'transition hook',
|
|
147
|
+
[10 /* ErrorCodes.APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
148
|
+
[11 /* ErrorCodes.APP_WARN_HANDLER */]: 'app warnHandler',
|
|
149
|
+
[12 /* ErrorCodes.FUNCTION_REF */]: 'ref function',
|
|
150
|
+
[13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
151
|
+
[14 /* ErrorCodes.SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
152
152
|
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
|
|
153
153
|
};
|
|
154
154
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
@@ -199,7 +199,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
199
199
|
// app-level handling
|
|
200
200
|
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
201
201
|
if (appErrorHandler) {
|
|
202
|
-
callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
202
|
+
callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -229,15 +229,11 @@ let isFlushing = false;
|
|
|
229
229
|
let isFlushPending = false;
|
|
230
230
|
const queue = [];
|
|
231
231
|
let flushIndex = 0;
|
|
232
|
-
const pendingPreFlushCbs = [];
|
|
233
|
-
let activePreFlushCbs = null;
|
|
234
|
-
let preFlushIndex = 0;
|
|
235
232
|
const pendingPostFlushCbs = [];
|
|
236
233
|
let activePostFlushCbs = null;
|
|
237
234
|
let postFlushIndex = 0;
|
|
238
235
|
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
239
236
|
let currentFlushPromise = null;
|
|
240
|
-
let currentPreFlushParentJob = null;
|
|
241
237
|
const RECURSION_LIMIT = 100;
|
|
242
238
|
function nextTick(fn) {
|
|
243
239
|
const p = currentFlushPromise || resolvedPromise;
|
|
@@ -265,9 +261,8 @@ function queueJob(job) {
|
|
|
265
261
|
// if the job is a watch() callback, the search will start with a +1 index to
|
|
266
262
|
// allow it recursively trigger itself - it is the user's responsibility to
|
|
267
263
|
// ensure it doesn't end up in an infinite loop.
|
|
268
|
-
if (
|
|
269
|
-
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex))
|
|
270
|
-
job !== currentPreFlushParentJob) {
|
|
264
|
+
if (!queue.length ||
|
|
265
|
+
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
|
|
271
266
|
if (job.id == null) {
|
|
272
267
|
queue.push(job);
|
|
273
268
|
}
|
|
@@ -289,51 +284,38 @@ function invalidateJob(job) {
|
|
|
289
284
|
queue.splice(i, 1);
|
|
290
285
|
}
|
|
291
286
|
}
|
|
292
|
-
function
|
|
287
|
+
function queuePostFlushCb(cb) {
|
|
293
288
|
if (!shared.isArray(cb)) {
|
|
294
|
-
if (!
|
|
295
|
-
!
|
|
296
|
-
|
|
289
|
+
if (!activePostFlushCbs ||
|
|
290
|
+
!activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
|
|
291
|
+
pendingPostFlushCbs.push(cb);
|
|
297
292
|
}
|
|
298
293
|
}
|
|
299
294
|
else {
|
|
300
295
|
// if cb is an array, it is a component lifecycle hook which can only be
|
|
301
296
|
// triggered by a job, which is already deduped in the main queue, so
|
|
302
297
|
// we can skip duplicate check here to improve perf
|
|
303
|
-
|
|
298
|
+
pendingPostFlushCbs.push(...cb);
|
|
304
299
|
}
|
|
305
300
|
queueFlush();
|
|
306
301
|
}
|
|
307
|
-
function
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
currentPreFlushParentJob = parentJob;
|
|
316
|
-
activePreFlushCbs = [...new Set(pendingPreFlushCbs)];
|
|
317
|
-
pendingPreFlushCbs.length = 0;
|
|
318
|
-
{
|
|
319
|
-
seen = seen || new Map();
|
|
320
|
-
}
|
|
321
|
-
for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
|
322
|
-
if (checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])) {
|
|
302
|
+
function flushPreFlushCbs(seen, i = flushIndex) {
|
|
303
|
+
{
|
|
304
|
+
seen = seen || new Map();
|
|
305
|
+
}
|
|
306
|
+
for (; i < queue.length; i++) {
|
|
307
|
+
const cb = queue[i];
|
|
308
|
+
if (cb && cb.pre) {
|
|
309
|
+
if (checkRecursiveUpdates(seen, cb)) {
|
|
323
310
|
continue;
|
|
324
311
|
}
|
|
325
|
-
|
|
312
|
+
queue.splice(i, 1);
|
|
313
|
+
i--;
|
|
314
|
+
cb();
|
|
326
315
|
}
|
|
327
|
-
activePreFlushCbs = null;
|
|
328
|
-
preFlushIndex = 0;
|
|
329
|
-
currentPreFlushParentJob = null;
|
|
330
|
-
// recursively flush until it drains
|
|
331
|
-
flushPreFlushCbs(seen, parentJob);
|
|
332
316
|
}
|
|
333
317
|
}
|
|
334
318
|
function flushPostFlushCbs(seen) {
|
|
335
|
-
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
336
|
-
flushPreFlushCbs();
|
|
337
319
|
if (pendingPostFlushCbs.length) {
|
|
338
320
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
339
321
|
pendingPostFlushCbs.length = 0;
|
|
@@ -358,13 +340,22 @@ function flushPostFlushCbs(seen) {
|
|
|
358
340
|
}
|
|
359
341
|
}
|
|
360
342
|
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
343
|
+
const comparator = (a, b) => {
|
|
344
|
+
const diff = getId(a) - getId(b);
|
|
345
|
+
if (diff === 0) {
|
|
346
|
+
if (a.pre && !b.pre)
|
|
347
|
+
return -1;
|
|
348
|
+
if (b.pre && !a.pre)
|
|
349
|
+
return 1;
|
|
350
|
+
}
|
|
351
|
+
return diff;
|
|
352
|
+
};
|
|
361
353
|
function flushJobs(seen) {
|
|
362
354
|
isFlushPending = false;
|
|
363
355
|
isFlushing = true;
|
|
364
356
|
{
|
|
365
357
|
seen = seen || new Map();
|
|
366
358
|
}
|
|
367
|
-
flushPreFlushCbs(seen);
|
|
368
359
|
// Sort queue before flush.
|
|
369
360
|
// This ensures that:
|
|
370
361
|
// 1. Components are updated from parent to child. (because parent is always
|
|
@@ -372,7 +363,7 @@ function flushJobs(seen) {
|
|
|
372
363
|
// priority number)
|
|
373
364
|
// 2. If a component is unmounted during a parent component's update,
|
|
374
365
|
// its update can be skipped.
|
|
375
|
-
queue.sort(
|
|
366
|
+
queue.sort(comparator);
|
|
376
367
|
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
377
368
|
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
378
369
|
// inside try-catch. This can leave all warning code unshaked. Although
|
|
@@ -388,7 +379,7 @@ function flushJobs(seen) {
|
|
|
388
379
|
continue;
|
|
389
380
|
}
|
|
390
381
|
// console.log(`running:`, job.id)
|
|
391
|
-
callWithErrorHandling(job, null, 14 /* SCHEDULER */);
|
|
382
|
+
callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
|
|
392
383
|
}
|
|
393
384
|
}
|
|
394
385
|
}
|
|
@@ -400,9 +391,7 @@ function flushJobs(seen) {
|
|
|
400
391
|
currentFlushPromise = null;
|
|
401
392
|
// some postFlushCb queued jobs!
|
|
402
393
|
// keep flushing until it drains.
|
|
403
|
-
if (queue.length ||
|
|
404
|
-
pendingPreFlushCbs.length ||
|
|
405
|
-
pendingPostFlushCbs.length) {
|
|
394
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
406
395
|
flushJobs(seen);
|
|
407
396
|
}
|
|
408
397
|
}
|
|
@@ -619,7 +608,7 @@ function setDevtoolsHook(hook, target) {
|
|
|
619
608
|
}
|
|
620
609
|
}
|
|
621
610
|
function devtoolsInitApp(app, version) {
|
|
622
|
-
emit("app:init" /* APP_INIT */, app, version, {
|
|
611
|
+
emit("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
|
|
623
612
|
Fragment,
|
|
624
613
|
Text,
|
|
625
614
|
Comment,
|
|
@@ -627,27 +616,27 @@ function devtoolsInitApp(app, version) {
|
|
|
627
616
|
});
|
|
628
617
|
}
|
|
629
618
|
function devtoolsUnmountApp(app) {
|
|
630
|
-
emit("app:unmount" /* APP_UNMOUNT */, app);
|
|
619
|
+
emit("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
|
|
631
620
|
}
|
|
632
|
-
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
|
|
621
|
+
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* DevtoolsHooks.COMPONENT_ADDED */);
|
|
633
622
|
const devtoolsComponentUpdated =
|
|
634
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
|
|
623
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* DevtoolsHooks.COMPONENT_UPDATED */);
|
|
635
624
|
const devtoolsComponentRemoved =
|
|
636
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
|
|
625
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* DevtoolsHooks.COMPONENT_REMOVED */);
|
|
637
626
|
function createDevtoolsComponentHook(hook) {
|
|
638
627
|
return (component) => {
|
|
639
628
|
emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
|
640
629
|
};
|
|
641
630
|
}
|
|
642
|
-
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
|
|
643
|
-
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
|
|
631
|
+
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* DevtoolsHooks.PERFORMANCE_START */);
|
|
632
|
+
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* DevtoolsHooks.PERFORMANCE_END */);
|
|
644
633
|
function createDevtoolsPerformanceHook(hook) {
|
|
645
634
|
return (component, type, time) => {
|
|
646
635
|
emit(hook, component.appContext.app, component.uid, component, type, time);
|
|
647
636
|
};
|
|
648
637
|
}
|
|
649
638
|
function devtoolsComponentEmit(component, event, params) {
|
|
650
|
-
emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
639
|
+
emit("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
651
640
|
}
|
|
652
641
|
|
|
653
642
|
function emit$1(instance, event, ...rawArgs) {
|
|
@@ -712,7 +701,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
712
701
|
handler = props[(handlerName = shared.toHandlerKey(shared.hyphenate(event)))];
|
|
713
702
|
}
|
|
714
703
|
if (handler) {
|
|
715
|
-
callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
704
|
+
callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
716
705
|
}
|
|
717
706
|
const onceHandler = props[handlerName + `Once`];
|
|
718
707
|
if (onceHandler) {
|
|
@@ -723,7 +712,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
723
712
|
return;
|
|
724
713
|
}
|
|
725
714
|
instance.emitted[handlerName] = true;
|
|
726
|
-
callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
715
|
+
callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
727
716
|
}
|
|
728
717
|
}
|
|
729
718
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
@@ -755,7 +744,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
755
744
|
}
|
|
756
745
|
}
|
|
757
746
|
if (!raw && !hasExtends) {
|
|
758
|
-
|
|
747
|
+
if (shared.isObject(comp)) {
|
|
748
|
+
cache.set(comp, null);
|
|
749
|
+
}
|
|
759
750
|
return null;
|
|
760
751
|
}
|
|
761
752
|
if (shared.isArray(raw)) {
|
|
@@ -764,7 +755,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
764
755
|
else {
|
|
765
756
|
shared.extend(normalized, raw);
|
|
766
757
|
}
|
|
767
|
-
|
|
758
|
+
if (shared.isObject(comp)) {
|
|
759
|
+
cache.set(comp, normalized);
|
|
760
|
+
}
|
|
768
761
|
return normalized;
|
|
769
762
|
}
|
|
770
763
|
// Check if an incoming prop key is a declared emit event listener.
|
|
@@ -883,7 +876,7 @@ function renderComponentRoot(instance) {
|
|
|
883
876
|
accessedAttrs = false;
|
|
884
877
|
}
|
|
885
878
|
try {
|
|
886
|
-
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
879
|
+
if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
|
|
887
880
|
// withProxy is a proxy with a different `has` trap only for
|
|
888
881
|
// runtime-compiled render functions using `with` block.
|
|
889
882
|
const proxyToUse = withProxy || proxy;
|
|
@@ -916,7 +909,7 @@ function renderComponentRoot(instance) {
|
|
|
916
909
|
}
|
|
917
910
|
catch (err) {
|
|
918
911
|
blockStack.length = 0;
|
|
919
|
-
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
912
|
+
handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
|
|
920
913
|
result = createVNode(Comment);
|
|
921
914
|
}
|
|
922
915
|
// attr merging
|
|
@@ -925,14 +918,14 @@ function renderComponentRoot(instance) {
|
|
|
925
918
|
let root = result;
|
|
926
919
|
let setRoot = undefined;
|
|
927
920
|
if (result.patchFlag > 0 &&
|
|
928
|
-
result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
921
|
+
result.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
929
922
|
[root, setRoot] = getChildRoot(result);
|
|
930
923
|
}
|
|
931
924
|
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
932
925
|
const keys = Object.keys(fallthroughAttrs);
|
|
933
926
|
const { shapeFlag } = root;
|
|
934
927
|
if (keys.length) {
|
|
935
|
-
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
928
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
|
|
936
929
|
if (propsOptions && keys.some(shared.isModelListener)) {
|
|
937
930
|
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
938
931
|
// prop, it indicates this component expects to handle v-model and
|
|
@@ -1073,7 +1066,7 @@ const filterModelListeners = (attrs, props) => {
|
|
|
1073
1066
|
return res;
|
|
1074
1067
|
};
|
|
1075
1068
|
const isElementRoot = (vnode) => {
|
|
1076
|
-
return (vnode.shapeFlag & (6 /* COMPONENT */ | 1 /* ELEMENT */) ||
|
|
1069
|
+
return (vnode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 1 /* ShapeFlags.ELEMENT */) ||
|
|
1077
1070
|
vnode.type === Comment // potential v-if branch switch
|
|
1078
1071
|
);
|
|
1079
1072
|
};
|
|
@@ -1092,19 +1085,19 @@ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
|
1092
1085
|
return true;
|
|
1093
1086
|
}
|
|
1094
1087
|
if (optimized && patchFlag >= 0) {
|
|
1095
|
-
if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
|
|
1088
|
+
if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
|
|
1096
1089
|
// slot content that references values that might have changed,
|
|
1097
1090
|
// e.g. in a v-for
|
|
1098
1091
|
return true;
|
|
1099
1092
|
}
|
|
1100
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
1093
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
1101
1094
|
if (!prevProps) {
|
|
1102
1095
|
return !!nextProps;
|
|
1103
1096
|
}
|
|
1104
1097
|
// presence of this flag indicates props are always non-null
|
|
1105
1098
|
return hasPropsChanged(prevProps, nextProps, emits);
|
|
1106
1099
|
}
|
|
1107
|
-
else if (patchFlag & 8 /* PROPS */) {
|
|
1100
|
+
else if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
1108
1101
|
const dynamicProps = nextVNode.dynamicProps;
|
|
1109
1102
|
for (let i = 0; i < dynamicProps.length; i++) {
|
|
1110
1103
|
const key = dynamicProps[i];
|
|
@@ -1362,7 +1355,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1362
1355
|
if (delayEnter) {
|
|
1363
1356
|
activeBranch.transition.afterLeave = () => {
|
|
1364
1357
|
if (pendingId === suspense.pendingId) {
|
|
1365
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
1358
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
1366
1359
|
}
|
|
1367
1360
|
};
|
|
1368
1361
|
}
|
|
@@ -1377,7 +1370,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1377
1370
|
}
|
|
1378
1371
|
if (!delayEnter) {
|
|
1379
1372
|
// move content from off-dom container to actual container
|
|
1380
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
1373
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
1381
1374
|
}
|
|
1382
1375
|
}
|
|
1383
1376
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -1451,7 +1444,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1451
1444
|
const hydratedEl = instance.vnode.el;
|
|
1452
1445
|
instance
|
|
1453
1446
|
.asyncDep.catch(err => {
|
|
1454
|
-
handleError(err, instance, 0 /* SETUP_FUNCTION */);
|
|
1447
|
+
handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
1455
1448
|
})
|
|
1456
1449
|
.then(asyncSetupResult => {
|
|
1457
1450
|
// retry when the setup() promise resolves.
|
|
@@ -1525,7 +1518,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
|
|
|
1525
1518
|
}
|
|
1526
1519
|
function normalizeSuspenseChildren(vnode) {
|
|
1527
1520
|
const { shapeFlag, children } = vnode;
|
|
1528
|
-
const isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */;
|
|
1521
|
+
const isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
1529
1522
|
vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
|
|
1530
1523
|
vnode.ssFallback = isSlotChildren
|
|
1531
1524
|
? normalizeSuspenseSlot(children.fallback)
|
|
@@ -1698,7 +1691,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1698
1691
|
return traverse(s);
|
|
1699
1692
|
}
|
|
1700
1693
|
else if (shared.isFunction(s)) {
|
|
1701
|
-
return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
|
|
1694
|
+
return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
1702
1695
|
}
|
|
1703
1696
|
else {
|
|
1704
1697
|
warnInvalidSource(s);
|
|
@@ -1708,7 +1701,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1708
1701
|
else if (shared.isFunction(source)) {
|
|
1709
1702
|
if (cb) {
|
|
1710
1703
|
// getter with cb
|
|
1711
|
-
getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
|
|
1704
|
+
getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
1712
1705
|
}
|
|
1713
1706
|
else {
|
|
1714
1707
|
// no cb -> simple effect
|
|
@@ -1719,7 +1712,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1719
1712
|
if (cleanup) {
|
|
1720
1713
|
cleanup();
|
|
1721
1714
|
}
|
|
1722
|
-
return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
|
|
1715
|
+
return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
|
|
1723
1716
|
};
|
|
1724
1717
|
}
|
|
1725
1718
|
}
|
|
@@ -1734,7 +1727,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1734
1727
|
let cleanup;
|
|
1735
1728
|
let onCleanup = (fn) => {
|
|
1736
1729
|
cleanup = effect.onStop = () => {
|
|
1737
|
-
callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
|
|
1730
|
+
callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
|
|
1738
1731
|
};
|
|
1739
1732
|
};
|
|
1740
1733
|
// in SSR there is no need to setup an actual effect, and it should be noop
|
|
@@ -1746,7 +1739,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1746
1739
|
getter();
|
|
1747
1740
|
}
|
|
1748
1741
|
else if (immediate) {
|
|
1749
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
1742
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
1750
1743
|
getter(),
|
|
1751
1744
|
isMultiSource ? [] : undefined,
|
|
1752
1745
|
onCleanup
|
|
@@ -1772,7 +1765,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1772
1765
|
if (cleanup) {
|
|
1773
1766
|
cleanup();
|
|
1774
1767
|
}
|
|
1775
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
1768
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
1776
1769
|
newValue,
|
|
1777
1770
|
// pass undefined as the old value when it's changed for the first time
|
|
1778
1771
|
oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
|
@@ -1798,7 +1791,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = sh
|
|
|
1798
1791
|
}
|
|
1799
1792
|
else {
|
|
1800
1793
|
// default: 'pre'
|
|
1801
|
-
|
|
1794
|
+
job.pre = true;
|
|
1795
|
+
if (instance)
|
|
1796
|
+
job.id = instance.uid;
|
|
1797
|
+
scheduler = () => queueJob(job);
|
|
1802
1798
|
}
|
|
1803
1799
|
const effect = new reactivity.ReactiveEffect(getter, scheduler);
|
|
1804
1800
|
{
|
|
@@ -1865,7 +1861,7 @@ function createPathGetter(ctx, path) {
|
|
|
1865
1861
|
};
|
|
1866
1862
|
}
|
|
1867
1863
|
function traverse(value, seen) {
|
|
1868
|
-
if (!shared.isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
1864
|
+
if (!shared.isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
|
|
1869
1865
|
return value;
|
|
1870
1866
|
}
|
|
1871
1867
|
seen = seen || new Set();
|
|
@@ -2049,7 +2045,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
2049
2045
|
const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
|
2050
2046
|
const callHook = (hook, args) => {
|
|
2051
2047
|
hook &&
|
|
2052
|
-
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
2048
|
+
callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
|
|
2053
2049
|
};
|
|
2054
2050
|
const callAsyncHook = (hook, args) => {
|
|
2055
2051
|
const done = args[1];
|
|
@@ -2185,10 +2181,10 @@ function getKeepAliveChild(vnode) {
|
|
|
2185
2181
|
: vnode;
|
|
2186
2182
|
}
|
|
2187
2183
|
function setTransitionHooks(vnode, hooks) {
|
|
2188
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
|
|
2184
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
|
|
2189
2185
|
setTransitionHooks(vnode.component.subTree, hooks);
|
|
2190
2186
|
}
|
|
2191
|
-
else if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
2187
|
+
else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
2192
2188
|
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
2193
2189
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
2194
2190
|
}
|
|
@@ -2207,7 +2203,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
2207
2203
|
: String(parentKey) + String(child.key != null ? child.key : i);
|
|
2208
2204
|
// handle fragment children case, e.g. v-for
|
|
2209
2205
|
if (child.type === Fragment) {
|
|
2210
|
-
if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
|
|
2206
|
+
if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */)
|
|
2211
2207
|
keyedFragmentCount++;
|
|
2212
2208
|
ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
|
|
2213
2209
|
}
|
|
@@ -2222,7 +2218,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
2222
2218
|
// these children to force full diffs to ensure correct behavior.
|
|
2223
2219
|
if (keyedFragmentCount > 1) {
|
|
2224
2220
|
for (let i = 0; i < ret.length; i++) {
|
|
2225
|
-
ret[i].patchFlag = -2 /* BAIL */;
|
|
2221
|
+
ret[i].patchFlag = -2 /* PatchFlags.BAIL */;
|
|
2226
2222
|
}
|
|
2227
2223
|
}
|
|
2228
2224
|
return ret;
|
|
@@ -2300,7 +2296,7 @@ function defineAsyncComponent(source) {
|
|
|
2300
2296
|
}
|
|
2301
2297
|
const onError = (err) => {
|
|
2302
2298
|
pendingRequest = null;
|
|
2303
|
-
handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
2299
|
+
handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
2304
2300
|
};
|
|
2305
2301
|
// suspense-controlled or SSR.
|
|
2306
2302
|
if ((suspensible && instance.suspense) ||
|
|
@@ -2410,7 +2406,7 @@ const KeepAliveImpl = {
|
|
|
2410
2406
|
const storageContainer = createElement('div');
|
|
2411
2407
|
sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
|
2412
2408
|
const instance = vnode.component;
|
|
2413
|
-
move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
|
|
2409
|
+
move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
|
|
2414
2410
|
// in case props have changed
|
|
2415
2411
|
patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
|
|
2416
2412
|
queuePostRenderEffect(() => {
|
|
@@ -2430,7 +2426,7 @@ const KeepAliveImpl = {
|
|
|
2430
2426
|
};
|
|
2431
2427
|
sharedContext.deactivate = (vnode) => {
|
|
2432
2428
|
const instance = vnode.component;
|
|
2433
|
-
move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
|
|
2429
|
+
move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
|
|
2434
2430
|
queuePostRenderEffect(() => {
|
|
2435
2431
|
if (instance.da) {
|
|
2436
2432
|
shared.invokeArrayFns(instance.da);
|
|
@@ -2519,8 +2515,8 @@ const KeepAliveImpl = {
|
|
|
2519
2515
|
return children;
|
|
2520
2516
|
}
|
|
2521
2517
|
else if (!isVNode(rawVNode) ||
|
|
2522
|
-
(!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&
|
|
2523
|
-
!(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {
|
|
2518
|
+
(!(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) &&
|
|
2519
|
+
!(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */))) {
|
|
2524
2520
|
current = null;
|
|
2525
2521
|
return rawVNode;
|
|
2526
2522
|
}
|
|
@@ -2542,7 +2538,7 @@ const KeepAliveImpl = {
|
|
|
2542
2538
|
// clone vnode if it's reused because we are going to mutate it
|
|
2543
2539
|
if (vnode.el) {
|
|
2544
2540
|
vnode = cloneVNode(vnode);
|
|
2545
|
-
if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
|
|
2541
|
+
if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
2546
2542
|
rawVNode.ssContent = vnode;
|
|
2547
2543
|
}
|
|
2548
2544
|
}
|
|
@@ -2561,7 +2557,7 @@ const KeepAliveImpl = {
|
|
|
2561
2557
|
setTransitionHooks(vnode, vnode.transition);
|
|
2562
2558
|
}
|
|
2563
2559
|
// avoid vnode being mounted as fresh
|
|
2564
|
-
vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
2560
|
+
vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
2565
2561
|
// make this key the freshest
|
|
2566
2562
|
keys.delete(key);
|
|
2567
2563
|
keys.add(key);
|
|
@@ -2574,7 +2570,7 @@ const KeepAliveImpl = {
|
|
|
2574
2570
|
}
|
|
2575
2571
|
}
|
|
2576
2572
|
// avoid vnode being unmounted
|
|
2577
|
-
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2573
|
+
vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2578
2574
|
current = vnode;
|
|
2579
2575
|
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
2580
2576
|
};
|
|
@@ -2597,10 +2593,10 @@ function matches(pattern, name) {
|
|
|
2597
2593
|
return false;
|
|
2598
2594
|
}
|
|
2599
2595
|
function onActivated(hook, target) {
|
|
2600
|
-
registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
|
|
2596
|
+
registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
|
|
2601
2597
|
}
|
|
2602
2598
|
function onDeactivated(hook, target) {
|
|
2603
|
-
registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
|
|
2599
|
+
registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
|
|
2604
2600
|
}
|
|
2605
2601
|
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
2606
2602
|
// cache the deactivate branch check wrapper for injected hooks so the same
|
|
@@ -2644,16 +2640,16 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
|
2644
2640
|
}
|
|
2645
2641
|
function resetShapeFlag(vnode) {
|
|
2646
2642
|
let shapeFlag = vnode.shapeFlag;
|
|
2647
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
2648
|
-
shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2643
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
2644
|
+
shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2649
2645
|
}
|
|
2650
|
-
if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
2651
|
-
shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
2646
|
+
if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
2647
|
+
shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
2652
2648
|
}
|
|
2653
2649
|
vnode.shapeFlag = shapeFlag;
|
|
2654
2650
|
}
|
|
2655
2651
|
function getInnerChild(vnode) {
|
|
2656
|
-
return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
|
|
2652
|
+
return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
|
|
2657
2653
|
}
|
|
2658
2654
|
|
|
2659
2655
|
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
@@ -2699,19 +2695,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2699
2695
|
}
|
|
2700
2696
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
2701
2697
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
2702
|
-
(!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
|
|
2698
|
+
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
2703
2699
|
injectHook(lifecycle, hook, target);
|
|
2704
|
-
const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
|
|
2705
|
-
const onMounted = createHook("m" /* MOUNTED */);
|
|
2706
|
-
const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
|
|
2707
|
-
const onUpdated = createHook("u" /* UPDATED */);
|
|
2708
|
-
const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
|
|
2709
|
-
const onUnmounted = createHook("um" /* UNMOUNTED */);
|
|
2710
|
-
const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
|
|
2711
|
-
const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
|
|
2712
|
-
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
|
|
2700
|
+
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
2701
|
+
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
2702
|
+
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
2703
|
+
const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
|
|
2704
|
+
const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
|
|
2705
|
+
const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
|
|
2706
|
+
const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
|
|
2707
|
+
const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
|
|
2708
|
+
const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
|
|
2713
2709
|
function onErrorCaptured(hook, target = currentInstance) {
|
|
2714
|
-
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
2710
|
+
injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
|
|
2715
2711
|
}
|
|
2716
2712
|
|
|
2717
2713
|
/**
|
|
@@ -2778,7 +2774,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
2778
2774
|
// disable tracking inside all lifecycle hooks
|
|
2779
2775
|
// since they can potentially be called inside effects.
|
|
2780
2776
|
reactivity.pauseTracking();
|
|
2781
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
2777
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [
|
|
2782
2778
|
vnode.el,
|
|
2783
2779
|
binding,
|
|
2784
2780
|
vnode,
|
|
@@ -2823,7 +2819,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
2823
2819
|
const Component = instance.type;
|
|
2824
2820
|
// explicit self name has highest priority
|
|
2825
2821
|
if (type === COMPONENTS) {
|
|
2826
|
-
const selfName = getComponentName(Component);
|
|
2822
|
+
const selfName = getComponentName(Component, false /* do not include inferred name to avoid breaking existing code */);
|
|
2827
2823
|
if (selfName &&
|
|
2828
2824
|
(selfName === name ||
|
|
2829
2825
|
selfName === shared.camelize(name) ||
|
|
@@ -2920,7 +2916,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2920
2916
|
}
|
|
2921
2917
|
else if (slot) {
|
|
2922
2918
|
// conditional single slot generated by <template v-if="..." #foo>
|
|
2923
|
-
slots[slot.name] = slot.
|
|
2919
|
+
slots[slot.name] = slot.key
|
|
2920
|
+
? (...args) => {
|
|
2921
|
+
const res = slot.fn(...args);
|
|
2922
|
+
res.key = slot.key;
|
|
2923
|
+
return res;
|
|
2924
|
+
}
|
|
2925
|
+
: slot.fn;
|
|
2924
2926
|
}
|
|
2925
2927
|
}
|
|
2926
2928
|
return slots;
|
|
@@ -2956,9 +2958,15 @@ fallback, noSlotted) {
|
|
|
2956
2958
|
}
|
|
2957
2959
|
openBlock();
|
|
2958
2960
|
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
2959
|
-
const rendered = createBlock(Fragment, {
|
|
2960
|
-
|
|
2961
|
-
|
|
2961
|
+
const rendered = createBlock(Fragment, {
|
|
2962
|
+
key: props.key ||
|
|
2963
|
+
// slot content array of a dynamic conditional slot may have a branch
|
|
2964
|
+
// key attached in the `createSlots` helper, respect that
|
|
2965
|
+
(validSlotContent && validSlotContent.key) ||
|
|
2966
|
+
`_${name}`
|
|
2967
|
+
}, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */
|
|
2968
|
+
? 64 /* PatchFlags.STABLE_FRAGMENT */
|
|
2969
|
+
: -2 /* PatchFlags.BAIL */);
|
|
2962
2970
|
if (!noSlotted && rendered.scopeId) {
|
|
2963
2971
|
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
2964
2972
|
}
|
|
@@ -2986,14 +2994,16 @@ function ensureValidVNode(vnodes) {
|
|
|
2986
2994
|
* For prefixing keys in v-on="obj" with "on"
|
|
2987
2995
|
* @private
|
|
2988
2996
|
*/
|
|
2989
|
-
function toHandlers(obj) {
|
|
2997
|
+
function toHandlers(obj, preserveCaseIfNecessary) {
|
|
2990
2998
|
const ret = {};
|
|
2991
2999
|
if (!shared.isObject(obj)) {
|
|
2992
3000
|
warn(`v-on with no argument expects an object value.`);
|
|
2993
3001
|
return ret;
|
|
2994
3002
|
}
|
|
2995
3003
|
for (const key in obj) {
|
|
2996
|
-
ret[
|
|
3004
|
+
ret[preserveCaseIfNecessary && /[A-Z]/.test(key)
|
|
3005
|
+
? `on:${key}`
|
|
3006
|
+
: shared.toHandlerKey(key)] = obj[key];
|
|
2997
3007
|
}
|
|
2998
3008
|
return ret;
|
|
2999
3009
|
}
|
|
@@ -3057,23 +3067,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
3057
3067
|
const n = accessCache[key];
|
|
3058
3068
|
if (n !== undefined) {
|
|
3059
3069
|
switch (n) {
|
|
3060
|
-
case 1 /* SETUP */:
|
|
3070
|
+
case 1 /* AccessTypes.SETUP */:
|
|
3061
3071
|
return setupState[key];
|
|
3062
|
-
case 2 /* DATA */:
|
|
3072
|
+
case 2 /* AccessTypes.DATA */:
|
|
3063
3073
|
return data[key];
|
|
3064
|
-
case 4 /* CONTEXT */:
|
|
3074
|
+
case 4 /* AccessTypes.CONTEXT */:
|
|
3065
3075
|
return ctx[key];
|
|
3066
|
-
case 3 /* PROPS */:
|
|
3076
|
+
case 3 /* AccessTypes.PROPS */:
|
|
3067
3077
|
return props[key];
|
|
3068
3078
|
// default: just fallthrough
|
|
3069
3079
|
}
|
|
3070
3080
|
}
|
|
3071
3081
|
else if (setupState !== shared.EMPTY_OBJ && shared.hasOwn(setupState, key)) {
|
|
3072
|
-
accessCache[key] = 1 /* SETUP */;
|
|
3082
|
+
accessCache[key] = 1 /* AccessTypes.SETUP */;
|
|
3073
3083
|
return setupState[key];
|
|
3074
3084
|
}
|
|
3075
3085
|
else if (data !== shared.EMPTY_OBJ && shared.hasOwn(data, key)) {
|
|
3076
|
-
accessCache[key] = 2 /* DATA */;
|
|
3086
|
+
accessCache[key] = 2 /* AccessTypes.DATA */;
|
|
3077
3087
|
return data[key];
|
|
3078
3088
|
}
|
|
3079
3089
|
else if (
|
|
@@ -3081,15 +3091,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
3081
3091
|
// props
|
|
3082
3092
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
3083
3093
|
shared.hasOwn(normalizedProps, key)) {
|
|
3084
|
-
accessCache[key] = 3 /* PROPS */;
|
|
3094
|
+
accessCache[key] = 3 /* AccessTypes.PROPS */;
|
|
3085
3095
|
return props[key];
|
|
3086
3096
|
}
|
|
3087
3097
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
3088
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
3098
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
3089
3099
|
return ctx[key];
|
|
3090
3100
|
}
|
|
3091
3101
|
else if (shouldCacheAccess) {
|
|
3092
|
-
accessCache[key] = 0 /* OTHER */;
|
|
3102
|
+
accessCache[key] = 0 /* AccessTypes.OTHER */;
|
|
3093
3103
|
}
|
|
3094
3104
|
}
|
|
3095
3105
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -3097,7 +3107,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
3097
3107
|
// public $xxx properties
|
|
3098
3108
|
if (publicGetter) {
|
|
3099
3109
|
if (key === '$attrs') {
|
|
3100
|
-
reactivity.track(instance, "get" /* GET */, key);
|
|
3110
|
+
reactivity.track(instance, "get" /* TrackOpTypes.GET */, key);
|
|
3101
3111
|
markAttrsAccessed();
|
|
3102
3112
|
}
|
|
3103
3113
|
return publicGetter(instance);
|
|
@@ -3110,7 +3120,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
3110
3120
|
}
|
|
3111
3121
|
else if (ctx !== shared.EMPTY_OBJ && shared.hasOwn(ctx, key)) {
|
|
3112
3122
|
// user may set custom properties to `this` that start with `$`
|
|
3113
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
3123
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
3114
3124
|
return ctx[key];
|
|
3115
3125
|
}
|
|
3116
3126
|
else if (
|
|
@@ -3293,7 +3303,7 @@ function applyOptions(instance) {
|
|
|
3293
3303
|
// call beforeCreate first before accessing other options since
|
|
3294
3304
|
// the hook may mutate resolved options (#2791)
|
|
3295
3305
|
if (options.beforeCreate) {
|
|
3296
|
-
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
3306
|
+
callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
|
|
3297
3307
|
}
|
|
3298
3308
|
const {
|
|
3299
3309
|
// state
|
|
@@ -3309,7 +3319,7 @@ function applyOptions(instance) {
|
|
|
3309
3319
|
const [propsOptions] = instance.propsOptions;
|
|
3310
3320
|
if (propsOptions) {
|
|
3311
3321
|
for (const key in propsOptions) {
|
|
3312
|
-
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
3322
|
+
checkDuplicateProperties("Props" /* OptionTypes.PROPS */, key);
|
|
3313
3323
|
}
|
|
3314
3324
|
}
|
|
3315
3325
|
}
|
|
@@ -3339,7 +3349,7 @@ function applyOptions(instance) {
|
|
|
3339
3349
|
});
|
|
3340
3350
|
}
|
|
3341
3351
|
{
|
|
3342
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
3352
|
+
checkDuplicateProperties("Methods" /* OptionTypes.METHODS */, key);
|
|
3343
3353
|
}
|
|
3344
3354
|
}
|
|
3345
3355
|
else {
|
|
@@ -3366,7 +3376,7 @@ function applyOptions(instance) {
|
|
|
3366
3376
|
instance.data = reactivity.reactive(data);
|
|
3367
3377
|
{
|
|
3368
3378
|
for (const key in data) {
|
|
3369
|
-
checkDuplicateProperties("Data" /* DATA */, key);
|
|
3379
|
+
checkDuplicateProperties("Data" /* OptionTypes.DATA */, key);
|
|
3370
3380
|
// expose data on ctx during dev
|
|
3371
3381
|
if (!isReservedPrefix(key[0])) {
|
|
3372
3382
|
Object.defineProperty(ctx, key, {
|
|
@@ -3410,7 +3420,7 @@ function applyOptions(instance) {
|
|
|
3410
3420
|
set: v => (c.value = v)
|
|
3411
3421
|
});
|
|
3412
3422
|
{
|
|
3413
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
3423
|
+
checkDuplicateProperties("Computed" /* OptionTypes.COMPUTED */, key);
|
|
3414
3424
|
}
|
|
3415
3425
|
}
|
|
3416
3426
|
}
|
|
@@ -3428,7 +3438,7 @@ function applyOptions(instance) {
|
|
|
3428
3438
|
});
|
|
3429
3439
|
}
|
|
3430
3440
|
if (created) {
|
|
3431
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
3441
|
+
callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
|
|
3432
3442
|
}
|
|
3433
3443
|
function registerLifecycleHook(register, hook) {
|
|
3434
3444
|
if (shared.isArray(hook)) {
|
|
@@ -3521,7 +3531,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = shared
|
|
|
3521
3531
|
ctx[key] = injected;
|
|
3522
3532
|
}
|
|
3523
3533
|
{
|
|
3524
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
3534
|
+
checkDuplicateProperties("Inject" /* OptionTypes.INJECT */, key);
|
|
3525
3535
|
}
|
|
3526
3536
|
}
|
|
3527
3537
|
}
|
|
@@ -3592,7 +3602,9 @@ function resolveMergedOptions(instance) {
|
|
|
3592
3602
|
}
|
|
3593
3603
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
3594
3604
|
}
|
|
3595
|
-
|
|
3605
|
+
if (shared.isObject(base)) {
|
|
3606
|
+
cache.set(base, resolved);
|
|
3607
|
+
}
|
|
3596
3608
|
return resolved;
|
|
3597
3609
|
}
|
|
3598
3610
|
function mergeOptions(to, from, strats, asMixin = false) {
|
|
@@ -3721,6 +3733,13 @@ isSSR = false) {
|
|
|
3721
3733
|
}
|
|
3722
3734
|
instance.attrs = attrs;
|
|
3723
3735
|
}
|
|
3736
|
+
function isInHmrContext(instance) {
|
|
3737
|
+
while (instance) {
|
|
3738
|
+
if (instance.type.__hmrId)
|
|
3739
|
+
return true;
|
|
3740
|
+
instance = instance.parent;
|
|
3741
|
+
}
|
|
3742
|
+
}
|
|
3724
3743
|
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
3725
3744
|
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
3726
3745
|
const rawCurrentProps = reactivity.toRaw(props);
|
|
@@ -3730,11 +3749,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3730
3749
|
// always force full diff in dev
|
|
3731
3750
|
// - #1942 if hmr is enabled with sfc component
|
|
3732
3751
|
// - vite#872 non-sfc component used by sfc component
|
|
3733
|
-
!((instance
|
|
3734
|
-
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
3752
|
+
!(isInHmrContext(instance)) &&
|
|
3735
3753
|
(optimized || patchFlag > 0) &&
|
|
3736
|
-
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
3737
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
3754
|
+
!(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
|
|
3755
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
3738
3756
|
// Compiler-generated props & no keys change, just set the updated
|
|
3739
3757
|
// the props.
|
|
3740
3758
|
const propsToUpdate = instance.vnode.dynamicProps;
|
|
@@ -3813,7 +3831,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3813
3831
|
}
|
|
3814
3832
|
// trigger updates for $attrs in case it's used in component slots
|
|
3815
3833
|
if (hasAttrsChanged) {
|
|
3816
|
-
reactivity.trigger(instance, "set" /* SET */, '$attrs');
|
|
3834
|
+
reactivity.trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
|
|
3817
3835
|
}
|
|
3818
3836
|
{
|
|
3819
3837
|
validateProps(rawProps || {}, props, instance);
|
|
@@ -3882,11 +3900,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
3882
3900
|
}
|
|
3883
3901
|
}
|
|
3884
3902
|
// boolean casting
|
|
3885
|
-
if (opt[0 /* shouldCast */]) {
|
|
3903
|
+
if (opt[0 /* BooleanFlags.shouldCast */]) {
|
|
3886
3904
|
if (isAbsent && !hasDefault) {
|
|
3887
3905
|
value = false;
|
|
3888
3906
|
}
|
|
3889
|
-
else if (opt[1 /* shouldCastTrue */] &&
|
|
3907
|
+
else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
|
|
3890
3908
|
(value === '' || value === shared.hyphenate(key))) {
|
|
3891
3909
|
value = true;
|
|
3892
3910
|
}
|
|
@@ -3924,7 +3942,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3924
3942
|
}
|
|
3925
3943
|
}
|
|
3926
3944
|
if (!raw && !hasExtends) {
|
|
3927
|
-
|
|
3945
|
+
if (shared.isObject(comp)) {
|
|
3946
|
+
cache.set(comp, shared.EMPTY_ARR);
|
|
3947
|
+
}
|
|
3928
3948
|
return shared.EMPTY_ARR;
|
|
3929
3949
|
}
|
|
3930
3950
|
if (shared.isArray(raw)) {
|
|
@@ -3951,8 +3971,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3951
3971
|
if (prop) {
|
|
3952
3972
|
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
3953
3973
|
const stringIndex = getTypeIndex(String, prop.type);
|
|
3954
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
3955
|
-
prop[1 /* shouldCastTrue */] =
|
|
3974
|
+
prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
|
|
3975
|
+
prop[1 /* BooleanFlags.shouldCastTrue */] =
|
|
3956
3976
|
stringIndex < 0 || booleanIndex < stringIndex;
|
|
3957
3977
|
// if the prop needs boolean casting or default value
|
|
3958
3978
|
if (booleanIndex > -1 || shared.hasOwn(prop, 'default')) {
|
|
@@ -3963,7 +3983,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3963
3983
|
}
|
|
3964
3984
|
}
|
|
3965
3985
|
const res = [normalized, needCastKeys];
|
|
3966
|
-
|
|
3986
|
+
if (shared.isObject(comp)) {
|
|
3987
|
+
cache.set(comp, res);
|
|
3988
|
+
}
|
|
3967
3989
|
return res;
|
|
3968
3990
|
}
|
|
3969
3991
|
function validatePropName(key) {
|
|
@@ -4173,7 +4195,7 @@ const normalizeVNodeSlots = (instance, children) => {
|
|
|
4173
4195
|
instance.slots.default = () => normalized;
|
|
4174
4196
|
};
|
|
4175
4197
|
const initSlots = (instance, children) => {
|
|
4176
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
4198
|
+
if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
4177
4199
|
const type = children._;
|
|
4178
4200
|
if (type) {
|
|
4179
4201
|
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
@@ -4198,7 +4220,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4198
4220
|
const { vnode, slots } = instance;
|
|
4199
4221
|
let needDeletionCheck = true;
|
|
4200
4222
|
let deletionComparisonTarget = shared.EMPTY_OBJ;
|
|
4201
|
-
if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
4223
|
+
if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
4202
4224
|
const type = children._;
|
|
4203
4225
|
if (type) {
|
|
4204
4226
|
// compiled slots.
|
|
@@ -4207,7 +4229,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4207
4229
|
// force update slots and mark instance for hmr as well
|
|
4208
4230
|
shared.extend(slots, children);
|
|
4209
4231
|
}
|
|
4210
|
-
else if (optimized && type === 1 /* STABLE */) {
|
|
4232
|
+
else if (optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
4211
4233
|
// compiled AND stable.
|
|
4212
4234
|
// no need to update, and skip stale slots removal.
|
|
4213
4235
|
needDeletionCheck = false;
|
|
@@ -4220,7 +4242,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4220
4242
|
// when rendering the optimized slots by manually written render function,
|
|
4221
4243
|
// we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
|
|
4222
4244
|
// i.e. let the `renderSlot` create the bailed Fragment
|
|
4223
|
-
if (!optimized && type === 1 /* STABLE */) {
|
|
4245
|
+
if (!optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
4224
4246
|
delete slots._;
|
|
4225
4247
|
}
|
|
4226
4248
|
}
|
|
@@ -4431,7 +4453,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4431
4453
|
// because the template ref is forwarded to inner component
|
|
4432
4454
|
return;
|
|
4433
4455
|
}
|
|
4434
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4456
|
+
const refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
4435
4457
|
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4436
4458
|
: vnode.el;
|
|
4437
4459
|
const value = isUnmount ? null : refValue;
|
|
@@ -4457,7 +4479,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4457
4479
|
}
|
|
4458
4480
|
}
|
|
4459
4481
|
if (shared.isFunction(ref)) {
|
|
4460
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4482
|
+
callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
|
|
4461
4483
|
}
|
|
4462
4484
|
else {
|
|
4463
4485
|
const _isString = shared.isString(ref);
|
|
@@ -4494,7 +4516,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4494
4516
|
setupState[ref] = value;
|
|
4495
4517
|
}
|
|
4496
4518
|
}
|
|
4497
|
-
else if (
|
|
4519
|
+
else if (_isRef) {
|
|
4498
4520
|
ref.value = value;
|
|
4499
4521
|
if (rawRef.k)
|
|
4500
4522
|
refs[rawRef.k] = value;
|
|
@@ -4519,7 +4541,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4519
4541
|
|
|
4520
4542
|
let hasMismatch = false;
|
|
4521
4543
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
4522
|
-
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
4544
|
+
const isComment = (node) => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
|
|
4523
4545
|
// Note: hydration is DOM-specific
|
|
4524
4546
|
// But we have to place it in core due to tight coupling with core - splitting
|
|
4525
4547
|
// it out creates a ton of unnecessary complexity.
|
|
@@ -4533,11 +4555,13 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4533
4555
|
`Performing full mount instead.`);
|
|
4534
4556
|
patch(null, vnode, container);
|
|
4535
4557
|
flushPostFlushCbs();
|
|
4558
|
+
container._vnode = vnode;
|
|
4536
4559
|
return;
|
|
4537
4560
|
}
|
|
4538
4561
|
hasMismatch = false;
|
|
4539
4562
|
hydrateNode(container.firstChild, vnode, null, null, null);
|
|
4540
4563
|
flushPostFlushCbs();
|
|
4564
|
+
container._vnode = vnode;
|
|
4541
4565
|
if (hasMismatch && !false) {
|
|
4542
4566
|
// this error should show up in production
|
|
4543
4567
|
console.error(`Hydration completed but contains mismatches.`);
|
|
@@ -4549,14 +4573,14 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4549
4573
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
4550
4574
|
const domType = node.nodeType;
|
|
4551
4575
|
vnode.el = node;
|
|
4552
|
-
if (patchFlag === -2 /* BAIL */) {
|
|
4576
|
+
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
4553
4577
|
optimized = false;
|
|
4554
4578
|
vnode.dynamicChildren = null;
|
|
4555
4579
|
}
|
|
4556
4580
|
let nextNode = null;
|
|
4557
4581
|
switch (type) {
|
|
4558
4582
|
case Text:
|
|
4559
|
-
if (domType !== 3 /* TEXT */) {
|
|
4583
|
+
if (domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
4560
4584
|
// #5728 empty text node inside a slot can cause hydration failure
|
|
4561
4585
|
// because the server rendered HTML won't contain a text node
|
|
4562
4586
|
if (vnode.children === '') {
|
|
@@ -4579,7 +4603,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4579
4603
|
}
|
|
4580
4604
|
break;
|
|
4581
4605
|
case Comment:
|
|
4582
|
-
if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
4606
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
|
|
4583
4607
|
nextNode = onMismatch();
|
|
4584
4608
|
}
|
|
4585
4609
|
else {
|
|
@@ -4587,7 +4611,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4587
4611
|
}
|
|
4588
4612
|
break;
|
|
4589
4613
|
case Static:
|
|
4590
|
-
if (domType !== 1 /* ELEMENT */) {
|
|
4614
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
4591
4615
|
nextNode = onMismatch();
|
|
4592
4616
|
}
|
|
4593
4617
|
else {
|
|
@@ -4598,7 +4622,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4598
4622
|
const needToAdoptContent = !vnode.children.length;
|
|
4599
4623
|
for (let i = 0; i < vnode.staticCount; i++) {
|
|
4600
4624
|
if (needToAdoptContent)
|
|
4601
|
-
vnode.children +=
|
|
4625
|
+
vnode.children +=
|
|
4626
|
+
nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
|
|
4627
|
+
? nextNode.outerHTML
|
|
4628
|
+
: nextNode.data;
|
|
4602
4629
|
if (i === vnode.staticCount - 1) {
|
|
4603
4630
|
vnode.anchor = nextNode;
|
|
4604
4631
|
}
|
|
@@ -4616,8 +4643,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4616
4643
|
}
|
|
4617
4644
|
break;
|
|
4618
4645
|
default:
|
|
4619
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
4620
|
-
if (domType !== 1 /* ELEMENT */ ||
|
|
4646
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
4647
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
|
|
4621
4648
|
vnode.type.toLowerCase() !==
|
|
4622
4649
|
node.tagName.toLowerCase()) {
|
|
4623
4650
|
nextNode = onMismatch();
|
|
@@ -4626,7 +4653,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4626
4653
|
nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
4627
4654
|
}
|
|
4628
4655
|
}
|
|
4629
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
4656
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4630
4657
|
// when setting up the render effect, if the initial vnode already
|
|
4631
4658
|
// has .el set, the component will perform hydration instead of mount
|
|
4632
4659
|
// on its sub-tree.
|
|
@@ -4665,15 +4692,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4665
4692
|
vnode.component.subTree = subTree;
|
|
4666
4693
|
}
|
|
4667
4694
|
}
|
|
4668
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
4669
|
-
if (domType !== 8 /* COMMENT */) {
|
|
4695
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
4696
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
|
|
4670
4697
|
nextNode = onMismatch();
|
|
4671
4698
|
}
|
|
4672
4699
|
else {
|
|
4673
4700
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
4674
4701
|
}
|
|
4675
4702
|
}
|
|
4676
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
4703
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4677
4704
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
4678
4705
|
}
|
|
4679
4706
|
else {
|
|
@@ -4701,7 +4728,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4701
4728
|
if (props) {
|
|
4702
4729
|
if (forcePatchValue ||
|
|
4703
4730
|
!optimized ||
|
|
4704
|
-
patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
|
|
4731
|
+
patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
|
|
4705
4732
|
for (const key in props) {
|
|
4706
4733
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
4707
4734
|
(shared.isOn(key) && !shared.isReservedProp(key))) {
|
|
@@ -4730,7 +4757,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4730
4757
|
}, parentSuspense);
|
|
4731
4758
|
}
|
|
4732
4759
|
// children
|
|
4733
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
|
|
4760
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
|
|
4734
4761
|
// skip if element has innerHTML / textContent
|
|
4735
4762
|
!(props && (props.innerHTML || props.textContent))) {
|
|
4736
4763
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -4748,7 +4775,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4748
4775
|
remove(cur);
|
|
4749
4776
|
}
|
|
4750
4777
|
}
|
|
4751
|
-
else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
4778
|
+
else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
4752
4779
|
if (el.textContent !== vnode.children) {
|
|
4753
4780
|
hasMismatch = true;
|
|
4754
4781
|
warn(`Hydration text content mismatch in <${vnode.type}>:\n` +
|
|
@@ -4811,7 +4838,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4811
4838
|
};
|
|
4812
4839
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
4813
4840
|
hasMismatch = true;
|
|
4814
|
-
warn(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* TEXT */
|
|
4841
|
+
warn(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* DOMNodeTypes.TEXT */
|
|
4815
4842
|
? `(text)`
|
|
4816
4843
|
: isComment(node) && node.data === '['
|
|
4817
4844
|
? `(start of fragment)`
|
|
@@ -4942,7 +4969,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4942
4969
|
unmount(n1, parentComponent, parentSuspense, true);
|
|
4943
4970
|
n1 = null;
|
|
4944
4971
|
}
|
|
4945
|
-
if (n2.patchFlag === -2 /* BAIL */) {
|
|
4972
|
+
if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
4946
4973
|
optimized = false;
|
|
4947
4974
|
n2.dynamicChildren = null;
|
|
4948
4975
|
}
|
|
@@ -4966,16 +4993,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4966
4993
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4967
4994
|
break;
|
|
4968
4995
|
default:
|
|
4969
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
4996
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
4970
4997
|
processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4971
4998
|
}
|
|
4972
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
4999
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4973
5000
|
processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4974
5001
|
}
|
|
4975
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
5002
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
4976
5003
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
4977
5004
|
}
|
|
4978
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5005
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4979
5006
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
4980
5007
|
}
|
|
4981
5008
|
else {
|
|
@@ -5061,10 +5088,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5061
5088
|
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
5062
5089
|
// mount children first, since some props may rely on child content
|
|
5063
5090
|
// being already rendered, e.g. `<select value>`
|
|
5064
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5091
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5065
5092
|
hostSetElementText(el, vnode.children);
|
|
5066
5093
|
}
|
|
5067
|
-
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5094
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5068
5095
|
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
5069
5096
|
}
|
|
5070
5097
|
if (dirs) {
|
|
@@ -5140,7 +5167,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5140
5167
|
if (parentComponent) {
|
|
5141
5168
|
let subTree = parentComponent.subTree;
|
|
5142
5169
|
if (subTree.patchFlag > 0 &&
|
|
5143
|
-
subTree.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
5170
|
+
subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
5144
5171
|
subTree =
|
|
5145
5172
|
filterSingleRoot(subTree.children) || subTree;
|
|
5146
5173
|
}
|
|
@@ -5163,7 +5190,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5163
5190
|
let { patchFlag, dynamicChildren, dirs } = n2;
|
|
5164
5191
|
// #1426 take the old vnode's patch flag into account since user may clone a
|
|
5165
5192
|
// compiler-generated vnode, which de-opts to FULL_PROPS
|
|
5166
|
-
patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
|
|
5193
|
+
patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
|
|
5167
5194
|
const oldProps = n1.props || shared.EMPTY_OBJ;
|
|
5168
5195
|
const newProps = n2.props || shared.EMPTY_OBJ;
|
|
5169
5196
|
let vnodeHook;
|
|
@@ -5198,21 +5225,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5198
5225
|
// generated by the compiler and can take the fast path.
|
|
5199
5226
|
// in this path old node and new node are guaranteed to have the same shape
|
|
5200
5227
|
// (i.e. at the exact same position in the source template)
|
|
5201
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
5228
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
5202
5229
|
// element props contain dynamic keys, full diff needed
|
|
5203
5230
|
patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
|
5204
5231
|
}
|
|
5205
5232
|
else {
|
|
5206
5233
|
// class
|
|
5207
5234
|
// this flag is matched when the element has dynamic class bindings.
|
|
5208
|
-
if (patchFlag & 2 /* CLASS */) {
|
|
5235
|
+
if (patchFlag & 2 /* PatchFlags.CLASS */) {
|
|
5209
5236
|
if (oldProps.class !== newProps.class) {
|
|
5210
5237
|
hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
|
5211
5238
|
}
|
|
5212
5239
|
}
|
|
5213
5240
|
// style
|
|
5214
5241
|
// this flag is matched when the element has dynamic style bindings
|
|
5215
|
-
if (patchFlag & 4 /* STYLE */) {
|
|
5242
|
+
if (patchFlag & 4 /* PatchFlags.STYLE */) {
|
|
5216
5243
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
|
5217
5244
|
}
|
|
5218
5245
|
// props
|
|
@@ -5221,7 +5248,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5221
5248
|
// faster iteration.
|
|
5222
5249
|
// Note dynamic keys like :[foo]="bar" will cause this optimization to
|
|
5223
5250
|
// bail out and go through a full diff because we need to unset the old key
|
|
5224
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
5251
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
5225
5252
|
// if the flag is present then dynamicProps must be non-null
|
|
5226
5253
|
const propsToUpdate = n2.dynamicProps;
|
|
5227
5254
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
@@ -5237,7 +5264,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5237
5264
|
}
|
|
5238
5265
|
// text
|
|
5239
5266
|
// This flag is matched when the element has only dynamic text children.
|
|
5240
|
-
if (patchFlag & 1 /* TEXT */) {
|
|
5267
|
+
if (patchFlag & 1 /* PatchFlags.TEXT */) {
|
|
5241
5268
|
if (n1.children !== n2.children) {
|
|
5242
5269
|
hostSetElementText(el, n2.children);
|
|
5243
5270
|
}
|
|
@@ -5271,7 +5298,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5271
5298
|
// which also requires the correct parent container
|
|
5272
5299
|
!isSameVNodeType(oldVNode, newVNode) ||
|
|
5273
5300
|
// - In the case of a component, it could contain anything.
|
|
5274
|
-
oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
|
|
5301
|
+
oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
|
|
5275
5302
|
? hostParentNode(oldVNode.el)
|
|
5276
5303
|
: // In other cases, the parent container is not actually used so we
|
|
5277
5304
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -5309,7 +5336,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5309
5336
|
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
|
5310
5337
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
5311
5338
|
if (// #5523 dev root fragment may inherit directives
|
|
5312
|
-
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
5339
|
+
(isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */)) {
|
|
5313
5340
|
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
5314
5341
|
patchFlag = 0;
|
|
5315
5342
|
optimized = false;
|
|
@@ -5331,7 +5358,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5331
5358
|
}
|
|
5332
5359
|
else {
|
|
5333
5360
|
if (patchFlag > 0 &&
|
|
5334
|
-
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
5361
|
+
patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
|
|
5335
5362
|
dynamicChildren &&
|
|
5336
5363
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
5337
5364
|
// of renderSlot() with no valid children
|
|
@@ -5364,7 +5391,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5364
5391
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
5365
5392
|
n2.slotScopeIds = slotScopeIds;
|
|
5366
5393
|
if (n1 == null) {
|
|
5367
|
-
if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
5394
|
+
if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
5368
5395
|
parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
|
5369
5396
|
}
|
|
5370
5397
|
else {
|
|
@@ -5526,10 +5553,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5526
5553
|
// activated hook for keep-alive roots.
|
|
5527
5554
|
// #1742 activated hook must be accessed after first render
|
|
5528
5555
|
// since the hook may be injected by a child keep-alive
|
|
5529
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5556
|
+
if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5530
5557
|
(parent &&
|
|
5531
5558
|
isAsyncWrapper(parent.vnode) &&
|
|
5532
|
-
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5559
|
+
parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5533
5560
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
5534
5561
|
}
|
|
5535
5562
|
instance.isMounted = true;
|
|
@@ -5640,7 +5667,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5640
5667
|
reactivity.pauseTracking();
|
|
5641
5668
|
// props update may have triggered pre-flush watchers.
|
|
5642
5669
|
// flush them before the render update.
|
|
5643
|
-
flushPreFlushCbs(
|
|
5670
|
+
flushPreFlushCbs();
|
|
5644
5671
|
reactivity.resetTracking();
|
|
5645
5672
|
};
|
|
5646
5673
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
|
@@ -5650,22 +5677,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5650
5677
|
const { patchFlag, shapeFlag } = n2;
|
|
5651
5678
|
// fast path
|
|
5652
5679
|
if (patchFlag > 0) {
|
|
5653
|
-
if (patchFlag & 128 /* KEYED_FRAGMENT */) {
|
|
5680
|
+
if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
|
|
5654
5681
|
// this could be either fully-keyed or mixed (some keyed some not)
|
|
5655
5682
|
// presence of patchFlag means children are guaranteed to be arrays
|
|
5656
5683
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5657
5684
|
return;
|
|
5658
5685
|
}
|
|
5659
|
-
else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
|
|
5686
|
+
else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
|
|
5660
5687
|
// unkeyed
|
|
5661
5688
|
patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5662
5689
|
return;
|
|
5663
5690
|
}
|
|
5664
5691
|
}
|
|
5665
5692
|
// children has 3 possibilities: text, array or no children.
|
|
5666
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5693
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5667
5694
|
// text children fast path
|
|
5668
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5695
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5669
5696
|
unmountChildren(c1, parentComponent, parentSuspense);
|
|
5670
5697
|
}
|
|
5671
5698
|
if (c2 !== c1) {
|
|
@@ -5673,9 +5700,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5673
5700
|
}
|
|
5674
5701
|
}
|
|
5675
5702
|
else {
|
|
5676
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5703
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5677
5704
|
// prev children was array
|
|
5678
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5705
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5679
5706
|
// two arrays, cannot assume anything, do full diff
|
|
5680
5707
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5681
5708
|
}
|
|
@@ -5687,11 +5714,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5687
5714
|
else {
|
|
5688
5715
|
// prev children was text OR null
|
|
5689
5716
|
// new children is array OR null
|
|
5690
|
-
if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5717
|
+
if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5691
5718
|
hostSetElementText(container, '');
|
|
5692
5719
|
}
|
|
5693
5720
|
// mount new if array
|
|
5694
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5721
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5695
5722
|
mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5696
5723
|
}
|
|
5697
5724
|
}
|
|
@@ -5882,7 +5909,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5882
5909
|
// There is no stable subsequence (e.g. a reverse)
|
|
5883
5910
|
// OR current node is not among the stable sequence
|
|
5884
5911
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
5885
|
-
move(nextChild, container, anchor, 2 /* REORDER */);
|
|
5912
|
+
move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
|
|
5886
5913
|
}
|
|
5887
5914
|
else {
|
|
5888
5915
|
j--;
|
|
@@ -5893,15 +5920,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5893
5920
|
};
|
|
5894
5921
|
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
5895
5922
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
5896
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
5923
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5897
5924
|
move(vnode.component.subTree, container, anchor, moveType);
|
|
5898
5925
|
return;
|
|
5899
5926
|
}
|
|
5900
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5927
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5901
5928
|
vnode.suspense.move(container, anchor, moveType);
|
|
5902
5929
|
return;
|
|
5903
5930
|
}
|
|
5904
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
5931
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5905
5932
|
type.move(vnode, container, anchor, internals);
|
|
5906
5933
|
return;
|
|
5907
5934
|
}
|
|
@@ -5918,11 +5945,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5918
5945
|
return;
|
|
5919
5946
|
}
|
|
5920
5947
|
// single nodes
|
|
5921
|
-
const needTransition = moveType !== 2 /* REORDER */ &&
|
|
5922
|
-
shapeFlag & 1 /* ELEMENT */ &&
|
|
5948
|
+
const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
|
|
5949
|
+
shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
5923
5950
|
transition;
|
|
5924
5951
|
if (needTransition) {
|
|
5925
|
-
if (moveType === 0 /* ENTER */) {
|
|
5952
|
+
if (moveType === 0 /* MoveType.ENTER */) {
|
|
5926
5953
|
transition.beforeEnter(el);
|
|
5927
5954
|
hostInsert(el, container, anchor);
|
|
5928
5955
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -5954,42 +5981,42 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5954
5981
|
if (ref != null) {
|
|
5955
5982
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
5956
5983
|
}
|
|
5957
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
5984
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
5958
5985
|
parentComponent.ctx.deactivate(vnode);
|
|
5959
5986
|
return;
|
|
5960
5987
|
}
|
|
5961
|
-
const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
|
|
5988
|
+
const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
|
|
5962
5989
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
5963
5990
|
let vnodeHook;
|
|
5964
5991
|
if (shouldInvokeVnodeHook &&
|
|
5965
5992
|
(vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
|
5966
5993
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
5967
5994
|
}
|
|
5968
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
5995
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5969
5996
|
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
5970
5997
|
}
|
|
5971
5998
|
else {
|
|
5972
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5999
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5973
6000
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
5974
6001
|
return;
|
|
5975
6002
|
}
|
|
5976
6003
|
if (shouldInvokeDirs) {
|
|
5977
6004
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
|
5978
6005
|
}
|
|
5979
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6006
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5980
6007
|
vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
|
5981
6008
|
}
|
|
5982
6009
|
else if (dynamicChildren &&
|
|
5983
6010
|
// #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
5984
6011
|
(type !== Fragment ||
|
|
5985
|
-
(patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
|
|
6012
|
+
(patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
|
|
5986
6013
|
// fast path for block nodes: only need to unmount dynamic children.
|
|
5987
6014
|
unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
5988
6015
|
}
|
|
5989
6016
|
else if ((type === Fragment &&
|
|
5990
6017
|
patchFlag &
|
|
5991
|
-
(128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
|
|
5992
|
-
(!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
|
|
6018
|
+
(128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
|
|
6019
|
+
(!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
|
|
5993
6020
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
5994
6021
|
}
|
|
5995
6022
|
if (doRemove) {
|
|
@@ -6010,7 +6037,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6010
6037
|
const { type, el, anchor, transition } = vnode;
|
|
6011
6038
|
if (type === Fragment) {
|
|
6012
6039
|
if (vnode.patchFlag > 0 &&
|
|
6013
|
-
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
6040
|
+
vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ &&
|
|
6014
6041
|
transition &&
|
|
6015
6042
|
!transition.persisted) {
|
|
6016
6043
|
vnode.children.forEach(child => {
|
|
@@ -6037,7 +6064,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6037
6064
|
transition.afterLeave();
|
|
6038
6065
|
}
|
|
6039
6066
|
};
|
|
6040
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ &&
|
|
6067
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
6041
6068
|
transition &&
|
|
6042
6069
|
!transition.persisted) {
|
|
6043
6070
|
const { leave, delayLeave } = transition;
|
|
@@ -6113,10 +6140,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6113
6140
|
}
|
|
6114
6141
|
};
|
|
6115
6142
|
const getNextHostNode = vnode => {
|
|
6116
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */) {
|
|
6143
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6117
6144
|
return getNextHostNode(vnode.component.subTree);
|
|
6118
6145
|
}
|
|
6119
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
6146
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6120
6147
|
return vnode.suspense.next();
|
|
6121
6148
|
}
|
|
6122
6149
|
return hostNextSibling((vnode.anchor || vnode.el));
|
|
@@ -6130,6 +6157,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6130
6157
|
else {
|
|
6131
6158
|
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
|
6132
6159
|
}
|
|
6160
|
+
flushPreFlushCbs();
|
|
6133
6161
|
flushPostFlushCbs();
|
|
6134
6162
|
container._vnode = vnode;
|
|
6135
6163
|
};
|
|
@@ -6179,8 +6207,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
6179
6207
|
// guaranteed to be vnodes
|
|
6180
6208
|
const c1 = ch1[i];
|
|
6181
6209
|
let c2 = ch2[i];
|
|
6182
|
-
if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
|
|
6183
|
-
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
|
|
6210
|
+
if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
|
|
6211
|
+
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
6184
6212
|
c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
|
6185
6213
|
c2.el = c1.el;
|
|
6186
6214
|
}
|
|
@@ -6300,7 +6328,7 @@ const TeleportImpl = {
|
|
|
6300
6328
|
const mount = (container, anchor) => {
|
|
6301
6329
|
// Teleport *always* has Array children. This is enforced in both the
|
|
6302
6330
|
// compiler and vnode children normalization.
|
|
6303
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6331
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6304
6332
|
mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6305
6333
|
}
|
|
6306
6334
|
};
|
|
@@ -6336,7 +6364,7 @@ const TeleportImpl = {
|
|
|
6336
6364
|
if (!wasDisabled) {
|
|
6337
6365
|
// enabled -> disabled
|
|
6338
6366
|
// move into main container
|
|
6339
|
-
moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
|
|
6367
|
+
moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
6340
6368
|
}
|
|
6341
6369
|
}
|
|
6342
6370
|
else {
|
|
@@ -6344,7 +6372,7 @@ const TeleportImpl = {
|
|
|
6344
6372
|
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
6345
6373
|
const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
|
6346
6374
|
if (nextTarget) {
|
|
6347
|
-
moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
|
|
6375
|
+
moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
|
|
6348
6376
|
}
|
|
6349
6377
|
else {
|
|
6350
6378
|
warn('Invalid Teleport target on update:', target, `(${typeof target})`);
|
|
@@ -6353,7 +6381,7 @@ const TeleportImpl = {
|
|
|
6353
6381
|
else if (wasDisabled) {
|
|
6354
6382
|
// disabled -> enabled
|
|
6355
6383
|
// move into teleport target
|
|
6356
|
-
moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
|
|
6384
|
+
moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
6357
6385
|
}
|
|
6358
6386
|
}
|
|
6359
6387
|
}
|
|
@@ -6366,7 +6394,7 @@ const TeleportImpl = {
|
|
|
6366
6394
|
// an unmounted teleport should always remove its children if not disabled
|
|
6367
6395
|
if (doRemove || !isTeleportDisabled(props)) {
|
|
6368
6396
|
hostRemove(anchor);
|
|
6369
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6397
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6370
6398
|
for (let i = 0; i < children.length; i++) {
|
|
6371
6399
|
const child = children[i];
|
|
6372
6400
|
unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
|
|
@@ -6377,13 +6405,13 @@ const TeleportImpl = {
|
|
|
6377
6405
|
move: moveTeleport,
|
|
6378
6406
|
hydrate: hydrateTeleport
|
|
6379
6407
|
};
|
|
6380
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
|
|
6408
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* TeleportMoveTypes.REORDER */) {
|
|
6381
6409
|
// move target anchor if this is a target change.
|
|
6382
|
-
if (moveType === 0 /* TARGET_CHANGE */) {
|
|
6410
|
+
if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
|
|
6383
6411
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
6384
6412
|
}
|
|
6385
6413
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
6386
|
-
const isReorder = moveType === 2 /* REORDER */;
|
|
6414
|
+
const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
|
|
6387
6415
|
// move main view anchor if this is a re-order.
|
|
6388
6416
|
if (isReorder) {
|
|
6389
6417
|
insert(el, container, parentAnchor);
|
|
@@ -6393,9 +6421,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
6393
6421
|
// is not a reorder, or the teleport is disabled
|
|
6394
6422
|
if (!isReorder || isTeleportDisabled(props)) {
|
|
6395
6423
|
// Teleport has either Array children or no children.
|
|
6396
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6424
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6397
6425
|
for (let i = 0; i < children.length; i++) {
|
|
6398
|
-
move(children[i], container, parentAnchor, 2 /* REORDER */);
|
|
6426
|
+
move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
|
|
6399
6427
|
}
|
|
6400
6428
|
}
|
|
6401
6429
|
}
|
|
@@ -6410,7 +6438,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
6410
6438
|
// if multiple teleports rendered to the same target element, we need to
|
|
6411
6439
|
// pick up from where the last teleport finished instead of the first node
|
|
6412
6440
|
const targetNode = target._lpa || target.firstChild;
|
|
6413
|
-
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6441
|
+
if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6414
6442
|
if (isTeleportDisabled(vnode.props)) {
|
|
6415
6443
|
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
6416
6444
|
vnode.targetAnchor = targetNode;
|
|
@@ -6532,7 +6560,7 @@ function isVNode(value) {
|
|
|
6532
6560
|
return value ? value.__v_isVNode === true : false;
|
|
6533
6561
|
}
|
|
6534
6562
|
function isSameVNodeType(n1, n2) {
|
|
6535
|
-
if (n2.shapeFlag & 6 /* COMPONENT */ &&
|
|
6563
|
+
if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
6536
6564
|
hmrDirtyComponents.has(n2.type)) {
|
|
6537
6565
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
6538
6566
|
return false;
|
|
@@ -6563,7 +6591,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
6563
6591
|
: ref
|
|
6564
6592
|
: null);
|
|
6565
6593
|
};
|
|
6566
|
-
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
6594
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
6567
6595
|
const vnode = {
|
|
6568
6596
|
__v_isVNode: true,
|
|
6569
6597
|
__v_skip: true,
|
|
@@ -6594,7 +6622,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6594
6622
|
if (needFullChildrenNormalization) {
|
|
6595
6623
|
normalizeChildren(vnode, children);
|
|
6596
6624
|
// normalize suspense children
|
|
6597
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6625
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6598
6626
|
type.normalize(vnode);
|
|
6599
6627
|
}
|
|
6600
6628
|
}
|
|
@@ -6602,8 +6630,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6602
6630
|
// compiled element vnode - if children is passed, only possible types are
|
|
6603
6631
|
// string or Array.
|
|
6604
6632
|
vnode.shapeFlag |= shared.isString(children)
|
|
6605
|
-
? 8 /* TEXT_CHILDREN */
|
|
6606
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
6633
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
6634
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6607
6635
|
}
|
|
6608
6636
|
// validate key
|
|
6609
6637
|
if (vnode.key !== vnode.key) {
|
|
@@ -6619,10 +6647,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6619
6647
|
// component nodes also should always be patched, because even if the
|
|
6620
6648
|
// component doesn't need to update, it needs to persist the instance on to
|
|
6621
6649
|
// the next vnode so that it can be properly unmounted later.
|
|
6622
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
6650
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
6623
6651
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
6624
6652
|
// vnode should not be considered dynamic due to handler caching.
|
|
6625
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
6653
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
6626
6654
|
currentBlock.push(vnode);
|
|
6627
6655
|
}
|
|
6628
6656
|
return vnode;
|
|
@@ -6644,14 +6672,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6644
6672
|
normalizeChildren(cloned, children);
|
|
6645
6673
|
}
|
|
6646
6674
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
6647
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
6675
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6648
6676
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
6649
6677
|
}
|
|
6650
6678
|
else {
|
|
6651
6679
|
currentBlock.push(cloned);
|
|
6652
6680
|
}
|
|
6653
6681
|
}
|
|
6654
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
6682
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
6655
6683
|
return cloned;
|
|
6656
6684
|
}
|
|
6657
6685
|
// class component normalization.
|
|
@@ -6677,17 +6705,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6677
6705
|
}
|
|
6678
6706
|
// encode the vnode type information into a bitmap
|
|
6679
6707
|
const shapeFlag = shared.isString(type)
|
|
6680
|
-
? 1 /* ELEMENT */
|
|
6708
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
6681
6709
|
: isSuspense(type)
|
|
6682
|
-
? 128 /* SUSPENSE */
|
|
6710
|
+
? 128 /* ShapeFlags.SUSPENSE */
|
|
6683
6711
|
: isTeleport(type)
|
|
6684
|
-
? 64 /* TELEPORT */
|
|
6712
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
6685
6713
|
: shared.isObject(type)
|
|
6686
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
6714
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
6687
6715
|
: shared.isFunction(type)
|
|
6688
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
6716
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
6689
6717
|
: 0;
|
|
6690
|
-
if (shapeFlag & 4 /* STATEFUL_COMPONENT */ && reactivity.isProxy(type)) {
|
|
6718
|
+
if (shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && reactivity.isProxy(type)) {
|
|
6691
6719
|
type = reactivity.toRaw(type);
|
|
6692
6720
|
warn(`Vue received a Component which was made a reactive object. This can ` +
|
|
6693
6721
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
@@ -6726,7 +6754,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6726
6754
|
: ref,
|
|
6727
6755
|
scopeId: vnode.scopeId,
|
|
6728
6756
|
slotScopeIds: vnode.slotScopeIds,
|
|
6729
|
-
children: patchFlag === -1 /* HOISTED */ && shared.isArray(children)
|
|
6757
|
+
children: patchFlag === -1 /* PatchFlags.HOISTED */ && shared.isArray(children)
|
|
6730
6758
|
? children.map(deepCloneVNode)
|
|
6731
6759
|
: children,
|
|
6732
6760
|
target: vnode.target,
|
|
@@ -6739,8 +6767,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6739
6767
|
// fast paths only.
|
|
6740
6768
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
6741
6769
|
? patchFlag === -1 // hoisted node
|
|
6742
|
-
? 16 /* FULL_PROPS */
|
|
6743
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
6770
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
6771
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
6744
6772
|
: patchFlag,
|
|
6745
6773
|
dynamicProps: vnode.dynamicProps,
|
|
6746
6774
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -6830,10 +6858,10 @@ function normalizeChildren(vnode, children) {
|
|
|
6830
6858
|
children = null;
|
|
6831
6859
|
}
|
|
6832
6860
|
else if (shared.isArray(children)) {
|
|
6833
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6861
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6834
6862
|
}
|
|
6835
6863
|
else if (typeof children === 'object') {
|
|
6836
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
6864
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
6837
6865
|
// Normalize slot to plain children for plain element and Teleport
|
|
6838
6866
|
const slot = children.default;
|
|
6839
6867
|
if (slot) {
|
|
@@ -6845,37 +6873,37 @@ function normalizeChildren(vnode, children) {
|
|
|
6845
6873
|
return;
|
|
6846
6874
|
}
|
|
6847
6875
|
else {
|
|
6848
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6876
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6849
6877
|
const slotFlag = children._;
|
|
6850
6878
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
6851
6879
|
children._ctx = currentRenderingInstance;
|
|
6852
6880
|
}
|
|
6853
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
6881
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
6854
6882
|
// a child component receives forwarded slots from the parent.
|
|
6855
6883
|
// its slot type is determined by its parent's slot type.
|
|
6856
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
6857
|
-
children._ = 1 /* STABLE */;
|
|
6884
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
6885
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
6858
6886
|
}
|
|
6859
6887
|
else {
|
|
6860
|
-
children._ = 2 /* DYNAMIC */;
|
|
6861
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
6888
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
6889
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
6862
6890
|
}
|
|
6863
6891
|
}
|
|
6864
6892
|
}
|
|
6865
6893
|
}
|
|
6866
6894
|
else if (shared.isFunction(children)) {
|
|
6867
6895
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
6868
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6896
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6869
6897
|
}
|
|
6870
6898
|
else {
|
|
6871
6899
|
children = String(children);
|
|
6872
6900
|
// force teleport children to array so it can be moved around
|
|
6873
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6874
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6901
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6902
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6875
6903
|
children = [createTextVNode(children)];
|
|
6876
6904
|
}
|
|
6877
6905
|
else {
|
|
6878
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
6906
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
6879
6907
|
}
|
|
6880
6908
|
}
|
|
6881
6909
|
vnode.children = children;
|
|
@@ -6913,7 +6941,7 @@ function mergeProps(...args) {
|
|
|
6913
6941
|
return ret;
|
|
6914
6942
|
}
|
|
6915
6943
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
6916
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
6944
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
|
|
6917
6945
|
vnode,
|
|
6918
6946
|
prevVNode
|
|
6919
6947
|
]);
|
|
@@ -7021,7 +7049,7 @@ function validateComponentName(name, config) {
|
|
|
7021
7049
|
}
|
|
7022
7050
|
}
|
|
7023
7051
|
function isStatefulComponent(instance) {
|
|
7024
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
7052
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
7025
7053
|
}
|
|
7026
7054
|
let isInSSRComponentSetup = false;
|
|
7027
7055
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -7076,7 +7104,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7076
7104
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
7077
7105
|
setCurrentInstance(instance);
|
|
7078
7106
|
reactivity.pauseTracking();
|
|
7079
|
-
const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [reactivity.shallowReadonly(instance.props) , setupContext]);
|
|
7107
|
+
const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [reactivity.shallowReadonly(instance.props) , setupContext]);
|
|
7080
7108
|
reactivity.resetTracking();
|
|
7081
7109
|
unsetCurrentInstance();
|
|
7082
7110
|
if (shared.isPromise(setupResult)) {
|
|
@@ -7088,7 +7116,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7088
7116
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
7089
7117
|
})
|
|
7090
7118
|
.catch(e => {
|
|
7091
|
-
handleError(e, instance, 0 /* SETUP_FUNCTION */);
|
|
7119
|
+
handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
7092
7120
|
});
|
|
7093
7121
|
}
|
|
7094
7122
|
else {
|
|
@@ -7219,7 +7247,7 @@ function createAttrsProxy(instance) {
|
|
|
7219
7247
|
return new Proxy(instance.attrs, {
|
|
7220
7248
|
get(target, key) {
|
|
7221
7249
|
markAttrsAccessed();
|
|
7222
|
-
reactivity.track(instance, "get" /* GET */, '$attrs');
|
|
7250
|
+
reactivity.track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
7223
7251
|
return target[key];
|
|
7224
7252
|
},
|
|
7225
7253
|
set() {
|
|
@@ -7275,10 +7303,10 @@ function getExposeProxy(instance) {
|
|
|
7275
7303
|
}
|
|
7276
7304
|
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
7277
7305
|
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
7278
|
-
function getComponentName(Component) {
|
|
7306
|
+
function getComponentName(Component, includeInferred = true) {
|
|
7279
7307
|
return shared.isFunction(Component)
|
|
7280
7308
|
? Component.displayName || Component.name
|
|
7281
|
-
: Component.name;
|
|
7309
|
+
: Component.name || (includeInferred && Component.__name);
|
|
7282
7310
|
}
|
|
7283
7311
|
/* istanbul ignore next */
|
|
7284
7312
|
function formatComponentName(instance, Component, isRoot = false) {
|
|
@@ -7506,7 +7534,7 @@ const useSSRContext = () => {
|
|
|
7506
7534
|
};
|
|
7507
7535
|
|
|
7508
7536
|
function isShallow(value) {
|
|
7509
|
-
return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
|
|
7537
|
+
return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
|
|
7510
7538
|
}
|
|
7511
7539
|
|
|
7512
7540
|
function initCustomFormatter() {
|
|
@@ -7726,7 +7754,7 @@ function isMemoSame(cached, memo) {
|
|
|
7726
7754
|
}
|
|
7727
7755
|
|
|
7728
7756
|
// Core API ------------------------------------------------------------------
|
|
7729
|
-
const version = "3.2.
|
|
7757
|
+
const version = "3.2.38";
|
|
7730
7758
|
const _ssrUtils = {
|
|
7731
7759
|
createComponentInstance,
|
|
7732
7760
|
setupComponent,
|
|
@@ -7736,7 +7764,7 @@ const _ssrUtils = {
|
|
|
7736
7764
|
normalizeVNode
|
|
7737
7765
|
};
|
|
7738
7766
|
/**
|
|
7739
|
-
* SSR utils for \@vue/server-renderer. Only exposed in
|
|
7767
|
+
* SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
|
|
7740
7768
|
* @internal
|
|
7741
7769
|
*/
|
|
7742
7770
|
const ssrUtils = (_ssrUtils );
|