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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-core v3.6.0-beta.9
2
+ * @vue/runtime-core v3.6.0-rc.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -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
  }
@@ -853,7 +891,7 @@ function instanceWatch(source, value, options) {
853
891
  }
854
892
  const prev = setCurrentInstance(this);
855
893
  const res = doWatch(getter, cb.bind(publicThis), options);
856
- setCurrentInstance(...prev);
894
+ restoreCurrentInstance(prev);
857
895
  return res;
858
896
  }
859
897
  function createPathGetter(ctx, path) {
@@ -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);
@@ -1293,12 +1350,11 @@ function getInnerChild$1(vnode) {
1293
1350
  }
1294
1351
  }
1295
1352
  function setTransitionHooks(vnode, hooks) {
1296
- if (vnode.shapeFlag & 6 && vnode.component) if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
1297
- else {
1353
+ if (vnode.shapeFlag & 6 && vnode.component) {
1298
1354
  vnode.transition = hooks;
1299
- setTransitionHooks(vnode.component.subTree, hooks);
1300
- }
1301
- else if (vnode.shapeFlag & 128) {
1355
+ if (isVaporComponent(vnode.type)) getVaporInterface(vnode.component, vnode).setTransitionHooks(vnode.component, hooks);
1356
+ else setTransitionHooks(vnode.component.subTree, hooks);
1357
+ } else if (vnode.shapeFlag & 128) {
1302
1358
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1303
1359
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
1304
1360
  } else vnode.transition = hooks;
@@ -1576,7 +1632,7 @@ function createHydrationFunctions(rendererInternals) {
1576
1632
  else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
1577
1633
  break;
1578
1634
  case VaporSlot:
1579
- nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
1635
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
1580
1636
  break;
1581
1637
  default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
1582
1638
  else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -1586,16 +1642,31 @@ function createHydrationFunctions(rendererInternals) {
1586
1642
  if (isFragmentStart) nextNode = locateClosingAnchor(node);
1587
1643
  else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
1588
1644
  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;
1645
+ if (vnode.type.__vapor) {
1646
+ const vnodeBeforeMountHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeBeforeMount;
1647
+ getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, nextNode, parentComponent, parentSuspense, () => {
1648
+ if (vnode.dirs) {
1649
+ invokeDirectiveHook(vnode, null, parentComponent, "created");
1650
+ invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
1651
+ }
1652
+ }, () => {
1653
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, vnode);
1654
+ });
1655
+ if (vnode.dirs) queueEffectWithSuspense(() => invokeDirectiveHook(vnode, null, parentComponent, "mounted"), void 0, parentSuspense);
1656
+ const vnodeMountedHook = !isAsyncWrapper(vnode) && vnode.props && vnode.props.onVnodeMounted;
1657
+ if (vnodeMountedHook) queueEffectWithSuspense(() => invokeVNodeHook(vnodeMountedHook, parentComponent, vnode), void 0, parentSuspense);
1658
+ } else {
1659
+ mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
1660
+ const component = vnode.component;
1661
+ if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved || component.asyncDep && !component.asyncResolved) {
1662
+ let subTree;
1663
+ if (isFragmentStart) {
1664
+ subTree = createVNode(Fragment);
1665
+ subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
1666
+ } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
1667
+ subTree.el = node;
1668
+ component.subTree = subTree;
1669
+ }
1599
1670
  }
1600
1671
  } else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
1601
1672
  else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
@@ -1607,9 +1678,10 @@ function createHydrationFunctions(rendererInternals) {
1607
1678
  };
1608
1679
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1609
1680
  optimized = optimized || !!vnode.dynamicChildren;
1610
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
1681
+ const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
1611
1682
  const forcePatch = type === "input" || type === "option";
