@vue/runtime-core 3.4.31 → 3.4.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime-core.cjs.js +2259 -2240
- package/dist/runtime-core.cjs.prod.js +2006 -1993
- package/dist/runtime-core.d.ts +20 -10
- package/dist/runtime-core.esm-bundler.js +2391 -2371
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-core v3.4.
|
|
2
|
+
* @vue/runtime-core v3.4.33
|
|
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,769 @@ 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 (!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
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
const isInPendingSuspense = !!suspense.pendingBranch;
|
|
1078
|
-
if (isInPendingSuspense) {
|
|
1079
|
-
suspense.deps++;
|
|
989
|
+
let vnode = getInnerChild(rawVNode);
|
|
990
|
+
const comp = vnode.type;
|
|
991
|
+
const name = getComponentName(
|
|
992
|
+
isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
|
|
993
|
+
);
|
|
994
|
+
const { include, exclude, max } = props;
|
|
995
|
+
if (include && (!name || !matches(include, name)) || exclude && name && matches(exclude, name)) {
|
|
996
|
+
current = vnode;
|
|
997
|
+
return rawVNode;
|
|
1080
998
|
}
|
|
1081
|
-
const
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
if (
|
|
1086
|
-
|
|
1087
|
-
}
|
|
1088
|
-
instance.asyncResolved = true;
|
|
1089
|
-
const { vnode: vnode2 } = instance;
|
|
1090
|
-
handleSetupResult(instance, asyncSetupResult, false);
|
|
1091
|
-
if (hydratedEl) {
|
|
1092
|
-
vnode2.el = hydratedEl;
|
|
999
|
+
const key = vnode.key == null ? comp : vnode.key;
|
|
1000
|
+
const cachedVNode = cache.get(key);
|
|
1001
|
+
if (vnode.el) {
|
|
1002
|
+
vnode = cloneVNode(vnode);
|
|
1003
|
+
if (rawVNode.shapeFlag & 128) {
|
|
1004
|
+
rawVNode.ssContent = vnode;
|
|
1093
1005
|
}
|
|
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);
|
|
1006
|
+
}
|
|
1007
|
+
pendingCacheKey = key;
|
|
1008
|
+
if (cachedVNode) {
|
|
1009
|
+
vnode.el = cachedVNode.el;
|
|
1010
|
+
vnode.component = cachedVNode.component;
|
|
1011
|
+
if (vnode.transition) {
|
|
1012
|
+
setTransitionHooks(vnode, vnode.transition);
|
|
1111
1013
|
}
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1014
|
+
vnode.shapeFlag |= 512;
|
|
1015
|
+
keys.delete(key);
|
|
1016
|
+
keys.add(key);
|
|
1017
|
+
} else {
|
|
1018
|
+
keys.add(key);
|
|
1019
|
+
if (max && keys.size > parseInt(max, 10)) {
|
|
1020
|
+
pruneCacheEntry(keys.values().next().value);
|
|
1115
1021
|
}
|
|
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
1022
|
}
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
parentSuspense2,
|
|
1133
|
-
doRemove
|
|
1134
|
-
);
|
|
1135
|
-
}
|
|
1136
|
-
}
|
|
1137
|
-
};
|
|
1138
|
-
return suspense;
|
|
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);
|
|
1023
|
+
vnode.shapeFlag |= 256;
|
|
1024
|
+
current = vnode;
|
|
1025
|
+
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
1026
|
+
};
|
|
1165
1027
|
}
|
|
1166
|
-
|
|
1028
|
+
};
|
|
1029
|
+
const KeepAlive = KeepAliveImpl;
|
|
1030
|
+
function matches(pattern, name) {
|
|
1031
|
+
if (shared.isArray(pattern)) {
|
|
1032
|
+
return pattern.some((p) => matches(p, name));
|
|
1033
|
+
} else if (shared.isString(pattern)) {
|
|
1034
|
+
return pattern.split(",").includes(name);
|
|
1035
|
+
} else if (shared.isRegExp(pattern)) {
|
|
1036
|
+
return pattern.test(name);
|
|
1037
|
+
}
|
|
1038
|
+
return false;
|
|
1167
1039
|
}
|
|
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);
|
|
1040
|
+
function onActivated(hook, target) {
|
|
1041
|
+
registerKeepAliveHook(hook, "a", target);
|
|
1175
1042
|
}
|
|
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;
|
|
1043
|
+
function onDeactivated(hook, target) {
|
|
1044
|
+
registerKeepAliveHook(hook, "da", target);
|
|
1200
1045
|
}
|
|
1201
|
-
function
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1046
|
+
function registerKeepAliveHook(hook, type, target = currentInstance) {
|
|
1047
|
+
const wrappedHook = hook.__wdc || (hook.__wdc = () => {
|
|
1048
|
+
let current = target;
|
|
1049
|
+
while (current) {
|
|
1050
|
+
if (current.isDeactivated) {
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
current = current.parent;
|
|
1054
|
+
}
|
|
1055
|
+
return hook();
|
|
1056
|
+
});
|
|
1057
|
+
injectHook(type, wrappedHook, target);
|
|
1058
|
+
if (target) {
|
|
1059
|
+
let current = target.parent;
|
|
1060
|
+
while (current && current.parent) {
|
|
1061
|
+
if (isKeepAlive(current.parent.vnode)) {
|
|
1062
|
+
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
1063
|
+
}
|
|
1064
|
+
current = current.parent;
|
|
1207
1065
|
}
|
|
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
1066
|
}
|
|
1225
1067
|
}
|
|
1226
|
-
function
|
|
1227
|
-
const
|
|
1228
|
-
|
|
1068
|
+
function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
|
|
1069
|
+
const injected = injectHook(
|
|
1070
|
+
type,
|
|
1071
|
+
hook,
|
|
1072
|
+
keepAliveRoot,
|
|
1073
|
+
true
|
|
1074
|
+
/* prepend */
|
|
1075
|
+
);
|
|
1076
|
+
onUnmounted(() => {
|
|
1077
|
+
shared.remove(keepAliveRoot[type], injected);
|
|
1078
|
+
}, target);
|
|
1079
|
+
}
|
|
1080
|
+
function resetShapeFlag(vnode) {
|
|
1081
|
+
vnode.shapeFlag &= ~256;
|
|
1082
|
+
vnode.shapeFlag &= ~512;
|
|
1083
|
+
}
|
|
1084
|
+
function getInnerChild(vnode) {
|
|
1085
|
+
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
|
1229
1086
|
}
|
|
1230
1087
|
|
|
1231
1088
|
function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
@@ -1269,57 +1126,50 @@ function onErrorCaptured(hook, target = currentInstance) {
|
|
|
1269
1126
|
injectHook("ec", hook, target);
|
|
1270
1127
|
}
|
|
1271
1128
|
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
mounted: dir,
|
|
1284
|
-
updated: dir
|
|
1285
|
-
};
|
|
1286
|
-
}
|
|
1287
|
-
if (dir.deep) {
|
|
1288
|
-
traverse(value);
|
|
1289
|
-
}
|
|
1290
|
-
bindings.push({
|
|
1291
|
-
dir,
|
|
1292
|
-
instance,
|
|
1293
|
-
value,
|
|
1294
|
-
oldValue: void 0,
|
|
1295
|
-
arg,
|
|
1296
|
-
modifiers
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1129
|
+
const COMPONENTS = "components";
|
|
1130
|
+
const DIRECTIVES = "directives";
|
|
1131
|
+
function resolveComponent(name, maybeSelfReference) {
|
|
1132
|
+
return resolveAsset(COMPONENTS, name, true, maybeSelfReference) || name;
|
|
1133
|
+
}
|
|
1134
|
+
const NULL_DYNAMIC_COMPONENT = Symbol.for("v-ndc");
|
|
1135
|
+
function resolveDynamicComponent(component) {
|
|
1136
|
+
if (shared.isString(component)) {
|
|
1137
|
+
return resolveAsset(COMPONENTS, component, false) || component;
|
|
1138
|
+
} else {
|
|
1139
|
+
return component || NULL_DYNAMIC_COMPONENT;
|
|
1299
1140
|
}
|
|
1300
|
-
return vnode;
|
|
1301
1141
|
}
|
|
1302
|
-
function
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1142
|
+
function resolveDirective(name) {
|
|
1143
|
+
return resolveAsset(DIRECTIVES, name);
|
|
1144
|
+
}
|
|
1145
|
+
function resolveAsset(type, name, warnMissing = true, maybeSelfReference = false) {
|
|
1146
|
+
const instance = currentRenderingInstance || currentInstance;
|
|
1147
|
+
if (instance) {
|
|
1148
|
+
const Component = instance.type;
|
|
1149
|
+
if (type === COMPONENTS) {
|
|
1150
|
+
const selfName = getComponentName(
|
|
1151
|
+
Component,
|
|
1152
|
+
false
|
|
1153
|
+
);
|
|
1154
|
+
if (selfName && (selfName === name || selfName === shared.camelize(name) || selfName === shared.capitalize(shared.camelize(name)))) {
|
|
1155
|
+
return Component;
|
|
1156
|
+
}
|
|
1309
1157
|
}
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
]);
|
|
1319
|
-
reactivity.resetTracking();
|
|
1158
|
+
const res = (
|
|
1159
|
+
// local registration
|
|
1160
|
+
// check instance[type] first which is resolved for options API
|
|
1161
|
+
resolve(instance[type] || Component[type], name) || // global registration
|
|
1162
|
+
resolve(instance.appContext[type], name)
|
|
1163
|
+
);
|
|
1164
|
+
if (!res && maybeSelfReference) {
|
|
1165
|
+
return Component;
|
|
1320
1166
|
}
|
|
1167
|
+
return res;
|
|
1321
1168
|
}
|
|
1322
1169
|
}
|
|
1170
|
+
function resolve(registry, name) {
|
|
1171
|
+
return registry && (registry[name] || registry[shared.camelize(name)] || registry[shared.capitalize(shared.camelize(name))]);
|
|
1172
|
+
}
|
|
1323
1173
|
|
|
1324
1174
|
function renderList(source, renderItem, cache, index) {
|
|
1325
1175
|
let ret;
|
|
@@ -1356,164 +1206,23 @@ function renderList(source, renderItem, cache, index) {
|
|
|
1356
1206
|
}
|
|
1357
1207
|
return ret;
|
|
1358
1208
|
}
|
|
1359
|
-
|
|
1360
|
-
function createSlots(slots, dynamicSlots) {
|
|
1361
|
-
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
1362
|
-
const slot = dynamicSlots[i];
|
|
1363
|
-
if (shared.isArray(slot)) {
|
|
1364
|
-
for (let j = 0; j < slot.length; j++) {
|
|
1365
|
-
slots[slot[j].name] = slot[j].fn;
|
|
1366
|
-
}
|
|
1367
|
-
} else if (slot) {
|
|
1368
|
-
slots[slot.name] = slot.key ? (...args) => {
|
|
1369
|
-
const res = slot.fn(...args);
|
|
1370
|
-
if (res) res.key = slot.key;
|
|
1371
|
-
return res;
|
|
1372
|
-
} : slot.fn;
|
|
1373
|
-
}
|
|
1374
|
-
}
|
|
1375
|
-
return slots;
|
|
1376
|
-
}
|
|
1377
|
-
|
|
1378
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
1379
|
-
// @__NO_SIDE_EFFECTS__
|
|
1380
|
-
function defineComponent(options, extraOptions) {
|
|
1381
|
-
return shared.isFunction(options) ? (
|
|
1382
|
-
// #8326: extend call and options.name access are considered side-effects
|
|
1383
|
-
// by Rollup, so we have to wrap it in a pure-annotated IIFE.
|
|
1384
|
-
/* @__PURE__ */ (() => shared.extend({ name: options.name }, extraOptions, { setup: options }))()
|
|
1385
|
-
) : options;
|
|
1386
|
-
}
|
|
1387
|
-
|
|
1388
|
-
const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
|
|
1389
|
-
/*! #__NO_SIDE_EFFECTS__ */
|
|
1390
|
-
// @__NO_SIDE_EFFECTS__
|
|
1391
|
-
function defineAsyncComponent(source) {
|
|
1392
|
-
if (shared.isFunction(source)) {
|
|
1393
|
-
source = { loader: source };
|
|
1394
|
-
}
|
|
1395
|
-
const {
|
|
1396
|
-
loader,
|
|
1397
|
-
loadingComponent,
|
|
1398
|
-
errorComponent,
|
|
1399
|
-
delay = 200,
|
|
1400
|
-
timeout,
|
|
1401
|
-
// undefined = never times out
|
|
1402
|
-
suspensible = true,
|
|
1403
|
-
onError: userOnError
|
|
1404
|
-
} = source;
|
|
1405
|
-
let pendingRequest = null;
|
|
1406
|
-
let resolvedComp;
|
|
1407
|
-
let retries = 0;
|
|
1408
|
-
const retry = () => {
|
|
1409
|
-
retries++;
|
|
1410
|
-
pendingRequest = null;
|
|
1411
|
-
return load();
|
|
1412
|
-
};
|
|
1413
|
-
const load = () => {
|
|
1414
|
-
let thisRequest;
|
|
1415
|
-
return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
|
|
1416
|
-
err = err instanceof Error ? err : new Error(String(err));
|
|
1417
|
-
if (userOnError) {
|
|
1418
|
-
return new Promise((resolve, reject) => {
|
|
1419
|
-
const userRetry = () => resolve(retry());
|
|
1420
|
-
const userFail = () => reject(err);
|
|
1421
|
-
userOnError(err, userRetry, userFail, retries + 1);
|
|
1422
|
-
});
|
|
1423
|
-
} else {
|
|
1424
|
-
throw err;
|
|
1425
|
-
}
|
|
1426
|
-
}).then((comp) => {
|
|
1427
|
-
if (thisRequest !== pendingRequest && pendingRequest) {
|
|
1428
|
-
return pendingRequest;
|
|
1429
|
-
}
|
|
1430
|
-
if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
|
|
1431
|
-
comp = comp.default;
|
|
1432
|
-
}
|
|
1433
|
-
resolvedComp = comp;
|
|
1434
|
-
return comp;
|
|
1435
|
-
}));
|
|
1436
|
-
};
|
|
1437
|
-
return defineComponent({
|
|
1438
|
-
name: "AsyncComponentWrapper",
|
|
1439
|
-
__asyncLoader: load,
|
|
1440
|
-
get __asyncResolved() {
|
|
1441
|
-
return resolvedComp;
|
|
1442
|
-
},
|
|
1443
|
-
setup() {
|
|
1444
|
-
const instance = currentInstance;
|
|
1445
|
-
if (resolvedComp) {
|
|
1446
|
-
return () => createInnerComp(resolvedComp, instance);
|
|
1447
|
-
}
|
|
1448
|
-
const onError = (err) => {
|
|
1449
|
-
pendingRequest = null;
|
|
1450
|
-
handleError(
|
|
1451
|
-
err,
|
|
1452
|
-
instance,
|
|
1453
|
-
13,
|
|
1454
|
-
!errorComponent
|
|
1455
|
-
);
|
|
1456
|
-
};
|
|
1457
|
-
if (suspensible && instance.suspense || isInSSRComponentSetup) {
|
|
1458
|
-
return load().then((comp) => {
|
|
1459
|
-
return () => createInnerComp(comp, instance);
|
|
1460
|
-
}).catch((err) => {
|
|
1461
|
-
onError(err);
|
|
1462
|
-
return () => errorComponent ? createVNode(errorComponent, {
|
|
1463
|
-
error: err
|
|
1464
|
-
}) : null;
|
|
1465
|
-
});
|
|
1466
|
-
}
|
|
1467
|
-
const loaded = reactivity.ref(false);
|
|
1468
|
-
const error = reactivity.ref();
|
|
1469
|
-
const delayed = reactivity.ref(!!delay);
|
|
1470
|
-
if (delay) {
|
|
1471
|
-
setTimeout(() => {
|
|
1472
|
-
delayed.value = false;
|
|
1473
|
-
}, delay);
|
|
1474
|
-
}
|
|
1475
|
-
if (timeout != null) {
|
|
1476
|
-
setTimeout(() => {
|
|
1477
|
-
if (!loaded.value && !error.value) {
|
|
1478
|
-
const err = new Error(
|
|
1479
|
-
`Async component timed out after ${timeout}ms.`
|
|
1480
|
-
);
|
|
1481
|
-
onError(err);
|
|
1482
|
-
error.value = err;
|
|
1483
|
-
}
|
|
1484
|
-
}, timeout);
|
|
1485
|
-
}
|
|
1486
|
-
load().then(() => {
|
|
1487
|
-
loaded.value = true;
|
|
1488
|
-
if (instance.parent && isKeepAlive(instance.parent.vnode)) {
|
|
1489
|
-
instance.parent.effect.dirty = true;
|
|
1490
|
-
queueJob(instance.parent.update);
|
|
1491
|
-
}
|
|
1492
|
-
}).catch((err) => {
|
|
1493
|
-
onError(err);
|
|
1494
|
-
error.value = err;
|
|
1495
|
-
});
|
|
1496
|
-
return () => {
|
|
1497
|
-
if (loaded.value && resolvedComp) {
|
|
1498
|
-
return createInnerComp(resolvedComp, instance);
|
|
1499
|
-
} else if (error.value && errorComponent) {
|
|
1500
|
-
return createVNode(errorComponent, {
|
|
1501
|
-
error: error.value
|
|
1502
|
-
});
|
|
1503
|
-
} else if (loadingComponent && !delayed.value) {
|
|
1504
|
-
return createVNode(loadingComponent);
|
|
1505
|
-
}
|
|
1506
|
-
};
|
|
1507
|
-
}
|
|
1508
|
-
});
|
|
1509
|
-
}
|
|
1510
|
-
function createInnerComp(comp, parent) {
|
|
1511
|
-
const { ref: ref2, props, children, ce } = parent.vnode;
|
|
1512
|
-
const vnode = createVNode(comp, props, children);
|
|
1513
|
-
vnode.ref = ref2;
|
|
1514
|
-
vnode.ce = ce;
|
|
1515
|
-
delete parent.vnode.ce;
|
|
1516
|
-
return vnode;
|
|
1209
|
+
|
|
1210
|
+
function createSlots(slots, dynamicSlots) {
|
|
1211
|
+
for (let i = 0; i < dynamicSlots.length; i++) {
|
|
1212
|
+
const slot = dynamicSlots[i];
|
|
1213
|
+
if (shared.isArray(slot)) {
|
|
1214
|
+
for (let j = 0; j < slot.length; j++) {
|
|
1215
|
+
slots[slot[j].name] = slot[j].fn;
|
|
1216
|
+
}
|
|
1217
|
+
} else if (slot) {
|
|
1218
|
+
slots[slot.name] = slot.key ? (...args) => {
|
|
1219
|
+
const res = slot.fn(...args);
|
|
1220
|
+
if (res) res.key = slot.key;
|
|
1221
|
+
return res;
|
|
1222
|
+
} : slot.fn;
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
return slots;
|
|
1517
1226
|
}
|
|
1518
1227
|
|
|
1519
1228
|
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
@@ -1530,9 +1239,10 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
1530
1239
|
const rendered = createBlock(
|
|
1531
1240
|
Fragment,
|
|
1532
1241
|
{
|
|
1533
|
-
key: props.key || // slot content array of a dynamic conditional slot may have a branch
|
|
1242
|
+
key: (props.key || // slot content array of a dynamic conditional slot may have a branch
|
|
1534
1243
|
// key attached in the `createSlots` helper, respect that
|
|
1535
|
-
validSlotContent && validSlotContent.key || `_${name}`
|
|
1244
|
+
validSlotContent && validSlotContent.key || `_${name}`) + // #7256 force differentiate fallback content from actual content
|
|
1245
|
+
(!validSlotContent && fallback ? "_fb" : "")
|
|
1536
1246
|
},
|
|
1537
1247
|
validSlotContent || (fallback ? fallback() : []),
|
|
1538
1248
|
validSlotContent && slots._ === 1 ? 64 : -2
|
|
@@ -2458,8 +2168,9 @@ function resolvePropValue(options, props, key, value, instance, isAbsent) {
|
|
|
2458
2168
|
}
|
|
2459
2169
|
return value;
|
|
2460
2170
|
}
|
|
2171
|
+
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
2461
2172
|
function normalizePropsOptions(comp, appContext, asMixin = false) {
|
|
2462
|
-
const cache = appContext.propsCache;
|
|
2173
|
+
const cache = asMixin ? mixinPropsCache : appContext.propsCache;
|
|
2463
2174
|
const cached = cache.get(comp);
|
|
2464
2175
|
if (cached) {
|
|
2465
2176
|
return cached;
|
|
@@ -2582,13 +2293,22 @@ const normalizeVNodeSlots = (instance, children) => {
|
|
|
2582
2293
|
const normalized = normalizeSlotValue(children);
|
|
2583
2294
|
instance.slots.default = () => normalized;
|
|
2584
2295
|
};
|
|
2585
|
-
const
|
|
2296
|
+
const assignSlots = (slots, children, optimized) => {
|
|
2297
|
+
for (const key in children) {
|
|
2298
|
+
if (optimized || key !== "_") {
|
|
2299
|
+
slots[key] = children[key];
|
|
2300
|
+
}
|
|
2301
|
+
}
|
|
2302
|
+
};
|
|
2303
|
+
const initSlots = (instance, children, optimized) => {
|
|
2586
2304
|
const slots = instance.slots = createInternalObject();
|
|
2587
2305
|
if (instance.vnode.shapeFlag & 32) {
|
|
2588
2306
|
const type = children._;
|
|
2589
2307
|
if (type) {
|
|
2590
|
-
|
|
2591
|
-
|
|
2308
|
+
assignSlots(slots, children, optimized);
|
|
2309
|
+
if (optimized) {
|
|
2310
|
+
shared.def(slots, "_", type, true);
|
|
2311
|
+
}
|
|
2592
2312
|
} else {
|
|
2593
2313
|
normalizeObjectSlots(children, slots);
|
|
2594
2314
|
}
|
|
@@ -2606,10 +2326,7 @@ const updateSlots = (instance, children, optimized) => {
|
|
|
2606
2326
|
if (optimized && type === 1) {
|
|
2607
2327
|
needDeletionCheck = false;
|
|
2608
2328
|
} else {
|
|
2609
|
-
|
|
2610
|
-
if (!optimized && type === 1) {
|
|
2611
|
-
delete slots._;
|
|
2612
|
-
}
|
|
2329
|
+
assignSlots(slots, children, optimized);
|
|
2613
2330
|
}
|
|
2614
2331
|
} else {
|
|
2615
2332
|
needDeletionCheck = !children.$stable;
|
|
@@ -2642,68 +2359,332 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
|
|
|
2642
2359
|
);
|
|
2643
2360
|
return;
|
|
2644
2361
|
}
|
|
2645
|
-
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
2646
|
-
return;
|
|
2362
|
+
if (isAsyncWrapper(vnode) && !isUnmount) {
|
|
2363
|
+
return;
|
|
2364
|
+
}
|
|
2365
|
+
const refValue = vnode.shapeFlag & 4 ? getComponentPublicInstance(vnode.component) : vnode.el;
|
|
2366
|
+
const value = isUnmount ? null : refValue;
|
|
2367
|
+
const { i: owner, r: ref } = rawRef;
|
|
2368
|
+
const oldRef = oldRawRef && oldRawRef.r;
|
|
2369
|
+
const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
|
|
2370
|
+
const setupState = owner.setupState;
|
|
2371
|
+
if (oldRef != null && oldRef !== ref) {
|
|
2372
|
+
if (shared.isString(oldRef)) {
|
|
2373
|
+
refs[oldRef] = null;
|
|
2374
|
+
if (shared.hasOwn(setupState, oldRef)) {
|
|
2375
|
+
setupState[oldRef] = null;
|
|
2376
|
+
}
|
|
2377
|
+
} else if (reactivity.isRef(oldRef)) {
|
|
2378
|
+
oldRef.value = null;
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
if (shared.isFunction(ref)) {
|
|
2382
|
+
callWithErrorHandling(ref, owner, 12, [value, refs]);
|
|
2383
|
+
} else {
|
|
2384
|
+
const _isString = shared.isString(ref);
|
|
2385
|
+
const _isRef = reactivity.isRef(ref);
|
|
2386
|
+
if (_isString || _isRef) {
|
|
2387
|
+
const doSet = () => {
|
|
2388
|
+
if (rawRef.f) {
|
|
2389
|
+
const existing = _isString ? shared.hasOwn(setupState, ref) ? setupState[ref] : refs[ref] : ref.value;
|
|
2390
|
+
if (isUnmount) {
|
|
2391
|
+
shared.isArray(existing) && shared.remove(existing, refValue);
|
|
2392
|
+
} else {
|
|
2393
|
+
if (!shared.isArray(existing)) {
|
|
2394
|
+
if (_isString) {
|
|
2395
|
+
refs[ref] = [refValue];
|
|
2396
|
+
if (shared.hasOwn(setupState, ref)) {
|
|
2397
|
+
setupState[ref] = refs[ref];
|
|
2398
|
+
}
|
|
2399
|
+
} else {
|
|
2400
|
+
ref.value = [refValue];
|
|
2401
|
+
if (rawRef.k) refs[rawRef.k] = ref.value;
|
|
2402
|
+
}
|
|
2403
|
+
} else if (!existing.includes(refValue)) {
|
|
2404
|
+
existing.push(refValue);
|
|
2405
|
+
}
|
|
2406
|
+
}
|
|
2407
|
+
} else if (_isString) {
|
|
2408
|
+
refs[ref] = value;
|
|
2409
|
+
if (shared.hasOwn(setupState, ref)) {
|
|
2410
|
+
setupState[ref] = value;
|
|
2411
|
+
}
|
|
2412
|
+
} else if (_isRef) {
|
|
2413
|
+
ref.value = value;
|
|
2414
|
+
if (rawRef.k) refs[rawRef.k] = value;
|
|
2415
|
+
} else ;
|
|
2416
|
+
};
|
|
2417
|
+
if (value) {
|
|
2418
|
+
doSet.id = -1;
|
|
2419
|
+
queuePostRenderEffect(doSet, parentSuspense);
|
|
2420
|
+
} else {
|
|
2421
|
+
doSet();
|
|
2422
|
+
}
|
|
2423
|
+
}
|
|
2424
|
+
}
|
|
2425
|
+
}
|
|
2426
|
+
|
|
2427
|
+
const TeleportEndKey = Symbol("_vte");
|
|
2428
|
+
const isTeleport = (type) => type.__isTeleport;
|
|
2429
|
+
const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
|
2430
|
+
const isTargetSVG = (target) => typeof SVGElement !== "undefined" && target instanceof SVGElement;
|
|
2431
|
+
const isTargetMathML = (target) => typeof MathMLElement === "function" && target instanceof MathMLElement;
|
|
2432
|
+
const resolveTarget = (props, select) => {
|
|
2433
|
+
const targetSelector = props && props.to;
|
|
2434
|
+
if (shared.isString(targetSelector)) {
|
|
2435
|
+
if (!select) {
|
|
2436
|
+
return null;
|
|
2437
|
+
} else {
|
|
2438
|
+
const target = select(targetSelector);
|
|
2439
|
+
return target;
|
|
2440
|
+
}
|
|
2441
|
+
} else {
|
|
2442
|
+
return targetSelector;
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2445
|
+
const TeleportImpl = {
|
|
2446
|
+
name: "Teleport",
|
|
2447
|
+
__isTeleport: true,
|
|
2448
|
+
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
|
2449
|
+
const {
|
|
2450
|
+
mc: mountChildren,
|
|
2451
|
+
pc: patchChildren,
|
|
2452
|
+
pbc: patchBlockChildren,
|
|
2453
|
+
o: { insert, querySelector, createText, createComment }
|
|
2454
|
+
} = internals;
|
|
2455
|
+
const disabled = isTeleportDisabled(n2.props);
|
|
2456
|
+
let { shapeFlag, children, dynamicChildren } = n2;
|
|
2457
|
+
if (n1 == null) {
|
|
2458
|
+
const placeholder = n2.el = createText("");
|
|
2459
|
+
const mainAnchor = n2.anchor = createText("");
|
|
2460
|
+
const target = n2.target = resolveTarget(n2.props, querySelector);
|
|
2461
|
+
const targetStart = n2.targetStart = createText("");
|
|
2462
|
+
const targetAnchor = n2.targetAnchor = createText("");
|
|
2463
|
+
insert(placeholder, container, anchor);
|
|
2464
|
+
insert(mainAnchor, container, anchor);
|
|
2465
|
+
targetStart[TeleportEndKey] = targetAnchor;
|
|
2466
|
+
if (target) {
|
|
2467
|
+
insert(targetStart, target);
|
|
2468
|
+
insert(targetAnchor, target);
|
|
2469
|
+
if (namespace === "svg" || isTargetSVG(target)) {
|
|
2470
|
+
namespace = "svg";
|
|
2471
|
+
} else if (namespace === "mathml" || isTargetMathML(target)) {
|
|
2472
|
+
namespace = "mathml";
|
|
2473
|
+
}
|
|
2474
|
+
}
|
|
2475
|
+
const mount = (container2, anchor2) => {
|
|
2476
|
+
if (shapeFlag & 16) {
|
|
2477
|
+
mountChildren(
|
|
2478
|
+
children,
|
|
2479
|
+
container2,
|
|
2480
|
+
anchor2,
|
|
2481
|
+
parentComponent,
|
|
2482
|
+
parentSuspense,
|
|
2483
|
+
namespace,
|
|
2484
|
+
slotScopeIds,
|
|
2485
|
+
optimized
|
|
2486
|
+
);
|
|
2487
|
+
}
|
|
2488
|
+
};
|
|
2489
|
+
if (disabled) {
|
|
2490
|
+
mount(container, mainAnchor);
|
|
2491
|
+
} else if (target) {
|
|
2492
|
+
mount(target, targetAnchor);
|
|
2493
|
+
}
|
|
2494
|
+
} else {
|
|
2495
|
+
n2.el = n1.el;
|
|
2496
|
+
n2.targetStart = n1.targetStart;
|
|
2497
|
+
const mainAnchor = n2.anchor = n1.anchor;
|
|
2498
|
+
const target = n2.target = n1.target;
|
|
2499
|
+
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
2500
|
+
const wasDisabled = isTeleportDisabled(n1.props);
|
|
2501
|
+
const currentContainer = wasDisabled ? container : target;
|
|
2502
|
+
const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
|
2503
|
+
if (namespace === "svg" || isTargetSVG(target)) {
|
|
2504
|
+
namespace = "svg";
|
|
2505
|
+
} else if (namespace === "mathml" || isTargetMathML(target)) {
|
|
2506
|
+
namespace = "mathml";
|
|
2507
|
+
}
|
|
2508
|
+
if (dynamicChildren) {
|
|
2509
|
+
patchBlockChildren(
|
|
2510
|
+
n1.dynamicChildren,
|
|
2511
|
+
dynamicChildren,
|
|
2512
|
+
currentContainer,
|
|
2513
|
+
parentComponent,
|
|
2514
|
+
parentSuspense,
|
|
2515
|
+
namespace,
|
|
2516
|
+
slotScopeIds
|
|
2517
|
+
);
|
|
2518
|
+
traverseStaticChildren(n1, n2, true);
|
|
2519
|
+
} else if (!optimized) {
|
|
2520
|
+
patchChildren(
|
|
2521
|
+
n1,
|
|
2522
|
+
n2,
|
|
2523
|
+
currentContainer,
|
|
2524
|
+
currentAnchor,
|
|
2525
|
+
parentComponent,
|
|
2526
|
+
parentSuspense,
|
|
2527
|
+
namespace,
|
|
2528
|
+
slotScopeIds,
|
|
2529
|
+
false
|
|
2530
|
+
);
|
|
2531
|
+
}
|
|
2532
|
+
if (disabled) {
|
|
2533
|
+
if (!wasDisabled) {
|
|
2534
|
+
moveTeleport(
|
|
2535
|
+
n2,
|
|
2536
|
+
container,
|
|
2537
|
+
mainAnchor,
|
|
2538
|
+
internals,
|
|
2539
|
+
1
|
|
2540
|
+
);
|
|
2541
|
+
} else {
|
|
2542
|
+
if (n2.props && n1.props && n2.props.to !== n1.props.to) {
|
|
2543
|
+
n2.props.to = n1.props.to;
|
|
2544
|
+
}
|
|
2545
|
+
}
|
|
2546
|
+
} else {
|
|
2547
|
+
if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
2548
|
+
const nextTarget = n2.target = resolveTarget(
|
|
2549
|
+
n2.props,
|
|
2550
|
+
querySelector
|
|
2551
|
+
);
|
|
2552
|
+
if (nextTarget) {
|
|
2553
|
+
moveTeleport(
|
|
2554
|
+
n2,
|
|
2555
|
+
nextTarget,
|
|
2556
|
+
null,
|
|
2557
|
+
internals,
|
|
2558
|
+
0
|
|
2559
|
+
);
|
|
2560
|
+
}
|
|
2561
|
+
} else if (wasDisabled) {
|
|
2562
|
+
moveTeleport(
|
|
2563
|
+
n2,
|
|
2564
|
+
target,
|
|
2565
|
+
targetAnchor,
|
|
2566
|
+
internals,
|
|
2567
|
+
1
|
|
2568
|
+
);
|
|
2569
|
+
}
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
updateCssVars(n2);
|
|
2573
|
+
},
|
|
2574
|
+
remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
2575
|
+
const {
|
|
2576
|
+
shapeFlag,
|
|
2577
|
+
children,
|
|
2578
|
+
anchor,
|
|
2579
|
+
targetStart,
|
|
2580
|
+
targetAnchor,
|
|
2581
|
+
target,
|
|
2582
|
+
props
|
|
2583
|
+
} = vnode;
|
|
2584
|
+
if (target) {
|
|
2585
|
+
hostRemove(targetStart);
|
|
2586
|
+
hostRemove(targetAnchor);
|
|
2587
|
+
}
|
|
2588
|
+
doRemove && hostRemove(anchor);
|
|
2589
|
+
if (shapeFlag & 16) {
|
|
2590
|
+
const shouldRemove = doRemove || !isTeleportDisabled(props);
|
|
2591
|
+
for (let i = 0; i < children.length; i++) {
|
|
2592
|
+
const child = children[i];
|
|
2593
|
+
unmount(
|
|
2594
|
+
child,
|
|
2595
|
+
parentComponent,
|
|
2596
|
+
parentSuspense,
|
|
2597
|
+
shouldRemove,
|
|
2598
|
+
!!child.dynamicChildren
|
|
2599
|
+
);
|
|
2600
|
+
}
|
|
2601
|
+
}
|
|
2602
|
+
},
|
|
2603
|
+
move: moveTeleport,
|
|
2604
|
+
hydrate: hydrateTeleport
|
|
2605
|
+
};
|
|
2606
|
+
function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }, moveType = 2) {
|
|
2607
|
+
if (moveType === 0) {
|
|
2608
|
+
insert(vnode.targetAnchor, container, parentAnchor);
|
|
2609
|
+
}
|
|
2610
|
+
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
2611
|
+
const isReorder = moveType === 2;
|
|
2612
|
+
if (isReorder) {
|
|
2613
|
+
insert(el, container, parentAnchor);
|
|
2647
2614
|
}
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
if (shared.hasOwn(setupState, oldRef)) {
|
|
2658
|
-
setupState[oldRef] = null;
|
|
2615
|
+
if (!isReorder || isTeleportDisabled(props)) {
|
|
2616
|
+
if (shapeFlag & 16) {
|
|
2617
|
+
for (let i = 0; i < children.length; i++) {
|
|
2618
|
+
move(
|
|
2619
|
+
children[i],
|
|
2620
|
+
container,
|
|
2621
|
+
parentAnchor,
|
|
2622
|
+
2
|
|
2623
|
+
);
|
|
2659
2624
|
}
|
|
2660
|
-
} else if (reactivity.isRef(oldRef)) {
|
|
2661
|
-
oldRef.value = null;
|
|
2662
2625
|
}
|
|
2663
2626
|
}
|
|
2664
|
-
if (
|
|
2665
|
-
|
|
2666
|
-
}
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
}
|
|
2690
|
-
} else if (_isString) {
|
|
2691
|
-
refs[ref] = value;
|
|
2692
|
-
if (shared.hasOwn(setupState, ref)) {
|
|
2693
|
-
setupState[ref] = value;
|
|
2694
|
-
}
|
|
2695
|
-
} else if (_isRef) {
|
|
2696
|
-
ref.value = value;
|
|
2697
|
-
if (rawRef.k) refs[rawRef.k] = value;
|
|
2698
|
-
} else ;
|
|
2699
|
-
};
|
|
2700
|
-
if (value) {
|
|
2701
|
-
doSet.id = -1;
|
|
2702
|
-
queuePostRenderEffect(doSet, parentSuspense);
|
|
2627
|
+
if (isReorder) {
|
|
2628
|
+
insert(anchor, container, parentAnchor);
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
|
|
2632
|
+
o: { nextSibling, parentNode, querySelector }
|
|
2633
|
+
}, hydrateChildren) {
|
|
2634
|
+
const target = vnode.target = resolveTarget(
|
|
2635
|
+
vnode.props,
|
|
2636
|
+
querySelector
|
|
2637
|
+
);
|
|
2638
|
+
if (target) {
|
|
2639
|
+
const targetNode = target._lpa || target.firstChild;
|
|
2640
|
+
if (vnode.shapeFlag & 16) {
|
|
2641
|
+
if (isTeleportDisabled(vnode.props)) {
|
|
2642
|
+
vnode.anchor = hydrateChildren(
|
|
2643
|
+
nextSibling(node),
|
|
2644
|
+
vnode,
|
|
2645
|
+
parentNode(node),
|
|
2646
|
+
parentComponent,
|
|
2647
|
+
parentSuspense,
|
|
2648
|
+
slotScopeIds,
|
|
2649
|
+
optimized
|
|
2650
|
+
);
|
|
2651
|
+
vnode.targetAnchor = targetNode;
|
|
2703
2652
|
} else {
|
|
2704
|
-
|
|
2653
|
+
vnode.anchor = nextSibling(node);
|
|
2654
|
+
let targetAnchor = targetNode;
|
|
2655
|
+
while (targetAnchor) {
|
|
2656
|
+
targetAnchor = nextSibling(targetAnchor);
|
|
2657
|
+
if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
|
|
2658
|
+
vnode.targetAnchor = targetAnchor;
|
|
2659
|
+
target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
2660
|
+
break;
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
hydrateChildren(
|
|
2664
|
+
targetNode,
|
|
2665
|
+
vnode,
|
|
2666
|
+
target,
|
|
2667
|
+
parentComponent,
|
|
2668
|
+
parentSuspense,
|
|
2669
|
+
slotScopeIds,
|
|
2670
|
+
optimized
|
|
2671
|
+
);
|
|
2705
2672
|
}
|
|
2706
2673
|
}
|
|
2674
|
+
updateCssVars(vnode);
|
|
2675
|
+
}
|
|
2676
|
+
return vnode.anchor && nextSibling(vnode.anchor);
|
|
2677
|
+
}
|
|
2678
|
+
const Teleport = TeleportImpl;
|
|
2679
|
+
function updateCssVars(vnode) {
|
|
2680
|
+
const ctx = vnode.ctx;
|
|
2681
|
+
if (ctx && ctx.ut) {
|
|
2682
|
+
let node = vnode.children[0].el;
|
|
2683
|
+
while (node && node !== vnode.targetAnchor) {
|
|
2684
|
+
if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
|
|
2685
|
+
node = node.nextSibling;
|
|
2686
|
+
}
|
|
2687
|
+
ctx.ut();
|
|
2707
2688
|
}
|
|
2708
2689
|
}
|
|
2709
2690
|
|
|
@@ -2957,15 +2938,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
2957
2938
|
for (const key in props) {
|
|
2958
2939
|
if (forcePatch && (key.endsWith("value") || key === "indeterminate") || shared.isOn(key) && !shared.isReservedProp(key) || // force hydrate v-bind with .prop modifiers
|
|
2959
2940
|
key[0] === ".") {
|
|
2960
|
-
patchProp(
|
|
2961
|
-
el,
|
|
2962
|
-
key,
|
|
2963
|
-
null,
|
|
2964
|
-
props[key],
|
|
2965
|
-
void 0,
|
|
2966
|
-
void 0,
|
|
2967
|
-
parentComponent
|
|
2968
|
-
);
|
|
2941
|
+
patchProp(el, key, null, props[key], void 0, parentComponent);
|
|
2969
2942
|
}
|
|
2970
2943
|
}
|
|
2971
2944
|
} else if (props.onClick) {
|
|
@@ -2975,9 +2948,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
2975
2948
|
null,
|
|
2976
2949
|
props.onClick,
|
|
2977
2950
|
void 0,
|
|
2978
|
-
void 0,
|
|
2979
2951
|
parentComponent
|
|
2980
2952
|
);
|
|
2953
|
+
} else if (patchFlag & 4 && reactivity.isReactive(props.style)) {
|
|
2954
|
+
for (const key in props.style) props.style[key];
|
|
2981
2955
|
}
|
|
2982
2956
|
}
|
|
2983
2957
|
let vnodeHooks;
|
|
@@ -3003,7 +2977,21 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3003
2977
|
const l = children.length;
|
|
3004
2978
|
for (let i = 0; i < l; i++) {
|
|
3005
2979
|
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
2980
|
+
const isText = vnode.type === Text;
|
|
3006
2981
|
if (node) {
|
|
2982
|
+
if (isText && !optimized) {
|
|
2983
|
+
let next = children[i + 1];
|
|
2984
|
+
if (next && (next = normalizeVNode(next)).type === Text) {
|
|
2985
|
+
insert(
|
|
2986
|
+
createText(
|
|
2987
|
+
node.data.slice(vnode.children.length)
|
|
2988
|
+
),
|
|
2989
|
+
container,
|
|
2990
|
+
nextSibling(node)
|
|
2991
|
+
);
|
|
2992
|
+
node.data = vnode.children;
|
|
2993
|
+
}
|
|
2994
|
+
}
|
|
3007
2995
|
node = hydrateNode(
|
|
3008
2996
|
node,
|
|
3009
2997
|
vnode,
|
|
@@ -3012,7 +3000,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
3012
3000
|
slotScopeIds,
|
|
3013
3001
|
optimized
|
|
3014
3002
|
);
|
|
3015
|
-
} else if (
|
|
3003
|
+
} else if (isText && !vnode.children) {
|
|
3016
3004
|
insert(vnode.el = createText(""), container);
|
|
3017
3005
|
} else {
|
|
3018
3006
|
logMismatchError();
|
|
@@ -3351,17 +3339,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3351
3339
|
if (props) {
|
|
3352
3340
|
for (const key in props) {
|
|
3353
3341
|
if (key !== "value" && !shared.isReservedProp(key)) {
|
|
3354
|
-
hostPatchProp(
|
|
3355
|
-
el,
|
|
3356
|
-
key,
|
|
3357
|
-
null,
|
|
3358
|
-
props[key],
|
|
3359
|
-
namespace,
|
|
3360
|
-
vnode.children,
|
|
3361
|
-
parentComponent,
|
|
3362
|
-
parentSuspense,
|
|
3363
|
-
unmountChildren
|
|
3364
|
-
);
|
|
3342
|
+
hostPatchProp(el, key, null, props[key], namespace, parentComponent);
|
|
3365
3343
|
}
|
|
3366
3344
|
}
|
|
3367
3345
|
if ("value" in props) {
|
|
@@ -3441,6 +3419,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3441
3419
|
invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
3442
3420
|
}
|
|
3443
3421
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
3422
|
+
if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) {
|
|
3423
|
+
hostSetElementText(el, "");
|
|
3424
|
+
}
|
|
3444
3425
|
if (dynamicChildren) {
|
|
3445
3426
|
patchBlockChildren(
|
|
3446
3427
|
n1.dynamicChildren,
|
|
@@ -3466,15 +3447,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3466
3447
|
}
|
|
3467
3448
|
if (patchFlag > 0) {
|
|
3468
3449
|
if (patchFlag & 16) {
|
|
3469
|
-
patchProps(
|
|
3470
|
-
el,
|
|
3471
|
-
n2,
|
|
3472
|
-
oldProps,
|
|
3473
|
-
newProps,
|
|
3474
|
-
parentComponent,
|
|
3475
|
-
parentSuspense,
|
|
3476
|
-
namespace
|
|
3477
|
-
);
|
|
3450
|
+
patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
3478
3451
|
} else {
|
|
3479
3452
|
if (patchFlag & 2) {
|
|
3480
3453
|
if (oldProps.class !== newProps.class) {
|
|
@@ -3491,17 +3464,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3491
3464
|
const prev = oldProps[key];
|
|
3492
3465
|
const next = newProps[key];
|
|
3493
3466
|
if (next !== prev || key === "value") {
|
|
3494
|
-
hostPatchProp(
|
|
3495
|
-
el,
|
|
3496
|
-
key,
|
|
3497
|
-
prev,
|
|
3498
|
-
next,
|
|
3499
|
-
namespace,
|
|
3500
|
-
n1.children,
|
|
3501
|
-
parentComponent,
|
|
3502
|
-
parentSuspense,
|
|
3503
|
-
unmountChildren
|
|
3504
|
-
);
|
|
3467
|
+
hostPatchProp(el, key, prev, next, namespace, parentComponent);
|
|
3505
3468
|
}
|
|
3506
3469
|
}
|
|
3507
3470
|
}
|
|
@@ -3512,15 +3475,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3512
3475
|
}
|
|
3513
3476
|
}
|
|
3514
3477
|
} else if (!optimized && dynamicChildren == null) {
|
|
3515
|
-
patchProps(
|
|
3516
|
-
el,
|
|
3517
|
-
n2,
|
|
3518
|
-
oldProps,
|
|
3519
|
-
newProps,
|
|
3520
|
-
parentComponent,
|
|
3521
|
-
parentSuspense,
|
|
3522
|
-
namespace
|
|
3523
|
-
);
|
|
3478
|
+
patchProps(el, oldProps, newProps, parentComponent, namespace);
|
|
3524
3479
|
}
|
|
3525
3480
|
if ((vnodeHook = newProps.onVnodeUpdated) || dirs) {
|
|
3526
3481
|
queuePostRenderEffect(() => {
|
|
@@ -3560,7 +3515,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3560
3515
|
);
|
|
3561
3516
|
}
|
|
3562
3517
|
};
|
|
3563
|
-
const patchProps = (el,
|
|
3518
|
+
const patchProps = (el, oldProps, newProps, parentComponent, namespace) => {
|
|
3564
3519
|
if (oldProps !== newProps) {
|
|
3565
3520
|
if (oldProps !== shared.EMPTY_OBJ) {
|
|
3566
3521
|
for (const key in oldProps) {
|
|
@@ -3571,10 +3526,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3571
3526
|
oldProps[key],
|
|
3572
3527
|
null,
|
|
3573
3528
|
namespace,
|
|
3574
|
-
|
|
3575
|
-
parentComponent,
|
|
3576
|
-
parentSuspense,
|
|
3577
|
-
unmountChildren
|
|
3529
|
+
parentComponent
|
|
3578
3530
|
);
|
|
3579
3531
|
}
|
|
3580
3532
|
}
|
|
@@ -3584,17 +3536,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3584
3536
|
const next = newProps[key];
|
|
3585
3537
|
const prev = oldProps[key];
|
|
3586
3538
|
if (next !== prev && key !== "value") {
|
|
3587
|
-
hostPatchProp(
|
|
3588
|
-
el,
|
|
3589
|
-
key,
|
|
3590
|
-
prev,
|
|
3591
|
-
next,
|
|
3592
|
-
namespace,
|
|
3593
|
-
vnode.children,
|
|
3594
|
-
parentComponent,
|
|
3595
|
-
parentSuspense,
|
|
3596
|
-
unmountChildren
|
|
3597
|
-
);
|
|
3539
|
+
hostPatchProp(el, key, prev, next, namespace, parentComponent);
|
|
3598
3540
|
}
|
|
3599
3541
|
}
|
|
3600
3542
|
if ("value" in newProps) {
|
|
@@ -3704,7 +3646,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3704
3646
|
instance.ctx.renderer = internals;
|
|
3705
3647
|
}
|
|
3706
3648
|
{
|
|
3707
|
-
setupComponent(instance);
|
|
3649
|
+
setupComponent(instance, false, optimized);
|
|
3708
3650
|
}
|
|
3709
3651
|
if (instance.asyncDep) {
|
|
3710
3652
|
parentSuspense && parentSuspense.registerDep(instance, setupRenderEffect, optimized);
|
|
@@ -3880,6 +3822,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3880
3822
|
effect.run();
|
|
3881
3823
|
}
|
|
3882
3824
|
};
|
|
3825
|
+
update.i = instance;
|
|
3883
3826
|
update.id = instance.uid;
|
|
3884
3827
|
toggleRecurse(instance, true);
|
|
3885
3828
|
update();
|
|
@@ -4232,7 +4175,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4232
4175
|
shapeFlag,
|
|
4233
4176
|
patchFlag,
|
|
4234
4177
|
dirs,
|
|
4235
|
-
|
|
4178
|
+
cacheIndex
|
|
4236
4179
|
} = vnode;
|
|
4237
4180
|
if (patchFlag === -2) {
|
|
4238
4181
|
optimized = false;
|
|
@@ -4240,8 +4183,8 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4240
4183
|
if (ref != null) {
|
|
4241
4184
|
setRef(ref, null, parentSuspense, vnode, true);
|
|
4242
4185
|
}
|
|
4243
|
-
if (
|
|
4244
|
-
parentComponent.renderCache[
|
|
4186
|
+
if (cacheIndex != null) {
|
|
4187
|
+
parentComponent.renderCache[cacheIndex] = void 0;
|
|
4245
4188
|
}
|
|
4246
4189
|
if (shapeFlag & 256) {
|
|
4247
4190
|
parentComponent.ctx.deactivate(vnode);
|
|
@@ -4271,7 +4214,12 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4271
4214
|
internals,
|
|
4272
4215
|
doRemove
|
|
4273
4216
|
);
|
|
4274
|
-
} else if (dynamicChildren && // #
|
|
4217
|
+
} else if (dynamicChildren && // #5154
|
|
4218
|
+
// when v-once is used inside a block, setBlockTracking(-1) marks the
|
|
4219
|
+
// parent block with hasOnce: true
|
|
4220
|
+
// so that it doesn't take the fast path during unmount - otherwise
|
|
4221
|
+
// components nested in v-once are never unmounted.
|
|
4222
|
+
!dynamicChildren.hasOnce && // #1153: fast path should not be taken for non-stable (v-for) fragments
|
|
4275
4223
|
(type !== Fragment || patchFlag > 0 && patchFlag & 64)) {
|
|
4276
4224
|
unmountChildren(
|
|
4277
4225
|
dynamicChildren,
|
|
@@ -4370,7 +4318,9 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4370
4318
|
if (vnode.shapeFlag & 128) {
|
|
4371
4319
|
return vnode.suspense.next();
|
|
4372
4320
|
}
|
|
4373
|
-
|
|
4321
|
+
const el = hostNextSibling(vnode.anchor || vnode.el);
|
|
4322
|
+
const teleportEnd = el && el[TeleportEndKey];
|
|
4323
|
+
return teleportEnd ? hostNextSibling(teleportEnd) : el;
|
|
4374
4324
|
};
|
|
4375
4325
|
let isFlushing = false;
|
|
4376
4326
|
const render = (vnode, container, namespace) => {
|
|
@@ -4744,827 +4694,932 @@ function traverse(value, depth = Infinity, seen) {
|
|
|
4744
4694
|
return value;
|
|
4745
4695
|
}
|
|
4746
4696
|
|
|
4747
|
-
|
|
4748
|
-
const
|
|
4749
|
-
name
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
const sharedContext = instance.ctx;
|
|
4762
|
-
if (!sharedContext.renderer) {
|
|
4763
|
-
return () => {
|
|
4764
|
-
const children = slots.default && slots.default();
|
|
4765
|
-
return children && children.length === 1 ? children[0] : children;
|
|
4766
|
-
};
|
|
4767
|
-
}
|
|
4768
|
-
const cache = /* @__PURE__ */ new Map();
|
|
4769
|
-
const keys = /* @__PURE__ */ new Set();
|
|
4770
|
-
let current = null;
|
|
4771
|
-
const parentSuspense = instance.suspense;
|
|
4772
|
-
const {
|
|
4773
|
-
renderer: {
|
|
4774
|
-
p: patch,
|
|
4775
|
-
m: move,
|
|
4776
|
-
um: _unmount,
|
|
4777
|
-
o: { createElement }
|
|
4697
|
+
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
4698
|
+
const i = getCurrentInstance();
|
|
4699
|
+
const camelizedName = shared.camelize(name);
|
|
4700
|
+
const hyphenatedName = shared.hyphenate(name);
|
|
4701
|
+
const modifiers = getModelModifiers(props, name);
|
|
4702
|
+
const res = reactivity.customRef((track, trigger) => {
|
|
4703
|
+
let localValue;
|
|
4704
|
+
let prevSetValue;
|
|
4705
|
+
let prevEmittedValue;
|
|
4706
|
+
watchSyncEffect(() => {
|
|
4707
|
+
const propValue = props[name];
|
|
4708
|
+
if (shared.hasChanged(localValue, propValue)) {
|
|
4709
|
+
localValue = propValue;
|
|
4710
|
+
trigger();
|
|
4778
4711
|
}
|
|
4779
|
-
}
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
anchor,
|
|
4789
|
-
instance2,
|
|
4790
|
-
parentSuspense,
|
|
4791
|
-
namespace,
|
|
4792
|
-
vnode.slotScopeIds,
|
|
4793
|
-
optimized
|
|
4794
|
-
);
|
|
4795
|
-
queuePostRenderEffect(() => {
|
|
4796
|
-
instance2.isDeactivated = false;
|
|
4797
|
-
if (instance2.a) {
|
|
4798
|
-
shared.invokeArrayFns(instance2.a);
|
|
4799
|
-
}
|
|
4800
|
-
const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
|
|
4801
|
-
if (vnodeHook) {
|
|
4802
|
-
invokeVNodeHook(vnodeHook, instance2.parent, vnode);
|
|
4712
|
+
});
|
|
4713
|
+
return {
|
|
4714
|
+
get() {
|
|
4715
|
+
track();
|
|
4716
|
+
return options.get ? options.get(localValue) : localValue;
|
|
4717
|
+
},
|
|
4718
|
+
set(value) {
|
|
4719
|
+
if (!shared.hasChanged(value, localValue)) {
|
|
4720
|
+
return;
|
|
4803
4721
|
}
|
|
4804
|
-
|
|
4805
|
-
|
|
4806
|
-
|
|
4807
|
-
|
|
4808
|
-
|
|
4809
|
-
invalidateMount(instance2.a);
|
|
4810
|
-
move(vnode, storageContainer, null, 1, parentSuspense);
|
|
4811
|
-
queuePostRenderEffect(() => {
|
|
4812
|
-
if (instance2.da) {
|
|
4813
|
-
shared.invokeArrayFns(instance2.da);
|
|
4722
|
+
const rawProps = i.vnode.props;
|
|
4723
|
+
if (!(rawProps && // check if parent has passed v-model
|
|
4724
|
+
(name in rawProps || camelizedName in rawProps || hyphenatedName in rawProps) && (`onUpdate:${name}` in rawProps || `onUpdate:${camelizedName}` in rawProps || `onUpdate:${hyphenatedName}` in rawProps))) {
|
|
4725
|
+
localValue = value;
|
|
4726
|
+
trigger();
|
|
4814
4727
|
}
|
|
4815
|
-
const
|
|
4816
|
-
|
|
4817
|
-
|
|
4728
|
+
const emittedValue = options.set ? options.set(value) : value;
|
|
4729
|
+
i.emit(`update:${name}`, emittedValue);
|
|
4730
|
+
if (value !== emittedValue && value !== prevSetValue && emittedValue === prevEmittedValue) {
|
|
4731
|
+
trigger();
|
|
4818
4732
|
}
|
|
4819
|
-
|
|
4820
|
-
|
|
4733
|
+
prevSetValue = value;
|
|
4734
|
+
prevEmittedValue = emittedValue;
|
|
4735
|
+
}
|
|
4821
4736
|
};
|
|
4822
|
-
|
|
4823
|
-
|
|
4824
|
-
|
|
4825
|
-
|
|
4826
|
-
|
|
4827
|
-
|
|
4828
|
-
|
|
4829
|
-
|
|
4830
|
-
|
|
4737
|
+
});
|
|
4738
|
+
res[Symbol.iterator] = () => {
|
|
4739
|
+
let i2 = 0;
|
|
4740
|
+
return {
|
|
4741
|
+
next() {
|
|
4742
|
+
if (i2 < 2) {
|
|
4743
|
+
return { value: i2++ ? modifiers || shared.EMPTY_OBJ : res, done: false };
|
|
4744
|
+
} else {
|
|
4745
|
+
return { done: true };
|
|
4831
4746
|
}
|
|
4832
|
-
});
|
|
4833
|
-
}
|
|
4834
|
-
function pruneCacheEntry(key) {
|
|
4835
|
-
const cached = cache.get(key);
|
|
4836
|
-
if (!current || !isSameVNodeType(cached, current)) {
|
|
4837
|
-
unmount(cached);
|
|
4838
|
-
} else if (current) {
|
|
4839
|
-
resetShapeFlag(current);
|
|
4840
4747
|
}
|
|
4841
|
-
|
|
4842
|
-
|
|
4748
|
+
};
|
|
4749
|
+
};
|
|
4750
|
+
return res;
|
|
4751
|
+
}
|
|
4752
|
+
const getModelModifiers = (props, modelName) => {
|
|
4753
|
+
return modelName === "modelValue" || modelName === "model-value" ? props.modelModifiers : props[`${modelName}Modifiers`] || props[`${shared.camelize(modelName)}Modifiers`] || props[`${shared.hyphenate(modelName)}Modifiers`];
|
|
4754
|
+
};
|
|
4755
|
+
|
|
4756
|
+
function emit(instance, event, ...rawArgs) {
|
|
4757
|
+
if (instance.isUnmounted) return;
|
|
4758
|
+
const props = instance.vnode.props || shared.EMPTY_OBJ;
|
|
4759
|
+
let args = rawArgs;
|
|
4760
|
+
const isModelListener = event.startsWith("update:");
|
|
4761
|
+
const modifiers = isModelListener && getModelModifiers(props, event.slice(7));
|
|
4762
|
+
if (modifiers) {
|
|
4763
|
+
if (modifiers.trim) {
|
|
4764
|
+
args = rawArgs.map((a) => shared.isString(a) ? a.trim() : a);
|
|
4843
4765
|
}
|
|
4844
|
-
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
4766
|
+
if (modifiers.number) {
|
|
4767
|
+
args = rawArgs.map(shared.looseToNumber);
|
|
4768
|
+
}
|
|
4769
|
+
}
|
|
4770
|
+
let handlerName;
|
|
4771
|
+
let handler = props[handlerName = shared.toHandlerKey(event)] || // also try camelCase event handler (#2249)
|
|
4772
|
+
props[handlerName = shared.toHandlerKey(shared.camelize(event))];
|
|
4773
|
+
if (!handler && isModelListener) {
|
|
4774
|
+
handler = props[handlerName = shared.toHandlerKey(shared.hyphenate(event))];
|
|
4775
|
+
}
|
|
4776
|
+
if (handler) {
|
|
4777
|
+
callWithAsyncErrorHandling(
|
|
4778
|
+
handler,
|
|
4779
|
+
instance,
|
|
4780
|
+
6,
|
|
4781
|
+
args
|
|
4852
4782
|
);
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
4856
|
-
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
4862
|
-
|
|
4783
|
+
}
|
|
4784
|
+
const onceHandler = props[handlerName + `Once`];
|
|
4785
|
+
if (onceHandler) {
|
|
4786
|
+
if (!instance.emitted) {
|
|
4787
|
+
instance.emitted = {};
|
|
4788
|
+
} else if (instance.emitted[handlerName]) {
|
|
4789
|
+
return;
|
|
4790
|
+
}
|
|
4791
|
+
instance.emitted[handlerName] = true;
|
|
4792
|
+
callWithAsyncErrorHandling(
|
|
4793
|
+
onceHandler,
|
|
4794
|
+
instance,
|
|
4795
|
+
6,
|
|
4796
|
+
args
|
|
4797
|
+
);
|
|
4798
|
+
}
|
|
4799
|
+
}
|
|
4800
|
+
function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
4801
|
+
const cache = appContext.emitsCache;
|
|
4802
|
+
const cached = cache.get(comp);
|
|
4803
|
+
if (cached !== void 0) {
|
|
4804
|
+
return cached;
|
|
4805
|
+
}
|
|
4806
|
+
const raw = comp.emits;
|
|
4807
|
+
let normalized = {};
|
|
4808
|
+
let hasExtends = false;
|
|
4809
|
+
if (!shared.isFunction(comp)) {
|
|
4810
|
+
const extendEmits = (raw2) => {
|
|
4811
|
+
const normalizedFromExtend = normalizeEmitsOptions(raw2, appContext, true);
|
|
4812
|
+
if (normalizedFromExtend) {
|
|
4813
|
+
hasExtends = true;
|
|
4814
|
+
shared.extend(normalized, normalizedFromExtend);
|
|
4863
4815
|
}
|
|
4864
4816
|
};
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
4868
|
-
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4872
|
-
|
|
4873
|
-
|
|
4874
|
-
|
|
4875
|
-
|
|
4817
|
+
if (!asMixin && appContext.mixins.length) {
|
|
4818
|
+
appContext.mixins.forEach(extendEmits);
|
|
4819
|
+
}
|
|
4820
|
+
if (comp.extends) {
|
|
4821
|
+
extendEmits(comp.extends);
|
|
4822
|
+
}
|
|
4823
|
+
if (comp.mixins) {
|
|
4824
|
+
comp.mixins.forEach(extendEmits);
|
|
4825
|
+
}
|
|
4826
|
+
}
|
|
4827
|
+
if (!raw && !hasExtends) {
|
|
4828
|
+
if (shared.isObject(comp)) {
|
|
4829
|
+
cache.set(comp, null);
|
|
4830
|
+
}
|
|
4831
|
+
return null;
|
|
4832
|
+
}
|
|
4833
|
+
if (shared.isArray(raw)) {
|
|
4834
|
+
raw.forEach((key) => normalized[key] = null);
|
|
4835
|
+
} else {
|
|
4836
|
+
shared.extend(normalized, raw);
|
|
4837
|
+
}
|
|
4838
|
+
if (shared.isObject(comp)) {
|
|
4839
|
+
cache.set(comp, normalized);
|
|
4840
|
+
}
|
|
4841
|
+
return normalized;
|
|
4842
|
+
}
|
|
4843
|
+
function isEmitListener(options, key) {
|
|
4844
|
+
if (!options || !shared.isOn(key)) {
|
|
4845
|
+
return false;
|
|
4846
|
+
}
|
|
4847
|
+
key = key.slice(2).replace(/Once$/, "");
|
|
4848
|
+
return shared.hasOwn(options, key[0].toLowerCase() + key.slice(1)) || shared.hasOwn(options, shared.hyphenate(key)) || shared.hasOwn(options, key);
|
|
4849
|
+
}
|
|
4850
|
+
|
|
4851
|
+
function markAttrsAccessed() {
|
|
4852
|
+
}
|
|
4853
|
+
function renderComponentRoot(instance) {
|
|
4854
|
+
const {
|
|
4855
|
+
type: Component,
|
|
4856
|
+
vnode,
|
|
4857
|
+
proxy,
|
|
4858
|
+
withProxy,
|
|
4859
|
+
propsOptions: [propsOptions],
|
|
4860
|
+
slots,
|
|
4861
|
+
attrs,
|
|
4862
|
+
emit,
|
|
4863
|
+
render,
|
|
4864
|
+
renderCache,
|
|
4865
|
+
props,
|
|
4866
|
+
data,
|
|
4867
|
+
setupState,
|
|
4868
|
+
ctx,
|
|
4869
|
+
inheritAttrs
|
|
4870
|
+
} = instance;
|
|
4871
|
+
const prev = setCurrentRenderingInstance(instance);
|
|
4872
|
+
let result;
|
|
4873
|
+
let fallthroughAttrs;
|
|
4874
|
+
try {
|
|
4875
|
+
if (vnode.shapeFlag & 4) {
|
|
4876
|
+
const proxyToUse = withProxy || proxy;
|
|
4877
|
+
const thisProxy = false ? new Proxy(proxyToUse, {
|
|
4878
|
+
get(target, key, receiver) {
|
|
4879
|
+
warn(
|
|
4880
|
+
`Property '${String(
|
|
4881
|
+
key
|
|
4882
|
+
)}' was accessed via 'this'. Avoid using 'this' in templates.`
|
|
4883
|
+
);
|
|
4884
|
+
return Reflect.get(target, key, receiver);
|
|
4876
4885
|
}
|
|
4877
|
-
|
|
4878
|
-
|
|
4879
|
-
|
|
4880
|
-
|
|
4881
|
-
|
|
4882
|
-
|
|
4883
|
-
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
4888
|
-
current = null;
|
|
4889
|
-
return children;
|
|
4890
|
-
} else if (!isVNode(rawVNode) || !(rawVNode.shapeFlag & 4) && !(rawVNode.shapeFlag & 128)) {
|
|
4891
|
-
current = null;
|
|
4892
|
-
return rawVNode;
|
|
4893
|
-
}
|
|
4894
|
-
let vnode = getInnerChild(rawVNode);
|
|
4895
|
-
const comp = vnode.type;
|
|
4896
|
-
const name = getComponentName(
|
|
4897
|
-
isAsyncWrapper(vnode) ? vnode.type.__asyncResolved || {} : comp
|
|
4886
|
+
}) : proxyToUse;
|
|
4887
|
+
result = normalizeVNode(
|
|
4888
|
+
render.call(
|
|
4889
|
+
thisProxy,
|
|
4890
|
+
proxyToUse,
|
|
4891
|
+
renderCache,
|
|
4892
|
+
false ? shallowReadonly(props) : props,
|
|
4893
|
+
setupState,
|
|
4894
|
+
data,
|
|
4895
|
+
ctx
|
|
4896
|
+
)
|
|
4898
4897
|
);
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
4904
|
-
|
|
4905
|
-
|
|
4906
|
-
|
|
4907
|
-
|
|
4908
|
-
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4898
|
+
fallthroughAttrs = attrs;
|
|
4899
|
+
} else {
|
|
4900
|
+
const render2 = Component;
|
|
4901
|
+
if (false) ;
|
|
4902
|
+
result = normalizeVNode(
|
|
4903
|
+
render2.length > 1 ? render2(
|
|
4904
|
+
false ? shallowReadonly(props) : props,
|
|
4905
|
+
false ? {
|
|
4906
|
+
get attrs() {
|
|
4907
|
+
markAttrsAccessed();
|
|
4908
|
+
return shallowReadonly(attrs);
|
|
4909
|
+
},
|
|
4910
|
+
slots,
|
|
4911
|
+
emit
|
|
4912
|
+
} : { attrs, slots, emit }
|
|
4913
|
+
) : render2(
|
|
4914
|
+
false ? shallowReadonly(props) : props,
|
|
4915
|
+
null
|
|
4916
|
+
)
|
|
4917
|
+
);
|
|
4918
|
+
fallthroughAttrs = Component.props ? attrs : getFunctionalFallthrough(attrs);
|
|
4919
|
+
}
|
|
4920
|
+
} catch (err) {
|
|
4921
|
+
blockStack.length = 0;
|
|
4922
|
+
handleError(err, instance, 1);
|
|
4923
|
+
result = createVNode(Comment);
|
|
4924
|
+
}
|
|
4925
|
+
let root = result;
|
|
4926
|
+
if (fallthroughAttrs && inheritAttrs !== false) {
|
|
4927
|
+
const keys = Object.keys(fallthroughAttrs);
|
|
4928
|
+
const { shapeFlag } = root;
|
|
4929
|
+
if (keys.length) {
|
|
4930
|
+
if (shapeFlag & (1 | 6)) {
|
|
4931
|
+
if (propsOptions && keys.some(shared.isModelListener)) {
|
|
4932
|
+
fallthroughAttrs = filterModelListeners(
|
|
4933
|
+
fallthroughAttrs,
|
|
4934
|
+
propsOptions
|
|
4935
|
+
);
|
|
4926
4936
|
}
|
|
4937
|
+
root = cloneVNode(root, fallthroughAttrs, false, true);
|
|
4927
4938
|
}
|
|
4928
|
-
|
|
4929
|
-
current = vnode;
|
|
4930
|
-
return isSuspense(rawVNode.type) ? rawVNode : vnode;
|
|
4931
|
-
};
|
|
4939
|
+
}
|
|
4932
4940
|
}
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
if (shared.isArray(pattern)) {
|
|
4937
|
-
return pattern.some((p) => matches(p, name));
|
|
4938
|
-
} else if (shared.isString(pattern)) {
|
|
4939
|
-
return pattern.split(",").includes(name);
|
|
4940
|
-
} else if (shared.isRegExp(pattern)) {
|
|
4941
|
-
return pattern.test(name);
|
|
4941
|
+
if (vnode.dirs) {
|
|
4942
|
+
root = cloneVNode(root, null, false, true);
|
|
4943
|
+
root.dirs = root.dirs ? root.dirs.concat(vnode.dirs) : vnode.dirs;
|
|
4942
4944
|
}
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4945
|
+
if (vnode.transition) {
|
|
4946
|
+
root.transition = vnode.transition;
|
|
4947
|
+
}
|
|
4948
|
+
{
|
|
4949
|
+
result = root;
|
|
4950
|
+
}
|
|
4951
|
+
setCurrentRenderingInstance(prev);
|
|
4952
|
+
return result;
|
|
4950
4953
|
}
|
|
4951
|
-
function
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
injectHook(type, wrappedHook, target);
|
|
4963
|
-
if (target) {
|
|
4964
|
-
let current = target.parent;
|
|
4965
|
-
while (current && current.parent) {
|
|
4966
|
-
if (isKeepAlive(current.parent.vnode)) {
|
|
4967
|
-
injectToKeepAliveRoot(wrappedHook, type, target, current);
|
|
4954
|
+
function filterSingleRoot(children, recurse = true) {
|
|
4955
|
+
let singleRoot;
|
|
4956
|
+
for (let i = 0; i < children.length; i++) {
|
|
4957
|
+
const child = children[i];
|
|
4958
|
+
if (isVNode(child)) {
|
|
4959
|
+
if (child.type !== Comment || child.children === "v-if") {
|
|
4960
|
+
if (singleRoot) {
|
|
4961
|
+
return;
|
|
4962
|
+
} else {
|
|
4963
|
+
singleRoot = child;
|
|
4964
|
+
}
|
|
4968
4965
|
}
|
|
4969
|
-
|
|
4966
|
+
} else {
|
|
4967
|
+
return;
|
|
4970
4968
|
}
|
|
4971
4969
|
}
|
|
4970
|
+
return singleRoot;
|
|
4972
4971
|
}
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
onUnmounted(() => {
|
|
4982
|
-
shared.remove(keepAliveRoot[type], injected);
|
|
4983
|
-
}, target);
|
|
4984
|
-
}
|
|
4985
|
-
function resetShapeFlag(vnode) {
|
|
4986
|
-
vnode.shapeFlag &= ~256;
|
|
4987
|
-
vnode.shapeFlag &= ~512;
|
|
4988
|
-
}
|
|
4989
|
-
function getInnerChild(vnode) {
|
|
4990
|
-
return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
|
|
4991
|
-
}
|
|
4992
|
-
|
|
4993
|
-
const leaveCbKey = Symbol("_leaveCb");
|
|
4994
|
-
const enterCbKey = Symbol("_enterCb");
|
|
4995
|
-
function useTransitionState() {
|
|
4996
|
-
const state = {
|
|
4997
|
-
isMounted: false,
|
|
4998
|
-
isLeaving: false,
|
|
4999
|
-
isUnmounting: false,
|
|
5000
|
-
leavingVNodes: /* @__PURE__ */ new Map()
|
|
5001
|
-
};
|
|
5002
|
-
onMounted(() => {
|
|
5003
|
-
state.isMounted = true;
|
|
5004
|
-
});
|
|
5005
|
-
onBeforeUnmount(() => {
|
|
5006
|
-
state.isUnmounting = true;
|
|
5007
|
-
});
|
|
5008
|
-
return state;
|
|
5009
|
-
}
|
|
5010
|
-
const TransitionHookValidator = [Function, Array];
|
|
5011
|
-
const BaseTransitionPropsValidators = {
|
|
5012
|
-
mode: String,
|
|
5013
|
-
appear: Boolean,
|
|
5014
|
-
persisted: Boolean,
|
|
5015
|
-
// enter
|
|
5016
|
-
onBeforeEnter: TransitionHookValidator,
|
|
5017
|
-
onEnter: TransitionHookValidator,
|
|
5018
|
-
onAfterEnter: TransitionHookValidator,
|
|
5019
|
-
onEnterCancelled: TransitionHookValidator,
|
|
5020
|
-
// leave
|
|
5021
|
-
onBeforeLeave: TransitionHookValidator,
|
|
5022
|
-
onLeave: TransitionHookValidator,
|
|
5023
|
-
onAfterLeave: TransitionHookValidator,
|
|
5024
|
-
onLeaveCancelled: TransitionHookValidator,
|
|
5025
|
-
// appear
|
|
5026
|
-
onBeforeAppear: TransitionHookValidator,
|
|
5027
|
-
onAppear: TransitionHookValidator,
|
|
5028
|
-
onAfterAppear: TransitionHookValidator,
|
|
5029
|
-
onAppearCancelled: TransitionHookValidator
|
|
4972
|
+
const getFunctionalFallthrough = (attrs) => {
|
|
4973
|
+
let res;
|
|
4974
|
+
for (const key in attrs) {
|
|
4975
|
+
if (key === "class" || key === "style" || shared.isOn(key)) {
|
|
4976
|
+
(res || (res = {}))[key] = attrs[key];
|
|
4977
|
+
}
|
|
4978
|
+
}
|
|
4979
|
+
return res;
|
|
5030
4980
|
};
|
|
5031
|
-
const
|
|
5032
|
-
const
|
|
5033
|
-
|
|
4981
|
+
const filterModelListeners = (attrs, props) => {
|
|
4982
|
+
const res = {};
|
|
4983
|
+
for (const key in attrs) {
|
|
4984
|
+
if (!shared.isModelListener(key) || !(key.slice(9) in props)) {
|
|
4985
|
+
res[key] = attrs[key];
|
|
4986
|
+
}
|
|
4987
|
+
}
|
|
4988
|
+
return res;
|
|
5034
4989
|
};
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
props:
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
|
|
5044
|
-
|
|
5045
|
-
|
|
5046
|
-
|
|
5047
|
-
if (
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
if (state.isLeaving) {
|
|
5058
|
-
return emptyPlaceholder(child);
|
|
5059
|
-
}
|
|
5060
|
-
const innerChild = getKeepAliveChild(child);
|
|
5061
|
-
if (!innerChild) {
|
|
5062
|
-
return emptyPlaceholder(child);
|
|
5063
|
-
}
|
|
5064
|
-
let enterHooks = resolveTransitionHooks(
|
|
5065
|
-
innerChild,
|
|
5066
|
-
rawProps,
|
|
5067
|
-
state,
|
|
5068
|
-
instance,
|
|
5069
|
-
// #11061, ensure enterHooks is fresh after clone
|
|
5070
|
-
(hooks) => enterHooks = hooks
|
|
5071
|
-
);
|
|
5072
|
-
setTransitionHooks(innerChild, enterHooks);
|
|
5073
|
-
const oldChild = instance.subTree;
|
|
5074
|
-
const oldInnerChild = oldChild && getKeepAliveChild(oldChild);
|
|
5075
|
-
if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
|
|
5076
|
-
const leavingHooks = resolveTransitionHooks(
|
|
5077
|
-
oldInnerChild,
|
|
5078
|
-
rawProps,
|
|
5079
|
-
state,
|
|
5080
|
-
instance
|
|
5081
|
-
);
|
|
5082
|
-
setTransitionHooks(oldInnerChild, leavingHooks);
|
|
5083
|
-
if (mode === "out-in" && innerChild.type !== Comment) {
|
|
5084
|
-
state.isLeaving = true;
|
|
5085
|
-
leavingHooks.afterLeave = () => {
|
|
5086
|
-
state.isLeaving = false;
|
|
5087
|
-
if (instance.update.active !== false) {
|
|
5088
|
-
instance.effect.dirty = true;
|
|
5089
|
-
instance.update();
|
|
5090
|
-
}
|
|
5091
|
-
};
|
|
5092
|
-
return emptyPlaceholder(child);
|
|
5093
|
-
} else if (mode === "in-out" && innerChild.type !== Comment) {
|
|
5094
|
-
leavingHooks.delayLeave = (el, earlyRemove, delayedLeave) => {
|
|
5095
|
-
const leavingVNodesCache = getLeavingNodesForType(
|
|
5096
|
-
state,
|
|
5097
|
-
oldInnerChild
|
|
5098
|
-
);
|
|
5099
|
-
leavingVNodesCache[String(oldInnerChild.key)] = oldInnerChild;
|
|
5100
|
-
el[leaveCbKey] = () => {
|
|
5101
|
-
earlyRemove();
|
|
5102
|
-
el[leaveCbKey] = void 0;
|
|
5103
|
-
delete enterHooks.delayedLeave;
|
|
5104
|
-
};
|
|
5105
|
-
enterHooks.delayedLeave = delayedLeave;
|
|
5106
|
-
};
|
|
4990
|
+
function shouldUpdateComponent(prevVNode, nextVNode, optimized) {
|
|
4991
|
+
const { props: prevProps, children: prevChildren, component } = prevVNode;
|
|
4992
|
+
const { props: nextProps, children: nextChildren, patchFlag } = nextVNode;
|
|
4993
|
+
const emits = component.emitsOptions;
|
|
4994
|
+
if (nextVNode.dirs || nextVNode.transition) {
|
|
4995
|
+
return true;
|
|
4996
|
+
}
|
|
4997
|
+
if (optimized && patchFlag >= 0) {
|
|
4998
|
+
if (patchFlag & 1024) {
|
|
4999
|
+
return true;
|
|
5000
|
+
}
|
|
5001
|
+
if (patchFlag & 16) {
|
|
5002
|
+
if (!prevProps) {
|
|
5003
|
+
return !!nextProps;
|
|
5004
|
+
}
|
|
5005
|
+
return hasPropsChanged(prevProps, nextProps, emits);
|
|
5006
|
+
} else if (patchFlag & 8) {
|
|
5007
|
+
const dynamicProps = nextVNode.dynamicProps;
|
|
5008
|
+
for (let i = 0; i < dynamicProps.length; i++) {
|
|
5009
|
+
const key = dynamicProps[i];
|
|
5010
|
+
if (nextProps[key] !== prevProps[key] && !isEmitListener(emits, key)) {
|
|
5011
|
+
return true;
|
|
5107
5012
|
}
|
|
5108
5013
|
}
|
|
5109
|
-
|
|
5110
|
-
|
|
5014
|
+
}
|
|
5015
|
+
} else {
|
|
5016
|
+
if (prevChildren || nextChildren) {
|
|
5017
|
+
if (!nextChildren || !nextChildren.$stable) {
|
|
5018
|
+
return true;
|
|
5019
|
+
}
|
|
5020
|
+
}
|
|
5021
|
+
if (prevProps === nextProps) {
|
|
5022
|
+
return false;
|
|
5023
|
+
}
|
|
5024
|
+
if (!prevProps) {
|
|
5025
|
+
return !!nextProps;
|
|
5026
|
+
}
|
|
5027
|
+
if (!nextProps) {
|
|
5028
|
+
return true;
|
|
5029
|
+
}
|
|
5030
|
+
return hasPropsChanged(prevProps, nextProps, emits);
|
|
5111
5031
|
}
|
|
5032
|
+
return false;
|
|
5033
|
+
}
|
|
5034
|
+
function hasPropsChanged(prevProps, nextProps, emitsOptions) {
|
|
5035
|
+
const nextKeys = Object.keys(nextProps);
|
|
5036
|
+
if (nextKeys.length !== Object.keys(prevProps).length) {
|
|
5037
|
+
return true;
|
|
5038
|
+
}
|
|
5039
|
+
for (let i = 0; i < nextKeys.length; i++) {
|
|
5040
|
+
const key = nextKeys[i];
|
|
5041
|
+
if (nextProps[key] !== prevProps[key] && !isEmitListener(emitsOptions, key)) {
|
|
5042
|
+
return true;
|
|
5043
|
+
}
|
|
5044
|
+
}
|
|
5045
|
+
return false;
|
|
5046
|
+
}
|
|
5047
|
+
function updateHOCHostEl({ vnode, parent }, el) {
|
|
5048
|
+
while (parent) {
|
|
5049
|
+
const root = parent.subTree;
|
|
5050
|
+
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
5051
|
+
root.el = vnode.el;
|
|
5052
|
+
}
|
|
5053
|
+
if (root === vnode) {
|
|
5054
|
+
(vnode = parent.vnode).el = el;
|
|
5055
|
+
parent = parent.parent;
|
|
5056
|
+
} else {
|
|
5057
|
+
break;
|
|
5058
|
+
}
|
|
5059
|
+
}
|
|
5060
|
+
}
|
|
5061
|
+
|
|
5062
|
+
const isSuspense = (type) => type.__isSuspense;
|
|
5063
|
+
let suspenseId = 0;
|
|
5064
|
+
const SuspenseImpl = {
|
|
5065
|
+
name: "Suspense",
|
|
5066
|
+
// In order to make Suspense tree-shakable, we need to avoid importing it
|
|
5067
|
+
// directly in the renderer. The renderer checks for the __isSuspense flag
|
|
5068
|
+
// on a vnode's type and calls the `process` method, passing in renderer
|
|
5069
|
+
// internals.
|
|
5070
|
+
__isSuspense: true,
|
|
5071
|
+
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
|
5072
|
+
if (n1 == null) {
|
|
5073
|
+
mountSuspense(
|
|
5074
|
+
n2,
|
|
5075
|
+
container,
|
|
5076
|
+
anchor,
|
|
5077
|
+
parentComponent,
|
|
5078
|
+
parentSuspense,
|
|
5079
|
+
namespace,
|
|
5080
|
+
slotScopeIds,
|
|
5081
|
+
optimized,
|
|
5082
|
+
rendererInternals
|
|
5083
|
+
);
|
|
5084
|
+
} else {
|
|
5085
|
+
if (parentSuspense && parentSuspense.deps > 0 && !n1.suspense.isInFallback) {
|
|
5086
|
+
n2.suspense = n1.suspense;
|
|
5087
|
+
n2.suspense.vnode = n2;
|
|
5088
|
+
n2.el = n1.el;
|
|
5089
|
+
return;
|
|
5090
|
+
}
|
|
5091
|
+
patchSuspense(
|
|
5092
|
+
n1,
|
|
5093
|
+
n2,
|
|
5094
|
+
container,
|
|
5095
|
+
anchor,
|
|
5096
|
+
parentComponent,
|
|
5097
|
+
namespace,
|
|
5098
|
+
slotScopeIds,
|
|
5099
|
+
optimized,
|
|
5100
|
+
rendererInternals
|
|
5101
|
+
);
|
|
5102
|
+
}
|
|
5103
|
+
},
|
|
5104
|
+
hydrate: hydrateSuspense,
|
|
5105
|
+
normalize: normalizeSuspenseChildren
|
|
5112
5106
|
};
|
|
5113
|
-
const
|
|
5114
|
-
function
|
|
5115
|
-
const
|
|
5116
|
-
|
|
5117
|
-
|
|
5118
|
-
leavingVNodesCache = /* @__PURE__ */ Object.create(null);
|
|
5119
|
-
leavingVNodes.set(vnode.type, leavingVNodesCache);
|
|
5107
|
+
const Suspense = SuspenseImpl ;
|
|
5108
|
+
function triggerEvent(vnode, name) {
|
|
5109
|
+
const eventListener = vnode.props && vnode.props[name];
|
|
5110
|
+
if (shared.isFunction(eventListener)) {
|
|
5111
|
+
eventListener();
|
|
5120
5112
|
}
|
|
5121
|
-
return leavingVNodesCache;
|
|
5122
5113
|
}
|
|
5123
|
-
function
|
|
5114
|
+
function mountSuspense(vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals) {
|
|
5124
5115
|
const {
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5116
|
+
p: patch,
|
|
5117
|
+
o: { createElement }
|
|
5118
|
+
} = rendererInternals;
|
|
5119
|
+
const hiddenContainer = createElement("div");
|
|
5120
|
+
const suspense = vnode.suspense = createSuspenseBoundary(
|
|
5121
|
+
vnode,
|
|
5122
|
+
parentSuspense,
|
|
5123
|
+
parentComponent,
|
|
5124
|
+
container,
|
|
5125
|
+
hiddenContainer,
|
|
5126
|
+
anchor,
|
|
5127
|
+
namespace,
|
|
5128
|
+
slotScopeIds,
|
|
5129
|
+
optimized,
|
|
5130
|
+
rendererInternals
|
|
5131
|
+
);
|
|
5132
|
+
patch(
|
|
5133
|
+
null,
|
|
5134
|
+
suspense.pendingBranch = vnode.ssContent,
|
|
5135
|
+
hiddenContainer,
|
|
5136
|
+
null,
|
|
5137
|
+
parentComponent,
|
|
5138
|
+
suspense,
|
|
5139
|
+
namespace,
|
|
5140
|
+
slotScopeIds
|
|
5141
|
+
);
|
|
5142
|
+
if (suspense.deps > 0) {
|
|
5143
|
+
triggerEvent(vnode, "onPending");
|
|
5144
|
+
triggerEvent(vnode, "onFallback");
|
|
5145
|
+
patch(
|
|
5146
|
+
null,
|
|
5147
|
+
vnode.ssFallback,
|
|
5148
|
+
container,
|
|
5149
|
+
anchor,
|
|
5150
|
+
parentComponent,
|
|
5151
|
+
null,
|
|
5152
|
+
// fallback tree will not have suspense context
|
|
5153
|
+
namespace,
|
|
5154
|
+
slotScopeIds
|
|
5149
5155
|
);
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
const
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
} else {
|
|
5194
|
-
return;
|
|
5156
|
+
setActiveBranch(suspense, vnode.ssFallback);
|
|
5157
|
+
} else {
|
|
5158
|
+
suspense.resolve(false, true);
|
|
5159
|
+
}
|
|
5160
|
+
}
|
|
5161
|
+
function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, slotScopeIds, optimized, { p: patch, um: unmount, o: { createElement } }) {
|
|
5162
|
+
const suspense = n2.suspense = n1.suspense;
|
|
5163
|
+
suspense.vnode = n2;
|
|
5164
|
+
n2.el = n1.el;
|
|
5165
|
+
const newBranch = n2.ssContent;
|
|
5166
|
+
const newFallback = n2.ssFallback;
|
|
5167
|
+
const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
|
|
5168
|
+
if (pendingBranch) {
|
|
5169
|
+
suspense.pendingBranch = newBranch;
|
|
5170
|
+
if (isSameVNodeType(newBranch, pendingBranch)) {
|
|
5171
|
+
patch(
|
|
5172
|
+
pendingBranch,
|
|
5173
|
+
newBranch,
|
|
5174
|
+
suspense.hiddenContainer,
|
|
5175
|
+
null,
|
|
5176
|
+
parentComponent,
|
|
5177
|
+
suspense,
|
|
5178
|
+
namespace,
|
|
5179
|
+
slotScopeIds,
|
|
5180
|
+
optimized
|
|
5181
|
+
);
|
|
5182
|
+
if (suspense.deps <= 0) {
|
|
5183
|
+
suspense.resolve();
|
|
5184
|
+
} else if (isInFallback) {
|
|
5185
|
+
if (!isHydrating) {
|
|
5186
|
+
patch(
|
|
5187
|
+
activeBranch,
|
|
5188
|
+
newFallback,
|
|
5189
|
+
container,
|
|
5190
|
+
anchor,
|
|
5191
|
+
parentComponent,
|
|
5192
|
+
null,
|
|
5193
|
+
// fallback tree will not have suspense context
|
|
5194
|
+
namespace,
|
|
5195
|
+
slotScopeIds,
|
|
5196
|
+
optimized
|
|
5197
|
+
);
|
|
5198
|
+
setActiveBranch(suspense, newFallback);
|
|
5195
5199
|
}
|
|
5196
5200
|
}
|
|
5197
|
-
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5202
|
-
callHook(cancelHook, [el]);
|
|
5203
|
-
} else {
|
|
5204
|
-
callHook(afterHook, [el]);
|
|
5205
|
-
}
|
|
5206
|
-
if (hooks.delayedLeave) {
|
|
5207
|
-
hooks.delayedLeave();
|
|
5208
|
-
}
|
|
5209
|
-
el[enterCbKey] = void 0;
|
|
5210
|
-
};
|
|
5211
|
-
if (hook) {
|
|
5212
|
-
callAsyncHook(hook, [el, done]);
|
|
5201
|
+
} else {
|
|
5202
|
+
suspense.pendingId = suspenseId++;
|
|
5203
|
+
if (isHydrating) {
|
|
5204
|
+
suspense.isHydrating = false;
|
|
5205
|
+
suspense.activeBranch = pendingBranch;
|
|
5213
5206
|
} else {
|
|
5214
|
-
|
|
5207
|
+
unmount(pendingBranch, parentComponent, suspense);
|
|
5215
5208
|
}
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5219
|
-
if (
|
|
5220
|
-
|
|
5221
|
-
|
|
5222
|
-
|
|
5209
|
+
suspense.deps = 0;
|
|
5210
|
+
suspense.effects.length = 0;
|
|
5211
|
+
suspense.hiddenContainer = createElement("div");
|
|
5212
|
+
if (isInFallback) {
|
|
5213
|
+
patch(
|
|
5214
|
+
null,
|
|
5215
|
+
newBranch,
|
|
5216
|
+
suspense.hiddenContainer,
|
|
5217
|
+
null,
|
|
5218
|
+
parentComponent,
|
|
5219
|
+
suspense,
|
|
5220
|
+
namespace,
|
|
5221
|
+
slotScopeIds,
|
|
5222
|
+
optimized
|
|
5223
5223
|
);
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
return remove();
|
|
5227
|
-
}
|
|
5228
|
-
callHook(onBeforeLeave, [el]);
|
|
5229
|
-
let called = false;
|
|
5230
|
-
const done = el[leaveCbKey] = (cancelled) => {
|
|
5231
|
-
if (called) return;
|
|
5232
|
-
called = true;
|
|
5233
|
-
remove();
|
|
5234
|
-
if (cancelled) {
|
|
5235
|
-
callHook(onLeaveCancelled, [el]);
|
|
5224
|
+
if (suspense.deps <= 0) {
|
|
5225
|
+
suspense.resolve();
|
|
5236
5226
|
} else {
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5227
|
+
patch(
|
|
5228
|
+
activeBranch,
|
|
5229
|
+
newFallback,
|
|
5230
|
+
container,
|
|
5231
|
+
anchor,
|
|
5232
|
+
parentComponent,
|
|
5233
|
+
null,
|
|
5234
|
+
// fallback tree will not have suspense context
|
|
5235
|
+
namespace,
|
|
5236
|
+
slotScopeIds,
|
|
5237
|
+
optimized
|
|
5238
|
+
);
|
|
5239
|
+
setActiveBranch(suspense, newFallback);
|
|
5242
5240
|
}
|
|
5243
|
-
}
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
|
|
5241
|
+
} else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
|
5242
|
+
patch(
|
|
5243
|
+
activeBranch,
|
|
5244
|
+
newBranch,
|
|
5245
|
+
container,
|
|
5246
|
+
anchor,
|
|
5247
|
+
parentComponent,
|
|
5248
|
+
suspense,
|
|
5249
|
+
namespace,
|
|
5250
|
+
slotScopeIds,
|
|
5251
|
+
optimized
|
|
5252
|
+
);
|
|
5253
|
+
suspense.resolve(true);
|
|
5247
5254
|
} else {
|
|
5248
|
-
|
|
5255
|
+
patch(
|
|
5256
|
+
null,
|
|
5257
|
+
newBranch,
|
|
5258
|
+
suspense.hiddenContainer,
|
|
5259
|
+
null,
|
|
5260
|
+
parentComponent,
|
|
5261
|
+
suspense,
|
|
5262
|
+
namespace,
|
|
5263
|
+
slotScopeIds,
|
|
5264
|
+
optimized
|
|
5265
|
+
);
|
|
5266
|
+
if (suspense.deps <= 0) {
|
|
5267
|
+
suspense.resolve();
|
|
5268
|
+
}
|
|
5249
5269
|
}
|
|
5250
|
-
},
|
|
5251
|
-
clone(vnode2) {
|
|
5252
|
-
const hooks2 = resolveTransitionHooks(
|
|
5253
|
-
vnode2,
|
|
5254
|
-
props,
|
|
5255
|
-
state,
|
|
5256
|
-
instance,
|
|
5257
|
-
postClone
|
|
5258
|
-
);
|
|
5259
|
-
if (postClone) postClone(hooks2);
|
|
5260
|
-
return hooks2;
|
|
5261
|
-
}
|
|
5262
|
-
};
|
|
5263
|
-
return hooks;
|
|
5264
|
-
}
|
|
5265
|
-
function emptyPlaceholder(vnode) {
|
|
5266
|
-
if (isKeepAlive(vnode)) {
|
|
5267
|
-
vnode = cloneVNode(vnode);
|
|
5268
|
-
vnode.children = null;
|
|
5269
|
-
return vnode;
|
|
5270
|
-
}
|
|
5271
|
-
}
|
|
5272
|
-
function getKeepAliveChild(vnode) {
|
|
5273
|
-
if (!isKeepAlive(vnode)) {
|
|
5274
|
-
return vnode;
|
|
5275
|
-
}
|
|
5276
|
-
const { shapeFlag, children } = vnode;
|
|
5277
|
-
if (children) {
|
|
5278
|
-
if (shapeFlag & 16) {
|
|
5279
|
-
return children[0];
|
|
5280
|
-
}
|
|
5281
|
-
if (shapeFlag & 32 && shared.isFunction(children.default)) {
|
|
5282
|
-
return children.default();
|
|
5283
5270
|
}
|
|
5284
|
-
}
|
|
5285
|
-
}
|
|
5286
|
-
function setTransitionHooks(vnode, hooks) {
|
|
5287
|
-
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
5288
|
-
setTransitionHooks(vnode.component.subTree, hooks);
|
|
5289
|
-
} else if (vnode.shapeFlag & 128) {
|
|
5290
|
-
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
5291
|
-
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
5292
5271
|
} else {
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5297
|
-
|
|
5298
|
-
|
|
5299
|
-
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
ret = ret.concat(
|
|
5305
|
-
getTransitionRawChildren(child.children, keepComment, key)
|
|
5272
|
+
if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
|
|
5273
|
+
patch(
|
|
5274
|
+
activeBranch,
|
|
5275
|
+
newBranch,
|
|
5276
|
+
container,
|
|
5277
|
+
anchor,
|
|
5278
|
+
parentComponent,
|
|
5279
|
+
suspense,
|
|
5280
|
+
namespace,
|
|
5281
|
+
slotScopeIds,
|
|
5282
|
+
optimized
|
|
5306
5283
|
);
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5284
|
+
setActiveBranch(suspense, newBranch);
|
|
5285
|
+
} else {
|
|
5286
|
+
triggerEvent(n2, "onPending");
|
|
5287
|
+
suspense.pendingBranch = newBranch;
|
|
5288
|
+
if (newBranch.shapeFlag & 512) {
|
|
5289
|
+
suspense.pendingId = newBranch.component.suspenseId;
|
|
5290
|
+
} else {
|
|
5291
|
+
suspense.pendingId = suspenseId++;
|
|
5292
|
+
}
|
|
5293
|
+
patch(
|
|
5294
|
+
null,
|
|
5295
|
+
newBranch,
|
|
5296
|
+
suspense.hiddenContainer,
|
|
5297
|
+
null,
|
|
5298
|
+
parentComponent,
|
|
5299
|
+
suspense,
|
|
5300
|
+
namespace,
|
|
5301
|
+
slotScopeIds,
|
|
5302
|
+
optimized
|
|
5303
|
+
);
|
|
5304
|
+
if (suspense.deps <= 0) {
|
|
5305
|
+
suspense.resolve();
|
|
5306
|
+
} else {
|
|
5307
|
+
const { timeout, pendingId } = suspense;
|
|
5308
|
+
if (timeout > 0) {
|
|
5309
|
+
setTimeout(() => {
|
|
5310
|
+
if (suspense.pendingId === pendingId) {
|
|
5311
|
+
suspense.fallback(newFallback);
|
|
5312
|
+
}
|
|
5313
|
+
}, timeout);
|
|
5314
|
+
} else if (timeout === 0) {
|
|
5315
|
+
suspense.fallback(newFallback);
|
|
5316
|
+
}
|
|
5317
|
+
}
|
|
5314
5318
|
}
|
|
5315
5319
|
}
|
|
5316
|
-
return ret;
|
|
5317
5320
|
}
|
|
5318
|
-
|
|
5319
|
-
const
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5330
|
-
|
|
5321
|
+
function createSuspenseBoundary(vnode, parentSuspense, parentComponent, container, hiddenContainer, anchor, namespace, slotScopeIds, optimized, rendererInternals, isHydrating = false) {
|
|
5322
|
+
const {
|
|
5323
|
+
p: patch,
|
|
5324
|
+
m: move,
|
|
5325
|
+
um: unmount,
|
|
5326
|
+
n: next,
|
|
5327
|
+
o: { parentNode, remove }
|
|
5328
|
+
} = rendererInternals;
|
|
5329
|
+
let parentSuspenseId;
|
|
5330
|
+
const isSuspensible = isVNodeSuspensible(vnode);
|
|
5331
|
+
if (isSuspensible) {
|
|
5332
|
+
if (parentSuspense && parentSuspense.pendingBranch) {
|
|
5333
|
+
parentSuspenseId = parentSuspense.pendingId;
|
|
5334
|
+
parentSuspense.deps++;
|
|
5331
5335
|
}
|
|
5332
|
-
} else {
|
|
5333
|
-
return targetSelector;
|
|
5334
5336
|
}
|
|
5335
|
-
|
|
5336
|
-
const
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5340
|
-
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
const
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5337
|
+
const timeout = vnode.props ? shared.toNumber(vnode.props.timeout) : void 0;
|
|
5338
|
+
const initialAnchor = anchor;
|
|
5339
|
+
const suspense = {
|
|
5340
|
+
vnode,
|
|
5341
|
+
parent: parentSuspense,
|
|
5342
|
+
parentComponent,
|
|
5343
|
+
namespace,
|
|
5344
|
+
container,
|
|
5345
|
+
hiddenContainer,
|
|
5346
|
+
deps: 0,
|
|
5347
|
+
pendingId: suspenseId++,
|
|
5348
|
+
timeout: typeof timeout === "number" ? timeout : -1,
|
|
5349
|
+
activeBranch: null,
|
|
5350
|
+
pendingBranch: null,
|
|
5351
|
+
isInFallback: !isHydrating,
|
|
5352
|
+
isHydrating,
|
|
5353
|
+
isUnmounted: false,
|
|
5354
|
+
effects: [],
|
|
5355
|
+
resolve(resume = false, sync = false) {
|
|
5356
|
+
const {
|
|
5357
|
+
vnode: vnode2,
|
|
5358
|
+
activeBranch,
|
|
5359
|
+
pendingBranch,
|
|
5360
|
+
pendingId,
|
|
5361
|
+
effects,
|
|
5362
|
+
parentComponent: parentComponent2,
|
|
5363
|
+
container: container2
|
|
5364
|
+
} = suspense;
|
|
5365
|
+
let delayEnter = false;
|
|
5366
|
+
if (suspense.isHydrating) {
|
|
5367
|
+
suspense.isHydrating = false;
|
|
5368
|
+
} else if (!resume) {
|
|
5369
|
+
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
5370
|
+
if (delayEnter) {
|
|
5371
|
+
activeBranch.transition.afterLeave = () => {
|
|
5372
|
+
if (pendingId === suspense.pendingId) {
|
|
5373
|
+
move(
|
|
5374
|
+
pendingBranch,
|
|
5375
|
+
container2,
|
|
5376
|
+
anchor === initialAnchor ? next(activeBranch) : anchor,
|
|
5377
|
+
0
|
|
5378
|
+
);
|
|
5379
|
+
queuePostFlushCb(effects);
|
|
5380
|
+
}
|
|
5381
|
+
};
|
|
5382
|
+
}
|
|
5383
|
+
if (activeBranch) {
|
|
5384
|
+
if (parentNode(activeBranch.el) !== suspense.hiddenContainer) {
|
|
5385
|
+
anchor = next(activeBranch);
|
|
5386
|
+
}
|
|
5387
|
+
unmount(activeBranch, parentComponent2, suspense, true);
|
|
5388
|
+
}
|
|
5389
|
+
if (!delayEnter) {
|
|
5390
|
+
move(pendingBranch, container2, anchor, 0);
|
|
5361
5391
|
}
|
|
5362
5392
|
}
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5367
|
-
|
|
5368
|
-
|
|
5369
|
-
|
|
5370
|
-
|
|
5371
|
-
|
|
5372
|
-
|
|
5373
|
-
optimized
|
|
5374
|
-
);
|
|
5393
|
+
setActiveBranch(suspense, pendingBranch);
|
|
5394
|
+
suspense.pendingBranch = null;
|
|
5395
|
+
suspense.isInFallback = false;
|
|
5396
|
+
let parent = suspense.parent;
|
|
5397
|
+
let hasUnresolvedAncestor = false;
|
|
5398
|
+
while (parent) {
|
|
5399
|
+
if (parent.pendingBranch) {
|
|
5400
|
+
parent.effects.push(...effects);
|
|
5401
|
+
hasUnresolvedAncestor = true;
|
|
5402
|
+
break;
|
|
5375
5403
|
}
|
|
5376
|
-
|
|
5377
|
-
if (disabled) {
|
|
5378
|
-
mount(container, mainAnchor);
|
|
5379
|
-
} else if (target) {
|
|
5380
|
-
mount(target, targetAnchor);
|
|
5404
|
+
parent = parent.parent;
|
|
5381
5405
|
}
|
|
5382
|
-
|
|
5383
|
-
|
|
5384
|
-
const mainAnchor = n2.anchor = n1.anchor;
|
|
5385
|
-
const target = n2.target = n1.target;
|
|
5386
|
-
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
5387
|
-
const wasDisabled = isTeleportDisabled(n1.props);
|
|
5388
|
-
const currentContainer = wasDisabled ? container : target;
|
|
5389
|
-
const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
|
5390
|
-
if (namespace === "svg" || isTargetSVG(target)) {
|
|
5391
|
-
namespace = "svg";
|
|
5392
|
-
} else if (namespace === "mathml" || isTargetMathML(target)) {
|
|
5393
|
-
namespace = "mathml";
|
|
5406
|
+
if (!hasUnresolvedAncestor && !delayEnter) {
|
|
5407
|
+
queuePostFlushCb(effects);
|
|
5394
5408
|
}
|
|
5395
|
-
|
|
5396
|
-
|
|
5397
|
-
|
|
5398
|
-
|
|
5399
|
-
|
|
5400
|
-
|
|
5401
|
-
|
|
5402
|
-
|
|
5403
|
-
|
|
5404
|
-
|
|
5405
|
-
|
|
5406
|
-
|
|
5407
|
-
|
|
5408
|
-
|
|
5409
|
-
|
|
5410
|
-
|
|
5411
|
-
|
|
5412
|
-
|
|
5413
|
-
|
|
5414
|
-
|
|
5409
|
+
suspense.effects = [];
|
|
5410
|
+
if (isSuspensible) {
|
|
5411
|
+
if (parentSuspense && parentSuspense.pendingBranch && parentSuspenseId === parentSuspense.pendingId) {
|
|
5412
|
+
parentSuspense.deps--;
|
|
5413
|
+
if (parentSuspense.deps === 0 && !sync) {
|
|
5414
|
+
parentSuspense.resolve();
|
|
5415
|
+
}
|
|
5416
|
+
}
|
|
5417
|
+
}
|
|
5418
|
+
triggerEvent(vnode2, "onResolve");
|
|
5419
|
+
},
|
|
5420
|
+
fallback(fallbackVNode) {
|
|
5421
|
+
if (!suspense.pendingBranch) {
|
|
5422
|
+
return;
|
|
5423
|
+
}
|
|
5424
|
+
const { vnode: vnode2, activeBranch, parentComponent: parentComponent2, container: container2, namespace: namespace2 } = suspense;
|
|
5425
|
+
triggerEvent(vnode2, "onFallback");
|
|
5426
|
+
const anchor2 = next(activeBranch);
|
|
5427
|
+
const mountFallback = () => {
|
|
5428
|
+
if (!suspense.isInFallback) {
|
|
5429
|
+
return;
|
|
5430
|
+
}
|
|
5431
|
+
patch(
|
|
5432
|
+
null,
|
|
5433
|
+
fallbackVNode,
|
|
5434
|
+
container2,
|
|
5435
|
+
anchor2,
|
|
5436
|
+
parentComponent2,
|
|
5437
|
+
null,
|
|
5438
|
+
// fallback tree will not have suspense context
|
|
5439
|
+
namespace2,
|
|
5415
5440
|
slotScopeIds,
|
|
5416
|
-
|
|
5441
|
+
optimized
|
|
5417
5442
|
);
|
|
5443
|
+
setActiveBranch(suspense, fallbackVNode);
|
|
5444
|
+
};
|
|
5445
|
+
const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
|
5446
|
+
if (delayEnter) {
|
|
5447
|
+
activeBranch.transition.afterLeave = mountFallback;
|
|
5418
5448
|
}
|
|
5419
|
-
|
|
5420
|
-
|
|
5421
|
-
|
|
5422
|
-
|
|
5423
|
-
|
|
5424
|
-
|
|
5425
|
-
|
|
5426
|
-
|
|
5427
|
-
|
|
5428
|
-
|
|
5429
|
-
|
|
5430
|
-
|
|
5431
|
-
|
|
5449
|
+
suspense.isInFallback = true;
|
|
5450
|
+
unmount(
|
|
5451
|
+
activeBranch,
|
|
5452
|
+
parentComponent2,
|
|
5453
|
+
null,
|
|
5454
|
+
// no suspense so unmount hooks fire now
|
|
5455
|
+
true
|
|
5456
|
+
// shouldRemove
|
|
5457
|
+
);
|
|
5458
|
+
if (!delayEnter) {
|
|
5459
|
+
mountFallback();
|
|
5460
|
+
}
|
|
5461
|
+
},
|
|
5462
|
+
move(container2, anchor2, type) {
|
|
5463
|
+
suspense.activeBranch && move(suspense.activeBranch, container2, anchor2, type);
|
|
5464
|
+
suspense.container = container2;
|
|
5465
|
+
},
|
|
5466
|
+
next() {
|
|
5467
|
+
return suspense.activeBranch && next(suspense.activeBranch);
|
|
5468
|
+
},
|
|
5469
|
+
registerDep(instance, setupRenderEffect, optimized2) {
|
|
5470
|
+
const isInPendingSuspense = !!suspense.pendingBranch;
|
|
5471
|
+
if (isInPendingSuspense) {
|
|
5472
|
+
suspense.deps++;
|
|
5473
|
+
}
|
|
5474
|
+
const hydratedEl = instance.vnode.el;
|
|
5475
|
+
instance.asyncDep.catch((err) => {
|
|
5476
|
+
handleError(err, instance, 0);
|
|
5477
|
+
}).then((asyncSetupResult) => {
|
|
5478
|
+
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) {
|
|
5479
|
+
return;
|
|
5432
5480
|
}
|
|
5433
|
-
|
|
5434
|
-
|
|
5435
|
-
|
|
5436
|
-
|
|
5437
|
-
|
|
5438
|
-
);
|
|
5439
|
-
if (nextTarget) {
|
|
5440
|
-
moveTeleport(
|
|
5441
|
-
n2,
|
|
5442
|
-
nextTarget,
|
|
5443
|
-
null,
|
|
5444
|
-
internals,
|
|
5445
|
-
0
|
|
5446
|
-
);
|
|
5447
|
-
}
|
|
5448
|
-
} else if (wasDisabled) {
|
|
5449
|
-
moveTeleport(
|
|
5450
|
-
n2,
|
|
5451
|
-
target,
|
|
5452
|
-
targetAnchor,
|
|
5453
|
-
internals,
|
|
5454
|
-
1
|
|
5455
|
-
);
|
|
5481
|
+
instance.asyncResolved = true;
|
|
5482
|
+
const { vnode: vnode2 } = instance;
|
|
5483
|
+
handleSetupResult(instance, asyncSetupResult, false);
|
|
5484
|
+
if (hydratedEl) {
|
|
5485
|
+
vnode2.el = hydratedEl;
|
|
5456
5486
|
}
|
|
5457
|
-
|
|
5458
|
-
|
|
5459
|
-
|
|
5460
|
-
|
|
5461
|
-
|
|
5462
|
-
|
|
5463
|
-
|
|
5464
|
-
|
|
5465
|
-
|
|
5466
|
-
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
|
|
5487
|
+
const placeholder = !hydratedEl && instance.subTree.el;
|
|
5488
|
+
setupRenderEffect(
|
|
5489
|
+
instance,
|
|
5490
|
+
vnode2,
|
|
5491
|
+
// component may have been moved before resolve.
|
|
5492
|
+
// if this is not a hydration, instance.subTree will be the comment
|
|
5493
|
+
// placeholder.
|
|
5494
|
+
parentNode(hydratedEl || instance.subTree.el),
|
|
5495
|
+
// anchor will not be used if this is hydration, so only need to
|
|
5496
|
+
// consider the comment placeholder case.
|
|
5497
|
+
hydratedEl ? null : next(instance.subTree),
|
|
5498
|
+
suspense,
|
|
5499
|
+
namespace,
|
|
5500
|
+
optimized2
|
|
5501
|
+
);
|
|
5502
|
+
if (placeholder) {
|
|
5503
|
+
remove(placeholder);
|
|
5504
|
+
}
|
|
5505
|
+
updateHOCHostEl(instance, vnode2.el);
|
|
5506
|
+
if (isInPendingSuspense && --suspense.deps === 0) {
|
|
5507
|
+
suspense.resolve();
|
|
5508
|
+
}
|
|
5509
|
+
});
|
|
5510
|
+
},
|
|
5511
|
+
unmount(parentSuspense2, doRemove) {
|
|
5512
|
+
suspense.isUnmounted = true;
|
|
5513
|
+
if (suspense.activeBranch) {
|
|
5471
5514
|
unmount(
|
|
5472
|
-
|
|
5515
|
+
suspense.activeBranch,
|
|
5473
5516
|
parentComponent,
|
|
5474
|
-
|
|
5475
|
-
|
|
5476
|
-
!!child.dynamicChildren
|
|
5517
|
+
parentSuspense2,
|
|
5518
|
+
doRemove
|
|
5477
5519
|
);
|
|
5478
5520
|
}
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
if (moveType === 0) {
|
|
5486
|
-
insert(vnode.targetAnchor, container, parentAnchor);
|
|
5487
|
-
}
|
|
5488
|
-
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
5489
|
-
const isReorder = moveType === 2;
|
|
5490
|
-
if (isReorder) {
|
|
5491
|
-
insert(el, container, parentAnchor);
|
|
5492
|
-
}
|
|
5493
|
-
if (!isReorder || isTeleportDisabled(props)) {
|
|
5494
|
-
if (shapeFlag & 16) {
|
|
5495
|
-
for (let i = 0; i < children.length; i++) {
|
|
5496
|
-
move(
|
|
5497
|
-
children[i],
|
|
5498
|
-
container,
|
|
5499
|
-
parentAnchor,
|
|
5500
|
-
2
|
|
5521
|
+
if (suspense.pendingBranch) {
|
|
5522
|
+
unmount(
|
|
5523
|
+
suspense.pendingBranch,
|
|
5524
|
+
parentComponent,
|
|
5525
|
+
parentSuspense2,
|
|
5526
|
+
doRemove
|
|
5501
5527
|
);
|
|
5502
5528
|
}
|
|
5503
5529
|
}
|
|
5530
|
+
};
|
|
5531
|
+
return suspense;
|
|
5532
|
+
}
|
|
5533
|
+
function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, rendererInternals, hydrateNode) {
|
|
5534
|
+
const suspense = vnode.suspense = createSuspenseBoundary(
|
|
5535
|
+
vnode,
|
|
5536
|
+
parentSuspense,
|
|
5537
|
+
parentComponent,
|
|
5538
|
+
node.parentNode,
|
|
5539
|
+
// eslint-disable-next-line no-restricted-globals
|
|
5540
|
+
document.createElement("div"),
|
|
5541
|
+
null,
|
|
5542
|
+
namespace,
|
|
5543
|
+
slotScopeIds,
|
|
5544
|
+
optimized,
|
|
5545
|
+
rendererInternals,
|
|
5546
|
+
true
|
|
5547
|
+
);
|
|
5548
|
+
const result = hydrateNode(
|
|
5549
|
+
node,
|
|
5550
|
+
suspense.pendingBranch = vnode.ssContent,
|
|
5551
|
+
parentComponent,
|
|
5552
|
+
suspense,
|
|
5553
|
+
slotScopeIds,
|
|
5554
|
+
optimized
|
|
5555
|
+
);
|
|
5556
|
+
if (suspense.deps === 0) {
|
|
5557
|
+
suspense.resolve(false, true);
|
|
5504
5558
|
}
|
|
5505
|
-
|
|
5506
|
-
insert(anchor, container, parentAnchor);
|
|
5507
|
-
}
|
|
5559
|
+
return result;
|
|
5508
5560
|
}
|
|
5509
|
-
function
|
|
5510
|
-
|
|
5511
|
-
|
|
5512
|
-
|
|
5513
|
-
|
|
5514
|
-
querySelector
|
|
5561
|
+
function normalizeSuspenseChildren(vnode) {
|
|
5562
|
+
const { shapeFlag, children } = vnode;
|
|
5563
|
+
const isSlotChildren = shapeFlag & 32;
|
|
5564
|
+
vnode.ssContent = normalizeSuspenseSlot(
|
|
5565
|
+
isSlotChildren ? children.default : children
|
|
5515
5566
|
);
|
|
5516
|
-
|
|
5517
|
-
|
|
5518
|
-
|
|
5519
|
-
|
|
5520
|
-
|
|
5521
|
-
|
|
5522
|
-
|
|
5523
|
-
|
|
5524
|
-
|
|
5525
|
-
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
|
|
5530
|
-
|
|
5531
|
-
vnode.anchor = nextSibling(node);
|
|
5532
|
-
let targetAnchor = targetNode;
|
|
5533
|
-
while (targetAnchor) {
|
|
5534
|
-
targetAnchor = nextSibling(targetAnchor);
|
|
5535
|
-
if (targetAnchor && targetAnchor.nodeType === 8 && targetAnchor.data === "teleport anchor") {
|
|
5536
|
-
vnode.targetAnchor = targetAnchor;
|
|
5537
|
-
target._lpa = vnode.targetAnchor && nextSibling(vnode.targetAnchor);
|
|
5538
|
-
break;
|
|
5539
|
-
}
|
|
5540
|
-
}
|
|
5541
|
-
hydrateChildren(
|
|
5542
|
-
targetNode,
|
|
5543
|
-
vnode,
|
|
5544
|
-
target,
|
|
5545
|
-
parentComponent,
|
|
5546
|
-
parentSuspense,
|
|
5547
|
-
slotScopeIds,
|
|
5548
|
-
optimized
|
|
5549
|
-
);
|
|
5550
|
-
}
|
|
5567
|
+
vnode.ssFallback = isSlotChildren ? normalizeSuspenseSlot(children.fallback) : createVNode(Comment);
|
|
5568
|
+
}
|
|
5569
|
+
function normalizeSuspenseSlot(s) {
|
|
5570
|
+
let block;
|
|
5571
|
+
if (shared.isFunction(s)) {
|
|
5572
|
+
const trackBlock = isBlockTreeEnabled && s._c;
|
|
5573
|
+
if (trackBlock) {
|
|
5574
|
+
s._d = false;
|
|
5575
|
+
openBlock();
|
|
5576
|
+
}
|
|
5577
|
+
s = s();
|
|
5578
|
+
if (trackBlock) {
|
|
5579
|
+
s._d = true;
|
|
5580
|
+
block = currentBlock;
|
|
5581
|
+
closeBlock();
|
|
5551
5582
|
}
|
|
5552
|
-
updateCssVars(vnode);
|
|
5553
5583
|
}
|
|
5554
|
-
|
|
5584
|
+
if (shared.isArray(s)) {
|
|
5585
|
+
const singleChild = filterSingleRoot(s);
|
|
5586
|
+
s = singleChild;
|
|
5587
|
+
}
|
|
5588
|
+
s = normalizeVNode(s);
|
|
5589
|
+
if (block && !s.dynamicChildren) {
|
|
5590
|
+
s.dynamicChildren = block.filter((c) => c !== s);
|
|
5591
|
+
}
|
|
5592
|
+
return s;
|
|
5555
5593
|
}
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
if (node.nodeType === 1) node.setAttribute("data-v-owner", ctx.uid);
|
|
5563
|
-
node = node.nextSibling;
|
|
5594
|
+
function queueEffectWithSuspense(fn, suspense) {
|
|
5595
|
+
if (suspense && suspense.pendingBranch) {
|
|
5596
|
+
if (shared.isArray(fn)) {
|
|
5597
|
+
suspense.effects.push(...fn);
|
|
5598
|
+
} else {
|
|
5599
|
+
suspense.effects.push(fn);
|
|
5564
5600
|
}
|
|
5565
|
-
|
|
5601
|
+
} else {
|
|
5602
|
+
queuePostFlushCb(fn);
|
|
5603
|
+
}
|
|
5604
|
+
}
|
|
5605
|
+
function setActiveBranch(suspense, branch) {
|
|
5606
|
+
suspense.activeBranch = branch;
|
|
5607
|
+
const { vnode, parentComponent } = suspense;
|
|
5608
|
+
let el = branch.el;
|
|
5609
|
+
while (!el && branch.component) {
|
|
5610
|
+
branch = branch.component.subTree;
|
|
5611
|
+
el = branch.el;
|
|
5612
|
+
}
|
|
5613
|
+
vnode.el = el;
|
|
5614
|
+
if (parentComponent && parentComponent.subTree === vnode) {
|
|
5615
|
+
parentComponent.vnode.el = el;
|
|
5616
|
+
updateHOCHostEl(parentComponent, el);
|
|
5566
5617
|
}
|
|
5567
5618
|
}
|
|
5619
|
+
function isVNodeSuspensible(vnode) {
|
|
5620
|
+
const suspensible = vnode.props && vnode.props.suspensible;
|
|
5621
|
+
return suspensible != null && suspensible !== false;
|
|
5622
|
+
}
|
|
5568
5623
|
|
|
5569
5624
|
const Fragment = Symbol.for("v-fgt");
|
|
5570
5625
|
const Text = Symbol.for("v-txt");
|
|
@@ -5582,6 +5637,9 @@ function closeBlock() {
|
|
|
5582
5637
|
let isBlockTreeEnabled = 1;
|
|
5583
5638
|
function setBlockTracking(value) {
|
|
5584
5639
|
isBlockTreeEnabled += value;
|
|
5640
|
+
if (value < 0 && currentBlock) {
|
|
5641
|
+
currentBlock.hasOnce = true;
|
|
5642
|
+
}
|
|
5585
5643
|
}
|
|
5586
5644
|
function setupBlock(vnode) {
|
|
5587
5645
|
vnode.dynamicChildren = isBlockTreeEnabled > 0 ? currentBlock || shared.EMPTY_ARR : null;
|
|
@@ -5655,6 +5713,7 @@ function createBaseVNode(type, props = null, children = null, patchFlag = 0, dyn
|
|
|
5655
5713
|
el: null,
|
|
5656
5714
|
anchor: null,
|
|
5657
5715
|
target: null,
|
|
5716
|
+
targetStart: null,
|
|
5658
5717
|
targetAnchor: null,
|
|
5659
5718
|
staticCount: 0,
|
|
5660
5719
|
shapeFlag,
|
|
@@ -5761,6 +5820,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
5761
5820
|
slotScopeIds: vnode.slotScopeIds,
|
|
5762
5821
|
children: children,
|
|
5763
5822
|
target: vnode.target,
|
|
5823
|
+
targetStart: vnode.targetStart,
|
|
5764
5824
|
targetAnchor: vnode.targetAnchor,
|
|
5765
5825
|
staticCount: vnode.staticCount,
|
|
5766
5826
|
shapeFlag: vnode.shapeFlag,
|
|
@@ -5955,8 +6015,6 @@ function createComponentInstance(vnode, parent, suspense) {
|
|
|
5955
6015
|
refs: shared.EMPTY_OBJ,
|
|
5956
6016
|
setupState: shared.EMPTY_OBJ,
|
|
5957
6017
|
setupContext: null,
|
|
5958
|
-
attrsProxy: null,
|
|
5959
|
-
slotsProxy: null,
|
|
5960
6018
|
// suspense related
|
|
5961
6019
|
suspense,
|
|
5962
6020
|
suspenseId: suspense ? suspense.pendingId : 0,
|
|
@@ -6033,12 +6091,12 @@ function isStatefulComponent(instance) {
|
|
|
6033
6091
|
return instance.vnode.shapeFlag & 4;
|
|
6034
6092
|
}
|
|
6035
6093
|
let isInSSRComponentSetup = false;
|
|
6036
|
-
function setupComponent(instance, isSSR = false) {
|
|
6094
|
+
function setupComponent(instance, isSSR = false, optimized = false) {
|
|
6037
6095
|
isSSR && setInSSRSetupState(isSSR);
|
|
6038
6096
|
const { props, children } = instance.vnode;
|
|
6039
6097
|
const isStateful = isStatefulComponent(instance);
|
|
6040
6098
|
initProps(instance, props, isStateful, isSSR);
|
|
6041
|
-
initSlots(instance, children);
|
|
6099
|
+
initSlots(instance, children, optimized);
|
|
6042
6100
|
const setupResult = isStateful ? setupStatefulComponent(instance, isSSR) : void 0;
|
|
6043
6101
|
isSSR && setInSSRSetupState(false);
|
|
6044
6102
|
return setupResult;
|
|
@@ -6190,51 +6248,6 @@ const computed = (getterOrOptions, debugOptions) => {
|
|
|
6190
6248
|
return c;
|
|
6191
6249
|
};
|
|
6192
6250
|
|
|
6193
|
-
function useModel(props, name, options = shared.EMPTY_OBJ) {
|
|
6194
|
-
const i = getCurrentInstance();
|
|
6195
|
-
const camelizedName = shared.camelize(name);
|
|
6196
|
-
const hyphenatedName = shared.hyphenate(name);
|
|
6197
|
-
const res = reactivity.customRef((track, trigger) => {
|
|
6198
|
-
let localValue;
|
|
6199
|
-
watchSyncEffect(() => {
|
|
6200
|
-
const propValue = props[name];
|
|
6201
|
-
if (shared.hasChanged(localValue, propValue)) {
|
|
6202
|
-
localValue = propValue;
|
|
6203
|
-
trigger();
|
|
6204
|
-
}
|
|
6205
|
-
});
|
|
6206
|
-
return {
|
|
6207
|
-
get() {
|
|
6208
|
-
track();
|
|
6209
|
-
return options.get ? options.get(localValue) : localValue;
|
|
6210
|
-
},
|
|
6211
|
-
set(value) {
|
|
6212
|
-
const rawProps = i.vnode.props;
|
|
6213
|
-
if (!(rawProps && // check if parent has passed v-model
|
|
6214
|
-
(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)) {
|
|
6215
|
-
localValue = value;
|
|
6216
|
-
trigger();
|
|
6217
|
-
}
|
|
6218
|
-
i.emit(`update:${name}`, options.set ? options.set(value) : value);
|
|
6219
|
-
}
|
|
6220
|
-
};
|
|
6221
|
-
});
|
|
6222
|
-
const modifierKey = name === "modelValue" ? "modelModifiers" : `${name}Modifiers`;
|
|
6223
|
-
res[Symbol.iterator] = () => {
|
|
6224
|
-
let i2 = 0;
|
|
6225
|
-
return {
|
|
6226
|
-
next() {
|
|
6227
|
-
if (i2 < 2) {
|
|
6228
|
-
return { value: i2++ ? props[modifierKey] || {} : res, done: false };
|
|
6229
|
-
} else {
|
|
6230
|
-
return { done: true };
|
|
6231
|
-
}
|
|
6232
|
-
}
|
|
6233
|
-
};
|
|
6234
|
-
};
|
|
6235
|
-
return res;
|
|
6236
|
-
}
|
|
6237
|
-
|
|
6238
6251
|
function h(type, propsOrChildren, children) {
|
|
6239
6252
|
const l = arguments.length;
|
|
6240
6253
|
if (l === 2) {
|
|
@@ -6269,7 +6282,7 @@ function withMemo(memo, render, cache, index) {
|
|
|
6269
6282
|
}
|
|
6270
6283
|
const ret = render();
|
|
6271
6284
|
ret.memo = memo.slice();
|
|
6272
|
-
ret.
|
|
6285
|
+
ret.cacheIndex = index;
|
|
6273
6286
|
return cache[index] = ret;
|
|
6274
6287
|
}
|
|
6275
6288
|
function isMemoSame(cached, memo) {
|
|
@@ -6288,7 +6301,7 @@ function isMemoSame(cached, memo) {
|
|
|
6288
6301
|
return true;
|
|
6289
6302
|
}
|
|
6290
6303
|
|
|
6291
|
-
const version = "3.4.
|
|
6304
|
+
const version = "3.4.33";
|
|
6292
6305
|
const warn$1 = shared.NOOP;
|
|
6293
6306
|
const ErrorTypeStrings = ErrorTypeStrings$1 ;
|
|
6294
6307
|
const devtools = void 0;
|