@vue/runtime-core 3.2.36 → 3.2.39
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 +330 -299
- package/dist/runtime-core.cjs.prod.js +269 -244
- package/dist/runtime-core.d.ts +15 -7
- package/dist/runtime-core.esm-bundler.js +334 -305
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { pauseTracking, resetTracking, isRef, toRaw, isShallow as isShallow$1, isReactive, ReactiveEffect, ref, shallowReadonly, track, reactive, shallowReactive, trigger, isProxy, EffectScope, markRaw, proxyRefs, computed as computed$1, isReadonly } from '@vue/reactivity';
|
|
2
2
|
export { EffectScope, ReactiveEffect, customRef, effect, effectScope, getCurrentScope, isProxy, isReactive, isReadonly, isRef, isShallow, markRaw, onScopeDispose, proxyRefs, reactive, readonly, ref, shallowReactive, shallowReadonly, shallowRef, stop, toRaw, toRef, toRefs, triggerRef, unref } from '@vue/reactivity';
|
|
3
|
-
import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, toNumber, hyphenate, camelize, isOn, hasOwn, isModelListener, hasChanged, remove,
|
|
3
|
+
import { isString, isFunction, isPromise, isArray, NOOP, getGlobalThis, extend, EMPTY_OBJ, toHandlerKey, toNumber, hyphenate, camelize, isObject, isOn, hasOwn, isModelListener, hasChanged, remove, isSet, isMap, isPlainObject, invokeArrayFns, isBuiltInDirective, capitalize, isGloballyWhitelisted, def, isReservedProp, EMPTY_ARR, toRawType, makeMap, NO, normalizeClass, normalizeStyle } from '@vue/shared';
|
|
4
4
|
export { camelize, capitalize, normalizeClass, normalizeProps, normalizeStyle, toDisplayString, toHandlerKey } from '@vue/shared';
|
|
5
5
|
|
|
6
6
|
const stack = [];
|
|
@@ -18,7 +18,7 @@ function warn(msg, ...args) {
|
|
|
18
18
|
const appWarnHandler = instance && instance.appContext.config.warnHandler;
|
|
19
19
|
const trace = getComponentTrace();
|
|
20
20
|
if (appWarnHandler) {
|
|
21
|
-
callWithErrorHandling(appWarnHandler, instance, 11 /* APP_WARN_HANDLER */, [
|
|
21
|
+
callWithErrorHandling(appWarnHandler, instance, 11 /* ErrorCodes.APP_WARN_HANDLER */, [
|
|
22
22
|
msg + args.join(''),
|
|
23
23
|
instance && instance.proxy,
|
|
24
24
|
trace
|
|
@@ -118,35 +118,35 @@ function formatProp(key, value, raw) {
|
|
|
118
118
|
}
|
|
119
119
|
|
|
120
120
|
const ErrorTypeStrings = {
|
|
121
|
-
["sp" /* SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
122
|
-
["bc" /* BEFORE_CREATE */]: 'beforeCreate hook',
|
|
123
|
-
["c" /* CREATED */]: 'created hook',
|
|
124
|
-
["bm" /* BEFORE_MOUNT */]: 'beforeMount hook',
|
|
125
|
-
["m" /* MOUNTED */]: 'mounted hook',
|
|
126
|
-
["bu" /* BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
127
|
-
["u" /* UPDATED */]: 'updated',
|
|
128
|
-
["bum" /* BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
129
|
-
["um" /* UNMOUNTED */]: 'unmounted hook',
|
|
130
|
-
["a" /* ACTIVATED */]: 'activated hook',
|
|
131
|
-
["da" /* DEACTIVATED */]: 'deactivated hook',
|
|
132
|
-
["ec" /* ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
133
|
-
["rtc" /* RENDER_TRACKED */]: 'renderTracked hook',
|
|
134
|
-
["rtg" /* RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
135
|
-
[0 /* SETUP_FUNCTION */]: 'setup function',
|
|
136
|
-
[1 /* RENDER_FUNCTION */]: 'render function',
|
|
137
|
-
[2 /* WATCH_GETTER */]: 'watcher getter',
|
|
138
|
-
[3 /* WATCH_CALLBACK */]: 'watcher callback',
|
|
139
|
-
[4 /* WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
140
|
-
[5 /* NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
141
|
-
[6 /* COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
142
|
-
[7 /* VNODE_HOOK */]: 'vnode hook',
|
|
143
|
-
[8 /* DIRECTIVE_HOOK */]: 'directive hook',
|
|
144
|
-
[9 /* TRANSITION_HOOK */]: 'transition hook',
|
|
145
|
-
[10 /* APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
146
|
-
[11 /* APP_WARN_HANDLER */]: 'app warnHandler',
|
|
147
|
-
[12 /* FUNCTION_REF */]: 'ref function',
|
|
148
|
-
[13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
149
|
-
[14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
121
|
+
["sp" /* LifecycleHooks.SERVER_PREFETCH */]: 'serverPrefetch hook',
|
|
122
|
+
["bc" /* LifecycleHooks.BEFORE_CREATE */]: 'beforeCreate hook',
|
|
123
|
+
["c" /* LifecycleHooks.CREATED */]: 'created hook',
|
|
124
|
+
["bm" /* LifecycleHooks.BEFORE_MOUNT */]: 'beforeMount hook',
|
|
125
|
+
["m" /* LifecycleHooks.MOUNTED */]: 'mounted hook',
|
|
126
|
+
["bu" /* LifecycleHooks.BEFORE_UPDATE */]: 'beforeUpdate hook',
|
|
127
|
+
["u" /* LifecycleHooks.UPDATED */]: 'updated',
|
|
128
|
+
["bum" /* LifecycleHooks.BEFORE_UNMOUNT */]: 'beforeUnmount hook',
|
|
129
|
+
["um" /* LifecycleHooks.UNMOUNTED */]: 'unmounted hook',
|
|
130
|
+
["a" /* LifecycleHooks.ACTIVATED */]: 'activated hook',
|
|
131
|
+
["da" /* LifecycleHooks.DEACTIVATED */]: 'deactivated hook',
|
|
132
|
+
["ec" /* LifecycleHooks.ERROR_CAPTURED */]: 'errorCaptured hook',
|
|
133
|
+
["rtc" /* LifecycleHooks.RENDER_TRACKED */]: 'renderTracked hook',
|
|
134
|
+
["rtg" /* LifecycleHooks.RENDER_TRIGGERED */]: 'renderTriggered hook',
|
|
135
|
+
[0 /* ErrorCodes.SETUP_FUNCTION */]: 'setup function',
|
|
136
|
+
[1 /* ErrorCodes.RENDER_FUNCTION */]: 'render function',
|
|
137
|
+
[2 /* ErrorCodes.WATCH_GETTER */]: 'watcher getter',
|
|
138
|
+
[3 /* ErrorCodes.WATCH_CALLBACK */]: 'watcher callback',
|
|
139
|
+
[4 /* ErrorCodes.WATCH_CLEANUP */]: 'watcher cleanup function',
|
|
140
|
+
[5 /* ErrorCodes.NATIVE_EVENT_HANDLER */]: 'native event handler',
|
|
141
|
+
[6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */]: 'component event handler',
|
|
142
|
+
[7 /* ErrorCodes.VNODE_HOOK */]: 'vnode hook',
|
|
143
|
+
[8 /* ErrorCodes.DIRECTIVE_HOOK */]: 'directive hook',
|
|
144
|
+
[9 /* ErrorCodes.TRANSITION_HOOK */]: 'transition hook',
|
|
145
|
+
[10 /* ErrorCodes.APP_ERROR_HANDLER */]: 'app errorHandler',
|
|
146
|
+
[11 /* ErrorCodes.APP_WARN_HANDLER */]: 'app warnHandler',
|
|
147
|
+
[12 /* ErrorCodes.FUNCTION_REF */]: 'ref function',
|
|
148
|
+
[13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */]: 'async component loader',
|
|
149
|
+
[14 /* ErrorCodes.SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
|
|
150
150
|
'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
|
|
151
151
|
};
|
|
152
152
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
@@ -197,7 +197,7 @@ function handleError(err, instance, type, throwInDev = true) {
|
|
|
197
197
|
// app-level handling
|
|
198
198
|
const appErrorHandler = instance.appContext.config.errorHandler;
|
|
199
199
|
if (appErrorHandler) {
|
|
200
|
-
callWithErrorHandling(appErrorHandler, null, 10 /* APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
200
|
+
callWithErrorHandling(appErrorHandler, null, 10 /* ErrorCodes.APP_ERROR_HANDLER */, [err, exposedInstance, errorInfo]);
|
|
201
201
|
return;
|
|
202
202
|
}
|
|
203
203
|
}
|
|
@@ -231,15 +231,11 @@ let isFlushing = false;
|
|
|
231
231
|
let isFlushPending = false;
|
|
232
232
|
const queue = [];
|
|
233
233
|
let flushIndex = 0;
|
|
234
|
-
const pendingPreFlushCbs = [];
|
|
235
|
-
let activePreFlushCbs = null;
|
|
236
|
-
let preFlushIndex = 0;
|
|
237
234
|
const pendingPostFlushCbs = [];
|
|
238
235
|
let activePostFlushCbs = null;
|
|
239
236
|
let postFlushIndex = 0;
|
|
240
237
|
const resolvedPromise = /*#__PURE__*/ Promise.resolve();
|
|
241
238
|
let currentFlushPromise = null;
|
|
242
|
-
let currentPreFlushParentJob = null;
|
|
243
239
|
const RECURSION_LIMIT = 100;
|
|
244
240
|
function nextTick(fn) {
|
|
245
241
|
const p = currentFlushPromise || resolvedPromise;
|
|
@@ -267,9 +263,8 @@ function queueJob(job) {
|
|
|
267
263
|
// if the job is a watch() callback, the search will start with a +1 index to
|
|
268
264
|
// allow it recursively trigger itself - it is the user's responsibility to
|
|
269
265
|
// ensure it doesn't end up in an infinite loop.
|
|
270
|
-
if (
|
|
271
|
-
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex))
|
|
272
|
-
job !== currentPreFlushParentJob) {
|
|
266
|
+
if (!queue.length ||
|
|
267
|
+
!queue.includes(job, isFlushing && job.allowRecurse ? flushIndex + 1 : flushIndex)) {
|
|
273
268
|
if (job.id == null) {
|
|
274
269
|
queue.push(job);
|
|
275
270
|
}
|
|
@@ -291,52 +286,40 @@ function invalidateJob(job) {
|
|
|
291
286
|
queue.splice(i, 1);
|
|
292
287
|
}
|
|
293
288
|
}
|
|
294
|
-
function
|
|
289
|
+
function queuePostFlushCb(cb) {
|
|
295
290
|
if (!isArray(cb)) {
|
|
296
|
-
if (!
|
|
297
|
-
!
|
|
298
|
-
|
|
291
|
+
if (!activePostFlushCbs ||
|
|
292
|
+
!activePostFlushCbs.includes(cb, cb.allowRecurse ? postFlushIndex + 1 : postFlushIndex)) {
|
|
293
|
+
pendingPostFlushCbs.push(cb);
|
|
299
294
|
}
|
|
300
295
|
}
|
|
301
296
|
else {
|
|
302
297
|
// if cb is an array, it is a component lifecycle hook which can only be
|
|
303
298
|
// triggered by a job, which is already deduped in the main queue, so
|
|
304
299
|
// we can skip duplicate check here to improve perf
|
|
305
|
-
|
|
300
|
+
pendingPostFlushCbs.push(...cb);
|
|
306
301
|
}
|
|
307
302
|
queueFlush();
|
|
308
303
|
}
|
|
309
|
-
function
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
pendingPreFlushCbs.length = 0;
|
|
320
|
-
if ((process.env.NODE_ENV !== 'production')) {
|
|
321
|
-
seen = seen || new Map();
|
|
322
|
-
}
|
|
323
|
-
for (preFlushIndex = 0; preFlushIndex < activePreFlushCbs.length; preFlushIndex++) {
|
|
324
|
-
if ((process.env.NODE_ENV !== 'production') &&
|
|
325
|
-
checkRecursiveUpdates(seen, activePreFlushCbs[preFlushIndex])) {
|
|
304
|
+
function flushPreFlushCbs(seen,
|
|
305
|
+
// if currently flushing, skip the current job itself
|
|
306
|
+
i = isFlushing ? flushIndex + 1 : 0) {
|
|
307
|
+
if ((process.env.NODE_ENV !== 'production')) {
|
|
308
|
+
seen = seen || new Map();
|
|
309
|
+
}
|
|
310
|
+
for (; i < queue.length; i++) {
|
|
311
|
+
const cb = queue[i];
|
|
312
|
+
if (cb && cb.pre) {
|
|
313
|
+
if ((process.env.NODE_ENV !== 'production') && checkRecursiveUpdates(seen, cb)) {
|
|
326
314
|
continue;
|
|
327
315
|
}
|
|
328
|
-
|
|
316
|
+
queue.splice(i, 1);
|
|
317
|
+
i--;
|
|
318
|
+
cb();
|
|
329
319
|
}
|
|
330
|
-
activePreFlushCbs = null;
|
|
331
|
-
preFlushIndex = 0;
|
|
332
|
-
currentPreFlushParentJob = null;
|
|
333
|
-
// recursively flush until it drains
|
|
334
|
-
flushPreFlushCbs(seen, parentJob);
|
|
335
320
|
}
|
|
336
321
|
}
|
|
337
322
|
function flushPostFlushCbs(seen) {
|
|
338
|
-
// flush any pre cbs queued during the flush (e.g. pre watchers)
|
|
339
|
-
flushPreFlushCbs();
|
|
340
323
|
if (pendingPostFlushCbs.length) {
|
|
341
324
|
const deduped = [...new Set(pendingPostFlushCbs)];
|
|
342
325
|
pendingPostFlushCbs.length = 0;
|
|
@@ -362,13 +345,22 @@ function flushPostFlushCbs(seen) {
|
|
|
362
345
|
}
|
|
363
346
|
}
|
|
364
347
|
const getId = (job) => job.id == null ? Infinity : job.id;
|
|
348
|
+
const comparator = (a, b) => {
|
|
349
|
+
const diff = getId(a) - getId(b);
|
|
350
|
+
if (diff === 0) {
|
|
351
|
+
if (a.pre && !b.pre)
|
|
352
|
+
return -1;
|
|
353
|
+
if (b.pre && !a.pre)
|
|
354
|
+
return 1;
|
|
355
|
+
}
|
|
356
|
+
return diff;
|
|
357
|
+
};
|
|
365
358
|
function flushJobs(seen) {
|
|
366
359
|
isFlushPending = false;
|
|
367
360
|
isFlushing = true;
|
|
368
361
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
369
362
|
seen = seen || new Map();
|
|
370
363
|
}
|
|
371
|
-
flushPreFlushCbs(seen);
|
|
372
364
|
// Sort queue before flush.
|
|
373
365
|
// This ensures that:
|
|
374
366
|
// 1. Components are updated from parent to child. (because parent is always
|
|
@@ -376,7 +368,7 @@ function flushJobs(seen) {
|
|
|
376
368
|
// priority number)
|
|
377
369
|
// 2. If a component is unmounted during a parent component's update,
|
|
378
370
|
// its update can be skipped.
|
|
379
|
-
queue.sort(
|
|
371
|
+
queue.sort(comparator);
|
|
380
372
|
// conditional usage of checkRecursiveUpdate must be determined out of
|
|
381
373
|
// try ... catch block since Rollup by default de-optimizes treeshaking
|
|
382
374
|
// inside try-catch. This can leave all warning code unshaked. Although
|
|
@@ -393,7 +385,7 @@ function flushJobs(seen) {
|
|
|
393
385
|
continue;
|
|
394
386
|
}
|
|
395
387
|
// console.log(`running:`, job.id)
|
|
396
|
-
callWithErrorHandling(job, null, 14 /* SCHEDULER */);
|
|
388
|
+
callWithErrorHandling(job, null, 14 /* ErrorCodes.SCHEDULER */);
|
|
397
389
|
}
|
|
398
390
|
}
|
|
399
391
|
}
|
|
@@ -405,9 +397,7 @@ function flushJobs(seen) {
|
|
|
405
397
|
currentFlushPromise = null;
|
|
406
398
|
// some postFlushCb queued jobs!
|
|
407
399
|
// keep flushing until it drains.
|
|
408
|
-
if (queue.length ||
|
|
409
|
-
pendingPreFlushCbs.length ||
|
|
410
|
-
pendingPostFlushCbs.length) {
|
|
400
|
+
if (queue.length || pendingPostFlushCbs.length) {
|
|
411
401
|
flushJobs(seen);
|
|
412
402
|
}
|
|
413
403
|
}
|
|
@@ -625,7 +615,7 @@ function setDevtoolsHook(hook, target) {
|
|
|
625
615
|
}
|
|
626
616
|
}
|
|
627
617
|
function devtoolsInitApp(app, version) {
|
|
628
|
-
emit("app:init" /* APP_INIT */, app, version, {
|
|
618
|
+
emit("app:init" /* DevtoolsHooks.APP_INIT */, app, version, {
|
|
629
619
|
Fragment,
|
|
630
620
|
Text,
|
|
631
621
|
Comment,
|
|
@@ -633,27 +623,27 @@ function devtoolsInitApp(app, version) {
|
|
|
633
623
|
});
|
|
634
624
|
}
|
|
635
625
|
function devtoolsUnmountApp(app) {
|
|
636
|
-
emit("app:unmount" /* APP_UNMOUNT */, app);
|
|
626
|
+
emit("app:unmount" /* DevtoolsHooks.APP_UNMOUNT */, app);
|
|
637
627
|
}
|
|
638
|
-
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* COMPONENT_ADDED */);
|
|
628
|
+
const devtoolsComponentAdded = /*#__PURE__*/ createDevtoolsComponentHook("component:added" /* DevtoolsHooks.COMPONENT_ADDED */);
|
|
639
629
|
const devtoolsComponentUpdated =
|
|
640
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* COMPONENT_UPDATED */);
|
|
630
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:updated" /* DevtoolsHooks.COMPONENT_UPDATED */);
|
|
641
631
|
const devtoolsComponentRemoved =
|
|
642
|
-
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* COMPONENT_REMOVED */);
|
|
632
|
+
/*#__PURE__*/ createDevtoolsComponentHook("component:removed" /* DevtoolsHooks.COMPONENT_REMOVED */);
|
|
643
633
|
function createDevtoolsComponentHook(hook) {
|
|
644
634
|
return (component) => {
|
|
645
635
|
emit(hook, component.appContext.app, component.uid, component.parent ? component.parent.uid : undefined, component);
|
|
646
636
|
};
|
|
647
637
|
}
|
|
648
|
-
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* PERFORMANCE_START */);
|
|
649
|
-
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* PERFORMANCE_END */);
|
|
638
|
+
const devtoolsPerfStart = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:start" /* DevtoolsHooks.PERFORMANCE_START */);
|
|
639
|
+
const devtoolsPerfEnd = /*#__PURE__*/ createDevtoolsPerformanceHook("perf:end" /* DevtoolsHooks.PERFORMANCE_END */);
|
|
650
640
|
function createDevtoolsPerformanceHook(hook) {
|
|
651
641
|
return (component, type, time) => {
|
|
652
642
|
emit(hook, component.appContext.app, component.uid, component, type, time);
|
|
653
643
|
};
|
|
654
644
|
}
|
|
655
645
|
function devtoolsComponentEmit(component, event, params) {
|
|
656
|
-
emit("component:emit" /* COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
646
|
+
emit("component:emit" /* DevtoolsHooks.COMPONENT_EMIT */, component.appContext.app, component, event, params);
|
|
657
647
|
}
|
|
658
648
|
|
|
659
649
|
function emit$1(instance, event, ...rawArgs) {
|
|
@@ -718,7 +708,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
718
708
|
handler = props[(handlerName = toHandlerKey(hyphenate(event)))];
|
|
719
709
|
}
|
|
720
710
|
if (handler) {
|
|
721
|
-
callWithAsyncErrorHandling(handler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
711
|
+
callWithAsyncErrorHandling(handler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
722
712
|
}
|
|
723
713
|
const onceHandler = props[handlerName + `Once`];
|
|
724
714
|
if (onceHandler) {
|
|
@@ -729,7 +719,7 @@ function emit$1(instance, event, ...rawArgs) {
|
|
|
729
719
|
return;
|
|
730
720
|
}
|
|
731
721
|
instance.emitted[handlerName] = true;
|
|
732
|
-
callWithAsyncErrorHandling(onceHandler, instance, 6 /* COMPONENT_EVENT_HANDLER */, args);
|
|
722
|
+
callWithAsyncErrorHandling(onceHandler, instance, 6 /* ErrorCodes.COMPONENT_EVENT_HANDLER */, args);
|
|
733
723
|
}
|
|
734
724
|
}
|
|
735
725
|
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
@@ -761,7 +751,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
761
751
|
}
|
|
762
752
|
}
|
|
763
753
|
if (!raw && !hasExtends) {
|
|
764
|
-
|
|
754
|
+
if (isObject(comp)) {
|
|
755
|
+
cache.set(comp, null);
|
|
756
|
+
}
|
|
765
757
|
return null;
|
|
766
758
|
}
|
|
767
759
|
if (isArray(raw)) {
|
|
@@ -770,7 +762,9 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
770
762
|
else {
|
|
771
763
|
extend(normalized, raw);
|
|
772
764
|
}
|
|
773
|
-
|
|
765
|
+
if (isObject(comp)) {
|
|
766
|
+
cache.set(comp, normalized);
|
|
767
|
+
}
|
|
774
768
|
return normalized;
|
|
775
769
|
}
|
|
776
770
|
// Check if an incoming prop key is a declared emit event listener.
|
|
@@ -889,7 +883,7 @@ function renderComponentRoot(instance) {
|
|
|
889
883
|
accessedAttrs = false;
|
|
890
884
|
}
|
|
891
885
|
try {
|
|
892
|
-
if (vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */) {
|
|
886
|
+
if (vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) {
|
|
893
887
|
// withProxy is a proxy with a different `has` trap only for
|
|
894
888
|
// runtime-compiled render functions using `with` block.
|
|
895
889
|
const proxyToUse = withProxy || proxy;
|
|
@@ -922,7 +916,7 @@ function renderComponentRoot(instance) {
|
|
|
922
916
|
}
|
|
923
917
|
catch (err) {
|
|
924
918
|
blockStack.length = 0;
|
|
925
|
-
handleError(err, instance, 1 /* RENDER_FUNCTION */);
|
|
919
|
+
handleError(err, instance, 1 /* ErrorCodes.RENDER_FUNCTION */);
|
|
926
920
|
result = createVNode(Comment);
|
|
927
921
|
}
|
|
928
922
|
// attr merging
|
|
@@ -932,14 +926,14 @@ function renderComponentRoot(instance) {
|
|
|
932
926
|
let setRoot = undefined;
|
|
933
927
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
934
928
|
result.patchFlag > 0 &&
|
|
935
|
-
result.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
929
|
+
result.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
936
930
|
[root, setRoot] = getChildRoot(result);
|
|
937
931
|
}
|
|
938
932
|
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
939
933
|
const keys = Object.keys(fallthroughAttrs);
|
|
940
934
|
const { shapeFlag } = root;
|
|
941
935
|
if (keys.length) {
|
|
942
|
-
if (shapeFlag & (1 /* ELEMENT */ | 6 /* COMPONENT */)) {
|
|
936
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 6 /* ShapeFlags.COMPONENT */)) {
|
|
943
937
|
if (propsOptions && keys.some(isModelListener)) {
|
|
944
938
|
// If a v-model listener (onUpdate:xxx) has a corresponding declared
|
|
945
939
|
// prop, it indicates this component expects to handle v-model and
|
|
@@ -1080,7 +1074,7 @@ const filterModelListeners = (attrs, props) => {
|
|
|
1080
1074
|
return res;
|
|
1081
1075
|
};
|
|
1082
1076
|
const isElementRoot = (vnode) => {
|
|
1083
|
-
return (vnode.shapeFlag & (6 /* COMPONENT */ | 1 /* ELEMENT */) ||
|
|
1077
|
+
return (vnode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 1 /* ShapeFlags.ELEMENT */) ||
|
|
1084
1078
|
vnode.type === Comment // potential v-if branch switch
|
|
1085
1079
|
);
|
|
1086
1080
|
};
|
|
@@ -1099,19 +1093,19 @@ function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
|
1099
1093
|
return true;
|
|
1100
1094
|
}
|
|
1101
1095
|
if (optimized && patchFlag >= 0) {
|
|
1102
|
-
if (patchFlag & 1024 /* DYNAMIC_SLOTS */) {
|
|
1096
|
+
if (patchFlag & 1024 /* PatchFlags.DYNAMIC_SLOTS */) {
|
|
1103
1097
|
// slot content that references values that might have changed,
|
|
1104
1098
|
// e.g. in a v-for
|
|
1105
1099
|
return true;
|
|
1106
1100
|
}
|
|
1107
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
1101
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
1108
1102
|
if (!prevProps) {
|
|
1109
1103
|
return !!nextProps;
|
|
1110
1104
|
}
|
|
1111
1105
|
// presence of this flag indicates props are always non-null
|
|
1112
1106
|
return hasPropsChanged(prevProps, nextProps, emits);
|
|
1113
1107
|
}
|
|
1114
|
-
else if (patchFlag & 8 /* PROPS */) {
|
|
1108
|
+
else if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
1115
1109
|
const dynamicProps = nextVNode.dynamicProps;
|
|
1116
1110
|
for (let i = 0; i < dynamicProps.length; i++) {
|
|
1117
1111
|
const key = dynamicProps[i];
|
|
@@ -1369,7 +1363,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1369
1363
|
if (delayEnter) {
|
|
1370
1364
|
activeBranch.transition.afterLeave = () => {
|
|
1371
1365
|
if (pendingId === suspense.pendingId) {
|
|
1372
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
1366
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
1373
1367
|
}
|
|
1374
1368
|
};
|
|
1375
1369
|
}
|
|
@@ -1384,7 +1378,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1384
1378
|
}
|
|
1385
1379
|
if (!delayEnter) {
|
|
1386
1380
|
// move content from off-dom container to actual container
|
|
1387
|
-
move(pendingBranch, container, anchor, 0 /* ENTER */);
|
|
1381
|
+
move(pendingBranch, container, anchor, 0 /* MoveType.ENTER */);
|
|
1388
1382
|
}
|
|
1389
1383
|
}
|
|
1390
1384
|
setActiveBranch(suspense, pendingBranch);
|
|
@@ -1458,7 +1452,7 @@ function createSuspenseBoundary(vnode, parent, parentComponent, container, hidde
|
|
|
1458
1452
|
const hydratedEl = instance.vnode.el;
|
|
1459
1453
|
instance
|
|
1460
1454
|
.asyncDep.catch(err => {
|
|
1461
|
-
handleError(err, instance, 0 /* SETUP_FUNCTION */);
|
|
1455
|
+
handleError(err, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
1462
1456
|
})
|
|
1463
1457
|
.then(asyncSetupResult => {
|
|
1464
1458
|
// retry when the setup() promise resolves.
|
|
@@ -1532,7 +1526,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, isSVG, sl
|
|
|
1532
1526
|
}
|
|
1533
1527
|
function normalizeSuspenseChildren(vnode) {
|
|
1534
1528
|
const { shapeFlag, children } = vnode;
|
|
1535
|
-
const isSlotChildren = shapeFlag & 32 /* SLOTS_CHILDREN */;
|
|
1529
|
+
const isSlotChildren = shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
1536
1530
|
vnode.ssContent = normalizeSuspenseSlot(isSlotChildren ? children.default : children);
|
|
1537
1531
|
vnode.ssFallback = isSlotChildren
|
|
1538
1532
|
? normalizeSuspenseSlot(children.fallback)
|
|
@@ -1705,7 +1699,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1705
1699
|
return traverse(s);
|
|
1706
1700
|
}
|
|
1707
1701
|
else if (isFunction(s)) {
|
|
1708
|
-
return callWithErrorHandling(s, instance, 2 /* WATCH_GETTER */);
|
|
1702
|
+
return callWithErrorHandling(s, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
1709
1703
|
}
|
|
1710
1704
|
else {
|
|
1711
1705
|
(process.env.NODE_ENV !== 'production') && warnInvalidSource(s);
|
|
@@ -1715,7 +1709,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1715
1709
|
else if (isFunction(source)) {
|
|
1716
1710
|
if (cb) {
|
|
1717
1711
|
// getter with cb
|
|
1718
|
-
getter = () => callWithErrorHandling(source, instance, 2 /* WATCH_GETTER */);
|
|
1712
|
+
getter = () => callWithErrorHandling(source, instance, 2 /* ErrorCodes.WATCH_GETTER */);
|
|
1719
1713
|
}
|
|
1720
1714
|
else {
|
|
1721
1715
|
// no cb -> simple effect
|
|
@@ -1726,7 +1720,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1726
1720
|
if (cleanup) {
|
|
1727
1721
|
cleanup();
|
|
1728
1722
|
}
|
|
1729
|
-
return callWithAsyncErrorHandling(source, instance, 3 /* WATCH_CALLBACK */, [onCleanup]);
|
|
1723
|
+
return callWithAsyncErrorHandling(source, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [onCleanup]);
|
|
1730
1724
|
};
|
|
1731
1725
|
}
|
|
1732
1726
|
}
|
|
@@ -1741,7 +1735,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1741
1735
|
let cleanup;
|
|
1742
1736
|
let onCleanup = (fn) => {
|
|
1743
1737
|
cleanup = effect.onStop = () => {
|
|
1744
|
-
callWithErrorHandling(fn, instance, 4 /* WATCH_CLEANUP */);
|
|
1738
|
+
callWithErrorHandling(fn, instance, 4 /* ErrorCodes.WATCH_CLEANUP */);
|
|
1745
1739
|
};
|
|
1746
1740
|
};
|
|
1747
1741
|
// in SSR there is no need to setup an actual effect, and it should be noop
|
|
@@ -1753,7 +1747,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1753
1747
|
getter();
|
|
1754
1748
|
}
|
|
1755
1749
|
else if (immediate) {
|
|
1756
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
1750
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
1757
1751
|
getter(),
|
|
1758
1752
|
isMultiSource ? [] : undefined,
|
|
1759
1753
|
onCleanup
|
|
@@ -1779,7 +1773,7 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1779
1773
|
if (cleanup) {
|
|
1780
1774
|
cleanup();
|
|
1781
1775
|
}
|
|
1782
|
-
callWithAsyncErrorHandling(cb, instance, 3 /* WATCH_CALLBACK */, [
|
|
1776
|
+
callWithAsyncErrorHandling(cb, instance, 3 /* ErrorCodes.WATCH_CALLBACK */, [
|
|
1783
1777
|
newValue,
|
|
1784
1778
|
// pass undefined as the old value when it's changed for the first time
|
|
1785
1779
|
oldValue === INITIAL_WATCHER_VALUE ? undefined : oldValue,
|
|
@@ -1805,7 +1799,10 @@ function doWatch(source, cb, { immediate, deep, flush, onTrack, onTrigger } = EM
|
|
|
1805
1799
|
}
|
|
1806
1800
|
else {
|
|
1807
1801
|
// default: 'pre'
|
|
1808
|
-
|
|
1802
|
+
job.pre = true;
|
|
1803
|
+
if (instance)
|
|
1804
|
+
job.id = instance.uid;
|
|
1805
|
+
scheduler = () => queueJob(job);
|
|
1809
1806
|
}
|
|
1810
1807
|
const effect = new ReactiveEffect(getter, scheduler);
|
|
1811
1808
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -1872,7 +1869,7 @@ function createPathGetter(ctx, path) {
|
|
|
1872
1869
|
};
|
|
1873
1870
|
}
|
|
1874
1871
|
function traverse(value, seen) {
|
|
1875
|
-
if (!isObject(value) || value["__v_skip" /* SKIP */]) {
|
|
1872
|
+
if (!isObject(value) || value["__v_skip" /* ReactiveFlags.SKIP */]) {
|
|
1876
1873
|
return value;
|
|
1877
1874
|
}
|
|
1878
1875
|
seen = seen || new Set();
|
|
@@ -2059,7 +2056,7 @@ function resolveTransitionHooks(vnode, props, state, instance) {
|
|
|
2059
2056
|
const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
|
2060
2057
|
const callHook = (hook, args) => {
|
|
2061
2058
|
hook &&
|
|
2062
|
-
callWithAsyncErrorHandling(hook, instance, 9 /* TRANSITION_HOOK */, args);
|
|
2059
|
+
callWithAsyncErrorHandling(hook, instance, 9 /* ErrorCodes.TRANSITION_HOOK */, args);
|
|
2063
2060
|
};
|
|
2064
2061
|
const callAsyncHook = (hook, args) => {
|
|
2065
2062
|
const done = args[1];
|
|
@@ -2195,10 +2192,10 @@ function getKeepAliveChild(vnode) {
|
|
|
2195
2192
|
: vnode;
|
|
2196
2193
|
}
|
|
2197
2194
|
function setTransitionHooks(vnode, hooks) {
|
|
2198
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */ && vnode.component) {
|
|
2195
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */ && vnode.component) {
|
|
2199
2196
|
setTransitionHooks(vnode.component.subTree, hooks);
|
|
2200
2197
|
}
|
|
2201
|
-
else if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
2198
|
+
else if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
2202
2199
|
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
2203
2200
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
2204
2201
|
}
|
|
@@ -2217,7 +2214,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
2217
2214
|
: String(parentKey) + String(child.key != null ? child.key : i);
|
|
2218
2215
|
// handle fragment children case, e.g. v-for
|
|
2219
2216
|
if (child.type === Fragment) {
|
|
2220
|
-
if (child.patchFlag & 128 /* KEYED_FRAGMENT */)
|
|
2217
|
+
if (child.patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */)
|
|
2221
2218
|
keyedFragmentCount++;
|
|
2222
2219
|
ret = ret.concat(getTransitionRawChildren(child.children, keepComment, key));
|
|
2223
2220
|
}
|
|
@@ -2232,7 +2229,7 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
|
2232
2229
|
// these children to force full diffs to ensure correct behavior.
|
|
2233
2230
|
if (keyedFragmentCount > 1) {
|
|
2234
2231
|
for (let i = 0; i < ret.length; i++) {
|
|
2235
|
-
ret[i].patchFlag = -2 /* BAIL */;
|
|
2232
|
+
ret[i].patchFlag = -2 /* PatchFlags.BAIL */;
|
|
2236
2233
|
}
|
|
2237
2234
|
}
|
|
2238
2235
|
return ret;
|
|
@@ -2310,7 +2307,7 @@ function defineAsyncComponent(source) {
|
|
|
2310
2307
|
}
|
|
2311
2308
|
const onError = (err) => {
|
|
2312
2309
|
pendingRequest = null;
|
|
2313
|
-
handleError(err, instance, 13 /* ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
2310
|
+
handleError(err, instance, 13 /* ErrorCodes.ASYNC_COMPONENT_LOADER */, !errorComponent /* do not throw in dev if user provided error component */);
|
|
2314
2311
|
};
|
|
2315
2312
|
// suspense-controlled or SSR.
|
|
2316
2313
|
if ((suspensible && instance.suspense) ||
|
|
@@ -2420,7 +2417,7 @@ const KeepAliveImpl = {
|
|
|
2420
2417
|
const storageContainer = createElement('div');
|
|
2421
2418
|
sharedContext.activate = (vnode, container, anchor, isSVG, optimized) => {
|
|
2422
2419
|
const instance = vnode.component;
|
|
2423
|
-
move(vnode, container, anchor, 0 /* ENTER */, parentSuspense);
|
|
2420
|
+
move(vnode, container, anchor, 0 /* MoveType.ENTER */, parentSuspense);
|
|
2424
2421
|
// in case props have changed
|
|
2425
2422
|
patch(instance.vnode, vnode, container, anchor, instance, parentSuspense, isSVG, vnode.slotScopeIds, optimized);
|
|
2426
2423
|
queuePostRenderEffect(() => {
|
|
@@ -2440,7 +2437,7 @@ const KeepAliveImpl = {
|
|
|
2440
2437
|
};
|
|
2441
2438
|
sharedContext.deactivate = (vnode) => {
|
|
2442
2439
|
const instance = vnode.component;
|
|
2443
|
-
move(vnode, storageContainer, null, 1 /* LEAVE */, parentSuspense);
|
|
2440
|
+
move(vnode, storageContainer, null, 1 /* MoveType.LEAVE */, parentSuspense);
|
|
2444
2441
|
queuePostRenderEffect(() => {
|
|
2445
2442
|
if (instance.da) {
|
|
2446
2443
|
invokeArrayFns(instance.da);
|
|
@@ -2529,8 +2526,8 @@ const KeepAliveImpl = {
|
|
|
2529
2526
|
return children;
|
|
2530
2527
|
}
|
|
2531
2528
|
else if (!isVNode(rawVNode) ||
|
|
2532
|
-
(!(rawVNode.shapeFlag & 4 /* STATEFUL_COMPONENT */) &&
|
|
2533
|
-
!(rawVNode.shapeFlag & 128 /* SUSPENSE */))) {
|
|
2529
|
+
(!(rawVNode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */) &&
|
|
2530
|
+
!(rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */))) {
|
|
2534
2531
|
current = null;
|
|
2535
2532
|
return rawVNode;
|
|
2536
2533
|
}
|
|
@@ -2552,7 +2549,7 @@ const KeepAliveImpl = {
|
|
|
2552
2549
|
// clone vnode if it's reused because we are going to mutate it
|
|
2553
2550
|
if (vnode.el) {
|
|
2554
2551
|
vnode = cloneVNode(vnode);
|
|
2555
|
-
if (rawVNode.shapeFlag & 128 /* SUSPENSE */) {
|
|
2552
|
+
if (rawVNode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
2556
2553
|
rawVNode.ssContent = vnode;
|
|
2557
2554
|
}
|
|
2558
2555
|
}
|
|
@@ -2571,7 +2568,7 @@ const KeepAliveImpl = {
|
|
|
2571
2568
|
setTransitionHooks(vnode, vnode.transition);
|
|
2572
2569
|
}
|
|
2573
2570
|
// avoid vnode being mounted as fresh
|
|
2574
|
-
vnode.shapeFlag |= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
2571
|
+
vnode.shapeFlag |= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
2575
2572
|
// make this key the freshest
|
|
2576
2573
|
keys.delete(key);
|
|
2577
2574
|
keys.add(key);
|
|
@@ -2584,7 +2581,7 @@ const KeepAliveImpl = {
|
|
|
2584
2581
|
}
|
|
2585
2582
|
}
|
|
2586
2583
|
// avoid vnode being unmounted
|
|
2587
|
-
vnode.shapeFlag |= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2584
|
+
vnode.shapeFlag |= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2588
2585
|
current = vnode;
|
|
2589
2586
|
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
2590
2587
|
};
|
|
@@ -2607,10 +2604,10 @@ function matches(pattern, name) {
|
|
|
2607
2604
|
return false;
|
|
2608
2605
|
}
|
|
2609
2606
|
function onActivated(hook, target) {
|
|
2610
|
-
registerKeepAliveHook(hook, "a" /* ACTIVATED */, target);
|
|
2607
|
+
registerKeepAliveHook(hook, "a" /* LifecycleHooks.ACTIVATED */, target);
|
|
2611
2608
|
}
|
|
2612
2609
|
function onDeactivated(hook, target) {
|
|
2613
|
-
registerKeepAliveHook(hook, "da" /* DEACTIVATED */, target);
|
|
2610
|
+
registerKeepAliveHook(hook, "da" /* LifecycleHooks.DEACTIVATED */, target);
|
|
2614
2611
|
}
|
|
2615
2612
|
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
2616
2613
|
// cache the deactivate branch check wrapper for injected hooks so the same
|
|
@@ -2654,16 +2651,16 @@ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
|
2654
2651
|
}
|
|
2655
2652
|
function resetShapeFlag(vnode) {
|
|
2656
2653
|
let shapeFlag = vnode.shapeFlag;
|
|
2657
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
2658
|
-
shapeFlag -= 256 /* COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2654
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
2655
|
+
shapeFlag -= 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */;
|
|
2659
2656
|
}
|
|
2660
|
-
if (shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
2661
|
-
shapeFlag -= 512 /* COMPONENT_KEPT_ALIVE */;
|
|
2657
|
+
if (shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
2658
|
+
shapeFlag -= 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */;
|
|
2662
2659
|
}
|
|
2663
2660
|
vnode.shapeFlag = shapeFlag;
|
|
2664
2661
|
}
|
|
2665
2662
|
function getInnerChild(vnode) {
|
|
2666
|
-
return vnode.shapeFlag & 128 /* SUSPENSE */ ? vnode.ssContent : vnode;
|
|
2663
|
+
return vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */ ? vnode.ssContent : vnode;
|
|
2667
2664
|
}
|
|
2668
2665
|
|
|
2669
2666
|
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
@@ -2709,19 +2706,19 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2709
2706
|
}
|
|
2710
2707
|
const createHook = (lifecycle) => (hook, target = currentInstance) =>
|
|
2711
2708
|
// post-create lifecycle registrations are noops during SSR (except for serverPrefetch)
|
|
2712
|
-
(!isInSSRComponentSetup || lifecycle === "sp" /* SERVER_PREFETCH */) &&
|
|
2709
|
+
(!isInSSRComponentSetup || lifecycle === "sp" /* LifecycleHooks.SERVER_PREFETCH */) &&
|
|
2713
2710
|
injectHook(lifecycle, hook, target);
|
|
2714
|
-
const onBeforeMount = createHook("bm" /* BEFORE_MOUNT */);
|
|
2715
|
-
const onMounted = createHook("m" /* MOUNTED */);
|
|
2716
|
-
const onBeforeUpdate = createHook("bu" /* BEFORE_UPDATE */);
|
|
2717
|
-
const onUpdated = createHook("u" /* UPDATED */);
|
|
2718
|
-
const onBeforeUnmount = createHook("bum" /* BEFORE_UNMOUNT */);
|
|
2719
|
-
const onUnmounted = createHook("um" /* UNMOUNTED */);
|
|
2720
|
-
const onServerPrefetch = createHook("sp" /* SERVER_PREFETCH */);
|
|
2721
|
-
const onRenderTriggered = createHook("rtg" /* RENDER_TRIGGERED */);
|
|
2722
|
-
const onRenderTracked = createHook("rtc" /* RENDER_TRACKED */);
|
|
2711
|
+
const onBeforeMount = createHook("bm" /* LifecycleHooks.BEFORE_MOUNT */);
|
|
2712
|
+
const onMounted = createHook("m" /* LifecycleHooks.MOUNTED */);
|
|
2713
|
+
const onBeforeUpdate = createHook("bu" /* LifecycleHooks.BEFORE_UPDATE */);
|
|
2714
|
+
const onUpdated = createHook("u" /* LifecycleHooks.UPDATED */);
|
|
2715
|
+
const onBeforeUnmount = createHook("bum" /* LifecycleHooks.BEFORE_UNMOUNT */);
|
|
2716
|
+
const onUnmounted = createHook("um" /* LifecycleHooks.UNMOUNTED */);
|
|
2717
|
+
const onServerPrefetch = createHook("sp" /* LifecycleHooks.SERVER_PREFETCH */);
|
|
2718
|
+
const onRenderTriggered = createHook("rtg" /* LifecycleHooks.RENDER_TRIGGERED */);
|
|
2719
|
+
const onRenderTracked = createHook("rtc" /* LifecycleHooks.RENDER_TRACKED */);
|
|
2723
2720
|
function onErrorCaptured(hook, target = currentInstance) {
|
|
2724
|
-
injectHook("ec" /* ERROR_CAPTURED */, hook, target);
|
|
2721
|
+
injectHook("ec" /* LifecycleHooks.ERROR_CAPTURED */, hook, target);
|
|
2725
2722
|
}
|
|
2726
2723
|
|
|
2727
2724
|
/**
|
|
@@ -2788,7 +2785,7 @@ function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
|
2788
2785
|
// disable tracking inside all lifecycle hooks
|
|
2789
2786
|
// since they can potentially be called inside effects.
|
|
2790
2787
|
pauseTracking();
|
|
2791
|
-
callWithAsyncErrorHandling(hook, instance, 8 /* DIRECTIVE_HOOK */, [
|
|
2788
|
+
callWithAsyncErrorHandling(hook, instance, 8 /* ErrorCodes.DIRECTIVE_HOOK */, [
|
|
2792
2789
|
vnode.el,
|
|
2793
2790
|
binding,
|
|
2794
2791
|
vnode,
|
|
@@ -2833,7 +2830,7 @@ function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false
|
|
|
2833
2830
|
const Component = instance.type;
|
|
2834
2831
|
// explicit self name has highest priority
|
|
2835
2832
|
if (type === COMPONENTS) {
|
|
2836
|
-
const selfName = getComponentName(Component);
|
|
2833
|
+
const selfName = getComponentName(Component, false /* do not include inferred name to avoid breaking existing code */);
|
|
2837
2834
|
if (selfName &&
|
|
2838
2835
|
(selfName === name ||
|
|
2839
2836
|
selfName === camelize(name) ||
|
|
@@ -2930,7 +2927,13 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2930
2927
|
}
|
|
2931
2928
|
else if (slot) {
|
|
2932
2929
|
// conditional single slot generated by <template v-if="..." #foo>
|
|
2933
|
-
slots[slot.name] = slot.
|
|
2930
|
+
slots[slot.name] = slot.key
|
|
2931
|
+
? (...args) => {
|
|
2932
|
+
const res = slot.fn(...args);
|
|
2933
|
+
res.key = slot.key;
|
|
2934
|
+
return res;
|
|
2935
|
+
}
|
|
2936
|
+
: slot.fn;
|
|
2934
2937
|
}
|
|
2935
2938
|
}
|
|
2936
2939
|
return slots;
|
|
@@ -2966,9 +2969,15 @@ fallback, noSlotted) {
|
|
|
2966
2969
|
}
|
|
2967
2970
|
openBlock();
|
|
2968
2971
|
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
2969
|
-
const rendered = createBlock(Fragment, {
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
+
const rendered = createBlock(Fragment, {
|
|
2973
|
+
key: props.key ||
|
|
2974
|
+
// slot content array of a dynamic conditional slot may have a branch
|
|
2975
|
+
// key attached in the `createSlots` helper, respect that
|
|
2976
|
+
(validSlotContent && validSlotContent.key) ||
|
|
2977
|
+
`_${name}`
|
|
2978
|
+
}, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 /* SlotFlags.STABLE */
|
|
2979
|
+
? 64 /* PatchFlags.STABLE_FRAGMENT */
|
|
2980
|
+
: -2 /* PatchFlags.BAIL */);
|
|
2972
2981
|
if (!noSlotted && rendered.scopeId) {
|
|
2973
2982
|
rendered.slotScopeIds = [rendered.scopeId + '-s'];
|
|
2974
2983
|
}
|
|
@@ -2996,14 +3005,16 @@ function ensureValidVNode(vnodes) {
|
|
|
2996
3005
|
* For prefixing keys in v-on="obj" with "on"
|
|
2997
3006
|
* @private
|
|
2998
3007
|
*/
|
|
2999
|
-
function toHandlers(obj) {
|
|
3008
|
+
function toHandlers(obj, preserveCaseIfNecessary) {
|
|
3000
3009
|
const ret = {};
|
|
3001
3010
|
if ((process.env.NODE_ENV !== 'production') && !isObject(obj)) {
|
|
3002
3011
|
warn(`v-on with no argument expects an object value.`);
|
|
3003
3012
|
return ret;
|
|
3004
3013
|
}
|
|
3005
3014
|
for (const key in obj) {
|
|
3006
|
-
ret[
|
|
3015
|
+
ret[preserveCaseIfNecessary && /[A-Z]/.test(key)
|
|
3016
|
+
? `on:${key}`
|
|
3017
|
+
: toHandlerKey(key)] = obj[key];
|
|
3007
3018
|
}
|
|
3008
3019
|
return ret;
|
|
3009
3020
|
}
|
|
@@ -3068,23 +3079,23 @@ const PublicInstanceProxyHandlers = {
|
|
|
3068
3079
|
const n = accessCache[key];
|
|
3069
3080
|
if (n !== undefined) {
|
|
3070
3081
|
switch (n) {
|
|
3071
|
-
case 1 /* SETUP */:
|
|
3082
|
+
case 1 /* AccessTypes.SETUP */:
|
|
3072
3083
|
return setupState[key];
|
|
3073
|
-
case 2 /* DATA */:
|
|
3084
|
+
case 2 /* AccessTypes.DATA */:
|
|
3074
3085
|
return data[key];
|
|
3075
|
-
case 4 /* CONTEXT */:
|
|
3086
|
+
case 4 /* AccessTypes.CONTEXT */:
|
|
3076
3087
|
return ctx[key];
|
|
3077
|
-
case 3 /* PROPS */:
|
|
3088
|
+
case 3 /* AccessTypes.PROPS */:
|
|
3078
3089
|
return props[key];
|
|
3079
3090
|
// default: just fallthrough
|
|
3080
3091
|
}
|
|
3081
3092
|
}
|
|
3082
3093
|
else if (setupState !== EMPTY_OBJ && hasOwn(setupState, key)) {
|
|
3083
|
-
accessCache[key] = 1 /* SETUP */;
|
|
3094
|
+
accessCache[key] = 1 /* AccessTypes.SETUP */;
|
|
3084
3095
|
return setupState[key];
|
|
3085
3096
|
}
|
|
3086
3097
|
else if (data !== EMPTY_OBJ && hasOwn(data, key)) {
|
|
3087
|
-
accessCache[key] = 2 /* DATA */;
|
|
3098
|
+
accessCache[key] = 2 /* AccessTypes.DATA */;
|
|
3088
3099
|
return data[key];
|
|
3089
3100
|
}
|
|
3090
3101
|
else if (
|
|
@@ -3092,15 +3103,15 @@ const PublicInstanceProxyHandlers = {
|
|
|
3092
3103
|
// props
|
|
3093
3104
|
(normalizedProps = instance.propsOptions[0]) &&
|
|
3094
3105
|
hasOwn(normalizedProps, key)) {
|
|
3095
|
-
accessCache[key] = 3 /* PROPS */;
|
|
3106
|
+
accessCache[key] = 3 /* AccessTypes.PROPS */;
|
|
3096
3107
|
return props[key];
|
|
3097
3108
|
}
|
|
3098
3109
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
3099
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
3110
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
3100
3111
|
return ctx[key];
|
|
3101
3112
|
}
|
|
3102
3113
|
else if (!__VUE_OPTIONS_API__ || shouldCacheAccess) {
|
|
3103
|
-
accessCache[key] = 0 /* OTHER */;
|
|
3114
|
+
accessCache[key] = 0 /* AccessTypes.OTHER */;
|
|
3104
3115
|
}
|
|
3105
3116
|
}
|
|
3106
3117
|
const publicGetter = publicPropertiesMap[key];
|
|
@@ -3108,7 +3119,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
3108
3119
|
// public $xxx properties
|
|
3109
3120
|
if (publicGetter) {
|
|
3110
3121
|
if (key === '$attrs') {
|
|
3111
|
-
track(instance, "get" /* GET */, key);
|
|
3122
|
+
track(instance, "get" /* TrackOpTypes.GET */, key);
|
|
3112
3123
|
(process.env.NODE_ENV !== 'production') && markAttrsAccessed();
|
|
3113
3124
|
}
|
|
3114
3125
|
return publicGetter(instance);
|
|
@@ -3121,7 +3132,7 @@ const PublicInstanceProxyHandlers = {
|
|
|
3121
3132
|
}
|
|
3122
3133
|
else if (ctx !== EMPTY_OBJ && hasOwn(ctx, key)) {
|
|
3123
3134
|
// user may set custom properties to `this` that start with `$`
|
|
3124
|
-
accessCache[key] = 4 /* CONTEXT */;
|
|
3135
|
+
accessCache[key] = 4 /* AccessTypes.CONTEXT */;
|
|
3125
3136
|
return ctx[key];
|
|
3126
3137
|
}
|
|
3127
3138
|
else if (
|
|
@@ -3307,7 +3318,7 @@ function applyOptions(instance) {
|
|
|
3307
3318
|
// call beforeCreate first before accessing other options since
|
|
3308
3319
|
// the hook may mutate resolved options (#2791)
|
|
3309
3320
|
if (options.beforeCreate) {
|
|
3310
|
-
callHook(options.beforeCreate, instance, "bc" /* BEFORE_CREATE */);
|
|
3321
|
+
callHook(options.beforeCreate, instance, "bc" /* LifecycleHooks.BEFORE_CREATE */);
|
|
3311
3322
|
}
|
|
3312
3323
|
const {
|
|
3313
3324
|
// state
|
|
@@ -3323,7 +3334,7 @@ function applyOptions(instance) {
|
|
|
3323
3334
|
const [propsOptions] = instance.propsOptions;
|
|
3324
3335
|
if (propsOptions) {
|
|
3325
3336
|
for (const key in propsOptions) {
|
|
3326
|
-
checkDuplicateProperties("Props" /* PROPS */, key);
|
|
3337
|
+
checkDuplicateProperties("Props" /* OptionTypes.PROPS */, key);
|
|
3327
3338
|
}
|
|
3328
3339
|
}
|
|
3329
3340
|
}
|
|
@@ -3356,7 +3367,7 @@ function applyOptions(instance) {
|
|
|
3356
3367
|
ctx[key] = methodHandler.bind(publicThis);
|
|
3357
3368
|
}
|
|
3358
3369
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
3359
|
-
checkDuplicateProperties("Methods" /* METHODS */, key);
|
|
3370
|
+
checkDuplicateProperties("Methods" /* OptionTypes.METHODS */, key);
|
|
3360
3371
|
}
|
|
3361
3372
|
}
|
|
3362
3373
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -3383,7 +3394,7 @@ function applyOptions(instance) {
|
|
|
3383
3394
|
instance.data = reactive(data);
|
|
3384
3395
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
3385
3396
|
for (const key in data) {
|
|
3386
|
-
checkDuplicateProperties("Data" /* DATA */, key);
|
|
3397
|
+
checkDuplicateProperties("Data" /* OptionTypes.DATA */, key);
|
|
3387
3398
|
// expose data on ctx during dev
|
|
3388
3399
|
if (!isReservedPrefix(key[0])) {
|
|
3389
3400
|
Object.defineProperty(ctx, key, {
|
|
@@ -3428,7 +3439,7 @@ function applyOptions(instance) {
|
|
|
3428
3439
|
set: v => (c.value = v)
|
|
3429
3440
|
});
|
|
3430
3441
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
3431
|
-
checkDuplicateProperties("Computed" /* COMPUTED */, key);
|
|
3442
|
+
checkDuplicateProperties("Computed" /* OptionTypes.COMPUTED */, key);
|
|
3432
3443
|
}
|
|
3433
3444
|
}
|
|
3434
3445
|
}
|
|
@@ -3446,7 +3457,7 @@ function applyOptions(instance) {
|
|
|
3446
3457
|
});
|
|
3447
3458
|
}
|
|
3448
3459
|
if (created) {
|
|
3449
|
-
callHook(created, instance, "c" /* CREATED */);
|
|
3460
|
+
callHook(created, instance, "c" /* LifecycleHooks.CREATED */);
|
|
3450
3461
|
}
|
|
3451
3462
|
function registerLifecycleHook(register, hook) {
|
|
3452
3463
|
if (isArray(hook)) {
|
|
@@ -3539,7 +3550,7 @@ function resolveInjections(injectOptions, ctx, checkDuplicateProperties = NOOP,
|
|
|
3539
3550
|
ctx[key] = injected;
|
|
3540
3551
|
}
|
|
3541
3552
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
3542
|
-
checkDuplicateProperties("Inject" /* INJECT */, key);
|
|
3553
|
+
checkDuplicateProperties("Inject" /* OptionTypes.INJECT */, key);
|
|
3543
3554
|
}
|
|
3544
3555
|
}
|
|
3545
3556
|
}
|
|
@@ -3610,7 +3621,9 @@ function resolveMergedOptions(instance) {
|
|
|
3610
3621
|
}
|
|
3611
3622
|
mergeOptions(resolved, base, optionMergeStrategies);
|
|
3612
3623
|
}
|
|
3613
|
-
|
|
3624
|
+
if (isObject(base)) {
|
|
3625
|
+
cache.set(base, resolved);
|
|
3626
|
+
}
|
|
3614
3627
|
return resolved;
|
|
3615
3628
|
}
|
|
3616
3629
|
function mergeOptions(to, from, strats, asMixin = false) {
|
|
@@ -3740,6 +3753,13 @@ isSSR = false) {
|
|
|
3740
3753
|
}
|
|
3741
3754
|
instance.attrs = attrs;
|
|
3742
3755
|
}
|
|
3756
|
+
function isInHmrContext(instance) {
|
|
3757
|
+
while (instance) {
|
|
3758
|
+
if (instance.type.__hmrId)
|
|
3759
|
+
return true;
|
|
3760
|
+
instance = instance.parent;
|
|
3761
|
+
}
|
|
3762
|
+
}
|
|
3743
3763
|
function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
3744
3764
|
const { props, attrs, vnode: { patchFlag } } = instance;
|
|
3745
3765
|
const rawCurrentProps = toRaw(props);
|
|
@@ -3749,12 +3769,10 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3749
3769
|
// always force full diff in dev
|
|
3750
3770
|
// - #1942 if hmr is enabled with sfc component
|
|
3751
3771
|
// - vite#872 non-sfc component used by sfc component
|
|
3752
|
-
!((process.env.NODE_ENV !== 'production') &&
|
|
3753
|
-
(instance.type.__hmrId ||
|
|
3754
|
-
(instance.parent && instance.parent.type.__hmrId))) &&
|
|
3772
|
+
!((process.env.NODE_ENV !== 'production') && isInHmrContext(instance)) &&
|
|
3755
3773
|
(optimized || patchFlag > 0) &&
|
|
3756
|
-
!(patchFlag & 16 /* FULL_PROPS */)) {
|
|
3757
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
3774
|
+
!(patchFlag & 16 /* PatchFlags.FULL_PROPS */)) {
|
|
3775
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
3758
3776
|
// Compiler-generated props & no keys change, just set the updated
|
|
3759
3777
|
// the props.
|
|
3760
3778
|
const propsToUpdate = instance.vnode.dynamicProps;
|
|
@@ -3833,7 +3851,7 @@ function updateProps(instance, rawProps, rawPrevProps, optimized) {
|
|
|
3833
3851
|
}
|
|
3834
3852
|
// trigger updates for $attrs in case it's used in component slots
|
|
3835
3853
|
if (hasAttrsChanged) {
|
|
3836
|
-
trigger(instance, "set" /* SET */, '$attrs');
|
|
3854
|
+
trigger(instance, "set" /* TriggerOpTypes.SET */, '$attrs');
|
|
3837
3855
|
}
|
|
3838
3856
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
3839
3857
|
validateProps(rawProps || {}, props, instance);
|
|
@@ -3902,11 +3920,11 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
3902
3920
|
}
|
|
3903
3921
|
}
|
|
3904
3922
|
// boolean casting
|
|
3905
|
-
if (opt[0 /* shouldCast */]) {
|
|
3923
|
+
if (opt[0 /* BooleanFlags.shouldCast */]) {
|
|
3906
3924
|
if (isAbsent && !hasDefault) {
|
|
3907
3925
|
value = false;
|
|
3908
3926
|
}
|
|
3909
|
-
else if (opt[1 /* shouldCastTrue */] &&
|
|
3927
|
+
else if (opt[1 /* BooleanFlags.shouldCastTrue */] &&
|
|
3910
3928
|
(value === '' || value === hyphenate(key))) {
|
|
3911
3929
|
value = true;
|
|
3912
3930
|
}
|
|
@@ -3944,7 +3962,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3944
3962
|
}
|
|
3945
3963
|
}
|
|
3946
3964
|
if (!raw && !hasExtends) {
|
|
3947
|
-
|
|
3965
|
+
if (isObject(comp)) {
|
|
3966
|
+
cache.set(comp, EMPTY_ARR);
|
|
3967
|
+
}
|
|
3948
3968
|
return EMPTY_ARR;
|
|
3949
3969
|
}
|
|
3950
3970
|
if (isArray(raw)) {
|
|
@@ -3971,8 +3991,8 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3971
3991
|
if (prop) {
|
|
3972
3992
|
const booleanIndex = getTypeIndex(Boolean, prop.type);
|
|
3973
3993
|
const stringIndex = getTypeIndex(String, prop.type);
|
|
3974
|
-
prop[0 /* shouldCast */] = booleanIndex > -1;
|
|
3975
|
-
prop[1 /* shouldCastTrue */] =
|
|
3994
|
+
prop[0 /* BooleanFlags.shouldCast */] = booleanIndex > -1;
|
|
3995
|
+
prop[1 /* BooleanFlags.shouldCastTrue */] =
|
|
3976
3996
|
stringIndex < 0 || booleanIndex < stringIndex;
|
|
3977
3997
|
// if the prop needs boolean casting or default value
|
|
3978
3998
|
if (booleanIndex > -1 || hasOwn(prop, 'default')) {
|
|
@@ -3983,7 +4003,9 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
3983
4003
|
}
|
|
3984
4004
|
}
|
|
3985
4005
|
const res = [normalized, needCastKeys];
|
|
3986
|
-
|
|
4006
|
+
if (isObject(comp)) {
|
|
4007
|
+
cache.set(comp, res);
|
|
4008
|
+
}
|
|
3987
4009
|
return res;
|
|
3988
4010
|
}
|
|
3989
4011
|
function validatePropName(key) {
|
|
@@ -4195,7 +4217,7 @@ const normalizeVNodeSlots = (instance, children) => {
|
|
|
4195
4217
|
instance.slots.default = () => normalized;
|
|
4196
4218
|
};
|
|
4197
4219
|
const initSlots = (instance, children) => {
|
|
4198
|
-
if (instance.vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
4220
|
+
if (instance.vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
4199
4221
|
const type = children._;
|
|
4200
4222
|
if (type) {
|
|
4201
4223
|
// users can get the shallow readonly version of the slots object through `this.$slots`,
|
|
@@ -4220,7 +4242,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4220
4242
|
const { vnode, slots } = instance;
|
|
4221
4243
|
let needDeletionCheck = true;
|
|
4222
4244
|
let deletionComparisonTarget = EMPTY_OBJ;
|
|
4223
|
-
if (vnode.shapeFlag & 32 /* SLOTS_CHILDREN */) {
|
|
4245
|
+
if (vnode.shapeFlag & 32 /* ShapeFlags.SLOTS_CHILDREN */) {
|
|
4224
4246
|
const type = children._;
|
|
4225
4247
|
if (type) {
|
|
4226
4248
|
// compiled slots.
|
|
@@ -4229,7 +4251,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4229
4251
|
// force update slots and mark instance for hmr as well
|
|
4230
4252
|
extend(slots, children);
|
|
4231
4253
|
}
|
|
4232
|
-
else if (optimized && type === 1 /* STABLE */) {
|
|
4254
|
+
else if (optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
4233
4255
|
// compiled AND stable.
|
|
4234
4256
|
// no need to update, and skip stale slots removal.
|
|
4235
4257
|
needDeletionCheck = false;
|
|
@@ -4242,7 +4264,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
4242
4264
|
// when rendering the optimized slots by manually written render function,
|
|
4243
4265
|
// we need to delete the `slots._` flag if necessary to make subsequent updates reliable,
|
|
4244
4266
|
// i.e. let the `renderSlot` create the bailed Fragment
|
|
4245
|
-
if (!optimized && type === 1 /* STABLE */) {
|
|
4267
|
+
if (!optimized && type === 1 /* SlotFlags.STABLE */) {
|
|
4246
4268
|
delete slots._;
|
|
4247
4269
|
}
|
|
4248
4270
|
}
|
|
@@ -4456,7 +4478,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4456
4478
|
// because the template ref is forwarded to inner component
|
|
4457
4479
|
return;
|
|
4458
4480
|
}
|
|
4459
|
-
const refValue = vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */
|
|
4481
|
+
const refValue = vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
4460
4482
|
? getExposeProxy(vnode.component) || vnode.component.proxy
|
|
4461
4483
|
: vnode.el;
|
|
4462
4484
|
const value = isUnmount ? null : refValue;
|
|
@@ -4482,7 +4504,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4482
4504
|
}
|
|
4483
4505
|
}
|
|
4484
4506
|
if (isFunction(ref)) {
|
|
4485
|
-
callWithErrorHandling(ref, owner, 12 /* FUNCTION_REF */, [value, refs]);
|
|
4507
|
+
callWithErrorHandling(ref, owner, 12 /* ErrorCodes.FUNCTION_REF */, [value, refs]);
|
|
4486
4508
|
}
|
|
4487
4509
|
else {
|
|
4488
4510
|
const _isString = isString(ref);
|
|
@@ -4519,7 +4541,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4519
4541
|
setupState[ref] = value;
|
|
4520
4542
|
}
|
|
4521
4543
|
}
|
|
4522
|
-
else if (
|
|
4544
|
+
else if (_isRef) {
|
|
4523
4545
|
ref.value = value;
|
|
4524
4546
|
if (rawRef.k)
|
|
4525
4547
|
refs[rawRef.k] = value;
|
|
@@ -4544,7 +4566,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
4544
4566
|
|
|
4545
4567
|
let hasMismatch = false;
|
|
4546
4568
|
const isSVGContainer = (container) => /svg/.test(container.namespaceURI) && container.tagName !== 'foreignObject';
|
|
4547
|
-
const isComment = (node) => node.nodeType === 8 /* COMMENT */;
|
|
4569
|
+
const isComment = (node) => node.nodeType === 8 /* DOMNodeTypes.COMMENT */;
|
|
4548
4570
|
// Note: hydration is DOM-specific
|
|
4549
4571
|
// But we have to place it in core due to tight coupling with core - splitting
|
|
4550
4572
|
// it out creates a ton of unnecessary complexity.
|
|
@@ -4559,11 +4581,13 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4559
4581
|
`Performing full mount instead.`);
|
|
4560
4582
|
patch(null, vnode, container);
|
|
4561
4583
|
flushPostFlushCbs();
|
|
4584
|
+
container._vnode = vnode;
|
|
4562
4585
|
return;
|
|
4563
4586
|
}
|
|
4564
4587
|
hasMismatch = false;
|
|
4565
4588
|
hydrateNode(container.firstChild, vnode, null, null, null);
|
|
4566
4589
|
flushPostFlushCbs();
|
|
4590
|
+
container._vnode = vnode;
|
|
4567
4591
|
if (hasMismatch && !false) {
|
|
4568
4592
|
// this error should show up in production
|
|
4569
4593
|
console.error(`Hydration completed but contains mismatches.`);
|
|
@@ -4575,14 +4599,14 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4575
4599
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
4576
4600
|
const domType = node.nodeType;
|
|
4577
4601
|
vnode.el = node;
|
|
4578
|
-
if (patchFlag === -2 /* BAIL */) {
|
|
4602
|
+
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
4579
4603
|
optimized = false;
|
|
4580
4604
|
vnode.dynamicChildren = null;
|
|
4581
4605
|
}
|
|
4582
4606
|
let nextNode = null;
|
|
4583
4607
|
switch (type) {
|
|
4584
4608
|
case Text:
|
|
4585
|
-
if (domType !== 3 /* TEXT */) {
|
|
4609
|
+
if (domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
4586
4610
|
// #5728 empty text node inside a slot can cause hydration failure
|
|
4587
4611
|
// because the server rendered HTML won't contain a text node
|
|
4588
4612
|
if (vnode.children === '') {
|
|
@@ -4606,7 +4630,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4606
4630
|
}
|
|
4607
4631
|
break;
|
|
4608
4632
|
case Comment:
|
|
4609
|
-
if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
4633
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
|
|
4610
4634
|
nextNode = onMismatch();
|
|
4611
4635
|
}
|
|
4612
4636
|
else {
|
|
@@ -4614,7 +4638,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4614
4638
|
}
|
|
4615
4639
|
break;
|
|
4616
4640
|
case Static:
|
|
4617
|
-
if (domType !== 1 /* ELEMENT */) {
|
|
4641
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
4618
4642
|
nextNode = onMismatch();
|
|
4619
4643
|
}
|
|
4620
4644
|
else {
|
|
@@ -4625,7 +4649,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4625
4649
|
const needToAdoptContent = !vnode.children.length;
|
|
4626
4650
|
for (let i = 0; i < vnode.staticCount; i++) {
|
|
4627
4651
|
if (needToAdoptContent)
|
|
4628
|
-
vnode.children +=
|
|
4652
|
+
vnode.children +=
|
|
4653
|
+
nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
|
|
4654
|
+
? nextNode.outerHTML
|
|
4655
|
+
: nextNode.data;
|
|
4629
4656
|
if (i === vnode.staticCount - 1) {
|
|
4630
4657
|
vnode.anchor = nextNode;
|
|
4631
4658
|
}
|
|
@@ -4643,8 +4670,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4643
4670
|
}
|
|
4644
4671
|
break;
|
|
4645
4672
|
default:
|
|
4646
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
4647
|
-
if (domType !== 1 /* ELEMENT */ ||
|
|
4673
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
4674
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
|
|
4648
4675
|
vnode.type.toLowerCase() !==
|
|
4649
4676
|
node.tagName.toLowerCase()) {
|
|
4650
4677
|
nextNode = onMismatch();
|
|
@@ -4653,7 +4680,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4653
4680
|
nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
4654
4681
|
}
|
|
4655
4682
|
}
|
|
4656
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
4683
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4657
4684
|
// when setting up the render effect, if the initial vnode already
|
|
4658
4685
|
// has .el set, the component will perform hydration instead of mount
|
|
4659
4686
|
// on its sub-tree.
|
|
@@ -4692,15 +4719,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4692
4719
|
vnode.component.subTree = subTree;
|
|
4693
4720
|
}
|
|
4694
4721
|
}
|
|
4695
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
4696
|
-
if (domType !== 8 /* COMMENT */) {
|
|
4722
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
4723
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
|
|
4697
4724
|
nextNode = onMismatch();
|
|
4698
4725
|
}
|
|
4699
4726
|
else {
|
|
4700
4727
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
4701
4728
|
}
|
|
4702
4729
|
}
|
|
4703
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
4730
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4704
4731
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
4705
4732
|
}
|
|
4706
4733
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -4720,7 +4747,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4720
4747
|
const forcePatchValue = (type === 'input' && dirs) || type === 'option';
|
|
4721
4748
|
// skip props & children if this is hoisted static nodes
|
|
4722
4749
|
// #5405 in dev, always hydrate children for HMR
|
|
4723
|
-
if ((process.env.NODE_ENV !== 'production') || forcePatchValue || patchFlag !== -1 /* HOISTED */) {
|
|
4750
|
+
if ((process.env.NODE_ENV !== 'production') || forcePatchValue || patchFlag !== -1 /* PatchFlags.HOISTED */) {
|
|
4724
4751
|
if (dirs) {
|
|
4725
4752
|
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
|
4726
4753
|
}
|
|
@@ -4728,7 +4755,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4728
4755
|
if (props) {
|
|
4729
4756
|
if (forcePatchValue ||
|
|
4730
4757
|
!optimized ||
|
|
4731
|
-
patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
|
|
4758
|
+
patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
|
|
4732
4759
|
for (const key in props) {
|
|
4733
4760
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
4734
4761
|
(isOn(key) && !isReservedProp(key))) {
|
|
@@ -4757,7 +4784,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4757
4784
|
}, parentSuspense);
|
|
4758
4785
|
}
|
|
4759
4786
|
// children
|
|
4760
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
|
|
4787
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
|
|
4761
4788
|
// skip if element has innerHTML / textContent
|
|
4762
4789
|
!(props && (props.innerHTML || props.textContent))) {
|
|
4763
4790
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -4775,7 +4802,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4775
4802
|
remove(cur);
|
|
4776
4803
|
}
|
|
4777
4804
|
}
|
|
4778
|
-
else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
4805
|
+
else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
4779
4806
|
if (el.textContent !== vnode.children) {
|
|
4780
4807
|
hasMismatch = true;
|
|
4781
4808
|
(process.env.NODE_ENV !== 'production') &&
|
|
@@ -4840,7 +4867,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4840
4867
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
4841
4868
|
hasMismatch = true;
|
|
4842
4869
|
(process.env.NODE_ENV !== 'production') &&
|
|
4843
|
-
warn(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* TEXT */
|
|
4870
|
+
warn(`Hydration node mismatch:\n- Client vnode:`, vnode.type, `\n- Server rendered DOM:`, node, node.nodeType === 3 /* DOMNodeTypes.TEXT */
|
|
4844
4871
|
? `(text)`
|
|
4845
4872
|
: isComment(node) && node.data === '['
|
|
4846
4873
|
? `(start of fragment)`
|
|
@@ -5002,7 +5029,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5002
5029
|
unmount(n1, parentComponent, parentSuspense, true);
|
|
5003
5030
|
n1 = null;
|
|
5004
5031
|
}
|
|
5005
|
-
if (n2.patchFlag === -2 /* BAIL */) {
|
|
5032
|
+
if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
5006
5033
|
optimized = false;
|
|
5007
5034
|
n2.dynamicChildren = null;
|
|
5008
5035
|
}
|
|
@@ -5026,16 +5053,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5026
5053
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5027
5054
|
break;
|
|
5028
5055
|
default:
|
|
5029
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
5056
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
5030
5057
|
processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5031
5058
|
}
|
|
5032
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
5059
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5033
5060
|
processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5034
5061
|
}
|
|
5035
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
5062
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5036
5063
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
5037
5064
|
}
|
|
5038
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5065
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5039
5066
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
5040
5067
|
}
|
|
5041
5068
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -5120,7 +5147,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5120
5147
|
if (!(process.env.NODE_ENV !== 'production') &&
|
|
5121
5148
|
vnode.el &&
|
|
5122
5149
|
hostCloneNode !== undefined &&
|
|
5123
|
-
patchFlag === -1 /* HOISTED */) {
|
|
5150
|
+
patchFlag === -1 /* PatchFlags.HOISTED */) {
|
|
5124
5151
|
// If a vnode has non-null el, it means it's being reused.
|
|
5125
5152
|
// Only static vnodes can be reused, so its mounted DOM nodes should be
|
|
5126
5153
|
// exactly the same, and we can simply do a clone here.
|
|
@@ -5131,10 +5158,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5131
5158
|
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
5132
5159
|
// mount children first, since some props may rely on child content
|
|
5133
5160
|
// being already rendered, e.g. `<select value>`
|
|
5134
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5161
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5135
5162
|
hostSetElementText(el, vnode.children);
|
|
5136
5163
|
}
|
|
5137
|
-
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5164
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5138
5165
|
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
5139
5166
|
}
|
|
5140
5167
|
if (dirs) {
|
|
@@ -5211,7 +5238,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5211
5238
|
let subTree = parentComponent.subTree;
|
|
5212
5239
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
5213
5240
|
subTree.patchFlag > 0 &&
|
|
5214
|
-
subTree.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
5241
|
+
subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
5215
5242
|
subTree =
|
|
5216
5243
|
filterSingleRoot(subTree.children) || subTree;
|
|
5217
5244
|
}
|
|
@@ -5234,7 +5261,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5234
5261
|
let { patchFlag, dynamicChildren, dirs } = n2;
|
|
5235
5262
|
// #1426 take the old vnode's patch flag into account since user may clone a
|
|
5236
5263
|
// compiler-generated vnode, which de-opts to FULL_PROPS
|
|
5237
|
-
patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
|
|
5264
|
+
patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
|
|
5238
5265
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
5239
5266
|
const newProps = n2.props || EMPTY_OBJ;
|
|
5240
5267
|
let vnodeHook;
|
|
@@ -5269,21 +5296,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5269
5296
|
// generated by the compiler and can take the fast path.
|
|
5270
5297
|
// in this path old node and new node are guaranteed to have the same shape
|
|
5271
5298
|
// (i.e. at the exact same position in the source template)
|
|
5272
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
5299
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
5273
5300
|
// element props contain dynamic keys, full diff needed
|
|
5274
5301
|
patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
|
5275
5302
|
}
|
|
5276
5303
|
else {
|
|
5277
5304
|
// class
|
|
5278
5305
|
// this flag is matched when the element has dynamic class bindings.
|
|
5279
|
-
if (patchFlag & 2 /* CLASS */) {
|
|
5306
|
+
if (patchFlag & 2 /* PatchFlags.CLASS */) {
|
|
5280
5307
|
if (oldProps.class !== newProps.class) {
|
|
5281
5308
|
hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
|
5282
5309
|
}
|
|
5283
5310
|
}
|
|
5284
5311
|
// style
|
|
5285
5312
|
// this flag is matched when the element has dynamic style bindings
|
|
5286
|
-
if (patchFlag & 4 /* STYLE */) {
|
|
5313
|
+
if (patchFlag & 4 /* PatchFlags.STYLE */) {
|
|
5287
5314
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
|
5288
5315
|
}
|
|
5289
5316
|
// props
|
|
@@ -5292,7 +5319,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5292
5319
|
// faster iteration.
|
|
5293
5320
|
// Note dynamic keys like :[foo]="bar" will cause this optimization to
|
|
5294
5321
|
// bail out and go through a full diff because we need to unset the old key
|
|
5295
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
5322
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
5296
5323
|
// if the flag is present then dynamicProps must be non-null
|
|
5297
5324
|
const propsToUpdate = n2.dynamicProps;
|
|
5298
5325
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
@@ -5308,7 +5335,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5308
5335
|
}
|
|
5309
5336
|
// text
|
|
5310
5337
|
// This flag is matched when the element has only dynamic text children.
|
|
5311
|
-
if (patchFlag & 1 /* TEXT */) {
|
|
5338
|
+
if (patchFlag & 1 /* PatchFlags.TEXT */) {
|
|
5312
5339
|
if (n1.children !== n2.children) {
|
|
5313
5340
|
hostSetElementText(el, n2.children);
|
|
5314
5341
|
}
|
|
@@ -5342,7 +5369,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5342
5369
|
// which also requires the correct parent container
|
|
5343
5370
|
!isSameVNodeType(oldVNode, newVNode) ||
|
|
5344
5371
|
// - In the case of a component, it could contain anything.
|
|
5345
|
-
oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
|
|
5372
|
+
oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
|
|
5346
5373
|
? hostParentNode(oldVNode.el)
|
|
5347
5374
|
: // In other cases, the parent container is not actually used so we
|
|
5348
5375
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -5381,7 +5408,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5381
5408
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
5382
5409
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
5383
5410
|
// #5523 dev root fragment may inherit directives
|
|
5384
|
-
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
5411
|
+
(isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */)) {
|
|
5385
5412
|
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
5386
5413
|
patchFlag = 0;
|
|
5387
5414
|
optimized = false;
|
|
@@ -5403,7 +5430,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5403
5430
|
}
|
|
5404
5431
|
else {
|
|
5405
5432
|
if (patchFlag > 0 &&
|
|
5406
|
-
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
5433
|
+
patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
|
|
5407
5434
|
dynamicChildren &&
|
|
5408
5435
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
5409
5436
|
// of renderSlot() with no valid children
|
|
@@ -5436,7 +5463,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5436
5463
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
5437
5464
|
n2.slotScopeIds = slotScopeIds;
|
|
5438
5465
|
if (n1 == null) {
|
|
5439
|
-
if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
5466
|
+
if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
5440
5467
|
parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
|
5441
5468
|
}
|
|
5442
5469
|
else {
|
|
@@ -5598,10 +5625,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5598
5625
|
// activated hook for keep-alive roots.
|
|
5599
5626
|
// #1742 activated hook must be accessed after first render
|
|
5600
5627
|
// since the hook may be injected by a child keep-alive
|
|
5601
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5628
|
+
if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5602
5629
|
(parent &&
|
|
5603
5630
|
isAsyncWrapper(parent.vnode) &&
|
|
5604
|
-
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5631
|
+
parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5605
5632
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
5606
5633
|
}
|
|
5607
5634
|
instance.isMounted = true;
|
|
@@ -5712,7 +5739,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5712
5739
|
pauseTracking();
|
|
5713
5740
|
// props update may have triggered pre-flush watchers.
|
|
5714
5741
|
// flush them before the render update.
|
|
5715
|
-
flushPreFlushCbs(
|
|
5742
|
+
flushPreFlushCbs();
|
|
5716
5743
|
resetTracking();
|
|
5717
5744
|
};
|
|
5718
5745
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
|
@@ -5722,22 +5749,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5722
5749
|
const { patchFlag, shapeFlag } = n2;
|
|
5723
5750
|
// fast path
|
|
5724
5751
|
if (patchFlag > 0) {
|
|
5725
|
-
if (patchFlag & 128 /* KEYED_FRAGMENT */) {
|
|
5752
|
+
if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
|
|
5726
5753
|
// this could be either fully-keyed or mixed (some keyed some not)
|
|
5727
5754
|
// presence of patchFlag means children are guaranteed to be arrays
|
|
5728
5755
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5729
5756
|
return;
|
|
5730
5757
|
}
|
|
5731
|
-
else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
|
|
5758
|
+
else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
|
|
5732
5759
|
// unkeyed
|
|
5733
5760
|
patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5734
5761
|
return;
|
|
5735
5762
|
}
|
|
5736
5763
|
}
|
|
5737
5764
|
// children has 3 possibilities: text, array or no children.
|
|
5738
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5765
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5739
5766
|
// text children fast path
|
|
5740
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5767
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5741
5768
|
unmountChildren(c1, parentComponent, parentSuspense);
|
|
5742
5769
|
}
|
|
5743
5770
|
if (c2 !== c1) {
|
|
@@ -5745,9 +5772,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5745
5772
|
}
|
|
5746
5773
|
}
|
|
5747
5774
|
else {
|
|
5748
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5775
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5749
5776
|
// prev children was array
|
|
5750
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5777
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5751
5778
|
// two arrays, cannot assume anything, do full diff
|
|
5752
5779
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5753
5780
|
}
|
|
@@ -5759,11 +5786,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5759
5786
|
else {
|
|
5760
5787
|
// prev children was text OR null
|
|
5761
5788
|
// new children is array OR null
|
|
5762
|
-
if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5789
|
+
if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5763
5790
|
hostSetElementText(container, '');
|
|
5764
5791
|
}
|
|
5765
5792
|
// mount new if array
|
|
5766
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5793
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5767
5794
|
mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5768
5795
|
}
|
|
5769
5796
|
}
|
|
@@ -5954,7 +5981,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5954
5981
|
// There is no stable subsequence (e.g. a reverse)
|
|
5955
5982
|
// OR current node is not among the stable sequence
|
|
5956
5983
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
5957
|
-
move(nextChild, container, anchor, 2 /* REORDER */);
|
|
5984
|
+
move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
|
|
5958
5985
|
}
|
|
5959
5986
|
else {
|
|
5960
5987
|
j--;
|
|
@@ -5965,15 +5992,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5965
5992
|
};
|
|
5966
5993
|
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
5967
5994
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
5968
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
5995
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5969
5996
|
move(vnode.component.subTree, container, anchor, moveType);
|
|
5970
5997
|
return;
|
|
5971
5998
|
}
|
|
5972
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5999
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5973
6000
|
vnode.suspense.move(container, anchor, moveType);
|
|
5974
6001
|
return;
|
|
5975
6002
|
}
|
|
5976
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6003
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5977
6004
|
type.move(vnode, container, anchor, internals);
|
|
5978
6005
|
return;
|
|
5979
6006
|
}
|
|
@@ -5990,11 +6017,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5990
6017
|
return;
|
|
5991
6018
|
}
|
|
5992
6019
|
// single nodes
|
|
5993
|
-
const needTransition = moveType !== 2 /* REORDER */ &&
|
|
5994
|
-
shapeFlag & 1 /* ELEMENT */ &&
|
|
6020
|
+
const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
|
|
6021
|
+
shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
5995
6022
|
transition;
|
|
5996
6023
|
if (needTransition) {
|
|
5997
|
-
if (moveType === 0 /* ENTER */) {
|
|
6024
|
+
if (moveType === 0 /* MoveType.ENTER */) {
|
|
5998
6025
|
transition.beforeEnter(el);
|
|
5999
6026
|
hostInsert(el, container, anchor);
|
|
6000
6027
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -6026,42 +6053,42 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6026
6053
|
if (ref != null) {
|
|
6027
6054
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
6028
6055
|
}
|
|
6029
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
6056
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
6030
6057
|
parentComponent.ctx.deactivate(vnode);
|
|
6031
6058
|
return;
|
|
6032
6059
|
}
|
|
6033
|
-
const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
|
|
6060
|
+
const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
|
|
6034
6061
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
6035
6062
|
let vnodeHook;
|
|
6036
6063
|
if (shouldInvokeVnodeHook &&
|
|
6037
6064
|
(vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
|
6038
6065
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
6039
6066
|
}
|
|
6040
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
6067
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6041
6068
|
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
6042
6069
|
}
|
|
6043
6070
|
else {
|
|
6044
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6071
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6045
6072
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
6046
6073
|
return;
|
|
6047
6074
|
}
|
|
6048
6075
|
if (shouldInvokeDirs) {
|
|
6049
6076
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
|
6050
6077
|
}
|
|
6051
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6078
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6052
6079
|
vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
|
6053
6080
|
}
|
|
6054
6081
|
else if (dynamicChildren &&
|
|
6055
6082
|
// #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
6056
6083
|
(type !== Fragment ||
|
|
6057
|
-
(patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
|
|
6084
|
+
(patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
|
|
6058
6085
|
// fast path for block nodes: only need to unmount dynamic children.
|
|
6059
6086
|
unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
6060
6087
|
}
|
|
6061
6088
|
else if ((type === Fragment &&
|
|
6062
6089
|
patchFlag &
|
|
6063
|
-
(128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
|
|
6064
|
-
(!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
|
|
6090
|
+
(128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
|
|
6091
|
+
(!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
|
|
6065
6092
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
6066
6093
|
}
|
|
6067
6094
|
if (doRemove) {
|
|
@@ -6083,7 +6110,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6083
6110
|
if (type === Fragment) {
|
|
6084
6111
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
6085
6112
|
vnode.patchFlag > 0 &&
|
|
6086
|
-
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
6113
|
+
vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ &&
|
|
6087
6114
|
transition &&
|
|
6088
6115
|
!transition.persisted) {
|
|
6089
6116
|
vnode.children.forEach(child => {
|
|
@@ -6110,7 +6137,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6110
6137
|
transition.afterLeave();
|
|
6111
6138
|
}
|
|
6112
6139
|
};
|
|
6113
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ &&
|
|
6140
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
6114
6141
|
transition &&
|
|
6115
6142
|
!transition.persisted) {
|
|
6116
6143
|
const { leave, delayLeave } = transition;
|
|
@@ -6186,10 +6213,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6186
6213
|
}
|
|
6187
6214
|
};
|
|
6188
6215
|
const getNextHostNode = vnode => {
|
|
6189
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */) {
|
|
6216
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6190
6217
|
return getNextHostNode(vnode.component.subTree);
|
|
6191
6218
|
}
|
|
6192
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
6219
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6193
6220
|
return vnode.suspense.next();
|
|
6194
6221
|
}
|
|
6195
6222
|
return hostNextSibling((vnode.anchor || vnode.el));
|
|
@@ -6203,6 +6230,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6203
6230
|
else {
|
|
6204
6231
|
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
|
6205
6232
|
}
|
|
6233
|
+
flushPreFlushCbs();
|
|
6206
6234
|
flushPostFlushCbs();
|
|
6207
6235
|
container._vnode = vnode;
|
|
6208
6236
|
};
|
|
@@ -6252,8 +6280,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
6252
6280
|
// guaranteed to be vnodes
|
|
6253
6281
|
const c1 = ch1[i];
|
|
6254
6282
|
let c2 = ch2[i];
|
|
6255
|
-
if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
|
|
6256
|
-
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* HYDRATE_EVENTS */) {
|
|
6283
|
+
if (c2.shapeFlag & 1 /* ShapeFlags.ELEMENT */ && !c2.dynamicChildren) {
|
|
6284
|
+
if (c2.patchFlag <= 0 || c2.patchFlag === 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
6257
6285
|
c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
|
6258
6286
|
c2.el = c1.el;
|
|
6259
6287
|
}
|
|
@@ -6377,7 +6405,7 @@ const TeleportImpl = {
|
|
|
6377
6405
|
const mount = (container, anchor) => {
|
|
6378
6406
|
// Teleport *always* has Array children. This is enforced in both the
|
|
6379
6407
|
// compiler and vnode children normalization.
|
|
6380
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6408
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6381
6409
|
mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6382
6410
|
}
|
|
6383
6411
|
};
|
|
@@ -6413,7 +6441,7 @@ const TeleportImpl = {
|
|
|
6413
6441
|
if (!wasDisabled) {
|
|
6414
6442
|
// enabled -> disabled
|
|
6415
6443
|
// move into main container
|
|
6416
|
-
moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
|
|
6444
|
+
moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
6417
6445
|
}
|
|
6418
6446
|
}
|
|
6419
6447
|
else {
|
|
@@ -6421,7 +6449,7 @@ const TeleportImpl = {
|
|
|
6421
6449
|
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
6422
6450
|
const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
|
6423
6451
|
if (nextTarget) {
|
|
6424
|
-
moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
|
|
6452
|
+
moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
|
|
6425
6453
|
}
|
|
6426
6454
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
6427
6455
|
warn('Invalid Teleport target on update:', target, `(${typeof target})`);
|
|
@@ -6430,7 +6458,7 @@ const TeleportImpl = {
|
|
|
6430
6458
|
else if (wasDisabled) {
|
|
6431
6459
|
// disabled -> enabled
|
|
6432
6460
|
// move into teleport target
|
|
6433
|
-
moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
|
|
6461
|
+
moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
6434
6462
|
}
|
|
6435
6463
|
}
|
|
6436
6464
|
}
|
|
@@ -6443,7 +6471,7 @@ const TeleportImpl = {
|
|
|
6443
6471
|
// an unmounted teleport should always remove its children if not disabled
|
|
6444
6472
|
if (doRemove || !isTeleportDisabled(props)) {
|
|
6445
6473
|
hostRemove(anchor);
|
|
6446
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6474
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6447
6475
|
for (let i = 0; i < children.length; i++) {
|
|
6448
6476
|
const child = children[i];
|
|
6449
6477
|
unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
|
|
@@ -6454,13 +6482,13 @@ const TeleportImpl = {
|
|
|
6454
6482
|
move: moveTeleport,
|
|
6455
6483
|
hydrate: hydrateTeleport
|
|
6456
6484
|
};
|
|
6457
|
-
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* REORDER */) {
|
|
6485
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2 /* TeleportMoveTypes.REORDER */) {
|
|
6458
6486
|
// move target anchor if this is a target change.
|
|
6459
|
-
if (moveType === 0 /* TARGET_CHANGE */) {
|
|
6487
|
+
if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
|
|
6460
6488
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
6461
6489
|
}
|
|
6462
6490
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
6463
|
-
const isReorder = moveType === 2 /* REORDER */;
|
|
6491
|
+
const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
|
|
6464
6492
|
// move main view anchor if this is a re-order.
|
|
6465
6493
|
if (isReorder) {
|
|
6466
6494
|
insert(el, container, parentAnchor);
|
|
@@ -6470,9 +6498,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
6470
6498
|
// is not a reorder, or the teleport is disabled
|
|
6471
6499
|
if (!isReorder || isTeleportDisabled(props)) {
|
|
6472
6500
|
// Teleport has either Array children or no children.
|
|
6473
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6501
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6474
6502
|
for (let i = 0; i < children.length; i++) {
|
|
6475
|
-
move(children[i], container, parentAnchor, 2 /* REORDER */);
|
|
6503
|
+
move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
|
|
6476
6504
|
}
|
|
6477
6505
|
}
|
|
6478
6506
|
}
|
|
@@ -6487,7 +6515,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
6487
6515
|
// if multiple teleports rendered to the same target element, we need to
|
|
6488
6516
|
// pick up from where the last teleport finished instead of the first node
|
|
6489
6517
|
const targetNode = target._lpa || target.firstChild;
|
|
6490
|
-
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6518
|
+
if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6491
6519
|
if (isTeleportDisabled(vnode.props)) {
|
|
6492
6520
|
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
6493
6521
|
vnode.targetAnchor = targetNode;
|
|
@@ -6610,7 +6638,7 @@ function isVNode(value) {
|
|
|
6610
6638
|
}
|
|
6611
6639
|
function isSameVNodeType(n1, n2) {
|
|
6612
6640
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
6613
|
-
n2.shapeFlag & 6 /* COMPONENT */ &&
|
|
6641
|
+
n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
6614
6642
|
hmrDirtyComponents.has(n2.type)) {
|
|
6615
6643
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
6616
6644
|
return false;
|
|
@@ -6641,7 +6669,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
6641
6669
|
: ref
|
|
6642
6670
|
: null);
|
|
6643
6671
|
};
|
|
6644
|
-
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
6672
|
+
function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1 /* ShapeFlags.ELEMENT */, isBlockNode = false, needFullChildrenNormalization = false) {
|
|
6645
6673
|
const vnode = {
|
|
6646
6674
|
__v_isVNode: true,
|
|
6647
6675
|
__v_skip: true,
|
|
@@ -6672,7 +6700,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6672
6700
|
if (needFullChildrenNormalization) {
|
|
6673
6701
|
normalizeChildren(vnode, children);
|
|
6674
6702
|
// normalize suspense children
|
|
6675
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6703
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6676
6704
|
type.normalize(vnode);
|
|
6677
6705
|
}
|
|
6678
6706
|
}
|
|
@@ -6680,8 +6708,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6680
6708
|
// compiled element vnode - if children is passed, only possible types are
|
|
6681
6709
|
// string or Array.
|
|
6682
6710
|
vnode.shapeFlag |= isString(children)
|
|
6683
|
-
? 8 /* TEXT_CHILDREN */
|
|
6684
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
6711
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
6712
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6685
6713
|
}
|
|
6686
6714
|
// validate key
|
|
6687
6715
|
if ((process.env.NODE_ENV !== 'production') && vnode.key !== vnode.key) {
|
|
@@ -6697,10 +6725,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6697
6725
|
// component nodes also should always be patched, because even if the
|
|
6698
6726
|
// component doesn't need to update, it needs to persist the instance on to
|
|
6699
6727
|
// the next vnode so that it can be properly unmounted later.
|
|
6700
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
6728
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
6701
6729
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
6702
6730
|
// vnode should not be considered dynamic due to handler caching.
|
|
6703
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
6731
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
6704
6732
|
currentBlock.push(vnode);
|
|
6705
6733
|
}
|
|
6706
6734
|
return vnode;
|
|
@@ -6722,14 +6750,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6722
6750
|
normalizeChildren(cloned, children);
|
|
6723
6751
|
}
|
|
6724
6752
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
6725
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
6753
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6726
6754
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
6727
6755
|
}
|
|
6728
6756
|
else {
|
|
6729
6757
|
currentBlock.push(cloned);
|
|
6730
6758
|
}
|
|
6731
6759
|
}
|
|
6732
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
6760
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
6733
6761
|
return cloned;
|
|
6734
6762
|
}
|
|
6735
6763
|
// class component normalization.
|
|
@@ -6755,17 +6783,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6755
6783
|
}
|
|
6756
6784
|
// encode the vnode type information into a bitmap
|
|
6757
6785
|
const shapeFlag = isString(type)
|
|
6758
|
-
? 1 /* ELEMENT */
|
|
6786
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
6759
6787
|
: isSuspense(type)
|
|
6760
|
-
? 128 /* SUSPENSE */
|
|
6788
|
+
? 128 /* ShapeFlags.SUSPENSE */
|
|
6761
6789
|
: isTeleport(type)
|
|
6762
|
-
? 64 /* TELEPORT */
|
|
6790
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
6763
6791
|
: isObject(type)
|
|
6764
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
6792
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
6765
6793
|
: isFunction(type)
|
|
6766
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
6794
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
6767
6795
|
: 0;
|
|
6768
|
-
if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
6796
|
+
if ((process.env.NODE_ENV !== 'production') && shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */ && isProxy(type)) {
|
|
6769
6797
|
type = toRaw(type);
|
|
6770
6798
|
warn(`Vue received a Component which was made a reactive object. This can ` +
|
|
6771
6799
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
@@ -6804,7 +6832,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6804
6832
|
: ref,
|
|
6805
6833
|
scopeId: vnode.scopeId,
|
|
6806
6834
|
slotScopeIds: vnode.slotScopeIds,
|
|
6807
|
-
children: (process.env.NODE_ENV !== 'production') && patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
6835
|
+
children: (process.env.NODE_ENV !== 'production') && patchFlag === -1 /* PatchFlags.HOISTED */ && isArray(children)
|
|
6808
6836
|
? children.map(deepCloneVNode)
|
|
6809
6837
|
: children,
|
|
6810
6838
|
target: vnode.target,
|
|
@@ -6817,8 +6845,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6817
6845
|
// fast paths only.
|
|
6818
6846
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
6819
6847
|
? patchFlag === -1 // hoisted node
|
|
6820
|
-
? 16 /* FULL_PROPS */
|
|
6821
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
6848
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
6849
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
6822
6850
|
: patchFlag,
|
|
6823
6851
|
dynamicProps: vnode.dynamicProps,
|
|
6824
6852
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -6908,10 +6936,10 @@ function normalizeChildren(vnode, children) {
|
|
|
6908
6936
|
children = null;
|
|
6909
6937
|
}
|
|
6910
6938
|
else if (isArray(children)) {
|
|
6911
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6939
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6912
6940
|
}
|
|
6913
6941
|
else if (typeof children === 'object') {
|
|
6914
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
6942
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
6915
6943
|
// Normalize slot to plain children for plain element and Teleport
|
|
6916
6944
|
const slot = children.default;
|
|
6917
6945
|
if (slot) {
|
|
@@ -6923,37 +6951,37 @@ function normalizeChildren(vnode, children) {
|
|
|
6923
6951
|
return;
|
|
6924
6952
|
}
|
|
6925
6953
|
else {
|
|
6926
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6954
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6927
6955
|
const slotFlag = children._;
|
|
6928
6956
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
6929
6957
|
children._ctx = currentRenderingInstance;
|
|
6930
6958
|
}
|
|
6931
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
6959
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
6932
6960
|
// a child component receives forwarded slots from the parent.
|
|
6933
6961
|
// its slot type is determined by its parent's slot type.
|
|
6934
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
6935
|
-
children._ = 1 /* STABLE */;
|
|
6962
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
6963
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
6936
6964
|
}
|
|
6937
6965
|
else {
|
|
6938
|
-
children._ = 2 /* DYNAMIC */;
|
|
6939
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
6966
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
6967
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
6940
6968
|
}
|
|
6941
6969
|
}
|
|
6942
6970
|
}
|
|
6943
6971
|
}
|
|
6944
6972
|
else if (isFunction(children)) {
|
|
6945
6973
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
6946
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6974
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6947
6975
|
}
|
|
6948
6976
|
else {
|
|
6949
6977
|
children = String(children);
|
|
6950
6978
|
// force teleport children to array so it can be moved around
|
|
6951
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6952
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6979
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6980
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6953
6981
|
children = [createTextVNode(children)];
|
|
6954
6982
|
}
|
|
6955
6983
|
else {
|
|
6956
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
6984
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
6957
6985
|
}
|
|
6958
6986
|
}
|
|
6959
6987
|
vnode.children = children;
|
|
@@ -6991,7 +7019,7 @@ function mergeProps(...args) {
|
|
|
6991
7019
|
return ret;
|
|
6992
7020
|
}
|
|
6993
7021
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
6994
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7022
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
|
|
6995
7023
|
vnode,
|
|
6996
7024
|
prevVNode
|
|
6997
7025
|
]);
|
|
@@ -7102,7 +7130,7 @@ function validateComponentName(name, config) {
|
|
|
7102
7130
|
}
|
|
7103
7131
|
}
|
|
7104
7132
|
function isStatefulComponent(instance) {
|
|
7105
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
7133
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
7106
7134
|
}
|
|
7107
7135
|
let isInSSRComponentSetup = false;
|
|
7108
7136
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -7157,7 +7185,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7157
7185
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
7158
7186
|
setCurrentInstance(instance);
|
|
7159
7187
|
pauseTracking();
|
|
7160
|
-
const setupResult = callWithErrorHandling(setup, instance, 0 /* SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
|
|
7188
|
+
const setupResult = callWithErrorHandling(setup, instance, 0 /* ErrorCodes.SETUP_FUNCTION */, [(process.env.NODE_ENV !== 'production') ? shallowReadonly(instance.props) : instance.props, setupContext]);
|
|
7161
7189
|
resetTracking();
|
|
7162
7190
|
unsetCurrentInstance();
|
|
7163
7191
|
if (isPromise(setupResult)) {
|
|
@@ -7169,7 +7197,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7169
7197
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
7170
7198
|
})
|
|
7171
7199
|
.catch(e => {
|
|
7172
|
-
handleError(e, instance, 0 /* SETUP_FUNCTION */);
|
|
7200
|
+
handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
7173
7201
|
});
|
|
7174
7202
|
}
|
|
7175
7203
|
else {
|
|
@@ -7249,7 +7277,8 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
7249
7277
|
// only do on-the-fly compile if not in SSR - SSR on-the-fly compilation
|
|
7250
7278
|
// is done by server-renderer
|
|
7251
7279
|
if (!isSSR && compile && !Component.render) {
|
|
7252
|
-
const template = Component.template
|
|
7280
|
+
const template = Component.template ||
|
|
7281
|
+
resolveMergedOptions(instance).template;
|
|
7253
7282
|
if (template) {
|
|
7254
7283
|
if ((process.env.NODE_ENV !== 'production')) {
|
|
7255
7284
|
startMeasure(instance, `compile`);
|
|
@@ -7302,7 +7331,7 @@ function createAttrsProxy(instance) {
|
|
|
7302
7331
|
? {
|
|
7303
7332
|
get(target, key) {
|
|
7304
7333
|
markAttrsAccessed();
|
|
7305
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
7334
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
7306
7335
|
return target[key];
|
|
7307
7336
|
},
|
|
7308
7337
|
set() {
|
|
@@ -7316,7 +7345,7 @@ function createAttrsProxy(instance) {
|
|
|
7316
7345
|
}
|
|
7317
7346
|
: {
|
|
7318
7347
|
get(target, key) {
|
|
7319
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
7348
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
7320
7349
|
return target[key];
|
|
7321
7350
|
}
|
|
7322
7351
|
});
|
|
@@ -7373,10 +7402,10 @@ function getExposeProxy(instance) {
|
|
|
7373
7402
|
}
|
|
7374
7403
|
const classifyRE = /(?:^|[-_])(\w)/g;
|
|
7375
7404
|
const classify = (str) => str.replace(classifyRE, c => c.toUpperCase()).replace(/[-_]/g, '');
|
|
7376
|
-
function getComponentName(Component) {
|
|
7405
|
+
function getComponentName(Component, includeInferred = true) {
|
|
7377
7406
|
return isFunction(Component)
|
|
7378
7407
|
? Component.displayName || Component.name
|
|
7379
|
-
: Component.name;
|
|
7408
|
+
: Component.name || (includeInferred && Component.__name);
|
|
7380
7409
|
}
|
|
7381
7410
|
/* istanbul ignore next */
|
|
7382
7411
|
function formatComponentName(instance, Component, isRoot = false) {
|
|
@@ -7604,7 +7633,7 @@ const useSSRContext = () => {
|
|
|
7604
7633
|
};
|
|
7605
7634
|
|
|
7606
7635
|
function isShallow(value) {
|
|
7607
|
-
return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
|
|
7636
|
+
return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
|
|
7608
7637
|
}
|
|
7609
7638
|
|
|
7610
7639
|
function initCustomFormatter() {
|
|
@@ -7824,7 +7853,7 @@ function isMemoSame(cached, memo) {
|
|
|
7824
7853
|
}
|
|
7825
7854
|
|
|
7826
7855
|
// Core API ------------------------------------------------------------------
|
|
7827
|
-
const version = "3.2.
|
|
7856
|
+
const version = "3.2.39";
|
|
7828
7857
|
const _ssrUtils = {
|
|
7829
7858
|
createComponentInstance,
|
|
7830
7859
|
setupComponent,
|
|
@@ -7834,7 +7863,7 @@ const _ssrUtils = {
|
|
|
7834
7863
|
normalizeVNode
|
|
7835
7864
|
};
|
|
7836
7865
|
/**
|
|
7837
|
-
* SSR utils for \@vue/server-renderer. Only exposed in
|
|
7866
|
+
* SSR utils for \@vue/server-renderer. Only exposed in ssr-possible builds.
|
|
7838
7867
|
* @internal
|
|
7839
7868
|
*/
|
|
7840
7869
|
const ssrUtils = (_ssrUtils );
|