@vue/runtime-core 3.2.37 → 3.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-core.cjs.js +316 -293
- package/dist/runtime-core.cjs.prod.js +255 -238
- package/dist/runtime-core.d.ts +6 -4
- package/dist/runtime-core.esm-bundler.js +320 -299
- package/package.json +3 -3
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,
|
|
@@ -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);
|
|
@@ -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.
|
|
@@ -4551,14 +4573,14 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4551
4573
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
4552
4574
|
const domType = node.nodeType;
|
|
4553
4575
|
vnode.el = node;
|
|
4554
|
-
if (patchFlag === -2 /* BAIL */) {
|
|
4576
|
+
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
4555
4577
|
optimized = false;
|
|
4556
4578
|
vnode.dynamicChildren = null;
|
|
4557
4579
|
}
|
|
4558
4580
|
let nextNode = null;
|
|
4559
4581
|
switch (type) {
|
|
4560
4582
|
case Text:
|
|
4561
|
-
if (domType !== 3 /* TEXT */) {
|
|
4583
|
+
if (domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
4562
4584
|
// #5728 empty text node inside a slot can cause hydration failure
|
|
4563
4585
|
// because the server rendered HTML won't contain a text node
|
|
4564
4586
|
if (vnode.children === '') {
|
|
@@ -4581,7 +4603,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4581
4603
|
}
|
|
4582
4604
|
break;
|
|
4583
4605
|
case Comment:
|
|
4584
|
-
if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
4606
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
|
|
4585
4607
|
nextNode = onMismatch();
|
|
4586
4608
|
}
|
|
4587
4609
|
else {
|
|
@@ -4589,7 +4611,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4589
4611
|
}
|
|
4590
4612
|
break;
|
|
4591
4613
|
case Static:
|
|
4592
|
-
if (domType !== 1 /* ELEMENT */ && domType !== 3 /* TEXT */) {
|
|
4614
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
4593
4615
|
nextNode = onMismatch();
|
|
4594
4616
|
}
|
|
4595
4617
|
else {
|
|
@@ -4601,7 +4623,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4601
4623
|
for (let i = 0; i < vnode.staticCount; i++) {
|
|
4602
4624
|
if (needToAdoptContent)
|
|
4603
4625
|
vnode.children +=
|
|
4604
|
-
nextNode.nodeType === 1 /* ELEMENT */
|
|
4626
|
+
nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
|
|
4605
4627
|
? nextNode.outerHTML
|
|
4606
4628
|
: nextNode.data;
|
|
4607
4629
|
if (i === vnode.staticCount - 1) {
|
|
@@ -4621,8 +4643,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4621
4643
|
}
|
|
4622
4644
|
break;
|
|
4623
4645
|
default:
|
|
4624
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
4625
|
-
if (domType !== 1 /* ELEMENT */ ||
|
|
4646
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
4647
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
|
|
4626
4648
|
vnode.type.toLowerCase() !==
|
|
4627
4649
|
node.tagName.toLowerCase()) {
|
|
4628
4650
|
nextNode = onMismatch();
|
|
@@ -4631,7 +4653,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4631
4653
|
nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
4632
4654
|
}
|
|
4633
4655
|
}
|
|
4634
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
4656
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4635
4657
|
// when setting up the render effect, if the initial vnode already
|
|
4636
4658
|
// has .el set, the component will perform hydration instead of mount
|
|
4637
4659
|
// on its sub-tree.
|
|
@@ -4670,15 +4692,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4670
4692
|
vnode.component.subTree = subTree;
|
|
4671
4693
|
}
|
|
4672
4694
|
}
|
|
4673
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
4674
|
-
if (domType !== 8 /* COMMENT */) {
|
|
4695
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
4696
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
|
|
4675
4697
|
nextNode = onMismatch();
|
|
4676
4698
|
}
|
|
4677
4699
|
else {
|
|
4678
4700
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
4679
4701
|
}
|
|
4680
4702
|
}
|
|
4681
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
4703
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4682
4704
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
4683
4705
|
}
|
|
4684
4706
|
else {
|
|
@@ -4706,7 +4728,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4706
4728
|
if (props) {
|
|
4707
4729
|
if (forcePatchValue ||
|
|
4708
4730
|
!optimized ||
|
|
4709
|
-
patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
|
|
4731
|
+
patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
|
|
4710
4732
|
for (const key in props) {
|
|
4711
4733
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
4712
4734
|
(shared.isOn(key) && !shared.isReservedProp(key))) {
|
|
@@ -4735,7 +4757,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4735
4757
|
}, parentSuspense);
|
|
4736
4758
|
}
|
|
4737
4759
|
// children
|
|
4738
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
|
|
4760
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
|
|
4739
4761
|
// skip if element has innerHTML / textContent
|
|
4740
4762
|
!(props && (props.innerHTML || props.textContent))) {
|
|
4741
4763
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -4753,7 +4775,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4753
4775
|
remove(cur);
|
|
4754
4776
|
}
|
|
4755
4777
|
}
|
|
4756
|
-
else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
4778
|
+
else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
4757
4779
|
if (el.textContent !== vnode.children) {
|
|
4758
4780
|
hasMismatch = true;
|
|
4759
4781
|
warn(`Hydration text content mismatch in <${vnode.type}>:\n` +
|
|
@@ -4816,7 +4838,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4816
4838
|
};
|
|
4817
4839
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
4818
4840
|
hasMismatch = true;
|
|
4819
|
-
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 */
|
|
4820
4842
|
? `(text)`
|
|
4821
4843
|
: isComment(node) && node.data === '['
|
|
4822
4844
|
? `(start of fragment)`
|
|
@@ -4947,7 +4969,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4947
4969
|
unmount(n1, parentComponent, parentSuspense, true);
|
|
4948
4970
|
n1 = null;
|
|
4949
4971
|
}
|
|
4950
|
-
if (n2.patchFlag === -2 /* BAIL */) {
|
|
4972
|
+
if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
4951
4973
|
optimized = false;
|
|
4952
4974
|
n2.dynamicChildren = null;
|
|
4953
4975
|
}
|
|
@@ -4971,16 +4993,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4971
4993
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4972
4994
|
break;
|
|
4973
4995
|
default:
|
|
4974
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
4996
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
4975
4997
|
processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4976
4998
|
}
|
|
4977
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
4999
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4978
5000
|
processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
4979
5001
|
}
|
|
4980
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
5002
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
4981
5003
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
4982
5004
|
}
|
|
4983
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5005
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4984
5006
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
4985
5007
|
}
|
|
4986
5008
|
else {
|
|
@@ -5066,10 +5088,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5066
5088
|
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
5067
5089
|
// mount children first, since some props may rely on child content
|
|
5068
5090
|
// being already rendered, e.g. `<select value>`
|
|
5069
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5091
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5070
5092
|
hostSetElementText(el, vnode.children);
|
|
5071
5093
|
}
|
|
5072
|
-
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5094
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5073
5095
|
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
5074
5096
|
}
|
|
5075
5097
|
if (dirs) {
|
|
@@ -5145,7 +5167,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5145
5167
|
if (parentComponent) {
|
|
5146
5168
|
let subTree = parentComponent.subTree;
|
|
5147
5169
|
if (subTree.patchFlag > 0 &&
|
|
5148
|
-
subTree.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
5170
|
+
subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
5149
5171
|
subTree =
|
|
5150
5172
|
filterSingleRoot(subTree.children) || subTree;
|
|
5151
5173
|
}
|
|
@@ -5168,7 +5190,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5168
5190
|
let { patchFlag, dynamicChildren, dirs } = n2;
|
|
5169
5191
|
// #1426 take the old vnode's patch flag into account since user may clone a
|
|
5170
5192
|
// compiler-generated vnode, which de-opts to FULL_PROPS
|
|
5171
|
-
patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
|
|
5193
|
+
patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
|
|
5172
5194
|
const oldProps = n1.props || shared.EMPTY_OBJ;
|
|
5173
5195
|
const newProps = n2.props || shared.EMPTY_OBJ;
|
|
5174
5196
|
let vnodeHook;
|
|
@@ -5203,21 +5225,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5203
5225
|
// generated by the compiler and can take the fast path.
|
|
5204
5226
|
// in this path old node and new node are guaranteed to have the same shape
|
|
5205
5227
|
// (i.e. at the exact same position in the source template)
|
|
5206
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
5228
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
5207
5229
|
// element props contain dynamic keys, full diff needed
|
|
5208
5230
|
patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
|
5209
5231
|
}
|
|
5210
5232
|
else {
|
|
5211
5233
|
// class
|
|
5212
5234
|
// this flag is matched when the element has dynamic class bindings.
|
|
5213
|
-
if (patchFlag & 2 /* CLASS */) {
|
|
5235
|
+
if (patchFlag & 2 /* PatchFlags.CLASS */) {
|
|
5214
5236
|
if (oldProps.class !== newProps.class) {
|
|
5215
5237
|
hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
|
5216
5238
|
}
|
|
5217
5239
|
}
|
|
5218
5240
|
// style
|
|
5219
5241
|
// this flag is matched when the element has dynamic style bindings
|
|
5220
|
-
if (patchFlag & 4 /* STYLE */) {
|
|
5242
|
+
if (patchFlag & 4 /* PatchFlags.STYLE */) {
|
|
5221
5243
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
|
5222
5244
|
}
|
|
5223
5245
|
// props
|
|
@@ -5226,7 +5248,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5226
5248
|
// faster iteration.
|
|
5227
5249
|
// Note dynamic keys like :[foo]="bar" will cause this optimization to
|
|
5228
5250
|
// bail out and go through a full diff because we need to unset the old key
|
|
5229
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
5251
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
5230
5252
|
// if the flag is present then dynamicProps must be non-null
|
|
5231
5253
|
const propsToUpdate = n2.dynamicProps;
|
|
5232
5254
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
@@ -5242,7 +5264,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5242
5264
|
}
|
|
5243
5265
|
// text
|
|
5244
5266
|
// This flag is matched when the element has only dynamic text children.
|
|
5245
|
-
if (patchFlag & 1 /* TEXT */) {
|
|
5267
|
+
if (patchFlag & 1 /* PatchFlags.TEXT */) {
|
|
5246
5268
|
if (n1.children !== n2.children) {
|
|
5247
5269
|
hostSetElementText(el, n2.children);
|
|
5248
5270
|
}
|
|
@@ -5276,7 +5298,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5276
5298
|
// which also requires the correct parent container
|
|
5277
5299
|
!isSameVNodeType(oldVNode, newVNode) ||
|
|
5278
5300
|
// - In the case of a component, it could contain anything.
|
|
5279
|
-
oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
|
|
5301
|
+
oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
|
|
5280
5302
|
? hostParentNode(oldVNode.el)
|
|
5281
5303
|
: // In other cases, the parent container is not actually used so we
|
|
5282
5304
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -5314,7 +5336,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5314
5336
|
const fragmentEndAnchor = (n2.anchor = n1 ? n1.anchor : hostCreateText(''));
|
|
5315
5337
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
5316
5338
|
if (// #5523 dev root fragment may inherit directives
|
|
5317
|
-
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
5339
|
+
(isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */)) {
|
|
5318
5340
|
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
5319
5341
|
patchFlag = 0;
|
|
5320
5342
|
optimized = false;
|
|
@@ -5336,7 +5358,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5336
5358
|
}
|
|
5337
5359
|
else {
|
|
5338
5360
|
if (patchFlag > 0 &&
|
|
5339
|
-
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
5361
|
+
patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
|
|
5340
5362
|
dynamicChildren &&
|
|
5341
5363
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
5342
5364
|
// of renderSlot() with no valid children
|
|
@@ -5369,7 +5391,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5369
5391
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
5370
5392
|
n2.slotScopeIds = slotScopeIds;
|
|
5371
5393
|
if (n1 == null) {
|
|
5372
|
-
if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
5394
|
+
if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
5373
5395
|
parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
|
5374
5396
|
}
|
|
5375
5397
|
else {
|
|
@@ -5531,10 +5553,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5531
5553
|
// activated hook for keep-alive roots.
|
|
5532
5554
|
// #1742 activated hook must be accessed after first render
|
|
5533
5555
|
// since the hook may be injected by a child keep-alive
|
|
5534
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5556
|
+
if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5535
5557
|
(parent &&
|
|
5536
5558
|
isAsyncWrapper(parent.vnode) &&
|
|
5537
|
-
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5559
|
+
parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5538
5560
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
5539
5561
|
}
|
|
5540
5562
|
instance.isMounted = true;
|
|
@@ -5645,7 +5667,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5645
5667
|
reactivity.pauseTracking();
|
|
5646
5668
|
// props update may have triggered pre-flush watchers.
|
|
5647
5669
|
// flush them before the render update.
|
|
5648
|
-
flushPreFlushCbs(
|
|
5670
|
+
flushPreFlushCbs();
|
|
5649
5671
|
reactivity.resetTracking();
|
|
5650
5672
|
};
|
|
5651
5673
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
|
@@ -5655,22 +5677,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5655
5677
|
const { patchFlag, shapeFlag } = n2;
|
|
5656
5678
|
// fast path
|
|
5657
5679
|
if (patchFlag > 0) {
|
|
5658
|
-
if (patchFlag & 128 /* KEYED_FRAGMENT */) {
|
|
5680
|
+
if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
|
|
5659
5681
|
// this could be either fully-keyed or mixed (some keyed some not)
|
|
5660
5682
|
// presence of patchFlag means children are guaranteed to be arrays
|
|
5661
5683
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5662
5684
|
return;
|
|
5663
5685
|
}
|
|
5664
|
-
else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
|
|
5686
|
+
else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
|
|
5665
5687
|
// unkeyed
|
|
5666
5688
|
patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5667
5689
|
return;
|
|
5668
5690
|
}
|
|
5669
5691
|
}
|
|
5670
5692
|
// children has 3 possibilities: text, array or no children.
|
|
5671
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5693
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5672
5694
|
// text children fast path
|
|
5673
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5695
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5674
5696
|
unmountChildren(c1, parentComponent, parentSuspense);
|
|
5675
5697
|
}
|
|
5676
5698
|
if (c2 !== c1) {
|
|
@@ -5678,9 +5700,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5678
5700
|
}
|
|
5679
5701
|
}
|
|
5680
5702
|
else {
|
|
5681
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5703
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5682
5704
|
// prev children was array
|
|
5683
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5705
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5684
5706
|
// two arrays, cannot assume anything, do full diff
|
|
5685
5707
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5686
5708
|
}
|
|
@@ -5692,11 +5714,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5692
5714
|
else {
|
|
5693
5715
|
// prev children was text OR null
|
|
5694
5716
|
// new children is array OR null
|
|
5695
|
-
if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5717
|
+
if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5696
5718
|
hostSetElementText(container, '');
|
|
5697
5719
|
}
|
|
5698
5720
|
// mount new if array
|
|
5699
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5721
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5700
5722
|
mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5701
5723
|
}
|
|
5702
5724
|
}
|
|
@@ -5887,7 +5909,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5887
5909
|
// There is no stable subsequence (e.g. a reverse)
|
|
5888
5910
|
// OR current node is not among the stable sequence
|
|
5889
5911
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
5890
|
-
move(nextChild, container, anchor, 2 /* REORDER */);
|
|
5912
|
+
move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
|
|
5891
5913
|
}
|
|
5892
5914
|
else {
|
|
5893
5915
|
j--;
|
|
@@ -5898,15 +5920,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5898
5920
|
};
|
|
5899
5921
|
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
5900
5922
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
5901
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
5923
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5902
5924
|
move(vnode.component.subTree, container, anchor, moveType);
|
|
5903
5925
|
return;
|
|
5904
5926
|
}
|
|
5905
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5927
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5906
5928
|
vnode.suspense.move(container, anchor, moveType);
|
|
5907
5929
|
return;
|
|
5908
5930
|
}
|
|
5909
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
5931
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5910
5932
|
type.move(vnode, container, anchor, internals);
|
|
5911
5933
|
return;
|
|
5912
5934
|
}
|
|
@@ -5923,11 +5945,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5923
5945
|
return;
|
|
5924
5946
|
}
|
|
5925
5947
|
// single nodes
|
|
5926
|
-
const needTransition = moveType !== 2 /* REORDER */ &&
|
|
5927
|
-
shapeFlag & 1 /* ELEMENT */ &&
|
|
5948
|
+
const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
|
|
5949
|
+
shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
5928
5950
|
transition;
|
|
5929
5951
|
if (needTransition) {
|
|
5930
|
-
if (moveType === 0 /* ENTER */) {
|
|
5952
|
+
if (moveType === 0 /* MoveType.ENTER */) {
|
|
5931
5953
|
transition.beforeEnter(el);
|
|
5932
5954
|
hostInsert(el, container, anchor);
|
|
5933
5955
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -5959,42 +5981,42 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5959
5981
|
if (ref != null) {
|
|
5960
5982
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
5961
5983
|
}
|
|
5962
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
5984
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
5963
5985
|
parentComponent.ctx.deactivate(vnode);
|
|
5964
5986
|
return;
|
|
5965
5987
|
}
|
|
5966
|
-
const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
|
|
5988
|
+
const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
|
|
5967
5989
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
5968
5990
|
let vnodeHook;
|
|
5969
5991
|
if (shouldInvokeVnodeHook &&
|
|
5970
5992
|
(vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
|
5971
5993
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
5972
5994
|
}
|
|
5973
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
5995
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5974
5996
|
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
5975
5997
|
}
|
|
5976
5998
|
else {
|
|
5977
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5999
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5978
6000
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
5979
6001
|
return;
|
|
5980
6002
|
}
|
|
5981
6003
|
if (shouldInvokeDirs) {
|
|
5982
6004
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
|
5983
6005
|
}
|
|
5984
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6006
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5985
6007
|
vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
|
5986
6008
|
}
|
|
5987
6009
|
else if (dynamicChildren &&
|
|
5988
6010
|
// #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
5989
6011
|
(type !== Fragment ||
|
|
5990
|
-
(patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
|
|
6012
|
+
(patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
|
|
5991
6013
|
// fast path for block nodes: only need to unmount dynamic children.
|
|
5992
6014
|
unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
5993
6015
|
}
|
|
5994
6016
|
else if ((type === Fragment &&
|
|
5995
6017
|
patchFlag &
|
|
5996
|
-
(128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
|
|
5997
|
-
(!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
|
|
6018
|
+
(128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
|
|
6019
|
+
(!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
|
|
5998
6020
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
5999
6021
|
}
|
|
6000
6022
|
if (doRemove) {
|
|
@@ -6015,7 +6037,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6015
6037
|
const { type, el, anchor, transition } = vnode;
|
|
6016
6038
|
if (type === Fragment) {
|
|
6017
6039
|
if (vnode.patchFlag > 0 &&
|
|
6018
|
-
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
6040
|
+
vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ &&
|
|
6019
6041
|
transition &&
|
|
6020
6042
|
!transition.persisted) {
|
|
6021
6043
|
vnode.children.forEach(child => {
|
|
@@ -6042,7 +6064,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6042
6064
|
transition.afterLeave();
|
|
6043
6065
|
}
|
|
6044
6066
|
};
|
|
6045
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ &&
|
|
6067
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
6046
6068
|
transition &&
|
|
6047
6069
|
!transition.persisted) {
|
|
6048
6070
|
const { leave, delayLeave } = transition;
|
|
@@ -6118,10 +6140,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6118
6140
|
}
|
|
6119
6141
|
};
|
|
6120
6142
|
const getNextHostNode = vnode => {
|
|
6121
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */) {
|
|
6143
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6122
6144
|
return getNextHostNode(vnode.component.subTree);
|
|
6123
6145
|
}
|
|
6124
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
6146
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6125
6147
|
return vnode.suspense.next();
|
|
6126
6148
|
}
|
|
6127
6149
|
return hostNextSibling((vnode.anchor || vnode.el));
|
|
@@ -6135,6 +6157,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6135
6157
|
else {
|
|
6136
6158
|
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
|
6137
6159
|
}
|
|
6160
|
+
flushPreFlushCbs();
|
|
6138
6161
|
flushPostFlushCbs();
|
|
6139
6162
|
container._vnode = vnode;
|
|
6140
6163
|
};
|
|
@@ -6184,8 +6207,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
6184
6207
|
// guaranteed to be vnodes
|
|
6185
6208
|
const c1 = ch1[i];
|
|
6186
6209
|
let c2 = ch2[i];
|
|
6187
|
-
if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
|
|
6188
|
-
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 */) {
|
|
6189
6212
|
c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
|
6190
6213
|
c2.el = c1.el;
|
|
6191
6214
|
}
|
|
@@ -6305,7 +6328,7 @@ const TeleportImpl = {
|
|
|
6305
6328
|
const mount = (container, anchor) => {
|
|
6306
6329
|
// Teleport *always* has Array children. This is enforced in both the
|
|
6307
6330
|
// compiler and vnode children normalization.
|
|
6308
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6331
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6309
6332
|
mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6310
6333
|
}
|
|
6311
6334
|
};
|
|
@@ -6341,7 +6364,7 @@ const TeleportImpl = {
|
|
|
6341
6364
|
if (!wasDisabled) {
|
|
6342
6365
|
// enabled -> disabled
|
|
6343
6366
|
// move into main container
|
|
6344
|
-
moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
|
|
6367
|
+
moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
6345
6368
|
}
|
|
6346
6369
|
}
|
|
6347
6370
|
else {
|
|
@@ -6349,7 +6372,7 @@ const TeleportImpl = {
|
|
|
6349
6372
|
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
6350
6373
|
const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
|
6351
6374
|
if (nextTarget) {
|
|
6352
|
-
moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
|
|
6375
|
+
moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
|
|
6353
6376
|
}
|
|
6354
6377
|
else {
|
|
6355
6378
|
warn('Invalid Teleport target on update:', target, `(${typeof target})`);
|
|
@@ -6358,7 +6381,7 @@ const TeleportImpl = {
|
|
|
6358
6381
|
else if (wasDisabled) {
|
|
6359
6382
|
// disabled -> enabled
|
|
6360
6383
|
// move into teleport target
|
|
6361
|
-
moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
|
|
6384
|
+
moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
6362
6385
|
}
|
|
6363
6386
|
}
|
|
6364
6387
|
}
|
|
@@ -6371,7 +6394,7 @@ const TeleportImpl = {
|
|
|
6371
6394
|
// an unmounted teleport should always remove its children if not disabled
|
|
6372
6395
|
if (doRemove || !isTeleportDisabled(props)) {
|
|
6373
6396
|
hostRemove(anchor);
|
|
6374
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6397
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6375
6398
|
for (let i = 0; i < children.length; i++) {
|
|
6376
6399
|
const child = children[i];
|
|
6377
6400
|
unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
|
|
@@ -6382,13 +6405,13 @@ const TeleportImpl = {
|
|
|
6382
6405
|
move: moveTeleport,
|
|
6383
6406
|
hydrate: hydrateTeleport
|
|
6384
6407
|
};
|
|
6385
|
-
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 */) {
|
|
6386
6409
|
// move target anchor if this is a target change.
|
|
6387
|
-
if (moveType === 0 /* TARGET_CHANGE */) {
|
|
6410
|
+
if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
|
|
6388
6411
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
6389
6412
|
}
|
|
6390
6413
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
6391
|
-
const isReorder = moveType === 2 /* REORDER */;
|
|
6414
|
+
const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
|
|
6392
6415
|
// move main view anchor if this is a re-order.
|
|
6393
6416
|
if (isReorder) {
|
|
6394
6417
|
insert(el, container, parentAnchor);
|
|
@@ -6398,9 +6421,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
6398
6421
|
// is not a reorder, or the teleport is disabled
|
|
6399
6422
|
if (!isReorder || isTeleportDisabled(props)) {
|
|
6400
6423
|
// Teleport has either Array children or no children.
|
|
6401
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6424
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6402
6425
|
for (let i = 0; i < children.length; i++) {
|
|
6403
|
-
move(children[i], container, parentAnchor, 2 /* REORDER */);
|
|
6426
|
+
move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
|
|
6404
6427
|
}
|
|
6405
6428
|
}
|
|
6406
6429
|
}
|
|
@@ -6415,7 +6438,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
6415
6438
|
// if multiple teleports rendered to the same target element, we need to
|
|
6416
6439
|
// pick up from where the last teleport finished instead of the first node
|
|
6417
6440
|
const targetNode = target._lpa || target.firstChild;
|
|
6418
|
-
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6441
|
+
if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6419
6442
|
if (isTeleportDisabled(vnode.props)) {
|
|
6420
6443
|
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
6421
6444
|
vnode.targetAnchor = targetNode;
|
|
@@ -6537,7 +6560,7 @@ function isVNode(value) {
|
|
|
6537
6560
|
return value ? value.__v_isVNode === true : false;
|
|
6538
6561
|
}
|
|
6539
6562
|
function isSameVNodeType(n1, n2) {
|
|
6540
|
-
if (n2.shapeFlag & 6 /* COMPONENT */ &&
|
|
6563
|
+
if (n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
6541
6564
|
hmrDirtyComponents.has(n2.type)) {
|
|
6542
6565
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
6543
6566
|
return false;
|
|
@@ -6568,7 +6591,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
6568
6591
|
: ref
|
|
6569
6592
|
: null);
|
|
6570
6593
|
};
|
|
6571
|
-
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) {
|
|
6572
6595
|
const vnode = {
|
|
6573
6596
|
__v_isVNode: true,
|
|
6574
6597
|
__v_skip: true,
|
|
@@ -6599,7 +6622,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6599
6622
|
if (needFullChildrenNormalization) {
|
|
6600
6623
|
normalizeChildren(vnode, children);
|
|
6601
6624
|
// normalize suspense children
|
|
6602
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6625
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6603
6626
|
type.normalize(vnode);
|
|
6604
6627
|
}
|
|
6605
6628
|
}
|
|
@@ -6607,8 +6630,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6607
6630
|
// compiled element vnode - if children is passed, only possible types are
|
|
6608
6631
|
// string or Array.
|
|
6609
6632
|
vnode.shapeFlag |= shared.isString(children)
|
|
6610
|
-
? 8 /* TEXT_CHILDREN */
|
|
6611
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
6633
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
6634
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6612
6635
|
}
|
|
6613
6636
|
// validate key
|
|
6614
6637
|
if (vnode.key !== vnode.key) {
|
|
@@ -6624,10 +6647,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6624
6647
|
// component nodes also should always be patched, because even if the
|
|
6625
6648
|
// component doesn't need to update, it needs to persist the instance on to
|
|
6626
6649
|
// the next vnode so that it can be properly unmounted later.
|
|
6627
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
6650
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
6628
6651
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
6629
6652
|
// vnode should not be considered dynamic due to handler caching.
|
|
6630
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
6653
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
6631
6654
|
currentBlock.push(vnode);
|
|
6632
6655
|
}
|
|
6633
6656
|
return vnode;
|
|
@@ -6649,14 +6672,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6649
6672
|
normalizeChildren(cloned, children);
|
|
6650
6673
|
}
|
|
6651
6674
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
6652
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
6675
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6653
6676
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
6654
6677
|
}
|
|
6655
6678
|
else {
|
|
6656
6679
|
currentBlock.push(cloned);
|
|
6657
6680
|
}
|
|
6658
6681
|
}
|
|
6659
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
6682
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
6660
6683
|
return cloned;
|
|
6661
6684
|
}
|
|
6662
6685
|
// class component normalization.
|
|
@@ -6682,17 +6705,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6682
6705
|
}
|
|
6683
6706
|
// encode the vnode type information into a bitmap
|
|
6684
6707
|
const shapeFlag = shared.isString(type)
|
|
6685
|
-
? 1 /* ELEMENT */
|
|
6708
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
6686
6709
|
: isSuspense(type)
|
|
6687
|
-
? 128 /* SUSPENSE */
|
|
6710
|
+
? 128 /* ShapeFlags.SUSPENSE */
|
|
6688
6711
|
: isTeleport(type)
|
|
6689
|
-
? 64 /* TELEPORT */
|
|
6712
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
6690
6713
|
: shared.isObject(type)
|
|
6691
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
6714
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
6692
6715
|
: shared.isFunction(type)
|
|
6693
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
6716
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
6694
6717
|
: 0;
|
|
6695
|
-
if (shapeFlag & 4 /* STATEFUL_COMPONENT */ && reactivity.isProxy(type)) {
|
|
6718
|
+
if (shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && reactivity.isProxy(type)) {
|
|
6696
6719
|
type = reactivity.toRaw(type);
|
|
6697
6720
|
warn(`Vue received a Component which was made a reactive object. This can ` +
|
|
6698
6721
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
@@ -6731,7 +6754,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6731
6754
|
: ref,
|
|
6732
6755
|
scopeId: vnode.scopeId,
|
|
6733
6756
|
slotScopeIds: vnode.slotScopeIds,
|
|
6734
|
-
children: patchFlag === -1 /* HOISTED */ && shared.isArray(children)
|
|
6757
|
+
children: patchFlag === -1 /* PatchFlags.HOISTED */ && shared.isArray(children)
|
|
6735
6758
|
? children.map(deepCloneVNode)
|
|
6736
6759
|
: children,
|
|
6737
6760
|
target: vnode.target,
|
|
@@ -6744,8 +6767,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6744
6767
|
// fast paths only.
|
|
6745
6768
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
6746
6769
|
? patchFlag === -1 // hoisted node
|
|
6747
|
-
? 16 /* FULL_PROPS */
|
|
6748
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
6770
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
6771
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
6749
6772
|
: patchFlag,
|
|
6750
6773
|
dynamicProps: vnode.dynamicProps,
|
|
6751
6774
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -6835,10 +6858,10 @@ function normalizeChildren(vnode, children) {
|
|
|
6835
6858
|
children = null;
|
|
6836
6859
|
}
|
|
6837
6860
|
else if (shared.isArray(children)) {
|
|
6838
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6861
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6839
6862
|
}
|
|
6840
6863
|
else if (typeof children === 'object') {
|
|
6841
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
6864
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
6842
6865
|
// Normalize slot to plain children for plain element and Teleport
|
|
6843
6866
|
const slot = children.default;
|
|
6844
6867
|
if (slot) {
|
|
@@ -6850,37 +6873,37 @@ function normalizeChildren(vnode, children) {
|
|
|
6850
6873
|
return;
|
|
6851
6874
|
}
|
|
6852
6875
|
else {
|
|
6853
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6876
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6854
6877
|
const slotFlag = children._;
|
|
6855
6878
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
6856
6879
|
children._ctx = currentRenderingInstance;
|
|
6857
6880
|
}
|
|
6858
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
6881
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
6859
6882
|
// a child component receives forwarded slots from the parent.
|
|
6860
6883
|
// its slot type is determined by its parent's slot type.
|
|
6861
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
6862
|
-
children._ = 1 /* STABLE */;
|
|
6884
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
6885
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
6863
6886
|
}
|
|
6864
6887
|
else {
|
|
6865
|
-
children._ = 2 /* DYNAMIC */;
|
|
6866
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
6888
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
6889
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
6867
6890
|
}
|
|
6868
6891
|
}
|
|
6869
6892
|
}
|
|
6870
6893
|
}
|
|
6871
6894
|
else if (shared.isFunction(children)) {
|
|
6872
6895
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
6873
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6896
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6874
6897
|
}
|
|
6875
6898
|
else {
|
|
6876
6899
|
children = String(children);
|
|
6877
6900
|
// force teleport children to array so it can be moved around
|
|
6878
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6879
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6901
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6902
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6880
6903
|
children = [createTextVNode(children)];
|
|
6881
6904
|
}
|
|
6882
6905
|
else {
|
|
6883
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
6906
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
6884
6907
|
}
|
|
6885
6908
|
}
|
|
6886
6909
|
vnode.children = children;
|
|
@@ -6918,7 +6941,7 @@ function mergeProps(...args) {
|
|
|
6918
6941
|
return ret;
|
|
6919
6942
|
}
|
|
6920
6943
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
6921
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
6944
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
|
|
6922
6945
|
vnode,
|
|
6923
6946
|
prevVNode
|
|
6924
6947
|
]);
|
|
@@ -7026,7 +7049,7 @@ function validateComponentName(name, config) {
|
|
|
7026
7049
|
}
|
|
7027
7050
|
}
|
|
7028
7051
|
function isStatefulComponent(instance) {
|
|
7029
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
7052
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
7030
7053
|
}
|
|
7031
7054
|
let isInSSRComponentSetup = false;
|
|
7032
7055
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -7081,7 +7104,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7081
7104
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
7082
7105
|
setCurrentInstance(instance);
|
|
7083
7106
|
reactivity.pauseTracking();
|
|
7084
|
-
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]);
|
|
7085
7108
|
reactivity.resetTracking();
|
|
7086
7109
|
unsetCurrentInstance();
|
|
7087
7110
|
if (shared.isPromise(setupResult)) {
|
|
@@ -7093,7 +7116,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7093
7116
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
7094
7117
|
})
|
|
7095
7118
|
.catch(e => {
|
|
7096
|
-
handleError(e, instance, 0 /* SETUP_FUNCTION */);
|
|
7119
|
+
handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
7097
7120
|
});
|
|
7098
7121
|
}
|
|
7099
7122
|
else {
|
|
@@ -7224,7 +7247,7 @@ function createAttrsProxy(instance) {
|
|
|
7224
7247
|
return new Proxy(instance.attrs, {
|
|
7225
7248
|
get(target, key) {
|
|
7226
7249
|
markAttrsAccessed();
|
|
7227
|
-
reactivity.track(instance, "get" /* GET */, '$attrs');
|
|
7250
|
+
reactivity.track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
7228
7251
|
return target[key];
|
|
7229
7252
|
},
|
|
7230
7253
|
set() {
|
|
@@ -7511,7 +7534,7 @@ const useSSRContext = () => {
|
|
|
7511
7534
|
};
|
|
7512
7535
|
|
|
7513
7536
|
function isShallow(value) {
|
|
7514
|
-
return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
|
|
7537
|
+
return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
|
|
7515
7538
|
}
|
|
7516
7539
|
|
|
7517
7540
|
function initCustomFormatter() {
|
|
@@ -7731,7 +7754,7 @@ function isMemoSame(cached, memo) {
|
|
|
7731
7754
|
}
|
|
7732
7755
|
|
|
7733
7756
|
// Core API ------------------------------------------------------------------
|
|
7734
|
-
const version = "3.2.
|
|
7757
|
+
const version = "3.2.38";
|
|
7735
7758
|
const _ssrUtils = {
|
|
7736
7759
|
createComponentInstance,
|
|
7737
7760
|
setupComponent,
|