@vue/runtime-core 3.6.0-beta.9 → 3.6.0-rc.1
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 +322 -146
- package/dist/runtime-core.cjs.prod.js +252 -100
- package/dist/runtime-core.d.ts +19 -13
- package/dist/runtime-core.esm-bundler.js +327 -150
- package/package.json +3 -3
package/dist/runtime-core.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @vue/runtime-core v3.6.0-
|
|
2
|
+
* @vue/runtime-core v3.6.0-rc.1
|
|
3
3
|
* (c) 2018-present Yuxi (Evan) You and Vue contributors
|
|
4
4
|
* @license MIT
|
|
5
5
|
**/
|
|
@@ -273,8 +273,8 @@ function findInsertionIndex(order, queue, start, end) {
|
|
|
273
273
|
/**
|
|
274
274
|
* @internal for runtime-vapor only
|
|
275
275
|
*/
|
|
276
|
-
function queueJob(job, id, isPre = false) {
|
|
277
|
-
if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
|
|
276
|
+
function queueJob(job, id, isPre = false, order = 0) {
|
|
277
|
+
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)) {
|
|
278
278
|
jobsLength++;
|
|
279
279
|
queueFlush();
|
|
280
280
|
}
|
|
@@ -383,6 +383,7 @@ function flushJobs(seen) {
|
|
|
383
383
|
}
|
|
384
384
|
flushIndex = 0;
|
|
385
385
|
jobsLength = 0;
|
|
386
|
+
jobs.length = 0;
|
|
386
387
|
flushPostFlushCbs(seen);
|
|
387
388
|
currentFlushPromise = null;
|
|
388
389
|
if (jobsLength || postJobs.length) flushJobs(seen);
|
|
@@ -440,6 +441,14 @@ function createRecord(id, initialDef) {
|
|
|
440
441
|
function normalizeClassComponent(component) {
|
|
441
442
|
return isClassComponent(component) ? component.__vccOpts : component;
|
|
442
443
|
}
|
|
444
|
+
function hasDirtyAncestor(instance, dirtyInstances) {
|
|
445
|
+
let parent = instance.parent;
|
|
446
|
+
while (parent) {
|
|
447
|
+
if (dirtyInstances.has(parent)) return true;
|
|
448
|
+
parent = parent.parent;
|
|
449
|
+
}
|
|
450
|
+
return false;
|
|
451
|
+
}
|
|
443
452
|
function rerender(id, newRender) {
|
|
444
453
|
const record = map.get(id);
|
|
445
454
|
if (!record) return;
|
|
@@ -471,42 +480,69 @@ function reload(id, newComp) {
|
|
|
471
480
|
const isVapor = record.initialDef.__vapor;
|
|
472
481
|
updateComponentDef(record.initialDef, newComp);
|
|
473
482
|
const instances = [...record.instances];
|
|
474
|
-
if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
|
|
483
|
+
if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
|
|
475
484
|
for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
const
|
|
479
|
-
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
480
|
-
if (!dirtyInstances) {
|
|
481
|
-
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
482
|
-
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
483
|
-
}
|
|
484
|
-
dirtyInstances.add(instance);
|
|
485
|
-
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
486
|
-
instance.appContext.propsCache.delete(instance.type);
|
|
487
|
-
instance.appContext.emitsCache.delete(instance.type);
|
|
488
|
-
instance.appContext.optionsCache.delete(instance.type);
|
|
489
|
-
if (instance.ceReload) {
|
|
490
|
-
dirtyInstances.add(instance);
|
|
491
|
-
instance.ceReload(newComp.styles);
|
|
492
|
-
dirtyInstances.delete(instance);
|
|
493
|
-
} else if (instance.parent) queueJob(() => {
|
|
494
|
-
isHmrUpdating = true;
|
|
485
|
+
const dirtyInstances = new Set(instances);
|
|
486
|
+
const rerenderedParents = /* @__PURE__ */ new Set();
|
|
487
|
+
for (const instance of instances) {
|
|
495
488
|
const parent = instance.parent;
|
|
496
|
-
if (parent
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
489
|
+
if (parent) {
|
|
490
|
+
if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
|
|
491
|
+
rerenderedParents.add(parent);
|
|
492
|
+
parent.hmrRerender();
|
|
493
|
+
}
|
|
494
|
+
} else instance.hmrReload(newComp);
|
|
495
|
+
}
|
|
496
|
+
} else {
|
|
497
|
+
const parentUpdates = /* @__PURE__ */ new Map();
|
|
498
|
+
const dirtyInstanceSet = new Set(instances);
|
|
499
|
+
for (const instance of instances) {
|
|
500
|
+
const oldComp = normalizeClassComponent(instance.type);
|
|
501
|
+
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
502
|
+
if (!dirtyInstances) {
|
|
503
|
+
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
504
|
+
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
500
505
|
}
|
|
501
|
-
|
|
502
|
-
|
|
506
|
+
dirtyInstances.add(instance);
|
|
507
|
+
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
508
|
+
instance.appContext.propsCache.delete(instance.type);
|
|
509
|
+
instance.appContext.emitsCache.delete(instance.type);
|
|
510
|
+
instance.appContext.optionsCache.delete(instance.type);
|
|
511
|
+
if (instance.ceReload) {
|
|
512
|
+
dirtyInstances.add(instance);
|
|
513
|
+
instance.ceReload(newComp.styles);
|
|
514
|
+
dirtyInstances.delete(instance);
|
|
515
|
+
} else if (instance.parent) {
|
|
516
|
+
const parent = instance.parent;
|
|
517
|
+
if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
|
|
518
|
+
let updates = parentUpdates.get(parent);
|
|
519
|
+
if (!updates) parentUpdates.set(parent, updates = []);
|
|
520
|
+
updates.push([instance, dirtyInstances]);
|
|
521
|
+
}
|
|
522
|
+
} else if (instance.appContext.reload) instance.appContext.reload();
|
|
523
|
+
else if (typeof window !== "undefined") window.location.reload();
|
|
524
|
+
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
525
|
+
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
526
|
+
}
|
|
527
|
+
parentUpdates.forEach((updates, parent) => {
|
|
528
|
+
queueJob(() => {
|
|
529
|
+
isHmrUpdating = true;
|
|
530
|
+
if (parent.vapor) parent.hmrRerender();
|
|
531
|
+
else {
|
|
532
|
+
const i = parent;
|
|
533
|
+
if (!(i.effect.flags & 1024)) {
|
|
534
|
+
i.renderCache = [];
|
|
535
|
+
i.effect.run();
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
nextTick(() => {
|
|
539
|
+
isHmrUpdating = false;
|
|
540
|
+
});
|
|
541
|
+
updates.forEach(([instance, dirtyInstances]) => {
|
|
542
|
+
dirtyInstances.delete(instance);
|
|
543
|
+
});
|
|
503
544
|
});
|
|
504
|
-
dirtyInstances.delete(instance);
|
|
505
545
|
});
|
|
506
|
-
else if (instance.appContext.reload) instance.appContext.reload();
|
|
507
|
-
else if (typeof window !== "undefined") window.location.reload();
|
|
508
|
-
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
509
|
-
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
510
546
|
}
|
|
511
547
|
queuePostFlushCb(() => {
|
|
512
548
|
hmrDirtyComponents.clear();
|
|
@@ -649,10 +685,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
|
649
685
|
const renderFnWithContext = (...args) => {
|
|
650
686
|
if (renderFnWithContext._d) setBlockTracking(-1);
|
|
651
687
|
const prevInstance = setCurrentRenderingInstance(ctx);
|
|
688
|
+
const prevStackSize = blockStack.length;
|
|
652
689
|
let res;
|
|
653
690
|
try {
|
|
654
691
|
res = fn(...args);
|
|
655
692
|
} finally {
|
|
693
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
656
694
|
setCurrentRenderingInstance(prevInstance);
|
|
657
695
|
if (renderFnWithContext._d) setBlockTracking(1);
|
|
658
696
|
}
|
|
@@ -858,6 +896,7 @@ function createPathGetter(ctx, path) {
|
|
|
858
896
|
}
|
|
859
897
|
//#endregion
|
|
860
898
|
//#region packages/runtime-core/src/components/Teleport.ts
|
|
899
|
+
const pendingMounts = /* @__PURE__ */ new WeakMap();
|
|
861
900
|
const TeleportEndKey = Symbol("_vte");
|
|
862
901
|
const isTeleport = (type) => type.__isTeleport;
|
|
863
902
|
const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
|
@@ -883,58 +922,70 @@ const TeleportImpl = {
|
|
|
883
922
|
name: "Teleport",
|
|
884
923
|
__isTeleport: true,
|
|
885
924
|
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
|
886
|
-
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
|
|
925
|
+
const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
|
|
887
926
|
const disabled = isTeleportDisabled(n2.props);
|
|
888
|
-
let {
|
|
927
|
+
let { dynamicChildren } = n2;
|
|
889
928
|
if (isHmrUpdating) {
|
|
890
929
|
optimized = false;
|
|
891
930
|
dynamicChildren = null;
|
|
892
931
|
}
|
|
932
|
+
const mount = (vnode, container, anchor) => {
|
|
933
|
+
if (vnode.shapeFlag & 16) mountChildren(vnode.children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
|
|
934
|
+
};
|
|
935
|
+
const mountToTarget = (vnode = n2) => {
|
|
936
|
+
const disabled = isTeleportDisabled(vnode.props);
|
|
937
|
+
const target = vnode.target = resolveTarget(vnode.props, querySelector);
|
|
938
|
+
const targetAnchor = prepareAnchor(target, vnode, createText, insert);
|
|
939
|
+
if (target) {
|
|
940
|
+
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
941
|
+
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
942
|
+
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
943
|
+
if (!disabled) {
|
|
944
|
+
mount(vnode, target, targetAnchor);
|
|
945
|
+
updateCssVars(vnode, false);
|
|
946
|
+
}
|
|
947
|
+
} else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
|
|
948
|
+
};
|
|
949
|
+
const queuePendingMount = (vnode) => {
|
|
950
|
+
const mountJob = () => {
|
|
951
|
+
if (pendingMounts.get(vnode) !== mountJob) return;
|
|
952
|
+
pendingMounts.delete(vnode);
|
|
953
|
+
if (isTeleportDisabled(vnode.props)) {
|
|
954
|
+
mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
|
|
955
|
+
updateCssVars(vnode, true);
|
|
956
|
+
}
|
|
957
|
+
mountToTarget(vnode);
|
|
958
|
+
};
|
|
959
|
+
pendingMounts.set(vnode, mountJob);
|
|
960
|
+
queuePostRenderEffect(mountJob, void 0, parentSuspense);
|
|
961
|
+
};
|
|
893
962
|
if (n1 == null) {
|
|
894
963
|
const placeholder = n2.el = createComment("teleport start");
|
|
895
964
|
const mainAnchor = n2.anchor = createComment("teleport end");
|
|
896
965
|
insert(placeholder, container, anchor);
|
|
897
966
|
insert(mainAnchor, container, anchor);
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
const target = n2.target = resolveTarget(n2.props, querySelector);
|
|
903
|
-
const targetAnchor = prepareAnchor(target, n2, createText, insert);
|
|
904
|
-
if (target) {
|
|
905
|
-
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
906
|
-
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
907
|
-
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
908
|
-
if (!disabled) {
|
|
909
|
-
mount(target, targetAnchor);
|
|
910
|
-
updateCssVars(n2, false);
|
|
911
|
-
}
|
|
912
|
-
} else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
|
|
913
|
-
};
|
|
967
|
+
if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
|
|
968
|
+
queuePendingMount(n2);
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
914
971
|
if (disabled) {
|
|
915
|
-
mount(container, mainAnchor);
|
|
972
|
+
mount(n2, container, mainAnchor);
|
|
916
973
|
updateCssVars(n2, true);
|
|
917
974
|
}
|
|
918
|
-
|
|
919
|
-
n2.el.__isMounted = false;
|
|
920
|
-
queuePostRenderEffect(() => {
|
|
921
|
-
if (n2.el.__isMounted !== false) return;
|
|
922
|
-
mountToTarget();
|
|
923
|
-
delete n2.el.__isMounted;
|
|
924
|
-
}, void 0, parentSuspense);
|
|
925
|
-
} else mountToTarget();
|
|
975
|
+
mountToTarget();
|
|
926
976
|
} else {
|
|
927
977
|
n2.el = n1.el;
|
|
928
|
-
n2.targetStart = n1.targetStart;
|
|
929
978
|
const mainAnchor = n2.anchor = n1.anchor;
|
|
930
|
-
const
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
}, void 0, parentSuspense);
|
|
979
|
+
const pendingMount = pendingMounts.get(n1);
|
|
980
|
+
if (pendingMount) {
|
|
981
|
+
pendingMount.flags |= 4;
|
|
982
|
+
pendingMounts.delete(n1);
|
|
983
|
+
queuePendingMount(n2);
|
|
936
984
|
return;
|
|
937
985
|
}
|
|
986
|
+
n2.targetStart = n1.targetStart;
|
|
987
|
+
const target = n2.target = n1.target;
|
|
988
|
+
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
938
989
|
const wasDisabled = isTeleportDisabled(n1.props);
|
|
939
990
|
const currentContainer = wasDisabled ? container : target;
|
|
940
991
|
const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
|
|
@@ -948,24 +999,30 @@ const TeleportImpl = {
|
|
|
948
999
|
if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
|
|
949
1000
|
else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
|
|
950
1001
|
} else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
951
|
-
const nextTarget =
|
|
952
|
-
if (nextTarget)
|
|
953
|
-
|
|
1002
|
+
const nextTarget = resolveTarget(n2.props, querySelector);
|
|
1003
|
+
if (nextTarget) {
|
|
1004
|
+
n2.target = nextTarget;
|
|
1005
|
+
moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
|
|
1006
|
+
} else warn$1("Invalid Teleport target on update:", target, `(${typeof target})`);
|
|
954
1007
|
} else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
|
|
955
1008
|
updateCssVars(n2, disabled);
|
|
956
1009
|
}
|
|
957
1010
|
},
|
|
958
1011
|
remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
959
|
-
const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
|
|
1012
|
+
const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
|
|
1013
|
+
const disabled = isTeleportDisabled(props);
|
|
1014
|
+
const shouldRemove = doRemove || !disabled;
|
|
1015
|
+
const pendingMount = pendingMounts.get(vnode);
|
|
1016
|
+
if (pendingMount) {
|
|
1017
|
+
pendingMount.flags |= 4;
|
|
1018
|
+
pendingMounts.delete(vnode);
|
|
1019
|
+
}
|
|
960
1020
|
if (targetStart) hostRemove(targetStart);
|
|
961
1021
|
if (targetAnchor) hostRemove(targetAnchor);
|
|
962
1022
|
doRemove && hostRemove(anchor);
|
|
963
|
-
if (shapeFlag & 16) {
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
const child = children[i];
|
|
967
|
-
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
968
|
-
}
|
|
1023
|
+
if (!pendingMount && (disabled || target) && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
|
|
1024
|
+
const child = children[i];
|
|
1025
|
+
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
969
1026
|
}
|
|
970
1027
|
},
|
|
971
1028
|
move: moveTeleport,
|
|
@@ -976,7 +1033,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
976
1033
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
977
1034
|
const isReorder = moveType === 2;
|
|
978
1035
|
if (isReorder) insert(el, container, parentAnchor);
|
|
979
|
-
if (!isReorder || isTeleportDisabled(props)) {
|
|
1036
|
+
if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
|
|
980
1037
|
if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
|
|
981
1038
|
}
|
|
982
1039
|
if (isReorder) insert(anchor, container, parentAnchor);
|
|
@@ -1101,8 +1158,8 @@ const BaseTransitionImpl = {
|
|
|
1101
1158
|
const state = useTransitionState();
|
|
1102
1159
|
return () => {
|
|
1103
1160
|
const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
|
1104
|
-
|
|
1105
|
-
|
|
1161
|
+
const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
|
|
1162
|
+
if (!child) return;
|
|
1106
1163
|
const rawProps = (0, _vue_reactivity.toRaw)(props);
|
|
1107
1164
|
const { mode } = rawProps;
|
|
1108
1165
|
checkTransitionMode(mode);
|
|
@@ -1554,7 +1611,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1554
1611
|
else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1555
1612
|
break;
|
|
1556
1613
|
case VaporSlot:
|
|
1557
|
-
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
|
|
1614
|
+
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
|
|
1558
1615
|
break;
|
|
1559
1616
|
default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
|
|
1560
1617
|
else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -1564,16 +1621,31 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1564
1621
|
if (isFragmentStart) nextNode = locateClosingAnchor(node);
|
|
1565
1622
|
else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
|
1566
1623
|
else nextNode = nextSibling(node);
|
|
1567
|
-
if (vnode.type.__vapor)
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1624
|
+
if (vnode.type.__vapor) {
|
|
1625
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
|
|
1626
|
+
getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
|
|
1627
|
+
if (vnode.dirs) {
|
|
1628
|
+
invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
1629
|
+
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
1630
|
+
}
|
|
1631
|
+
}, () => {
|
|
1632
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
|
|
1633
|
+
});
|
|
1634
|
+
if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
|
|
1635
|
+
const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
|
|
1636
|
+
if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
|
|
1637
|
+
} else {
|
|
1638
|
+
mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
|
|
1639
|
+
const component = vnode.component;
|
|
1640
|
+
if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
|
|
1641
|
+
let subTree;
|
|
1642
|
+
if (isFragmentStart) {
|
|
1643
|
+
subTree = createVNode(Fragment);
|
|
1644
|
+
subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
|
1645
|
+
} else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
|
1646
|
+
subTree.el = node;
|
|
1647
|
+
component.subTree = subTree;
|
|
1648
|
+
}
|
|
1577
1649
|
}
|
|
1578
1650
|
} else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
|
|
1579
1651
|
else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
@@ -1585,7 +1657,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1585
1657
|
};
|
|
1586
1658
|
const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
1587
1659
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
1588
|
-
const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1660
|
+
const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1589
1661
|
const forcePatch = type === "input" || type === "option";
|
|
1590
1662
|
{
|
|
1591
1663
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
@@ -1603,15 +1675,11 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1603
1675
|
}
|
|
1604
1676
|
if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
|
|
1605
1677
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1606
|
-
|
|
1678
|
+
if (next && !isMismatchAllowed(el, 1)) {
|
|
1679
|
+
warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
|
|
1680
|
+
logMismatchError();
|
|
1681
|
+
}
|
|
1607
1682
|
while (next) {
|
|
1608
|
-
if (!isMismatchAllowed(el, 1)) {
|
|
1609
|
-
if (!hasWarned) {
|
|
1610
|
-
warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
|
|
1611
|
-
hasWarned = true;
|
|
1612
|
-
}
|
|
1613
|
-
logMismatchError();
|
|
1614
|
-
}
|
|
1615
1683
|
const cur = next;
|
|
1616
1684
|
next = next.nextSibling;
|
|
1617
1685
|
remove(cur);
|
|
@@ -1630,9 +1698,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1630
1698
|
}
|
|
1631
1699
|
if (props) {
|
|
1632
1700
|
const isCustomElement = el.tagName.includes("-");
|
|
1701
|
+
const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
|
|
1633
1702
|
for (const key in props) {
|
|
1634
1703
|
if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
|
|
1635
|
-
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)) patchProp(el, key, null, props[key],
|
|
1704
|
+
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);
|
|
1636
1705
|
}
|
|
1637
1706
|
}
|
|
1638
1707
|
let vnodeHooks;
|
|
@@ -1650,7 +1719,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1650
1719
|
optimized = optimized || !!parentVNode.dynamicChildren;
|
|
1651
1720
|
const children = parentVNode.children;
|
|
1652
1721
|
const l = children.length;
|
|
1653
|
-
let
|
|
1722
|
+
let hasCheckedMismatch = false;
|
|
1654
1723
|
for (let i = 0; i < l; i++) {
|
|
1655
1724
|
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
1656
1725
|
const isText = vnode.type === Text;
|
|
@@ -1664,12 +1733,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1664
1733
|
node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1665
1734
|
} else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
|
|
1666
1735
|
else {
|
|
1667
|
-
if (!
|
|
1668
|
-
|
|
1736
|
+
if (!hasCheckedMismatch) {
|
|
1737
|
+
hasCheckedMismatch = true;
|
|
1738
|
+
if (!isMismatchAllowed(container, 1)) {
|
|
1669
1739
|
warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
|
|
1670
|
-
|
|
1740
|
+
logMismatchError();
|
|
1671
1741
|
}
|
|
1672
|
-
logMismatchError();
|
|
1673
1742
|
}
|
|
1674
1743
|
patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
|
|
1675
1744
|
}
|
|
@@ -1689,7 +1758,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1689
1758
|
}
|
|
1690
1759
|
};
|
|
1691
1760
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
1692
|
-
if (!
|
|
1761
|
+
if (!isNodeMismatchAllowed(node, vnode)) {
|
|
1693
1762
|
warn$1(`Hydration node mismatch:\n- rendered on server:`, node, node.nodeType === 3 ? `(text)` : isComment(node) && node.data === "[" ? `(start of fragment)` : ``, `\n- expected on client:`, vnode.type);
|
|
1694
1763
|
logMismatchError();
|
|
1695
1764
|
}
|
|
@@ -1853,7 +1922,9 @@ const MismatchTypeString = {
|
|
|
1853
1922
|
};
|
|
1854
1923
|
function isMismatchAllowed(el, allowedType) {
|
|
1855
1924
|
if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
|
|
1856
|
-
|
|
1925
|
+
return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
|
|
1926
|
+
}
|
|
1927
|
+
function isMismatchAllowedByAttr(allowedAttr, allowedType) {
|
|
1857
1928
|
if (allowedAttr == null) return false;
|
|
1858
1929
|
else if (allowedAttr === "") return true;
|
|
1859
1930
|
else {
|
|
@@ -1862,6 +1933,16 @@ function isMismatchAllowed(el, allowedType) {
|
|
|
1862
1933
|
return list.includes(MismatchTypeString[allowedType]);
|
|
1863
1934
|
}
|
|
1864
1935
|
}
|
|
1936
|
+
function isNodeMismatchAllowed(node, vnode) {
|
|
1937
|
+
return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
|
|
1938
|
+
}
|
|
1939
|
+
function isMismatchAllowedByNode(node) {
|
|
1940
|
+
return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
|
|
1941
|
+
}
|
|
1942
|
+
function isMismatchAllowedByVNode({ props }) {
|
|
1943
|
+
const allowedAttr = props && props[allowMismatchAttr];
|
|
1944
|
+
return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
|
|
1945
|
+
}
|
|
1865
1946
|
//#endregion
|
|
1866
1947
|
//#region packages/runtime-core/src/hydrationStrategies.ts
|
|
1867
1948
|
let requestIdleCallback;
|
|
@@ -1980,11 +2061,16 @@ function defineAsyncComponent(source) {
|
|
|
1980
2061
|
onError(err);
|
|
1981
2062
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
1982
2063
|
});
|
|
1983
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
2064
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
1984
2065
|
load().then(() => {
|
|
2066
|
+
if (instance.isUnmounted) return;
|
|
1985
2067
|
loaded.value = true;
|
|
1986
2068
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
1987
2069
|
}).catch((err) => {
|
|
2070
|
+
if (instance.isUnmounted) {
|
|
2071
|
+
setPendingRequest(null);
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
1988
2074
|
onError(err);
|
|
1989
2075
|
error.value = err;
|
|
1990
2076
|
});
|
|
@@ -2042,14 +2128,22 @@ function createAsyncComponentContext(source) {
|
|
|
2042
2128
|
setPendingRequest: (request) => pendingRequest = request
|
|
2043
2129
|
};
|
|
2044
2130
|
}
|
|
2045
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
2131
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
2046
2132
|
const loaded = (0, _vue_reactivity.ref)(false);
|
|
2047
2133
|
const error = (0, _vue_reactivity.ref)();
|
|
2048
2134
|
const delayed = (0, _vue_reactivity.ref)(!!delay);
|
|
2049
|
-
|
|
2135
|
+
let timeoutTimer;
|
|
2136
|
+
let delayTimer;
|
|
2137
|
+
if (instance) onUnmounted(() => {
|
|
2138
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
2139
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
2140
|
+
}, instance);
|
|
2141
|
+
if (delay) delayTimer = setTimeout(() => {
|
|
2142
|
+
if (instance && instance.isUnmounted) return;
|
|
2050
2143
|
delayed.value = false;
|
|
2051
2144
|
}, delay);
|
|
2052
|
-
if (timeout != null) setTimeout(() => {
|
|
2145
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
2146
|
+
if (instance && instance.isUnmounted) return;
|
|
2053
2147
|
if (!loaded.value && !error.value) {
|
|
2054
2148
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
2055
2149
|
onError(err);
|
|
@@ -2067,6 +2161,7 @@ const useAsyncComponentState = (delay, timeout, onError) => {
|
|
|
2067
2161
|
* @internal
|
|
2068
2162
|
*/
|
|
2069
2163
|
function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
|
|
2164
|
+
const wasConnected = el.isConnected;
|
|
2070
2165
|
let patched = false;
|
|
2071
2166
|
(instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
2072
2167
|
const performHydrate = () => {
|
|
@@ -2077,6 +2172,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
|
|
|
2077
2172
|
}
|
|
2078
2173
|
return;
|
|
2079
2174
|
}
|
|
2175
|
+
if (!el.parentNode || wasConnected && !el.isConnected) return;
|
|
2080
2176
|
hydrate();
|
|
2081
2177
|
};
|
|
2082
2178
|
const doHydrate = hydrateStrategy ? () => {
|
|
@@ -2446,8 +2542,9 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2446
2542
|
* Compiler runtime helper for rendering `<slot/>`
|
|
2447
2543
|
* @private
|
|
2448
2544
|
*/
|
|
2449
|
-
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
2545
|
+
function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
|
|
2450
2546
|
let slot = slots[name];
|
|
2547
|
+
if (fallback) fallback.__vdom = true;
|
|
2451
2548
|
const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
|
|
2452
2549
|
if (vaporSlot) {
|
|
2453
2550
|
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
@@ -2455,25 +2552,35 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
2455
2552
|
slot: vaporSlot,
|
|
2456
2553
|
fallback
|
|
2457
2554
|
};
|
|
2555
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
2458
2556
|
return ret;
|
|
2459
2557
|
}
|
|
2460
2558
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2463
|
-
|
|
2559
|
+
const slotProps = branchKey != null && props.key == null ? (0, _vue_shared.extend)({}, props, { key: branchKey }) : props;
|
|
2560
|
+
const hasProps = Object.keys(slotProps).length > 0;
|
|
2561
|
+
if (name !== "default") slotProps.name = name;
|
|
2562
|
+
return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
|
|
2464
2563
|
}
|
|
2465
2564
|
if (slot && slot.length > 1) {
|
|
2466
2565
|
warn$1("SSR-optimized slot function detected in a non-SSR-optimized render function. You need to mark this component with $dynamic-slots in the parent template.");
|
|
2467
2566
|
slot = () => [];
|
|
2468
2567
|
}
|
|
2469
2568
|
if (slot && slot._c) slot._d = false;
|
|
2569
|
+
const prevStackSize = blockStack.length;
|
|
2470
2570
|
openBlock();
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2571
|
+
let rendered;
|
|
2572
|
+
try {
|
|
2573
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
2574
|
+
ensureVaporSlotFallback(validSlotContent, fallback);
|
|
2575
|
+
const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
|
|
2576
|
+
rendered = createBlock(Fragment, { key: (slotKey && !(0, _vue_shared.isSymbol)(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
|
|
2577
|
+
} catch (err) {
|
|
2578
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
2579
|
+
throw err;
|
|
2580
|
+
} finally {
|
|
2581
|
+
if (slot && slot._c) slot._d = true;
|
|
2582
|
+
}
|
|
2475
2583
|
if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
|
2476
|
-
if (slot && slot._c) slot._d = true;
|
|
2477
2584
|
return rendered;
|
|
2478
2585
|
}
|
|
2479
2586
|
function ensureValidVNode(vnodes) {
|
|
@@ -2486,9 +2593,7 @@ function ensureValidVNode(vnodes) {
|
|
|
2486
2593
|
}
|
|
2487
2594
|
function ensureVaporSlotFallback(vnodes, fallback) {
|
|
2488
2595
|
let vaporSlot;
|
|
2489
|
-
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs))
|
|
2490
|
-
if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
|
|
2491
|
-
}
|
|
2596
|
+
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
|
|
2492
2597
|
}
|
|
2493
2598
|
//#endregion
|
|
2494
2599
|
//#region packages/runtime-core/src/helpers/toHandlers.ts
|
|
@@ -2854,26 +2959,39 @@ function createPropsRestProxy(props, excludedKeys) {
|
|
|
2854
2959
|
function withAsyncContext(getAwaitable) {
|
|
2855
2960
|
const ctx = getCurrentGenericInstance();
|
|
2856
2961
|
const inSSRSetup = isInSSRComponentSetup;
|
|
2962
|
+
const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
|
|
2857
2963
|
if (!ctx) warn$1("withAsyncContext called without active current instance. This is likely a bug.");
|
|
2858
2964
|
let awaitable = getAwaitable();
|
|
2859
2965
|
setCurrentInstance(null, void 0);
|
|
2860
2966
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2861
2967
|
const restore = () => {
|
|
2968
|
+
const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
|
|
2862
2969
|
setCurrentInstance(ctx);
|
|
2863
2970
|
if (inSSRSetup) setInSSRSetupState(true);
|
|
2971
|
+
const reset = restoreAsyncContext && restoreAsyncContext();
|
|
2972
|
+
return () => {
|
|
2973
|
+
if (reset) reset();
|
|
2974
|
+
if (resetStoppedScope) resetStoppedScope.reset();
|
|
2975
|
+
};
|
|
2864
2976
|
};
|
|
2865
2977
|
const cleanup = () => {
|
|
2866
2978
|
setCurrentInstance(null, void 0);
|
|
2867
2979
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2868
2980
|
};
|
|
2869
2981
|
if ((0, _vue_shared.isPromise)(awaitable)) awaitable = awaitable.catch((e) => {
|
|
2870
|
-
restore();
|
|
2871
|
-
Promise.resolve().then(() => Promise.resolve().then(
|
|
2982
|
+
const reset = restore();
|
|
2983
|
+
Promise.resolve().then(() => Promise.resolve().then(() => {
|
|
2984
|
+
if (reset) reset();
|
|
2985
|
+
cleanup();
|
|
2986
|
+
}));
|
|
2872
2987
|
throw e;
|
|
2873
2988
|
});
|
|
2874
2989
|
return [awaitable, () => {
|
|
2875
|
-
restore();
|
|
2876
|
-
Promise.resolve().then(
|
|
2990
|
+
const reset = restore();
|
|
2991
|
+
Promise.resolve().then(() => {
|
|
2992
|
+
if (reset) reset();
|
|
2993
|
+
cleanup();
|
|
2994
|
+
});
|
|
2877
2995
|
}];
|
|
2878
2996
|
}
|
|
2879
2997
|
//#endregion
|
|
@@ -3298,12 +3416,13 @@ function useModel(props, name, options = _vue_shared.EMPTY_OBJ) {
|
|
|
3298
3416
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
3299
3417
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
3300
3418
|
}
|
|
3301
|
-
|
|
3419
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
3420
|
+
if (!hasVModel) {
|
|
3302
3421
|
localValue = value;
|
|
3303
3422
|
trigger();
|
|
3304
3423
|
}
|
|
3305
3424
|
i.emit(`update:${name}`, emittedValue);
|
|
3306
|
-
if ((0, _vue_shared.hasChanged)(value,
|
|
3425
|
+
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();
|
|
3307
3426
|
prevSetValue = value;
|
|
3308
3427
|
prevEmittedValue = emittedValue;
|
|
3309
3428
|
}
|
|
@@ -3410,7 +3529,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
3410
3529
|
*/
|
|
3411
3530
|
function isEmitListener(options, key) {
|
|
3412
3531
|
if (!options || !(0, _vue_shared.isOn)(key)) return false;
|
|
3413
|
-
key = key.slice(2)
|
|
3532
|
+
key = key.slice(2);
|
|
3533
|
+
key = key === "Once" ? key : key.replace(/Once$/, "");
|
|
3414
3534
|
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);
|
|
3415
3535
|
}
|
|
3416
3536
|
//#endregion
|
|
@@ -3885,7 +4005,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
3885
4005
|
const receivedType = (0, _vue_shared.toRawType)(value);
|
|
3886
4006
|
const expectedValue = styleValue(value, expectedType);
|
|
3887
4007
|
const receivedValue = styleValue(value, receivedType);
|
|
3888
|
-
if (expectedTypes.length === 1 && isExplicable(expectedType) &&
|
|
4008
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
|
|
3889
4009
|
message += `, got ${receivedType} `;
|
|
3890
4010
|
if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
|
|
3891
4011
|
return message;
|
|
@@ -3894,7 +4014,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
3894
4014
|
* dev only
|
|
3895
4015
|
*/
|
|
3896
4016
|
function styleValue(value, type) {
|
|
3897
|
-
if (
|
|
4017
|
+
if ((0, _vue_shared.isSymbol)(value)) return value.toString();
|
|
4018
|
+
else if (type === "String") return `"${value}"`;
|
|
3898
4019
|
else if (type === "Number") return `${Number(value)}`;
|
|
3899
4020
|
else return `${value}`;
|
|
3900
4021
|
}
|
|
@@ -3911,8 +4032,11 @@ function isExplicable(type) {
|
|
|
3911
4032
|
/**
|
|
3912
4033
|
* dev only
|
|
3913
4034
|
*/
|
|
3914
|
-
function
|
|
3915
|
-
return args.
|
|
4035
|
+
function isCoercible(...args) {
|
|
4036
|
+
return args.every((elem) => {
|
|
4037
|
+
const value = elem.toLowerCase();
|
|
4038
|
+
return value !== "boolean" && value !== "symbol";
|
|
4039
|
+
});
|
|
3916
4040
|
}
|
|
3917
4041
|
//#endregion
|
|
3918
4042
|
//#region packages/runtime-core/src/componentSlots.ts
|
|
@@ -4217,7 +4341,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4217
4341
|
if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
4218
4342
|
if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
4219
4343
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
4220
|
-
if (isHmrUpdating) {
|
|
4344
|
+
if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
|
|
4221
4345
|
patchFlag = 0;
|
|
4222
4346
|
optimized = false;
|
|
4223
4347
|
dynamicChildren = null;
|
|
@@ -4297,19 +4421,35 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4297
4421
|
n2.slotScopeIds = slotScopeIds;
|
|
4298
4422
|
if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
|
|
4299
4423
|
else {
|
|
4424
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
|
|
4300
4425
|
getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
|
|
4301
4426
|
if (n2.dirs) {
|
|
4302
4427
|
invokeDirectiveHook(n2, null, parentComponent, "created");
|
|
4303
4428
|
invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
|
|
4304
4429
|
}
|
|
4430
|
+
}, () => {
|
|
4431
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
|
|
4305
4432
|
});
|
|
4306
4433
|
if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
|
|
4434
|
+
const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
|
|
4435
|
+
if (vnodeMountedHook) {
|
|
4436
|
+
const scopedVNode = n2;
|
|
4437
|
+
queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
|
|
4438
|
+
}
|
|
4307
4439
|
}
|
|
4308
4440
|
else {
|
|
4309
|
-
|
|
4441
|
+
const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
|
|
4442
|
+
getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
|
|
4310
4443
|
if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
4444
|
+
}, () => {
|
|
4445
|
+
const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
|
|
4446
|
+
if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
|
|
4311
4447
|
});
|
|
4312
|
-
|
|
4448
|
+
const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
|
|
4449
|
+
if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
|
|
4450
|
+
n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
4451
|
+
vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
|
|
4452
|
+
}, void 0, parentSuspense);
|
|
4313
4453
|
}
|
|
4314
4454
|
else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
4315
4455
|
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
@@ -4655,8 +4795,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4655
4795
|
else hostInsert(el, container, anchor);
|
|
4656
4796
|
};
|
|
4657
4797
|
const performLeave = () => {
|
|
4798
|
+
const wasLeaving = el._isLeaving || !!el[leaveCbKey];
|
|
4658
4799
|
if (el._isLeaving) el[leaveCbKey](true);
|
|
4659
|
-
|
|
4800
|
+
if (transition.persisted && !wasLeaving) remove();
|
|
4801
|
+
else leave(el, () => {
|
|
4660
4802
|
remove();
|
|
4661
4803
|
afterLeave && afterLeave();
|
|
4662
4804
|
});
|
|
@@ -4687,7 +4829,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4687
4829
|
if (shapeFlag & 6) if (isVaporComponent(type)) {
|
|
4688
4830
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
|
4689
4831
|
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
4690
|
-
if (
|
|
4832
|
+
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
|
|
4833
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
4834
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4835
|
+
}, void 0, parentSuspense);
|
|
4691
4836
|
return;
|
|
4692
4837
|
} else unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
4693
4838
|
else {
|
|
@@ -4748,7 +4893,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4748
4893
|
if (effect) {
|
|
4749
4894
|
effect.stop();
|
|
4750
4895
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
4751
|
-
}
|
|
4896
|
+
} else if (doRemove && subTree && instance.vnode.el) remove(subTree);
|
|
4752
4897
|
if (um) queuePostRenderEffect(um, void 0, parentSuspense);
|
|
4753
4898
|
queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
|
|
4754
4899
|
devtoolsComponentRemoved(instance);
|
|
@@ -4874,6 +5019,10 @@ function invalidateMount(hooks) {
|
|
|
4874
5019
|
if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
|
|
4875
5020
|
}
|
|
4876
5021
|
function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
|
|
5022
|
+
if (force && transition.persisted && !el[leaveCbKey]) {
|
|
5023
|
+
insert();
|
|
5024
|
+
return;
|
|
5025
|
+
}
|
|
4877
5026
|
if (force || needTransition(parentSuspense, transition)) {
|
|
4878
5027
|
transition.beforeEnter(el);
|
|
4879
5028
|
insert();
|
|
@@ -5076,15 +5225,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5076
5225
|
if (suspense.isHydrating) suspense.isHydrating = false;
|
|
5077
5226
|
else if (!resume) {
|
|
5078
5227
|
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
5228
|
+
let hasUpdatedAnchor = false;
|
|
5079
5229
|
if (delayEnter) activeBranch.transition.afterLeave = () => {
|
|
5080
5230
|
if (pendingId === suspense.pendingId) {
|
|
5081
|
-
move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
5231
|
+
move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
5082
5232
|
queuePostFlushCb(effects);
|
|
5083
5233
|
if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
|
|
5084
5234
|
}
|
|
5085
5235
|
};
|
|
5086
5236
|
if (activeBranch && !suspense.isFallbackMountPending) {
|
|
5087
|
-
if (parentNode(activeBranch.el) === container)
|
|
5237
|
+
if (parentNode(activeBranch.el) === container) {
|
|
5238
|
+
anchor = next(activeBranch);
|
|
5239
|
+
hasUpdatedAnchor = true;
|
|
5240
|
+
}
|
|
5088
5241
|
unmount(activeBranch, parentComponent, suspense, true);
|
|
5089
5242
|
if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
|
|
5090
5243
|
}
|
|
@@ -5148,6 +5301,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5148
5301
|
handleError(err, instance, 0);
|
|
5149
5302
|
}).then((asyncSetupResult) => {
|
|
5150
5303
|
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
|
|
5304
|
+
setCurrentInstance(null, void 0);
|
|
5151
5305
|
instance.asyncResolved = true;
|
|
5152
5306
|
onResolve(asyncSetupResult);
|
|
5153
5307
|
if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
|
|
@@ -5437,11 +5591,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
5437
5591
|
el: vnode.el,
|
|
5438
5592
|
anchor: vnode.anchor,
|
|
5439
5593
|
ctx: vnode.ctx,
|
|
5440
|
-
ce: vnode.ce
|
|
5594
|
+
ce: vnode.ce,
|
|
5595
|
+
vi: vnode.vi,
|
|
5596
|
+
vs: cloneVaporSlotMeta(vnode),
|
|
5597
|
+
vb: vnode.vb
|
|
5441
5598
|
};
|
|
5442
5599
|
if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
|
|
5443
5600
|
return cloned;
|
|
5444
5601
|
}
|
|
5602
|
+
function cloneVaporSlotMeta(vnode) {
|
|
5603
|
+
const vaporSlot = vnode.vs;
|
|
5604
|
+
if (!vaporSlot) return vaporSlot;
|
|
5605
|
+
const cloned = {
|
|
5606
|
+
slot: vaporSlot.slot,
|
|
5607
|
+
fallback: vaporSlot.fallback,
|
|
5608
|
+
outletFallback: vaporSlot.outletFallback
|
|
5609
|
+
};
|
|
5610
|
+
if (vnode.el) {
|
|
5611
|
+
cloned.state = vaporSlot.state;
|
|
5612
|
+
cloned.ref = vaporSlot.ref;
|
|
5613
|
+
cloned.scope = vaporSlot.scope;
|
|
5614
|
+
}
|
|
5615
|
+
return cloned;
|
|
5616
|
+
}
|
|
5445
5617
|
/**
|
|
5446
5618
|
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
5447
5619
|
* https://github.com/vitejs/vite/issues/2022
|
|
@@ -5504,6 +5676,10 @@ function normalizeChildren(vnode, children) {
|
|
|
5504
5676
|
}
|
|
5505
5677
|
}
|
|
5506
5678
|
else if ((0, _vue_shared.isFunction)(children)) {
|
|
5679
|
+
if (shapeFlag & 65) {
|
|
5680
|
+
normalizeChildren(vnode, { default: children });
|
|
5681
|
+
return;
|
|
5682
|
+
}
|
|
5507
5683
|
children = {
|
|
5508
5684
|
default: children,
|
|
5509
5685
|
_ctx: currentRenderingInstance
|
|
@@ -6107,7 +6283,7 @@ function isMemoSame(cached, memo) {
|
|
|
6107
6283
|
}
|
|
6108
6284
|
//#endregion
|
|
6109
6285
|
//#region packages/runtime-core/src/index.ts
|
|
6110
|
-
const version = "3.6.0-
|
|
6286
|
+
const version = "3.6.0-rc.1";
|
|
6111
6287
|
const warn = warn$1;
|
|
6112
6288
|
/**
|
|
6113
6289
|
* Runtime error messages. Only exposed in dev or esm builds.
|