@vue/runtime-core 3.2.37 → 3.2.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-core.cjs.js +316 -293
- package/dist/runtime-core.cjs.prod.js +255 -238
- package/dist/runtime-core.d.ts +6 -4
- package/dist/runtime-core.esm-bundler.js +320 -299
- package/package.json +3 -3
|
@@ -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,
|
|
@@ -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);
|
|
@@ -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.
|
|
@@ -4577,14 +4597,14 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4577
4597
|
const { type, ref, shapeFlag, patchFlag } = vnode;
|
|
4578
4598
|
const domType = node.nodeType;
|
|
4579
4599
|
vnode.el = node;
|
|
4580
|
-
if (patchFlag === -2 /* BAIL */) {
|
|
4600
|
+
if (patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
4581
4601
|
optimized = false;
|
|
4582
4602
|
vnode.dynamicChildren = null;
|
|
4583
4603
|
}
|
|
4584
4604
|
let nextNode = null;
|
|
4585
4605
|
switch (type) {
|
|
4586
4606
|
case Text:
|
|
4587
|
-
if (domType !== 3 /* TEXT */) {
|
|
4607
|
+
if (domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
4588
4608
|
// #5728 empty text node inside a slot can cause hydration failure
|
|
4589
4609
|
// because the server rendered HTML won't contain a text node
|
|
4590
4610
|
if (vnode.children === '') {
|
|
@@ -4608,7 +4628,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4608
4628
|
}
|
|
4609
4629
|
break;
|
|
4610
4630
|
case Comment:
|
|
4611
|
-
if (domType !== 8 /* COMMENT */ || isFragmentStart) {
|
|
4631
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */ || isFragmentStart) {
|
|
4612
4632
|
nextNode = onMismatch();
|
|
4613
4633
|
}
|
|
4614
4634
|
else {
|
|
@@ -4616,7 +4636,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4616
4636
|
}
|
|
4617
4637
|
break;
|
|
4618
4638
|
case Static:
|
|
4619
|
-
if (domType !== 1 /* ELEMENT */ && domType !== 3 /* TEXT */) {
|
|
4639
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ && domType !== 3 /* DOMNodeTypes.TEXT */) {
|
|
4620
4640
|
nextNode = onMismatch();
|
|
4621
4641
|
}
|
|
4622
4642
|
else {
|
|
@@ -4628,7 +4648,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4628
4648
|
for (let i = 0; i < vnode.staticCount; i++) {
|
|
4629
4649
|
if (needToAdoptContent)
|
|
4630
4650
|
vnode.children +=
|
|
4631
|
-
nextNode.nodeType === 1 /* ELEMENT */
|
|
4651
|
+
nextNode.nodeType === 1 /* DOMNodeTypes.ELEMENT */
|
|
4632
4652
|
? nextNode.outerHTML
|
|
4633
4653
|
: nextNode.data;
|
|
4634
4654
|
if (i === vnode.staticCount - 1) {
|
|
@@ -4648,8 +4668,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4648
4668
|
}
|
|
4649
4669
|
break;
|
|
4650
4670
|
default:
|
|
4651
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
4652
|
-
if (domType !== 1 /* ELEMENT */ ||
|
|
4671
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
4672
|
+
if (domType !== 1 /* DOMNodeTypes.ELEMENT */ ||
|
|
4653
4673
|
vnode.type.toLowerCase() !==
|
|
4654
4674
|
node.tagName.toLowerCase()) {
|
|
4655
4675
|
nextNode = onMismatch();
|
|
@@ -4658,7 +4678,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4658
4678
|
nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
4659
4679
|
}
|
|
4660
4680
|
}
|
|
4661
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
4681
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
4662
4682
|
// when setting up the render effect, if the initial vnode already
|
|
4663
4683
|
// has .el set, the component will perform hydration instead of mount
|
|
4664
4684
|
// on its sub-tree.
|
|
@@ -4697,15 +4717,15 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4697
4717
|
vnode.component.subTree = subTree;
|
|
4698
4718
|
}
|
|
4699
4719
|
}
|
|
4700
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
4701
|
-
if (domType !== 8 /* COMMENT */) {
|
|
4720
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
4721
|
+
if (domType !== 8 /* DOMNodeTypes.COMMENT */) {
|
|
4702
4722
|
nextNode = onMismatch();
|
|
4703
4723
|
}
|
|
4704
4724
|
else {
|
|
4705
4725
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
4706
4726
|
}
|
|
4707
4727
|
}
|
|
4708
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
4728
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
4709
4729
|
nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, isSVGContainer(parentNode(node)), slotScopeIds, optimized, rendererInternals, hydrateNode);
|
|
4710
4730
|
}
|
|
4711
4731
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -4725,7 +4745,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4725
4745
|
const forcePatchValue = (type === 'input' && dirs) || type === 'option';
|
|
4726
4746
|
// skip props & children if this is hoisted static nodes
|
|
4727
4747
|
// #5405 in dev, always hydrate children for HMR
|
|
4728
|
-
if ((process.env.NODE_ENV !== 'production') || forcePatchValue || patchFlag !== -1 /* HOISTED */) {
|
|
4748
|
+
if ((process.env.NODE_ENV !== 'production') || forcePatchValue || patchFlag !== -1 /* PatchFlags.HOISTED */) {
|
|
4729
4749
|
if (dirs) {
|
|
4730
4750
|
invokeDirectiveHook(vnode, null, parentComponent, 'created');
|
|
4731
4751
|
}
|
|
@@ -4733,7 +4753,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4733
4753
|
if (props) {
|
|
4734
4754
|
if (forcePatchValue ||
|
|
4735
4755
|
!optimized ||
|
|
4736
|
-
patchFlag & (16 /* FULL_PROPS */ | 32 /* HYDRATE_EVENTS */)) {
|
|
4756
|
+
patchFlag & (16 /* PatchFlags.FULL_PROPS */ | 32 /* PatchFlags.HYDRATE_EVENTS */)) {
|
|
4737
4757
|
for (const key in props) {
|
|
4738
4758
|
if ((forcePatchValue && key.endsWith('value')) ||
|
|
4739
4759
|
(isOn(key) && !isReservedProp(key))) {
|
|
@@ -4762,7 +4782,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4762
4782
|
}, parentSuspense);
|
|
4763
4783
|
}
|
|
4764
4784
|
// children
|
|
4765
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */ &&
|
|
4785
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */ &&
|
|
4766
4786
|
// skip if element has innerHTML / textContent
|
|
4767
4787
|
!(props && (props.innerHTML || props.textContent))) {
|
|
4768
4788
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -4780,7 +4800,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4780
4800
|
remove(cur);
|
|
4781
4801
|
}
|
|
4782
4802
|
}
|
|
4783
|
-
else if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
4803
|
+
else if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
4784
4804
|
if (el.textContent !== vnode.children) {
|
|
4785
4805
|
hasMismatch = true;
|
|
4786
4806
|
(process.env.NODE_ENV !== 'production') &&
|
|
@@ -4845,7 +4865,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
4845
4865
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
4846
4866
|
hasMismatch = true;
|
|
4847
4867
|
(process.env.NODE_ENV !== 'production') &&
|
|
4848
|
-
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 */
|
|
4849
4869
|
? `(text)`
|
|
4850
4870
|
: isComment(node) && node.data === '['
|
|
4851
4871
|
? `(start of fragment)`
|
|
@@ -5007,7 +5027,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5007
5027
|
unmount(n1, parentComponent, parentSuspense, true);
|
|
5008
5028
|
n1 = null;
|
|
5009
5029
|
}
|
|
5010
|
-
if (n2.patchFlag === -2 /* BAIL */) {
|
|
5030
|
+
if (n2.patchFlag === -2 /* PatchFlags.BAIL */) {
|
|
5011
5031
|
optimized = false;
|
|
5012
5032
|
n2.dynamicChildren = null;
|
|
5013
5033
|
}
|
|
@@ -5031,16 +5051,16 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5031
5051
|
processFragment(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5032
5052
|
break;
|
|
5033
5053
|
default:
|
|
5034
|
-
if (shapeFlag & 1 /* ELEMENT */) {
|
|
5054
|
+
if (shapeFlag & 1 /* ShapeFlags.ELEMENT */) {
|
|
5035
5055
|
processElement(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5036
5056
|
}
|
|
5037
|
-
else if (shapeFlag & 6 /* COMPONENT */) {
|
|
5057
|
+
else if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5038
5058
|
processComponent(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5039
5059
|
}
|
|
5040
|
-
else if (shapeFlag & 64 /* TELEPORT */) {
|
|
5060
|
+
else if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5041
5061
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
5042
5062
|
}
|
|
5043
|
-
else if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5063
|
+
else if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5044
5064
|
type.process(n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized, internals);
|
|
5045
5065
|
}
|
|
5046
5066
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
@@ -5125,7 +5145,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5125
5145
|
if (!(process.env.NODE_ENV !== 'production') &&
|
|
5126
5146
|
vnode.el &&
|
|
5127
5147
|
hostCloneNode !== undefined &&
|
|
5128
|
-
patchFlag === -1 /* HOISTED */) {
|
|
5148
|
+
patchFlag === -1 /* PatchFlags.HOISTED */) {
|
|
5129
5149
|
// If a vnode has non-null el, it means it's being reused.
|
|
5130
5150
|
// Only static vnodes can be reused, so its mounted DOM nodes should be
|
|
5131
5151
|
// exactly the same, and we can simply do a clone here.
|
|
@@ -5136,10 +5156,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5136
5156
|
el = vnode.el = hostCreateElement(vnode.type, isSVG, props && props.is, props);
|
|
5137
5157
|
// mount children first, since some props may rely on child content
|
|
5138
5158
|
// being already rendered, e.g. `<select value>`
|
|
5139
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5159
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5140
5160
|
hostSetElementText(el, vnode.children);
|
|
5141
5161
|
}
|
|
5142
|
-
else if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5162
|
+
else if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5143
5163
|
mountChildren(vnode.children, el, null, parentComponent, parentSuspense, isSVG && type !== 'foreignObject', slotScopeIds, optimized);
|
|
5144
5164
|
}
|
|
5145
5165
|
if (dirs) {
|
|
@@ -5216,7 +5236,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5216
5236
|
let subTree = parentComponent.subTree;
|
|
5217
5237
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
5218
5238
|
subTree.patchFlag > 0 &&
|
|
5219
|
-
subTree.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */) {
|
|
5239
|
+
subTree.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */) {
|
|
5220
5240
|
subTree =
|
|
5221
5241
|
filterSingleRoot(subTree.children) || subTree;
|
|
5222
5242
|
}
|
|
@@ -5239,7 +5259,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5239
5259
|
let { patchFlag, dynamicChildren, dirs } = n2;
|
|
5240
5260
|
// #1426 take the old vnode's patch flag into account since user may clone a
|
|
5241
5261
|
// compiler-generated vnode, which de-opts to FULL_PROPS
|
|
5242
|
-
patchFlag |= n1.patchFlag & 16 /* FULL_PROPS */;
|
|
5262
|
+
patchFlag |= n1.patchFlag & 16 /* PatchFlags.FULL_PROPS */;
|
|
5243
5263
|
const oldProps = n1.props || EMPTY_OBJ;
|
|
5244
5264
|
const newProps = n2.props || EMPTY_OBJ;
|
|
5245
5265
|
let vnodeHook;
|
|
@@ -5274,21 +5294,21 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5274
5294
|
// generated by the compiler and can take the fast path.
|
|
5275
5295
|
// in this path old node and new node are guaranteed to have the same shape
|
|
5276
5296
|
// (i.e. at the exact same position in the source template)
|
|
5277
|
-
if (patchFlag & 16 /* FULL_PROPS */) {
|
|
5297
|
+
if (patchFlag & 16 /* PatchFlags.FULL_PROPS */) {
|
|
5278
5298
|
// element props contain dynamic keys, full diff needed
|
|
5279
5299
|
patchProps(el, n2, oldProps, newProps, parentComponent, parentSuspense, isSVG);
|
|
5280
5300
|
}
|
|
5281
5301
|
else {
|
|
5282
5302
|
// class
|
|
5283
5303
|
// this flag is matched when the element has dynamic class bindings.
|
|
5284
|
-
if (patchFlag & 2 /* CLASS */) {
|
|
5304
|
+
if (patchFlag & 2 /* PatchFlags.CLASS */) {
|
|
5285
5305
|
if (oldProps.class !== newProps.class) {
|
|
5286
5306
|
hostPatchProp(el, 'class', null, newProps.class, isSVG);
|
|
5287
5307
|
}
|
|
5288
5308
|
}
|
|
5289
5309
|
// style
|
|
5290
5310
|
// this flag is matched when the element has dynamic style bindings
|
|
5291
|
-
if (patchFlag & 4 /* STYLE */) {
|
|
5311
|
+
if (patchFlag & 4 /* PatchFlags.STYLE */) {
|
|
5292
5312
|
hostPatchProp(el, 'style', oldProps.style, newProps.style, isSVG);
|
|
5293
5313
|
}
|
|
5294
5314
|
// props
|
|
@@ -5297,7 +5317,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5297
5317
|
// faster iteration.
|
|
5298
5318
|
// Note dynamic keys like :[foo]="bar" will cause this optimization to
|
|
5299
5319
|
// bail out and go through a full diff because we need to unset the old key
|
|
5300
|
-
if (patchFlag & 8 /* PROPS */) {
|
|
5320
|
+
if (patchFlag & 8 /* PatchFlags.PROPS */) {
|
|
5301
5321
|
// if the flag is present then dynamicProps must be non-null
|
|
5302
5322
|
const propsToUpdate = n2.dynamicProps;
|
|
5303
5323
|
for (let i = 0; i < propsToUpdate.length; i++) {
|
|
@@ -5313,7 +5333,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5313
5333
|
}
|
|
5314
5334
|
// text
|
|
5315
5335
|
// This flag is matched when the element has only dynamic text children.
|
|
5316
|
-
if (patchFlag & 1 /* TEXT */) {
|
|
5336
|
+
if (patchFlag & 1 /* PatchFlags.TEXT */) {
|
|
5317
5337
|
if (n1.children !== n2.children) {
|
|
5318
5338
|
hostSetElementText(el, n2.children);
|
|
5319
5339
|
}
|
|
@@ -5347,7 +5367,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5347
5367
|
// which also requires the correct parent container
|
|
5348
5368
|
!isSameVNodeType(oldVNode, newVNode) ||
|
|
5349
5369
|
// - In the case of a component, it could contain anything.
|
|
5350
|
-
oldVNode.shapeFlag & (6 /* COMPONENT */ | 64 /* TELEPORT */))
|
|
5370
|
+
oldVNode.shapeFlag & (6 /* ShapeFlags.COMPONENT */ | 64 /* ShapeFlags.TELEPORT */))
|
|
5351
5371
|
? hostParentNode(oldVNode.el)
|
|
5352
5372
|
: // In other cases, the parent container is not actually used so we
|
|
5353
5373
|
// just pass the block element here to avoid a DOM parentNode call.
|
|
@@ -5386,7 +5406,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5386
5406
|
let { patchFlag, dynamicChildren, slotScopeIds: fragmentSlotScopeIds } = n2;
|
|
5387
5407
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
5388
5408
|
// #5523 dev root fragment may inherit directives
|
|
5389
|
-
(isHmrUpdating || patchFlag & 2048 /* DEV_ROOT_FRAGMENT */)) {
|
|
5409
|
+
(isHmrUpdating || patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */)) {
|
|
5390
5410
|
// HMR updated / Dev root fragment (w/ comments), force full diff
|
|
5391
5411
|
patchFlag = 0;
|
|
5392
5412
|
optimized = false;
|
|
@@ -5408,7 +5428,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5408
5428
|
}
|
|
5409
5429
|
else {
|
|
5410
5430
|
if (patchFlag > 0 &&
|
|
5411
|
-
patchFlag & 64 /* STABLE_FRAGMENT */ &&
|
|
5431
|
+
patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */ &&
|
|
5412
5432
|
dynamicChildren &&
|
|
5413
5433
|
// #2715 the previous fragment could've been a BAILed one as a result
|
|
5414
5434
|
// of renderSlot() with no valid children
|
|
@@ -5441,7 +5461,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5441
5461
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized) => {
|
|
5442
5462
|
n2.slotScopeIds = slotScopeIds;
|
|
5443
5463
|
if (n1 == null) {
|
|
5444
|
-
if (n2.shapeFlag & 512 /* COMPONENT_KEPT_ALIVE */) {
|
|
5464
|
+
if (n2.shapeFlag & 512 /* ShapeFlags.COMPONENT_KEPT_ALIVE */) {
|
|
5445
5465
|
parentComponent.ctx.activate(n2, container, anchor, isSVG, optimized);
|
|
5446
5466
|
}
|
|
5447
5467
|
else {
|
|
@@ -5603,10 +5623,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5603
5623
|
// activated hook for keep-alive roots.
|
|
5604
5624
|
// #1742 activated hook must be accessed after first render
|
|
5605
5625
|
// since the hook may be injected by a child keep-alive
|
|
5606
|
-
if (initialVNode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5626
|
+
if (initialVNode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */ ||
|
|
5607
5627
|
(parent &&
|
|
5608
5628
|
isAsyncWrapper(parent.vnode) &&
|
|
5609
|
-
parent.vnode.shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5629
|
+
parent.vnode.shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */)) {
|
|
5610
5630
|
instance.a && queuePostRenderEffect(instance.a, parentSuspense);
|
|
5611
5631
|
}
|
|
5612
5632
|
instance.isMounted = true;
|
|
@@ -5717,7 +5737,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5717
5737
|
pauseTracking();
|
|
5718
5738
|
// props update may have triggered pre-flush watchers.
|
|
5719
5739
|
// flush them before the render update.
|
|
5720
|
-
flushPreFlushCbs(
|
|
5740
|
+
flushPreFlushCbs();
|
|
5721
5741
|
resetTracking();
|
|
5722
5742
|
};
|
|
5723
5743
|
const patchChildren = (n1, n2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized = false) => {
|
|
@@ -5727,22 +5747,22 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5727
5747
|
const { patchFlag, shapeFlag } = n2;
|
|
5728
5748
|
// fast path
|
|
5729
5749
|
if (patchFlag > 0) {
|
|
5730
|
-
if (patchFlag & 128 /* KEYED_FRAGMENT */) {
|
|
5750
|
+
if (patchFlag & 128 /* PatchFlags.KEYED_FRAGMENT */) {
|
|
5731
5751
|
// this could be either fully-keyed or mixed (some keyed some not)
|
|
5732
5752
|
// presence of patchFlag means children are guaranteed to be arrays
|
|
5733
5753
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5734
5754
|
return;
|
|
5735
5755
|
}
|
|
5736
|
-
else if (patchFlag & 256 /* UNKEYED_FRAGMENT */) {
|
|
5756
|
+
else if (patchFlag & 256 /* PatchFlags.UNKEYED_FRAGMENT */) {
|
|
5737
5757
|
// unkeyed
|
|
5738
5758
|
patchUnkeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5739
5759
|
return;
|
|
5740
5760
|
}
|
|
5741
5761
|
}
|
|
5742
5762
|
// children has 3 possibilities: text, array or no children.
|
|
5743
|
-
if (shapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5763
|
+
if (shapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5744
5764
|
// text children fast path
|
|
5745
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5765
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5746
5766
|
unmountChildren(c1, parentComponent, parentSuspense);
|
|
5747
5767
|
}
|
|
5748
5768
|
if (c2 !== c1) {
|
|
@@ -5750,9 +5770,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5750
5770
|
}
|
|
5751
5771
|
}
|
|
5752
5772
|
else {
|
|
5753
|
-
if (prevShapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5773
|
+
if (prevShapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5754
5774
|
// prev children was array
|
|
5755
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5775
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5756
5776
|
// two arrays, cannot assume anything, do full diff
|
|
5757
5777
|
patchKeyedChildren(c1, c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5758
5778
|
}
|
|
@@ -5764,11 +5784,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5764
5784
|
else {
|
|
5765
5785
|
// prev children was text OR null
|
|
5766
5786
|
// new children is array OR null
|
|
5767
|
-
if (prevShapeFlag & 8 /* TEXT_CHILDREN */) {
|
|
5787
|
+
if (prevShapeFlag & 8 /* ShapeFlags.TEXT_CHILDREN */) {
|
|
5768
5788
|
hostSetElementText(container, '');
|
|
5769
5789
|
}
|
|
5770
5790
|
// mount new if array
|
|
5771
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
5791
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
5772
5792
|
mountChildren(c2, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
5773
5793
|
}
|
|
5774
5794
|
}
|
|
@@ -5959,7 +5979,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5959
5979
|
// There is no stable subsequence (e.g. a reverse)
|
|
5960
5980
|
// OR current node is not among the stable sequence
|
|
5961
5981
|
if (j < 0 || i !== increasingNewIndexSequence[j]) {
|
|
5962
|
-
move(nextChild, container, anchor, 2 /* REORDER */);
|
|
5982
|
+
move(nextChild, container, anchor, 2 /* MoveType.REORDER */);
|
|
5963
5983
|
}
|
|
5964
5984
|
else {
|
|
5965
5985
|
j--;
|
|
@@ -5970,15 +5990,15 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5970
5990
|
};
|
|
5971
5991
|
const move = (vnode, container, anchor, moveType, parentSuspense = null) => {
|
|
5972
5992
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
5973
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
5993
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
5974
5994
|
move(vnode.component.subTree, container, anchor, moveType);
|
|
5975
5995
|
return;
|
|
5976
5996
|
}
|
|
5977
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
5997
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
5978
5998
|
vnode.suspense.move(container, anchor, moveType);
|
|
5979
5999
|
return;
|
|
5980
6000
|
}
|
|
5981
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6001
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
5982
6002
|
type.move(vnode, container, anchor, internals);
|
|
5983
6003
|
return;
|
|
5984
6004
|
}
|
|
@@ -5995,11 +6015,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
5995
6015
|
return;
|
|
5996
6016
|
}
|
|
5997
6017
|
// single nodes
|
|
5998
|
-
const needTransition = moveType !== 2 /* REORDER */ &&
|
|
5999
|
-
shapeFlag & 1 /* ELEMENT */ &&
|
|
6018
|
+
const needTransition = moveType !== 2 /* MoveType.REORDER */ &&
|
|
6019
|
+
shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
6000
6020
|
transition;
|
|
6001
6021
|
if (needTransition) {
|
|
6002
|
-
if (moveType === 0 /* ENTER */) {
|
|
6022
|
+
if (moveType === 0 /* MoveType.ENTER */) {
|
|
6003
6023
|
transition.beforeEnter(el);
|
|
6004
6024
|
hostInsert(el, container, anchor);
|
|
6005
6025
|
queuePostRenderEffect(() => transition.enter(el), parentSuspense);
|
|
@@ -6031,42 +6051,42 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6031
6051
|
if (ref != null) {
|
|
6032
6052
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
6033
6053
|
}
|
|
6034
|
-
if (shapeFlag & 256 /* COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
6054
|
+
if (shapeFlag & 256 /* ShapeFlags.COMPONENT_SHOULD_KEEP_ALIVE */) {
|
|
6035
6055
|
parentComponent.ctx.deactivate(vnode);
|
|
6036
6056
|
return;
|
|
6037
6057
|
}
|
|
6038
|
-
const shouldInvokeDirs = shapeFlag & 1 /* ELEMENT */ && dirs;
|
|
6058
|
+
const shouldInvokeDirs = shapeFlag & 1 /* ShapeFlags.ELEMENT */ && dirs;
|
|
6039
6059
|
const shouldInvokeVnodeHook = !isAsyncWrapper(vnode);
|
|
6040
6060
|
let vnodeHook;
|
|
6041
6061
|
if (shouldInvokeVnodeHook &&
|
|
6042
6062
|
(vnodeHook = props && props.onVnodeBeforeUnmount)) {
|
|
6043
6063
|
invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
6044
6064
|
}
|
|
6045
|
-
if (shapeFlag & 6 /* COMPONENT */) {
|
|
6065
|
+
if (shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6046
6066
|
unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
6047
6067
|
}
|
|
6048
6068
|
else {
|
|
6049
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6069
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6050
6070
|
vnode.suspense.unmount(parentSuspense, doRemove);
|
|
6051
6071
|
return;
|
|
6052
6072
|
}
|
|
6053
6073
|
if (shouldInvokeDirs) {
|
|
6054
6074
|
invokeDirectiveHook(vnode, null, parentComponent, 'beforeUnmount');
|
|
6055
6075
|
}
|
|
6056
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6076
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6057
6077
|
vnode.type.remove(vnode, parentComponent, parentSuspense, optimized, internals, doRemove);
|
|
6058
6078
|
}
|
|
6059
6079
|
else if (dynamicChildren &&
|
|
6060
6080
|
// #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
6061
6081
|
(type !== Fragment ||
|
|
6062
|
-
(patchFlag > 0 && patchFlag & 64 /* STABLE_FRAGMENT */))) {
|
|
6082
|
+
(patchFlag > 0 && patchFlag & 64 /* PatchFlags.STABLE_FRAGMENT */))) {
|
|
6063
6083
|
// fast path for block nodes: only need to unmount dynamic children.
|
|
6064
6084
|
unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
6065
6085
|
}
|
|
6066
6086
|
else if ((type === Fragment &&
|
|
6067
6087
|
patchFlag &
|
|
6068
|
-
(128 /* KEYED_FRAGMENT */ | 256 /* UNKEYED_FRAGMENT */)) ||
|
|
6069
|
-
(!optimized && shapeFlag & 16 /* ARRAY_CHILDREN */)) {
|
|
6088
|
+
(128 /* PatchFlags.KEYED_FRAGMENT */ | 256 /* PatchFlags.UNKEYED_FRAGMENT */)) ||
|
|
6089
|
+
(!optimized && shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */)) {
|
|
6070
6090
|
unmountChildren(children, parentComponent, parentSuspense);
|
|
6071
6091
|
}
|
|
6072
6092
|
if (doRemove) {
|
|
@@ -6088,7 +6108,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6088
6108
|
if (type === Fragment) {
|
|
6089
6109
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
6090
6110
|
vnode.patchFlag > 0 &&
|
|
6091
|
-
vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
|
|
6111
|
+
vnode.patchFlag & 2048 /* PatchFlags.DEV_ROOT_FRAGMENT */ &&
|
|
6092
6112
|
transition &&
|
|
6093
6113
|
!transition.persisted) {
|
|
6094
6114
|
vnode.children.forEach(child => {
|
|
@@ -6115,7 +6135,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6115
6135
|
transition.afterLeave();
|
|
6116
6136
|
}
|
|
6117
6137
|
};
|
|
6118
|
-
if (vnode.shapeFlag & 1 /* ELEMENT */ &&
|
|
6138
|
+
if (vnode.shapeFlag & 1 /* ShapeFlags.ELEMENT */ &&
|
|
6119
6139
|
transition &&
|
|
6120
6140
|
!transition.persisted) {
|
|
6121
6141
|
const { leave, delayLeave } = transition;
|
|
@@ -6191,10 +6211,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6191
6211
|
}
|
|
6192
6212
|
};
|
|
6193
6213
|
const getNextHostNode = vnode => {
|
|
6194
|
-
if (vnode.shapeFlag & 6 /* COMPONENT */) {
|
|
6214
|
+
if (vnode.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6195
6215
|
return getNextHostNode(vnode.component.subTree);
|
|
6196
6216
|
}
|
|
6197
|
-
if (vnode.shapeFlag & 128 /* SUSPENSE */) {
|
|
6217
|
+
if (vnode.shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6198
6218
|
return vnode.suspense.next();
|
|
6199
6219
|
}
|
|
6200
6220
|
return hostNextSibling((vnode.anchor || vnode.el));
|
|
@@ -6208,6 +6228,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
6208
6228
|
else {
|
|
6209
6229
|
patch(container._vnode || null, vnode, container, null, null, null, isSVG);
|
|
6210
6230
|
}
|
|
6231
|
+
flushPreFlushCbs();
|
|
6211
6232
|
flushPostFlushCbs();
|
|
6212
6233
|
container._vnode = vnode;
|
|
6213
6234
|
};
|
|
@@ -6257,8 +6278,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
|
|
|
6257
6278
|
// guaranteed to be vnodes
|
|
6258
6279
|
const c1 = ch1[i];
|
|
6259
6280
|
let c2 = ch2[i];
|
|
6260
|
-
if (c2.shapeFlag & 1 /* ELEMENT */ && !c2.dynamicChildren) {
|
|
6261
|
-
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 */) {
|
|
6262
6283
|
c2 = ch2[i] = cloneIfMounted(ch2[i]);
|
|
6263
6284
|
c2.el = c1.el;
|
|
6264
6285
|
}
|
|
@@ -6382,7 +6403,7 @@ const TeleportImpl = {
|
|
|
6382
6403
|
const mount = (container, anchor) => {
|
|
6383
6404
|
// Teleport *always* has Array children. This is enforced in both the
|
|
6384
6405
|
// compiler and vnode children normalization.
|
|
6385
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6406
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6386
6407
|
mountChildren(children, container, anchor, parentComponent, parentSuspense, isSVG, slotScopeIds, optimized);
|
|
6387
6408
|
}
|
|
6388
6409
|
};
|
|
@@ -6418,7 +6439,7 @@ const TeleportImpl = {
|
|
|
6418
6439
|
if (!wasDisabled) {
|
|
6419
6440
|
// enabled -> disabled
|
|
6420
6441
|
// move into main container
|
|
6421
|
-
moveTeleport(n2, container, mainAnchor, internals, 1 /* TOGGLE */);
|
|
6442
|
+
moveTeleport(n2, container, mainAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
6422
6443
|
}
|
|
6423
6444
|
}
|
|
6424
6445
|
else {
|
|
@@ -6426,7 +6447,7 @@ const TeleportImpl = {
|
|
|
6426
6447
|
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
6427
6448
|
const nextTarget = (n2.target = resolveTarget(n2.props, querySelector));
|
|
6428
6449
|
if (nextTarget) {
|
|
6429
|
-
moveTeleport(n2, nextTarget, null, internals, 0 /* TARGET_CHANGE */);
|
|
6450
|
+
moveTeleport(n2, nextTarget, null, internals, 0 /* TeleportMoveTypes.TARGET_CHANGE */);
|
|
6430
6451
|
}
|
|
6431
6452
|
else if ((process.env.NODE_ENV !== 'production')) {
|
|
6432
6453
|
warn('Invalid Teleport target on update:', target, `(${typeof target})`);
|
|
@@ -6435,7 +6456,7 @@ const TeleportImpl = {
|
|
|
6435
6456
|
else if (wasDisabled) {
|
|
6436
6457
|
// disabled -> enabled
|
|
6437
6458
|
// move into teleport target
|
|
6438
|
-
moveTeleport(n2, target, targetAnchor, internals, 1 /* TOGGLE */);
|
|
6459
|
+
moveTeleport(n2, target, targetAnchor, internals, 1 /* TeleportMoveTypes.TOGGLE */);
|
|
6439
6460
|
}
|
|
6440
6461
|
}
|
|
6441
6462
|
}
|
|
@@ -6448,7 +6469,7 @@ const TeleportImpl = {
|
|
|
6448
6469
|
// an unmounted teleport should always remove its children if not disabled
|
|
6449
6470
|
if (doRemove || !isTeleportDisabled(props)) {
|
|
6450
6471
|
hostRemove(anchor);
|
|
6451
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6472
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6452
6473
|
for (let i = 0; i < children.length; i++) {
|
|
6453
6474
|
const child = children[i];
|
|
6454
6475
|
unmount(child, parentComponent, parentSuspense, true, !!child.dynamicChildren);
|
|
@@ -6459,13 +6480,13 @@ const TeleportImpl = {
|
|
|
6459
6480
|
move: moveTeleport,
|
|
6460
6481
|
hydrate: hydrateTeleport
|
|
6461
6482
|
};
|
|
6462
|
-
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 */) {
|
|
6463
6484
|
// move target anchor if this is a target change.
|
|
6464
|
-
if (moveType === 0 /* TARGET_CHANGE */) {
|
|
6485
|
+
if (moveType === 0 /* TeleportMoveTypes.TARGET_CHANGE */) {
|
|
6465
6486
|
insert(vnode.targetAnchor, container, parentAnchor);
|
|
6466
6487
|
}
|
|
6467
6488
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
6468
|
-
const isReorder = moveType === 2 /* REORDER */;
|
|
6489
|
+
const isReorder = moveType === 2 /* TeleportMoveTypes.REORDER */;
|
|
6469
6490
|
// move main view anchor if this is a re-order.
|
|
6470
6491
|
if (isReorder) {
|
|
6471
6492
|
insert(el, container, parentAnchor);
|
|
@@ -6475,9 +6496,9 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
6475
6496
|
// is not a reorder, or the teleport is disabled
|
|
6476
6497
|
if (!isReorder || isTeleportDisabled(props)) {
|
|
6477
6498
|
// Teleport has either Array children or no children.
|
|
6478
|
-
if (shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6499
|
+
if (shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6479
6500
|
for (let i = 0; i < children.length; i++) {
|
|
6480
|
-
move(children[i], container, parentAnchor, 2 /* REORDER */);
|
|
6501
|
+
move(children[i], container, parentAnchor, 2 /* MoveType.REORDER */);
|
|
6481
6502
|
}
|
|
6482
6503
|
}
|
|
6483
6504
|
}
|
|
@@ -6492,7 +6513,7 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
|
|
|
6492
6513
|
// if multiple teleports rendered to the same target element, we need to
|
|
6493
6514
|
// pick up from where the last teleport finished instead of the first node
|
|
6494
6515
|
const targetNode = target._lpa || target.firstChild;
|
|
6495
|
-
if (vnode.shapeFlag & 16 /* ARRAY_CHILDREN */) {
|
|
6516
|
+
if (vnode.shapeFlag & 16 /* ShapeFlags.ARRAY_CHILDREN */) {
|
|
6496
6517
|
if (isTeleportDisabled(vnode.props)) {
|
|
6497
6518
|
vnode.anchor = hydrateChildren(nextSibling(node), vnode, parentNode(node), parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
6498
6519
|
vnode.targetAnchor = targetNode;
|
|
@@ -6615,7 +6636,7 @@ function isVNode(value) {
|
|
|
6615
6636
|
}
|
|
6616
6637
|
function isSameVNodeType(n1, n2) {
|
|
6617
6638
|
if ((process.env.NODE_ENV !== 'production') &&
|
|
6618
|
-
n2.shapeFlag & 6 /* COMPONENT */ &&
|
|
6639
|
+
n2.shapeFlag & 6 /* ShapeFlags.COMPONENT */ &&
|
|
6619
6640
|
hmrDirtyComponents.has(n2.type)) {
|
|
6620
6641
|
// HMR only: if the component has been hot-updated, force a reload.
|
|
6621
6642
|
return false;
|
|
@@ -6646,7 +6667,7 @@ const normalizeRef = ({ ref, ref_key, ref_for }) => {
|
|
|
6646
6667
|
: ref
|
|
6647
6668
|
: null);
|
|
6648
6669
|
};
|
|
6649
|
-
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) {
|
|
6650
6671
|
const vnode = {
|
|
6651
6672
|
__v_isVNode: true,
|
|
6652
6673
|
__v_skip: true,
|
|
@@ -6677,7 +6698,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6677
6698
|
if (needFullChildrenNormalization) {
|
|
6678
6699
|
normalizeChildren(vnode, children);
|
|
6679
6700
|
// normalize suspense children
|
|
6680
|
-
if (shapeFlag & 128 /* SUSPENSE */) {
|
|
6701
|
+
if (shapeFlag & 128 /* ShapeFlags.SUSPENSE */) {
|
|
6681
6702
|
type.normalize(vnode);
|
|
6682
6703
|
}
|
|
6683
6704
|
}
|
|
@@ -6685,8 +6706,8 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6685
6706
|
// compiled element vnode - if children is passed, only possible types are
|
|
6686
6707
|
// string or Array.
|
|
6687
6708
|
vnode.shapeFlag |= isString(children)
|
|
6688
|
-
? 8 /* TEXT_CHILDREN */
|
|
6689
|
-
: 16 /* ARRAY_CHILDREN */;
|
|
6709
|
+
? 8 /* ShapeFlags.TEXT_CHILDREN */
|
|
6710
|
+
: 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6690
6711
|
}
|
|
6691
6712
|
// validate key
|
|
6692
6713
|
if ((process.env.NODE_ENV !== 'production') && vnode.key !== vnode.key) {
|
|
@@ -6702,10 +6723,10 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
6702
6723
|
// component nodes also should always be patched, because even if the
|
|
6703
6724
|
// component doesn't need to update, it needs to persist the instance on to
|
|
6704
6725
|
// the next vnode so that it can be properly unmounted later.
|
|
6705
|
-
(vnode.patchFlag > 0 || shapeFlag & 6 /* COMPONENT */) &&
|
|
6726
|
+
(vnode.patchFlag > 0 || shapeFlag & 6 /* ShapeFlags.COMPONENT */) &&
|
|
6706
6727
|
// the EVENTS flag is only for hydration and if it is the only flag, the
|
|
6707
6728
|
// vnode should not be considered dynamic due to handler caching.
|
|
6708
|
-
vnode.patchFlag !== 32 /* HYDRATE_EVENTS */) {
|
|
6729
|
+
vnode.patchFlag !== 32 /* PatchFlags.HYDRATE_EVENTS */) {
|
|
6709
6730
|
currentBlock.push(vnode);
|
|
6710
6731
|
}
|
|
6711
6732
|
return vnode;
|
|
@@ -6727,14 +6748,14 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6727
6748
|
normalizeChildren(cloned, children);
|
|
6728
6749
|
}
|
|
6729
6750
|
if (isBlockTreeEnabled > 0 && !isBlockNode && currentBlock) {
|
|
6730
|
-
if (cloned.shapeFlag & 6 /* COMPONENT */) {
|
|
6751
|
+
if (cloned.shapeFlag & 6 /* ShapeFlags.COMPONENT */) {
|
|
6731
6752
|
currentBlock[currentBlock.indexOf(type)] = cloned;
|
|
6732
6753
|
}
|
|
6733
6754
|
else {
|
|
6734
6755
|
currentBlock.push(cloned);
|
|
6735
6756
|
}
|
|
6736
6757
|
}
|
|
6737
|
-
cloned.patchFlag |= -2 /* BAIL */;
|
|
6758
|
+
cloned.patchFlag |= -2 /* PatchFlags.BAIL */;
|
|
6738
6759
|
return cloned;
|
|
6739
6760
|
}
|
|
6740
6761
|
// class component normalization.
|
|
@@ -6760,17 +6781,17 @@ function _createVNode(type, props = null, children = null, patchFlag = 0, dynami
|
|
|
6760
6781
|
}
|
|
6761
6782
|
// encode the vnode type information into a bitmap
|
|
6762
6783
|
const shapeFlag = isString(type)
|
|
6763
|
-
? 1 /* ELEMENT */
|
|
6784
|
+
? 1 /* ShapeFlags.ELEMENT */
|
|
6764
6785
|
: isSuspense(type)
|
|
6765
|
-
? 128 /* SUSPENSE */
|
|
6786
|
+
? 128 /* ShapeFlags.SUSPENSE */
|
|
6766
6787
|
: isTeleport(type)
|
|
6767
|
-
? 64 /* TELEPORT */
|
|
6788
|
+
? 64 /* ShapeFlags.TELEPORT */
|
|
6768
6789
|
: isObject(type)
|
|
6769
|
-
? 4 /* STATEFUL_COMPONENT */
|
|
6790
|
+
? 4 /* ShapeFlags.STATEFUL_COMPONENT */
|
|
6770
6791
|
: isFunction(type)
|
|
6771
|
-
? 2 /* FUNCTIONAL_COMPONENT */
|
|
6792
|
+
? 2 /* ShapeFlags.FUNCTIONAL_COMPONENT */
|
|
6772
6793
|
: 0;
|
|
6773
|
-
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)) {
|
|
6774
6795
|
type = toRaw(type);
|
|
6775
6796
|
warn(`Vue received a Component which was made a reactive object. This can ` +
|
|
6776
6797
|
`lead to unnecessary performance overhead, and should be avoided by ` +
|
|
@@ -6809,7 +6830,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6809
6830
|
: ref,
|
|
6810
6831
|
scopeId: vnode.scopeId,
|
|
6811
6832
|
slotScopeIds: vnode.slotScopeIds,
|
|
6812
|
-
children: (process.env.NODE_ENV !== 'production') && patchFlag === -1 /* HOISTED */ && isArray(children)
|
|
6833
|
+
children: (process.env.NODE_ENV !== 'production') && patchFlag === -1 /* PatchFlags.HOISTED */ && isArray(children)
|
|
6813
6834
|
? children.map(deepCloneVNode)
|
|
6814
6835
|
: children,
|
|
6815
6836
|
target: vnode.target,
|
|
@@ -6822,8 +6843,8 @@ function cloneVNode(vnode, extraProps, mergeRef = false) {
|
|
|
6822
6843
|
// fast paths only.
|
|
6823
6844
|
patchFlag: extraProps && vnode.type !== Fragment
|
|
6824
6845
|
? patchFlag === -1 // hoisted node
|
|
6825
|
-
? 16 /* FULL_PROPS */
|
|
6826
|
-
: patchFlag | 16 /* FULL_PROPS */
|
|
6846
|
+
? 16 /* PatchFlags.FULL_PROPS */
|
|
6847
|
+
: patchFlag | 16 /* PatchFlags.FULL_PROPS */
|
|
6827
6848
|
: patchFlag,
|
|
6828
6849
|
dynamicProps: vnode.dynamicProps,
|
|
6829
6850
|
dynamicChildren: vnode.dynamicChildren,
|
|
@@ -6913,10 +6934,10 @@ function normalizeChildren(vnode, children) {
|
|
|
6913
6934
|
children = null;
|
|
6914
6935
|
}
|
|
6915
6936
|
else if (isArray(children)) {
|
|
6916
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6937
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6917
6938
|
}
|
|
6918
6939
|
else if (typeof children === 'object') {
|
|
6919
|
-
if (shapeFlag & (1 /* ELEMENT */ | 64 /* TELEPORT */)) {
|
|
6940
|
+
if (shapeFlag & (1 /* ShapeFlags.ELEMENT */ | 64 /* ShapeFlags.TELEPORT */)) {
|
|
6920
6941
|
// Normalize slot to plain children for plain element and Teleport
|
|
6921
6942
|
const slot = children.default;
|
|
6922
6943
|
if (slot) {
|
|
@@ -6928,37 +6949,37 @@ function normalizeChildren(vnode, children) {
|
|
|
6928
6949
|
return;
|
|
6929
6950
|
}
|
|
6930
6951
|
else {
|
|
6931
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6952
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6932
6953
|
const slotFlag = children._;
|
|
6933
6954
|
if (!slotFlag && !(InternalObjectKey in children)) {
|
|
6934
6955
|
children._ctx = currentRenderingInstance;
|
|
6935
6956
|
}
|
|
6936
|
-
else if (slotFlag === 3 /* FORWARDED */ && currentRenderingInstance) {
|
|
6957
|
+
else if (slotFlag === 3 /* SlotFlags.FORWARDED */ && currentRenderingInstance) {
|
|
6937
6958
|
// a child component receives forwarded slots from the parent.
|
|
6938
6959
|
// its slot type is determined by its parent's slot type.
|
|
6939
|
-
if (currentRenderingInstance.slots._ === 1 /* STABLE */) {
|
|
6940
|
-
children._ = 1 /* STABLE */;
|
|
6960
|
+
if (currentRenderingInstance.slots._ === 1 /* SlotFlags.STABLE */) {
|
|
6961
|
+
children._ = 1 /* SlotFlags.STABLE */;
|
|
6941
6962
|
}
|
|
6942
6963
|
else {
|
|
6943
|
-
children._ = 2 /* DYNAMIC */;
|
|
6944
|
-
vnode.patchFlag |= 1024 /* DYNAMIC_SLOTS */;
|
|
6964
|
+
children._ = 2 /* SlotFlags.DYNAMIC */;
|
|
6965
|
+
vnode.patchFlag |= 1024 /* PatchFlags.DYNAMIC_SLOTS */;
|
|
6945
6966
|
}
|
|
6946
6967
|
}
|
|
6947
6968
|
}
|
|
6948
6969
|
}
|
|
6949
6970
|
else if (isFunction(children)) {
|
|
6950
6971
|
children = { default: children, _ctx: currentRenderingInstance };
|
|
6951
|
-
type = 32 /* SLOTS_CHILDREN */;
|
|
6972
|
+
type = 32 /* ShapeFlags.SLOTS_CHILDREN */;
|
|
6952
6973
|
}
|
|
6953
6974
|
else {
|
|
6954
6975
|
children = String(children);
|
|
6955
6976
|
// force teleport children to array so it can be moved around
|
|
6956
|
-
if (shapeFlag & 64 /* TELEPORT */) {
|
|
6957
|
-
type = 16 /* ARRAY_CHILDREN */;
|
|
6977
|
+
if (shapeFlag & 64 /* ShapeFlags.TELEPORT */) {
|
|
6978
|
+
type = 16 /* ShapeFlags.ARRAY_CHILDREN */;
|
|
6958
6979
|
children = [createTextVNode(children)];
|
|
6959
6980
|
}
|
|
6960
6981
|
else {
|
|
6961
|
-
type = 8 /* TEXT_CHILDREN */;
|
|
6982
|
+
type = 8 /* ShapeFlags.TEXT_CHILDREN */;
|
|
6962
6983
|
}
|
|
6963
6984
|
}
|
|
6964
6985
|
vnode.children = children;
|
|
@@ -6996,7 +7017,7 @@ function mergeProps(...args) {
|
|
|
6996
7017
|
return ret;
|
|
6997
7018
|
}
|
|
6998
7019
|
function invokeVNodeHook(hook, instance, vnode, prevVNode = null) {
|
|
6999
|
-
callWithAsyncErrorHandling(hook, instance, 7 /* VNODE_HOOK */, [
|
|
7020
|
+
callWithAsyncErrorHandling(hook, instance, 7 /* ErrorCodes.VNODE_HOOK */, [
|
|
7000
7021
|
vnode,
|
|
7001
7022
|
prevVNode
|
|
7002
7023
|
]);
|
|
@@ -7107,7 +7128,7 @@ function validateComponentName(name, config) {
|
|
|
7107
7128
|
}
|
|
7108
7129
|
}
|
|
7109
7130
|
function isStatefulComponent(instance) {
|
|
7110
|
-
return instance.vnode.shapeFlag & 4 /* STATEFUL_COMPONENT */;
|
|
7131
|
+
return instance.vnode.shapeFlag & 4 /* ShapeFlags.STATEFUL_COMPONENT */;
|
|
7111
7132
|
}
|
|
7112
7133
|
let isInSSRComponentSetup = false;
|
|
7113
7134
|
function setupComponent(instance, isSSR = false) {
|
|
@@ -7162,7 +7183,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7162
7183
|
setup.length > 1 ? createSetupContext(instance) : null);
|
|
7163
7184
|
setCurrentInstance(instance);
|
|
7164
7185
|
pauseTracking();
|
|
7165
|
-
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]);
|
|
7166
7187
|
resetTracking();
|
|
7167
7188
|
unsetCurrentInstance();
|
|
7168
7189
|
if (isPromise(setupResult)) {
|
|
@@ -7174,7 +7195,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
7174
7195
|
handleSetupResult(instance, resolvedResult, isSSR);
|
|
7175
7196
|
})
|
|
7176
7197
|
.catch(e => {
|
|
7177
|
-
handleError(e, instance, 0 /* SETUP_FUNCTION */);
|
|
7198
|
+
handleError(e, instance, 0 /* ErrorCodes.SETUP_FUNCTION */);
|
|
7178
7199
|
});
|
|
7179
7200
|
}
|
|
7180
7201
|
else {
|
|
@@ -7307,7 +7328,7 @@ function createAttrsProxy(instance) {
|
|
|
7307
7328
|
? {
|
|
7308
7329
|
get(target, key) {
|
|
7309
7330
|
markAttrsAccessed();
|
|
7310
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
7331
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
7311
7332
|
return target[key];
|
|
7312
7333
|
},
|
|
7313
7334
|
set() {
|
|
@@ -7321,7 +7342,7 @@ function createAttrsProxy(instance) {
|
|
|
7321
7342
|
}
|
|
7322
7343
|
: {
|
|
7323
7344
|
get(target, key) {
|
|
7324
|
-
track(instance, "get" /* GET */, '$attrs');
|
|
7345
|
+
track(instance, "get" /* TrackOpTypes.GET */, '$attrs');
|
|
7325
7346
|
return target[key];
|
|
7326
7347
|
}
|
|
7327
7348
|
});
|
|
@@ -7609,7 +7630,7 @@ const useSSRContext = () => {
|
|
|
7609
7630
|
};
|
|
7610
7631
|
|
|
7611
7632
|
function isShallow(value) {
|
|
7612
|
-
return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
|
|
7633
|
+
return !!(value && value["__v_isShallow" /* ReactiveFlags.IS_SHALLOW */]);
|
|
7613
7634
|
}
|
|
7614
7635
|
|
|
7615
7636
|
function initCustomFormatter() {
|
|
@@ -7829,7 +7850,7 @@ function isMemoSame(cached, memo) {
|
|
|
7829
7850
|
}
|
|
7830
7851
|
|
|
7831
7852
|
// Core API ------------------------------------------------------------------
|
|
7832
|
-
const version = "3.2.
|
|
7853
|
+
const version = "3.2.38";
|
|
7833
7854
|
const _ssrUtils = {
|
|
7834
7855
|
createComponentInstance,
|
|
7835
7856
|
setupComponent,
|