1612
- if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
1683
+ const hasDynamicProps = !!dynamicProps;
1684
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || hasDynamicProps || patchFlag !== -1) {
1613
1685
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
1614
1686
  let needCallTransitionHooks = false;
1615
1687
  if (isTemplateNode(el)) {
@@ -1625,15 +1697,11 @@ function createHydrationFunctions(rendererInternals) {
1625
1697
  }
1626
1698
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
1627
1699
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
1628
- let hasWarned = false;
1700
+ if (next && !isMismatchAllowed(el, 1)) {
1701
+ (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.`);
1702
+ logMismatchError();
1703
+ }
1629
1704
  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
1705
  const cur = next;
1638
1706
  next = next.nextSibling;
1639
1707
  remove(cur);
@@ -1651,11 +1719,12 @@ function createHydrationFunctions(rendererInternals) {
1651
1719
  }
1652
1720
  }
1653
1721
  if (props) {
1654
- if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || !optimized || patchFlag & 48) {
1722
+ if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__ || forcePatch || hasDynamicProps || !optimized || patchFlag & 48) {
1655
1723
  const isCustomElement = el.tagName.includes("-");
1724
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
1656
1725
  for (const key in props) {
1657
1726
  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);
1727
+ 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
1728
  }
1660
1729
  } else if (props.onClick) patchProp(el, "onClick", null, props.onClick, void 0, parentComponent);
1661
1730
  else if (patchFlag & 4 && isReactive$1(props.style)) for (const key in props.style) props.style[key];
@@ -1675,7 +1744,7 @@ function createHydrationFunctions(rendererInternals) {
1675
1744
  optimized = optimized || !!parentVNode.dynamicChildren;
1676
1745
  const children = parentVNode.children;
1677
1746
  const l = children.length;
1678
- let hasWarned = false;
1747
+ let hasCheckedMismatch = false;
1679
1748
  for (let i = 0; i < l; i++) {
1680
1749
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
1681
1750
  const isText = vnode.type === Text;
@@ -1689,12 +1758,12 @@ function createHydrationFunctions(rendererInternals) {
1689
1758
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
1690
1759
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
1691
1760
  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;
1761
+ if (!hasCheckedMismatch) {
1762
+ hasCheckedMismatch = true;
1763
+ if (!isMismatchAllowed(container, 1)) {
1764
+ (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.`);
1765
+ logMismatchError();
1696
1766
  }
1697
- logMismatchError();
1698
1767
  }
1699
1768
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
1700
1769
  }
@@ -1714,7 +1783,7 @@ function createHydrationFunctions(rendererInternals) {
1714
1783
  }
1715
1784
  };
1716
1785
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
1717
- if (!isMismatchAllowed(node.parentElement, 1)) {
1786
+ if (!isNodeMismatchAllowed(node, vnode)) {
1718
1787
  (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
1788
  logMismatchError();
1720
1789
  }
@@ -1890,7 +1959,9 @@ const MismatchTypeString = {
1890
1959
  };
1891
1960
  function isMismatchAllowed(el, allowedType) {
1892
1961
  if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
1893
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
1962
+ return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
1963
+ }
1964
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
1894
1965
  if (allowedAttr == null) return false;
1895
1966
  else if (allowedAttr === "") return true;
1896
1967
  else {
@@ -1899,6 +1970,16 @@ function isMismatchAllowed(el, allowedType) {
1899
1970
  return list.includes(MismatchTypeString[allowedType]);
1900
1971
  }
1901
1972
  }
1973
+ function isNodeMismatchAllowed(node, vnode) {
1974
+ return isMismatchAllowed(node.parentElement, 1) || isMismatchAllowedByNode(node) || isMismatchAllowedByVNode(vnode);
1975
+ }
1976
+ function isMismatchAllowedByNode(node) {
1977
+ return node.nodeType === 1 && isMismatchAllowedByAttr(node.getAttribute(allowMismatchAttr), 1);
1978
+ }
1979
+ function isMismatchAllowedByVNode({ props }) {
1980
+ const allowedAttr = props && props[allowMismatchAttr];
1981
+ return typeof allowedAttr === "string" && isMismatchAllowedByAttr(allowedAttr, 1);
1982
+ }
1902
1983
  //#endregion
1903
1984
  //#region packages/runtime-core/src/hydrationStrategies.ts
1904
1985
  let requestIdleCallback;
@@ -2017,11 +2098,16 @@ function defineAsyncComponent(source) {
2017
2098
  onError(err);
2018
2099
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
2019
2100
  });
2020
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
2101
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
2021
2102
  load().then(() => {
2103
+ if (instance.isUnmounted) return;
2022
2104
  loaded.value = true;
2023
2105
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
2024
2106
  }).catch((err) => {
2107
+ if (instance.isUnmounted) {
2108
+ setPendingRequest(null);
2109
+ return;
2110
+ }
2025
2111
  onError(err);
2026
2112
  error.value = err;
2027
2113
  });
@@ -2079,14 +2165,22 @@ function createAsyncComponentContext(source) {
2079
2165
  setPendingRequest: (request) => pendingRequest = request
2080
2166
  };
2081
2167
  }
