@cabloy/vue-runtime-core 3.4.34 → 3.4.36
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/README.md +1 -1
- package/dist/runtime-core.cjs.js +2308 -2265
- package/dist/runtime-core.cjs.prod.js +2047 -2024
- package/dist/runtime-core.d.ts +23 -13
- package/dist/runtime-core.esm-bundler.js +2312 -2268
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @cabloy/vue-runtime-core v3.4.
|
|
2
|
+
* @cabloy/vue-runtime-core v3.4.37
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -44,7 +44,9 @@ const ErrorCodes = {
|
|
|
44
44
|
"ASYNC_COMPONENT_LOADER": 13,
|
|
45
45
|
"13": "ASYNC_COMPONENT_LOADER",
|
|
46
46
|
"SCHEDULER": 14,
|
|
47
|
-
"14": "SCHEDULER"
|
|
47
|
+
"14": "SCHEDULER",
|
|
48
|
+
"COMPONENT_UPDATE": 15,
|
|
49
|
+
"15": "COMPONENT_UPDATE"
|
|
48
50
|
};
|
|
49
51
|
const ErrorTypeStrings$1 = {
|
|
50
52
|
["sp"]: "serverPrefetch hook",
|
|
@@ -75,7 +77,8 @@ const ErrorTypeStrings$1 = {
|
|
|
75
77
|
[11]: "app warnHandler",
|
|
76
78
|
[12]: "ref function",
|
|
77
79
|
[13]: "async component loader",
|
|
78
|
-
[14]: "scheduler flush
|
|
80
|
+
[14]: "scheduler flush",
|
|
81
|
+
[15]: "component update"
|
|
79
82
|
};
|
|
80
83
|
function callWithErrorHandling(fn, instance, type, args) {
|
|
81
84
|
try {
|
|
@@ -256,7 +259,11 @@ function flushJobs(seen) {
|
|
|
256
259
|
const job = queue[flushIndex];
|
|
257
260
|
if (job && job.active !== false) {
|
|
258
261
|
if (false) ;
|
|
259
|
-
callWithErrorHandling(
|
|
262
|
+
callWithErrorHandling(
|
|
263
|
+
job,
|
|
264
|
+
job.i,
|
|
265
|
+
job.i ? 15 : 14
|
|
266
|
+
);
|
|
260
267
|
}
|
|
261
268
|
}
|
|
262
269
|
} finally {
|
|
@@ -271,103 +278,6 @@ function flushJobs(seen) {
|
|
|
271
278
|
}
|
|
272
279
|
}
|
|
273
280
|
|
|
274
|
-
function emit(instance, event, ...rawArgs) {
|
|
275
|
-
if (instance.isUnmounted) return;
|
|
276
|
-
const props = instance.vnode.props || shared.EMPTY_OBJ;
|
|
277
|
-
let args = rawArgs;
|
|
278
|
-
const isModelListener = event.startsWith("update:");
|
|
279
|
-
const modelArg = isModelListener && event.slice(7);
|
|
280
|
-
if (modelArg && modelArg in props) {
|
|
281
|
-
const modifiersKey = `${modelArg === "modelValue" ? "model" : modelArg}Modifiers`;
|
|
282
|
-
const { number, trim } = props[modifiersKey] || shared.EMPTY_OBJ;
|
|
283
|
-
if (trim) {
|
|
284
|
-
args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
|
|
285
|
-
}
|
|
286
|
-
if (number) {
|
|
287
|
-
args = rawArgs.map(shared.looseToNumber);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
let handlerName;
|
|
291
|
-
let handler = props[handlerName = shared.toHandlerKey(event)] || // also try camelCase event handler (#2249)
|
|
292
|
-
props[handlerName = shared.toHandlerKey(shared.camelize(event))];
|
|
293
|
-
if (!handler && isModelListener) {
|
|
294
|
-
handler = props[handlerName = shared.toHandlerKey(shared.hyphenate(event))];
|
|
295
|
-
}
|
|
296
|
-
if (handler) {
|
|
297
|
-
callWithAsyncErrorHandling(
|
|
298
|
-
handler,
|
|
299
|
-
instance,
|
|
300
|
-
6,
|
|
301
|
-
args
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
const onceHandler = props[handlerName + `Once`];
|
|
305
|
-
if (onceHandler) {
|
|
306
|
-
if (!instance.emitted) {
|
|
307
|
-
instance.emitted = {};
|
|
308
|
-
} else if (instance.emitted[handlerName]) {
|
|
309
|
-
return;
|
|
310
|
-
}
|
|
311
|
-
instance.emitted[handlerName] = true;
|
|
312
|
-
callWithAsyncErrorHandling(
|
|
313
|
-
onceHandler,
|
|
314
|
-
instance,
|
|
315
|
-
6,
|
|
316
|
-
args
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
321
|
-
const cache = appContext.emitsCache;
|
|
322
|
-
const cached = cache.get(comp);
|
|
323
|
-
if (cached !== void 0) {
|
|
324
|
-
return cached;
|
|
325
|
-
}
|
|
326
|
-
const raw = comp.emits;
|
|
327
|
-
let normalized = {};
|
|
328
|
-
let hasExtends = false;
|
|
329
|
-
if (!shared.isFunction(comp)) {
|
|
330
|
-
const extendEmits = (raw2) => {
|
|
331
|
-
const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
|
332
|
-
if (normalizedFromExtend) {
|
|
333
|
-
hasExtends = true;
|
|
334
|
-
shared.extend(normalized, normalizedFromExtend);
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
if (!asMixin && appContext.mixins.length) {
|
|
338
|
-
appContext.mixins.forEach(extendEmits);
|
|
339
|
-
}
|
|
340
|
-
if (comp.extends) {
|
|
341
|
-
extendEmits(comp.extends);
|
|
342
|
-
}
|
|
343
|
-
if (comp.mixins) {
|
|
344
|
-
comp.mixins.forEach(extendEmits);
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
if (!raw && !hasExtends) {
|
|
348
|
-
if (shared.isObject(comp)) {
|
|
349
|
-
cache.set(comp, null);
|
|
350
|
-
}
|
|
351
|
-
return null;
|
|
352
|
-
}
|
|
353
|
-
if (shared.isArray(raw)) {
|
|
354
|
-
raw.forEach((key) => normalized[key] = null);
|
|
355
|
-
} else {
|
|
356
|
-
shared.extend(normalized, raw);
|
|
357
|
-
}
|
|
358
|
-
if (shared.isObject(comp)) {
|
|
359
|
-
cache.set(comp, normalized);
|
|
360
|
-
}
|
|
361
|
-
return normalized;
|
|
362
|
-
}
|
|
363
|
-
function isEmitListener(options, key) {
|
|
364
|
-
if (!options || !shared.isOn(key)) {
|
|
365
|
-
return false;
|
|
366
|
-
}
|
|
367
|
-
key = key.slice(2).replace(/Once$/, "");
|
|
368
|
-
return shared.hasOwn(options, key[0].toLowerCase() + key.slice(1)) || shared.hasOwn(options, shared.hyphenate(key)) || shared.hasOwn(options, key);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
281
|
let currentRenderingInstance = null;
|
|
372
282
|
let currentScopeId = null;
|
|
373
283
|
function setCurrentRenderingInstance(instance) {
|
|
@@ -410,822 +320,773 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
|
410
320
|
return renderFnWithContext;
|
|
411
321
|
}
|
|
412
322
|
|
|
413
|
-
function
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
const {
|
|
417
|
-
type: Component,
|
|
418
|
-
vnode,
|
|
419
|
-
proxy,
|
|
420
|
-
withProxy,
|
|
421
|
-
propsOptions: [propsOptions],
|
|
422
|
-
slots,
|
|
423
|
-
attrs,
|
|
424
|
-
emit,
|
|
425
|
-
render,
|
|
426
|
-
renderCache,
|
|
427
|
-
props,
|
|
428
|
-
data,
|
|
429
|
-
setupState,
|
|
430
|
-
ctx,
|
|
431
|
-
inheritAttrs
|
|
432
|
-
} = instance;
|
|
433
|
-
const prev = setCurrentRenderingInstance(instance);
|
|
434
|
-
let result;
|
|
435
|
-
let fallthroughAttrs;
|
|
436
|
-
try {
|
|
437
|
-
if (vnode.shapeFlag & 4) {
|
|
438
|
-
const proxyToUse = withProxy || proxy;
|
|
439
|
-
const thisProxy = false ? new Proxy(proxyToUse, {
|
|
440
|
-
get(target, key, receiver) {
|
|
441
|
-
warn(
|
|
442
|
-
`Property '${String(
|
|
443
|
-
key
|
|
444
|
-
)}' was accessed via 'this'. Avoid using 'this' in templates.`
|
|
445
|
-
);
|
|
446
|
-
return Reflect.get(target, key, receiver);
|
|
447
|
-
}
|
|
448
|
-
}) : proxyToUse;
|
|
449
|
-
result = normalizeVNode(
|
|
450
|
-
render.call(
|
|
451
|
-
thisProxy,
|
|
452
|
-
proxyToUse,
|
|
453
|
-
renderCache,
|
|
454
|
-
false ? shallowReadonly(props) : props,
|
|
455
|
-
setupState,
|
|
456
|
-
data,
|
|
457
|
-
ctx
|
|
458
|
-
)
|
|
459
|
-
);
|
|
460
|
-
fallthroughAttrs = attrs;
|
|
461
|
-
} else {
|
|
462
|
-
const render2 = Component;
|
|
463
|
-
if (false) ;
|
|
464
|
-
result = normalizeVNode(
|
|
465
|
-
render2.length > 1 ? render2(
|
|
466
|
-
false ? shallowReadonly(props) : props,
|
|
467
|
-
false ? {
|
|
468
|
-
get attrs() {
|
|
469
|
-
markAttrsAccessed();
|
|
470
|
-
return shallowReadonly(attrs);
|
|
471
|
-
},
|
|
472
|
-
slots,
|
|
473
|
-
emit
|
|
474
|
-
} : { attrs, slots, emit }
|
|
475
|
-
) : render2(
|
|
476
|
-
false ? shallowReadonly(props) : props,
|
|
477
|
-
null
|
|
478
|
-
)
|
|
479
|
-
);
|
|
480
|
-
fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
|
|
481
|
-
}
|
|
482
|
-
} catch (err) {
|
|
483
|
-
blockStack.length = 0;
|
|
484
|
-
handleError(err, instance, 1);
|
|
485
|
-
result = createVNode(Comment);
|
|
323
|
+
function withDirectives(vnode, directives) {
|
|
324
|
+
if (currentRenderingInstance === null) {
|
|
325
|
+
return vnode;
|
|
486
326
|
}
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
if (
|
|
492
|
-
if (
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
);
|
|
498
|
-
}
|
|
499
|
-
root = cloneVNode(root, fallthroughAttrs, false, true);
|
|
327
|
+
const instance = getComponentPublicInstance(currentRenderingInstance);
|
|
328
|
+
const bindings = vnode.dirs || (vnode.dirs = []);
|
|
329
|
+
for (let i = 0; i < directives.length; i++) {
|
|
330
|
+
let [dir, value, arg, modifiers = shared.EMPTY_OBJ] = directives[i];
|
|
331
|
+
if (dir) {
|
|
332
|
+
if (shared.isFunction(dir)) {
|
|
333
|
+
dir = {
|
|
334
|
+
mounted: dir,
|
|
335
|
+
updated: dir
|
|
336
|
+
};
|
|
500
337
|
}
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
if (vnode.dirs) {
|
|
504
|
-
root = cloneVNode(root, null, false, true);
|
|
505
|
-
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
506
|
-
}
|
|
507
|
-
if (vnode.transition) {
|
|
508
|
-
root.transition = vnode.transition;
|
|
509
|
-
}
|
|
510
|
-
{
|
|
511
|
-
result = root;
|
|
512
|
-
}
|
|
513
|
-
setCurrentRenderingInstance(prev);
|
|
514
|
-
return result;
|
|
515
|
-
}
|
|
516
|
-
function filterSingleRoot(children, recurse = true) {
|
|
517
|
-
let singleRoot;
|
|
518
|
-
for (let i = 0; i < children.length; i++) {
|
|
519
|
-
const child = children[i];
|
|
520
|
-
if (isVNode(child)) {
|
|
521
|
-
if (child.type !== Comment || child.children === "v-if") {
|
|
522
|
-
if (singleRoot) {
|
|
523
|
-
return;
|
|
524
|
-
} else {
|
|
525
|
-
singleRoot = child;
|
|
526
|
-
}
|
|
338
|
+
if (dir.deep) {
|
|
339
|
+
traverse(value);
|
|
527
340
|
}
|
|
528
|
-
|
|
529
|
-
|
|
341
|
+
bindings.push({
|
|
342
|
+
dir,
|
|
343
|
+
instance,
|
|
344
|
+
value,
|
|
345
|
+
oldValue: void 0,
|
|
346
|
+
arg,
|
|
347
|
+
modifiers
|
|
348
|
+
});
|
|
530
349
|
}
|
|
531
350
|
}
|
|
532
|
-
return
|
|
351
|
+
return vnode;
|
|
533
352
|
}
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
353
|
+
function invokeDirectiveHook(vnode, prevVNode, instance, name) {
|
|
354
|
+
const bindings = vnode.dirs;
|
|
355
|
+
const oldBindings = prevVNode && prevVNode.dirs;
|
|
356
|
+
for (let i = 0; i < bindings.length; i++) {
|
|
357
|
+
const binding = bindings[i];
|
|
358
|
+
if (oldBindings) {
|
|
359
|
+
binding.oldValue = oldBindings[i].value;
|
|
360
|
+
}
|
|
361
|
+
let hook = binding.dir[name];
|
|
362
|
+
if (hook) {
|
|
363
|
+
reactivity.pauseTracking();
|
|
364
|
+
callWithAsyncErrorHandling(hook, instance, 8, [
|
|
365
|
+
vnode.el,
|
|
366
|
+
binding,
|
|
367
|
+
vnode,
|
|
368
|
+
prevVNode
|
|
369
|
+
]);
|
|
370
|
+
reactivity.resetTracking();
|
|
539
371
|
}
|
|
540
372
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
const
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const leaveCbKey = Symbol("_leaveCb");
|
|
376
|
+
const enterCbKey = Symbol("_enterCb");
|
|
377
|
+
function useTransitionState() {
|
|
378
|
+
const state = {
|
|
379
|
+
isMounted: false,
|
|
380
|
+
isLeaving: false,
|
|
381
|
+
isUnmounting: false,
|
|
382
|
+
leavingVNodes: /* @__PURE__ */ new Map()
|
|
383
|
+
};
|
|
384
|
+
onMounted(() => {
|
|
385
|
+
state.isMounted = true;
|
|
386
|
+
});
|
|
387
|
+
onBeforeUnmount(() => {
|
|
388
|
+
state.isUnmounting = true;
|
|
389
|
+
});
|
|
390
|
+
return state;
|
|
391
|
+
}
|
|
392
|
+
const TransitionHookValidator = [Function, Array];
|
|
393
|
+
const BaseTransitionPropsValidators = {
|
|
394
|
+
mode: String,
|
|
395
|
+
appear: Boolean,
|
|
396
|
+
persisted: Boolean,
|
|
397
|
+
// enter
|
|
398
|
+
onBeforeEnter: TransitionHookValidator,
|
|
399
|
+
onEnter: TransitionHookValidator,
|
|
400
|
+
onAfterEnter: TransitionHookValidator,
|
|
401
|
+
onEnterCancelled: TransitionHookValidator,
|
|
402
|
+
// leave
|
|
403
|
+
onBeforeLeave: TransitionHookValidator,
|
|
404
|
+
onLeave: TransitionHookValidator,
|
|
405
|
+
onAfterLeave: TransitionHookValidator,
|
|
406
|
+
onLeaveCancelled: TransitionHookValidator,
|
|
407
|
+
// appear
|
|
408
|
+
onBeforeAppear: TransitionHookValidator,
|
|
409
|
+
onAppear: TransitionHookValidator,
|
|
410
|
+
onAfterAppear: TransitionHookValidator,
|
|
411
|
+
onAppearCancelled: TransitionHookValidator
|
|
551
412
|
};
|
|
552
|
-
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
if (!
|
|
565
|
-
return
|
|
413
|
+
const recursiveGetSubtree = (instance) => {
|
|
414
|
+
const subTree = instance.subTree;
|
|
415
|
+
return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
|
|
416
|
+
};
|
|
417
|
+
const BaseTransitionImpl = {
|
|
418
|
+
name: `BaseTransition`,
|
|
419
|
+
props: BaseTransitionPropsValidators,
|
|
420
|
+
setup(props, { slots }) {
|
|
421
|
+
const instance = getCurrentInstance();
|
|
422
|
+
const state = useTransitionState();
|
|
423
|
+
return () => {
|
|
424
|
+
const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
|
425
|
+
if (!children || !children.length) {
|
|
426
|
+
return;
|
|
566
427
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
428
|
+
let child = children[0];
|
|
429
|
+
if (children.length > 1) {
|
|
430
|
+
for (const c of children) {
|
|
431
|
+
if (c.type !== Comment) {
|
|
432
|
+
child = c;
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
574
435
|
}
|
|
575
436
|
}
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
return true;
|
|
437
|
+
const rawProps = reactivity.toRaw(props);
|
|
438
|
+
const { mode } = rawProps;
|
|
439
|
+
if (state.isLeaving) {
|
|
440
|
+
return emptyPlaceholder(child);
|
|
581
441
|
}
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
}
|
|
594
|
-
return false;
|
|
595
|
-
}
|
|
596
|
-
function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
597
|
-
const nextKeys = Object.keys(nextProps);
|
|
598
|
-
if (nextKeys.length !== Object.keys(prevProps).length) {
|
|
599
|
-
return true;
|
|
600
|
-
}
|
|
601
|
-
for (let i = 0; i < nextKeys.length; i++) {
|
|
602
|
-
const key = nextKeys[i];
|
|
603
|
-
if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
|
|
604
|
-
return true;
|
|
605
|
-
}
|
|
606
|
-
}
|
|
607
|
-
return false;
|
|
608
|
-
}
|
|
609
|
-
function updateHOCHostEl({ vnode, parent }, el) {
|
|
610
|
-
while (parent) {
|
|
611
|
-
const root = parent.subTree;
|
|
612
|
-
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
613
|
-
root.el = vnode.el;
|
|
614
|
-
}
|
|
615
|
-
if (root === vnode) {
|
|
616
|
-
(vnode = parent.vnode).el = el;
|
|
617
|
-
parent = parent.parent;
|
|
618
|
-
} else {
|
|
619
|
-
break;
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
const COMPONENTS = "components";
|
|
625
|
-
const DIRECTIVES = "directives";
|
|
626
|
-
function resolveComponent(name, maybeSelfReference) {
|
|
627
|
-
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
628
|
-
}
|
|
629
|
-
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
630
|
-
function resolveDynamicComponent(component) {
|
|
631
|
-
if (shared.isString(component)) {
|
|
632
|
-
return resolveAsset(COMPONENTS, component, false) || component;
|
|
633
|
-
} else {
|
|
634
|
-
return component || NULL_DYNAMIC_COMPONENT;
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
function resolveDirective(name) {
|
|
638
|
-
return resolveAsset(DIRECTIVES, name);
|
|
639
|
-
}
|
|
640
|
-
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
641
|
-
const instance = currentRenderingInstance || currentInstance;
|
|
642
|
-
if (instance) {
|
|
643
|
-
const Component = instance.type;
|
|
644
|
-
if (type === COMPONENTS) {
|
|
645
|
-
const selfName = getComponentName(
|
|
646
|
-
Component,
|
|
647
|
-
false
|
|
442
|
+
const innerChild = getKeepAliveChild(child);
|
|
443
|
+
if (!innerChild) {
|
|
444
|
+
return emptyPlaceholder(child);
|
|
445
|
+
}
|
|
446
|
+
let enterHooks = resolveTransitionHooks(
|
|
447
|
+
innerChild,
|
|
448
|
+
rawProps,
|
|
449
|
+
state,
|
|
450
|
+
instance,
|
|
451
|
+
// #11061, ensure enterHooks is fresh after clone
|
|
452
|
+
(hooks) => enterHooks = hooks
|
|
648
453
|
);
|
|
649
|
-
|
|
650
|
-
|
|
454
|
+
setTransitionHooks(innerChild, enterHooks);
|
|
455
|
+
const oldChild = instance.subTree;
|
|
456
|
+
const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
|
|
457
|
+
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
|
|
458
|
+
const leavingHooks = resolveTransitionHooks(
|
|
459
|
+
oldInnerChild,
|
|
460
|
+
rawProps,
|
|
461
|
+
state,
|
|
462
|
+
instance
|
|
463
|
+
);
|
|
464
|
+
setTransitionHooks(oldInnerChild, leavingHooks);
|
|
465
|
+
if (mode === "out-in" && innerChild.type !== Comment) {
|
|
466
|
+
state.isLeaving = true;
|
|
467
|
+
leavingHooks.afterLeave = () => {
|
|
468
|
+
state.isLeaving = false;
|
|
469
|
+
if (instance.update.active !== false) {
|
|
470
|
+
instance.effect.dirty = true;
|
|
471
|
+
instance.update();
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
return emptyPlaceholder(child);
|
|
475
|
+
} else if (mode === "in-out" && innerChild.type !== Comment) {
|
|
476
|
+
leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
|
477
|
+
const leavingVNodesCache = getLeavingNodesForType(
|
|
478
|
+
state,
|
|
479
|
+
oldInnerChild
|
|
480
|
+
);
|
|
481
|
+
leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
|
482
|
+
el[leaveCbKey] = () => {
|
|
483
|
+
earlyRemove();
|
|
484
|
+
el[leaveCbKey] = void 0;
|
|
485
|
+
delete enterHooks.delayedLeave;
|
|
486
|
+
};
|
|
487
|
+
enterHooks.delayedLeave = delayedLeave;
|
|
488
|
+
};
|
|
489
|
+
}
|
|
651
490
|
}
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
// local registration
|
|
655
|
-
// check instance[type] first which is resolved for options API
|
|
656
|
-
resolve(instance[type] || Component[type], name) || // global registration
|
|
657
|
-
resolve(instance.appContext[type], name)
|
|
658
|
-
);
|
|
659
|
-
if (!res && maybeSelfReference) {
|
|
660
|
-
return Component;
|
|
661
|
-
}
|
|
662
|
-
return res;
|
|
491
|
+
return child;
|
|
492
|
+
};
|
|
663
493
|
}
|
|
494
|
+
};
|
|
495
|
+
const BaseTransition = BaseTransitionImpl;
|
|
496
|
+
function getLeavingNodesForType(state, vnode) {
|
|
497
|
+
const { leavingVNodes } = state;
|
|
498
|
+
let leavingVNodesCache = leavingVNodes.get(vnode.type);
|
|
499
|
+
if (!leavingVNodesCache) {
|
|
500
|
+
leavingVNodesCache = /* @__PURE__ */ Object.create(null);
|
|
501
|
+
leavingVNodes.set(vnode.type, leavingVNodesCache);
|
|
502
|
+
}
|
|
503
|
+
return leavingVNodesCache;
|
|
664
504
|
}
|
|
665
|
-
function
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
505
|
+
function resolveTransitionHooks(vnode, props, state, instance, postClone) {
|
|
506
|
+
const {
|
|
507
|
+
appear,
|
|
508
|
+
mode,
|
|
509
|
+
persisted = false,
|
|
510
|
+
onBeforeEnter,
|
|
511
|
+
onEnter,
|
|
512
|
+
onAfterEnter,
|
|
513
|
+
onEnterCancelled,
|
|
514
|
+
onBeforeLeave,
|
|
515
|
+
onLeave,
|
|
516
|
+
onAfterLeave,
|
|
517
|
+
onLeaveCancelled,
|
|
518
|
+
onBeforeAppear,
|
|
519
|
+
onAppear,
|
|
520
|
+
onAfterAppear,
|
|
521
|
+
onAppearCancelled
|
|
522
|
+
} = props;
|
|
523
|
+
const key = String(vnode.key);
|
|
524
|
+
const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
|
525
|
+
const callHook = (hook, args) => {
|
|
526
|
+
hook && callWithAsyncErrorHandling(
|
|
527
|
+
hook,
|
|
528
|
+
instance,
|
|
529
|
+
9,
|
|
530
|
+
args
|
|
531
|
+
);
|
|
532
|
+
};
|
|
533
|
+
const callAsyncHook = (hook, args) => {
|
|
534
|
+
const done = args[1];
|
|
535
|
+
callHook(hook, args);
|
|
536
|
+
if (shared.isArray(hook)) {
|
|
537
|
+
if (hook.every((hook2) => hook2.length <= 1)) done();
|
|
538
|
+
} else if (hook.length <= 1) {
|
|
539
|
+
done();
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
const hooks = {
|
|
543
|
+
mode,
|
|
544
|
+
persisted,
|
|
545
|
+
beforeEnter(el) {
|
|
546
|
+
let hook = onBeforeEnter;
|
|
547
|
+
if (!state.isMounted) {
|
|
548
|
+
if (appear) {
|
|
549
|
+
hook = onBeforeAppear || onBeforeEnter;
|
|
550
|
+
} else {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
697
553
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
554
|
+
if (el[leaveCbKey]) {
|
|
555
|
+
el[leaveCbKey](
|
|
556
|
+
true
|
|
557
|
+
/* cancelled */
|
|
558
|
+
);
|
|
559
|
+
}
|
|
560
|
+
const leavingVNode = leavingVNodesCache[key];
|
|
561
|
+
if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
|
|
562
|
+
leavingVNode.el[leaveCbKey]();
|
|
563
|
+
}
|
|
564
|
+
callHook(hook, [el]);
|
|
565
|
+
},
|
|
566
|
+
enter(el) {
|
|
567
|
+
let hook = onEnter;
|
|
568
|
+
let afterHook = onAfterEnter;
|
|
569
|
+
let cancelHook = onEnterCancelled;
|
|
570
|
+
if (!state.isMounted) {
|
|
571
|
+
if (appear) {
|
|
572
|
+
hook = onAppear || onEnter;
|
|
573
|
+
afterHook = onAfterAppear || onAfterEnter;
|
|
574
|
+
cancelHook = onAppearCancelled || onEnterCancelled;
|
|
575
|
+
} else {
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
let called = false;
|
|
580
|
+
const done = el[enterCbKey] = (cancelled) => {
|
|
581
|
+
if (called) return;
|
|
582
|
+
called = true;
|
|
583
|
+
if (cancelled) {
|
|
584
|
+
callHook(cancelHook, [el]);
|
|
585
|
+
} else {
|
|
586
|
+
callHook(afterHook, [el]);
|
|
587
|
+
}
|
|
588
|
+
if (hooks.delayedLeave) {
|
|
589
|
+
hooks.delayedLeave();
|
|
590
|
+
}
|
|
591
|
+
el[enterCbKey] = void 0;
|
|
592
|
+
};
|
|
593
|
+
if (hook) {
|
|
594
|
+
callAsyncHook(hook, [el, done]);
|
|
595
|
+
} else {
|
|
596
|
+
done();
|
|
597
|
+
}
|
|
598
|
+
},
|
|
599
|
+
leave(el, remove) {
|
|
600
|
+
const key2 = String(vnode.key);
|
|
601
|
+
if (el[enterCbKey]) {
|
|
602
|
+
el[enterCbKey](
|
|
603
|
+
true
|
|
604
|
+
/* cancelled */
|
|
605
|
+
);
|
|
606
|
+
}
|
|
607
|
+
if (state.isUnmounting) {
|
|
608
|
+
return remove();
|
|
609
|
+
}
|
|
610
|
+
callHook(onBeforeLeave, [el]);
|
|
611
|
+
let called = false;
|
|
612
|
+
const done = el[leaveCbKey] = (cancelled) => {
|
|
613
|
+
if (called) return;
|
|
614
|
+
called = true;
|
|
615
|
+
remove();
|
|
616
|
+
if (cancelled) {
|
|
617
|
+
callHook(onLeaveCancelled, [el]);
|
|
618
|
+
} else {
|
|
619
|
+
callHook(onAfterLeave, [el]);
|
|
620
|
+
}
|
|
621
|
+
el[leaveCbKey] = void 0;
|
|
622
|
+
if (leavingVNodesCache[key2] === vnode) {
|
|
623
|
+
delete leavingVNodesCache[key2];
|
|
624
|
+
}
|
|
625
|
+
};
|
|
626
|
+
leavingVNodesCache[key2] = vnode;
|
|
627
|
+
if (onLeave) {
|
|
628
|
+
callAsyncHook(onLeave, [el, done]);
|
|
629
|
+
} else {
|
|
630
|
+
done();
|
|
631
|
+
}
|
|
632
|
+
},
|
|
633
|
+
clone(vnode2) {
|
|
634
|
+
const hooks2 = resolveTransitionHooks(
|
|
635
|
+
vnode2,
|
|
636
|
+
props,
|
|
637
|
+
state,
|
|
638
|
+
instance,
|
|
639
|
+
postClone
|
|
708
640
|
);
|
|
641
|
+
if (postClone) postClone(hooks2);
|
|
642
|
+
return hooks2;
|
|
709
643
|
}
|
|
710
|
-
}
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
eventListener();
|
|
644
|
+
};
|
|
645
|
+
return hooks;
|
|
646
|
+
}
|
|
647
|
+
function emptyPlaceholder(vnode) {
|
|
648
|
+
if (isKeepAlive(vnode)) {
|
|
649
|
+
vnode = cloneVNode(vnode);
|
|
650
|
+
vnode.children = null;
|
|
651
|
+
return vnode;
|
|
719
652
|
}
|
|
720
653
|
}
|
|
721
|
-
function
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
} =
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
)
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
suspense.pendingBranch = vnode.ssContent,
|
|
742
|
-
hiddenContainer,
|
|
743
|
-
null,
|
|
744
|
-
parentComponent,
|
|
745
|
-
suspense,
|
|
746
|
-
namespace,
|
|
747
|
-
slotScopeIds
|
|
748
|
-
);
|
|
749
|
-
if (suspense.deps > 0) {
|
|
750
|
-
triggerEvent(vnode, "onPending");
|
|
751
|
-
triggerEvent(vnode, "onFallback");
|
|
752
|
-
patch(
|
|
753
|
-
null,
|
|
754
|
-
vnode.ssFallback,
|
|
755
|
-
container,
|
|
756
|
-
anchor,
|
|
757
|
-
parentComponent,
|
|
758
|
-
null,
|
|
759
|
-
// fallback tree will not have suspense context
|
|
760
|
-
namespace,
|
|
761
|
-
slotScopeIds
|
|
762
|
-
);
|
|
763
|
-
setActiveBranch(suspense, vnode.ssFallback);
|
|
654
|
+
function getKeepAliveChild(vnode) {
|
|
655
|
+
if (!isKeepAlive(vnode)) {
|
|
656
|
+
return vnode;
|
|
657
|
+
}
|
|
658
|
+
const { shapeFlag, children } = vnode;
|
|
659
|
+
if (children) {
|
|
660
|
+
if (shapeFlag & 16) {
|
|
661
|
+
return children[0];
|
|
662
|
+
}
|
|
663
|
+
if (shapeFlag & 32 && shared.isFunction(children.default)) {
|
|
664
|
+
return children.default();
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
}
|
|
668
|
+
function setTransitionHooks(vnode, hooks) {
|
|
669
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
670
|
+
setTransitionHooks(vnode.component.subTree, hooks);
|
|
671
|
+
} else if (vnode.shapeFlag & 128) {
|
|
672
|
+
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
673
|
+
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
764
674
|
} else {
|
|
765
|
-
|
|
675
|
+
vnode.transition = hooks;
|
|
766
676
|
}
|
|
767
677
|
}
|
|
768
|
-
function
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
patch(
|
|
779
|
-
pendingBranch,
|
|
780
|
-
newBranch,
|
|
781
|
-
suspense.hiddenContainer,
|
|
782
|
-
null,
|
|
783
|
-
parentComponent,
|
|
784
|
-
suspense,
|
|
785
|
-
namespace,
|
|
786
|
-
slotScopeIds,
|
|
787
|
-
optimized
|
|
678
|
+
function getTransitionRawChildren(children, keepComment = false, parentKey) {
|
|
679
|
+
let ret = [];
|
|
680
|
+
let keyedFragmentCount = 0;
|
|
681
|
+
for (let i = 0; i < children.length; i++) {
|
|
682
|
+
let child = children[i];
|
|
683
|
+
const key = parentKey == null ? child.key : String(parentKey) + String(child.key != null ? child.key : i);
|
|
684
|
+
if (child.type === Fragment) {
|
|
685
|
+
if (child.patchFlag & 128) keyedFragmentCount++;
|
|
686
|
+
ret = ret.concat(
|
|
687
|
+
getTransitionRawChildren(child.children, keepComment, key)
|
|
788
688
|
);
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
689
|
+
} else if (keepComment || child.type !== Comment) {
|
|
690
|
+
ret.push(key != null ? cloneVNode(child, { key }) : child);
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
if (keyedFragmentCount > 1) {
|
|
694
|
+
for (let i = 0; i < ret.length; i++) {
|
|
695
|
+
ret[i].patchFlag = -2;
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
return ret;
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
702
|
+
// @__NO_SIDE_EFFECTS__
|
|
703
|
+
function defineComponent(options, extraOptions) {
|
|
704
|
+
return shared.isFunction(options) ? (
|
|
705
|
+
// #8326: extend call and options.name access are considered side-effects
|
|
706
|
+
// by Rollup, so we have to wrap it in a pure-annotated IIFE.
|
|
707
|
+
/* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
|
|
708
|
+
) : options;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
712
|
+
/*! #__NO_SIDE_EFFECTS__ */
|
|
713
|
+
// @__NO_SIDE_EFFECTS__
|
|
714
|
+
function defineAsyncComponent(source) {
|
|
715
|
+
if (shared.isFunction(source)) {
|
|
716
|
+
source = { loader: source };
|
|
717
|
+
}
|
|
718
|
+
const {
|
|
719
|
+
loader,
|
|
720
|
+
loadingComponent,
|
|
721
|
+
errorComponent,
|
|
722
|
+
delay = 200,
|
|
723
|
+
timeout,
|
|
724
|
+
// undefined = never times out
|
|
725
|
+
suspensible = true,
|
|
726
|
+
onError: userOnError
|
|
727
|
+
} = source;
|
|
728
|
+
let pendingRequest = null;
|
|
729
|
+
let resolvedComp;
|
|
730
|
+
let retries = 0;
|
|
731
|
+
const retry = () => {
|
|
732
|
+
retries++;
|
|
733
|
+
pendingRequest = null;
|
|
734
|
+
return load();
|
|
735
|
+
};
|
|
736
|
+
const load = () => {
|
|
737
|
+
let thisRequest;
|
|
738
|
+
return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
|
|
739
|
+
err = err instanceof Error ? err : new Error(String(err));
|
|
740
|
+
if (userOnError) {
|
|
741
|
+
return new Promise((resolve, reject) => {
|
|
742
|
+
const userRetry = () => resolve(retry());
|
|
743
|
+
const userFail = () => reject(err);
|
|
744
|
+
userOnError(err, userRetry, userFail, retries + 1);
|
|
745
|
+
});
|
|
813
746
|
} else {
|
|
814
|
-
|
|
747
|
+
throw err;
|
|
815
748
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
749
|
+
}).then((comp) => {
|
|
750
|
+
if (thisRequest !== pendingRequest && pendingRequest) {
|
|
751
|
+
return pendingRequest;
|
|
752
|
+
}
|
|
753
|
+
if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
|
|
754
|
+
comp = comp.default;
|
|
755
|
+
}
|
|
756
|
+
resolvedComp = comp;
|
|
757
|
+
return comp;
|
|
758
|
+
}));
|
|
759
|
+
};
|
|
760
|
+
return defineComponent({
|
|
761
|
+
name: "AsyncComponentWrapper",
|
|
762
|
+
__asyncLoader: load,
|
|
763
|
+
get __asyncResolved() {
|
|
764
|
+
return resolvedComp;
|
|
765
|
+
},
|
|
766
|
+
setup() {
|
|
767
|
+
const instance = currentInstance;
|
|
768
|
+
if (resolvedComp) {
|
|
769
|
+
return () => createInnerComp(resolvedComp, instance);
|
|
770
|
+
}
|
|
771
|
+
const onError = (err) => {
|
|
772
|
+
pendingRequest = null;
|
|
773
|
+
handleError(
|
|
774
|
+
err,
|
|
775
|
+
instance,
|
|
776
|
+
13,
|
|
777
|
+
!errorComponent
|
|
830
778
|
);
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
779
|
+
};
|
|
780
|
+
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
781
|
+
return load().then((comp) => {
|
|
782
|
+
return () => createInnerComp(comp, instance);
|
|
783
|
+
}).catch((err) => {
|
|
784
|
+
onError(err);
|
|
785
|
+
return () => errorComponent ? createVNode(errorComponent, {
|
|
786
|
+
error: err
|
|
787
|
+
}) : null;
|
|
788
|
+
});
|
|
789
|
+
}
|
|
790
|
+
const loaded = reactivity.ref(false);
|
|
791
|
+
const error = reactivity.ref();
|
|
792
|
+
const delayed = reactivity.ref(!!delay);
|
|
793
|
+
if (delay) {
|
|
794
|
+
setTimeout(() => {
|
|
795
|
+
delayed.value = false;
|
|
796
|
+
}, delay);
|
|
797
|
+
}
|
|
798
|
+
if (timeout != null) {
|
|
799
|
+
setTimeout(() => {
|
|
800
|
+
if (!loaded.value && !error.value) {
|
|
801
|
+
const err = new Error(
|
|
802
|
+
`Async component timed out after ${timeout}ms.`
|
|
803
|
+
);
|
|
804
|
+
onError(err);
|
|
805
|
+
error.value = err;
|
|
806
|
+
}
|
|
807
|
+
}, timeout);
|
|
808
|
+
}
|
|
809
|
+
load().then(() => {
|
|
810
|
+
loaded.value = true;
|
|
811
|
+
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
812
|
+
instance.parent.effect.dirty = true;
|
|
813
|
+
queueJob(instance.parent.update);
|
|
847
814
|
}
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
)
|
|
860
|
-
|
|
861
|
-
} else {
|
|
862
|
-
patch(
|
|
863
|
-
null,
|
|
864
|
-
newBranch,
|
|
865
|
-
suspense.hiddenContainer,
|
|
866
|
-
null,
|
|
867
|
-
parentComponent,
|
|
868
|
-
suspense,
|
|
869
|
-
namespace,
|
|
870
|
-
slotScopeIds,
|
|
871
|
-
optimized
|
|
872
|
-
);
|
|
873
|
-
if (suspense.deps <= 0) {
|
|
874
|
-
suspense.resolve();
|
|
815
|
+
}).catch((err) => {
|
|
816
|
+
onError(err);
|
|
817
|
+
error.value = err;
|
|
818
|
+
});
|
|
819
|
+
return () => {
|
|
820
|
+
if (loaded.value && resolvedComp) {
|
|
821
|
+
return createInnerComp(resolvedComp, instance);
|
|
822
|
+
} else if (error.value && errorComponent) {
|
|
823
|
+
return createVNode(errorComponent, {
|
|
824
|
+
error: error.value
|
|
825
|
+
});
|
|
826
|
+
} else if (loadingComponent && !delayed.value) {
|
|
827
|
+
return createVNode(loadingComponent);
|
|
875
828
|
}
|
|
876
|
-
}
|
|
829
|
+
};
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
function createInnerComp(comp, parent) {
|
|
834
|
+
const { ref: ref2, props, children, ce } = parent.vnode;
|
|
835
|
+
const vnode = createVNode(comp, props, children);
|
|
836
|
+
vnode.ref = ref2;
|
|
837
|
+
vnode.ce = ce;
|
|
838
|
+
delete parent.vnode.ce;
|
|
839
|
+
return vnode;
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
|
|
843
|
+
const KeepAliveImpl = {
|
|
844
|
+
name: `KeepAlive`,
|
|
845
|
+
// Marker for special handling inside the renderer. We are not using a ===
|
|
846
|
+
// check directly on KeepAlive in the renderer, because importing it directly
|
|
847
|
+
// would prevent it from being tree-shaken.
|
|
848
|
+
__isKeepAlive: true,
|
|
849
|
+
props: {
|
|
850
|
+
include: [String, RegExp, Array],
|
|
851
|
+
exclude: [String, RegExp, Array],
|
|
852
|
+
max: [String, Number]
|
|
853
|
+
},
|
|
854
|
+
setup(props, { slots }) {
|
|
855
|
+
const instance = getCurrentInstance();
|
|
856
|
+
const sharedContext = instance.ctx;
|
|
857
|
+
if (!sharedContext.renderer) {
|
|
858
|
+
return () => {
|
|
859
|
+
const children = slots.default && slots.default();
|
|
860
|
+
return children && children.length === 1 ? children[0] : children;
|
|
861
|
+
};
|
|
877
862
|
}
|
|
878
|
-
|
|
879
|
-
|
|
863
|
+
const cache = /* @__PURE__ */ new Map();
|
|
864
|
+
const keys = /* @__PURE__ */ new Set();
|
|
865
|
+
let current = null;
|
|
866
|
+
const parentSuspense = instance.suspense;
|
|
867
|
+
const {
|
|
868
|
+
renderer: {
|
|
869
|
+
p: patch,
|
|
870
|
+
m: move,
|
|
871
|
+
um: _unmount,
|
|
872
|
+
o: { createElement }
|
|
873
|
+
}
|
|
874
|
+
} = sharedContext;
|
|
875
|
+
const storageContainer = createElement("div");
|
|
876
|
+
sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
|
|
877
|
+
const instance2 = vnode.component;
|
|
878
|
+
move(vnode, container, anchor, 0, parentSuspense);
|
|
880
879
|
patch(
|
|
881
|
-
|
|
882
|
-
|
|
880
|
+
instance2.vnode,
|
|
881
|
+
vnode,
|
|
883
882
|
container,
|
|
884
883
|
anchor,
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
namespace,
|
|
888
|
-
slotScopeIds,
|
|
889
|
-
optimized
|
|
890
|
-
);
|
|
891
|
-
setActiveBranch(suspense, newBranch);
|
|
892
|
-
} else {
|
|
893
|
-
triggerEvent(n2, "onPending");
|
|
894
|
-
suspense.pendingBranch = newBranch;
|
|
895
|
-
if (newBranch.shapeFlag & 512) {
|
|
896
|
-
suspense.pendingId = newBranch.component.suspenseId;
|
|
897
|
-
} else {
|
|
898
|
-
suspense.pendingId = suspenseId++;
|
|
899
|
-
}
|
|
900
|
-
patch(
|
|
901
|
-
null,
|
|
902
|
-
newBranch,
|
|
903
|
-
suspense.hiddenContainer,
|
|
904
|
-
null,
|
|
905
|
-
parentComponent,
|
|
906
|
-
suspense,
|
|
884
|
+
instance2,
|
|
885
|
+
parentSuspense,
|
|
907
886
|
namespace,
|
|
908
|
-
slotScopeIds,
|
|
887
|
+
vnode.slotScopeIds,
|
|
909
888
|
optimized
|
|
910
889
|
);
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
if (timeout > 0) {
|
|
916
|
-
setTimeout(() => {
|
|
917
|
-
if (suspense.pendingId === pendingId) {
|
|
918
|
-
suspense.fallback(newFallback);
|
|
919
|
-
}
|
|
920
|
-
}, timeout);
|
|
921
|
-
} else if (timeout === 0) {
|
|
922
|
-
suspense.fallback(newFallback);
|
|
890
|
+
queuePostRenderEffect(() => {
|
|
891
|
+
instance2.isDeactivated = false;
|
|
892
|
+
if (instance2.a) {
|
|
893
|
+
shared.invokeArrayFns(instance2.a);
|
|
923
894
|
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
}
|
|
928
|
-
function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
|
|
929
|
-
const {
|
|
930
|
-
p: patch,
|
|
931
|
-
m: move,
|
|
932
|
-
um: unmount,
|
|
933
|
-
n: next,
|
|
934
|
-
o: { parentNode, remove }
|
|
935
|
-
} = rendererInternals;
|
|
936
|
-
let parentSuspenseId;
|
|
937
|
-
const isSuspensible = isVNodeSuspensible(vnode);
|
|
938
|
-
if (isSuspensible) {
|
|
939
|
-
if (parentSuspense && parentSuspense.pendingBranch) {
|
|
940
|
-
parentSuspenseId = parentSuspense.pendingId;
|
|
941
|
-
parentSuspense.deps++;
|
|
942
|
-
}
|
|
943
|
-
}
|
|
944
|
-
const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
|
|
945
|
-
const initialAnchor = anchor;
|
|
946
|
-
const suspense = {
|
|
947
|
-
vnode,
|
|
948
|
-
parent: parentSuspense,
|
|
949
|
-
parentComponent,
|
|
950
|
-
namespace,
|
|
951
|
-
container,
|
|
952
|
-
hiddenContainer,
|
|
953
|
-
deps: 0,
|
|
954
|
-
pendingId: suspenseId++,
|
|
955
|
-
timeout: typeof timeout === "number" ? timeout : -1,
|
|
956
|
-
activeBranch: null,
|
|
957
|
-
pendingBranch: null,
|
|
958
|
-
isInFallback: !isHydrating,
|
|
959
|
-
isHydrating,
|
|
960
|
-
isUnmounted: false,
|
|
961
|
-
effects: [],
|
|
962
|
-
resolve(resume = false, sync = false) {
|
|
963
|
-
const {
|
|
964
|
-
vnode: vnode2,
|
|
965
|
-
activeBranch,
|
|
966
|
-
pendingBranch,
|
|
967
|
-
pendingId,
|
|
968
|
-
effects,
|
|
969
|
-
parentComponent: parentComponent2,
|
|
970
|
-
container: container2
|
|
971
|
-
} = suspense;
|
|
972
|
-
let delayEnter = false;
|
|
973
|
-
if (suspense.isHydrating) {
|
|
974
|
-
suspense.isHydrating = false;
|
|
975
|
-
} else if (!resume) {
|
|
976
|
-
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
977
|
-
if (delayEnter) {
|
|
978
|
-
activeBranch.transition.afterLeave = () => {
|
|
979
|
-
if (pendingId === suspense.pendingId) {
|
|
980
|
-
move(
|
|
981
|
-
pendingBranch,
|
|
982
|
-
container2,
|
|
983
|
-
anchor === initialAnchor ? next(activeBranch) : anchor,
|
|
984
|
-
0
|
|
985
|
-
);
|
|
986
|
-
queuePostFlushCb(effects);
|
|
987
|
-
}
|
|
988
|
-
};
|
|
895
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
896
|
+
if (vnodeHook) {
|
|
897
|
+
invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
|
989
898
|
}
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
899
|
+
}, parentSuspense);
|
|
900
|
+
};
|
|
901
|
+
sharedContext.deactivate = (vnode) => {
|
|
902
|
+
const instance2 = vnode.component;
|
|
903
|
+
invalidateMount(instance2.m);
|
|
904
|
+
invalidateMount(instance2.a);
|
|
905
|
+
move(vnode, storageContainer, null, 1, parentSuspense);
|
|
906
|
+
queuePostRenderEffect(() => {
|
|
907
|
+
if (instance2.da) {
|
|
908
|
+
shared.invokeArrayFns(instance2.da);
|
|
995
909
|
}
|
|
996
|
-
|
|
997
|
-
|
|
910
|
+
const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
|
911
|
+
if (vnodeHook) {
|
|
912
|
+
invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
|
998
913
|
}
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
914
|
+
instance2.isDeactivated = true;
|
|
915
|
+
}, parentSuspense);
|
|
916
|
+
};
|
|
917
|
+
function unmount(vnode) {
|
|
918
|
+
resetShapeFlag(vnode);
|
|
919
|
+
_unmount(vnode, instance, parentSuspense, true);
|
|
920
|
+
}
|
|
921
|
+
function pruneCache(filter) {
|
|
922
|
+
cache.forEach((vnode, key) => {
|
|
923
|
+
const name = getComponentName(vnode.type);
|
|
924
|
+
if (name && (!filter || !filter(name))) {
|
|
925
|
+
pruneCacheEntry(key);
|
|
1010
926
|
}
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
function pruneCacheEntry(key) {
|
|
930
|
+
const cached = cache.get(key);
|
|
931
|
+
if (cached && (!current || !isSameVNodeType(cached, current))) {
|
|
932
|
+
unmount(cached);
|
|
933
|
+
} else if (current) {
|
|
934
|
+
resetShapeFlag(current);
|
|
1015
935
|
}
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
936
|
+
cache.delete(key);
|
|
937
|
+
keys.delete(key);
|
|
938
|
+
}
|
|
939
|
+
watch(
|
|
940
|
+
() => [props.include, props.exclude],
|
|
941
|
+
([include, exclude]) => {
|
|
942
|
+
include && pruneCache((name) => matches(include, name));
|
|
943
|
+
exclude && pruneCache((name) => !matches(exclude, name));
|
|
944
|
+
},
|
|
945
|
+
// prune post-render after `current` has been updated
|
|
946
|
+
{ flush: "post", deep: true }
|
|
947
|
+
);
|
|
948
|
+
let pendingCacheKey = null;
|
|
949
|
+
const cacheSubtree = () => {
|
|
950
|
+
if (pendingCacheKey != null) {
|
|
951
|
+
if (isSuspense(instance.subTree.type)) {
|
|
952
|
+
queuePostRenderEffect(() => {
|
|
953
|
+
cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
|
954
|
+
}, instance.subTree.suspense);
|
|
955
|
+
} else {
|
|
956
|
+
cache.set(pendingCacheKey, getInnerChild(instance.subTree));
|
|
1023
957
|
}
|
|
1024
958
|
}
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
959
|
+
};
|
|
960
|
+
onMounted(cacheSubtree);
|
|
961
|
+
onUpdated(cacheSubtree);
|
|
962
|
+
onBeforeUnmount(() => {
|
|
963
|
+
cache.forEach((cached) => {
|
|
964
|
+
const { subTree, suspense } = instance;
|
|
965
|
+
const vnode = getInnerChild(subTree);
|
|
966
|
+
if (cached.type === vnode.type && cached.key === vnode.key) {
|
|
967
|
+
resetShapeFlag(vnode);
|
|
968
|
+
const da = vnode.component.da;
|
|
969
|
+
da && queuePostRenderEffect(da, suspense);
|
|
1036
970
|
return;
|
|
1037
971
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
// fallback tree will not have suspense context
|
|
1046
|
-
namespace2,
|
|
1047
|
-
slotScopeIds,
|
|
1048
|
-
optimized
|
|
1049
|
-
);
|
|
1050
|
-
setActiveBranch(suspense, fallbackVNode);
|
|
1051
|
-
};
|
|
1052
|
-
const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
|
1053
|
-
if (delayEnter) {
|
|
1054
|
-
activeBranch.transition.afterLeave = mountFallback;
|
|
972
|
+
unmount(cached);
|
|
973
|
+
});
|
|
974
|
+
});
|
|
975
|
+
return () => {
|
|
976
|
+
pendingCacheKey = null;
|
|
977
|
+
if (!slots.default) {
|
|
978
|
+
return null;
|
|
1055
979
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
);
|
|
1065
|
-
if (!delayEnter) {
|
|
1066
|
-
mountFallback();
|
|
980
|
+
const children = slots.default();
|
|
981
|
+
const rawVNode = children[0];
|
|
982
|
+
if (children.length > 1) {
|
|
983
|
+
current = null;
|
|
984
|
+
return children;
|
|
985
|
+
} else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
|
|
986
|
+
current = null;
|
|
987
|
+
return rawVNode;
|
|
1067
988
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
},
|
|
1073
|
-
next() {
|
|
1074
|
-
return suspense.activeBranch && next(suspense.activeBranch);
|
|
1075
|
-
},
|
|
1076
|
-
registerDep(instance, setupRenderEffect, optimized2) {
|
|
1077
|
-
const isInPendingSuspense = !!suspense.pendingBranch;
|
|
1078
|
-
if (isInPendingSuspense) {
|
|
1079
|
-
suspense.deps++;
|
|
989
|
+
let vnode = getInnerChild(rawVNode);
|
|
990
|
+
if (vnode.type === Comment) {
|
|
991
|
+
current = null;
|
|
992
|
+
return vnode;
|
|
1080
993
|
}
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
994
|
+
const comp = vnode.type;
|
|
995
|
+
const name = getComponentName(
|
|
996
|
+
isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
|
|
997
|
+
);
|
|
998
|
+
const { include, exclude, max } = props;
|
|
999
|
+
if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
|
|
1000
|
+
current = vnode;
|
|
1001
|
+
return rawVNode;
|
|
1002
|
+
}
|
|
1003
|
+
const key = vnode.key == null ? comp : vnode.key;
|
|
1004
|
+
const cachedVNode = cache.get(key);
|
|
1005
|
+
if (vnode.el) {
|
|
1006
|
+
vnode = cloneVNode(vnode);
|
|
1007
|
+
if (rawVNode.shapeFlag & 128) {
|
|
1008
|
+
rawVNode.ssContent = vnode;
|
|
1093
1009
|
}
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
parentNode(hydratedEl || instance.subTree.el),
|
|
1102
|
-
// anchor will not be used if this is hydration, so only need to
|
|
1103
|
-
// consider the comment placeholder case.
|
|
1104
|
-
hydratedEl ? null : next(instance.subTree),
|
|
1105
|
-
suspense,
|
|
1106
|
-
namespace,
|
|
1107
|
-
optimized2
|
|
1108
|
-
);
|
|
1109
|
-
if (placeholder) {
|
|
1110
|
-
remove(placeholder);
|
|
1010
|
+
}
|
|
1011
|
+
pendingCacheKey = key;
|
|
1012
|
+
if (cachedVNode) {
|
|
1013
|
+
vnode.el = cachedVNode.el;
|
|
1014
|
+
vnode.component = cachedVNode.component;
|
|
1015
|
+
if (vnode.transition) {
|
|
1016
|
+
setTransitionHooks(vnode, vnode.transition);
|
|
1111
1017
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1018
|
+
vnode.shapeFlag |= 512;
|
|
1019
|
+
keys.delete(key);
|
|
1020
|
+
keys.add(key);
|
|
1021
|
+
} else {
|
|
1022
|
+
keys.add(key);
|
|
1023
|
+
if (max && keys.size > parseInt(max, 10)) {
|
|
1024
|
+
pruneCacheEntry(keys.values().next().value);
|
|
1115
1025
|
}
|
|
1116
|
-
});
|
|
1117
|
-
},
|
|
1118
|
-
unmount(parentSuspense2, doRemove) {
|
|
1119
|
-
suspense.isUnmounted = true;
|
|
1120
|
-
if (suspense.activeBranch) {
|
|
1121
|
-
unmount(
|
|
1122
|
-
suspense.activeBranch,
|
|
1123
|
-
parentComponent,
|
|
1124
|
-
parentSuspense2,
|
|
1125
|
-
doRemove
|
|
1126
|
-
);
|
|
1127
|
-
}
|
|
1128
|
-
if (suspense.pendingBranch) {
|
|
1129
|
-
unmount(
|
|
1130
|
-
suspense.pendingBranch,
|
|
1131
|
-
parentComponent,
|
|
1132
|
-
parentSuspense2,
|
|
1133
|
-
doRemove
|
|
1134
|
-
);
|
|
1135
1026
|
}
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
}
|
|
1140
|
-
function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
|
|
1141
|
-
const suspense = vnode.suspense = createSuspenseBoundary(
|
|
1142
|
-
vnode,
|
|
1143
|
-
parentSuspense,
|
|
1144
|
-
parentComponent,
|
|
1145
|
-
node.parentNode,
|
|
1146
|
-
// eslint-disable-next-line no-restricted-globals
|
|
1147
|
-
document.createElement("div"),
|
|
1148
|
-
null,
|
|
1149
|
-
namespace,
|
|
1150
|
-
slotScopeIds,
|
|
1151
|
-
optimized,
|
|
1152
|
-
rendererInternals,
|
|
1153
|
-
true
|
|
1154
|
-
);
|
|
1155
|
-
const result = hydrateNode(
|
|
1156
|
-
node,
|
|
1157
|
-
suspense.pendingBranch = vnode.ssContent,
|
|
1158
|
-
parentComponent,
|
|
1159
|
-
suspense,
|
|
1160
|
-
slotScopeIds,
|
|
1161
|
-
optimized
|
|
1162
|
-
);
|
|
1163
|
-
if (suspense.deps === 0) {
|
|
1164
|
-
suspense.resolve(false, true);
|
|
1027
|
+
vnode.shapeFlag |= 256;
|
|
1028
|
+
current = vnode;
|
|
1029
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
1030
|
+
};
|
|
1165
1031
|
}
|
|
1166
|
-
|
|
1032
|
+
};
|
|
1033
|
+
const KeepAlive = KeepAliveImpl;
|
|
1034
|
+
function matches(pattern, name) {
|
|
1035
|
+
if (shared.isArray(pattern)) {
|
|
1036
|
+
return pattern.some((p) => matches(p, name));
|
|
1037
|
+
} else if (shared.isString(pattern)) {
|
|
1038
|
+
return pattern.split(",").includes(name);
|
|
1039
|
+
} else if (shared.isRegExp(pattern)) {
|
|
1040
|
+
return pattern.test(name);
|
|
1041
|
+
}
|
|
1042
|
+
return false;
|
|
1167
1043
|
}
|
|
1168
|
-
function
|
|
1169
|
-
|
|
1170
|
-
const isSlotChildren = shapeFlag & 32;
|
|
1171
|
-
vnode.ssContent = normalizeSuspenseSlot(
|
|
1172
|
-
isSlotChildren ? children.default : children
|
|
1173
|
-
);
|
|
1174
|
-
vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
|
|
1044
|
+
function onActivated(hook, target) {
|
|
1045
|
+
registerKeepAliveHook(hook, "a", target);
|
|
1175
1046
|
}
|
|
1176
|
-
function
|
|
1177
|
-
|
|
1178
|
-
if (shared.isFunction(s)) {
|
|
1179
|
-
const trackBlock = isBlockTreeEnabled && s._c;
|
|
1180
|
-
if (trackBlock) {
|
|
1181
|
-
s._d = false;
|
|
1182
|
-
openBlock();
|
|
1183
|
-
}
|
|
1184
|
-
s = s();
|
|
1185
|
-
if (trackBlock) {
|
|
1186
|
-
s._d = true;
|
|
1187
|
-
block = currentBlock;
|
|
1188
|
-
closeBlock();
|
|
1189
|
-
}
|
|
1190
|
-
}
|
|
1191
|
-
if (shared.isArray(s)) {
|
|
1192
|
-
const singleChild = filterSingleRoot(s);
|
|
1193
|
-
s = singleChild;
|
|
1194
|
-
}
|
|
1195
|
-
s = normalizeVNode(s);
|
|
1196
|
-
if (block && !s.dynamicChildren) {
|
|
1197
|
-
s.dynamicChildren = block.filter((c) => c !== s);
|
|
1198
|
-
}
|
|
1199
|
-
return s;
|
|
1047
|
+
function onDeactivated(hook, target) {
|
|
1048
|
+
registerKeepAliveHook(hook, "da", target);
|
|
1200
1049
|
}
|
|
1201
|
-
function
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1050
|
+
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
1051
|
+
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
1052
|
+
let current = target;
|
|
1053
|
+
while (current) {
|
|
1054
|
+
if (current.isDeactivated) {
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
1057
|
+
current = current.parent;
|
|
1058
|
+
}
|
|
1059
|
+
return hook();
|
|
1060
|
+
});
|
|
1061
|
+
injectHook(type, wrappedHook, target);
|
|
1062
|
+
if (target) {
|
|
1063
|
+
let current = target.parent;
|
|
1064
|
+
while (current && current.parent) {
|
|
1065
|
+
if (isKeepAlive(current.parent.vnode)) {
|
|
1066
|
+
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
1067
|
+
}
|
|
1068
|
+
current = current.parent;
|
|
1207
1069
|
}
|
|
1208
|
-
} else {
|
|
1209
|
-
queuePostFlushCb(fn);
|
|
1210
|
-
}
|
|
1211
|
-
}
|
|
1212
|
-
function setActiveBranch(suspense, branch) {
|
|
1213
|
-
suspense.activeBranch = branch;
|
|
1214
|
-
const { vnode, parentComponent } = suspense;
|
|
1215
|
-
let el = branch.el;
|
|
1216
|
-
while (!el && branch.component) {
|
|
1217
|
-
branch = branch.component.subTree;
|
|
1218
|
-
el = branch.el;
|
|
1219
|
-
}
|
|
1220
|
-
vnode.el = el;
|
|
1221
|
-
if (parentComponent && parentComponent.subTree === vnode) {
|
|
1222
|
-
parentComponent.vnode.el = el;
|
|
1223
|
-
updateHOCHostEl(parentComponent, el);
|
|
1224
1070
|
}
|
|
1225
1071
|
}
|
|
1226
|
-
function
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1072
|
+
function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
1073
|
+
const injected = injectHook(
|
|
1074
|
+
type,
|
|
1075
|
+
hook,
|
|
1076
|
+
keepAliveRoot,
|
|
1077
|
+
true
|
|
1078
|
+
/* prepend */
|
|
1079
|
+
);
|
|
1080
|
+
onUnmounted(() => {
|
|
1081
|
+
shared.remove(keepAliveRoot[type], injected);
|
|
1082
|
+
}, target);
|
|
1083
|
+
}
|
|
1084
|
+
function resetShapeFlag(vnode) {
|
|
1085
|
+
vnode.shapeFlag &= ~256;
|
|
1086
|
+
vnode.shapeFlag &= ~512;
|
|
1087
|
+
}
|
|
1088
|
+
function getInnerChild(vnode) {
|
|
1089
|
+
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
|
1229
1090
|
}
|
|
1230
1091
|
|
|
1231
1092
|
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
@@ -1272,57 +1133,50 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
1272
1133
|
injectHook("ec", hook, target);
|
|
1273
1134
|
}
|
|
1274
1135
|
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
mounted: dir,
|
|
1287
|
-
updated: dir
|
|
1288
|
-
};
|
|
1289
|
-
}
|
|
1290
|
-
if (dir.deep) {
|
|
1291
|
-
traverse(value);
|
|
1292
|
-
}
|
|
1293
|
-
bindings.push({
|
|
1294
|
-
dir,
|
|
1295
|
-
instance,
|
|
1296
|
-
value,
|
|
1297
|
-
oldValue: void 0,
|
|
1298
|
-
arg,
|
|
1299
|
-
modifiers
|
|
1300
|
-
});
|
|
1301
|
-
}
|
|
1136
|
+
const COMPONENTS = "components";
|
|
1137
|
+
const DIRECTIVES = "directives";
|
|
1138
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
1139
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
1140
|
+
}
|
|
1141
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
1142
|
+
function resolveDynamicComponent(component) {
|
|
1143
|
+
if (shared.isString(component)) {
|
|
1144
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
1145
|
+
} else {
|
|
1146
|
+
return component || NULL_DYNAMIC_COMPONENT;
|
|
1302
1147
|
}
|
|
1303
|
-
return vnode;
|
|
1304
1148
|
}
|
|
1305
|
-
function
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1149
|
+
function resolveDirective(name) {
|
|
1150
|
+
return resolveAsset(DIRECTIVES, name);
|
|
1151
|
+
}
|
|
1152
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
1153
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
1154
|
+
if (instance) {
|
|
1155
|
+
const Component = instance.type;
|
|
1156
|
+
if (type === COMPONENTS) {
|
|
1157
|
+
const selfName = getComponentName(
|
|
1158
|
+
Component,
|
|
1159
|
+
false
|
|
1160
|
+
);
|
|
1161
|
+
if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
|
|
1162
|
+
return Component;
|
|
1163
|
+
}
|
|
1312
1164
|
}
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
]);
|
|
1322
|
-
reactivity.resetTracking();
|
|
1165
|
+
const res = (
|
|
1166
|
+
// local registration
|
|
1167
|
+
// check instance[type] first which is resolved for options API
|
|
1168
|
+
resolve(instance[type] || Component[type], name) || // global registration
|
|
1169
|
+
resolve(instance.appContext[type], name)
|
|
1170
|
+
);
|
|
1171
|
+
if (!res && maybeSelfReference) {
|
|
1172
|
+
return Component;
|
|
1323
1173
|
}
|
|
1174
|
+
return res;
|
|
1324
1175
|
}
|
|
1325
1176
|
}
|
|
1177
|
+
function resolve(registry, name) {
|
|
1178
|
+
return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
|
|
1179
|
+
}
|
|
1326
1180
|
|
|
1327
1181
|
function renderList(source, renderItem, cache, index) {
|
|
1328
1182
|
let ret;
|
|
@@ -1378,147 +1232,6 @@ function createSlots(slots, dynamicSlots) {
|
|
|
1378
1232
|
return slots;
|
|
1379
1233
|
}
|
|
1380
1234
|
|
|
1381
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
1382
|
-
// @__NO_SIDE_EFFECTS__
|
|
1383
|
-
function defineComponent(options, extraOptions) {
|
|
1384
|
-
return shared.isFunction(options) ? (
|
|
1385
|
-
// #8326: extend call and options.name access are considered side-effects
|
|
1386
|
-
// by Rollup, so we have to wrap it in a pure-annotated IIFE.
|
|
1387
|
-
/* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
|
|
1388
|
-
) : options;
|
|
1389
|
-
}
|
|
1390
|
-
|
|
1391
|
-
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
1392
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
1393
|
-
// @__NO_SIDE_EFFECTS__
|
|
1394
|
-
function defineAsyncComponent(source) {
|
|
1395
|
-
if (shared.isFunction(source)) {
|
|
1396
|
-
source = { loader: source };
|
|
1397
|
-
}
|
|
1398
|
-
const {
|
|
1399
|
-
loader,
|
|
1400
|
-
loadingComponent,
|
|
1401
|
-
errorComponent,
|
|
1402
|
-
delay = 200,
|
|
1403
|
-
timeout,
|
|
1404
|
-
// undefined = never times out
|
|
1405
|
-
suspensible = true,
|
|
1406
|
-
onError: userOnError
|
|
1407
|
-
} = source;
|
|
1408
|
-
let pendingRequest = null;
|
|
1409
|
-
let resolvedComp;
|
|
1410
|
-
let retries = 0;
|
|
1411
|
-
const retry = () => {
|
|
1412
|
-
retries++;
|
|
1413
|
-
pendingRequest = null;
|
|
1414
|
-
return load();
|
|
1415
|
-
};
|
|
1416
|
-
const load = () => {
|
|
1417
|
-
let thisRequest;
|
|
1418
|
-
return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
|
|
1419
|
-
err = err instanceof Error ? err : new Error(String(err));
|
|
1420
|
-
if (userOnError) {
|
|
1421
|
-
return new Promise((resolve, reject) => {
|
|
1422
|
-
const userRetry = () => resolve(retry());
|
|
1423
|
-
const userFail = () => reject(err);
|
|
1424
|
-
userOnError(err, userRetry, userFail, retries + 1);
|
|
1425
|
-
});
|
|
1426
|
-
} else {
|
|
1427
|
-
throw err;
|
|
1428
|
-
}
|
|
1429
|
-
}).then((comp) => {
|
|
1430
|
-
if (thisRequest !== pendingRequest && pendingRequest) {
|
|
1431
|
-
return pendingRequest;
|
|
1432
|
-
}
|
|
1433
|
-
if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
|
|
1434
|
-
comp = comp.default;
|
|
1435
|
-
}
|
|
1436
|
-
resolvedComp = comp;
|
|
1437
|
-
return comp;
|
|
1438
|
-
}));
|
|
1439
|
-
};
|
|
1440
|
-
return defineComponent({
|
|
1441
|
-
name: "AsyncComponentWrapper",
|
|
1442
|
-
__asyncLoader: load,
|
|
1443
|
-
get __asyncResolved() {
|
|
1444
|
-
return resolvedComp;
|
|
1445
|
-
},
|
|
1446
|
-
setup() {
|
|
1447
|
-
const instance = currentInstance;
|
|
1448
|
-
if (resolvedComp) {
|
|
1449
|
-
return () => createInnerComp(resolvedComp, instance);
|
|
1450
|
-
}
|
|
1451
|
-
const onError = (err) => {
|
|
1452
|
-
pendingRequest = null;
|
|
1453
|
-
handleError(
|
|
1454
|
-
err,
|
|
1455
|
-
instance,
|
|
1456
|
-
13,
|
|
1457
|
-
!errorComponent
|
|
1458
|
-
);
|
|
1459
|
-
};
|
|
1460
|
-
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
1461
|
-
return load().then((comp) => {
|
|
1462
|
-
return () => createInnerComp(comp, instance);
|
|
1463
|
-
}).catch((err) => {
|
|
1464
|
-
onError(err);
|
|
1465
|
-
return () => errorComponent ? createVNode(errorComponent, {
|
|
1466
|
-
error: err
|
|
1467
|
-
}) : null;
|
|
1468
|
-
});
|
|
1469
|
-
}
|
|
1470
|
-
const loaded = reactivity.ref(false);
|
|
1471
|
-
const error = reactivity.ref();
|
|
1472
|
-
const delayed = reactivity.ref(!!delay);
|
|
1473
|
-
if (delay) {
|
|
1474
|
-
setTimeout(() => {
|
|
1475
|
-
delayed.value = false;
|
|
1476
|
-
}, delay);
|
|
1477
|
-
}
|
|
1478
|
-
if (timeout != null) {
|
|
1479
|
-
setTimeout(() => {
|
|
1480
|
-
if (!loaded.value && !error.value) {
|
|
1481
|
-
const err = new Error(
|
|
1482
|
-
`Async component timed out after ${timeout}ms.`
|
|
1483
|
-
);
|
|
1484
|
-
onError(err);
|
|
1485
|
-
error.value = err;
|
|
1486
|
-
}
|
|
1487
|
-
}, timeout);
|
|
1488
|
-
}
|
|
1489
|
-
load().then(() => {
|
|
1490
|
-
loaded.value = true;
|
|
1491
|
-
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
1492
|
-
instance.parent.effect.dirty = true;
|
|
1493
|
-
queueJob(instance.parent.update);
|
|
1494
|
-
}
|
|
1495
|
-
}).catch((err) => {
|
|
1496
|
-
onError(err);
|
|
1497
|
-
error.value = err;
|
|
1498
|
-
});
|
|
1499
|
-
return () => {
|
|
1500
|
-
if (loaded.value && resolvedComp) {
|
|
1501
|
-
return createInnerComp(resolvedComp, instance);
|
|
1502
|
-
} else if (error.value && errorComponent) {
|
|
1503
|
-
return createVNode(errorComponent, {
|
|
1504
|
-
error: error.value
|
|
1505
|
-
});
|
|
1506
|
-
} else if (loadingComponent && !delayed.value) {
|
|
1507
|
-
return createVNode(loadingComponent);
|
|
1508
|
-
}
|
|
1509
|
-
};
|
|
1510
|
-
}
|
|
1511
|
-
});
|
|
1512
|
-
}
|
|
1513
|
-
function createInnerComp(comp, parent) {
|
|
1514
|
-
const { ref: ref2, props, children, ce } = parent.vnode;
|
|
1515
|
-
const vnode = createVNode(comp, props, children);
|
|
1516
|
-
vnode.ref = ref2;
|
|
1517
|
-
vnode.ce = ce;
|
|
1518
|
-
delete parent.vnode.ce;
|
|
1519
|
-
return vnode;
|
|
1520
|
-
}
|
|
1521
|
-
|
|
1522
1235
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
1523
1236
|
if (currentRenderingInstance.isCE || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.isCE) {
|
|
1524
1237
|
if (name !== "default") props.name = name;
|
|
@@ -1533,9 +1246,10 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
1533
1246
|
const rendered = createBlock(
|
|
1534
1247
|
Fragment,
|
|
1535
1248
|
{
|
|
1536
|
-
key: props.key || // slot content array of a dynamic conditional slot may have a branch
|
|
1249
|
+
key: (props.key || // slot content array of a dynamic conditional slot may have a branch
|
|
1537
1250
|
// key attached in the `createSlots` helper, respect that
|
|
1538
|
-
validSlotContent && validSlotContent.key || `_${name}`
|
|
1251
|
+
validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
|
|
1252
|
+
(!validSlotContent && fallback ? "_fb" : "")
|
|
1539
1253
|
},
|
|
1540
1254
|
validSlotContent || (fallback ? fallback() : []),
|
|
1541
1255
|
validSlotContent && slots._ === 1 ? 64 : -2
|
|
@@ -2261,7 +1975,7 @@ function provide(key, value) {
|
|
|
2261
1975
|
function inject(key, defaultValue, treatDefaultAsFactory = false) {
|
|
2262
1976
|
const instance = currentInstance || currentRenderingInstance;
|
|
2263
1977
|
if (instance || currentApp) {
|
|
2264
|
-
const provides = instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides :
|
|
1978
|
+
const provides = currentApp ? currentApp._context.provides : instance ? instance.parent == null ? instance.vnode.appContext && instance.vnode.appContext.provides : instance.parent.provides : void 0;
|
|
2265
1979
|
if (provides && key in provides) {
|
|
2266
1980
|
return provides[key];
|
|
2267
1981
|
} else if (arguments.length > 1) {
|
|
@@ -2461,8 +2175,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
2461
2175
|
}
|
|
2462
2176
|
return value;
|
|
2463
2177
|
}
|
|
2178
|
+
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
2464
2179
|
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
2465
|
-
const cache = appContext.propsCache;
|
|
2180
|
+
const cache = asMixin ? mixinPropsCache : appContext.propsCache;
|
|
2466
2181
|
const cached = cache.get(comp);
|
|
2467
2182
|
if (cached) {
|
|
2468
2183
|
return cached;
|
|
@@ -2507,14 +2222,27 @@ function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
|
2507
2222
|
if (validatePropName(normalizedKey)) {
|
|
2508
2223
|
const opt = raw[key];
|
|
2509
2224
|
const prop = normalized[normalizedKey] = shared.isArray(opt) || shared.isFunction(opt) ? { type: opt } : shared.extend({}, opt);
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2225
|
+
const propType = prop.type;
|
|
2226
|
+
let shouldCast = false;
|
|
2227
|
+
let shouldCastTrue = true;
|
|
2228
|
+
if (shared.isArray(propType)) {
|
|
2229
|
+
for (let index = 0; index < propType.length; ++index) {
|
|
2230
|
+
const type = propType[index];
|
|
2231
|
+
const typeName = shared.isFunction(type) && type.name;
|
|
2232
|
+
if (typeName === "Boolean") {
|
|
2233
|
+
shouldCast = true;
|
|
2234
|
+
break;
|
|
2235
|
+
} else if (typeName === "String") {
|
|
2236
|
+
shouldCastTrue = false;
|
|
2237
|
+
}
|
|
2517
2238
|
}
|
|
2239
|
+
} else {
|
|
2240
|
+
shouldCast = shared.isFunction(propType) && propType.name === "Boolean";
|
|
2241
|
+
}
|
|
2242
|
+
prop[0 /* shouldCast */] = shouldCast;
|
|
2243
|
+
prop[1 /* shouldCastTrue */] = shouldCastTrue;
|
|
2244
|
+
if (shouldCast || shared.hasOwn(prop, "default")) {
|
|
2245
|
+
needCastKeys.push(normalizedKey);
|
|
2518
2246
|
}
|
|
2519
2247
|
}
|
|
2520
2248
|
}
|
|
@@ -2531,29 +2259,6 @@ function validatePropName(key) {
|
|
|
2531
2259
|
}
|
|
2532
2260
|
return false;
|
|
2533
2261
|
}
|
|
2534
|
-
function getType(ctor) {
|
|
2535
|
-
if (ctor === null) {
|
|
2536
|
-
return "null";
|
|
2537
|
-
}
|
|
2538
|
-
if (typeof ctor === "function") {
|
|
2539
|
-
return ctor.name || "";
|
|
2540
|
-
} else if (typeof ctor === "object") {
|
|
2541
|
-
const name = ctor.constructor && ctor.constructor.name;
|
|
2542
|
-
return name || "";
|
|
2543
|
-
}
|
|
2544
|
-
return "";
|
|
2545
|
-
}
|
|
2546
|
-
function isSameType(a, b) {
|
|
2547
|
-
return getType(a) === getType(b);
|
|
2548
|
-
}
|
|
2549
|
-
function getTypeIndex(type, expectedTypes) {
|
|
2550
|
-
if (shared.isArray(expectedTypes)) {
|
|
2551
|
-
return expectedTypes.findIndex((t) => isSameType(t, type));
|
|
2552
|
-
} else if (shared.isFunction(expectedTypes)) {
|
|
2553
|
-
return isSameType(expectedTypes, type) ? 0 : -1;
|
|
2554
|
-
}
|
|
2555
|
-
return -1;
|
|
2556
|
-
}
|
|
2557
2262
|
|
|
2558
2263
|
const isInternalKey = (key) => key[0] === "_" || key === "$stable";
|
|
2559
2264
|
const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
|
|
@@ -2585,13 +2290,22 @@ const normalizeVNodeSlots = (instance, children) => {
|
|
|
2585
2290
|
const normalized = normalizeSlotValue(children);
|
|
2586
2291
|
instance.slots.default = () => normalized;
|
|
2587
2292
|
};
|
|
2588
|
-
const
|
|
2293
|
+
const assignSlots = (slots, children, optimized) => {
|
|
2294
|
+
for (const key in children) {
|
|
2295
|
+
if (optimized || key !== "_") {
|
|
2296
|
+
slots[key] = children[key];
|
|
2297
|
+
}
|
|
2298
|
+
}
|
|
2299
|
+
};
|
|
2300
|
+
const initSlots = (instance, children, optimized) => {
|
|
2589
2301
|
const slots = instance.slots = createInternalObject();
|
|
2590
2302
|
if (instance.vnode.shapeFlag & 32) {
|
|
2591
2303
|
const type = children._;
|
|
2592
2304
|
if (type) {
|
|
2593
|
-
|
|
2594
|
-
|
|
2305
|
+
assignSlots(slots, children, optimized);
|
|
2306
|
+
if (optimized) {
|
|
2307
|
+
shared.def(slots, "_", type, true);
|
|
2308
|
+
}
|
|
2595
2309
|
} else {
|
|
2596
2310
|
normalizeObjectSlots(children, slots);
|
|
2597
2311
|
}
|
|
@@ -2609,10 +2323,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
2609
2323
|
if (optimized && type === 1) {
|
|
2610
2324
|
needDeletionCheck = false;
|
|
2611
2325
|
} else {
|
|
2612
|
-
|
|
2613
|
-
if (!optimized && type === 1) {
|
|
2614
|
-
delete slots._;
|
|
2615
|
-
}
|
|
2326
|
+
assignSlots(slots, children, optimized);
|
|
2616
2327
|
}
|
|
2617
2328
|
} else {
|
|
2618
2329
|
needDeletionCheck = !children.$stable;
|
|
@@ -2629,86 +2340,364 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
2629
2340
|
delete slots[key];
|
|
2630
2341
|
}
|
|
2631
2342
|
}
|
|
2632
|
-
}
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
|
|
2346
|
+
function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
2347
|
+
if (shared.isArray(rawRef)) {
|
|
2348
|
+
rawRef.forEach(
|
|
2349
|
+
(r, i) => setRef(
|
|
2350
|
+
r,
|
|
2351
|
+
oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
|
|
2352
|
+
parentSuspense,
|
|
2353
|
+
vnode,
|
|
2354
|
+
isUnmount
|
|
2355
|
+
)
|
|
2356
|
+
);
|
|
2357
|
+
return;
|
|
2358
|
+
}
|
|
2359
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
2360
|
+
return;
|
|
2361
|
+
}
|
|
2362
|
+
const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
|
|
2363
|
+
const value = isUnmount ? null : refValue;
|
|
2364
|
+
const { i: owner, r: ref } = rawRef;
|
|
2365
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
2366
|
+
const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
|
|
2367
|
+
const setupState = owner.setupState;
|
|
2368
|
+
if (oldRef != null && oldRef !== ref) {
|
|
2369
|
+
if (shared.isString(oldRef)) {
|
|
2370
|
+
refs[oldRef] = null;
|
|
2371
|
+
if (shared.hasOwn(setupState, oldRef)) {
|
|
2372
|
+
setupState[oldRef] = null;
|
|
2373
|
+
}
|
|
2374
|
+
} else if (reactivity.isRef(oldRef)) {
|
|
2375
|
+
oldRef.value = null;
|
|
2376
|
+
}
|
|
2377
|
+
}
|
|
2378
|
+
if (shared.isFunction(ref)) {
|
|
2379
|
+
callWithErrorHandling(ref, owner, 12, [value, refs]);
|
|
2380
|
+
} else {
|
|
2381
|
+
const _isString = shared.isString(ref);
|
|
2382
|
+
const _isRef = reactivity.isRef(ref);
|
|
2383
|
+
if (_isString || _isRef) {
|
|
2384
|
+
const doSet = () => {
|
|
2385
|
+
if (rawRef.f) {
|
|
2386
|
+
const existing = _isString ? shared.hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
|
|
2387
|
+
if (isUnmount) {
|
|
2388
|
+
shared.isArray(existing) && shared.remove(existing, refValue);
|
|
2389
|
+
} else {
|
|
2390
|
+
if (!shared.isArray(existing)) {
|
|
2391
|
+
if (_isString) {
|
|
2392
|
+
refs[ref] = [refValue];
|
|
2393
|
+
if (shared.hasOwn(setupState, ref)) {
|
|
2394
|
+
setupState[ref] = refs[ref];
|
|
2395
|
+
}
|
|
2396
|
+
} else {
|
|
2397
|
+
ref.value = [refValue];
|
|
2398
|
+
if (rawRef.k) refs[rawRef.k] = ref.value;
|
|
2399
|
+
}
|
|
2400
|
+
} else if (!existing.includes(refValue)) {
|
|
2401
|
+
existing.push(refValue);
|
|
2402
|
+
}
|
|
2403
|
+
}
|
|
2404
|
+
} else if (_isString) {
|
|
2405
|
+
refs[ref] = value;
|
|
2406
|
+
if (shared.hasOwn(setupState, ref)) {
|
|
2407
|
+
setupState[ref] = value;
|
|
2408
|
+
}
|
|
2409
|
+
} else if (_isRef) {
|
|
2410
|
+
ref.value = value;
|
|
2411
|
+
if (rawRef.k) refs[rawRef.k] = value;
|
|
2412
|
+
} else ;
|
|
2413
|
+
};
|
|
2414
|
+
if (value) {
|
|
2415
|
+
doSet.id = -1;
|
|
2416
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
2417
|
+
} else {
|
|
2418
|
+
doSet();
|
|
2419
|
+
}
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
|
|
2424
|
+
const TeleportEndKey = Symbol("_vte");
|
|
2425
|
+
const isTeleport = (type) => type.__isTeleport;
|
|
2426
|
+
const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
|
2427
|
+
const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
|
|
2428
|
+
const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
|
|
2429
|
+
const resolveTarget = (props, select) => {
|
|
2430
|
+
const targetSelector = props && props.to;
|
|
2431
|
+
if (shared.isString(targetSelector)) {
|
|
2432
|
+
if (!select) {
|
|
2433
|
+
return null;
|
|
2434
|
+
} else {
|
|
2435
|
+
const target = select(targetSelector);
|
|
2436
|
+
return target;
|
|
2437
|
+
}
|
|
2438
|
+
} else {
|
|
2439
|
+
return targetSelector;
|
|
2440
|
+
}
|
|
2441
|
+
};
|
|
2442
|
+
const TeleportImpl = {
|
|
2443
|
+
name: "Teleport",
|
|
2444
|
+
__isTeleport: true,
|
|
2445
|
+
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
|
2446
|
+
const {
|
|
2447
|
+
mc: mountChildren,
|
|
2448
|
+
pc: patchChildren,
|
|
2449
|
+
pbc: patchBlockChildren,
|
|
2450
|
+
o: { insert, querySelector, createText, createComment }
|
|
2451
|
+
} = internals;
|
|
2452
|
+
const disabled = isTeleportDisabled(n2.props);
|
|
2453
|
+
let { shapeFlag, children, dynamicChildren } = n2;
|
|
2454
|
+
if (n1 == null) {
|
|
2455
|
+
const placeholder = n2.el = createText("");
|
|
2456
|
+
const mainAnchor = n2.anchor = createText("");
|
|
2457
|
+
insert(placeholder, container, anchor);
|
|
2458
|
+
insert(mainAnchor, container, anchor);
|
|
2459
|
+
const target = n2.target = resolveTarget(n2.props, querySelector);
|
|
2460
|
+
const targetAnchor = prepareAnchor(target, n2, createText, insert);
|
|
2461
|
+
if (target) {
|
|
2462
|
+
if (namespace === "svg" || isTargetSVG(target)) {
|
|
2463
|
+
namespace = "svg";
|
|
2464
|
+
} else if (namespace === "mathml" || isTargetMathML(target)) {
|
|
2465
|
+
namespace = "mathml";
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
const mount = (container2, anchor2) => {
|
|
2469
|
+
if (shapeFlag & 16) {
|
|
2470
|
+
mountChildren(
|
|
2471
|
+
children,
|
|
2472
|
+
container2,
|
|
2473
|
+
anchor2,
|
|
2474
|
+
parentComponent,
|
|
2475
|
+
parentSuspense,
|
|
2476
|
+
namespace,
|
|
2477
|
+
slotScopeIds,
|
|
2478
|
+
optimized
|
|
2479
|
+
);
|
|
2480
|
+
}
|
|
2481
|
+
};
|
|
2482
|
+
if (disabled) {
|
|
2483
|
+
mount(container, mainAnchor);
|
|
2484
|
+
} else if (target) {
|
|
2485
|
+
mount(target, targetAnchor);
|
|
2486
|
+
}
|
|
2487
|
+
} else {
|
|
2488
|
+
n2.el = n1.el;
|
|
2489
|
+
n2.targetStart = n1.targetStart;
|
|
2490
|
+
const mainAnchor = n2.anchor = n1.anchor;
|
|
2491
|
+
const target = n2.target = n1.target;
|
|
2492
|
+
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
2493
|
+
const wasDisabled = isTeleportDisabled(n1.props);
|
|
2494
|
+
const currentContainer = wasDisabled ? container : target;
|
|
2495
|
+
const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
|
2496
|
+
if (namespace === "svg" || isTargetSVG(target)) {
|
|
2497
|
+
namespace = "svg";
|
|
2498
|
+
} else if (namespace === "mathml" || isTargetMathML(target)) {
|
|
2499
|
+
namespace = "mathml";
|
|
2500
|
+
}
|
|
2501
|
+
if (dynamicChildren) {
|
|
2502
|
+
patchBlockChildren(
|
|
2503
|
+
n1.dynamicChildren,
|
|
2504
|
+
dynamicChildren,
|
|
2505
|
+
currentContainer,
|
|
2506
|
+
parentComponent,
|
|
2507
|
+
parentSuspense,
|
|
2508
|
+
namespace,
|
|
2509
|
+
slotScopeIds
|
|
2510
|
+
);
|
|
2511
|
+
traverseStaticChildren(n1, n2, true);
|
|
2512
|
+
} else if (!optimized) {
|
|
2513
|
+
patchChildren(
|
|
2514
|
+
n1,
|
|
2515
|
+
n2,
|
|
2516
|
+
currentContainer,
|
|
2517
|
+
currentAnchor,
|
|
2518
|
+
parentComponent,
|
|
2519
|
+
parentSuspense,
|
|
2520
|
+
namespace,
|
|
2521
|
+
slotScopeIds,
|
|
2522
|
+
false
|
|
2523
|
+
);
|
|
2524
|
+
}
|
|
2525
|
+
if (disabled) {
|
|
2526
|
+
if (!wasDisabled) {
|
|
2527
|
+
moveTeleport(
|
|
2528
|
+
n2,
|
|
2529
|
+
container,
|
|
2530
|
+
mainAnchor,
|
|
2531
|
+
internals,
|
|
2532
|
+
1
|
|
2533
|
+
);
|
|
2534
|
+
} else {
|
|
2535
|
+
if (n2.props && n1.props && n2.props.to !== n1.props.to) {
|
|
2536
|
+
n2.props.to = n1.props.to;
|
|
2537
|
+
}
|
|
2538
|
+
}
|
|
2539
|
+
} else {
|
|
2540
|
+
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
2541
|
+
const nextTarget = n2.target = resolveTarget(
|
|
2542
|
+
n2.props,
|
|
2543
|
+
querySelector
|
|
2544
|
+
);
|
|
2545
|
+
if (nextTarget) {
|
|
2546
|
+
moveTeleport(
|
|
2547
|
+
n2,
|
|
2548
|
+
nextTarget,
|
|
2549
|
+
null,
|
|
2550
|
+
internals,
|
|
2551
|
+
0
|
|
2552
|
+
);
|
|
2553
|
+
}
|
|
2554
|
+
} else if (wasDisabled) {
|
|
2555
|
+
moveTeleport(
|
|
2556
|
+
n2,
|
|
2557
|
+
target,
|
|
2558
|
+
targetAnchor,
|
|
2559
|
+
internals,
|
|
2560
|
+
1
|
|
2561
|
+
);
|
|
2562
|
+
}
|
|
2563
|
+
}
|
|
2564
|
+
}
|
|
2565
|
+
updateCssVars(n2);
|
|
2566
|
+
},
|
|
2567
|
+
remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
2568
|
+
const {
|
|
2569
|
+
shapeFlag,
|
|
2570
|
+
children,
|
|
2571
|
+
anchor,
|
|
2572
|
+
targetStart,
|
|
2573
|
+
targetAnchor,
|
|
2574
|
+
target,
|
|
2575
|
+
props
|
|
2576
|
+
} = vnode;
|
|
2577
|
+
if (target) {
|
|
2578
|
+
hostRemove(targetStart);
|
|
2579
|
+
hostRemove(targetAnchor);
|
|
2580
|
+
}
|
|
2581
|
+
doRemove && hostRemove(anchor);
|
|
2582
|
+
if (shapeFlag & 16) {
|
|
2583
|
+
const shouldRemove = doRemove || !isTeleportDisabled(props);
|
|
2584
|
+
for (let i = 0; i < children.length; i++) {
|
|
2585
|
+
const child = children[i];
|
|
2586
|
+
unmount(
|
|
2587
|
+
child,
|
|
2588
|
+
parentComponent,
|
|
2589
|
+
parentSuspense,
|
|
2590
|
+
shouldRemove,
|
|
2591
|
+
!!child.dynamicChildren
|
|
2592
|
+
);
|
|
2593
|
+
}
|
|
2594
|
+
}
|
|
2595
|
+
},
|
|
2596
|
+
move: moveTeleport,
|
|
2597
|
+
hydrate: hydrateTeleport
|
|
2633
2598
|
};
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
rawRef.forEach(
|
|
2638
|
-
(r, i) => setRef(
|
|
2639
|
-
r,
|
|
2640
|
-
oldRawRef && (shared.isArray(oldRawRef) ? oldRawRef[i] : oldRawRef),
|
|
2641
|
-
parentSuspense,
|
|
2642
|
-
vnode,
|
|
2643
|
-
isUnmount
|
|
2644
|
-
)
|
|
2645
|
-
);
|
|
2646
|
-
return;
|
|
2599
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
|
2600
|
+
if (moveType === 0) {
|
|
2601
|
+
insert(vnode.targetAnchor, container, parentAnchor);
|
|
2647
2602
|
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2603
|
+
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
2604
|
+
const isReorder = moveType === 2;
|
|
2605
|
+
if (isReorder) {
|
|
2606
|
+
insert(el, container, parentAnchor);
|
|
2650
2607
|
}
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
if (shared.hasOwn(setupState, oldRef)) {
|
|
2661
|
-
setupState[oldRef] = null;
|
|
2608
|
+
if (!isReorder || isTeleportDisabled(props)) {
|
|
2609
|
+
if (shapeFlag & 16) {
|
|
2610
|
+
for (let i = 0; i < children.length; i++) {
|
|
2611
|
+
move(
|
|
2612
|
+
children[i],
|
|
2613
|
+
container,
|
|
2614
|
+
parentAnchor,
|
|
2615
|
+
2
|
|
2616
|
+
);
|
|
2662
2617
|
}
|
|
2663
|
-
} else if (reactivity.isRef(oldRef)) {
|
|
2664
|
-
oldRef.value = null;
|
|
2665
2618
|
}
|
|
2666
2619
|
}
|
|
2667
|
-
if (
|
|
2668
|
-
|
|
2669
|
-
}
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2620
|
+
if (isReorder) {
|
|
2621
|
+
insert(anchor, container, parentAnchor);
|
|
2622
|
+
}
|
|
2623
|
+
}
|
|
2624
|
+
function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
|
|
2625
|
+
o: { nextSibling, parentNode, querySelector, insert, createText }
|
|
2626
|
+
}, hydrateChildren) {
|
|
2627
|
+
const target = vnode.target = resolveTarget(
|
|
2628
|
+
vnode.props,
|
|
2629
|
+
querySelector
|
|
2630
|
+
);
|
|
2631
|
+
if (target) {
|
|
2632
|
+
const targetNode = target._lpa || target.firstChild;
|
|
2633
|
+
if (vnode.shapeFlag & 16) {
|
|
2634
|
+
if (isTeleportDisabled(vnode.props)) {
|
|
2635
|
+
vnode.anchor = hydrateChildren(
|
|
2636
|
+
nextSibling(node),
|
|
2637
|
+
vnode,
|
|
2638
|
+
parentNode(node),
|
|
2639
|
+
parentComponent,
|
|
2640
|
+
parentSuspense,
|
|
2641
|
+
slotScopeIds,
|
|
2642
|
+
optimized
|
|
2643
|
+
);
|
|
2644
|
+
vnode.targetStart = targetNode;
|
|
2645
|
+
vnode.targetAnchor = targetNode && nextSibling(targetNode);
|
|
2646
|
+
} else {
|
|
2647
|
+
vnode.anchor = nextSibling(node);
|
|
2648
|
+
let targetAnchor = targetNode;
|
|
2649
|
+
while (targetAnchor) {
|
|
2650
|
+
if (targetAnchor && targetAnchor.nodeType === 8) {
|
|
2651
|
+
if (targetAnchor.data === "teleport start anchor") {
|
|
2652
|
+
vnode.targetStart = targetAnchor;
|
|
2653
|
+
} else if (targetAnchor.data === "teleport anchor") {
|
|
2654
|
+
vnode.targetAnchor = targetAnchor;
|
|
2655
|
+
target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
2656
|
+
break;
|
|
2691
2657
|
}
|
|
2692
2658
|
}
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
doSet();
|
|
2659
|
+
targetAnchor = nextSibling(targetAnchor);
|
|
2660
|
+
}
|
|
2661
|
+
if (!vnode.targetAnchor) {
|
|
2662
|
+
prepareAnchor(target, vnode, createText, insert);
|
|
2663
|
+
}
|
|
2664
|
+
hydrateChildren(
|
|
2665
|
+
targetNode && nextSibling(targetNode),
|
|
2666
|
+
vnode,
|
|
2667
|
+
target,
|
|
2668
|
+
parentComponent,
|
|
2669
|
+
parentSuspense,
|
|
2670
|
+
slotScopeIds,
|
|
2671
|
+
optimized
|
|
2672
|
+
);
|
|
2708
2673
|
}
|
|
2709
2674
|
}
|
|
2675
|
+
updateCssVars(vnode);
|
|
2676
|
+
}
|
|
2677
|
+
return vnode.anchor && nextSibling(vnode.anchor);
|
|
2678
|
+
}
|
|
2679
|
+
const Teleport = TeleportImpl;
|
|
2680
|
+
function updateCssVars(vnode) {
|
|
2681
|
+
const ctx = vnode.ctx;
|
|
2682
|
+
if (ctx && ctx.ut) {
|
|
2683
|
+
let node = vnode.children[0].el;
|
|
2684
|
+
while (node && node !== vnode.targetAnchor) {
|
|
2685
|
+
if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
|
|
2686
|
+
node = node.nextSibling;
|
|
2687
|
+
}
|
|
2688
|
+
ctx.ut();
|
|
2710
2689
|
}
|
|
2711
2690
|
}
|
|
2691
|
+
function prepareAnchor(target, vnode, createText, insert) {
|
|
2692
|
+
const targetStart = vnode.targetStart = createText("");
|
|
2693
|
+
const targetAnchor = vnode.targetAnchor = createText("");
|
|
2694
|
+
targetStart[TeleportEndKey] = targetAnchor;
|
|
2695
|
+
if (target) {
|
|
2696
|
+
insert(targetStart, target);
|
|
2697
|
+
insert(targetAnchor, target);
|
|
2698
|
+
}
|
|
2699
|
+
return targetAnchor;
|
|
2700
|
+
}
|
|
2712
2701
|
|
|
2713
2702
|
let hasLoggedMismatchError = false;
|
|
2714
2703
|
const logMismatchError = () => {
|
|
@@ -2957,18 +2946,11 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
2957
2946
|
}
|
|
2958
2947
|
if (props) {
|
|
2959
2948
|
if (forcePatch || !optimized || patchFlag & (16 | 32)) {
|
|
2949
|
+
const isCustomElement = el.tagName.includes("-");
|
|
2960
2950
|
for (const key in props) {
|
|
2961
2951
|
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
|
|
2962
|
-
key[0] === ".") {
|
|
2963
|
-
patchProp(
|
|
2964
|
-
el,
|
|
2965
|
-
key,
|
|
2966
|
-
null,
|
|
2967
|
-
props[key],
|
|
2968
|
-
void 0,
|
|
2969
|
-
void 0,
|
|
2970
|
-
parentComponent
|
|
2971
|
-
);
|
|
2952
|
+
key[0] === "." || isCustomElement) {
|
|
2953
|
+
patchProp(el, key, null, props[key], void 0, parentComponent);
|
|
2972
2954
|
}
|
|
2973
2955
|
}
|
|
2974
2956
|
} else if (props.onClick) {
|
|
@@ -2978,9 +2960,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
2978
2960
|
null,
|
|
2979
2961
|
props.onClick,
|
|
2980
2962
|
void 0,
|
|
2981
|
-
void 0,
|
|
2982
2963
|
parentComponent
|
|
2983
2964
|
);
|
|
2965
|
+
} else if (patchFlag & 4 && reactivity.isReactive(props.style)) {
|
|
2966
|
+
for (const key in props.style) props.style[key];
|
|
2984
2967
|
}
|
|
2985
2968
|
}
|
|
2986
2969
|
let vnodeHooks;
|
|
@@ -3006,7 +2989,21 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3006
2989
|
const l = children.length;
|
|
3007
2990
|
for (let i = 0; i < l; i++) {
|
|
3008
2991
|
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
2992
|
+
const isText = vnode.type === Text;
|
|
3009
2993
|
if (node) {
|
|
2994
|
+
if (isText && !optimized) {
|
|
2995
|
+
let next = children[i + 1];
|
|
2996
|
+
if (next && (next = normalizeVNode(next)).type === Text) {
|
|
2997
|
+
insert(
|
|
2998
|
+
createText(
|
|
2999
|
+
node.data.slice(vnode.children.length)
|
|
3000
|
+
),
|
|
3001
|
+
container,
|
|
3002
|
+
nextSibling(node)
|
|
3003
|
+
);
|
|
3004
|
+
node.data = vnode.children;
|
|
3005
|
+
}
|
|
3006
|
+
}
|
|
3010
3007
|
node = hydrateNode(
|
|
3011
3008
|
node,
|
|
3012
3009
|
vnode,
|
|
@@ -3015,7 +3012,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3015
3012
|
slotScopeIds,
|
|
3016
3013
|
optimized
|
|
3017
3014
|
);
|
|
3018
|
-
} else if (
|
|
3015
|
+
} else if (isText && !vnode.children) {
|
|
3019
3016
|
insert(vnode.el = createText(""), container);
|
|
3020
3017
|
} else {
|
|
3021
3018
|
logMismatchError();
|
|
@@ -3354,17 +3351,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3354
3351
|
if (props) {
|
|
3355
3352
|
for (const key in props) {
|
|
3356
3353
|
if (key !== "value" && !shared.isReservedProp(key)) {
|
|
3357
|
-
hostPatchProp(
|
|
3358
|
-
el,
|
|
3359
|
-
key,
|
|
3360
|
-
null,
|
|
3361
|
-
props[key],
|
|
3362
|
-
namespace,
|
|
3363
|
-
vnode.children,
|
|
3364
|
-
parentComponent,
|
|
3365
|
-
parentSuspense,
|
|
3366
|
-
unmountChildren
|
|
3367
|
-
);
|
|
3354
|
+
hostPatchProp(el, key, null, props[key], namespace, parentComponent);
|
|
3368
3355
|
}
|
|
3369
3356
|
}
|
|
3370
3357
|
if ("value" in props) {
|
|
@@ -3444,6 +3431,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3444
3431
|
invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
3445
3432
|
}
|
|
3446
3433
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
3434
|
+
if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
|
|
3435
|
+
hostSetElementText(el, "");
|
|
3436
|
+
}
|
|
3447
3437
|
if (dynamicChildren) {
|
|
3448
3438
|
patchBlockChildren(
|
|
3449
3439
|
n1.dynamicChildren,
|
|
@@ -3469,15 +3459,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3469
3459
|
}
|
|
3470
3460
|
if (patchFlag > 0) {
|
|
3471
3461
|
if (patchFlag & 16) {
|
|
3472
|
-
patchProps(
|
|
3473
|
-
el,
|
|
3474
|
-
n2,
|
|
3475
|
-
oldProps,
|
|
3476
|
-
newProps,
|
|
3477
|
-
parentComponent,
|
|
3478
|
-
parentSuspense,
|
|
3479
|
-
namespace
|
|
3480
|
-
);
|
|
3462
|
+
patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
3481
3463
|
} else {
|
|
3482
3464
|
if (patchFlag & 2) {
|
|
3483
3465
|
if (oldProps.class !== newProps.class) {
|
|
@@ -3494,17 +3476,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3494
3476
|
const prev = oldProps[key];
|
|
3495
3477
|
const next = newProps[key];
|
|
3496
3478
|
if (next !== prev || key === "value") {
|
|
3497
|
-
hostPatchProp(
|
|
3498
|
-
el,
|
|
3499
|
-
key,
|
|
3500
|
-
prev,
|
|
3501
|
-
next,
|
|
3502
|
-
namespace,
|
|
3503
|
-
n1.children,
|
|
3504
|
-
parentComponent,
|
|
3505
|
-
parentSuspense,
|
|
3506
|
-
unmountChildren
|
|
3507
|
-
);
|
|
3479
|
+
hostPatchProp(el, key, prev, next, namespace, parentComponent);
|
|
3508
3480
|
}
|
|
3509
3481
|
}
|
|
3510
3482
|
}
|
|
@@ -3515,15 +3487,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3515
3487
|
}
|
|
3516
3488
|
}
|
|
3517
3489
|
} else if (!optimized && dynamicChildren == null) {
|
|
3518
|
-
patchProps(
|
|
3519
|
-
el,
|
|
3520
|
-
n2,
|
|
3521
|
-
oldProps,
|
|
3522
|
-
newProps,
|
|
3523
|
-
parentComponent,
|
|
3524
|
-
parentSuspense,
|
|
3525
|
-
namespace
|
|
3526
|
-
);
|
|
3490
|
+
patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
3527
3491
|
}
|
|
3528
3492
|
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
|
3529
3493
|
queuePostRenderEffect(() => {
|
|
@@ -3563,7 +3527,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3563
3527
|
);
|
|
3564
3528
|
}
|
|
3565
3529
|
};
|
|
3566
|
-
const patchProps = (el,
|
|
3530
|
+
const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
|
|
3567
3531
|
if (oldProps !== newProps) {
|
|
3568
3532
|
if (oldProps !== shared.EMPTY_OBJ) {
|
|
3569
3533
|
for (const key in oldProps) {
|
|
@@ -3574,10 +3538,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3574
3538
|
oldProps[key],
|
|
3575
3539
|
null,
|
|
3576
3540
|
namespace,
|
|
3577
|
-
|
|
3578
|
-
parentComponent,
|
|
3579
|
-
parentSuspense,
|
|
3580
|
-
unmountChildren
|
|
3541
|
+
parentComponent
|
|
3581
3542
|
);
|
|
3582
3543
|
}
|
|
3583
3544
|
}
|
|
@@ -3587,17 +3548,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3587
3548
|
const next = newProps[key];
|
|
3588
3549
|
const prev = oldProps[key];
|
|
3589
3550
|
if (next !== prev && key !== "value") {
|
|
3590
|
-
hostPatchProp(
|
|
3591
|
-
el,
|
|
3592
|
-
key,
|
|
3593
|
-
prev,
|
|
3594
|
-
next,
|
|
3595
|
-
namespace,
|
|
3596
|
-
vnode.children,
|
|
3597
|
-
parentComponent,
|
|
3598
|
-
parentSuspense,
|
|
3599
|
-
unmountChildren
|
|
3600
|
-
);
|
|
3551
|
+
hostPatchProp(el, key, prev, next, namespace, parentComponent);
|
|
3601
3552
|
}
|
|
3602
3553
|
}
|
|
3603
3554
|
if ("value" in newProps) {
|
|
@@ -3707,7 +3658,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3707
3658
|
instance.ctx.renderer = internals;
|
|
3708
3659
|
}
|
|
3709
3660
|
{
|
|
3710
|
-
setupComponent(instance);
|
|
3661
|
+
setupComponent(instance, false, optimized);
|
|
3711
3662
|
}
|
|
3712
3663
|
if (instance.asyncDep) {
|
|
3713
3664
|
parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
|
|
@@ -3883,6 +3834,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3883
3834
|
effect.run();
|
|
3884
3835
|
}
|
|
3885
3836
|
};
|
|
3837
|
+
update.i = instance;
|
|
3886
3838
|
update.id = instance.uid;
|
|
3887
3839
|
toggleRecurse(instance, true);
|
|
3888
3840
|
update();
|
|
@@ -4235,7 +4187,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4235
4187
|
shapeFlag,
|
|
4236
4188
|
patchFlag,
|
|
4237
4189
|
dirs,
|
|
4238
|
-
|
|
4190
|
+
cacheIndex
|
|
4239
4191
|
} = vnode;
|
|
4240
4192
|
if (patchFlag === -2) {
|
|
4241
4193
|
optimized = false;
|
|
@@ -4243,8 +4195,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4243
4195
|
if (ref != null) {
|
|
4244
4196
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
4245
4197
|
}
|
|
4246
|
-
if (
|
|
4247
|
-
parentComponent.renderCache[
|
|
4198
|
+
if (cacheIndex != null) {
|
|
4199
|
+
parentComponent.renderCache[cacheIndex] = void 0;
|
|
4248
4200
|
}
|
|
4249
4201
|
if (shapeFlag & 256) {
|
|
4250
4202
|
parentComponent.ctx.deactivate(vnode);
|
|
@@ -4274,7 +4226,12 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4274
4226
|
internals,
|
|
4275
4227
|
doRemove
|
|
4276
4228
|
);
|
|
4277
|
-
} else if (dynamicChildren && // #
|
|
4229
|
+
} else if (dynamicChildren && // #5154
|
|
4230
|
+
// when v-once is used inside a block, setBlockTracking(-1) marks the
|
|
4231
|
+
// parent block with hasOnce: true
|
|
4232
|
+
// so that it doesn't take the fast path during unmount - otherwise
|
|
4233
|
+
// components nested in v-once are never unmounted.
|
|
4234
|
+
!dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
4278
4235
|
(type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
|
|
4279
4236
|
unmountChildren(
|
|
4280
4237
|
dynamicChildren,
|
|
@@ -4373,7 +4330,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4373
4330
|
if (vnode.shapeFlag & 128) {
|
|
4374
4331
|
return vnode.suspense.next();
|
|
4375
4332
|
}
|
|
4376
|
-
|
|
4333
|
+
const el = hostNextSibling(vnode.anchor || vnode.el);
|
|
4334
|
+
const teleportEnd = el && el[TeleportEndKey];
|
|
4335
|
+
return teleportEnd ? hostNextSibling(teleportEnd) : el;
|
|
4377
4336
|
};
|
|
4378
4337
|
let isFlushing = false;
|
|
4379
4338
|
const render = (vnode, container, namespace) => {
|
|
@@ -4392,13 +4351,13 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4392
4351
|
namespace
|
|
4393
4352
|
);
|
|
4394
4353
|
}
|
|
4354
|
+
container._vnode = vnode;
|
|
4395
4355
|
if (!isFlushing) {
|
|
4396
4356
|
isFlushing = true;
|
|
4397
4357
|
flushPreFlushCbs();
|
|
4398
4358
|
flushPostFlushCbs();
|
|
4399
4359
|
isFlushing = false;
|
|
4400
4360
|
}
|
|
4401
|
-
container._vnode = vnode;
|
|
4402
4361
|
};
|
|
4403
4362
|
const internals = {
|
|
4404
4363
|
p: patch,
|
|
@@ -4747,827 +4706,932 @@ function traverse(value, depth = Infinity, seen) {
|
|
|
4747
4706
|
return value;
|
|
4748
4707
|
}
|
|
4749
4708
|
|
|
4750
|
-
|
|
4751
|
-
const
|
|
4752
|
-
name
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
const sharedContext = instance.ctx;
|
|
4765
|
-
if (!sharedContext.renderer) {
|
|
4766
|
-
return () => {
|
|
4767
|
-
const children = slots.default && slots.default();
|
|
4768
|
-
return children && children.length === 1 ? children[0] : children;
|
|
4769
|
-
};
|
|
4770
|
-
}
|
|
4771
|
-
const cache = /* @__PURE__ */ new Map();
|
|
4772
|
-
const keys = /* @__PURE__ */ new Set();
|
|
4773
|
-
let current = null;
|
|
4774
|
-
const parentSuspense = instance.suspense;
|
|
4775
|
-
const {
|
|
4776
|
-
renderer: {
|
|
4777
|
-
p: patch,
|
|
4778
|
-
m: move,
|
|
4779
|
-
um: _unmount,
|
|
4780
|
-
o: { createElement }
|
|
4709
|
+
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
4710
|
+
const i = getCurrentInstance();
|
|
4711
|
+
const camelizedName = shared.camelize(name);
|
|
4712
|
+
const hyphenatedName = shared.hyphenate(name);
|
|
4713
|
+
const modifiers = getModelModifiers(props, name);
|
|
4714
|
+
const res = reactivity.customRef((track, trigger) => {
|
|
4715
|
+
let localValue;
|
|
4716
|
+
let prevSetValue = shared.EMPTY_OBJ;
|
|
4717
|
+
let prevEmittedValue;
|
|
4718
|
+
watchSyncEffect(() => {
|
|
4719
|
+
const propValue = props[name];
|
|
4720
|
+
if (shared.hasChanged(localValue, propValue)) {
|
|
4721
|
+
localValue = propValue;
|
|
4722
|
+
trigger();
|
|
4781
4723
|
}
|
|
4782
|
-
}
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
instance2,
|
|
4793
|
-
parentSuspense,
|
|
4794
|
-
namespace,
|
|
4795
|
-
vnode.slotScopeIds,
|
|
4796
|
-
optimized
|
|
4797
|
-
);
|
|
4798
|
-
queuePostRenderEffect(() => {
|
|
4799
|
-
instance2.isDeactivated = false;
|
|
4800
|
-
if (instance2.a) {
|
|
4801
|
-
shared.invokeArrayFns(instance2.a);
|
|
4724
|
+
});
|
|
4725
|
+
return {
|
|
4726
|
+
get() {
|
|
4727
|
+
track();
|
|
4728
|
+
return options.get ? options.get(localValue) : localValue;
|
|
4729
|
+
},
|
|
4730
|
+
set(value) {
|
|
4731
|
+
const emittedValue = options.set ? options.set(value) : value;
|
|
4732
|
+
if (!shared.hasChanged(emittedValue, localValue) && !(prevSetValue !== shared.EMPTY_OBJ && shared.hasChanged(value, prevSetValue))) {
|
|
4733
|
+
return;
|
|
4802
4734
|
}
|
|
4803
|
-
const
|
|
4804
|
-
if (
|
|
4805
|
-
|
|
4735
|
+
const rawProps = i.vnode.props;
|
|
4736
|
+
if (!(rawProps && // check if parent has passed v-model
|
|
4737
|
+
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
|
|
4738
|
+
localValue = value;
|
|
4739
|
+
trigger();
|
|
4740
|
+
}
|
|
4741
|
+
i.emit(`update:${name}`, emittedValue);
|
|
4742
|
+
if (shared.hasChanged(value, emittedValue) && shared.hasChanged(value, prevSetValue) && !shared.hasChanged(emittedValue, prevEmittedValue)) {
|
|
4743
|
+
trigger();
|
|
4806
4744
|
}
|
|
4807
|
-
|
|
4745
|
+
prevSetValue = value;
|
|
4746
|
+
prevEmittedValue = emittedValue;
|
|
4747
|
+
}
|
|
4808
4748
|
};
|
|
4809
|
-
|
|
4810
|
-
|
|
4811
|
-
|
|
4812
|
-
|
|
4813
|
-
|
|
4814
|
-
|
|
4815
|
-
|
|
4816
|
-
|
|
4817
|
-
|
|
4818
|
-
const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
|
|
4819
|
-
if (vnodeHook) {
|
|
4820
|
-
invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
|
4749
|
+
});
|
|
4750
|
+
res[Symbol.iterator] = () => {
|
|
4751
|
+
let i2 = 0;
|
|
4752
|
+
return {
|
|
4753
|
+
next() {
|
|
4754
|
+
if (i2 < 2) {
|
|
4755
|
+
return { value: i2++ ? modifiers || shared.EMPTY_OBJ : res, done: false };
|
|
4756
|
+
} else {
|
|
4757
|
+
return { done: true };
|
|
4821
4758
|
}
|
|
4822
|
-
|
|
4823
|
-
}, parentSuspense);
|
|
4759
|
+
}
|
|
4824
4760
|
};
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4761
|
+
};
|
|
4762
|
+
return res;
|
|
4763
|
+
}
|
|
4764
|
+
const getModelModifiers = (props, modelName) => {
|
|
4765
|
+
return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${shared.camelize(modelName)}Modifiers`] || props[`${shared.hyphenate(modelName)}Modifiers`];
|
|
4766
|
+
};
|
|
4767
|
+
|
|
4768
|
+
function emit(instance, event, ...rawArgs) {
|
|
4769
|
+
if (instance.isUnmounted) return;
|
|
4770
|
+
const props = instance.vnode.props || shared.EMPTY_OBJ;
|
|
4771
|
+
let args = rawArgs;
|
|
4772
|
+
const isModelListener = event.startsWith("update:");
|
|
4773
|
+
const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
|
|
4774
|
+
if (modifiers) {
|
|
4775
|
+
if (modifiers.trim) {
|
|
4776
|
+
args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
|
|
4828
4777
|
}
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
const name = getComponentName(vnode.type);
|
|
4832
|
-
if (name && (!filter || !filter(name))) {
|
|
4833
|
-
pruneCacheEntry(key);
|
|
4834
|
-
}
|
|
4835
|
-
});
|
|
4778
|
+
if (modifiers.number) {
|
|
4779
|
+
args = rawArgs.map(shared.looseToNumber);
|
|
4836
4780
|
}
|
|
4837
|
-
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
|
|
4781
|
+
}
|
|
4782
|
+
let handlerName;
|
|
4783
|
+
let handler = props[handlerName = shared.toHandlerKey(event)] || // also try camelCase event handler (#2249)
|
|
4784
|
+
props[handlerName = shared.toHandlerKey(shared.camelize(event))];
|
|
4785
|
+
if (!handler && isModelListener) {
|
|
4786
|
+
handler = props[handlerName = shared.toHandlerKey(shared.hyphenate(event))];
|
|
4787
|
+
}
|
|
4788
|
+
if (handler) {
|
|
4789
|
+
callWithAsyncErrorHandling(
|
|
4790
|
+
handler,
|
|
4791
|
+
instance,
|
|
4792
|
+
6,
|
|
4793
|
+
args
|
|
4794
|
+
);
|
|
4795
|
+
}
|
|
4796
|
+
const onceHandler = props[handlerName + `Once`];
|
|
4797
|
+
if (onceHandler) {
|
|
4798
|
+
if (!instance.emitted) {
|
|
4799
|
+
instance.emitted = {};
|
|
4800
|
+
} else if (instance.emitted[handlerName]) {
|
|
4801
|
+
return;
|
|
4846
4802
|
}
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4852
|
-
|
|
4853
|
-
// prune post-render after `current` has been updated
|
|
4854
|
-
{ flush: "post", deep: true }
|
|
4803
|
+
instance.emitted[handlerName] = true;
|
|
4804
|
+
callWithAsyncErrorHandling(
|
|
4805
|
+
onceHandler,
|
|
4806
|
+
instance,
|
|
4807
|
+
6,
|
|
4808
|
+
args
|
|
4855
4809
|
);
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4863
|
-
|
|
4864
|
-
|
|
4865
|
-
|
|
4810
|
+
}
|
|
4811
|
+
}
|
|
4812
|
+
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
4813
|
+
const cache = appContext.emitsCache;
|
|
4814
|
+
const cached = cache.get(comp);
|
|
4815
|
+
if (cached !== void 0) {
|
|
4816
|
+
return cached;
|
|
4817
|
+
}
|
|
4818
|
+
const raw = comp.emits;
|
|
4819
|
+
let normalized = {};
|
|
4820
|
+
let hasExtends = false;
|
|
4821
|
+
if (!shared.isFunction(comp)) {
|
|
4822
|
+
const extendEmits = (raw2) => {
|
|
4823
|
+
const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
|
4824
|
+
if (normalizedFromExtend) {
|
|
4825
|
+
hasExtends = true;
|
|
4826
|
+
shared.extend(normalized, normalizedFromExtend);
|
|
4866
4827
|
}
|
|
4867
4828
|
};
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4829
|
+
if (!asMixin && appContext.mixins.length) {
|
|
4830
|
+
appContext.mixins.forEach(extendEmits);
|
|
4831
|
+
}
|
|
4832
|
+
if (comp.extends) {
|
|
4833
|
+
extendEmits(comp.extends);
|
|
4834
|
+
}
|
|
4835
|
+
if (comp.mixins) {
|
|
4836
|
+
comp.mixins.forEach(extendEmits);
|
|
4837
|
+
}
|
|
4838
|
+
}
|
|
4839
|
+
if (!raw && !hasExtends) {
|
|
4840
|
+
if (shared.isObject(comp)) {
|
|
4841
|
+
cache.set(comp, null);
|
|
4842
|
+
}
|
|
4843
|
+
return null;
|
|
4844
|
+
}
|
|
4845
|
+
if (shared.isArray(raw)) {
|
|
4846
|
+
raw.forEach((key) => normalized[key] = null);
|
|
4847
|
+
} else {
|
|
4848
|
+
shared.extend(normalized, raw);
|
|
4849
|
+
}
|
|
4850
|
+
if (shared.isObject(comp)) {
|
|
4851
|
+
cache.set(comp, normalized);
|
|
4852
|
+
}
|
|
4853
|
+
return normalized;
|
|
4854
|
+
}
|
|
4855
|
+
function isEmitListener(options, key) {
|
|
4856
|
+
if (!options || !shared.isOn(key)) {
|
|
4857
|
+
return false;
|
|
4858
|
+
}
|
|
4859
|
+
key = key.slice(2).replace(/Once$/, "");
|
|
4860
|
+
return shared.hasOwn(options, key[0].toLowerCase() + key.slice(1)) || shared.hasOwn(options, shared.hyphenate(key)) || shared.hasOwn(options, key);
|
|
4861
|
+
}
|
|
4862
|
+
|
|
4863
|
+
function markAttrsAccessed() {
|
|
4864
|
+
}
|
|
4865
|
+
function renderComponentRoot(instance) {
|
|
4866
|
+
const {
|
|
4867
|
+
type: Component,
|
|
4868
|
+
vnode,
|
|
4869
|
+
proxy,
|
|
4870
|
+
withProxy,
|
|
4871
|
+
propsOptions: [propsOptions],
|
|
4872
|
+
slots,
|
|
4873
|
+
attrs,
|
|
4874
|
+
emit,
|
|
4875
|
+
render,
|
|
4876
|
+
renderCache,
|
|
4877
|
+
props,
|
|
4878
|
+
data,
|
|
4879
|
+
setupState,
|
|
4880
|
+
ctx,
|
|
4881
|
+
inheritAttrs
|
|
4882
|
+
} = instance;
|
|
4883
|
+
const prev = setCurrentRenderingInstance(instance);
|
|
4884
|
+
let result;
|
|
4885
|
+
let fallthroughAttrs;
|
|
4886
|
+
try {
|
|
4887
|
+
if (vnode.shapeFlag & 4) {
|
|
4888
|
+
const proxyToUse = withProxy || proxy;
|
|
4889
|
+
const thisProxy = false ? new Proxy(proxyToUse, {
|
|
4890
|
+
get(target, key, receiver) {
|
|
4891
|
+
warn(
|
|
4892
|
+
`Property '${String(
|
|
4893
|
+
key
|
|
4894
|
+
)}' was accessed via 'this'. Avoid using 'this' in templates.`
|
|
4895
|
+
);
|
|
4896
|
+
return Reflect.get(target, key, receiver);
|
|
4921
4897
|
}
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4898
|
+
}) : proxyToUse;
|
|
4899
|
+
result = normalizeVNode(
|
|
4900
|
+
render.call(
|
|
4901
|
+
thisProxy,
|
|
4902
|
+
proxyToUse,
|
|
4903
|
+
renderCache,
|
|
4904
|
+
false ? shallowReadonly(props) : props,
|
|
4905
|
+
setupState,
|
|
4906
|
+
data,
|
|
4907
|
+
ctx
|
|
4908
|
+
)
|
|
4909
|
+
);
|
|
4910
|
+
fallthroughAttrs = attrs;
|
|
4911
|
+
} else {
|
|
4912
|
+
const render2 = Component;
|
|
4913
|
+
if (false) ;
|
|
4914
|
+
result = normalizeVNode(
|
|
4915
|
+
render2.length > 1 ? render2(
|
|
4916
|
+
false ? shallowReadonly(props) : props,
|
|
4917
|
+
false ? {
|
|
4918
|
+
get attrs() {
|
|
4919
|
+
markAttrsAccessed();
|
|
4920
|
+
return shallowReadonly(attrs);
|
|
4921
|
+
},
|
|
4922
|
+
slots,
|
|
4923
|
+
emit
|
|
4924
|
+
} : { attrs, slots, emit }
|
|
4925
|
+
) : render2(
|
|
4926
|
+
false ? shallowReadonly(props) : props,
|
|
4927
|
+
null
|
|
4928
|
+
)
|
|
4929
|
+
);
|
|
4930
|
+
fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
|
|
4931
|
+
}
|
|
4932
|
+
} catch (err) {
|
|
4933
|
+
blockStack.length = 0;
|
|
4934
|
+
handleError(err, instance, 1);
|
|
4935
|
+
result = createVNode(Comment);
|
|
4936
|
+
}
|
|
4937
|
+
let root = result;
|
|
4938
|
+
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
4939
|
+
const keys = Object.keys(fallthroughAttrs);
|
|
4940
|
+
const { shapeFlag } = root;
|
|
4941
|
+
if (keys.length) {
|
|
4942
|
+
if (shapeFlag & (1 | 6)) {
|
|
4943
|
+
if (propsOptions && keys.some(shared.isModelListener)) {
|
|
4944
|
+
fallthroughAttrs = filterModelListeners(
|
|
4945
|
+
fallthroughAttrs,
|
|
4946
|
+
propsOptions
|
|
4947
|
+
);
|
|
4929
4948
|
}
|
|
4949
|
+
root = cloneVNode(root, fallthroughAttrs, false, true);
|
|
4930
4950
|
}
|
|
4931
|
-
|
|
4932
|
-
current = vnode;
|
|
4933
|
-
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
4934
|
-
};
|
|
4951
|
+
}
|
|
4935
4952
|
}
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
if (shared.isArray(pattern)) {
|
|
4940
|
-
return pattern.some((p) => matches(p, name));
|
|
4941
|
-
} else if (shared.isString(pattern)) {
|
|
4942
|
-
return pattern.split(",").includes(name);
|
|
4943
|
-
} else if (shared.isRegExp(pattern)) {
|
|
4944
|
-
return pattern.test(name);
|
|
4953
|
+
if (vnode.dirs) {
|
|
4954
|
+
root = cloneVNode(root, null, false, true);
|
|
4955
|
+
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
4945
4956
|
}
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4957
|
+
if (vnode.transition) {
|
|
4958
|
+
root.transition = vnode.transition;
|
|
4959
|
+
}
|
|
4960
|
+
{
|
|
4961
|
+
result = root;
|
|
4962
|
+
}
|
|
4963
|
+
setCurrentRenderingInstance(prev);
|
|
4964
|
+
return result;
|
|
4953
4965
|
}
|
|
4954
|
-
function
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
injectHook(type, wrappedHook, target);
|
|
4966
|
-
if (target) {
|
|
4967
|
-
let current = target.parent;
|
|
4968
|
-
while (current && current.parent) {
|
|
4969
|
-
if (isKeepAlive(current.parent.vnode)) {
|
|
4970
|
-
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
4966
|
+
function filterSingleRoot(children, recurse = true) {
|
|
4967
|
+
let singleRoot;
|
|
4968
|
+
for (let i = 0; i < children.length; i++) {
|
|
4969
|
+
const child = children[i];
|
|
4970
|
+
if (isVNode(child)) {
|
|
4971
|
+
if (child.type !== Comment || child.children === "v-if") {
|
|
4972
|
+
if (singleRoot) {
|
|
4973
|
+
return;
|
|
4974
|
+
} else {
|
|
4975
|
+
singleRoot = child;
|
|
4976
|
+
}
|
|
4971
4977
|
}
|
|
4972
|
-
|
|
4978
|
+
} else {
|
|
4979
|
+
return;
|
|
4973
4980
|
}
|
|
4974
4981
|
}
|
|
4982
|
+
return singleRoot;
|
|
4975
4983
|
}
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
onUnmounted(() => {
|
|
4985
|
-
shared.remove(keepAliveRoot[type], injected);
|
|
4986
|
-
}, target);
|
|
4987
|
-
}
|
|
4988
|
-
function resetShapeFlag(vnode) {
|
|
4989
|
-
vnode.shapeFlag &= ~256;
|
|
4990
|
-
vnode.shapeFlag &= ~512;
|
|
4991
|
-
}
|
|
4992
|
-
function getInnerChild(vnode) {
|
|
4993
|
-
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
|
4994
|
-
}
|
|
4995
|
-
|
|
4996
|
-
const leaveCbKey = Symbol("_leaveCb");
|
|
4997
|
-
const enterCbKey = Symbol("_enterCb");
|
|
4998
|
-
function useTransitionState() {
|
|
4999
|
-
const state = {
|
|
5000
|
-
isMounted: false,
|
|
5001
|
-
isLeaving: false,
|
|
5002
|
-
isUnmounting: false,
|
|
5003
|
-
leavingVNodes: /* @__PURE__ */ new Map()
|
|
5004
|
-
};
|
|
5005
|
-
onMounted(() => {
|
|
5006
|
-
state.isMounted = true;
|
|
5007
|
-
});
|
|
5008
|
-
onBeforeUnmount(() => {
|
|
5009
|
-
state.isUnmounting = true;
|
|
5010
|
-
});
|
|
5011
|
-
return state;
|
|
5012
|
-
}
|
|
5013
|
-
const TransitionHookValidator = [Function, Array];
|
|
5014
|
-
const BaseTransitionPropsValidators = {
|
|
5015
|
-
mode: String,
|
|
5016
|
-
appear: Boolean,
|
|
5017
|
-
persisted: Boolean,
|
|
5018
|
-
// enter
|
|
5019
|
-
onBeforeEnter: TransitionHookValidator,
|
|
5020
|
-
onEnter: TransitionHookValidator,
|
|
5021
|
-
onAfterEnter: TransitionHookValidator,
|
|
5022
|
-
onEnterCancelled: TransitionHookValidator,
|
|
5023
|
-
// leave
|
|
5024
|
-
onBeforeLeave: TransitionHookValidator,
|
|
5025
|
-
onLeave: TransitionHookValidator,
|
|
5026
|
-
onAfterLeave: TransitionHookValidator,
|
|
5027
|
-
onLeaveCancelled: TransitionHookValidator,
|
|
5028
|
-
// appear
|
|
5029
|
-
onBeforeAppear: TransitionHookValidator,
|
|
5030
|
-
onAppear: TransitionHookValidator,
|
|
5031
|
-
onAfterAppear: TransitionHookValidator,
|
|
5032
|
-
onAppearCancelled: TransitionHookValidator
|
|
5033
|
-
};
|
|
5034
|
-
const recursiveGetSubtree = (instance) => {
|
|
5035
|
-
const subTree = instance.subTree;
|
|
5036
|
-
return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
|
|
4984
|
+
const getFunctionalFallthrough = (attrs) => {
|
|
4985
|
+
let res;
|
|
4986
|
+
for (const key in attrs) {
|
|
4987
|
+
if (key === "class" || key === "style" || shared.isOn(key)) {
|
|
4988
|
+
(res || (res = {}))[key] = attrs[key];
|
|
4989
|
+
}
|
|
4990
|
+
}
|
|
4991
|
+
return res;
|
|
5037
4992
|
};
|
|
5038
|
-
const
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
return () => {
|
|
5045
|
-
const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
|
5046
|
-
if (!children || !children.length) {
|
|
5047
|
-
return;
|
|
5048
|
-
}
|
|
5049
|
-
let child = children[0];
|
|
5050
|
-
if (children.length > 1) {
|
|
5051
|
-
for (const c of children) {
|
|
5052
|
-
if (c.type !== Comment) {
|
|
5053
|
-
child = c;
|
|
5054
|
-
break;
|
|
5055
|
-
}
|
|
5056
|
-
}
|
|
5057
|
-
}
|
|
5058
|
-
const rawProps = reactivity.toRaw(props);
|
|
5059
|
-
const { mode } = rawProps;
|
|
5060
|
-
if (state.isLeaving) {
|
|
5061
|
-
return emptyPlaceholder(child);
|
|
5062
|
-
}
|
|
5063
|
-
const innerChild = getKeepAliveChild(child);
|
|
5064
|
-
if (!innerChild) {
|
|
5065
|
-
return emptyPlaceholder(child);
|
|
5066
|
-
}
|
|
5067
|
-
let enterHooks = resolveTransitionHooks(
|
|
5068
|
-
innerChild,
|
|
5069
|
-
rawProps,
|
|
5070
|
-
state,
|
|
5071
|
-
instance,
|
|
5072
|
-
// #11061, ensure enterHooks is fresh after clone
|
|
5073
|
-
(hooks) => enterHooks = hooks
|
|
5074
|
-
);
|
|
5075
|
-
setTransitionHooks(innerChild, enterHooks);
|
|
5076
|
-
const oldChild = instance.subTree;
|
|
5077
|
-
const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
|
|
5078
|
-
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
|
|
5079
|
-
const leavingHooks = resolveTransitionHooks(
|
|
5080
|
-
oldInnerChild,
|
|
5081
|
-
rawProps,
|
|
5082
|
-
state,
|
|
5083
|
-
instance
|
|
5084
|
-
);
|
|
5085
|
-
setTransitionHooks(oldInnerChild, leavingHooks);
|
|
5086
|
-
if (mode === "out-in" && innerChild.type !== Comment) {
|
|
5087
|
-
state.isLeaving = true;
|
|
5088
|
-
leavingHooks.afterLeave = () => {
|
|
5089
|
-
state.isLeaving = false;
|
|
5090
|
-
if (instance.update.active !== false) {
|
|
5091
|
-
instance.effect.dirty = true;
|
|
5092
|
-
instance.update();
|
|
5093
|
-
}
|
|
5094
|
-
};
|
|
5095
|
-
return emptyPlaceholder(child);
|
|
5096
|
-
} else if (mode === "in-out" && innerChild.type !== Comment) {
|
|
5097
|
-
leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
|
5098
|
-
const leavingVNodesCache = getLeavingNodesForType(
|
|
5099
|
-
state,
|
|
5100
|
-
oldInnerChild
|
|
5101
|
-
);
|
|
5102
|
-
leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
|
5103
|
-
el[leaveCbKey] = () => {
|
|
5104
|
-
earlyRemove();
|
|
5105
|
-
el[leaveCbKey] = void 0;
|
|
5106
|
-
delete enterHooks.delayedLeave;
|
|
5107
|
-
};
|
|
5108
|
-
enterHooks.delayedLeave = delayedLeave;
|
|
5109
|
-
};
|
|
5110
|
-
}
|
|
5111
|
-
}
|
|
5112
|
-
return child;
|
|
5113
|
-
};
|
|
4993
|
+
const filterModelListeners = (attrs, props) => {
|
|
4994
|
+
const res = {};
|
|
4995
|
+
for (const key in attrs) {
|
|
4996
|
+
if (!shared.isModelListener(key) || !(key.slice(9) in props)) {
|
|
4997
|
+
res[key] = attrs[key];
|
|
4998
|
+
}
|
|
5114
4999
|
}
|
|
5000
|
+
return res;
|
|
5115
5001
|
};
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
const {
|
|
5119
|
-
|
|
5120
|
-
if (
|
|
5121
|
-
|
|
5122
|
-
leavingVNodes.set(vnode.type, leavingVNodesCache);
|
|
5002
|
+
function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
5003
|
+
const { props: prevProps, children: prevChildren, component } = prevVNode;
|
|
5004
|
+
const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
|
|
5005
|
+
const emits = component.emitsOptions;
|
|
5006
|
+
if (nextVNode.dirs || nextVNode.transition) {
|
|
5007
|
+
return true;
|
|
5123
5008
|
}
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
const {
|
|
5128
|
-
appear,
|
|
5129
|
-
mode,
|
|
5130
|
-
persisted = false,
|
|
5131
|
-
onBeforeEnter,
|
|
5132
|
-
onEnter,
|
|
5133
|
-
onAfterEnter,
|
|
5134
|
-
onEnterCancelled,
|
|
5135
|
-
onBeforeLeave,
|
|
5136
|
-
onLeave,
|
|
5137
|
-
onAfterLeave,
|
|
5138
|
-
onLeaveCancelled,
|
|
5139
|
-
onBeforeAppear,
|
|
5140
|
-
onAppear,
|
|
5141
|
-
onAfterAppear,
|
|
5142
|
-
onAppearCancelled
|
|
5143
|
-
} = props;
|
|
5144
|
-
const key = String(vnode.key);
|
|
5145
|
-
const leavingVNodesCache = getLeavingNodesForType(state, vnode);
|
|
5146
|
-
const callHook = (hook, args) => {
|
|
5147
|
-
hook && callWithAsyncErrorHandling(
|
|
5148
|
-
hook,
|
|
5149
|
-
instance,
|
|
5150
|
-
9,
|
|
5151
|
-
args
|
|
5152
|
-
);
|
|
5153
|
-
};
|
|
5154
|
-
const callAsyncHook = (hook, args) => {
|
|
5155
|
-
const done = args[1];
|
|
5156
|
-
callHook(hook, args);
|
|
5157
|
-
if (shared.isArray(hook)) {
|
|
5158
|
-
if (hook.every((hook2) => hook2.length <= 1)) done();
|
|
5159
|
-
} else if (hook.length <= 1) {
|
|
5160
|
-
done();
|
|
5009
|
+
if (optimized && patchFlag >= 0) {
|
|
5010
|
+
if (patchFlag & 1024) {
|
|
5011
|
+
return true;
|
|
5161
5012
|
}
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
return;
|
|
5013
|
+
if (patchFlag & 16) {
|
|
5014
|
+
if (!prevProps) {
|
|
5015
|
+
return !!nextProps;
|
|
5016
|
+
}
|
|
5017
|
+
return hasPropsChanged(prevProps, nextProps, emits);
|
|
5018
|
+
} else if (patchFlag & 8) {
|
|
5019
|
+
const dynamicProps = nextVNode.dynamicProps;
|
|
5020
|
+
for (let i = 0; i < dynamicProps.length; i++) {
|
|
5021
|
+
const key = dynamicProps[i];
|
|
5022
|
+
if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
|
|
5023
|
+
return true;
|
|
5173
5024
|
}
|
|
5174
5025
|
}
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5026
|
+
}
|
|
5027
|
+
} else {
|
|
5028
|
+
if (prevChildren || nextChildren) {
|
|
5029
|
+
if (!nextChildren || !nextChildren.$stable) {
|
|
5030
|
+
return true;
|
|
5180
5031
|
}
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5032
|
+
}
|
|
5033
|
+
if (prevProps === nextProps) {
|
|
5034
|
+
return false;
|
|
5035
|
+
}
|
|
5036
|
+
if (!prevProps) {
|
|
5037
|
+
return !!nextProps;
|
|
5038
|
+
}
|
|
5039
|
+
if (!nextProps) {
|
|
5040
|
+
return true;
|
|
5041
|
+
}
|
|
5042
|
+
return hasPropsChanged(prevProps, nextProps, emits);
|
|
5043
|
+
}
|
|
5044
|
+
return false;
|
|
5045
|
+
}
|
|
5046
|
+
function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
5047
|
+
const nextKeys = Object.keys(nextProps);
|
|
5048
|
+
if (nextKeys.length !== Object.keys(prevProps).length) {
|
|
5049
|
+
return true;
|
|
5050
|
+
}
|
|
5051
|
+
for (let i = 0; i < nextKeys.length; i++) {
|
|
5052
|
+
const key = nextKeys[i];
|
|
5053
|
+
if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
|
|
5054
|
+
return true;
|
|
5055
|
+
}
|
|
5056
|
+
}
|
|
5057
|
+
return false;
|
|
5058
|
+
}
|
|
5059
|
+
function updateHOCHostEl({ vnode, parent }, el) {
|
|
5060
|
+
while (parent) {
|
|
5061
|
+
const root = parent.subTree;
|
|
5062
|
+
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
5063
|
+
root.el = vnode.el;
|
|
5064
|
+
}
|
|
5065
|
+
if (root === vnode) {
|
|
5066
|
+
(vnode = parent.vnode).el = el;
|
|
5067
|
+
parent = parent.parent;
|
|
5068
|
+
} else {
|
|
5069
|
+
break;
|
|
5070
|
+
}
|
|
5071
|
+
}
|
|
5072
|
+
}
|
|
5073
|
+
|
|
5074
|
+
const isSuspense = (type) => type.__isSuspense;
|
|
5075
|
+
let suspenseId = 0;
|
|
5076
|
+
const SuspenseImpl = {
|
|
5077
|
+
name: "Suspense",
|
|
5078
|
+
// In order to make Suspense tree-shakable, we need to avoid importing it
|
|
5079
|
+
// directly in the renderer. The renderer checks for the __isSuspense flag
|
|
5080
|
+
// on a vnode's type and calls the `process` method, passing in renderer
|
|
5081
|
+
// internals.
|
|
5082
|
+
__isSuspense: true,
|
|
5083
|
+
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
|
5084
|
+
if (n1 == null) {
|
|
5085
|
+
mountSuspense(
|
|
5086
|
+
n2,
|
|
5087
|
+
container,
|
|
5088
|
+
anchor,
|
|
5089
|
+
parentComponent,
|
|
5090
|
+
parentSuspense,
|
|
5091
|
+
namespace,
|
|
5092
|
+
slotScopeIds,
|
|
5093
|
+
optimized,
|
|
5094
|
+
rendererInternals
|
|
5095
|
+
);
|
|
5096
|
+
} else {
|
|
5097
|
+
if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
|
|
5098
|
+
n2.suspense = n1.suspense;
|
|
5099
|
+
n2.suspense.vnode = n2;
|
|
5100
|
+
n2.el = n1.el;
|
|
5101
|
+
return;
|
|
5184
5102
|
}
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5103
|
+
patchSuspense(
|
|
5104
|
+
n1,
|
|
5105
|
+
n2,
|
|
5106
|
+
container,
|
|
5107
|
+
anchor,
|
|
5108
|
+
parentComponent,
|
|
5109
|
+
namespace,
|
|
5110
|
+
slotScopeIds,
|
|
5111
|
+
optimized,
|
|
5112
|
+
rendererInternals
|
|
5113
|
+
);
|
|
5114
|
+
}
|
|
5115
|
+
},
|
|
5116
|
+
hydrate: hydrateSuspense,
|
|
5117
|
+
normalize: normalizeSuspenseChildren
|
|
5118
|
+
};
|
|
5119
|
+
const Suspense = SuspenseImpl ;
|
|
5120
|
+
function triggerEvent(vnode, name) {
|
|
5121
|
+
const eventListener = vnode.props && vnode.props[name];
|
|
5122
|
+
if (shared.isFunction(eventListener)) {
|
|
5123
|
+
eventListener();
|
|
5124
|
+
}
|
|
5125
|
+
}
|
|
5126
|
+
function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
|
5127
|
+
const {
|
|
5128
|
+
p: patch,
|
|
5129
|
+
o: { createElement }
|
|
5130
|
+
} = rendererInternals;
|
|
5131
|
+
const hiddenContainer = createElement("div");
|
|
5132
|
+
const suspense = vnode.suspense = createSuspenseBoundary(
|
|
5133
|
+
vnode,
|
|
5134
|
+
parentSuspense,
|
|
5135
|
+
parentComponent,
|
|
5136
|
+
container,
|
|
5137
|
+
hiddenContainer,
|
|
5138
|
+
anchor,
|
|
5139
|
+
namespace,
|
|
5140
|
+
slotScopeIds,
|
|
5141
|
+
optimized,
|
|
5142
|
+
rendererInternals
|
|
5143
|
+
);
|
|
5144
|
+
patch(
|
|
5145
|
+
null,
|
|
5146
|
+
suspense.pendingBranch = vnode.ssContent,
|
|
5147
|
+
hiddenContainer,
|
|
5148
|
+
null,
|
|
5149
|
+
parentComponent,
|
|
5150
|
+
suspense,
|
|
5151
|
+
namespace,
|
|
5152
|
+
slotScopeIds
|
|
5153
|
+
);
|
|
5154
|
+
if (suspense.deps > 0) {
|
|
5155
|
+
triggerEvent(vnode, "onPending");
|
|
5156
|
+
triggerEvent(vnode, "onFallback");
|
|
5157
|
+
patch(
|
|
5158
|
+
null,
|
|
5159
|
+
vnode.ssFallback,
|
|
5160
|
+
container,
|
|
5161
|
+
anchor,
|
|
5162
|
+
parentComponent,
|
|
5163
|
+
null,
|
|
5164
|
+
// fallback tree will not have suspense context
|
|
5165
|
+
namespace,
|
|
5166
|
+
slotScopeIds
|
|
5167
|
+
);
|
|
5168
|
+
setActiveBranch(suspense, vnode.ssFallback);
|
|
5169
|
+
} else {
|
|
5170
|
+
suspense.resolve(false, true);
|
|
5171
|
+
}
|
|
5172
|
+
}
|
|
5173
|
+
function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
|
|
5174
|
+
const suspense = n2.suspense = n1.suspense;
|
|
5175
|
+
suspense.vnode = n2;
|
|
5176
|
+
n2.el = n1.el;
|
|
5177
|
+
const newBranch = n2.ssContent;
|
|
5178
|
+
const newFallback = n2.ssFallback;
|
|
5179
|
+
const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
|
|
5180
|
+
if (pendingBranch) {
|
|
5181
|
+
suspense.pendingBranch = newBranch;
|
|
5182
|
+
if (isSameVNodeType(newBranch, pendingBranch)) {
|
|
5183
|
+
patch(
|
|
5184
|
+
pendingBranch,
|
|
5185
|
+
newBranch,
|
|
5186
|
+
suspense.hiddenContainer,
|
|
5187
|
+
null,
|
|
5188
|
+
parentComponent,
|
|
5189
|
+
suspense,
|
|
5190
|
+
namespace,
|
|
5191
|
+
slotScopeIds,
|
|
5192
|
+
optimized
|
|
5193
|
+
);
|
|
5194
|
+
if (suspense.deps <= 0) {
|
|
5195
|
+
suspense.resolve();
|
|
5196
|
+
} else if (isInFallback) {
|
|
5197
|
+
if (!isHydrating) {
|
|
5198
|
+
patch(
|
|
5199
|
+
activeBranch,
|
|
5200
|
+
newFallback,
|
|
5201
|
+
container,
|
|
5202
|
+
anchor,
|
|
5203
|
+
parentComponent,
|
|
5204
|
+
null,
|
|
5205
|
+
// fallback tree will not have suspense context
|
|
5206
|
+
namespace,
|
|
5207
|
+
slotScopeIds,
|
|
5208
|
+
optimized
|
|
5209
|
+
);
|
|
5210
|
+
setActiveBranch(suspense, newFallback);
|
|
5198
5211
|
}
|
|
5199
5212
|
}
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
callHook(cancelHook, [el]);
|
|
5206
|
-
} else {
|
|
5207
|
-
callHook(afterHook, [el]);
|
|
5208
|
-
}
|
|
5209
|
-
if (hooks.delayedLeave) {
|
|
5210
|
-
hooks.delayedLeave();
|
|
5211
|
-
}
|
|
5212
|
-
el[enterCbKey] = void 0;
|
|
5213
|
-
};
|
|
5214
|
-
if (hook) {
|
|
5215
|
-
callAsyncHook(hook, [el, done]);
|
|
5213
|
+
} else {
|
|
5214
|
+
suspense.pendingId = suspenseId++;
|
|
5215
|
+
if (isHydrating) {
|
|
5216
|
+
suspense.isHydrating = false;
|
|
5217
|
+
suspense.activeBranch = pendingBranch;
|
|
5216
5218
|
} else {
|
|
5217
|
-
|
|
5219
|
+
unmount(pendingBranch, parentComponent, suspense);
|
|
5218
5220
|
}
|
|
5219
|
-
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
if (
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5221
|
+
suspense.deps = 0;
|
|
5222
|
+
suspense.effects.length = 0;
|
|
5223
|
+
suspense.hiddenContainer = createElement("div");
|
|
5224
|
+
if (isInFallback) {
|
|
5225
|
+
patch(
|
|
5226
|
+
null,
|
|
5227
|
+
newBranch,
|
|
5228
|
+
suspense.hiddenContainer,
|
|
5229
|
+
null,
|
|
5230
|
+
parentComponent,
|
|
5231
|
+
suspense,
|
|
5232
|
+
namespace,
|
|
5233
|
+
slotScopeIds,
|
|
5234
|
+
optimized
|
|
5226
5235
|
);
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
return remove();
|
|
5230
|
-
}
|
|
5231
|
-
callHook(onBeforeLeave, [el]);
|
|
5232
|
-
let called = false;
|
|
5233
|
-
const done = el[leaveCbKey] = (cancelled) => {
|
|
5234
|
-
if (called) return;
|
|
5235
|
-
called = true;
|
|
5236
|
-
remove();
|
|
5237
|
-
if (cancelled) {
|
|
5238
|
-
callHook(onLeaveCancelled, [el]);
|
|
5236
|
+
if (suspense.deps <= 0) {
|
|
5237
|
+
suspense.resolve();
|
|
5239
5238
|
} else {
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5239
|
+
patch(
|
|
5240
|
+
activeBranch,
|
|
5241
|
+
newFallback,
|
|
5242
|
+
container,
|
|
5243
|
+
anchor,
|
|
5244
|
+
parentComponent,
|
|
5245
|
+
null,
|
|
5246
|
+
// fallback tree will not have suspense context
|
|
5247
|
+
namespace,
|
|
5248
|
+
slotScopeIds,
|
|
5249
|
+
optimized
|
|
5250
|
+
);
|
|
5251
|
+
setActiveBranch(suspense, newFallback);
|
|
5245
5252
|
}
|
|
5246
|
-
}
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5253
|
+
} else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
|
5254
|
+
patch(
|
|
5255
|
+
activeBranch,
|
|
5256
|
+
newBranch,
|
|
5257
|
+
container,
|
|
5258
|
+
anchor,
|
|
5259
|
+
parentComponent,
|
|
5260
|
+
suspense,
|
|
5261
|
+
namespace,
|
|
5262
|
+
slotScopeIds,
|
|
5263
|
+
optimized
|
|
5264
|
+
);
|
|
5265
|
+
suspense.resolve(true);
|
|
5250
5266
|
} else {
|
|
5251
|
-
|
|
5267
|
+
patch(
|
|
5268
|
+
null,
|
|
5269
|
+
newBranch,
|
|
5270
|
+
suspense.hiddenContainer,
|
|
5271
|
+
null,
|
|
5272
|
+
parentComponent,
|
|
5273
|
+
suspense,
|
|
5274
|
+
namespace,
|
|
5275
|
+
slotScopeIds,
|
|
5276
|
+
optimized
|
|
5277
|
+
);
|
|
5278
|
+
if (suspense.deps <= 0) {
|
|
5279
|
+
suspense.resolve();
|
|
5280
|
+
}
|
|
5252
5281
|
}
|
|
5253
|
-
},
|
|
5254
|
-
clone(vnode2) {
|
|
5255
|
-
const hooks2 = resolveTransitionHooks(
|
|
5256
|
-
vnode2,
|
|
5257
|
-
props,
|
|
5258
|
-
state,
|
|
5259
|
-
instance,
|
|
5260
|
-
postClone
|
|
5261
|
-
);
|
|
5262
|
-
if (postClone) postClone(hooks2);
|
|
5263
|
-
return hooks2;
|
|
5264
|
-
}
|
|
5265
|
-
};
|
|
5266
|
-
return hooks;
|
|
5267
|
-
}
|
|
5268
|
-
function emptyPlaceholder(vnode) {
|
|
5269
|
-
if (isKeepAlive(vnode)) {
|
|
5270
|
-
vnode = cloneVNode(vnode);
|
|
5271
|
-
vnode.children = null;
|
|
5272
|
-
return vnode;
|
|
5273
|
-
}
|
|
5274
|
-
}
|
|
5275
|
-
function getKeepAliveChild(vnode) {
|
|
5276
|
-
if (!isKeepAlive(vnode)) {
|
|
5277
|
-
return vnode;
|
|
5278
|
-
}
|
|
5279
|
-
const { shapeFlag, children } = vnode;
|
|
5280
|
-
if (children) {
|
|
5281
|
-
if (shapeFlag & 16) {
|
|
5282
|
-
return children[0];
|
|
5283
|
-
}
|
|
5284
|
-
if (shapeFlag & 32 && shared.isFunction(children.default)) {
|
|
5285
|
-
return children.default();
|
|
5286
5282
|
}
|
|
5287
|
-
}
|
|
5288
|
-
}
|
|
5289
|
-
function setTransitionHooks(vnode, hooks) {
|
|
5290
|
-
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
5291
|
-
setTransitionHooks(vnode.component.subTree, hooks);
|
|
5292
|
-
} else if (vnode.shapeFlag & 128) {
|
|
5293
|
-
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
5294
|
-
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
5295
5283
|
} else {
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
ret = ret.concat(
|
|
5308
|
-
getTransitionRawChildren(child.children, keepComment, key)
|
|
5284
|
+
if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
|
5285
|
+
patch(
|
|
5286
|
+
activeBranch,
|
|
5287
|
+
newBranch,
|
|
5288
|
+
container,
|
|
5289
|
+
anchor,
|
|
5290
|
+
parentComponent,
|
|
5291
|
+
suspense,
|
|
5292
|
+
namespace,
|
|
5293
|
+
slotScopeIds,
|
|
5294
|
+
optimized
|
|
5309
5295
|
);
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5296
|
+
setActiveBranch(suspense, newBranch);
|
|
5297
|
+
} else {
|
|
5298
|
+
triggerEvent(n2, "onPending");
|
|
5299
|
+
suspense.pendingBranch = newBranch;
|
|
5300
|
+
if (newBranch.shapeFlag & 512) {
|
|
5301
|
+
suspense.pendingId = newBranch.component.suspenseId;
|
|
5302
|
+
} else {
|
|
5303
|
+
suspense.pendingId = suspenseId++;
|
|
5304
|
+
}
|
|
5305
|
+
patch(
|
|
5306
|
+
null,
|
|
5307
|
+
newBranch,
|
|
5308
|
+
suspense.hiddenContainer,
|
|
5309
|
+
null,
|
|
5310
|
+
parentComponent,
|
|
5311
|
+
suspense,
|
|
5312
|
+
namespace,
|
|
5313
|
+
slotScopeIds,
|
|
5314
|
+
optimized
|
|
5315
|
+
);
|
|
5316
|
+
if (suspense.deps <= 0) {
|
|
5317
|
+
suspense.resolve();
|
|
5318
|
+
} else {
|
|
5319
|
+
const { timeout, pendingId } = suspense;
|
|
5320
|
+
if (timeout > 0) {
|
|
5321
|
+
setTimeout(() => {
|
|
5322
|
+
if (suspense.pendingId === pendingId) {
|
|
5323
|
+
suspense.fallback(newFallback);
|
|
5324
|
+
}
|
|
5325
|
+
}, timeout);
|
|
5326
|
+
} else if (timeout === 0) {
|
|
5327
|
+
suspense.fallback(newFallback);
|
|
5328
|
+
}
|
|
5329
|
+
}
|
|
5317
5330
|
}
|
|
5318
5331
|
}
|
|
5319
|
-
return ret;
|
|
5320
5332
|
}
|
|
5321
|
-
|
|
5322
|
-
const
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5333
|
+
function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
|
|
5334
|
+
const {
|
|
5335
|
+
p: patch,
|
|
5336
|
+
m: move,
|
|
5337
|
+
um: unmount,
|
|
5338
|
+
n: next,
|
|
5339
|
+
o: { parentNode, remove }
|
|
5340
|
+
} = rendererInternals;
|
|
5341
|
+
let parentSuspenseId;
|
|
5342
|
+
const isSuspensible = isVNodeSuspensible(vnode);
|
|
5343
|
+
if (isSuspensible) {
|
|
5344
|
+
if (parentSuspense && parentSuspense.pendingBranch) {
|
|
5345
|
+
parentSuspenseId = parentSuspense.pendingId;
|
|
5346
|
+
parentSuspense.deps++;
|
|
5334
5347
|
}
|
|
5335
|
-
} else {
|
|
5336
|
-
return targetSelector;
|
|
5337
5348
|
}
|
|
5338
|
-
|
|
5339
|
-
const
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
const
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5349
|
+
const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
|
|
5350
|
+
const initialAnchor = anchor;
|
|
5351
|
+
const suspense = {
|
|
5352
|
+
vnode,
|
|
5353
|
+
parent: parentSuspense,
|
|
5354
|
+
parentComponent,
|
|
5355
|
+
namespace,
|
|
5356
|
+
container,
|
|
5357
|
+
hiddenContainer,
|
|
5358
|
+
deps: 0,
|
|
5359
|
+
pendingId: suspenseId++,
|
|
5360
|
+
timeout: typeof timeout === "number" ? timeout : -1,
|
|
5361
|
+
activeBranch: null,
|
|
5362
|
+
pendingBranch: null,
|
|
5363
|
+
isInFallback: !isHydrating,
|
|
5364
|
+
isHydrating,
|
|
5365
|
+
isUnmounted: false,
|
|
5366
|
+
effects: [],
|
|
5367
|
+
resolve(resume = false, sync = false) {
|
|
5368
|
+
const {
|
|
5369
|
+
vnode: vnode2,
|
|
5370
|
+
activeBranch,
|
|
5371
|
+
pendingBranch,
|
|
5372
|
+
pendingId,
|
|
5373
|
+
effects,
|
|
5374
|
+
parentComponent: parentComponent2,
|
|
5375
|
+
container: container2
|
|
5376
|
+
} = suspense;
|
|
5377
|
+
let delayEnter = false;
|
|
5378
|
+
if (suspense.isHydrating) {
|
|
5379
|
+
suspense.isHydrating = false;
|
|
5380
|
+
} else if (!resume) {
|
|
5381
|
+
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
5382
|
+
if (delayEnter) {
|
|
5383
|
+
activeBranch.transition.afterLeave = () => {
|
|
5384
|
+
if (pendingId === suspense.pendingId) {
|
|
5385
|
+
move(
|
|
5386
|
+
pendingBranch,
|
|
5387
|
+
container2,
|
|
5388
|
+
anchor === initialAnchor ? next(activeBranch) : anchor,
|
|
5389
|
+
0
|
|
5390
|
+
);
|
|
5391
|
+
queuePostFlushCb(effects);
|
|
5392
|
+
}
|
|
5393
|
+
};
|
|
5394
|
+
}
|
|
5395
|
+
if (activeBranch) {
|
|
5396
|
+
if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
|
|
5397
|
+
anchor = next(activeBranch);
|
|
5398
|
+
}
|
|
5399
|
+
unmount(activeBranch, parentComponent2, suspense, true);
|
|
5400
|
+
}
|
|
5401
|
+
if (!delayEnter) {
|
|
5402
|
+
move(pendingBranch, container2, anchor, 0);
|
|
5364
5403
|
}
|
|
5365
5404
|
}
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
|
|
5374
|
-
|
|
5375
|
-
|
|
5376
|
-
optimized
|
|
5377
|
-
);
|
|
5405
|
+
setActiveBranch(suspense, pendingBranch);
|
|
5406
|
+
suspense.pendingBranch = null;
|
|
5407
|
+
suspense.isInFallback = false;
|
|
5408
|
+
let parent = suspense.parent;
|
|
5409
|
+
let hasUnresolvedAncestor = false;
|
|
5410
|
+
while (parent) {
|
|
5411
|
+
if (parent.pendingBranch) {
|
|
5412
|
+
parent.effects.push(...effects);
|
|
5413
|
+
hasUnresolvedAncestor = true;
|
|
5414
|
+
break;
|
|
5378
5415
|
}
|
|
5379
|
-
|
|
5380
|
-
if (disabled) {
|
|
5381
|
-
mount(container, mainAnchor);
|
|
5382
|
-
} else if (target) {
|
|
5383
|
-
mount(target, targetAnchor);
|
|
5416
|
+
parent = parent.parent;
|
|
5384
5417
|
}
|
|
5385
|
-
|
|
5386
|
-
|
|
5387
|
-
const mainAnchor = n2.anchor = n1.anchor;
|
|
5388
|
-
const target = n2.target = n1.target;
|
|
5389
|
-
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
5390
|
-
const wasDisabled = isTeleportDisabled(n1.props);
|
|
5391
|
-
const currentContainer = wasDisabled ? container : target;
|
|
5392
|
-
const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
|
5393
|
-
if (namespace === "svg" || isTargetSVG(target)) {
|
|
5394
|
-
namespace = "svg";
|
|
5395
|
-
} else if (namespace === "mathml" || isTargetMathML(target)) {
|
|
5396
|
-
namespace = "mathml";
|
|
5418
|
+
if (!hasUnresolvedAncestor && !delayEnter) {
|
|
5419
|
+
queuePostFlushCb(effects);
|
|
5397
5420
|
}
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5415
|
-
|
|
5416
|
-
|
|
5417
|
-
|
|
5421
|
+
suspense.effects = [];
|
|
5422
|
+
if (isSuspensible) {
|
|
5423
|
+
if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
|
|
5424
|
+
parentSuspense.deps--;
|
|
5425
|
+
if (parentSuspense.deps === 0 && !sync) {
|
|
5426
|
+
parentSuspense.resolve();
|
|
5427
|
+
}
|
|
5428
|
+
}
|
|
5429
|
+
}
|
|
5430
|
+
triggerEvent(vnode2, "onResolve");
|
|
5431
|
+
},
|
|
5432
|
+
fallback(fallbackVNode) {
|
|
5433
|
+
if (!suspense.pendingBranch) {
|
|
5434
|
+
return;
|
|
5435
|
+
}
|
|
5436
|
+
const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
|
|
5437
|
+
triggerEvent(vnode2, "onFallback");
|
|
5438
|
+
const anchor2 = next(activeBranch);
|
|
5439
|
+
const mountFallback = () => {
|
|
5440
|
+
if (!suspense.isInFallback) {
|
|
5441
|
+
return;
|
|
5442
|
+
}
|
|
5443
|
+
patch(
|
|
5444
|
+
null,
|
|
5445
|
+
fallbackVNode,
|
|
5446
|
+
container2,
|
|
5447
|
+
anchor2,
|
|
5448
|
+
parentComponent2,
|
|
5449
|
+
null,
|
|
5450
|
+
// fallback tree will not have suspense context
|
|
5451
|
+
namespace2,
|
|
5418
5452
|
slotScopeIds,
|
|
5419
|
-
|
|
5453
|
+
optimized
|
|
5420
5454
|
);
|
|
5455
|
+
setActiveBranch(suspense, fallbackVNode);
|
|
5456
|
+
};
|
|
5457
|
+
const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
|
5458
|
+
if (delayEnter) {
|
|
5459
|
+
activeBranch.transition.afterLeave = mountFallback;
|
|
5421
5460
|
}
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5432
|
-
|
|
5433
|
-
|
|
5434
|
-
|
|
5461
|
+
suspense.isInFallback = true;
|
|
5462
|
+
unmount(
|
|
5463
|
+
activeBranch,
|
|
5464
|
+
parentComponent2,
|
|
5465
|
+
null,
|
|
5466
|
+
// no suspense so unmount hooks fire now
|
|
5467
|
+
true
|
|
5468
|
+
// shouldRemove
|
|
5469
|
+
);
|
|
5470
|
+
if (!delayEnter) {
|
|
5471
|
+
mountFallback();
|
|
5472
|
+
}
|
|
5473
|
+
},
|
|
5474
|
+
move(container2, anchor2, type) {
|
|
5475
|
+
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
|
5476
|
+
suspense.container = container2;
|
|
5477
|
+
},
|
|
5478
|
+
next() {
|
|
5479
|
+
return suspense.activeBranch && next(suspense.activeBranch);
|
|
5480
|
+
},
|
|
5481
|
+
registerDep(instance, setupRenderEffect, optimized2) {
|
|
5482
|
+
const isInPendingSuspense = !!suspense.pendingBranch;
|
|
5483
|
+
if (isInPendingSuspense) {
|
|
5484
|
+
suspense.deps++;
|
|
5485
|
+
}
|
|
5486
|
+
const hydratedEl = instance.vnode.el;
|
|
5487
|
+
instance.asyncDep.catch((err) => {
|
|
5488
|
+
handleError(err, instance, 0);
|
|
5489
|
+
}).then((asyncSetupResult) => {
|
|
5490
|
+
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
|
|
5491
|
+
return;
|
|
5492
|
+
}
|
|
5493
|
+
instance.asyncResolved = true;
|
|
5494
|
+
const { vnode: vnode2 } = instance;
|
|
5495
|
+
handleSetupResult(instance, asyncSetupResult, false);
|
|
5496
|
+
if (hydratedEl) {
|
|
5497
|
+
vnode2.el = hydratedEl;
|
|
5498
|
+
}
|
|
5499
|
+
const placeholder = !hydratedEl && instance.subTree.el;
|
|
5500
|
+
setupRenderEffect(
|
|
5501
|
+
instance,
|
|
5502
|
+
vnode2,
|
|
5503
|
+
// component may have been moved before resolve.
|
|
5504
|
+
// if this is not a hydration, instance.subTree will be the comment
|
|
5505
|
+
// placeholder.
|
|
5506
|
+
parentNode(hydratedEl || instance.subTree.el),
|
|
5507
|
+
// anchor will not be used if this is hydration, so only need to
|
|
5508
|
+
// consider the comment placeholder case.
|
|
5509
|
+
hydratedEl ? null : next(instance.subTree),
|
|
5510
|
+
suspense,
|
|
5511
|
+
namespace,
|
|
5512
|
+
optimized2
|
|
5513
|
+
);
|
|
5514
|
+
if (placeholder) {
|
|
5515
|
+
remove(placeholder);
|
|
5435
5516
|
}
|
|
5436
|
-
|
|
5437
|
-
if (
|
|
5438
|
-
|
|
5439
|
-
n2.props,
|
|
5440
|
-
querySelector
|
|
5441
|
-
);
|
|
5442
|
-
if (nextTarget) {
|
|
5443
|
-
moveTeleport(
|
|
5444
|
-
n2,
|
|
5445
|
-
nextTarget,
|
|
5446
|
-
null,
|
|
5447
|
-
internals,
|
|
5448
|
-
0
|
|
5449
|
-
);
|
|
5450
|
-
}
|
|
5451
|
-
} else if (wasDisabled) {
|
|
5452
|
-
moveTeleport(
|
|
5453
|
-
n2,
|
|
5454
|
-
target,
|
|
5455
|
-
targetAnchor,
|
|
5456
|
-
internals,
|
|
5457
|
-
1
|
|
5458
|
-
);
|
|
5517
|
+
updateHOCHostEl(instance, vnode2.el);
|
|
5518
|
+
if (isInPendingSuspense && --suspense.deps === 0) {
|
|
5519
|
+
suspense.resolve();
|
|
5459
5520
|
}
|
|
5460
|
-
}
|
|
5461
|
-
}
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
const { shapeFlag, children, anchor, targetAnchor, target, props } = vnode;
|
|
5466
|
-
if (target) {
|
|
5467
|
-
hostRemove(targetAnchor);
|
|
5468
|
-
}
|
|
5469
|
-
doRemove && hostRemove(anchor);
|
|
5470
|
-
if (shapeFlag & 16) {
|
|
5471
|
-
const shouldRemove = doRemove || !isTeleportDisabled(props);
|
|
5472
|
-
for (let i = 0; i < children.length; i++) {
|
|
5473
|
-
const child = children[i];
|
|
5521
|
+
});
|
|
5522
|
+
},
|
|
5523
|
+
unmount(parentSuspense2, doRemove) {
|
|
5524
|
+
suspense.isUnmounted = true;
|
|
5525
|
+
if (suspense.activeBranch) {
|
|
5474
5526
|
unmount(
|
|
5475
|
-
|
|
5527
|
+
suspense.activeBranch,
|
|
5476
5528
|
parentComponent,
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
!!child.dynamicChildren
|
|
5529
|
+
parentSuspense2,
|
|
5530
|
+
doRemove
|
|
5480
5531
|
);
|
|
5481
5532
|
}
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
if (moveType === 0) {
|
|
5489
|
-
insert(vnode.targetAnchor, container, parentAnchor);
|
|
5490
|
-
}
|
|
5491
|
-
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
5492
|
-
const isReorder = moveType === 2;
|
|
5493
|
-
if (isReorder) {
|
|
5494
|
-
insert(el, container, parentAnchor);
|
|
5495
|
-
}
|
|
5496
|
-
if (!isReorder || isTeleportDisabled(props)) {
|
|
5497
|
-
if (shapeFlag & 16) {
|
|
5498
|
-
for (let i = 0; i < children.length; i++) {
|
|
5499
|
-
move(
|
|
5500
|
-
children[i],
|
|
5501
|
-
container,
|
|
5502
|
-
parentAnchor,
|
|
5503
|
-
2
|
|
5533
|
+
if (suspense.pendingBranch) {
|
|
5534
|
+
unmount(
|
|
5535
|
+
suspense.pendingBranch,
|
|
5536
|
+
parentComponent,
|
|
5537
|
+
parentSuspense2,
|
|
5538
|
+
doRemove
|
|
5504
5539
|
);
|
|
5505
5540
|
}
|
|
5506
5541
|
}
|
|
5542
|
+
};
|
|
5543
|
+
return suspense;
|
|
5544
|
+
}
|
|
5545
|
+
function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
|
|
5546
|
+
const suspense = vnode.suspense = createSuspenseBoundary(
|
|
5547
|
+
vnode,
|
|
5548
|
+
parentSuspense,
|
|
5549
|
+
parentComponent,
|
|
5550
|
+
node.parentNode,
|
|
5551
|
+
// eslint-disable-next-line no-restricted-globals
|
|
5552
|
+
document.createElement("div"),
|
|
5553
|
+
null,
|
|
5554
|
+
namespace,
|
|
5555
|
+
slotScopeIds,
|
|
5556
|
+
optimized,
|
|
5557
|
+
rendererInternals,
|
|
5558
|
+
true
|
|
5559
|
+
);
|
|
5560
|
+
const result = hydrateNode(
|
|
5561
|
+
node,
|
|
5562
|
+
suspense.pendingBranch = vnode.ssContent,
|
|
5563
|
+
parentComponent,
|
|
5564
|
+
suspense,
|
|
5565
|
+
slotScopeIds,
|
|
5566
|
+
optimized
|
|
5567
|
+
);
|
|
5568
|
+
if (suspense.deps === 0) {
|
|
5569
|
+
suspense.resolve(false, true);
|
|
5507
5570
|
}
|
|
5508
|
-
|
|
5509
|
-
insert(anchor, container, parentAnchor);
|
|
5510
|
-
}
|
|
5571
|
+
return result;
|
|
5511
5572
|
}
|
|
5512
|
-
function
|
|
5513
|
-
|
|
5514
|
-
|
|
5515
|
-
|
|
5516
|
-
|
|
5517
|
-
querySelector
|
|
5573
|
+
function normalizeSuspenseChildren(vnode) {
|
|
5574
|
+
const { shapeFlag, children } = vnode;
|
|
5575
|
+
const isSlotChildren = shapeFlag & 32;
|
|
5576
|
+
vnode.ssContent = normalizeSuspenseSlot(
|
|
5577
|
+
isSlotChildren ? children.default : children
|
|
5518
5578
|
);
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
vnode.anchor = nextSibling(node);
|
|
5535
|
-
let targetAnchor = targetNode;
|
|
5536
|
-
while (targetAnchor) {
|
|
5537
|
-
targetAnchor = nextSibling(targetAnchor);
|
|
5538
|
-
if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
|
|
5539
|
-
vnode.targetAnchor = targetAnchor;
|
|
5540
|
-
target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
5541
|
-
break;
|
|
5542
|
-
}
|
|
5543
|
-
}
|
|
5544
|
-
hydrateChildren(
|
|
5545
|
-
targetNode,
|
|
5546
|
-
vnode,
|
|
5547
|
-
target,
|
|
5548
|
-
parentComponent,
|
|
5549
|
-
parentSuspense,
|
|
5550
|
-
slotScopeIds,
|
|
5551
|
-
optimized
|
|
5552
|
-
);
|
|
5553
|
-
}
|
|
5579
|
+
vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
|
|
5580
|
+
}
|
|
5581
|
+
function normalizeSuspenseSlot(s) {
|
|
5582
|
+
let block;
|
|
5583
|
+
if (shared.isFunction(s)) {
|
|
5584
|
+
const trackBlock = isBlockTreeEnabled && s._c;
|
|
5585
|
+
if (trackBlock) {
|
|
5586
|
+
s._d = false;
|
|
5587
|
+
openBlock();
|
|
5588
|
+
}
|
|
5589
|
+
s = s();
|
|
5590
|
+
if (trackBlock) {
|
|
5591
|
+
s._d = true;
|
|
5592
|
+
block = currentBlock;
|
|
5593
|
+
closeBlock();
|
|
5554
5594
|
}
|
|
5555
|
-
updateCssVars(vnode);
|
|
5556
5595
|
}
|
|
5557
|
-
|
|
5596
|
+
if (shared.isArray(s)) {
|
|
5597
|
+
const singleChild = filterSingleRoot(s);
|
|
5598
|
+
s = singleChild;
|
|
5599
|
+
}
|
|
5600
|
+
s = normalizeVNode(s);
|
|
5601
|
+
if (block && !s.dynamicChildren) {
|
|
5602
|
+
s.dynamicChildren = block.filter((c) => c !== s);
|
|
5603
|
+
}
|
|
5604
|
+
return s;
|
|
5558
5605
|
}
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5563
|
-
|
|
5564
|
-
|
|
5565
|
-
if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
|
|
5566
|
-
node = node.nextSibling;
|
|
5606
|
+
function queueEffectWithSuspense(fn, suspense) {
|
|
5607
|
+
if (suspense && suspense.pendingBranch) {
|
|
5608
|
+
if (shared.isArray(fn)) {
|
|
5609
|
+
suspense.effects.push(...fn);
|
|
5610
|
+
} else {
|
|
5611
|
+
suspense.effects.push(fn);
|
|
5567
5612
|
}
|
|
5568
|
-
|
|
5613
|
+
} else {
|
|
5614
|
+
queuePostFlushCb(fn);
|
|
5615
|
+
}
|
|
5616
|
+
}
|
|
5617
|
+
function setActiveBranch(suspense, branch) {
|
|
5618
|
+
suspense.activeBranch = branch;
|
|
5619
|
+
const { vnode, parentComponent } = suspense;
|
|
5620
|
+
let el = branch.el;
|
|
5621
|
+
while (!el && branch.component) {
|
|
5622
|
+
branch = branch.component.subTree;
|
|
5623
|
+
el = branch.el;
|
|
5624
|
+
}
|
|
5625
|
+
vnode.el = el;
|
|
5626
|
+
if (parentComponent && parentComponent.subTree === vnode) {
|
|
5627
|
+
parentComponent.vnode.el = el;
|
|
5628
|
+
updateHOCHostEl(parentComponent, el);
|
|
5569
5629
|
}
|
|
5570
5630
|
}
|
|
5631
|
+
function isVNodeSuspensible(vnode) {
|
|
5632
|
+
const suspensible = vnode.props && vnode.props.suspensible;
|
|
5633
|
+
return suspensible != null && suspensible !== false;
|
|
5634
|
+
}
|
|
5571
5635
|
|
|
5572
5636
|
const Fragment = Symbol.for("v-fgt");
|
|
5573
5637
|
const Text = Symbol.for("v-txt");
|
|
@@ -5585,6 +5649,9 @@ function closeBlock() {
|
|
|
5585
5649
|
let isBlockTreeEnabled = 1;
|
|
5586
5650
|
function setBlockTracking(value) {
|
|
5587
5651
|
isBlockTreeEnabled += value;
|
|
5652
|
+
if (value < 0 && currentBlock) {
|
|
5653
|
+
currentBlock.hasOnce = true;
|
|
5654
|
+
}
|
|
5588
5655
|
}
|
|
5589
5656
|
function setupBlock(vnode) {
|
|
5590
5657
|
vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || shared.EMPTY_ARR : null;
|
|
@@ -5658,6 +5725,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
5658
5725
|
el: null,
|
|
5659
5726
|
anchor: null,
|
|
5660
5727
|
target: null,
|
|
5728
|
+
targetStart: null,
|
|
5661
5729
|
targetAnchor: null,
|
|
5662
5730
|
staticCount: 0,
|
|
5663
5731
|
shapeFlag,
|
|
@@ -5764,6 +5832,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
5764
5832
|
slotScopeIds: vnode.slotScopeIds,
|
|
5765
5833
|
children: children,
|
|
5766
5834
|
target: vnode.target,
|
|
5835
|
+
targetStart: vnode.targetStart,
|
|
5767
5836
|
targetAnchor: vnode.targetAnchor,
|
|
5768
5837
|
staticCount: vnode.staticCount,
|
|
5769
5838
|
shapeFlag: vnode.shapeFlag,
|
|
@@ -5958,8 +6027,6 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
5958
6027
|
refs: shared.EMPTY_OBJ,
|
|
5959
6028
|
setupState: shared.EMPTY_OBJ,
|
|
5960
6029
|
setupContext: null,
|
|
5961
|
-
attrsProxy: null,
|
|
5962
|
-
slotsProxy: null,
|
|
5963
6030
|
// suspense related
|
|
5964
6031
|
suspense,
|
|
5965
6032
|
suspenseId: suspense ? suspense.pendingId : 0,
|
|
@@ -6036,12 +6103,12 @@ function isStatefulComponent(instance) {
|
|
|
6036
6103
|
return instance.vnode.shapeFlag & 4;
|
|
6037
6104
|
}
|
|
6038
6105
|
let isInSSRComponentSetup = false;
|
|
6039
|
-
function setupComponent(instance, isSSR = false) {
|
|
6106
|
+
function setupComponent(instance, isSSR = false, optimized = false) {
|
|
6040
6107
|
isSSR && setInSSRSetupState(isSSR);
|
|
6041
6108
|
const { props, children } = instance.vnode;
|
|
6042
6109
|
const isStateful = isStatefulComponent(instance);
|
|
6043
6110
|
initProps(instance, props, isStateful, isSSR);
|
|
6044
|
-
initSlots(instance, children);
|
|
6111
|
+
initSlots(instance, children, optimized);
|
|
6045
6112
|
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
|
6046
6113
|
isSSR && setInSSRSetupState(false);
|
|
6047
6114
|
return setupResult;
|
|
@@ -6193,51 +6260,6 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
6193
6260
|
return c;
|
|
6194
6261
|
};
|
|
6195
6262
|
|
|
6196
|
-
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
6197
|
-
const i = getCurrentInstance();
|
|
6198
|
-
const camelizedName = shared.camelize(name);
|
|
6199
|
-
const hyphenatedName = shared.hyphenate(name);
|
|
6200
|
-
const res = reactivity.customRef((track, trigger) => {
|
|
6201
|
-
let localValue;
|
|
6202
|
-
watchSyncEffect(() => {
|
|
6203
|
-
const propValue = props[name];
|
|
6204
|
-
if (shared.hasChanged(localValue, propValue)) {
|
|
6205
|
-
localValue = propValue;
|
|
6206
|
-
trigger();
|
|
6207
|
-
}
|
|
6208
|
-
});
|
|
6209
|
-
return {
|
|
6210
|
-
get() {
|
|
6211
|
-
track();
|
|
6212
|
-
return options.get ? options.get(localValue) : localValue;
|
|
6213
|
-
},
|
|
6214
|
-
set(value) {
|
|
6215
|
-
const rawProps = i.vnode.props;
|
|
6216
|
-
if (!(rawProps && // check if parent has passed v-model
|
|
6217
|
-
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps)) && shared.hasChanged(value, localValue)) {
|
|
6218
|
-
localValue = value;
|
|
6219
|
-
trigger();
|
|
6220
|
-
}
|
|
6221
|
-
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
6222
|
-
}
|
|
6223
|
-
};
|
|
6224
|
-
});
|
|
6225
|
-
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
6226
|
-
res[Symbol.iterator] = () => {
|
|
6227
|
-
let i2 = 0;
|
|
6228
|
-
return {
|
|
6229
|
-
next() {
|
|
6230
|
-
if (i2 < 2) {
|
|
6231
|
-
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
|
6232
|
-
} else {
|
|
6233
|
-
return { done: true };
|
|
6234
|
-
}
|
|
6235
|
-
}
|
|
6236
|
-
};
|
|
6237
|
-
};
|
|
6238
|
-
return res;
|
|
6239
|
-
}
|
|
6240
|
-
|
|
6241
6263
|
function h(type, propsOrChildren, children) {
|
|
6242
6264
|
const l = arguments.length;
|
|
6243
6265
|
if (l === 2) {
|
|
@@ -6272,7 +6294,7 @@ function withMemo(memo, render, cache, index) {
|
|
|
6272
6294
|
}
|
|
6273
6295
|
const ret = render();
|
|
6274
6296
|
ret.memo = memo.slice();
|
|
6275
|
-
ret.
|
|
6297
|
+
ret.cacheIndex = index;
|
|
6276
6298
|
return cache[index] = ret;
|
|
6277
6299
|
}
|
|
6278
6300
|
function isMemoSame(cached, memo) {
|
|
@@ -6291,7 +6313,7 @@ function isMemoSame(cached, memo) {
|
|
|
6291
6313
|
return true;
|
|
6292
6314
|
}
|
|
6293
6315
|
|
|
6294
|
-
const version = "3.4.
|
|
6316
|
+
const version = "3.4.37";
|
|
6295
6317
|
const warn$1 = shared.NOOP;
|
|
6296
6318
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
6297
6319
|
const devtools = void 0;
|
|
@@ -6303,7 +6325,8 @@ const _ssrUtils = {
|
|
|
6303
6325
|
setCurrentRenderingInstance,
|
|
6304
6326
|
isVNode: isVNode,
|
|
6305
6327
|
normalizeVNode,
|
|
6306
|
-
getComponentPublicInstance
|
|
6328
|
+
getComponentPublicInstance,
|
|
6329
|
+
ensureValidVNode
|
|
6307
6330
|
};
|
|
6308
6331
|
const ssrUtils = _ssrUtils ;
|
|
6309
6332
|
const resolveFilter = null;
|