@vue/runtime-core 3.6.0-beta.9 → 3.6.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-core v3.6.0-beta.9
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
  **/
@@ -279,8 +279,8 @@ function findInsertionIndex(order, queue, start, end) {
279
279
  /**
280
280
  * @internal for runtime-vapor only
281
281
  */
282
- function queueJob(job, id, isPre = false) {
283
- if (queueJobWorker(job, id === void 0 ? isPre ? -2 : Infinity : isPre ? id * 2 : id * 2 + 1, jobs, jobsLength, flushIndex)) {
282
+ function queueJob(job, id, isPre = false, order = 0) {
283
+ 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)) {
284
284
  jobsLength++;
285
285
  queueFlush();
286
286
  }
@@ -389,6 +389,7 @@ function flushJobs(seen) {
389
389
  }
390
390
  flushIndex = 0;
391
391
  jobsLength = 0;
392
+ jobs.length = 0;
392
393
  flushPostFlushCbs(seen);
393
394
  currentFlushPromise = null;
394
395
  if (jobsLength || postJobs.length) flushJobs(seen);
@@ -446,6 +447,14 @@ function createRecord(id, initialDef) {
446
447
  function normalizeClassComponent(component) {
447
448
  return isClassComponent(component) ? component.__vccOpts : component;
448
449
  }
450
+ function hasDirtyAncestor(instance, dirtyInstances) {
451
+ let parent = instance.parent;
452
+ while (parent) {
453
+ if (dirtyInstances.has(parent)) return true;
454
+ parent = parent.parent;
455
+ }
456
+ return false;
457
+ }
449
458
  function rerender(id, newRender) {
450
459
  const record = map.get(id);
451
460
  if (!record) return;
@@ -477,42 +486,69 @@ function reload(id, newComp) {
477
486
  const isVapor = record.initialDef.__vapor;
478
487
  updateComponentDef(record.initialDef, newComp);
479
488
  const instances = [...record.instances];
480
- if (isVapor && newComp.__vapor && !instances.some((i) => i.ceReload)) {
489
+ if (isVapor && newComp.__vapor && !instances.some((instance) => instance.parent && !instance.parent.vapor) && !instances.some((i) => i.ceReload)) {
481
490
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
482
- for (const instance of instances) instance.hmrReload(newComp);
483
- } else for (const instance of instances) {
484
- const oldComp = normalizeClassComponent(instance.type);
485
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
486
- if (!dirtyInstances) {
487
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
488
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
489
- }
490
- dirtyInstances.add(instance);
491
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
492
- instance.appContext.propsCache.delete(instance.type);
493
- instance.appContext.emitsCache.delete(instance.type);
494
- instance.appContext.optionsCache.delete(instance.type);
495
- if (instance.ceReload) {
496
- dirtyInstances.add(instance);
497
- instance.ceReload(newComp.styles);
498
- dirtyInstances.delete(instance);
499
- } else if (instance.parent) queueJob(() => {
500
- isHmrUpdating = true;
491
+ const dirtyInstances = new Set(instances);
492
+ const rerenderedParents = /* @__PURE__ */ new Set();
493
+ for (const instance of instances) {
501
494
  const parent = instance.parent;
502
- if (parent.vapor) parent.hmrRerender();
503
- else if (!(parent.effect.flags & 1024)) {
504
- parent.renderCache = [];
505
- parent.effect.run();
495
+ if (parent) {
496
+ if (!hasDirtyAncestor(instance, dirtyInstances) && !rerenderedParents.has(parent)) {
497
+ rerenderedParents.add(parent);
498
+ parent.hmrRerender();
499
+ }
500
+ } else instance.hmrReload(newComp);
501
+ }
502
+ } else {
503
+ const parentUpdates = /* @__PURE__ */ new Map();
504
+ const dirtyInstanceSet = new Set(instances);
505
+ for (const instance of instances) {
506
+ const oldComp = normalizeClassComponent(instance.type);
507
+ let dirtyInstances = hmrDirtyComponents.get(oldComp);
508
+ if (!dirtyInstances) {
509
+ if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
510
+ hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
506
511
  }
507
- nextTick(() => {
508
- isHmrUpdating = false;
512
+ dirtyInstances.add(instance);
513
+ hmrDirtyComponentsMode.set(oldComp, !!isVapor);
514
+ instance.appContext.propsCache.delete(instance.type);
515
+ instance.appContext.emitsCache.delete(instance.type);
516
+ instance.appContext.optionsCache.delete(instance.type);
517
+ if (instance.ceReload) {
518
+ dirtyInstances.add(instance);
519
+ instance.ceReload(newComp.styles);
520
+ dirtyInstances.delete(instance);
521
+ } else if (instance.parent) {
522
+ const parent = instance.parent;
523
+ if (!hasDirtyAncestor(instance, dirtyInstanceSet)) {
524
+ let updates = parentUpdates.get(parent);
525
+ if (!updates) parentUpdates.set(parent, updates = []);
526
+ updates.push([instance, dirtyInstances]);
527
+ }
528
+ } else if (instance.appContext.reload) instance.appContext.reload();
529
+ else if (typeof window !== "undefined") window.location.reload();
530
+ else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
531
+ if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
532
+ }
533
+ parentUpdates.forEach((updates, parent) => {
534
+ queueJob(() => {
535
+ isHmrUpdating = true;
536
+ if (parent.vapor) parent.hmrRerender();
537
+ else {
538
+ const i = parent;
539
+ if (!(i.effect.flags & 1024)) {
540
+ i.renderCache = [];
541
+ i.effect.run();
542
+ }
543
+ }
544
+ nextTick(() => {
545
+ isHmrUpdating = false;
546
+ });
547
+ updates.forEach(([instance, dirtyInstances]) => {
548
+ dirtyInstances.delete(instance);
549
+ });
509
550
  });
510
- dirtyInstances.delete(instance);
511
551
  });
512
- else if (instance.appContext.reload) instance.appContext.reload();
513
- else if (typeof window !== "undefined") window.location.reload();
514
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
515
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
516
552
  }
517
553
  queuePostFlushCb(() => {
518
554
  hmrDirtyComponents.clear();
@@ -655,10 +691,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
655
691
  const renderFnWithContext = (...args) => {
656
692
  if (renderFnWithContext._d) setBlockTracking(-1);
657
693
  const prevInstance = setCurrentRenderingInstance(ctx);
694
+ const prevStackSize = blockStack.length;
658
695
  let res;
659
696
  try {
660
697
  res = fn(...args);
661
698
  } finally {
699
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
662
700
  setCurrentRenderingInstance(prevInstance);
663
701
  if (renderFnWithContext._d) setBlockTracking(1);
664
702
  }
@@ -866,6 +904,7 @@ function createPathGetter(ctx, path) {
866
904
  }
867
905
  //#endregion
868
906
  //#region packages/runtime-core/src/components/Teleport.ts
907
+ const pendingMounts = /* @__PURE__ */ new WeakMap();
869
908
  const TeleportEndKey = Symbol("_vte");
870
909
  const isTeleport = (type) => type.__isTeleport;
871
910
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
@@ -891,58 +930,70 @@ const TeleportImpl = {
891
930
  name: "Teleport",
892
931
  __isTeleport: true,
893
932
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
894
- const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment } } = internals;
933
+ const { mc: mountChildren, pc: patchChildren, pbc: patchBlockChildren, o: { insert, querySelector, createText, createComment, parentNode } } = internals;
895
934
  const disabled = isTeleportDisabled(n2.props);
896
- let { shapeFlag, children, dynamicChildren } = n2;
935
+ let { dynamicChildren } = n2;
897
936
  if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
898
937
  optimized = false;
899
938
  dynamicChildren = null;
900
939
  }
940
+ const mount = (vnode, container, anchor) => {
941
+ if (vnode.shapeFlag & 16) mountChildren(vnode.children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
942
+ };
943
+ const mountToTarget = (vnode = n2) => {
944
+ const disabled = isTeleportDisabled(vnode.props);
945
+ const target = vnode.target = resolveTarget(vnode.props, querySelector);
946
+ const targetAnchor = prepareAnchor(target, vnode, createText, insert);
947
+ if (target) {
948
+ if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
949
+ else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
950
+ if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
951
+ if (!disabled) {
952
+ mount(vnode, target, targetAnchor);
953
+ updateCssVars(vnode, false);
954
+ }
955
+ } else if (!!(process.env.NODE_ENV !== "production") && !disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
956
+ };
957
+ const queuePendingMount = (vnode) => {
958
+ const mountJob = () => {
959
+ if (pendingMounts.get(vnode) !== mountJob) return;
960
+ pendingMounts.delete(vnode);
961
+ if (isTeleportDisabled(vnode.props)) {
962
+ mount(vnode, parentNode(vnode.el) || container, vnode.anchor);
963
+ updateCssVars(vnode, true);
964
+ }
965
+ mountToTarget(vnode);
966
+ };
967
+ pendingMounts.set(vnode, mountJob);
968
+ queuePostRenderEffect(mountJob, void 0, parentSuspense);
969
+ };
901
970
  if (n1 == null) {
902
971
  const placeholder = n2.el = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createText("");
903
972
  const mainAnchor = n2.anchor = !!(process.env.NODE_ENV !== "production") ? createComment("teleport end") : createText("");
904
973
  insert(placeholder, container, anchor);
905
974
  insert(mainAnchor, container, anchor);
906
- const mount = (container, anchor) => {
907
- if (shapeFlag & 16) mountChildren(children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
908
- };
909
- const mountToTarget = () => {
910
- const target = n2.target = resolveTarget(n2.props, querySelector);
911
- const targetAnchor = prepareAnchor(target, n2, createText, insert);
912
- if (target) {
913
- if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
914
- else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
915
- if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
916
- if (!disabled) {
917
- mount(target, targetAnchor);
918
- updateCssVars(n2, false);
919
- }
920
- } else if (!!(process.env.NODE_ENV !== "production") && !disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
921
- };
975
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
976
+ queuePendingMount(n2);
977
+ return;
978
+ }
922
979
  if (disabled) {
923
- mount(container, mainAnchor);
980
+ mount(n2, container, mainAnchor);
924
981
  updateCssVars(n2, true);
925
982
  }
926
- if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
927
- n2.el.__isMounted = false;
928
- queuePostRenderEffect(() => {
929
- if (n2.el.__isMounted !== false) return;
930
- mountToTarget();
931
- delete n2.el.__isMounted;
932
- }, void 0, parentSuspense);
933
- } else mountToTarget();
983
+ mountToTarget();
934
984
  } else {
935
985
  n2.el = n1.el;
936
- n2.targetStart = n1.targetStart;
937
986
  const mainAnchor = n2.anchor = n1.anchor;
938
- const target = n2.target = n1.target;
939
- const targetAnchor = n2.targetAnchor = n1.targetAnchor;
940
- if (n1.el.__isMounted === false) {
941
- queuePostRenderEffect(() => {
942
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
943
- }, void 0, parentSuspense);
987
+ const pendingMount = pendingMounts.get(n1);
988
+ if (pendingMount) {
989
+ pendingMount.flags |= 4;
990
+ pendingMounts.delete(n1);
991
+ queuePendingMount(n2);
944
992
  return;
945
993
  }
994
+ n2.targetStart = n1.targetStart;
995
+ const target = n2.target = n1.target;
996
+ const targetAnchor = n2.targetAnchor = n1.targetAnchor;
946
997
  const wasDisabled = isTeleportDisabled(n1.props);
947
998
  const currentContainer = wasDisabled ? container : target;
948
999
  const currentAnchor = wasDisabled ? mainAnchor : targetAnchor;
@@ -956,24 +1007,30 @@ const TeleportImpl = {
956
1007
  if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
957
1008
  else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
958
1009
  } else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
959
- const nextTarget = n2.target = resolveTarget(n2.props, querySelector);
960
- if (nextTarget) moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
961
- else if (!!(process.env.NODE_ENV !== "production")) warn$1("Invalid Teleport target on update:", target, `(${typeof target})`);
1010
+ const nextTarget = resolveTarget(n2.props, querySelector);
1011
+ if (nextTarget) {
1012
+ n2.target = nextTarget;
1013
+ moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
1014
+ } else if (!!(process.env.NODE_ENV !== "production")) warn$1("Invalid Teleport target on update:", target, `(${typeof target})`);
962
1015
  } else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
963
1016
  updateCssVars(n2, disabled);
964
1017
  }
965
1018
  },
966
1019
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
967
- const { shapeFlag, children, anchor, targetStart, targetAnchor, props } = vnode;
1020
+ const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
1021
+ const disabled = isTeleportDisabled(props);
1022
+ const shouldRemove = doRemove || !disabled;
1023
+ const pendingMount = pendingMounts.get(vnode);
1024
+ if (pendingMount) {
1025
+ pendingMount.flags |= 4;
1026
+ pendingMounts.delete(vnode);
1027
+ }
968
1028
  if (targetStart) hostRemove(targetStart);
969
1029
  if (targetAnchor) hostRemove(targetAnchor);
970
1030
  doRemove && hostRemove(anchor);
971
- if (shapeFlag & 16) {
972
- const shouldRemove = doRemove || !isTeleportDisabled(props);
973
- for (let i = 0; i < children.length; i++) {
974
- const child = children[i];
975
- unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
976
- }
1031
+ if (!pendingMount && (disabled || target) && shapeFlag & 16) for (let i = 0; i < children.length; i++) {
1032
+ const child = children[i];
1033
+ unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
977
1034
  }
978
1035
  },
979
1036
  move: moveTeleport,
@@ -984,7 +1041,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
984
1041
  const { el, anchor, shapeFlag, children, props } = vnode;
985
1042
  const isReorder = moveType === 2;
986
1043
  if (isReorder) insert(el, container, parentAnchor);
987
- if (!isReorder || isTeleportDisabled(props)) {
1044
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
988
1045
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
989
1046
  }
990
1047
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -1109,8 +1166,8 @@ const BaseTransitionImpl = {
1109
1166
  const state = useTransitionState();
1110
1167
  return () => {
1111
1168
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
1112
- if (!children || !children.length) return;
1113
- const child = findNonCommentChild(children);
1169
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
1170
+ if (!child) return;
1114
1171
  const rawProps = toRaw$1(props);
1115
1172
  const { mode } = rawProps;
1116
1173
  checkTransitionMode(mode);
@@ -1576,7 +1633,7 @@ function createHydrationFunctions(rendererInternals) {
1576
1633
  else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
1577
1634
  break;
1578
1635
  case VaporSlot:
1579
- nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
1636
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
1580
1637
  break;
1581
1638
  default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
1582
1639
  else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -1586,16 +1643,31 @@ function createHydrationFunctions(rendererInternals) {
1586
1643
  if (isFragmentStart) nextNode = locateClosingAnchor(node);
1587
1644
  else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
1588
1645
  else nextNode = nextSibling(node);
1589
- if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, null, parentComponent, parentSuspense);
1590
- else mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
1591
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
1592
- let subTree;
1593
- if (isFragmentStart) {
1594
- subTree = createVNode(Fragment);
1595
- subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
1596
- } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
1597
- subTree.el = node;
1598
- vnode.component.subTree = subTree;
1646
+ if (vnode.type.__vapor) {
1647
+ const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
1648
+ getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
1649
+ if (vnode.dirs) {
1650
+ invokeDirectiveHook(vnode, null, parentComponent, "created");
1651
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
1652
+ }
1653
+ }, () => {
1654
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
1655
+ });
1656
+ if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
1657
+ const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
1658
+ if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
1659
+ } else {
1660
+ mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
1661
+ const component = vnode.component;
1662
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
1663
+ let subTree;
1664
+ if (isFragmentStart) {
1665
+ subTree = createVNode(Fragment);
1666
+ subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
1667
+ } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
1668
+ subTree.el = node;
1669
+ component.subTree = subTree;
1670
+ }
1599
1671
  }
1600
1672
  } else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
1601
1673
  else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
@@ -1607,9 +1679,10 @@ function createHydrationFunctions(rendererInternals) {
1607
1679
  };
1608
1680
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1609
1681
  optimized = optimized || !!vnode.dynamicChildren;
1610
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
1682
+ const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
1611
1683
  const forcePatch = type === "input" || type === "option";
1612
- if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
1684
+ const hasDynamicProps = !!dynamicProps;
1685
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || hasDynamicProps || patchFlag !== -1) {
1613
1686
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
1614
1687
  let needCallTransitionHooks = false;
1615
1688
  if (isTemplateNode(el)) {
@@ -1625,15 +1698,11 @@ function createHydrationFunctions(rendererInternals) {
1625
1698
  }
1626
1699
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
1627
1700
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
1628
- let hasWarned = false;
1701
+ if (next && !isMismatchAllowed(el, 1)) {
1702
+ (process.env.NODE_ENV !== "production" || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
1703
+ logMismatchError();
1704
+ }
1629
1705
  while (next) {
1630
- if (!isMismatchAllowed(el, 1)) {
1631
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
1632
- warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
1633
- hasWarned = true;
1634
- }
1635
- logMismatchError();
1636
- }
1637
1706
  const cur = next;
1638
1707
  next = next.nextSibling;
1639
1708
  remove(cur);
@@ -1651,11 +1720,12 @@ function createHydrationFunctions(rendererInternals) {
1651
1720
  }
1652
1721
  }
1653
1722
  if (props) {
1654
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & 48) {
1723
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || hasDynamicProps || !optimized || patchFlag & 48) {
1655
1724
  const isCustomElement = el.tagName.includes("-");
1725
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
1656
1726
  for (const key in props) {
1657
1727
  if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !(dirs && dirs.some((d) => d.dir.created)) && propHasMismatch(el, key, props[key], vnode, parentComponent)) logMismatchError();
1658
- if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key)) patchProp(el, key, null, props[key], void 0, parentComponent);
1728
+ if (forcePatch && (key.endsWith("value") || key === "indeterminate") || isOn(key) && !isReservedProp(key) || key[0] === "." || isCustomElement && !isReservedProp(key) || dynamicProps && dynamicProps.includes(key)) patchProp(el, key, null, props[key], namespace, parentComponent);
1659
1729
  }
1660
1730
  } else if (props.onClick) patchProp(el, "onClick", null, props.onClick, void 0, parentComponent);
1661
1731
  else if (patchFlag & 4 && isReactive$1(props.style)) for (const key in props.style) props.style[key];
@@ -1675,7 +1745,7 @@ function createHydrationFunctions(rendererInternals) {
1675
1745
  optimized = optimized || !!parentVNode.dynamicChildren;
1676
1746
  const children = parentVNode.children;
1677
1747
  const l = children.length;
1678
- let hasWarned = false;
1748
+ let hasCheckedMismatch = false;
1679
1749
  for (let i = 0; i < l; i++) {
1680
1750
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
1681
1751
  const isText = vnode.type === Text;
@@ -1689,12 +1759,12 @@ function createHydrationFunctions(rendererInternals) {
1689
1759
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
1690
1760
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
1691
1761
  else {
1692
- if (!isMismatchAllowed(container, 1)) {
1693
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
1694
- warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
1695
- hasWarned = true;
1762
+ if (!hasCheckedMismatch) {
1763
+ hasCheckedMismatch = true;
1764
+ if (!isMismatchAllowed(container, 1)) {
1765
+ (process.env.NODE_ENV !== "production" || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
1766
+ logMismatchError();
1696
1767
  }
1697
- logMismatchError();
1698
1768
  }
1699
1769
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
1700
1770
  }
@@ -1714,7 +1784,7 @@ function createHydrationFunctions(rendererInternals) {
1714
1784
  }
1715
1785
  };
1716
1786
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
1717
- if (!isMismatchAllowed(node.parentElement, 1)) {
1787
+ if (!isNodeMismatchAllowed(node, vnode)) {
1718
1788
  (process.env.NODE_ENV !== "production" || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && 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);
1719
1789
  logMismatchError();
1720
1790
  }
@@ -1890,7 +1960,9 @@ const MismatchTypeString = {
1890
1960
  };
1891
1961
  function isMismatchAllowed(el, allowedType) {
1892
1962
  if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
1893
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
1963
+ return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
1964
+ }
1965
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
1894
1966
  if (allowedAttr == null) return false;
1895
1967
  else if (allowedAttr === "") return true;
1896
1968
  else {
@@ -1899,6 +1971,16 @@ function isMismatchAllowed(el, allowedType) {
1899
1971
  return list.includes(MismatchTypeString[allowedType]);
1900
1972
  }
1901
1973
  }
1974
+ function isNodeMismatchAllowed(node, vnode) {
1975
+ return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
1976
+ }
1977
+ function isMismatchAllowedByNode(node) {
1978
+ return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
1979
+ }
1980
+ function isMismatchAllowedByVNode({ props }) {
1981
+ const allowedAttr = props && props[allowMismatchAttr];
1982
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
1983
+ }
1902
1984
  //#endregion
1903
1985
  //#region packages/runtime-core/src/hydrationStrategies.ts
1904
1986
  let requestIdleCallback;
@@ -2017,11 +2099,16 @@ function defineAsyncComponent(source) {
2017
2099
  onError(err);
2018
2100
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
2019
2101
  });
2020
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
2102
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
2021
2103
  load().then(() => {
2104
+ if (instance.isUnmounted) return;
2022
2105
  loaded.value = true;
2023
2106
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
2024
2107
  }).catch((err) => {
2108
+ if (instance.isUnmounted) {
2109
+ setPendingRequest(null);
2110
+ return;
2111
+ }
2025
2112
  onError(err);
2026
2113
  error.value = err;
2027
2114
  });
@@ -2079,14 +2166,22 @@ function createAsyncComponentContext(source) {
2079
2166
  setPendingRequest: (request) => pendingRequest = request
2080
2167
  };
2081
2168
  }
2082
- const useAsyncComponentState = (delay, timeout, onError) => {
2169
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
2083
2170
  const loaded = ref$1(false);
2084
2171
  const error = ref$1();
2085
2172
  const delayed = ref$1(!!delay);
2086
- if (delay) setTimeout(() => {
2173
+ let timeoutTimer;
2174
+ let delayTimer;
2175
+ if (instance) onUnmounted(() => {
2176
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
2177
+ if (delayTimer != null) clearTimeout(delayTimer);
2178
+ }, instance);
2179
+ if (delay) delayTimer = setTimeout(() => {
2180
+ if (instance && instance.isUnmounted) return;
2087
2181
  delayed.value = false;
2088
2182
  }, delay);
2089
- if (timeout != null) setTimeout(() => {
2183
+ if (timeout != null) timeoutTimer = setTimeout(() => {
2184
+ if (instance && instance.isUnmounted) return;
2090
2185
  if (!loaded.value && !error.value) {
2091
2186
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
2092
2187
  onError(err);
@@ -2104,6 +2199,7 @@ const useAsyncComponentState = (delay, timeout, onError) => {
2104
2199
  * @internal
2105
2200
  */
2106
2201
  function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
2202
+ const wasConnected = el.isConnected;
2107
2203
  let patched = false;
2108
2204
  (instance.bu || (instance.bu = [])).push(() => patched = true);
2109
2205
  const performHydrate = () => {
@@ -2114,6 +2210,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
2114
2210
  }
2115
2211
  return;
2116
2212
  }
2213
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
2117
2214
  hydrate();
2118
2215
  };
2119
2216
  const doHydrate = hydrateStrategy ? () => {
@@ -2483,8 +2580,9 @@ function createSlots(slots, dynamicSlots) {
2483
2580
  * Compiler runtime helper for rendering `<slot/>`
2484
2581
  * @private
2485
2582
  */
2486
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2583
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
2487
2584
  let slot = slots[name];
2585
+ if (fallback) fallback.__vdom = true;
2488
2586
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
2489
2587
  if (vaporSlot) {
2490
2588
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -2492,25 +2590,35 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2492
2590
  slot: vaporSlot,
2493
2591
  fallback
2494
2592
  };
2593
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
2495
2594
  return ret;
2496
2595
  }
2497
2596
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
2498
- const hasProps = Object.keys(props).length > 0;
2499
- if (name !== "default") props.name = name;
2500
- return openBlock(), createBlock(Fragment, null, [createVNode("slot", props, fallback && fallback())], hasProps ? -2 : 64);
2597
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
2598
+ const hasProps = Object.keys(slotProps).length > 0;
2599
+ if (name !== "default") slotProps.name = name;
2600
+ return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
2501
2601
  }
2502
2602
  if (!!(process.env.NODE_ENV !== "production") && slot && slot.length > 1) {
2503
2603
  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.");
2504
2604
  slot = () => [];
2505
2605
  }
2506
2606
  if (slot && slot._c) slot._d = false;
2607
+ const prevStackSize = blockStack.length;
2507
2608
  openBlock();
2508
- const validSlotContent = slot && ensureValidVNode(slot(props));
2509
- ensureVaporSlotFallback(validSlotContent, fallback);
2510
- const slotKey = props.key || validSlotContent && validSlotContent.key;
2511
- const rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
2609
+ let rendered;
2610
+ try {
2611
+ const validSlotContent = slot && ensureValidVNode(slot(props));
2612
+ ensureVaporSlotFallback(validSlotContent, fallback);
2613
+ const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
2614
+ rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
2615
+ } catch (err) {
2616
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
2617
+ throw err;
2618
+ } finally {
2619
+ if (slot && slot._c) slot._d = true;
2620
+ }
2512
2621
  if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
2513
- if (slot && slot._c) slot._d = true;
2514
2622
  return rendered;
2515
2623
  }
2516
2624
  function ensureValidVNode(vnodes) {
@@ -2523,9 +2631,7 @@ function ensureValidVNode(vnodes) {
2523
2631
  }
2524
2632
  function ensureVaporSlotFallback(vnodes, fallback) {
2525
2633
  let vaporSlot;
2526
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
2527
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
2528
- }
2634
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
2529
2635
  }
2530
2636
  //#endregion
2531
2637
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -2891,26 +2997,39 @@ function createPropsRestProxy(props, excludedKeys) {
2891
2997
  function withAsyncContext(getAwaitable) {
2892
2998
  const ctx = getCurrentGenericInstance();
2893
2999
  const inSSRSetup = isInSSRComponentSetup;
3000
+ const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
2894
3001
  if (!!(process.env.NODE_ENV !== "production") && !ctx) warn$1("withAsyncContext called without active current instance. This is likely a bug.");
2895
3002
  let awaitable = getAwaitable();
2896
3003
  setCurrentInstance(null, void 0);
2897
3004
  if (inSSRSetup) setInSSRSetupState(false);
2898
3005
  const restore = () => {
3006
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
2899
3007
  setCurrentInstance(ctx);
2900
3008
  if (inSSRSetup) setInSSRSetupState(true);
3009
+ const reset = restoreAsyncContext && restoreAsyncContext();
3010
+ return () => {
3011
+ if (reset) reset();
3012
+ if (resetStoppedScope) resetStoppedScope.reset();
3013
+ };
2901
3014
  };
2902
3015
  const cleanup = () => {
2903
3016
  setCurrentInstance(null, void 0);
2904
3017
  if (inSSRSetup) setInSSRSetupState(false);
2905
3018
  };
2906
3019
  if (isPromise(awaitable)) awaitable = awaitable.catch((e) => {
2907
- restore();
2908
- Promise.resolve().then(() => Promise.resolve().then(cleanup));
3020
+ const reset = restore();
3021
+ Promise.resolve().then(() => Promise.resolve().then(() => {
3022
+ if (reset) reset();
3023
+ cleanup();
3024
+ }));
2909
3025
  throw e;
2910
3026
  });
2911
3027
  return [awaitable, () => {
2912
- restore();
2913
- Promise.resolve().then(cleanup);
3028
+ const reset = restore();
3029
+ Promise.resolve().then(() => {
3030
+ if (reset) reset();
3031
+ cleanup();
3032
+ });
2914
3033
  }];
2915
3034
  }
2916
3035
  //#endregion
@@ -3342,12 +3461,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
3342
3461
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
3343
3462
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
3344
3463
  }
3345
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
3464
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
3465
+ if (!hasVModel) {
3346
3466
  localValue = value;
3347
3467
  trigger();
3348
3468
  }
3349
3469
  i.emit(`update:${name}`, emittedValue);
3350
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
3470
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
3351
3471
  prevSetValue = value;
3352
3472
  prevEmittedValue = emittedValue;
3353
3473
  }
@@ -3454,7 +3574,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
3454
3574
  */
3455
3575
  function isEmitListener(options, key) {
3456
3576
  if (!options || !isOn(key)) return false;
3457
- key = key.slice(2).replace(/Once$/, "");
3577
+ key = key.slice(2);
3578
+ key = key === "Once" ? key : key.replace(/Once$/, "");
3458
3579
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
3459
3580
  }
3460
3581
  //#endregion
@@ -3933,7 +4054,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
3933
4054
  const receivedType = toRawType(value);
3934
4055
  const expectedValue = styleValue(value, expectedType);
3935
4056
  const receivedValue = styleValue(value, receivedType);
3936
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) message += ` with value ${expectedValue}`;
4057
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
3937
4058
  message += `, got ${receivedType} `;
3938
4059
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
3939
4060
  return message;
@@ -3942,7 +4063,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
3942
4063
  * dev only
3943
4064
  */
3944
4065
  function styleValue(value, type) {
3945
- if (type === "String") return `"${value}"`;
4066
+ if (isSymbol(value)) return value.toString();
4067
+ else if (type === "String") return `"${value}"`;
3946
4068
  else if (type === "Number") return `${Number(value)}`;
3947
4069
  else return `${value}`;
3948
4070
  }
@@ -3959,8 +4081,11 @@ function isExplicable(type) {
3959
4081
  /**
3960
4082
  * dev only
3961
4083
  */
3962
- function isBoolean(...args) {
3963
- return args.some((elem) => elem.toLowerCase() === "boolean");
4084
+ function isCoercible(...args) {
4085
+ return args.every((elem) => {
4086
+ const value = elem.toLowerCase();
4087
+ return value !== "boolean" && value !== "symbol";
4088
+ });
3964
4089
  }
3965
4090
  //#endregion
3966
4091
  //#region packages/runtime-core/src/componentSlots.ts
@@ -4297,7 +4422,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4297
4422
  if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4298
4423
  if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
4299
4424
  parentComponent && toggleRecurse(parentComponent, true);
4300
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
4425
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
4301
4426
  patchFlag = 0;
4302
4427
  optimized = false;
4303
4428
  dynamicChildren = null;
@@ -4378,19 +4503,35 @@ function baseCreateRenderer(options, createHydrationFns) {
4378
4503
  n2.slotScopeIds = slotScopeIds;
4379
4504
  if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
4380
4505
  else {
4506
+ const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
4381
4507
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
4382
4508
  if (n2.dirs) {
4383
4509
  invokeDirectiveHook(n2, null, parentComponent, "created");
4384
4510
  invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
4385
4511
  }
4512
+ }, () => {
4513
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
4386
4514
  });
4387
4515
  if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
4516
+ const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
4517
+ if (vnodeMountedHook) {
4518
+ const scopedVNode = n2;
4519
+ queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
4520
+ }
4388
4521
  }
4389
4522
  else {
4390
- getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized), () => {
4523
+ const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
4524
+ getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
4391
4525
  if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
4526
+ }, () => {
4527
+ const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
4528
+ if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
4392
4529
  });
4393
- if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, n1, parentComponent, "updated"), void 0, parentSuspense);
4530
+ const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
4531
+ if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
4532
+ n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4533
+ vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
4534
+ }, void 0, parentSuspense);
4394
4535
  }
4395
4536
  else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
4396
4537
  else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
@@ -4742,8 +4883,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4742
4883
  else hostInsert(el, container, anchor);
4743
4884
  };
4744
4885
  const performLeave = () => {
4886
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
4745
4887
  if (el._isLeaving) el[leaveCbKey](true);
4746
- leave(el, () => {
4888
+ if (transition.persisted && !wasLeaving) remove();
4889
+ else leave(el, () => {
4747
4890
  remove();
4748
4891
  afterLeave && afterLeave();
4749
4892
  });
@@ -4774,7 +4917,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4774
4917
  if (shapeFlag & 6) if (isVaporComponent(type)) {
4775
4918
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
4776
4919
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
4777
- if (dirs) queuePostRenderEffect(() => invokeDirectiveHook(vnode, null, parentComponent, "unmounted"), void 0, parentSuspense);
4920
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
4921
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
4922
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4923
+ }, void 0, parentSuspense);
4778
4924
  return;
4779
4925
  } else unmountComponent(vnode.component, parentSuspense, doRemove);
4780
4926
  else {
@@ -4835,7 +4981,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4835
4981
  if (effect) {
4836
4982
  effect.stop();
4837
4983
  unmount(subTree, instance, parentSuspense, doRemove);
4838
- }
4984
+ } else if (doRemove && subTree && instance.vnode.el) remove(subTree);
4839
4985
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
4840
4986
  queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
4841
4987
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) devtoolsComponentRemoved(instance);
@@ -4961,6 +5107,10 @@ function invalidateMount(hooks) {
4961
5107
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
4962
5108
  }
4963
5109
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
5110
+ if (force && transition.persisted && !el[leaveCbKey]) {
5111
+ insert();
5112
+ return;
5113
+ }
4964
5114
  if (force || needTransition(parentSuspense, transition)) {
4965
5115
  transition.beforeEnter(el);
4966
5116
  insert();
@@ -5165,15 +5315,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5165
5315
  if (suspense.isHydrating) suspense.isHydrating = false;
5166
5316
  else if (!resume) {
5167
5317
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
5318
+ let hasUpdatedAnchor = false;
5168
5319
  if (delayEnter) activeBranch.transition.afterLeave = () => {
5169
5320
  if (pendingId === suspense.pendingId) {
5170
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
5321
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
5171
5322
  queuePostFlushCb(effects);
5172
5323
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
5173
5324
  }
5174
5325
  };
5175
5326
  if (activeBranch && !suspense.isFallbackMountPending) {
5176
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
5327
+ if (parentNode(activeBranch.el) === container) {
5328
+ anchor = next(activeBranch);
5329
+ hasUpdatedAnchor = true;
5330
+ }
5177
5331
  unmount(activeBranch, parentComponent, suspense, true);
5178
5332
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
5179
5333
  }
@@ -5237,6 +5391,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5237
5391
  handleError(err, instance, 0);
5238
5392
  }).then((asyncSetupResult) => {
5239
5393
  if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
5394
+ setCurrentInstance(null, void 0);
5240
5395
  instance.asyncResolved = true;
5241
5396
  onResolve(asyncSetupResult);
5242
5397
  if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
@@ -5526,11 +5681,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
5526
5681
  el: vnode.el,
5527
5682
  anchor: vnode.anchor,
5528
5683
  ctx: vnode.ctx,
5529
- ce: vnode.ce
5684
+ ce: vnode.ce,
5685
+ vi: vnode.vi,
5686
+ vs: cloneVaporSlotMeta(vnode),
5687
+ vb: vnode.vb
5530
5688
  };
5531
5689
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
5532
5690
  return cloned;
5533
5691
  }
5692
+ function cloneVaporSlotMeta(vnode) {
5693
+ const vaporSlot = vnode.vs;
5694
+ if (!vaporSlot) return vaporSlot;
5695
+ const cloned = {
5696
+ slot: vaporSlot.slot,
5697
+ fallback: vaporSlot.fallback,
5698
+ outletFallback: vaporSlot.outletFallback
5699
+ };
5700
+ if (vnode.el) {
5701
+ cloned.state = vaporSlot.state;
5702
+ cloned.ref = vaporSlot.ref;
5703
+ cloned.scope = vaporSlot.scope;
5704
+ }
5705
+ return cloned;
5706
+ }
5534
5707
  /**
5535
5708
  * Dev only, for HMR of hoisted vnodes reused in v-for
5536
5709
  * https://github.com/vitejs/vite/issues/2022
@@ -5593,6 +5766,10 @@ function normalizeChildren(vnode, children) {
5593
5766
  }
5594
5767
  }
5595
5768
  else if (isFunction(children)) {
5769
+ if (shapeFlag & 65) {
5770
+ normalizeChildren(vnode, { default: children });
5771
+ return;
5772
+ }
5596
5773
  children = {
5597
5774
  default: children,
5598
5775
  _ctx: currentRenderingInstance
@@ -6215,7 +6392,7 @@ function isMemoSame(cached, memo) {
6215
6392
  }
6216
6393
  //#endregion
6217
6394
  //#region packages/runtime-core/src/index.ts
6218
- const version = "3.6.0-beta.9";
6395
+ const version = "3.6.0-rc.1";
6219
6396
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
6220
6397
  /**
6221
6398
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -6250,4 +6427,4 @@ const resolveFilter = null;
6250
6427
  const compatUtils = null;
6251
6428
  const DeprecationTypes = null;
6252
6429
  //#endregion
6253
- export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, MismatchTypes, MoveType, NULL_DYNAMIC_COMPONENT, ReactiveEffect, SchedulerJobFlags, Static, Suspense, Teleport, Text, TrackOpTypes, TriggerOpTypes, activate, assertNumber, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, checkTransitionMode, cloneVNode, compatUtils, computed, createAppAPI, createAsyncComponentContext, createBlock, createCanSetSetupRefChecker, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createInternalObject, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, currentInstance, customRef, deactivate, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, devtoolsComponentAdded, effect, effectScope, endMeasure, ensureVaporSlotFallback, expose, flushOnAppMount, getAttributeMismatch, getComponentName, getCurrentInstance, getCurrentScope, getCurrentWatcher, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initFeatureFlags, inject, invalidateMount, invokeDirectiveHook, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMemoSame, isMismatchAllowed, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isSetEqual, isShallow, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, markAsyncBoundary, markRaw, matches, mergeDefaults, mergeModels, mergeProps, nextTick, nextUid, normalizeClass, normalizeProps, normalizeRef, normalizeStyle, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popScopeId, popWarningContext, provide, proxyRefs, pushScopeId, pushWarningContext, queueJob, queuePostFlushCb, reactive, readonly, ref, registerHMR, registerRuntimeCompiler, renderList, renderSlot, resetShapeFlag, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolvePropValue, resolveTarget as resolveTeleportTarget, resolveTransitionHooks, setBlockTracking, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setIsHydratingEnabled, setRef, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, shouldUpdateComponent, simpleSetCurrentInstance, ssrContextKey, ssrUtils, startMeasure, stop, toClassSet, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toStyleMap, toValue, transformVNodeArgs, triggerRef, unref, unregisterHMR, useAsyncComponentState, useAttrs, useId, useInstanceOption, useModel, useSSRContext, useSlots, useTemplateRef, useTransitionState, validateComponentName, validateProps, version, warn, warnExtraneousAttributes, warnPropMismatch, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };
6430
+ export { BaseTransition, BaseTransitionPropsValidators, Comment, DeprecationTypes, EffectScope, ErrorCodes, ErrorTypeStrings, Fragment, KeepAlive, MismatchTypes, MoveType, NULL_DYNAMIC_COMPONENT, ReactiveEffect, SchedulerJobFlags, Static, Suspense, Teleport, Text, TrackOpTypes, TriggerOpTypes, VaporSlot, activate, assertNumber, baseEmit, baseNormalizePropsOptions, baseResolveTransitionHooks, callWithAsyncErrorHandling, callWithErrorHandling, camelize, capitalize, checkTransitionMode, cloneVNode, compatUtils, computed, createAppAPI, createAsyncComponentContext, createBlock, createCanSetSetupRefChecker, createCommentVNode, createElementBlock, createBaseVNode as createElementVNode, createHydrationRenderer, createInternalObject, createPropsRestProxy, createRenderer, createSlots, createStaticVNode, createTextVNode, createVNode, currentInstance, customRef, deactivate, defineAsyncComponent, defineComponent, defineEmits, defineExpose, defineModel, defineOptions, defineProps, defineSlots, devtools, devtoolsComponentAdded, effect, effectScope, endMeasure, ensureValidVNode, ensureVaporSlotFallback, expose, flushOnAppMount, getAttributeMismatch, getComponentName, getCurrentInstance, getCurrentScope, getCurrentWatcher, getFunctionalFallthrough, getInheritedScopeIds, getTransitionRawChildren, guardReactiveProps, h, handleError, hasInjectionContext, hydrateOnIdle, hydrateOnInteraction, hydrateOnMediaQuery, hydrateOnVisible, initCustomFormatter, initFeatureFlags, inject, invalidateMount, invokeDirectiveHook, isAsyncWrapper, isEmitListener, isHydrating, isKeepAlive, isMapEqual, isMemoSame, isMismatchAllowed, isProxy, isReactive, isReadonly, isRef, isRuntimeOnly, isSetEqual, isShallow, isTeleportDeferred, isTeleportDisabled, isTemplateNode, isTemplateRefKey, isVNode, isValidHtmlOrSvgAttribute, knownTemplateRefs, leaveCbKey, logMismatchError, markAsyncBoundary, markRaw, matches, mergeDefaults, mergeModels, mergeProps, nextTick, nextUid, normalizeClass, normalizeProps, normalizeRef, normalizeStyle, normalizeVNode, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onRenderTracked, onRenderTriggered, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, onWatcherCleanup, openBlock, performAsyncHydrate, performTransitionEnter, performTransitionLeave, popScopeId, popWarningContext, provide, proxyRefs, pushScopeId, pushWarningContext, queueJob, queuePostFlushCb, reactive, readonly, ref, registerHMR, registerRuntimeCompiler, renderList, renderSlot, resetShapeFlag, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolvePropValue, resolveTarget as resolveTeleportTarget, resolveTransitionHooks, setBlockTracking, setCurrentInstance, setCurrentRenderingInstance, setDevtoolsHook, setIsHydratingEnabled, setRef, setTransitionHooks, shallowReactive, shallowReadonly, shallowRef, shouldUpdateComponent, simpleSetCurrentInstance, ssrContextKey, ssrUtils, startMeasure, stop, toClassSet, toDisplayString, toHandlerKey, toHandlers, toRaw, toRef, toRefs, toStyleMap, toValue, transformVNodeArgs, triggerRef, unref, unregisterHMR, useAsyncComponentState, useAttrs, useId, useInstanceOption, useModel, useSSRContext, useSlots, useTemplateRef, useTransitionState, validateComponentName, validateProps, version, warn, warnExtraneousAttributes, warnPropMismatch, watch, watchEffect, watchPostEffect, watchSyncEffect, withAsyncContext, withCtx, withDefaults, withDirectives, withMemo, withScopeId };