@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
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.2
|
|
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
|
}
|
|
@@ -845,7 +883,7 @@ function instanceWatch(source, value, options) {
|
|
|
845
883
|
}
|
|
846
884
|
const prev = setCurrentInstance(this);
|
|
847
885
|
const res = doWatch(getter, cb.bind(publicThis), options);
|
|
848
|
-
|
|
886
|
+
restoreCurrentInstance(prev);
|
|
849
887
|
return res;
|
|
850
888
|
}
|
|
851
889
|
function createPathGetter(ctx, path) {
|
|
@@ -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);
|
|
@@ -1284,12 +1341,11 @@ function getInnerChild$1(vnode) {
|
|
|
1284
1341
|
}
|
|
1285
1342
|
}
|
|
1286
1343
|
function setTransitionHooks(vnode, hooks) {
|
|
1287
|
-
if (vnode.shapeFlag & 6 && vnode.component)
|
|
1288
|
-
else {
|
|
1344
|
+
if (vnode.shapeFlag & 6 && vnode.component) {
|
|
1289
1345
|
vnode.transition = hooks;
|
|
1290
|
-
setTransitionHooks(vnode.component
|
|
1291
|
-
|
|
1292
|
-
else if (vnode.shapeFlag & 128) {
|
|
1346
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
|
|
1347
|
+
else setTransitionHooks(vnode.component.subTree, hooks);
|
|
1348
|
+
} else if (vnode.shapeFlag & 128) {
|
|
1293
1349
|
vnode.ssContent.transition = hooks.clone(vnode.ssContent);
|
|
1294
1350
|
vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
|
|
1295
1351
|
} else vnode.transition = hooks;
|
|
@@ -1554,7 +1610,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1554
1610
|
else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1555
1611
|
break;
|
|
1556
1612
|
case VaporSlot:
|
|
1557
|
-
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
|
|
1613
|
+
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
|
|
1558
1614
|
break;
|
|
1559
1615
|
default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
|
|
1560
1616
|
else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -1564,16 +1620,31 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1564
1620
|
if (isFragmentStart) nextNode = locateClosingAnchor(node);
|
|
1565
1621
|
else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
|
1566
1622
|
else nextNode = nextSibling(node);
|
|
1567
|
-
if (vnode.type.__vapor)
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
|
|
1623
|
+
if (vnode.type.__vapor) {
|
|
1624
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
|
|
1625
|
+
getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
|
|
1626
|
+
if (vnode.dirs) {
|
|
1627
|
+
invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
1628
|
+
invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
1629
|
+
}
|
|
1630
|
+
}, () => {
|
|
1631
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
|
|
1632
|
+
});
|
|
1633
|
+
if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
|
|
1634
|
+
const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
|
|
1635
|
+
if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
|
|
1636
|
+
} else {
|
|
1637
|
+
mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
|
|
1638
|
+
const component = vnode.component;
|
|
1639
|
+
if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
|
|
1640
|
+
let subTree;
|
|
1641
|
+
if (isFragmentStart) {
|
|
1642
|
+
subTree = createVNode(Fragment);
|
|
1643
|
+
subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
|
|
1644
|
+
} else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
|
|
1645
|
+
subTree.el = node;
|
|
1646
|
+
component.subTree = subTree;
|
|
1647
|
+
}
|
|
1577
1648
|
}
|
|
1578
1649
|
} else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
|
|
1579
1650
|
else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
@@ -1585,7 +1656,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1585
1656
|
};
|
|
1586
1657
|
const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
1587
1658
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
1588
|
-
const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1659
|
+
const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1589
1660
|
const forcePatch = type === "input" || type === "option";
|
|
1590
1661
|
{
|
|
1591
1662
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
@@ -1603,15 +1674,11 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1603
1674
|
}
|
|
1604
1675
|
if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
|
|
1605
1676
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1606
|
-
|
|
1677
|
+
if (next && !isMismatchAllowed(el, 1)) {
|
|
1678
|
+
warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
|
|
1679
|
+
logMismatchError();
|
|
1680
|
+
}
|
|
1607
1681
|
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
1682
|
const cur = next;
|
|
1616
1683
|
next = next.nextSibling;
|
|
1617
1684
|
remove(cur);
|
|
@@ -1630,9 +1697,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1630
1697
|
}
|
|
1631
1698
|
if (props) {
|
|
1632
1699
|
const isCustomElement = el.tagName.includes("-");
|
|
1700
|
+
const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
|
|
1633
1701
|
for (const key in props) {
|
|
1634
1702
|
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],
|
|
1703
|
+
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
1704
|
}
|
|
1637
1705
|
}
|
|
1638
1706
|
let vnodeHooks;
|
|
@@ -1650,7 +1718,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1650
1718
|
optimized = optimized || !!parentVNode.dynamicChildren;
|
|
1651
1719
|
const children = parentVNode.children;
|
|
1652
1720
|
const l = children.length;
|
|
1653
|
-
let
|
|
1721
|
+
let hasCheckedMismatch = false;
|
|
1654
1722
|
for (let i = 0; i < l; i++) {
|
|
1655
1723
|
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
1656
1724
|
const isText = vnode.type === Text;
|
|
@@ -1664,12 +1732,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1664
1732
|
node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1665
1733
|
} else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
|
|
1666
1734
|
else {
|
|
1667
|
-
if (!
|
|
1668
|
-
|
|
1735
|
+
if (!hasCheckedMismatch) {
|
|
1736
|
+
hasCheckedMismatch = true;
|
|
1737
|
+
if (!isMismatchAllowed(container, 1)) {
|
|
1669
1738
|
warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
|
|
1670
|
-
|
|
1739
|
+
logMismatchError();
|
|
1671
1740
|
}
|
|
1672
|
-
logMismatchError();
|
|
1673
1741
|
}
|
|
1674
1742
|
patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
|
|
1675
1743
|
}
|
|
@@ -1689,7 +1757,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1689
1757
|
}
|
|
1690
1758
|
};
|
|
1691
1759
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
1692
|
-
if (!
|
|
1760
|
+
if (!isNodeMismatchAllowed(node, vnode)) {
|
|
1693
1761
|
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
1762
|
logMismatchError();
|
|
1695
1763
|
}
|
|
@@ -1853,7 +1921,9 @@ const MismatchTypeString = {
|
|
|
1853
1921
|
};
|
|
1854
1922
|
function isMismatchAllowed(el, allowedType) {
|
|
1855
1923
|
if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
|
|
1856
|
-
|
|
1924
|
+
return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
|
|
1925
|
+
}
|
|
1926
|
+
function isMismatchAllowedByAttr(allowedAttr, allowedType) {
|
|
1857
1927
|
if (allowedAttr == null) return false;
|
|
1858
1928
|
else if (allowedAttr === "") return true;
|
|
1859
1929
|
else {
|
|
@@ -1862,6 +1932,16 @@ function isMismatchAllowed(el, allowedType) {
|
|
|
1862
1932
|
return list.includes(MismatchTypeString[allowedType]);
|
|
1863
1933
|
}
|
|
1864
1934
|
}
|
|
1935
|
+
function isNodeMismatchAllowed(node, vnode) {
|
|
1936
|
+
return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
|
|
1937
|
+
}
|
|
1938
|
+
function isMismatchAllowedByNode(node) {
|
|
1939
|
+
return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
|
|
1940
|
+
}
|
|
1941
|
+
function isMismatchAllowedByVNode({ props }) {
|
|
1942
|
+
const allowedAttr = props && props[allowMismatchAttr];
|
|
1943
|
+
return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
|
|
1944
|
+
}
|
|
1865
1945
|
//#endregion
|
|
1866
1946
|
//#region packages/runtime-core/src/hydrationStrategies.ts
|
|
1867
1947
|
let requestIdleCallback;
|
|
@@ -1980,11 +2060,16 @@ function defineAsyncComponent(source) {
|
|
|
1980
2060
|
onError(err);
|
|
1981
2061
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
1982
2062
|
});
|
|
1983
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
2063
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
1984
2064
|
load().then(() => {
|
|
2065
|
+
if (instance.isUnmounted) return;
|
|
1985
2066
|
loaded.value = true;
|
|
1986
2067
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
1987
2068
|
}).catch((err) => {
|
|
2069
|
+
if (instance.isUnmounted) {
|
|
2070
|
+
setPendingRequest(null);
|
|
2071
|
+
return;
|
|
2072
|
+
}
|
|
1988
2073
|
onError(err);
|
|
1989
2074
|
error.value = err;
|
|
1990
2075
|
});
|
|
@@ -2042,14 +2127,22 @@ function createAsyncComponentContext(source) {
|
|
|
2042
2127
|
setPendingRequest: (request) => pendingRequest = request
|
|
2043
2128
|
};
|
|
2044
2129
|
}
|
|
2045
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
2130
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
2046
2131
|
const loaded = (0, _vue_reactivity.ref)(false);
|
|
2047
2132
|
const error = (0, _vue_reactivity.ref)();
|
|
2048
2133
|
const delayed = (0, _vue_reactivity.ref)(!!delay);
|
|
2049
|
-
|
|
2134
|
+
let timeoutTimer;
|
|
2135
|
+
let delayTimer;
|
|
2136
|
+
if (instance) onUnmounted(() => {
|
|
2137
|
+
if (timeoutTimer != null) clearTimeout(timeoutTimer);
|
|
2138
|
+
if (delayTimer != null) clearTimeout(delayTimer);
|
|
2139
|
+
}, instance);
|
|
2140
|
+
if (delay) delayTimer = setTimeout(() => {
|
|
2141
|
+
if (instance && instance.isUnmounted) return;
|
|
2050
2142
|
delayed.value = false;
|
|
2051
2143
|
}, delay);
|
|
2052
|
-
if (timeout != null) setTimeout(() => {
|
|
2144
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
2145
|
+
if (instance && instance.isUnmounted) return;
|
|
2053
2146
|
if (!loaded.value && !error.value) {
|
|
2054
2147
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
2055
2148
|
onError(err);
|
|
@@ -2067,6 +2160,7 @@ const useAsyncComponentState = (delay, timeout, onError) => {
|
|
|
2067
2160
|
* @internal
|
|
2068
2161
|
*/
|
|
2069
2162
|
function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
|
|
2163
|
+
const wasConnected = el.isConnected;
|
|
2070
2164
|
let patched = false;
|
|
2071
2165
|
(instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
2072
2166
|
const performHydrate = () => {
|
|
@@ -2077,6 +2171,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
|
|
|
2077
2171
|
}
|
|
2078
2172
|
return;
|
|
2079
2173
|
}
|
|
2174
|
+
if (!el.parentNode || wasConnected && !el.isConnected) return;
|
|
2080
2175
|
hydrate();
|
|
2081
2176
|
};
|
|
2082
2177
|
const doHydrate = hydrateStrategy ? () => {
|
|
@@ -2317,7 +2412,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
|
|
|
2317
2412
|
try {
|
|
2318
2413
|
return callWithAsyncErrorHandling(hook, target, type, args);
|
|
2319
2414
|
} finally {
|
|
2320
|
-
|
|
2415
|
+
restoreCurrentInstance(prev);
|
|
2321
2416
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
2322
2417
|
}
|
|
2323
2418
|
});
|
|
@@ -2446,8 +2541,9 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2446
2541
|
* Compiler runtime helper for rendering `<slot/>`
|
|
2447
2542
|
* @private
|
|
2448
2543
|
*/
|
|
2449
|
-
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
2544
|
+
function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
|
|
2450
2545
|
let slot = slots[name];
|
|
2546
|
+
if (fallback) fallback.__vdom = true;
|
|
2451
2547
|
const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
|
|
2452
2548
|
if (vaporSlot) {
|
|
2453
2549
|
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
@@ -2455,25 +2551,35 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
2455
2551
|
slot: vaporSlot,
|
|
2456
2552
|
fallback
|
|
2457
2553
|
};
|
|
2554
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
2458
2555
|
return ret;
|
|
2459
2556
|
}
|
|
2460
2557
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
2461
|
-
const
|
|
2462
|
-
|
|
2463
|
-
|
|
2558
|
+
const slotProps = branchKey != null && props.key == null ? (0, _vue_shared.extend)({}, props, { key: branchKey }) : props;
|
|
2559
|
+
const hasProps = Object.keys(slotProps).length > 0;
|
|
2560
|
+
if (name !== "default") slotProps.name = name;
|
|
2561
|
+
return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
|
|
2464
2562
|
}
|
|
2465
2563
|
if (slot && slot.length > 1) {
|
|
2466
2564
|
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
2565
|
slot = () => [];
|
|
2468
2566
|
}
|
|
2469
2567
|
if (slot && slot._c) slot._d = false;
|
|
2568
|
+
const prevStackSize = blockStack.length;
|
|
2470
2569
|
openBlock();
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2570
|
+
let rendered;
|
|
2571
|
+
try {
|
|
2572
|
+
const validSlotContent = slot && ensureValidVNode(slot(props));
|
|
2573
|
+
ensureVaporSlotFallback(validSlotContent, fallback);
|
|
2574
|
+
const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
|
|
2575
|
+
rendered = createBlock(Fragment, { key: (slotKey && !(0, _vue_shared.isSymbol)(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
|
|
2576
|
+
} catch (err) {
|
|
2577
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
2578
|
+
throw err;
|
|
2579
|
+
} finally {
|
|
2580
|
+
if (slot && slot._c) slot._d = true;
|
|
2581
|
+
}
|
|
2475
2582
|
if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
|
2476
|
-
if (slot && slot._c) slot._d = true;
|
|
2477
2583
|
return rendered;
|
|
2478
2584
|
}
|
|
2479
2585
|
function ensureValidVNode(vnodes) {
|
|
@@ -2486,9 +2592,7 @@ function ensureValidVNode(vnodes) {
|
|
|
2486
2592
|
}
|
|
2487
2593
|
function ensureVaporSlotFallback(vnodes, fallback) {
|
|
2488
2594
|
let vaporSlot;
|
|
2489
|
-
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs))
|
|
2490
|
-
if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
|
|
2491
|
-
}
|
|
2595
|
+
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
|
|
2492
2596
|
}
|
|
2493
2597
|
//#endregion
|
|
2494
2598
|
//#region packages/runtime-core/src/helpers/toHandlers.ts
|
|
@@ -2854,26 +2958,39 @@ function createPropsRestProxy(props, excludedKeys) {
|
|
|
2854
2958
|
function withAsyncContext(getAwaitable) {
|
|
2855
2959
|
const ctx = getCurrentGenericInstance();
|
|
2856
2960
|
const inSSRSetup = isInSSRComponentSetup;
|
|
2961
|
+
const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
|
|
2857
2962
|
if (!ctx) warn$1("withAsyncContext called without active current instance. This is likely a bug.");
|
|
2858
2963
|
let awaitable = getAwaitable();
|
|
2859
2964
|
setCurrentInstance(null, void 0);
|
|
2860
2965
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2861
2966
|
const restore = () => {
|
|
2967
|
+
const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
|
|
2862
2968
|
setCurrentInstance(ctx);
|
|
2863
2969
|
if (inSSRSetup) setInSSRSetupState(true);
|
|
2970
|
+
const reset = restoreAsyncContext && restoreAsyncContext();
|
|
2971
|
+
return () => {
|
|
2972
|
+
if (reset) reset();
|
|
2973
|
+
if (resetStoppedScope) resetStoppedScope.reset();
|
|
2974
|
+
};
|
|
2864
2975
|
};
|
|
2865
2976
|
const cleanup = () => {
|
|
2866
2977
|
setCurrentInstance(null, void 0);
|
|
2867
2978
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2868
2979
|
};
|
|
2869
2980
|
if ((0, _vue_shared.isPromise)(awaitable)) awaitable = awaitable.catch((e) => {
|
|
2870
|
-
restore();
|
|
2871
|
-
Promise.resolve().then(() => Promise.resolve().then(
|
|
2981
|
+
const reset = restore();
|
|
2982
|
+
Promise.resolve().then(() => Promise.resolve().then(() => {
|
|
2983
|
+
if (reset) reset();
|
|
2984
|
+
cleanup();
|
|
2985
|
+
}));
|
|
2872
2986
|
throw e;
|
|
2873
2987
|
});
|
|
2874
2988
|
return [awaitable, () => {
|
|
2875
|
-
restore();
|
|
2876
|
-
Promise.resolve().then(
|
|
2989
|
+
const reset = restore();
|
|
2990
|
+
Promise.resolve().then(() => {
|
|
2991
|
+
if (reset) reset();
|
|
2992
|
+
cleanup();
|
|
2993
|
+
});
|
|
2877
2994
|
}];
|
|
2878
2995
|
}
|
|
2879
2996
|
//#endregion
|
|
@@ -3298,12 +3415,13 @@ function useModel(props, name, options = _vue_shared.EMPTY_OBJ) {
|
|
|
3298
3415
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
3299
3416
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
3300
3417
|
}
|
|
3301
|
-
|
|
3418
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
3419
|
+
if (!hasVModel) {
|
|
3302
3420
|
localValue = value;
|
|
3303
3421
|
trigger();
|
|
3304
3422
|
}
|
|
3305
3423
|
i.emit(`update:${name}`, emittedValue);
|
|
3306
|
-
if ((0, _vue_shared.hasChanged)(value,
|
|
3424
|
+
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
3425
|
prevSetValue = value;
|
|
3308
3426
|
prevEmittedValue = emittedValue;
|
|
3309
3427
|
}
|
|
@@ -3410,7 +3528,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
3410
3528
|
*/
|
|
3411
3529
|
function isEmitListener(options, key) {
|
|
3412
3530
|
if (!options || !(0, _vue_shared.isOn)(key)) return false;
|
|
3413
|
-
key = key.slice(2)
|
|
3531
|
+
key = key.slice(2);
|
|
3532
|
+
key = key === "Once" ? key : key.replace(/Once$/, "");
|
|
3414
3533
|
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
3534
|
}
|
|
3416
3535
|
//#endregion
|
|
@@ -3739,7 +3858,7 @@ function baseResolveDefault(factory, instance, key) {
|
|
|
3739
3858
|
const prev = setCurrentInstance(instance);
|
|
3740
3859
|
const props = (0, _vue_reactivity.toRaw)(instance.props);
|
|
3741
3860
|
value = factory.call(null, props);
|
|
3742
|
-
|
|
3861
|
+
restoreCurrentInstance(prev);
|
|
3743
3862
|
return value;
|
|
3744
3863
|
}
|
|
3745
3864
|
const mixinPropsCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -3885,7 +4004,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
3885
4004
|
const receivedType = (0, _vue_shared.toRawType)(value);
|
|
3886
4005
|
const expectedValue = styleValue(value, expectedType);
|
|
3887
4006
|
const receivedValue = styleValue(value, receivedType);
|
|
3888
|
-
if (expectedTypes.length === 1 && isExplicable(expectedType) &&
|
|
4007
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
|
|
3889
4008
|
message += `, got ${receivedType} `;
|
|
3890
4009
|
if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
|
|
3891
4010
|
return message;
|
|
@@ -3894,7 +4013,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
3894
4013
|
* dev only
|
|
3895
4014
|
*/
|
|
3896
4015
|
function styleValue(value, type) {
|
|
3897
|
-
if (
|
|
4016
|
+
if ((0, _vue_shared.isSymbol)(value)) return value.toString();
|
|
4017
|
+
else if (type === "String") return `"${value}"`;
|
|
3898
4018
|
else if (type === "Number") return `${Number(value)}`;
|
|
3899
4019
|
else return `${value}`;
|
|
3900
4020
|
}
|
|
@@ -3911,8 +4031,11 @@ function isExplicable(type) {
|
|
|
3911
4031
|
/**
|
|
3912
4032
|
* dev only
|
|
3913
4033
|
*/
|
|
3914
|
-
function
|
|
3915
|
-
return args.
|
|
4034
|
+
function isCoercible(...args) {
|
|
4035
|
+
return args.every((elem) => {
|
|
4036
|
+
const value = elem.toLowerCase();
|
|
4037
|
+
return value !== "boolean" && value !== "symbol";
|
|
4038
|
+
});
|
|
3916
4039
|
}
|
|
3917
4040
|
//#endregion
|
|
3918
4041
|
//#region packages/runtime-core/src/componentSlots.ts
|
|
@@ -4217,7 +4340,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4217
4340
|
if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
4218
4341
|
if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
4219
4342
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
4220
|
-
if (isHmrUpdating) {
|
|
4343
|
+
if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
|
|
4221
4344
|
patchFlag = 0;
|
|
4222
4345
|
optimized = false;
|
|
4223
4346
|
dynamicChildren = null;
|
|
@@ -4295,21 +4418,37 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4295
4418
|
};
|
|
4296
4419
|
const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
|
|
4297
4420
|
n2.slotScopeIds = slotScopeIds;
|
|
4298
|
-
if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
|
|
4421
|
+
if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
|
|
4299
4422
|
else {
|
|
4423
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
|
|
4300
4424
|
getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
|
|
4301
4425
|
if (n2.dirs) {
|
|
4302
4426
|
invokeDirectiveHook(n2, null, parentComponent, "created");
|
|
4303
4427
|
invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
|
|
4304
4428
|
}
|
|
4429
|
+
}, () => {
|
|
4430
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
|
|
4305
4431
|
});
|
|
4306
4432
|
if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
|
|
4433
|
+
const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
|
|
4434
|
+
if (vnodeMountedHook) {
|
|
4435
|
+
const scopedVNode = n2;
|
|
4436
|
+
queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
|
|
4437
|
+
}
|
|
4307
4438
|
}
|
|
4308
4439
|
else {
|
|
4309
|
-
|
|
4440
|
+
const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
|
|
4441
|
+
getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
|
|
4310
4442
|
if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
4443
|
+
}, () => {
|
|
4444
|
+
const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
|
|
4445
|
+
if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
|
|
4311
4446
|
});
|
|
4312
|
-
|
|
4447
|
+
const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
|
|
4448
|
+
if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
|
|
4449
|
+
n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
|
|
4450
|
+
vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
|
|
4451
|
+
}, void 0, parentSuspense);
|
|
4313
4452
|
}
|
|
4314
4453
|
else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
4315
4454
|
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
@@ -4622,7 +4761,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4622
4761
|
const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
|
|
4623
4762
|
const { el, type, transition, children, shapeFlag } = vnode;
|
|
4624
4763
|
if (isVaporComponent(type) || type === VaporSlot) {
|
|
4625
|
-
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
|
|
4764
|
+
getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
|
|
4626
4765
|
return;
|
|
4627
4766
|
}
|
|
4628
4767
|
if (shapeFlag & 6) {
|
|
@@ -4655,8 +4794,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4655
4794
|
else hostInsert(el, container, anchor);
|
|
4656
4795
|
};
|
|
4657
4796
|
const performLeave = () => {
|
|
4797
|
+
const wasLeaving = el._isLeaving || !!el[leaveCbKey];
|
|
4658
4798
|
if (el._isLeaving) el[leaveCbKey](true);
|
|
4659
|
-
|
|
4799
|
+
if (transition.persisted && !wasLeaving) remove();
|
|
4800
|
+
else leave(el, () => {
|
|
4660
4801
|
remove();
|
|
4661
4802
|
afterLeave && afterLeave();
|
|
4662
4803
|
});
|
|
@@ -4676,7 +4817,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4676
4817
|
}
|
|
4677
4818
|
if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
|
|
4678
4819
|
if (shapeFlag & 256) {
|
|
4679
|
-
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
|
|
4820
|
+
if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
|
|
4680
4821
|
else parentComponent.ctx.deactivate(vnode);
|
|
4681
4822
|
return;
|
|
4682
4823
|
}
|
|
@@ -4686,8 +4827,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4686
4827
|
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4687
4828
|
if (shapeFlag & 6) if (isVaporComponent(type)) {
|
|
4688
4829
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
|
4689
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
4690
|
-
if (
|
|
4830
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
4831
|
+
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
|
|
4832
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
4833
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4834
|
+
}, void 0, parentSuspense);
|
|
4691
4835
|
return;
|
|
4692
4836
|
} else unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
4693
4837
|
else {
|
|
@@ -4700,7 +4844,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4700
4844
|
else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
|
|
4701
4845
|
else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
|
|
4702
4846
|
if (type === VaporSlot) {
|
|
4703
|
-
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
4847
|
+
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
|
|
4704
4848
|
return;
|
|
4705
4849
|
}
|
|
4706
4850
|
if (doRemove) remove(vnode);
|
|
@@ -4748,7 +4892,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4748
4892
|
if (effect) {
|
|
4749
4893
|
effect.stop();
|
|
4750
4894
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
4751
|
-
}
|
|
4895
|
+
} else if (doRemove && subTree && instance.vnode.el) remove(subTree);
|
|
4752
4896
|
if (um) queuePostRenderEffect(um, void 0, parentSuspense);
|
|
4753
4897
|
queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
|
|
4754
4898
|
devtoolsComponentRemoved(instance);
|
|
@@ -4874,6 +5018,10 @@ function invalidateMount(hooks) {
|
|
|
4874
5018
|
if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
|
|
4875
5019
|
}
|
|
4876
5020
|
function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
|
|
5021
|
+
if (force && transition.persisted && !el[leaveCbKey]) {
|
|
5022
|
+
insert();
|
|
5023
|
+
return;
|
|
5024
|
+
}
|
|
4877
5025
|
if (force || needTransition(parentSuspense, transition)) {
|
|
4878
5026
|
transition.beforeEnter(el);
|
|
4879
5027
|
insert();
|
|
@@ -5076,15 +5224,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5076
5224
|
if (suspense.isHydrating) suspense.isHydrating = false;
|
|
5077
5225
|
else if (!resume) {
|
|
5078
5226
|
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
5227
|
+
let hasUpdatedAnchor = false;
|
|
5079
5228
|
if (delayEnter) activeBranch.transition.afterLeave = () => {
|
|
5080
5229
|
if (pendingId === suspense.pendingId) {
|
|
5081
|
-
move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
5230
|
+
move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
5082
5231
|
queuePostFlushCb(effects);
|
|
5083
5232
|
if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
|
|
5084
5233
|
}
|
|
5085
5234
|
};
|
|
5086
5235
|
if (activeBranch && !suspense.isFallbackMountPending) {
|
|
5087
|
-
if (parentNode(activeBranch.el) === container)
|
|
5236
|
+
if (parentNode(activeBranch.el) === container) {
|
|
5237
|
+
anchor = next(activeBranch);
|
|
5238
|
+
hasUpdatedAnchor = true;
|
|
5239
|
+
}
|
|
5088
5240
|
unmount(activeBranch, parentComponent, suspense, true);
|
|
5089
5241
|
if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
|
|
5090
5242
|
}
|
|
@@ -5148,6 +5300,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5148
5300
|
handleError(err, instance, 0);
|
|
5149
5301
|
}).then((asyncSetupResult) => {
|
|
5150
5302
|
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
|
|
5303
|
+
setCurrentInstance(null, void 0);
|
|
5151
5304
|
instance.asyncResolved = true;
|
|
5152
5305
|
onResolve(asyncSetupResult);
|
|
5153
5306
|
if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
|
|
@@ -5437,11 +5590,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
5437
5590
|
el: vnode.el,
|
|
5438
5591
|
anchor: vnode.anchor,
|
|
5439
5592
|
ctx: vnode.ctx,
|
|
5440
|
-
ce: vnode.ce
|
|
5593
|
+
ce: vnode.ce,
|
|
5594
|
+
vi: vnode.vi,
|
|
5595
|
+
vs: cloneVaporSlotMeta(vnode),
|
|
5596
|
+
vb: vnode.vb
|
|
5441
5597
|
};
|
|
5442
5598
|
if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
|
|
5443
5599
|
return cloned;
|
|
5444
5600
|
}
|
|
5601
|
+
function cloneVaporSlotMeta(vnode) {
|
|
5602
|
+
const vaporSlot = vnode.vs;
|
|
5603
|
+
if (!vaporSlot) return vaporSlot;
|
|
5604
|
+
const cloned = {
|
|
5605
|
+
slot: vaporSlot.slot,
|
|
5606
|
+
fallback: vaporSlot.fallback,
|
|
5607
|
+
outletFallback: vaporSlot.outletFallback
|
|
5608
|
+
};
|
|
5609
|
+
if (vnode.el) {
|
|
5610
|
+
cloned.state = vaporSlot.state;
|
|
5611
|
+
cloned.ref = vaporSlot.ref;
|
|
5612
|
+
cloned.scope = vaporSlot.scope;
|
|
5613
|
+
}
|
|
5614
|
+
return cloned;
|
|
5615
|
+
}
|
|
5445
5616
|
/**
|
|
5446
5617
|
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
5447
5618
|
* https://github.com/vitejs/vite/issues/2022
|
|
@@ -5504,6 +5675,10 @@ function normalizeChildren(vnode, children) {
|
|
|
5504
5675
|
}
|
|
5505
5676
|
}
|
|
5506
5677
|
else if ((0, _vue_shared.isFunction)(children)) {
|
|
5678
|
+
if (shapeFlag & 65) {
|
|
5679
|
+
normalizeChildren(vnode, { default: children });
|
|
5680
|
+
return;
|
|
5681
|
+
}
|
|
5507
5682
|
children = {
|
|
5508
5683
|
default: children,
|
|
5509
5684
|
_ctx: currentRenderingInstance
|
|
@@ -5576,6 +5751,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
|
|
|
5576
5751
|
simpleSetCurrentInstance(instance);
|
|
5577
5752
|
}
|
|
5578
5753
|
};
|
|
5754
|
+
/**
|
|
5755
|
+
* Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
|
|
5756
|
+
* `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
|
|
5757
|
+
* verbatim instead of re-triggering the `instance.scope` default.
|
|
5758
|
+
* @internal
|
|
5759
|
+
*/
|
|
5760
|
+
const restoreCurrentInstance = (prev) => {
|
|
5761
|
+
(0, _vue_reactivity.setCurrentScope)(prev[1]);
|
|
5762
|
+
simpleSetCurrentInstance(prev[0]);
|
|
5763
|
+
};
|
|
5579
5764
|
const internalOptions = [
|
|
5580
5765
|
"ce",
|
|
5581
5766
|
"type",
|
|
@@ -5727,7 +5912,7 @@ function setupStatefulComponent(instance, isSSR) {
|
|
|
5727
5912
|
const setupResult = callWithErrorHandling(setup, instance, 0, [(0, _vue_reactivity.shallowReadonly)(instance.props), setupContext]);
|
|
5728
5913
|
const isAsyncSetup = (0, _vue_shared.isPromise)(setupResult);
|
|
5729
5914
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
5730
|
-
|
|
5915
|
+
restoreCurrentInstance(prev);
|
|
5731
5916
|
if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
|
|
5732
5917
|
if (isAsyncSetup) {
|
|
5733
5918
|
const unsetCurrentInstance = () => {
|
|
@@ -5797,7 +5982,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
|
|
|
5797
5982
|
applyOptions(instance);
|
|
5798
5983
|
} finally {
|
|
5799
5984
|
(0, _vue_reactivity.setActiveSub)(prevSub);
|
|
5800
|
-
|
|
5985
|
+
restoreCurrentInstance(prevInstance);
|
|
5801
5986
|
}
|
|
5802
5987
|
}
|
|
5803
5988
|
if (!Component.render && instance.render === _vue_shared.NOOP && !isSSR) if (!compile && Component.template)
|
|
@@ -6107,7 +6292,7 @@ function isMemoSame(cached, memo) {
|
|
|
6107
6292
|
}
|
|
6108
6293
|
//#endregion
|
|
6109
6294
|
//#region packages/runtime-core/src/index.ts
|
|
6110
|
-
const version = "3.6.0-
|
|
6295
|
+
const version = "3.6.0-rc.2";
|
|
6111
6296
|
const warn = warn$1;
|
|
6112
6297
|
/**
|
|
6113
6298
|
* Runtime error messages. Only exposed in dev or esm builds.
|