@vue/runtime-core 3.6.0-beta.8 → 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 +362 -158
- package/dist/runtime-core.cjs.prod.js +274 -108
- package/dist/runtime-core.d.ts +24 -13
- package/dist/runtime-core.esm-bundler.js +367 -162
- 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);
|
|
@@ -402,6 +403,13 @@ function checkRecursiveUpdates(seen, fn) {
|
|
|
402
403
|
//#endregion
|
|
403
404
|
//#region packages/runtime-core/src/hmr.ts
|
|
404
405
|
let isHmrUpdating = false;
|
|
406
|
+
const setHmrUpdating = (v) => {
|
|
407
|
+
try {
|
|
408
|
+
return isHmrUpdating;
|
|
409
|
+
} finally {
|
|
410
|
+
isHmrUpdating = v;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
405
413
|
const hmrDirtyComponents = /* @__PURE__ */ new Map();
|
|
406
414
|
const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
|
|
407
415
|
(0, _vue_shared.getGlobalThis)().__VUE_HMR_RUNTIME__ = {
|
|
@@ -433,6 +441,14 @@ function createRecord(id, initialDef) {
|
|
|
433
441
|
function normalizeClassComponent(component) {
|
|
434
442
|
return isClassComponent(component) ? component.__vccOpts : component;
|
|
435
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
|
+
}
|
|
436
452
|
function rerender(id, newRender) {
|
|
437
453
|
const record = map.get(id);
|
|
438
454
|
if (!record) return;
|
|
@@ -464,42 +480,69 @@ function reload(id, newComp) {
|
|
|
464
480
|
const isVapor = record.initialDef.__vapor;
|
|
465
481
|
updateComponentDef(record.initialDef, newComp);
|
|
466
482
|
const instances = [...record.instances];
|
|
467
|
-
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)) {
|
|
468
484
|
for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
const
|
|
472
|
-
let dirtyInstances = hmrDirtyComponents.get(oldComp);
|
|
473
|
-
if (!dirtyInstances) {
|
|
474
|
-
if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
|
|
475
|
-
hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
|
|
476
|
-
}
|
|
477
|
-
dirtyInstances.add(instance);
|
|
478
|
-
hmrDirtyComponentsMode.set(oldComp, !!isVapor);
|
|
479
|
-
instance.appContext.propsCache.delete(instance.type);
|
|
480
|
-
instance.appContext.emitsCache.delete(instance.type);
|
|
481
|
-
instance.appContext.optionsCache.delete(instance.type);
|
|
482
|
-
if (instance.ceReload) {
|
|
483
|
-
dirtyInstances.add(instance);
|
|
484
|
-
instance.ceReload(newComp.styles);
|
|
485
|
-
dirtyInstances.delete(instance);
|
|
486
|
-
} else if (instance.parent) queueJob(() => {
|
|
487
|
-
isHmrUpdating = true;
|
|
485
|
+
const dirtyInstances = new Set(instances);
|
|
486
|
+
const rerenderedParents = /* @__PURE__ */ new Set();
|
|
487
|
+
for (const instance of instances) {
|
|
488
488
|
const parent = instance.parent;
|
|
489
|
-
if (parent
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
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());
|
|
493
505
|
}
|
|
494
|
-
|
|
495
|
-
|
|
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
|
+
});
|
|
496
544
|
});
|
|
497
|
-
dirtyInstances.delete(instance);
|
|
498
545
|
});
|
|
499
|
-
else if (instance.appContext.reload) instance.appContext.reload();
|
|
500
|
-
else if (typeof window !== "undefined") window.location.reload();
|
|
501
|
-
else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
|
|
502
|
-
if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
|
|
503
546
|
}
|
|
504
547
|
queuePostFlushCb(() => {
|
|
505
548
|
hmrDirtyComponents.clear();
|
|
@@ -642,10 +685,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
|
|
|
642
685
|
const renderFnWithContext = (...args) => {
|
|
643
686
|
if (renderFnWithContext._d) setBlockTracking(-1);
|
|
644
687
|
const prevInstance = setCurrentRenderingInstance(ctx);
|
|
688
|
+
const prevStackSize = blockStack.length;
|
|
645
689
|
let res;
|
|
646
690
|
try {
|
|
647
691
|
res = fn(...args);
|
|
648
692
|
} finally {
|
|
693
|
+
for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
|
|
649
694
|
setCurrentRenderingInstance(prevInstance);
|
|
650
695
|
if (renderFnWithContext._d) setBlockTracking(1);
|
|
651
696
|
}
|
|
@@ -851,6 +896,7 @@ function createPathGetter(ctx, path) {
|
|
|
851
896
|
}
|
|
852
897
|
//#endregion
|
|
853
898
|
//#region packages/runtime-core/src/components/Teleport.ts
|
|
899
|
+
const pendingMounts = /* @__PURE__ */ new WeakMap();
|
|
854
900
|
const TeleportEndKey = Symbol("_vte");
|
|
855
901
|
const isTeleport = (type) => type.__isTeleport;
|
|
856
902
|
const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
|
|
@@ -876,55 +922,68 @@ const TeleportImpl = {
|
|
|
876
922
|
name: "Teleport",
|
|
877
923
|
__isTeleport: true,
|
|
878
924
|
process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
|
|
879
|
-
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;
|
|
880
926
|
const disabled = isTeleportDisabled(n2.props);
|
|
881
|
-
let {
|
|
927
|
+
let { dynamicChildren } = n2;
|
|
882
928
|
if (isHmrUpdating) {
|
|
883
929
|
optimized = false;
|
|
884
930
|
dynamicChildren = null;
|
|
885
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
|
+
};
|
|
886
962
|
if (n1 == null) {
|
|
887
963
|
const placeholder = n2.el = createComment("teleport start");
|
|
888
964
|
const mainAnchor = n2.anchor = createComment("teleport end");
|
|
889
965
|
insert(placeholder, container, anchor);
|
|
890
966
|
insert(mainAnchor, container, anchor);
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
const target = n2.target = resolveTarget(n2.props, querySelector);
|
|
896
|
-
const targetAnchor = prepareAnchor(target, n2, createText, insert);
|
|
897
|
-
if (target) {
|
|
898
|
-
if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
|
|
899
|
-
else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
|
|
900
|
-
if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
|
|
901
|
-
if (!disabled) {
|
|
902
|
-
mount(target, targetAnchor);
|
|
903
|
-
updateCssVars(n2, false);
|
|
904
|
-
}
|
|
905
|
-
} else if (!disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
|
|
906
|
-
};
|
|
967
|
+
if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
|
|
968
|
+
queuePendingMount(n2);
|
|
969
|
+
return;
|
|
970
|
+
}
|
|
907
971
|
if (disabled) {
|
|
908
|
-
mount(container, mainAnchor);
|
|
972
|
+
mount(n2, container, mainAnchor);
|
|
909
973
|
updateCssVars(n2, true);
|
|
910
974
|
}
|
|
911
|
-
|
|
912
|
-
n2.el.__isMounted = false;
|
|
913
|
-
queuePostRenderEffect(() => {
|
|
914
|
-
mountToTarget();
|
|
915
|
-
delete n2.el.__isMounted;
|
|
916
|
-
}, void 0, parentSuspense);
|
|
917
|
-
} else mountToTarget();
|
|
975
|
+
mountToTarget();
|
|
918
976
|
} else {
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
977
|
+
n2.el = n1.el;
|
|
978
|
+
const mainAnchor = n2.anchor = n1.anchor;
|
|
979
|
+
const pendingMount = pendingMounts.get(n1);
|
|
980
|
+
if (pendingMount) {
|
|
981
|
+
pendingMount.flags |= 4;
|
|
982
|
+
pendingMounts.delete(n1);
|
|
983
|
+
queuePendingMount(n2);
|
|
923
984
|
return;
|
|
924
985
|
}
|
|
925
|
-
n2.el = n1.el;
|
|
926
986
|
n2.targetStart = n1.targetStart;
|
|
927
|
-
const mainAnchor = n2.anchor = n1.anchor;
|
|
928
987
|
const target = n2.target = n1.target;
|
|
929
988
|
const targetAnchor = n2.targetAnchor = n1.targetAnchor;
|
|
930
989
|
const wasDisabled = isTeleportDisabled(n1.props);
|
|
@@ -940,26 +999,30 @@ const TeleportImpl = {
|
|
|
940
999
|
if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
|
|
941
1000
|
else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
|
|
942
1001
|
} else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
|
|
943
|
-
const nextTarget =
|
|
944
|
-
if (nextTarget)
|
|
945
|
-
|
|
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})`);
|
|
946
1007
|
} else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
|
|
947
1008
|
updateCssVars(n2, disabled);
|
|
948
1009
|
}
|
|
949
1010
|
},
|
|
950
1011
|
remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
|
|
951
1012
|
const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
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
|
+
}
|
|
1020
|
+
if (targetStart) hostRemove(targetStart);
|
|
1021
|
+
if (targetAnchor) hostRemove(targetAnchor);
|
|
956
1022
|
doRemove && hostRemove(anchor);
|
|
957
|
-
if (shapeFlag & 16) {
|
|
958
|
-
const
|
|
959
|
-
|
|
960
|
-
const child = children[i];
|
|
961
|
-
unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
|
|
962
|
-
}
|
|
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);
|
|
963
1026
|
}
|
|
964
1027
|
},
|
|
965
1028
|
move: moveTeleport,
|
|
@@ -970,7 +1033,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
|
|
|
970
1033
|
const { el, anchor, shapeFlag, children, props } = vnode;
|
|
971
1034
|
const isReorder = moveType === 2;
|
|
972
1035
|
if (isReorder) insert(el, container, parentAnchor);
|
|
973
|
-
if (!isReorder || isTeleportDisabled(props)) {
|
|
1036
|
+
if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
|
|
974
1037
|
if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
|
|
975
1038
|
}
|
|
976
1039
|
if (isReorder) insert(anchor, container, parentAnchor);
|
|
@@ -1095,8 +1158,8 @@ const BaseTransitionImpl = {
|
|
|
1095
1158
|
const state = useTransitionState();
|
|
1096
1159
|
return () => {
|
|
1097
1160
|
const children = slots.default && getTransitionRawChildren(slots.default(), true);
|
|
1098
|
-
|
|
1099
|
-
|
|
1161
|
+
const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
|
|
1162
|
+
if (!child) return;
|
|
1100
1163
|
const rawProps = (0, _vue_reactivity.toRaw)(props);
|
|
1101
1164
|
const { mode } = rawProps;
|
|
1102
1165
|
checkTransitionMode(mode);
|
|
@@ -1211,7 +1274,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
|
|
|
1211
1274
|
callHook(hook, [el]);
|
|
1212
1275
|
},
|
|
1213
1276
|
enter(el) {
|
|
1214
|
-
if (isLeaving()) return;
|
|
1277
|
+
if (!isHmrUpdating && isLeaving()) return;
|
|
1215
1278
|
let hook = onEnter;
|
|
1216
1279
|
let afterHook = onAfterEnter;
|
|
1217
1280
|
let cancelHook = onEnterCancelled;
|
|
@@ -1548,7 +1611,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1548
1611
|
else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1549
1612
|
break;
|
|
1550
1613
|
case VaporSlot:
|
|
1551
|
-
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
|
|
1614
|
+
nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
|
|
1552
1615
|
break;
|
|
1553
1616
|
default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
|
|
1554
1617
|
else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
@@ -1558,16 +1621,31 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1558
1621
|
if (isFragmentStart) nextNode = locateClosingAnchor(node);
|
|
1559
1622
|
else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
|
|
1560
1623
|
else nextNode = nextSibling(node);
|
|
1561
|
-
if (vnode.type.__vapor)
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
}
|
|
1569
|
-
|
|
1570
|
-
|
|
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
|
+
}
|
|
1571
1649
|
}
|
|
1572
1650
|
} else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
|
|
1573
1651
|
else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
|
|
@@ -1579,7 +1657,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1579
1657
|
};
|
|
1580
1658
|
const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
|
|
1581
1659
|
optimized = optimized || !!vnode.dynamicChildren;
|
|
1582
|
-
const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1660
|
+
const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
|
|
1583
1661
|
const forcePatch = type === "input" || type === "option";
|
|
1584
1662
|
{
|
|
1585
1663
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
|
|
@@ -1597,15 +1675,11 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1597
1675
|
}
|
|
1598
1676
|
if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
|
|
1599
1677
|
let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1600
|
-
|
|
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
|
+
}
|
|
1601
1682
|
while (next) {
|
|
1602
|
-
if (!isMismatchAllowed(el, 1)) {
|
|
1603
|
-
if (!hasWarned) {
|
|
1604
|
-
warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
|
|
1605
|
-
hasWarned = true;
|
|
1606
|
-
}
|
|
1607
|
-
logMismatchError();
|
|
1608
|
-
}
|
|
1609
1683
|
const cur = next;
|
|
1610
1684
|
next = next.nextSibling;
|
|
1611
1685
|
remove(cur);
|
|
@@ -1624,9 +1698,10 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1624
1698
|
}
|
|
1625
1699
|
if (props) {
|
|
1626
1700
|
const isCustomElement = el.tagName.includes("-");
|
|
1701
|
+
const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
|
|
1627
1702
|
for (const key in props) {
|
|
1628
1703
|
if (!(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
|
|
1629
|
-
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);
|
|
1630
1705
|
}
|
|
1631
1706
|
}
|
|
1632
1707
|
let vnodeHooks;
|
|
@@ -1644,7 +1719,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1644
1719
|
optimized = optimized || !!parentVNode.dynamicChildren;
|
|
1645
1720
|
const children = parentVNode.children;
|
|
1646
1721
|
const l = children.length;
|
|
1647
|
-
let
|
|
1722
|
+
let hasCheckedMismatch = false;
|
|
1648
1723
|
for (let i = 0; i < l; i++) {
|
|
1649
1724
|
const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
|
|
1650
1725
|
const isText = vnode.type === Text;
|
|
@@ -1658,12 +1733,12 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1658
1733
|
node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
|
|
1659
1734
|
} else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
|
|
1660
1735
|
else {
|
|
1661
|
-
if (!
|
|
1662
|
-
|
|
1736
|
+
if (!hasCheckedMismatch) {
|
|
1737
|
+
hasCheckedMismatch = true;
|
|
1738
|
+
if (!isMismatchAllowed(container, 1)) {
|
|
1663
1739
|
warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
|
|
1664
|
-
|
|
1740
|
+
logMismatchError();
|
|
1665
1741
|
}
|
|
1666
|
-
logMismatchError();
|
|
1667
1742
|
}
|
|
1668
1743
|
patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
|
|
1669
1744
|
}
|
|
@@ -1683,7 +1758,7 @@ function createHydrationFunctions(rendererInternals) {
|
|
|
1683
1758
|
}
|
|
1684
1759
|
};
|
|
1685
1760
|
const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
|
|
1686
|
-
if (!
|
|
1761
|
+
if (!isNodeMismatchAllowed(node, vnode)) {
|
|
1687
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);
|
|
1688
1763
|
logMismatchError();
|
|
1689
1764
|
}
|
|
@@ -1847,7 +1922,9 @@ const MismatchTypeString = {
|
|
|
1847
1922
|
};
|
|
1848
1923
|
function isMismatchAllowed(el, allowedType) {
|
|
1849
1924
|
if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
|
|
1850
|
-
|
|
1925
|
+
return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
|
|
1926
|
+
}
|
|
1927
|
+
function isMismatchAllowedByAttr(allowedAttr, allowedType) {
|
|
1851
1928
|
if (allowedAttr == null) return false;
|
|
1852
1929
|
else if (allowedAttr === "") return true;
|
|
1853
1930
|
else {
|
|
@@ -1856,6 +1933,16 @@ function isMismatchAllowed(el, allowedType) {
|
|
|
1856
1933
|
return list.includes(MismatchTypeString[allowedType]);
|
|
1857
1934
|
}
|
|
1858
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
|
+
}
|
|
1859
1946
|
//#endregion
|
|
1860
1947
|
//#region packages/runtime-core/src/hydrationStrategies.ts
|
|
1861
1948
|
let requestIdleCallback;
|
|
@@ -1974,11 +2061,16 @@ function defineAsyncComponent(source) {
|
|
|
1974
2061
|
onError(err);
|
|
1975
2062
|
return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
|
|
1976
2063
|
});
|
|
1977
|
-
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
|
|
2064
|
+
const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
|
|
1978
2065
|
load().then(() => {
|
|
2066
|
+
if (instance.isUnmounted) return;
|
|
1979
2067
|
loaded.value = true;
|
|
1980
2068
|
if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
|
|
1981
2069
|
}).catch((err) => {
|
|
2070
|
+
if (instance.isUnmounted) {
|
|
2071
|
+
setPendingRequest(null);
|
|
2072
|
+
return;
|
|
2073
|
+
}
|
|
1982
2074
|
onError(err);
|
|
1983
2075
|
error.value = err;
|
|
1984
2076
|
});
|
|
@@ -2036,14 +2128,22 @@ function createAsyncComponentContext(source) {
|
|
|
2036
2128
|
setPendingRequest: (request) => pendingRequest = request
|
|
2037
2129
|
};
|
|
2038
2130
|
}
|
|
2039
|
-
const useAsyncComponentState = (delay, timeout, onError) => {
|
|
2131
|
+
const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
|
|
2040
2132
|
const loaded = (0, _vue_reactivity.ref)(false);
|
|
2041
2133
|
const error = (0, _vue_reactivity.ref)();
|
|
2042
2134
|
const delayed = (0, _vue_reactivity.ref)(!!delay);
|
|
2043
|
-
|
|
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;
|
|
2044
2143
|
delayed.value = false;
|
|
2045
2144
|
}, delay);
|
|
2046
|
-
if (timeout != null) setTimeout(() => {
|
|
2145
|
+
if (timeout != null) timeoutTimer = setTimeout(() => {
|
|
2146
|
+
if (instance && instance.isUnmounted) return;
|
|
2047
2147
|
if (!loaded.value && !error.value) {
|
|
2048
2148
|
const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
|
|
2049
2149
|
onError(err);
|
|
@@ -2061,6 +2161,7 @@ const useAsyncComponentState = (delay, timeout, onError) => {
|
|
|
2061
2161
|
* @internal
|
|
2062
2162
|
*/
|
|
2063
2163
|
function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
|
|
2164
|
+
const wasConnected = el.isConnected;
|
|
2064
2165
|
let patched = false;
|
|
2065
2166
|
(instance.bu || (instance.bu = [])).push(() => patched = true);
|
|
2066
2167
|
const performHydrate = () => {
|
|
@@ -2071,6 +2172,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
|
|
|
2071
2172
|
}
|
|
2072
2173
|
return;
|
|
2073
2174
|
}
|
|
2175
|
+
if (!el.parentNode || wasConnected && !el.isConnected) return;
|
|
2074
2176
|
hydrate();
|
|
2075
2177
|
};
|
|
2076
2178
|
const doHydrate = hydrateStrategy ? () => {
|
|
@@ -2440,8 +2542,9 @@ function createSlots(slots, dynamicSlots) {
|
|
|
2440
2542
|
* Compiler runtime helper for rendering `<slot/>`
|
|
2441
2543
|
* @private
|
|
2442
2544
|
*/
|
|
2443
|
-
function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
2545
|
+
function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
|
|
2444
2546
|
let slot = slots[name];
|
|
2547
|
+
if (fallback) fallback.__vdom = true;
|
|
2445
2548
|
const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
|
|
2446
2549
|
if (vaporSlot) {
|
|
2447
2550
|
const ret = (openBlock(), createBlock(VaporSlot, props));
|
|
@@ -2449,25 +2552,35 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
|
|
|
2449
2552
|
slot: vaporSlot,
|
|
2450
2553
|
fallback
|
|
2451
2554
|
};
|
|
2555
|
+
if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
|
|
2452
2556
|
return ret;
|
|
2453
2557
|
}
|
|
2454
2558
|
if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
|
|
2455
|
-
const
|
|
2456
|
-
|
|
2457
|
-
|
|
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);
|
|
2458
2563
|
}
|
|
2459
2564
|
if (slot && slot.length > 1) {
|
|
2460
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.");
|
|
2461
2566
|
slot = () => [];
|
|
2462
2567
|
}
|
|
2463
2568
|
if (slot && slot._c) slot._d = false;
|
|
2569
|
+
const prevStackSize = blockStack.length;
|
|
2464
2570
|
openBlock();
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
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
|
+
}
|
|
2469
2583
|
if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
|
|
2470
|
-
if (slot && slot._c) slot._d = true;
|
|
2471
2584
|
return rendered;
|
|
2472
2585
|
}
|
|
2473
2586
|
function ensureValidVNode(vnodes) {
|
|
@@ -2480,9 +2593,7 @@ function ensureValidVNode(vnodes) {
|
|
|
2480
2593
|
}
|
|
2481
2594
|
function ensureVaporSlotFallback(vnodes, fallback) {
|
|
2482
2595
|
let vaporSlot;
|
|
2483
|
-
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs))
|
|
2484
|
-
if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
|
|
2485
|
-
}
|
|
2596
|
+
if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
|
|
2486
2597
|
}
|
|
2487
2598
|
//#endregion
|
|
2488
2599
|
//#region packages/runtime-core/src/helpers/toHandlers.ts
|
|
@@ -2848,26 +2959,39 @@ function createPropsRestProxy(props, excludedKeys) {
|
|
|
2848
2959
|
function withAsyncContext(getAwaitable) {
|
|
2849
2960
|
const ctx = getCurrentGenericInstance();
|
|
2850
2961
|
const inSSRSetup = isInSSRComponentSetup;
|
|
2962
|
+
const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
|
|
2851
2963
|
if (!ctx) warn$1("withAsyncContext called without active current instance. This is likely a bug.");
|
|
2852
2964
|
let awaitable = getAwaitable();
|
|
2853
2965
|
setCurrentInstance(null, void 0);
|
|
2854
2966
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2855
2967
|
const restore = () => {
|
|
2968
|
+
const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
|
|
2856
2969
|
setCurrentInstance(ctx);
|
|
2857
2970
|
if (inSSRSetup) setInSSRSetupState(true);
|
|
2971
|
+
const reset = restoreAsyncContext && restoreAsyncContext();
|
|
2972
|
+
return () => {
|
|
2973
|
+
if (reset) reset();
|
|
2974
|
+
if (resetStoppedScope) resetStoppedScope.reset();
|
|
2975
|
+
};
|
|
2858
2976
|
};
|
|
2859
2977
|
const cleanup = () => {
|
|
2860
2978
|
setCurrentInstance(null, void 0);
|
|
2861
2979
|
if (inSSRSetup) setInSSRSetupState(false);
|
|
2862
2980
|
};
|
|
2863
2981
|
if ((0, _vue_shared.isPromise)(awaitable)) awaitable = awaitable.catch((e) => {
|
|
2864
|
-
restore();
|
|
2865
|
-
Promise.resolve().then(() => Promise.resolve().then(
|
|
2982
|
+
const reset = restore();
|
|
2983
|
+
Promise.resolve().then(() => Promise.resolve().then(() => {
|
|
2984
|
+
if (reset) reset();
|
|
2985
|
+
cleanup();
|
|
2986
|
+
}));
|
|
2866
2987
|
throw e;
|
|
2867
2988
|
});
|
|
2868
2989
|
return [awaitable, () => {
|
|
2869
|
-
restore();
|
|
2870
|
-
Promise.resolve().then(
|
|
2990
|
+
const reset = restore();
|
|
2991
|
+
Promise.resolve().then(() => {
|
|
2992
|
+
if (reset) reset();
|
|
2993
|
+
cleanup();
|
|
2994
|
+
});
|
|
2871
2995
|
}];
|
|
2872
2996
|
}
|
|
2873
2997
|
//#endregion
|
|
@@ -3292,12 +3416,13 @@ function useModel(props, name, options = _vue_shared.EMPTY_OBJ) {
|
|
|
3292
3416
|
for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
|
|
3293
3417
|
else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
|
|
3294
3418
|
}
|
|
3295
|
-
|
|
3419
|
+
const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
|
|
3420
|
+
if (!hasVModel) {
|
|
3296
3421
|
localValue = value;
|
|
3297
3422
|
trigger();
|
|
3298
3423
|
}
|
|
3299
3424
|
i.emit(`update:${name}`, emittedValue);
|
|
3300
|
-
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();
|
|
3301
3426
|
prevSetValue = value;
|
|
3302
3427
|
prevEmittedValue = emittedValue;
|
|
3303
3428
|
}
|
|
@@ -3404,7 +3529,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
|
|
|
3404
3529
|
*/
|
|
3405
3530
|
function isEmitListener(options, key) {
|
|
3406
3531
|
if (!options || !(0, _vue_shared.isOn)(key)) return false;
|
|
3407
|
-
key = key.slice(2)
|
|
3532
|
+
key = key.slice(2);
|
|
3533
|
+
key = key === "Once" ? key : key.replace(/Once$/, "");
|
|
3408
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);
|
|
3409
3535
|
}
|
|
3410
3536
|
//#endregion
|
|
@@ -3588,15 +3714,19 @@ function hasPropValueChanged(nextProps, prevProps, key) {
|
|
|
3588
3714
|
if (key === "style" && (0, _vue_shared.isObject)(nextProp) && (0, _vue_shared.isObject)(prevProp)) return !(0, _vue_shared.looseEqual)(nextProp, prevProp);
|
|
3589
3715
|
return nextProp !== prevProp;
|
|
3590
3716
|
}
|
|
3591
|
-
function updateHOCHostEl({ vnode, parent }, el) {
|
|
3717
|
+
function updateHOCHostEl({ vnode, parent, suspense }, el) {
|
|
3592
3718
|
while (parent && !parent.vapor) {
|
|
3593
3719
|
const root = parent.subTree;
|
|
3594
|
-
if (root.suspense && root.suspense.activeBranch === vnode)
|
|
3720
|
+
if (root.suspense && root.suspense.activeBranch === vnode) {
|
|
3721
|
+
root.suspense.vnode.el = root.el = el;
|
|
3722
|
+
vnode = root;
|
|
3723
|
+
}
|
|
3595
3724
|
if (root === vnode) {
|
|
3596
3725
|
(vnode = parent.vnode).el = el;
|
|
3597
3726
|
parent = parent.parent;
|
|
3598
3727
|
} else break;
|
|
3599
3728
|
}
|
|
3729
|
+
if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
|
|
3600
3730
|
}
|
|
3601
3731
|
//#endregion
|
|
3602
3732
|
//#region packages/runtime-core/src/internalObject.ts
|
|
@@ -3875,7 +4005,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
3875
4005
|
const receivedType = (0, _vue_shared.toRawType)(value);
|
|
3876
4006
|
const expectedValue = styleValue(value, expectedType);
|
|
3877
4007
|
const receivedValue = styleValue(value, receivedType);
|
|
3878
|
-
if (expectedTypes.length === 1 && isExplicable(expectedType) &&
|
|
4008
|
+
if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
|
|
3879
4009
|
message += `, got ${receivedType} `;
|
|
3880
4010
|
if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
|
|
3881
4011
|
return message;
|
|
@@ -3884,7 +4014,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
|
|
|
3884
4014
|
* dev only
|
|
3885
4015
|
*/
|
|
3886
4016
|
function styleValue(value, type) {
|
|
3887
|
-
if (
|
|
4017
|
+
if ((0, _vue_shared.isSymbol)(value)) return value.toString();
|
|
4018
|
+
else if (type === "String") return `"${value}"`;
|
|
3888
4019
|
else if (type === "Number") return `${Number(value)}`;
|
|
3889
4020
|
else return `${value}`;
|
|
3890
4021
|
}
|
|
@@ -3901,8 +4032,11 @@ function isExplicable(type) {
|
|
|
3901
4032
|
/**
|
|
3902
4033
|
* dev only
|
|
3903
4034
|
*/
|
|
3904
|
-
function
|
|
3905
|
-
return args.
|
|
4035
|
+
function isCoercible(...args) {
|
|
4036
|
+
return args.every((elem) => {
|
|
4037
|
+
const value = elem.toLowerCase();
|
|
4038
|
+
return value !== "boolean" && value !== "symbol";
|
|
4039
|
+
});
|
|
3906
4040
|
}
|
|
3907
4041
|
//#endregion
|
|
3908
4042
|
//#region packages/runtime-core/src/componentSlots.ts
|
|
@@ -4172,10 +4306,19 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4172
4306
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
|
|
4173
4307
|
if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
|
|
4174
4308
|
else hostInsert(el, container, anchor);
|
|
4175
|
-
if ((vnodeHook = props && props.onVnodeMounted) || dirs)
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4309
|
+
if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
|
|
4310
|
+
const isHmr = isHmrUpdating;
|
|
4311
|
+
queuePostRenderEffect(() => {
|
|
4312
|
+
let prev;
|
|
4313
|
+
prev = setHmrUpdating(isHmr);
|
|
4314
|
+
try {
|
|
4315
|
+
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4316
|
+
dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
|
|
4317
|
+
} finally {
|
|
4318
|
+
setHmrUpdating(prev);
|
|
4319
|
+
}
|
|
4320
|
+
}, void 0, parentSuspense);
|
|
4321
|
+
}
|
|
4179
4322
|
};
|
|
4180
4323
|
const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
|
|
4181
4324
|
if (scopeId) hostSetScopeId(el, scopeId);
|
|
@@ -4198,7 +4341,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4198
4341
|
if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
|
|
4199
4342
|
if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
|
|
4200
4343
|
parentComponent && toggleRecurse(parentComponent, true);
|
|
4201
|
-
if (isHmrUpdating) {
|
|
4344
|
+
if (isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
|
|
4202
4345
|
patchFlag = 0;
|
|
4203
4346
|
optimized = false;
|
|
4204
4347
|
dynamicChildren = null;
|
|
@@ -4278,19 +4421,35 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4278
4421
|
n2.slotScopeIds = slotScopeIds;
|
|
4279
4422
|
if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
|
|
4280
4423
|
else {
|
|
4424
|
+
const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
|
|
4281
4425
|
getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
|
|
4282
4426
|
if (n2.dirs) {
|
|
4283
4427
|
invokeDirectiveHook(n2, null, parentComponent, "created");
|
|
4284
4428
|
invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
|
|
4285
4429
|
}
|
|
4430
|
+
}, () => {
|
|
4431
|
+
if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
|
|
4286
4432
|
});
|
|
4287
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
|
+
}
|
|
4288
4439
|
}
|
|
4289
4440
|
else {
|
|
4290
|
-
|
|
4441
|
+
const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
|
|
4442
|
+
getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
|
|
4291
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);
|
|
4292
4447
|
});
|
|
4293
|
-
|
|
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);
|
|
4294
4453
|
}
|
|
4295
4454
|
else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
|
|
4296
4455
|
else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
|
|
@@ -4636,8 +4795,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4636
4795
|
else hostInsert(el, container, anchor);
|
|
4637
4796
|
};
|
|
4638
4797
|
const performLeave = () => {
|
|
4798
|
+
const wasLeaving = el._isLeaving || !!el[leaveCbKey];
|
|
4639
4799
|
if (el._isLeaving) el[leaveCbKey](true);
|
|
4640
|
-
|
|
4800
|
+
if (transition.persisted && !wasLeaving) remove();
|
|
4801
|
+
else leave(el, () => {
|
|
4641
4802
|
remove();
|
|
4642
4803
|
afterLeave && afterLeave();
|
|
4643
4804
|
});
|
|
@@ -4648,7 +4809,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4648
4809
|
else hostInsert(el, container, anchor);
|
|
4649
4810
|
};
|
|
4650
4811
|
const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
|
|
4651
|
-
const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
|
|
4812
|
+
const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
|
|
4652
4813
|
if (patchFlag === -2) optimized = false;
|
|
4653
4814
|
if (ref != null) {
|
|
4654
4815
|
const prevSub = (0, _vue_reactivity.setActiveSub)();
|
|
@@ -4668,7 +4829,10 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4668
4829
|
if (shapeFlag & 6) if (isVaporComponent(type)) {
|
|
4669
4830
|
if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
|
|
4670
4831
|
getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
|
|
4671
|
-
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);
|
|
4672
4836
|
return;
|
|
4673
4837
|
} else unmountComponent(vnode.component, parentSuspense, doRemove);
|
|
4674
4838
|
else {
|
|
@@ -4686,9 +4850,11 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4686
4850
|
}
|
|
4687
4851
|
if (doRemove) remove(vnode);
|
|
4688
4852
|
}
|
|
4689
|
-
|
|
4853
|
+
const shouldInvalidateMemo = memo != null && cacheIndex == null;
|
|
4854
|
+
if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
|
|
4690
4855
|
vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
|
|
4691
4856
|
shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
|
|
4857
|
+
if (shouldInvalidateMemo) vnode.el = null;
|
|
4692
4858
|
}, void 0, parentSuspense);
|
|
4693
4859
|
};
|
|
4694
4860
|
const remove = (vnode) => {
|
|
@@ -4727,7 +4893,7 @@ function baseCreateRenderer(options, createHydrationFns) {
|
|
|
4727
4893
|
if (effect) {
|
|
4728
4894
|
effect.stop();
|
|
4729
4895
|
unmount(subTree, instance, parentSuspense, doRemove);
|
|
4730
|
-
}
|
|
4896
|
+
} else if (doRemove && subTree && instance.vnode.el) remove(subTree);
|
|
4731
4897
|
if (um) queuePostRenderEffect(um, void 0, parentSuspense);
|
|
4732
4898
|
queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
|
|
4733
4899
|
devtoolsComponentRemoved(instance);
|
|
@@ -4853,6 +5019,10 @@ function invalidateMount(hooks) {
|
|
|
4853
5019
|
if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
|
|
4854
5020
|
}
|
|
4855
5021
|
function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
|
|
5022
|
+
if (force && transition.persisted && !el[leaveCbKey]) {
|
|
5023
|
+
insert();
|
|
5024
|
+
return;
|
|
5025
|
+
}
|
|
4856
5026
|
if (force || needTransition(parentSuspense, transition)) {
|
|
4857
5027
|
transition.beforeEnter(el);
|
|
4858
5028
|
insert();
|
|
@@ -5041,6 +5211,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5041
5211
|
pendingId: suspenseId++,
|
|
5042
5212
|
timeout: typeof timeout === "number" ? timeout : -1,
|
|
5043
5213
|
activeBranch: null,
|
|
5214
|
+
isFallbackMountPending: false,
|
|
5044
5215
|
pendingBranch: null,
|
|
5045
5216
|
isInFallback: !isHydrating,
|
|
5046
5217
|
isHydrating,
|
|
@@ -5054,20 +5225,25 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5054
5225
|
if (suspense.isHydrating) suspense.isHydrating = false;
|
|
5055
5226
|
else if (!resume) {
|
|
5056
5227
|
delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
|
|
5228
|
+
let hasUpdatedAnchor = false;
|
|
5057
5229
|
if (delayEnter) activeBranch.transition.afterLeave = () => {
|
|
5058
5230
|
if (pendingId === suspense.pendingId) {
|
|
5059
|
-
move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
5231
|
+
move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
|
|
5060
5232
|
queuePostFlushCb(effects);
|
|
5061
5233
|
if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
|
|
5062
5234
|
}
|
|
5063
5235
|
};
|
|
5064
|
-
if (activeBranch) {
|
|
5065
|
-
if (parentNode(activeBranch.el) === container)
|
|
5236
|
+
if (activeBranch && !suspense.isFallbackMountPending) {
|
|
5237
|
+
if (parentNode(activeBranch.el) === container) {
|
|
5238
|
+
anchor = next(activeBranch);
|
|
5239
|
+
hasUpdatedAnchor = true;
|
|
5240
|
+
}
|
|
5066
5241
|
unmount(activeBranch, parentComponent, suspense, true);
|
|
5067
5242
|
if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
|
|
5068
5243
|
}
|
|
5069
5244
|
if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
|
|
5070
5245
|
}
|
|
5246
|
+
suspense.isFallbackMountPending = false;
|
|
5071
5247
|
setActiveBranch(suspense, pendingBranch);
|
|
5072
5248
|
suspense.pendingBranch = null;
|
|
5073
5249
|
suspense.isInFallback = false;
|
|
@@ -5097,12 +5273,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5097
5273
|
triggerEvent(vnode, "onFallback");
|
|
5098
5274
|
const anchor = next(activeBranch);
|
|
5099
5275
|
const mountFallback = () => {
|
|
5276
|
+
suspense.isFallbackMountPending = false;
|
|
5100
5277
|
if (!suspense.isInFallback) return;
|
|
5101
5278
|
patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
|
|
5102
5279
|
setActiveBranch(suspense, fallbackVNode);
|
|
5103
5280
|
};
|
|
5104
5281
|
const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
|
|
5105
|
-
if (delayEnter)
|
|
5282
|
+
if (delayEnter) {
|
|
5283
|
+
suspense.isFallbackMountPending = true;
|
|
5284
|
+
activeBranch.transition.afterLeave = mountFallback;
|
|
5285
|
+
}
|
|
5106
5286
|
suspense.isInFallback = true;
|
|
5107
5287
|
unmount(activeBranch, parentComponent, null, true);
|
|
5108
5288
|
if (!delayEnter) mountFallback();
|
|
@@ -5121,6 +5301,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
|
|
|
5121
5301
|
handleError(err, instance, 0);
|
|
5122
5302
|
}).then((asyncSetupResult) => {
|
|
5123
5303
|
if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
|
|
5304
|
+
setCurrentInstance(null, void 0);
|
|
5124
5305
|
instance.asyncResolved = true;
|
|
5125
5306
|
onResolve(asyncSetupResult);
|
|
5126
5307
|
if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
|
|
@@ -5410,11 +5591,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
|
|
|
5410
5591
|
el: vnode.el,
|
|
5411
5592
|
anchor: vnode.anchor,
|
|
5412
5593
|
ctx: vnode.ctx,
|
|
5413
|
-
ce: vnode.ce
|
|
5594
|
+
ce: vnode.ce,
|
|
5595
|
+
vi: vnode.vi,
|
|
5596
|
+
vs: cloneVaporSlotMeta(vnode),
|
|
5597
|
+
vb: vnode.vb
|
|
5414
5598
|
};
|
|
5415
5599
|
if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
|
|
5416
5600
|
return cloned;
|
|
5417
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
|
+
}
|
|
5418
5617
|
/**
|
|
5419
5618
|
* Dev only, for HMR of hoisted vnodes reused in v-for
|
|
5420
5619
|
* https://github.com/vitejs/vite/issues/2022
|
|
@@ -5477,6 +5676,10 @@ function normalizeChildren(vnode, children) {
|
|
|
5477
5676
|
}
|
|
5478
5677
|
}
|
|
5479
5678
|
else if ((0, _vue_shared.isFunction)(children)) {
|
|
5679
|
+
if (shapeFlag & 65) {
|
|
5680
|
+
normalizeChildren(vnode, { default: children });
|
|
5681
|
+
return;
|
|
5682
|
+
}
|
|
5480
5683
|
children = {
|
|
5481
5684
|
default: children,
|
|
5482
5685
|
_ctx: currentRenderingInstance
|
|
@@ -5503,6 +5706,7 @@ function mergeProps(...args) {
|
|
|
5503
5706
|
const existing = ret[key];
|
|
5504
5707
|
const incoming = toMerge[key];
|
|
5505
5708
|
if (incoming && existing !== incoming && !((0, _vue_shared.isArray)(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
|
|
5709
|
+
else if (incoming == null && existing == null && !(0, _vue_shared.isModelListener)(key)) ret[key] = incoming;
|
|
5506
5710
|
} else if (key !== "") ret[key] = toMerge[key];
|
|
5507
5711
|
}
|
|
5508
5712
|
return ret;
|
|
@@ -6079,7 +6283,7 @@ function isMemoSame(cached, memo) {
|
|
|
6079
6283
|
}
|
|
6080
6284
|
//#endregion
|
|
6081
6285
|
//#region packages/runtime-core/src/index.ts
|
|
6082
|
-
const version = "3.6.0-
|
|
6286
|
+
const version = "3.6.0-rc.1";
|
|
6083
6287
|
const warn = warn$1;
|
|
6084
6288
|
/**
|
|
6085
6289
|
* Runtime error messages. Only exposed in dev or esm builds.
|