2082
- const useAsyncComponentState = (delay, timeout, onError) => {
2168
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
2083
2169
  const loaded = ref$1(false);
2084
2170
  const error = ref$1();
2085
2171
  const delayed = ref$1(!!delay);
2086
- if (delay) setTimeout(() => {
2172
+ let timeoutTimer;
2173
+ let delayTimer;
2174
+ if (instance) onUnmounted(() => {
2175
+ if (timeoutTimer != null) clearTimeout(timeoutTimer);
2176
+ if (delayTimer != null) clearTimeout(delayTimer);
2177
+ }, instance);
2178
+ if (delay) delayTimer = setTimeout(() => {
2179
+ if (instance && instance.isUnmounted) return;
2087
2180
  delayed.value = false;
2088
2181
  }, delay);
2089
- if (timeout != null) setTimeout(() => {
2182
+ if (timeout != null) timeoutTimer = setTimeout(() => {
2183
+ if (instance && instance.isUnmounted) return;
2090
2184
  if (!loaded.value && !error.value) {
2091
2185
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
2092
2186
  onError(err);
@@ -2104,6 +2198,7 @@ const useAsyncComponentState = (delay, timeout, onError) => {
2104
2198
  * @internal
2105
2199
  */
2106
2200
  function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
2201
+ const wasConnected = el.isConnected;
2107
2202
  let patched = false;
2108
2203
  (instance.bu || (instance.bu = [])).push(() => patched = true);
2109
2204
  const performHydrate = () => {
@@ -2114,6 +2209,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
2114
2209
  }
2115
2210
  return;
2116
2211
  }
2212
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
2117
2213
  hydrate();
2118
2214
  };
2119
2215
  const doHydrate = hydrateStrategy ? () => {
@@ -2354,7 +2450,7 @@ function injectHook(type, hook, target = currentInstance, prepend = false) {
2354
2450
  try {
2355
2451
  return callWithAsyncErrorHandling(hook, target, type, args);
2356
2452
  } finally {
2357
- setCurrentInstance(...prev);
2453
+ restoreCurrentInstance(prev);
2358
2454
  setActiveSub(prevSub);
2359
2455
  }
2360
2456
  });
@@ -2483,8 +2579,9 @@ function createSlots(slots, dynamicSlots) {
2483
2579
  * Compiler runtime helper for rendering `<slot/>`
2484
2580
  * @private
2485
2581
  */
2486
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2582
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
2487
2583
  let slot = slots[name];
2584
+ if (fallback) fallback.__vdom = true;
2488
2585
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
2489
2586
  if (vaporSlot) {
2490
2587
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -2492,25 +2589,35 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2492
2589
  slot: vaporSlot,
2493
2590
  fallback
2494
2591
  };
2592
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
2495
2593
  return ret;
2496
2594
  }
2497
2595
  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);
2596
+ const slotProps = branchKey != null && props.key == null ? extend({}, props, { key: branchKey }) : props;
2597
+ const hasProps = Object.keys(slotProps).length > 0;
2598
+ if (name !== "default") slotProps.name = name;
2599
+ return openBlock(), createBlock(Fragment, null, [createVNode("slot", slotProps, fallback && fallback())], hasProps ? -2 : 64);
2501
2600
  }
2502
2601
  if (!!(process.env.NODE_ENV !== "production") && slot && slot.length > 1) {
2503
2602
  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
2603
  slot = () => [];
2505
2604
  }
2506
2605
  if (slot && slot._c) slot._d = false;
2606
+ const prevStackSize = blockStack.length;
2507
2607
  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);
2608
+ let rendered;
2609
+ try {
2610
+ const validSlotContent = slot && ensureValidVNode(slot(props));
2611
+ ensureVaporSlotFallback(validSlotContent, fallback);
2612
+ const slotKey = props.key || branchKey || validSlotContent && validSlotContent.key;
2613
+ rendered = createBlock(Fragment, { key: (slotKey && !isSymbol(slotKey) ? slotKey : `_${name}`) + (!validSlotContent && fallback ? "_fb" : "") }, validSlotContent || (fallback ? fallback() : []), validSlotContent && slots._ === 1 ? 64 : -2);
2614
+ } catch (err) {
2615
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
2616
+ throw err;
2617
+ } finally {
2618
+ if (slot && slot._c) slot._d = true;
2619
+ }
2512
2620
  if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
2513
- if (slot && slot._c) slot._d = true;
2514
2621
  return rendered;
2515
2622
  }
2516
2623
  function ensureValidVNode(vnodes) {
@@ -2523,9 +2630,7 @@ function ensureValidVNode(vnodes) {
2523
2630
  }
2524
2631
  function ensureVaporSlotFallback(vnodes, fallback) {
2525
2632
  let vaporSlot;
2526
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
2527
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
2528
- }
2633
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
2529
2634
  }
2530
2635
  //#endregion
2531
2636
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -2891,26 +2996,39 @@ function createPropsRestProxy(props, excludedKeys) {
2891
2996
  function withAsyncContext(getAwaitable) {
2892
2997
  const ctx = getCurrentGenericInstance();
2893
2998
  const inSSRSetup = isInSSRComponentSetup;
2999
+ const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
2894
3000
  if (!!(process.env.NODE_ENV !== "production") && !ctx) warn$1("withAsyncContext called without active current instance. This is likely a bug.");
2895
3001
  let awaitable = getAwaitable();
2896
3002
  setCurrentInstance(null, void 0);
2897
3003
  if (inSSRSetup) setInSSRSetupState(false);
2898
3004
  const restore = () => {
3005
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
2899
3006
  setCurrentInstance(ctx);
2900
3007
  if (inSSRSetup) setInSSRSetupState(true);
3008
+ const reset = restoreAsyncContext && restoreAsyncContext();
3009
+ return () => {
3010
+ if (reset) reset();
3011
+ if (resetStoppedScope) resetStoppedScope.reset();
3012
+ };
2901
3013
  };
2902
3014
  const cleanup = () => {
2903
3015
  setCurrentInstance(null, void 0);
2904
3016
  if (inSSRSetup) setInSSRSetupState(false);
2905
3017
  };
2906
3018
  if (isPromise(awaitable)) awaitable = awaitable.catch((e) => {
2907
- restore();
2908
- Promise.resolve().then(() => Promise.resolve().then(cleanup));
3019
+ const reset = restore();
3020
+ Promise.resolve().then(() => Promise.resolve().then(() => {
3021
+ if (reset) reset();
3022
+ cleanup();
3023
+ }));
2909
3024
  throw e;
2910
3025
  });
2911
3026
  return [awaitable, () => {
2912
- restore();
2913
- Promise.resolve().then(cleanup);
3027
+ const reset = restore();
3028
+ Promise.resolve().then(() => {
3029
+ if (reset) reset();
3030
+ cleanup();
3031
+ });
2914
3032
  }];
2915
3033
  }
2916
3034
  //#endregion
@@ -3342,12 +3460,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
3342
3460
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
3343
3461
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
3344
3462
  }
3345
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
3463
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
3464
+ if (!hasVModel) {
3346
3465
  localValue = value;
3347
3466
  trigger();
3348
3467
  }
3349
3468
  i.emit(`update:${name}`, emittedValue);
3350
- if (hasChanged(value, emittedValue) && hasChanged(value, prevSetValue) && !hasChanged(emittedValue, prevEmittedValue)) trigger();
3469
+ if (hasChanged(value, prevSetValue) && (hasChanged(value, emittedValue) && !hasChanged(emittedValue, prevEmittedValue) || hasVModel && prevSetValue !== EMPTY_OBJ && !hasChanged(emittedValue, localValue))) trigger();
3351
3470
  prevSetValue = value;
3352
3471
  prevEmittedValue = emittedValue;
3353
3472
  }
@@ -3454,7 +3573,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
3454
3573
  */
3455
3574
  function isEmitListener(options, key) {
3456
3575
  if (!options || !isOn(key)) return false;
3457
- key = key.slice(2).replace(/Once$/, "");
3576
+ key = key.slice(2);
3577
+ key = key === "Once" ? key : key.replace(/Once$/, "");
3458
3578
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
3459
3579
  }
3460
3580
  //#endregion
@@ -3787,7 +3907,7 @@ function baseResolveDefault(factory, instance, key) {
3787
3907
  const prev = setCurrentInstance(instance);
3788
3908
  const props = toRaw$1(instance.props);
3789
3909
  value = factory.call(null, props);
3790
- setCurrentInstance(...prev);
3910
+ restoreCurrentInstance(prev);
3791
3911
  return value;
3792
3912
  }
3793
3913
  const mixinPropsCache = /* @__PURE__ */ new WeakMap();
@@ -3933,7 +4053,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
3933
4053
  const receivedType = toRawType(value);
3934
4054
  const expectedValue = styleValue(value, expectedType);
3935
4055
  const receivedValue = styleValue(value, receivedType);
3936
- if (expectedTypes.length === 1 && isExplicable(expectedType) && !isBoolean(expectedType, receivedType)) message += ` with value ${expectedValue}`;
4056
+ if (expectedTypes.length === 1 && isExplicable(expectedType) && isCoercible(expectedType, receivedType)) message += ` with value ${expectedValue}`;
3937
4057
  message += `, got ${receivedType} `;
3938
4058
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
3939
4059
  return message;
@@ -3942,7 +4062,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
3942
4062
  * dev only
3943
4063
  */
3944
4064
  function styleValue(value, type) {
3945
- if (type === "String") return `"${value}"`;
4065
+ if (isSymbol(value)) return value.toString();
4066
+ else if (type === "String") return `"${value}"`;
3946
4067
  else if (type === "Number") return `${Number(value)}`;
3947
4068
  else return `${value}`;
3948
4069
  }
@@ -3959,8 +4080,11 @@ function isExplicable(type) {
3959
4080
  /**
3960
4081
  * dev only
3961
4082
  */
3962
- function isBoolean(...args) {
3963
- return args.some((elem) => elem.toLowerCase() === "boolean");
4083
+ function isCoercible(...args) {
4084
+ return args.every((elem) => {
4085
+ const value = elem.toLowerCase();
4086
+ return value !== "boolean" && value !== "symbol";
4087
+ });
3964
4088
  }
3965
4089
  //#endregion
3966
4090
  //#region packages/runtime-core/src/componentSlots.ts
@@ -4297,7 +4421,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4297
4421
  if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4298
4422
  if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
4299
4423
  parentComponent && toggleRecurse(parentComponent, true);
4300
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
4424
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
4301
4425
  patchFlag = 0;
4302
4426
  optimized = false;
4303
4427
  dynamicChildren = null;
@@ -4376,21 +4500,37 @@ function baseCreateRenderer(options, createHydrationFns) {
4376
4500
  };
4377
4501
  const processComponent = (n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
4378
4502
  n2.slotScopeIds = slotScopeIds;
4379
- if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
4503
+ if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent, parentSuspense);
4380
4504
  else {
4505
+ const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
4381
4506
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
4382
4507
  if (n2.dirs) {
4383
4508
  invokeDirectiveHook(n2, null, parentComponent, "created");
4384
4509
  invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
4385
4510
  }
4511
+ }, () => {
4512
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
4386
4513
  });
4387
4514
  if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, null, parentComponent, "mounted"), void 0, parentSuspense);
4515
+ const vnodeMountedHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeMounted;
4516
+ if (vnodeMountedHook) {
4517
+ const scopedVNode = n2;
4518
+ queuePostRenderEffect(() => invokeVNodeHook(vnodeMountedHook, parentComponent, scopedVNode), void 0, parentSuspense);
4519
+ }
4388
4520
  }
