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