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