4389
4521
  else {
4390
- getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdateComponent(n1, n2, optimized), () => {
4522
+ const shouldUpdate = shouldUpdateComponent(n1, n2, optimized);
4523
+ getVaporInterface(parentComponent, n2).update(n1, n2, shouldUpdate, () => {
4391
4524
  if (n2.dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
4525
+ }, () => {
4526
+ const vnodeBeforeUpdateHook = n2.props && n2.props.onVnodeBeforeUpdate;
4527
+ if (vnodeBeforeUpdateHook) invokeVNodeHook(vnodeBeforeUpdateHook, parentComponent, n2, n1);
4392
4528
  });
4393
- if (n2.dirs) queuePostRenderEffect(() => invokeDirectiveHook(n2, n1, parentComponent, "updated"), void 0, parentSuspense);
4529
+ const vnodeUpdatedHook = n2.props && n2.props.onVnodeUpdated;
4530
+ if (shouldUpdate && (vnodeUpdatedHook || n2.dirs)) queuePostRenderEffect(() => {
4531
+ n2.dirs && invokeDirectiveHook(n2, n1, parentComponent, "updated");
4532
+ vnodeUpdatedHook && invokeVNodeHook(vnodeUpdatedHook, parentComponent, n2, n1);
4533
+ }, void 0, parentSuspense);
4394
4534
  }
4395
4535
  else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
4396
4536
  else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
@@ -4709,7 +4849,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4709
4849
  const move = (vnode, container, anchor, moveType, parentComponent, parentSuspense = null) => {
4710
4850
  const { el, type, transition, children, shapeFlag } = vnode;
4711
4851
  if (isVaporComponent(type) || type === VaporSlot) {
4712
- getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType);
4852
+ getVaporInterface(parentComponent, vnode).move(vnode, container, anchor, moveType, parentSuspense);
4713
4853
  return;
4714
4854
  }
4715
4855
  if (shapeFlag & 6) {
@@ -4742,8 +4882,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4742
4882
  else hostInsert(el, container, anchor);
4743
4883
  };
4744
4884
  const performLeave = () => {
4885
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
4745
4886
  if (el._isLeaving) el[leaveCbKey](true);
4746
- leave(el, () => {
4887
+ if (transition.persisted && !wasLeaving) remove();
4888
+ else leave(el, () => {
4747
4889
  remove();
4748
4890
  afterLeave && afterLeave();
4749
4891
  });
@@ -4763,7 +4905,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4763
4905
  }
4764
4906
  if (cacheIndex != null) parentComponent.renderCache[cacheIndex] = void 0;
4765
4907
  if (shapeFlag & 256) {
4766
- if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer());
4908
+ if (isVaporComponent(vnode.type)) getVaporInterface(parentComponent, vnode).deactivate(vnode, parentComponent.ctx.getStorageContainer(), parentSuspense);
4767
4909
  else parentComponent.ctx.deactivate(vnode);
4768
4910
  return;
4769
4911
  }
@@ -4773,8 +4915,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4773
4915
  if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeBeforeUnmount)) invokeVNodeHook(vnodeHook, parentComponent, vnode);
4774
4916
  if (shapeFlag & 6) if (isVaporComponent(type)) {
4775
4917
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
4776
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
4777
- if (dirs) queuePostRenderEffect(() => invokeDirectiveHook(vnode, null, parentComponent, "unmounted"), void 0, parentSuspense);
4918
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
4919
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || dirs) queuePostRenderEffect(() => {
4920
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
4921
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4922
+ }, void 0, parentSuspense);
4778
4923
  return;
4779
4924
  } else unmountComponent(vnode.component, parentSuspense, doRemove);
