@vue/runtime-core 3.6.0-beta.9 → 3.6.0-rc.2
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 +346 -161
- package/dist/runtime-core.cjs.prod.js +276 -115
- package/dist/runtime-core.d.ts +19 -13
- package/dist/runtime-core.esm-bundler.js +351 -165
- package/package.json +3 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-core v3.6.0-
|
|
2
|
+
* @vue/runtime-core v3.6.0-rc.2
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -169,8 +169,8 @@ function findInsertionIndex(order, queue, start, end) {
|
|
|
169
169
|
/**
|
|
170
170
|
* @internal for runtime-vapor only
|
|
171
171
|
*/
|
|
172
|
-
function queueJob(job, id, isPre = false) {
|
|
173
|
-
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
172
|
+
function queueJob(job, id, isPre = false, order = 0) {
|
|
173
|
+
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : order ? id * 2 + 1 + order / (order + 1) : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
174
174
|
jobsLength++;
|
|
175
175
|
queueFlush();
|
|
176
176
|
}
|
|
@@ -273,6 +273,7 @@ function flushJobs(seen) {
|
|
|
273
273
|
}
|
|
274
274
|
flushIndex = 0;
|
|
275
275
|
jobsLength = 0;
|
|
276
|
+
jobs.length = 0;
|
|
276
277
|
flushPostFlushCbs(seen);
|
|
277
278
|
currentFlushPromise = null;
|
|
278
279
|
if (jobsLength || postJobs.length) flushJobs(seen);
|
|
@@ -332,10 +333,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
|
332
333
|
const renderFnWithContext = (...args) => {
|
|
333
334
|
if (renderFnWithContext._d) setBlockTracking(-1);
|
|
334
335
|
const prevInstance = setCurrentRenderingInstance(ctx);
|
|
336
|
+
const prevStackSize = blockStack.length;
|
|
335
337
|
let res;
|
|
336
338
|
try {
|
|
337
339
|
res = fn(...args);
|
|
338
340
|
} finally {
|
|
341
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
339
342
|
setCurrentRenderingInstance(prevInstance);
|
|
340
343
|
if (renderFnWithContext._d) setBlockTracking(1);
|
|
341
344
|
}
|
|
@@ -512,7 +515,7 @@ function instanceWatch(source, value, options) {
|
|
|
512
515
|
}
|
|
513
516
|
const prev = setCurrentInstance(this);
|
|
514
517
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
515
|
-
|
|
518
|
+
restoreCurrentInstance(prev);
|
|
516
519
|
return res;
|
|
517
520
|
}
|
|
518
521
|
function createPathGetter(ctx, path) {
|
|
@@ -525,6 +528,7 @@ function createPathGetter(ctx, path) {
|
|
|
525
528
|
}
|
|
526
529
|
//#endregion
|
|
527
530
|
//#region packages/runtime-core/src/components/Teleport.ts
|
|
531
|
+
const pendingMounts = /* @__PURE__ */ new WeakMap();
|
|
528
532
|
const TeleportEndKey = Symbol("_vte");
|
|
529
533
|
const isTeleport = (type) => type.__isTeleport;
|
|
530
534
|
const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
|
@@ -541,54 +545,66 @@ const TeleportImpl = {
|
|
|
541
545
|
name: "Teleport",
|
|
542
546
|
__isTeleport: true,
|
|
543
547
|
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
|
544
|
-
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
|
|
548
|
+
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
|
|
545
549
|
const disabled = isTeleportDisabled(n2.props);
|
|
546
|
-
let {
|
|
550
|
+
let { dynamicChildren } = n2;
|
|
551
|
+
const mount = (vnode, container, anchor) => {
|
|
552
|
+
if (vnode.shapeFlag & 16) mountChildren(vnode.children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
553
|
+
};
|
|
554
|
+
const mountToTarget = (vnode = n2) => {
|
|
555
|
+
const disabled = isTeleportDisabled(vnode.props);
|
|
556
|
+
const target = vnode.target = resolveTarget(vnode.props, querySelector);
|
|
557
|
+
const targetAnchor = prepareAnchor(target, vnode, createText, insert);
|
|
558
|
+
if (target) {
|
|
559
|
+
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
560
|
+
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
561
|
+
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
562
|
+
if (!disabled) {
|
|
563
|
+
mount(vnode, target, targetAnchor);
|
|
564
|
+
updateCssVars(vnode, false);
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
};
|
|
568
|
+
const queuePendingMount = (vnode) => {
|
|
569
|
+
const mountJob = () => {
|
|
570
|
+
if (pendingMounts.get(vnode) !== mountJob) return;
|
|
571
|
+
pendingMounts.delete(vnode);
|
|
572
|
+
if (isTeleportDisabled(vnode.props)) {
|
|
573
|
+
mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
|
|
574
|
+
updateCssVars(vnode, true);
|
|
575
|
+
}
|
|
576
|
+
mountToTarget(vnode);
|
|
577
|
+
};
|
|
578
|
+
pendingMounts.set(vnode, mountJob);
|
|
579
|
+
queuePostRenderEffect(mountJob, void 0, parentSuspense);
|
|
580
|
+
};
|
|
547
581
|
if (n1 == null) {
|
|
548
582
|
const placeholder = n2.el = createText("");
|
|
549
583
|
const mainAnchor = n2.anchor = createText("");
|
|
550
584
|
insert(placeholder, container, anchor);
|
|
551
585
|
insert(mainAnchor, container, anchor);
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
const target = n2.target = resolveTarget(n2.props, querySelector);
|
|
557
|
-
const targetAnchor = prepareAnchor(target, n2, createText, insert);
|
|
558
|
-
if (target) {
|
|
559
|
-
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
560
|
-
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
561
|
-
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
562
|
-
if (!disabled) {
|
|
563
|
-
mount(target, targetAnchor);
|
|
564
|
-
updateCssVars(n2, false);
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
};
|
|
586
|
+
if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
|
|
587
|
+
queuePendingMount(n2);
|
|
588
|
+
return;
|
|
589
|
+
}
|
|
568
590
|
if (disabled) {
|
|
569
|
-
mount(container, mainAnchor);
|
|
591
|
+
mount(n2, container, mainAnchor);
|
|
570
592
|
updateCssVars(n2, true);
|
|
571
593
|
}
|
|
572
|
-
|
|
573
|
-
n2.el.__isMounted = false;
|
|
574
|
-
queuePostRenderEffect(() => {
|
|
575
|
-
if (n2.el.__isMounted !== false) return;
|
|
576
|
-
mountToTarget();
|
|
577
|
-
delete n2.el.__isMounted;
|
|
578
|
-
}, void 0, parentSuspense);
|
|
579
|
-
} else mountToTarget();
|
|
594
|
+
mountToTarget();
|
|
580
595
|
} else {
|
|
581
596
|
n2.el = n1.el;
|
|
582
|
-
n2.targetStart = n1.targetStart;
|
|
583
597
|
const mainAnchor = n2.anchor = n1.anchor;
|
|
584
|
-
const
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
}, void 0, parentSuspense);
|
|
598
|
+
const pendingMount = pendingMounts.get(n1);
|
|
599
|
+
if (pendingMount) {
|
|
600
|
+
pendingMount.flags |= 4;
|
|
601
|
+
pendingMounts.delete(n1);
|
|
602
|
+
queuePendingMount(n2);
|
|
590
603
|
return;
|
|
591
604
|
}
|
|
605
|
+
n2.targetStart = n1.targetStart;
|
|
606
|
+
const target = n2.target = n1.target;
|
|
607
|
+
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
592
608
|
const wasDisabled = isTeleportDisabled(n1.props);
|
|
593
609
|
const currentContainer = wasDisabled ? container : target;
|
|
594
610
|
const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
|
@@ -602,23 +618,30 @@ const TeleportImpl = {
|
|
|
602
618
|
if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
|
|
603
619
|
else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
|
|
604
620
|
} else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
605
|
-
const nextTarget =
|
|
606
|
-
if (nextTarget)
|
|
621
|
+
const nextTarget = resolveTarget(n2.props, querySelector);
|
|
622
|
+
if (nextTarget) {
|
|
623
|
+
n2.target = nextTarget;
|
|
624
|
+
moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
|
|
625
|
+
}
|
|
607
626
|
} else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
|
|
608
627
|
updateCssVars(n2, disabled);
|
|
609
628
|
}
|
|
610
629
|
},
|
|
611
630
|
remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
612
|
-
const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
|
|
631
|
+
const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
|
|
632
|
+
const disabled = isTeleportDisabled(props);
|
|
633
|
+
const shouldRemove = doRemove || !disabled;
|
|
634
|
+
const pendingMount = pendingMounts.get(vnode);
|
|
635
|
+
if (pendingMount) {
|
|
636
|
+
pendingMount.flags |= 4;
|
|
637
|
+
pendingMounts.delete(vnode);
|
|
638
|
+
}
|
|
613
639
|
if (targetStart) hostRemove(targetStart);
|
|
614
640
|
if (targetAnchor) hostRemove(targetAnchor);
|
|
615
641
|
doRemove && hostRemove(anchor);
|
|
616
|
-
if (shapeFlag & 16) {
|
|
617
|
-
const
|
|
618
|
-
|
|
619
|
-
const child = children[i];
|
|
620
|
-
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
621
|
-
}
|
|
642
|
+
if (!pendingMount && (disabled || target) && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
|
|
643
|
+
const child = children[i];
|
|
644
|
+
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
622
645
|
}
|
|
623
646
|
},
|
|
624
647
|
move: moveTeleport,
|
|
@@ -629,7 +652,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
629
652
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
630
653
|
const isReorder = moveType === 2;
|
|
631
654
|
if (isReorder) insert(el, container, parentAnchor);
|
|
632
|
-
if (!isReorder || isTeleportDisabled(props)) {
|
|
655
|
+
if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
|
|
633
656
|
if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
|
|
634
657
|
}
|
|
635
658
|
if (isReorder) insert(anchor, container, parentAnchor);
|
|
@@ -754,8 +777,8 @@ const BaseTransitionImpl = {
|
|
|
754
777
|
const state = useTransitionState();
|
|
755
778
|
return () => {
|
|
756
779
|
const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
|
757
|
-
|
|
758
|
-
|
|
780
|
+
const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
|
|
781
|
+
if (!child) return;
|
|
759
782
|
const rawProps = (0, _vue_reactivity.toRaw)(props);
|
|
760
783
|
const { mode } = rawProps;
|
|
761
784
|
if (state.isLeaving) return emptyPlaceholder(child);
|
|
@@ -931,12 +954,11 @@ function getInnerChild$1(vnode) {
|
|
|
931
954
|
}
|
|
932
955
|
}
|
|
933
956
|
function setTransitionHooks(vnode, hooks) {
|
|
934
|
-
if (vnode.shapeFlag & 6 && vnode.component)
|
|
935
|
-
else {
|
|
957
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
936
958
|
vnode.transition = hooks;
|
|
937
|
-
setTransitionHooks(vnode.component
|
|
938
|
-
|
|
939
|
-
else if (vnode.shapeFlag & 128) {
|
|
959
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
|
|
960
|
+
else setTransitionHooks(vnode.component.subTree, hooks);
|
|
961
|
+
} else if (vnode.shapeFlag & 128) {
|
|
940
962
|
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
941
963
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
942
964
|
} else vnode.transition = hooks;
|
|
@@ -1179,7 +1201,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1179
1201
|
else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1180
1202
|
break;
|
|
1181
1203
|
case VaporSlot:
|
|
1182
|
-
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
|
|
1204
|
+
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
|
|
1183
1205
|
break;
|
|
1184
1206
|
default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
|
|
1185
1207
|
else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -1189,16 +1211,31 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1189
1211
|
if (isFragmentStart) nextNode = locateClosingAnchor(node);
|
|
1190
1212
|
else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
|
1191
1213
|
else nextNode = nextSibling(node);
|
|
1192
|
-
if (vnode.type.__vapor)
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1214
|
+
if (vnode.type.__vapor) {
|
|
1215
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
|
|
1216
|
+
getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
|
|
1217
|
+
if (vnode.dirs) {
|
|
1218
|
+
invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
1219
|
+
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
1220
|
+
}
|
|
1221
|
+
}, () => {
|
|
1222
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
|
|
1223
|
+
});
|
|
1224
|
+
if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
|
|
1225
|
+
const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
|
|
1226
|
+
if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
|
|
1227
|
+
} else {
|
|
1228
|
+
mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
|
|
1229
|
+
const component = vnode.component;
|
|
1230
|
+
if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
|
|
1231
|
+
let subTree;
|
|
1232
|
+
if (isFragmentStart) {
|
|
1233
|
+
subTree = createVNode(Fragment);
|
|
1234
|
+
subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
|
1235
|
+
} else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
|
1236
|
+
subTree.el = node;
|
|
1237
|
+
component.subTree = subTree;
|
|
1238
|
+
}
|
|
1202
1239
|
}
|
|
1203
1240
|
} else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
|
|
1204
1241
|
else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
@@ -1209,9 +1246,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1209
1246
|
};
|
|
1210
1247
|
const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
1211
1248
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
1212
|
-
const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1249
|
+
const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1213
1250
|
const forcePatch = type === "input" || type === "option";
|
|
1214
|
-
|
|
1251
|
+
const hasDynamicProps = !!dynamicProps;
|
|
1252
|
+
if (forcePatch || hasDynamicProps || patchFlag !== -1) {
|
|
1215
1253
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
1216
1254
|
let needCallTransitionHooks = false;
|
|
1217
1255
|
if (isTemplateNode(el)) {
|
|
@@ -1227,8 +1265,8 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1227
1265
|
}
|
|
1228
1266
|
if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
|
|
1229
1267
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1268
|
+
if (next && !isMismatchAllowed(el, 1)) logMismatchError();
|
|
1230
1269
|
while (next) {
|
|
1231
|
-
if (!isMismatchAllowed(el, 1)) logMismatchError();
|
|
1232
1270
|
const cur = next;
|
|
1233
1271
|
next = next.nextSibling;
|
|
1234
1272
|
remove(cur);
|
|
@@ -1243,9 +1281,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1243
1281
|
}
|
|
1244
1282
|
}
|
|
1245
1283
|
if (props) {
|
|
1246
|
-
if (forcePatch || !optimized || patchFlag & 48) {
|
|
1284
|
+
if (forcePatch || hasDynamicProps || !optimized || patchFlag & 48) {
|
|
1247
1285
|
const isCustomElement = el.tagName.includes("-");
|
|
1248
|
-
|
|
1286
|
+
const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
|
|
1287
|
+
for (const key in props) if (forcePatch && (key.endsWith("value") || key === "indeterminate") || (0, _vue_shared.isOn)(key) && !(0, _vue_shared.isReservedProp)(key) || key[0] === "." || isCustomElement && !(0, _vue_shared.isReservedProp)(key) || dynamicProps && dynamicProps.includes(key)) patchProp(el, key, null, props[key], namespace, parentComponent);
|
|
1249
1288
|
} else if (props.onClick) patchProp(el, "onClick", null, props.onClick, void 0, parentComponent);
|
|
1250
1289
|
else if (patchFlag & 4 && (0, _vue_reactivity.isReactive)(props.style)) for (const key in props.style) props.style[key];
|
|
1251
1290
|
}
|
|
@@ -1264,6 +1303,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1264
1303
|
optimized = optimized || !!parentVNode.dynamicChildren;
|
|
1265
1304
|
const children = parentVNode.children;
|
|
1266
1305
|
const l = children.length;
|
|
1306
|
+
let hasCheckedMismatch = false;
|
|
1267
1307
|
for (let i = 0; i < l; i++) {
|
|
1268
1308
|
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
1269
1309
|
const isText = vnode.type === Text;
|
|
@@ -1277,7 +1317,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1277
1317
|
node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1278
1318
|
} else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
|
|
1279
1319
|
else {
|
|
1280
|
-
if (!
|
|
1320
|
+
if (!hasCheckedMismatch) {
|
|
1321
|
+
hasCheckedMismatch = true;
|
|
1322
|
+
if (!isMismatchAllowed(container, 1)) logMismatchError();
|
|
1323
|
+
}
|
|
1281
1324
|
patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
|
|
1282
1325
|
}
|
|
1283
1326
|
}
|
|
@@ -1296,7 +1339,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1296
1339
|
}
|
|
1297
1340
|
};
|
|
1298
1341
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
1299
|
-
if (!
|
|
1342
|
+
if (!isNodeMismatchAllowed(node, vnode)) logMismatchError();
|
|
1300
1343
|
vnode.el = null;
|
|
1301
1344
|
if (isFragment) {
|
|
1302
1345
|
const end = locateClosingAnchor(node);
|
|
@@ -1352,7 +1395,9 @@ const MismatchTypeString = {
|
|
|
1352
1395
|
};
|
|
1353
1396
|
function isMismatchAllowed(el, allowedType) {
|
|
1354
1397
|
if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
|
|
1355
|
-
|
|
1398
|
+
return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
|
|
1399
|
+
}
|
|
1400
|
+
function isMismatchAllowedByAttr(allowedAttr, allowedType) {
|
|
1356
1401
|
if (allowedAttr == null) return false;
|
|
1357
1402
|
else if (allowedAttr === "") return true;
|
|
1358
1403
|
else {
|
|
@@ -1361,6 +1406,16 @@ function isMismatchAllowed(el, allowedType) {
|
|
|
1361
1406
|
return list.includes(MismatchTypeString[allowedType]);
|
|
1362
1407
|
}
|
|
1363
1408
|
}
|
|
1409
|
+
function isNodeMismatchAllowed(node, vnode) {
|
|
1410
|
+
return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
|
|
1411
|
+
}
|
|
1412
|
+
function isMismatchAllowedByNode(node) {
|
|
1413
|
+
return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
|
|
1414
|
+
}
|
|
1415
|
+
function isMismatchAllowedByVNode({ props }) {
|
|
1416
|
+
const allowedAttr = props && props[allowMismatchAttr];
|
|
1417
|
+
return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
|
|
1418
|
+
}
|
|
1364
1419
|
//#endregion
|
|
1365
1420
|
//#region packages/runtime-core/src/hydrationStrategies.ts
|
|
1366
1421
|
let requestIdleCallback;
|
|
@@ -1479,11 +1534,16 @@ function defineAsyncComponent(source) {
|
|
|
1479
1534
|
onError(err);
|
|
1480
1535
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
1481
1536
|
});
|
|
1482
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
1537
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
1483
1538
|
load().then(() => {
|
|
1539
|
+
if (instance.isUnmounted) return;
|
|
1484
1540
|
loaded.value = true;
|
|
1485
1541
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
1486
1542
|
}).catch((err) => {
|
|
1543
|
+
if (instance.isUnmounted) {
|
|
1544
|
+
setPendingRequest(null);
|
|
1545
|
+
return;
|
|
1546
|
+
}
|
|
1487
1547
|
onError(err);
|
|
1488
1548
|
error.value = err;
|
|
1489
1549
|
});
|
|
@@ -1539,14 +1599,22 @@ function createAsyncComponentContext(source) {
|
|
|
1539
1599
|
setPendingRequest: (request) => pendingRequest = request
|
|
1540
1600
|
};
|
|
1541
1601
|
}
|
|
1542
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
1602
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
1543
1603
|
const loaded = (0, _vue_reactivity.ref)(false);
|
|
1544
1604
|
const error = (0, _vue_reactivity.ref)();
|
|
1545
1605
|
const delayed = (0, _vue_reactivity.ref)(!!delay);
|
|
1546
|
-
|
|
1606
|
+
let timeoutTimer;
|
|
1607
|
+
let delayTimer;
|
|
1608
|
+
if (instance) onUnmounted(() => {
|
|
1609
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
1610
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
1611
|
+
}, instance);
|
|
1612
|
+
if (delay) delayTimer = setTimeout(() => {
|
|
1613
|
+
if (instance && instance.isUnmounted) return;
|
|
1547
1614
|
delayed.value = false;
|
|
1548
1615
|
}, delay);
|
|
1549
|
-
if (timeout != null) setTimeout(() => {
|
|
1616
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
1617
|
+
if (instance && instance.isUnmounted) return;
|
|
1550
1618
|
if (!loaded.value && !error.value) {
|
|
1551
1619
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
1552
1620
|
onError(err);
|
|
@@ -1564,10 +1632,12 @@ const useAsyncComponentState = (delay, timeout, onError) => {
|
|
|
1564
1632
|
* @internal
|
|
1565
1633
|
*/
|
|
1566
1634
|
function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
|
|
1635
|
+
const wasConnected = el.isConnected;
|
|
1567
1636
|
let patched = false;
|
|
1568
1637
|
(instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
1569
1638
|
const performHydrate = () => {
|
|
1570
1639
|
if (patched) return;
|
|
1640
|
+
if (!el.parentNode || wasConnected && !el.isConnected) return;
|
|
1571
1641
|
hydrate();
|
|
1572
1642
|
};
|
|
1573
1643
|
const doHydrate = hydrateStrategy ? () => {
|
|
@@ -1804,7 +1874,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
1804
1874
|
try {
|
|
1805
1875
|
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
1806
1876
|
} finally {
|
|
1807
|
-
|
|
1877
|
+
restoreCurrentInstance(prev);
|
|
1808
1878
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
1809
1879
|
}
|
|
1810
1880
|
});
|
|
@@ -1925,8 +1995,9 @@ function createSlots(slots, dynamicSlots) {
|
|
|
1925
1995
|
* Compiler runtime helper for rendering `<slot/>`
|
|
1926
1996
|
* @private
|
|
1927
1997
|
*/
|
|
1928
|
-
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
1998
|
+
function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
|
|
1929
1999
|
let slot = slots[name];
|
|
2000
|
+
if (fallback) fallback.__vdom = true;
|
|
1930
2001
|
const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
|
|
1931
2002
|
if (vaporSlot) {
|
|
1932
2003
|
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
@@ -1934,21 +2005,31 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
1934
2005
|
slot: vaporSlot,
|
|
1935
2006
|
fallback
|
|
1936
2007
|
};
|
|
2008
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
1937
2009
|
return ret;
|
|
1938
2010
|
}
|
|
1939
2011
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
1940
|
-
const
|
|
1941
|
-
|
|
1942
|
-
|
|
2012
|
+
const slotProps = branchKey != null && props.key == null ? (0, _vue_shared.extend)({}, props, { key: branchKey }) : props;
|
|
2013
|
+
const hasProps = Object.keys(slotProps).length > 0;
|
|
2014
|
+
if (name !== "default") slotProps.name = name;
|
|
2015
|
+
return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
|
|
1943
2016
|
}
|
|
1944
2017
|
if (slot && slot._c) slot._d = false;
|
|
2018
|
+
const prevStackSize = blockStack.length;
|
|
1945
2019
|
openBlock();
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
2020
|
+
let rendered;
|
|
2021
|
+
try {
|
|
2022
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
2023
|
+
ensureVaporSlotFallback(validSlotContent, fallback);
|
|
2024
|
+
const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
|
|
2025
|
+
rendered = createBlock(Fragment, { key: (slotKey && !(0, _vue_shared.isSymbol)(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
|
|
2026
|
+
} catch (err) {
|
|
2027
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
2028
|
+
throw err;
|
|
2029
|
+
} finally {
|
|
2030
|
+
if (slot && slot._c) slot._d = true;
|
|
2031
|
+
}
|
|
1950
2032
|
if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
|
1951
|
-
if (slot && slot._c) slot._d = true;
|
|
1952
2033
|
return rendered;
|
|
1953
2034
|
}
|
|
1954
2035
|
function ensureValidVNode(vnodes) {
|
|
@@ -1961,9 +2042,7 @@ function ensureValidVNode(vnodes) {
|
|
|
1961
2042
|
}
|
|
1962
2043
|
function ensureVaporSlotFallback(vnodes, fallback) {
|
|
1963
2044
|
let vaporSlot;
|
|
1964
|
-
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs))
|
|
1965
|
-
if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
|
|
1966
|
-
}
|
|
2045
|
+
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
|
|
1967
2046
|
}
|
|
1968
2047
|
//#endregion
|
|
1969
2048
|
//#region packages/runtime-core/src/helpers/toHandlers.ts
|
|
@@ -2239,25 +2318,38 @@ function createPropsRestProxy(props, excludedKeys) {
|
|
|
2239
2318
|
function withAsyncContext(getAwaitable) {
|
|
2240
2319
|
const ctx = getCurrentGenericInstance();
|
|
2241
2320
|
const inSSRSetup = isInSSRComponentSetup;
|
|
2321
|
+
const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
|
|
2242
2322
|
let awaitable = getAwaitable();
|
|
2243
2323
|
setCurrentInstance(null, void 0);
|
|
2244
2324
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2245
2325
|
const restore = () => {
|
|
2326
|
+
const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
|
|
2246
2327
|
setCurrentInstance(ctx);
|
|
2247
2328
|
if (inSSRSetup) setInSSRSetupState(true);
|
|
2329
|
+
const reset = restoreAsyncContext && restoreAsyncContext();
|
|
2330
|
+
return () => {
|
|
2331
|
+
if (reset) reset();
|
|
2332
|
+
if (resetStoppedScope) resetStoppedScope.reset();
|
|
2333
|
+
};
|
|
2248
2334
|
};
|
|
2249
2335
|
const cleanup = () => {
|
|
2250
2336
|
setCurrentInstance(null, void 0);
|
|
2251
2337
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2252
2338
|
};
|
|
2253
2339
|
if ((0, _vue_shared.isPromise)(awaitable)) awaitable = awaitable.catch((e) => {
|
|
2254
|
-
restore();
|
|
2255
|
-
Promise.resolve().then(() => Promise.resolve().then(
|
|
2340
|
+
const reset = restore();
|
|
2341
|
+
Promise.resolve().then(() => Promise.resolve().then(() => {
|
|
2342
|
+
if (reset) reset();
|
|
2343
|
+
cleanup();
|
|
2344
|
+
}));
|
|
2256
2345
|
throw e;
|
|
2257
2346
|
});
|
|
2258
2347
|
return [awaitable, () => {
|
|
2259
|
-
restore();
|
|
2260
|
-
Promise.resolve().then(
|
|
2348
|
+
const reset = restore();
|
|
2349
|
+
Promise.resolve().then(() => {
|
|
2350
|
+
if (reset) reset();
|
|
2351
|
+
cleanup();
|
|
2352
|
+
});
|
|
2261
2353
|
}];
|
|
2262
2354
|
}
|
|
2263
2355
|
//#endregion
|
|
@@ -2612,12 +2704,13 @@ function useModel(props, name, options = _vue_shared.EMPTY_OBJ) {
|
|
|
2612
2704
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
2613
2705
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
2614
2706
|
}
|
|
2615
|
-
|
|
2707
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
2708
|
+
if (!hasVModel) {
|
|
2616
2709
|
localValue = value;
|
|
2617
2710
|
trigger();
|
|
2618
2711
|
}
|
|
2619
2712
|
i.emit(`update:${name}`, emittedValue);
|
|
2620
|
-
if ((0, _vue_shared.hasChanged)(value,
|
|
2713
|
+
if ((0, _vue_shared.hasChanged)(value, prevSetValue) && ((0, _vue_shared.hasChanged)(value, emittedValue) && !(0, _vue_shared.hasChanged)(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== _vue_shared.EMPTY_OBJ && !(0, _vue_shared.hasChanged)(emittedValue, localValue))) trigger();
|
|
2621
2714
|
prevSetValue = value;
|
|
2622
2715
|
prevEmittedValue = emittedValue;
|
|
2623
2716
|
}
|
|
@@ -2708,7 +2801,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
2708
2801
|
*/
|
|
2709
2802
|
function isEmitListener(options, key) {
|
|
2710
2803
|
if (!options || !(0, _vue_shared.isOn)(key)) return false;
|
|
2711
|
-
key = key.slice(2)
|
|
2804
|
+
key = key.slice(2);
|
|
2805
|
+
key = key === "Once" ? key : key.replace(/Once$/, "");
|
|
2712
2806
|
return (0, _vue_shared.hasOwn)(options, key[0].toLowerCase() + key.slice(1)) || (0, _vue_shared.hasOwn)(options, (0, _vue_shared.hyphenate)(key)) || (0, _vue_shared.hasOwn)(options, key);
|
|
2713
2807
|
}
|
|
2714
2808
|
//#endregion
|
|
@@ -2959,7 +3053,7 @@ function baseResolveDefault(factory, instance, key) {
|
|
|
2959
3053
|
const prev = setCurrentInstance(instance);
|
|
2960
3054
|
const props = (0, _vue_reactivity.toRaw)(instance.props);
|
|
2961
3055
|
value = factory.call(null, props);
|
|
2962
|
-
|
|
3056
|
+
restoreCurrentInstance(prev);
|
|
2963
3057
|
return value;
|
|
2964
3058
|
}
|
|
2965
3059
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3259,6 +3353,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3259
3353
|
if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
3260
3354
|
if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
3261
3355
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
3356
|
+
if (dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
|
|
3357
|
+
patchFlag = 0;
|
|
3358
|
+
optimized = false;
|
|
3359
|
+
dynamicChildren = null;
|
|
3360
|
+
}
|
|
3262
3361
|
if (oldProps.innerHTML && newProps.innerHTML == null || oldProps.textContent && newProps.textContent == null) hostSetElementText(el, "");
|
|
3263
3362
|
if (dynamicChildren) patchBlockChildren(n1.dynamicChildren, dynamicChildren, el, parentComponent, parentSuspense, resolveChildrenNamespace(n2, namespace), slotScopeIds);
|
|
3264
3363
|
else if (!optimized) patchChildren(n1, n2, el, null, parentComponent, parentSuspense, resolveChildrenNamespace(n2, namespace), slotScopeIds, false);
|
|
@@ -3325,21 +3424,37 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3325
3424
|
};
|
|
3326
3425
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
3327
3426
|
n2.slotScopeIds = slotScopeIds;
|
|
3328
|
-
if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
|
|
3427
|
+
if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
|
|
3329
3428
|
else {
|
|
3429
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
|
|
3330
3430
|
getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
|
|
3331
3431
|
if (n2.dirs) {
|
|
3332
3432
|
invokeDirectiveHook(n2, null, parentComponent, "created");
|
|
3333
3433
|
invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
|
|
3334
3434
|
}
|
|
3435
|
+
}, () => {
|
|
3436
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
|
|
3335
3437
|
});
|
|
3336
3438
|
if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
|
|
3439
|
+
const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
|
|
3440
|
+
if (vnodeMountedHook) {
|
|
3441
|
+
const scopedVNode = n2;
|
|
3442
|
+
queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
|
|
3443
|
+
}
|
|
3337
3444
|
}
|
|
3338
3445
|
else {
|
|
3339
|
-
|
|
3446
|
+
const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
|
|
3447
|
+
getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
|
|
3340
3448
|
if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
3449
|
+
}, () => {
|
|
3450
|
+
const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
|
|
3451
|
+
if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
|
|
3341
3452
|
});
|
|
3342
|
-
|
|
3453
|
+
const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
|
|
3454
|
+
if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
|
|
3455
|
+
n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
3456
|
+
vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
|
|
3457
|
+
}, void 0, parentSuspense);
|
|
3343
3458
|
}
|
|
3344
3459
|
else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
3345
3460
|
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
@@ -3619,7 +3734,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3619
3734
|
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
3620
3735
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
3621
3736
|
if (isVaporComponent(type) || type === VaporSlot) {
|
|
3622
|
-
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
|
|
3737
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
|
|
3623
3738
|
return;
|
|
3624
3739
|
}
|
|
3625
3740
|
if (shapeFlag & 6) {
|
|
@@ -3652,8 +3767,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3652
3767
|
else hostInsert(el, container, anchor);
|
|
3653
3768
|
};
|
|
3654
3769
|
const performLeave = () => {
|
|
3770
|
+
const wasLeaving = el._isLeaving || !!el[leaveCbKey];
|
|
3655
3771
|
if (el._isLeaving) el[leaveCbKey](true);
|
|
3656
|
-
|
|
3772
|
+
if (transition.persisted && !wasLeaving) remove();
|
|
3773
|
+
else leave(el, () => {
|
|
3657
3774
|
remove();
|
|
3658
3775
|
afterLeave && afterLeave();
|
|
3659
3776
|
});
|
|
@@ -3673,7 +3790,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3673
3790
|
}
|
|
3674
3791
|
if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
|
|
3675
3792
|
if (shapeFlag & 256) {
|
|
3676
|
-
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
|
|
3793
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
|
|
3677
3794
|
else parentComponent.ctx.deactivate(vnode);
|
|
3678
3795
|
return;
|
|
3679
3796
|
}
|
|
@@ -3683,8 +3800,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3683
3800
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
3684
3801
|
if (shapeFlag & 6) if (isVaporComponent(type)) {
|
|
3685
3802
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
|
3686
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
3687
|
-
if (
|
|
3803
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
3804
|
+
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
|
|
3805
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
3806
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
3807
|
+
}, void 0, parentSuspense);
|
|
3688
3808
|
return;
|
|
3689
3809
|
} else unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
3690
3810
|
else {
|
|
@@ -3697,7 +3817,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3697
3817
|
else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
3698
3818
|
else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
|
|
3699
3819
|
if (type === VaporSlot) {
|
|
3700
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
3820
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
3701
3821
|
return;
|
|
3702
3822
|
}
|
|
3703
3823
|
if (doRemove) remove(vnode);
|
|
@@ -3740,7 +3860,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
3740
3860
|
if (effect) {
|
|
3741
3861
|
effect.stop();
|
|
3742
3862
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
3743
|
-
}
|
|
3863
|
+
} else if (doRemove && subTree && instance.vnode.el) remove(subTree);
|
|
3744
3864
|
if (um) queuePostRenderEffect(um, void 0, parentSuspense);
|
|
3745
3865
|
queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
|
|
3746
3866
|
};
|
|
@@ -3859,6 +3979,10 @@ function invalidateMount(hooks) {
|
|
|
3859
3979
|
if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
|
|
3860
3980
|
}
|
|
3861
3981
|
function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
|
|
3982
|
+
if (force && transition.persisted && !el[leaveCbKey]) {
|
|
3983
|
+
insert();
|
|
3984
|
+
return;
|
|
3985
|
+
}
|
|
3862
3986
|
if (force || needTransition(parentSuspense, transition)) {
|
|
3863
3987
|
transition.beforeEnter(el);
|
|
3864
3988
|
insert();
|
|
@@ -4048,15 +4172,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
4048
4172
|
if (suspense.isHydrating) suspense.isHydrating = false;
|
|
4049
4173
|
else if (!resume) {
|
|
4050
4174
|
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
4175
|
+
let hasUpdatedAnchor = false;
|
|
4051
4176
|
if (delayEnter) activeBranch.transition.afterLeave = () => {
|
|
4052
4177
|
if (pendingId === suspense.pendingId) {
|
|
4053
|
-
move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
4178
|
+
move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
4054
4179
|
queuePostFlushCb(effects);
|
|
4055
4180
|
if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
|
|
4056
4181
|
}
|
|
4057
4182
|
};
|
|
4058
4183
|
if (activeBranch && !suspense.isFallbackMountPending) {
|
|
4059
|
-
if (parentNode(activeBranch.el) === container)
|
|
4184
|
+
if (parentNode(activeBranch.el) === container) {
|
|
4185
|
+
anchor = next(activeBranch);
|
|
4186
|
+
hasUpdatedAnchor = true;
|
|
4187
|
+
}
|
|
4060
4188
|
unmount(activeBranch, parentComponent, suspense, true);
|
|
4061
4189
|
if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
|
|
4062
4190
|
}
|
|
@@ -4120,6 +4248,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
4120
4248
|
handleError(err, instance, 0);
|
|
4121
4249
|
}).then((asyncSetupResult) => {
|
|
4122
4250
|
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
|
|
4251
|
+
setCurrentInstance(null, void 0);
|
|
4123
4252
|
instance.asyncResolved = true;
|
|
4124
4253
|
onResolve(asyncSetupResult);
|
|
4125
4254
|
if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
|
|
@@ -4383,11 +4512,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
4383
4512
|
el: vnode.el,
|
|
4384
4513
|
anchor: vnode.anchor,
|
|
4385
4514
|
ctx: vnode.ctx,
|
|
4386
|
-
ce: vnode.ce
|
|
4515
|
+
ce: vnode.ce,
|
|
4516
|
+
vi: vnode.vi,
|
|
4517
|
+
vs: cloneVaporSlotMeta(vnode),
|
|
4518
|
+
vb: vnode.vb
|
|
4387
4519
|
};
|
|
4388
4520
|
if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
|
|
4389
4521
|
return cloned;
|
|
4390
4522
|
}
|
|
4523
|
+
function cloneVaporSlotMeta(vnode) {
|
|
4524
|
+
const vaporSlot = vnode.vs;
|
|
4525
|
+
if (!vaporSlot) return vaporSlot;
|
|
4526
|
+
const cloned = {
|
|
4527
|
+
slot: vaporSlot.slot,
|
|
4528
|
+
fallback: vaporSlot.fallback,
|
|
4529
|
+
outletFallback: vaporSlot.outletFallback
|
|
4530
|
+
};
|
|
4531
|
+
if (vnode.el) {
|
|
4532
|
+
cloned.state = vaporSlot.state;
|
|
4533
|
+
cloned.ref = vaporSlot.ref;
|
|
4534
|
+
cloned.scope = vaporSlot.scope;
|
|
4535
|
+
}
|
|
4536
|
+
return cloned;
|
|
4537
|
+
}
|
|
4391
4538
|
/**
|
|
4392
4539
|
* @private
|
|
4393
4540
|
*/
|
|
@@ -4441,6 +4588,10 @@ function normalizeChildren(vnode, children) {
|
|
|
4441
4588
|
}
|
|
4442
4589
|
}
|
|
4443
4590
|
else if ((0, _vue_shared.isFunction)(children)) {
|
|
4591
|
+
if (shapeFlag & 65) {
|
|
4592
|
+
normalizeChildren(vnode, { default: children });
|
|
4593
|
+
return;
|
|
4594
|
+
}
|
|
4444
4595
|
children = {
|
|
4445
4596
|
default: children,
|
|
4446
4597
|
_ctx: currentRenderingInstance
|
|
@@ -4513,6 +4664,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
|
|
|
4513
4664
|
simpleSetCurrentInstance(instance);
|
|
4514
4665
|
}
|
|
4515
4666
|
};
|
|
4667
|
+
/**
|
|
4668
|
+
* Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
|
|
4669
|
+
* `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
|
|
4670
|
+
* verbatim instead of re-triggering the `instance.scope` default.
|
|
4671
|
+
* @internal
|
|
4672
|
+
*/
|
|
4673
|
+
const restoreCurrentInstance = (prev) => {
|
|
4674
|
+
(0, _vue_reactivity.setCurrentScope)(prev[1]);
|
|
4675
|
+
simpleSetCurrentInstance(prev[0]);
|
|
4676
|
+
};
|
|
4516
4677
|
const internalOptions = [
|
|
4517
4678
|
"ce",
|
|
4518
4679
|
"type",
|
|
@@ -4641,7 +4802,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
4641
4802
|
const setupResult = callWithErrorHandling(setup, instance, 0, [instance.props, setupContext]);
|
|
4642
4803
|
const isAsyncSetup = (0, _vue_shared.isPromise)(setupResult);
|
|
4643
4804
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
4644
|
-
|
|
4805
|
+
restoreCurrentInstance(prev);
|
|
4645
4806
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
|
|
4646
4807
|
if (isAsyncSetup) {
|
|
4647
4808
|
const unsetCurrentInstance = () => {
|
|
@@ -4701,7 +4862,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
4701
4862
|
applyOptions(instance);
|
|
4702
4863
|
} finally {
|
|
4703
4864
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
4704
|
-
|
|
4865
|
+
restoreCurrentInstance(prevInstance);
|
|
4705
4866
|
}
|
|
4706
4867
|
}
|
|
4707
4868
|
}
|
|
@@ -4799,7 +4960,7 @@ function isMemoSame(cached, memo) {
|
|
|
4799
4960
|
}
|
|
4800
4961
|
//#endregion
|
|
4801
4962
|
//#region packages/runtime-core/src/index.ts
|
|
4802
|
-
const version = "3.6.0-
|
|
4963
|
+
const version = "3.6.0-rc.2";
|
|
4803
4964
|
const warn = _vue_shared.NOOP;
|
|
4804
4965
|
/**
|
|
4805
4966
|
* Runtime error messages. Only exposed in dev or esm builds.
|