4780
4925
  else {
@@ -4787,7 +4932,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4787
4932
  else if (dynamicChildren && !dynamicChildren.hasOnce && (type !== Fragment || patchFlag > 0 && patchFlag & 64)) unmountChildren(dynamicChildren, parentComponent, parentSuspense, false, true);
4788
4933
  else if (type === Fragment && patchFlag & 384 || !optimized && shapeFlag & 16) unmountChildren(children, parentComponent, parentSuspense);
4789
4934
  if (type === VaporSlot) {
4790
- getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
4935
+ getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove, parentSuspense);
4791
4936
  return;
4792
4937
  }
4793
4938
  if (doRemove) remove(vnode);
@@ -4835,7 +4980,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4835
4980
  if (effect) {
4836
4981
  effect.stop();
4837
4982
  unmount(subTree, instance, parentSuspense, doRemove);
4838
- }
4983
+ } else if (doRemove && subTree && instance.vnode.el) remove(subTree);
4839
4984
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
4840
4985
  queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
4841
4986
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) devtoolsComponentRemoved(instance);
@@ -4961,6 +5106,10 @@ function invalidateMount(hooks) {
4961
5106
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
4962
5107
  }
4963
5108
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
5109
+ if (force && transition.persisted && !el[leaveCbKey]) {
5110
+ insert();
5111
+ return;
5112
+ }
4964
5113
  if (force || needTransition(parentSuspense, transition)) {
4965
5114
  transition.beforeEnter(el);
4966
5115
  insert();
@@ -5165,15 +5314,19 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5165
5314
  if (suspense.isHydrating) suspense.isHydrating = false;
5166
5315
  else if (!resume) {
5167
5316
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
5317
+ let hasUpdatedAnchor = false;
5168
5318
  if (delayEnter) activeBranch.transition.afterLeave = () => {
5169
5319
  if (pendingId === suspense.pendingId) {
5170
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
5320
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
5171
5321
  queuePostFlushCb(effects);
5172
5322
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
5173
5323
  }
5174
5324
  };
5175
5325
  if (activeBranch && !suspense.isFallbackMountPending) {
5176
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
5326
+ if (parentNode(activeBranch.el) === container) {
5327
+ anchor = next(activeBranch);
5328
+ hasUpdatedAnchor = true;
5329
+ }
5177
5330
  unmount(activeBranch, parentComponent, suspense, true);
5178
5331
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
5179
5332
  }
@@ -5237,6 +5390,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5237
5390
  handleError(err, instance, 0);
5238
5391
  }).then((asyncSetupResult) => {
5239
5392
  if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
5393
+ setCurrentInstance(null, void 0);
5240
5394
  instance.asyncResolved = true;
5241
5395
  onResolve(asyncSetupResult);
5242
5396
  if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
@@ -5526,11 +5680,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
5526
5680
  el: vnode.el,
5527
5681
  anchor: vnode.anchor,
5528
5682
  ctx: vnode.ctx,
5529
- ce: vnode.ce
5683
+ ce: vnode.ce,
5684
+ vi: vnode.vi,
5685
+ vs: cloneVaporSlotMeta(vnode),
5686
+ vb: vnode.vb
5530
5687
  };
5531
5688
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
5532
5689
  return cloned;
5533
5690
  }
5691
+ function cloneVaporSlotMeta(vnode) {
5692
+ const vaporSlot = vnode.vs;
5693
+ if (!vaporSlot) return vaporSlot;
5694
+ const cloned = {
5695
+ slot: vaporSlot.slot,
5696
+ fallback: vaporSlot.fallback,
5697
+ outletFallback: vaporSlot.outletFallback
5698
+ };
5699
+ if (vnode.el) {
5700
+ cloned.state = vaporSlot.state;
5701
+ cloned.ref = vaporSlot.ref;
5702
+ cloned.scope = vaporSlot.scope;
5703
+ }
5704
+ return cloned;
5705
+ }
5534
5706
  /**
5535
5707
  * Dev only, for HMR of hoisted vnodes reused in v-for
5536
5708
  * https://github.com/vitejs/vite/issues/2022
@@ -5593,6 +5765,10 @@ function normalizeChildren(vnode, children) {
5593
5765
  }
5594
5766
  }
5595
5767
  else if (isFunction(children)) {
5768
+ if (shapeFlag & 65) {
5769
+ normalizeChildren(vnode, { default: children });
5770
+ return;
5771
+ }
5596
5772
  children = {
5597
5773
  default: children,
5598
5774
  _ctx: currentRenderingInstance
@@ -5665,6 +5841,16 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
5665
5841
  simpleSetCurrentInstance(instance);
5666
5842
  }
5667
5843
  };
5844
+ /**
5845
+ * Restores a snapshot returned by {@link setCurrentInstance}. Unlike calling
5846
+ * `setCurrentInstance(...prev)`, an `undefined` saved scope is restored
5847
+ * verbatim instead of re-triggering the `instance.scope` default.
5848
+ * @internal
5849
+ */
5850
+ const restoreCurrentInstance = (prev) => {
5851
+ setCurrentScope(prev[1]);
5852
+ simpleSetCurrentInstance(prev[0]);
5853
+ };
5668
5854
  const internalOptions = [
5669
5855
  "ce",
5670
5856
  "type",
@@ -5825,7 +6011,7 @@ function setupStatefulComponent(instance, isSSR) {
5825
6011
  const setupResult = callWithErrorHandling(setup, instance, 0, [!!(process.env.NODE_ENV !== "production") ? shallowReadonly$1(instance.props) : instance.props, setupContext]);
5826
6012
  const isAsyncSetup = isPromise(setupResult);
5827
6013
  setActiveSub(prevSub);
5828
- setCurrentInstance(...prev);
6014
+ restoreCurrentInstance(prev);
5829
6015
  if ((isAsyncSetup || instance.sp) && !isAsyncWrapper(instance)) markAsyncBoundary(instance);
5830
6016
  if (isAsyncSetup) {
5831
6017
  const unsetCurrentInstance = () => {
@@ -5895,7 +6081,7 @@ function finishComponentSetup(instance, isSSR, skipOptions) {
5895
6081
  applyOptions(instance);
5896
6082
  } finally {
5897
6083
  setActiveSub(prevSub);
5898
- setCurrentInstance(...prevInstance);
6084
+ restoreCurrentInstance(prevInstance);
5899
6085
  }
5900
6086
  }
5901
6087
  if (!!(process.env.NODE_ENV !== "production") && !Component.render && instance.render === NOOP && !isSSR) if (!compile && Component.template)
@@ -6215,7 +6401,7 @@ function isMemoSame(cached, memo) {
6215
6401
  }
6216
6402
  //#endregion
6217
6403
  //#region packages/runtime-core/src/index.ts
6218
- const version = "3.6.0-beta.9";
6404
+ const version = "3.6.0-rc.2";
6219
6405
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
6220
6406
  /**
6221
6407
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -6250,4 +6436,4 @@ const resolveFilter = null;
6250
6436
  const compatUtils = null;
6251
6437
  const DeprecationTypes = null;
6252
6438
  //#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 };
6439
+ 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, isHydratingEnabled, 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, queuePostRenderEffect, reactive, readonly, ref, registerHMR, registerRuntimeCompiler, renderList, renderSlot, resetShapeFlag, resolveComponent, resolveDirective, resolveDynamicComponent, resolveFilter, resolvePropValue, resolveTarget as resolveTeleportTarget, resolveTransitionHooks, restoreCurrentInstance, 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 };