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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/runtime-core v3.6.0-beta.8
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);
@@ -408,6 +409,13 @@ function checkRecursiveUpdates(seen, fn) {
408
409
  //#endregion
409
410
  //#region packages/runtime-core/src/hmr.ts
410
411
  let isHmrUpdating = false;
412
+ const setHmrUpdating = (v) => {
413
+ try {
414
+ return isHmrUpdating;
415
+ } finally {
416
+ isHmrUpdating = v;
417
+ }
418
+ };
411
419
  const hmrDirtyComponents = /* @__PURE__ */ new Map();
412
420
  const hmrDirtyComponentsMode = /* @__PURE__ */ new Map();
413
421
  if (!!(process.env.NODE_ENV !== "production")) getGlobalThis().__VUE_HMR_RUNTIME__ = {
@@ -439,6 +447,14 @@ function createRecord(id, initialDef) {
439
447
  function normalizeClassComponent(component) {
440
448
  return isClassComponent(component) ? component.__vccOpts : component;
441
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
+ }
442
458
  function rerender(id, newRender) {
443
459
  const record = map.get(id);
444
460
  if (!record) return;
@@ -470,42 +486,69 @@ function reload(id, newComp) {
470
486
  const isVapor = record.initialDef.__vapor;
471
487
  updateComponentDef(record.initialDef, newComp);
472
488
  const instances = [...record.instances];
473
- 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)) {
474
490
  for (const instance of instances) if (instance.root && instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(instance.type);
475
- for (const instance of instances) instance.hmrReload(newComp);
476
- } else for (const instance of instances) {
477
- const oldComp = normalizeClassComponent(instance.type);
478
- let dirtyInstances = hmrDirtyComponents.get(oldComp);
479
- if (!dirtyInstances) {
480
- if (oldComp !== record.initialDef) updateComponentDef(oldComp, newComp);
481
- hmrDirtyComponents.set(oldComp, dirtyInstances = /* @__PURE__ */ new Set());
482
- }
483
- dirtyInstances.add(instance);
484
- hmrDirtyComponentsMode.set(oldComp, !!isVapor);
485
- instance.appContext.propsCache.delete(instance.type);
486
- instance.appContext.emitsCache.delete(instance.type);
487
- instance.appContext.optionsCache.delete(instance.type);
488
- if (instance.ceReload) {
489
- dirtyInstances.add(instance);
490
- instance.ceReload(newComp.styles);
491
- dirtyInstances.delete(instance);
492
- } else if (instance.parent) queueJob(() => {
493
- isHmrUpdating = true;
491
+ const dirtyInstances = new Set(instances);
492
+ const rerenderedParents = /* @__PURE__ */ new Set();
493
+ for (const instance of instances) {
494
494
  const parent = instance.parent;
495
- if (parent.vapor) parent.hmrRerender();
496
- else if (!(parent.effect.flags & 1024)) {
497
- parent.renderCache = [];
498
- 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());
499
511
  }
500
- nextTick(() => {
501
- 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
+ });
502
550
  });
503
- dirtyInstances.delete(instance);
504
551
  });
505
- else if (instance.appContext.reload) instance.appContext.reload();
506
- else if (typeof window !== "undefined") window.location.reload();
507
- else console.warn("[HMR] Root or manually mounted instance modified. Full reload required.");
508
- if (instance.root.ce && instance !== instance.root) instance.root.ce._removeChildStyle(oldComp);
509
552
  }
510
553
  queuePostFlushCb(() => {
511
554
  hmrDirtyComponents.clear();
@@ -648,10 +691,12 @@ function withCtx(fn, ctx = currentRenderingInstance, isNonScopedSlot) {
648
691
  const renderFnWithContext = (...args) => {
649
692
  if (renderFnWithContext._d) setBlockTracking(-1);
650
693
  const prevInstance = setCurrentRenderingInstance(ctx);
694
+ const prevStackSize = blockStack.length;
651
695
  let res;
652
696
  try {
653
697
  res = fn(...args);
654
698
  } finally {
699
+ for (let i = blockStack.length; i > prevStackSize; i--) closeBlock();
655
700
  setCurrentRenderingInstance(prevInstance);
656
701
  if (renderFnWithContext._d) setBlockTracking(1);
657
702
  }
@@ -859,6 +904,7 @@ function createPathGetter(ctx, path) {
859
904
  }
860
905
  //#endregion
861
906
  //#region packages/runtime-core/src/components/Teleport.ts
907
+ const pendingMounts = /* @__PURE__ */ new WeakMap();
862
908
  const TeleportEndKey = Symbol("_vte");
863
909
  const isTeleport = (type) => type.__isTeleport;
864
910
  const isTeleportDisabled = (props) => props && (props.disabled || props.disabled === "");
@@ -884,55 +930,68 @@ const TeleportImpl = {
884
930
  name: "Teleport",
885
931
  __isTeleport: true,
886
932
  process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals) {
887
- 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;
888
934
  const disabled = isTeleportDisabled(n2.props);
889
- let { shapeFlag, children, dynamicChildren } = n2;
935
+ let { dynamicChildren } = n2;
890
936
  if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
891
937
  optimized = false;
892
938
  dynamicChildren = null;
893
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
+ };
894
970
  if (n1 == null) {
895
971
  const placeholder = n2.el = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createText("");
896
972
  const mainAnchor = n2.anchor = !!(process.env.NODE_ENV !== "production") ? createComment("teleport end") : createText("");
897
973
  insert(placeholder, container, anchor);
898
974
  insert(mainAnchor, container, anchor);
899
- const mount = (container, anchor) => {
900
- if (shapeFlag & 16) mountChildren(children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized);
901
- };
902
- const mountToTarget = () => {
903
- const target = n2.target = resolveTarget(n2.props, querySelector);
904
- const targetAnchor = prepareAnchor(target, n2, createText, insert);
905
- if (target) {
906
- if (namespace !== "svg" && isTargetSVG(target)) namespace = "svg";
907
- else if (namespace !== "mathml" && isTargetMathML(target)) namespace = "mathml";
908
- if (parentComponent && parentComponent.isCE) (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
909
- if (!disabled) {
910
- mount(target, targetAnchor);
911
- updateCssVars(n2, false);
912
- }
913
- } else if (!!(process.env.NODE_ENV !== "production") && !disabled) warn$1("Invalid Teleport target on mount:", target, `(${typeof target})`);
914
- };
975
+ if (isTeleportDeferred(n2.props) || parentSuspense && parentSuspense.pendingBranch) {
976
+ queuePendingMount(n2);
977
+ return;
978
+ }
915
979
  if (disabled) {
916
- mount(container, mainAnchor);
980
+ mount(n2, container, mainAnchor);
917
981
  updateCssVars(n2, true);
918
982
  }
919
- if (isTeleportDeferred(n2.props)) {
920
- n2.el.__isMounted = false;
921
- queuePostRenderEffect(() => {
922
- mountToTarget();
923
- delete n2.el.__isMounted;
924
- }, void 0, parentSuspense);
925
- } else mountToTarget();
983
+ mountToTarget();
926
984
  } else {
927
- if (isTeleportDeferred(n2.props) && n1.el.__isMounted === false) {
928
- queuePostRenderEffect(() => {
929
- TeleportImpl.process(n1, n2, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, internals);
930
- }, void 0, parentSuspense);
985
+ n2.el = n1.el;
986
+ const mainAnchor = n2.anchor = n1.anchor;
987
+ const pendingMount = pendingMounts.get(n1);
988
+ if (pendingMount) {
989
+ pendingMount.flags |= 4;
990
+ pendingMounts.delete(n1);
991
+ queuePendingMount(n2);
931
992
  return;
932
993
  }
933
- n2.el = n1.el;
934
994
  n2.targetStart = n1.targetStart;
935
- const mainAnchor = n2.anchor = n1.anchor;
936
995
  const target = n2.target = n1.target;
937
996
  const targetAnchor = n2.targetAnchor = n1.targetAnchor;
938
997
  const wasDisabled = isTeleportDisabled(n1.props);
@@ -948,26 +1007,30 @@ const TeleportImpl = {
948
1007
  if (!wasDisabled) moveTeleport(n2, container, mainAnchor, internals, parentComponent, 1);
949
1008
  else if (n2.props && n1.props && n2.props.to !== n1.props.to) n2.props.to = n1.props.to;
950
1009
  } else if ((n2.props && n2.props.to) !== (n1.props && n1.props.to)) {
951
- const nextTarget = n2.target = resolveTarget(n2.props, querySelector);
952
- if (nextTarget) moveTeleport(n2, nextTarget, null, internals, parentComponent, 0);
953
- 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})`);
954
1015
  } else if (wasDisabled) moveTeleport(n2, target, targetAnchor, internals, parentComponent, 1);
955
1016
  updateCssVars(n2, disabled);
956
1017
  }
957
1018
  },
958
1019
  remove(vnode, parentComponent, parentSuspense, { um: unmount, o: { remove: hostRemove } }, doRemove) {
959
1020
  const { shapeFlag, children, anchor, targetStart, targetAnchor, target, props } = vnode;
960
- if (target) {
961
- hostRemove(targetStart);
962
- hostRemove(targetAnchor);
963
- }
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
+ }
1028
+ if (targetStart) hostRemove(targetStart);
1029
+ if (targetAnchor) hostRemove(targetAnchor);
964
1030
  doRemove && hostRemove(anchor);
965
- if (shapeFlag & 16) {
966
- const shouldRemove = doRemove || !isTeleportDisabled(props);
967
- for (let i = 0; i < children.length; i++) {
968
- const child = children[i];
969
- unmount(child, parentComponent, parentSuspense, shouldRemove, !!child.dynamicChildren);
970
- }
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);
971
1034
  }
972
1035
  },
973
1036
  move: moveTeleport,
@@ -978,7 +1041,7 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
978
1041
  const { el, anchor, shapeFlag, children, props } = vnode;
979
1042
  const isReorder = moveType === 2;
980
1043
  if (isReorder) insert(el, container, parentAnchor);
981
- if (!isReorder || isTeleportDisabled(props)) {
1044
+ if (!pendingMounts.has(vnode) && (!isReorder || isTeleportDisabled(props))) {
982
1045
  if (shapeFlag & 16) for (let i = 0; i < children.length; i++) move(children[i], container, parentAnchor, 2, parentComponent);
983
1046
  }
984
1047
  if (isReorder) insert(anchor, container, parentAnchor);
@@ -1103,8 +1166,8 @@ const BaseTransitionImpl = {
1103
1166
  const state = useTransitionState();
1104
1167
  return () => {
1105
1168
  const children = slots.default && getTransitionRawChildren(slots.default(), true);
1106
- if (!children || !children.length) return;
1107
- const child = findNonCommentChild(children);
1169
+ const child = children && children.length ? findNonCommentChild(children) : instance.subTree ? createCommentVNode() : void 0;
1170
+ if (!child) return;
1108
1171
  const rawProps = toRaw$1(props);
1109
1172
  const { mode } = rawProps;
1110
1173
  checkTransitionMode(mode);
@@ -1220,7 +1283,7 @@ function baseResolveTransitionHooks(context, props, state, instance) {
1220
1283
  callHook(hook, [el]);
1221
1284
  },
1222
1285
  enter(el) {
1223
- if (isLeaving()) return;
1286
+ if (!isHmrUpdating && isLeaving()) return;
1224
1287
  let hook = onEnter;
1225
1288
  let afterHook = onAfterEnter;
1226
1289
  let cancelHook = onEnterCancelled;
@@ -1570,7 +1633,7 @@ function createHydrationFunctions(rendererInternals) {
1570
1633
  else nextNode = hydrateFragment(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
1571
1634
  break;
1572
1635
  case VaporSlot:
1573
- nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node);
1636
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(vnode, node, parentComponent, parentSuspense);
1574
1637
  break;
1575
1638
  default: if (shapeFlag & 1) if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) nextNode = onMismatch();
1576
1639
  else nextNode = hydrateElement(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
@@ -1580,16 +1643,31 @@ function createHydrationFunctions(rendererInternals) {
1580
1643
  if (isFragmentStart) nextNode = locateClosingAnchor(node);
1581
1644
  else if (isComment(node) && node.data === "teleport start") nextNode = locateClosingAnchor(node, node.data, "teleport end");
1582
1645
  else nextNode = nextSibling(node);
1583
- if (vnode.type.__vapor) getVaporInterface(parentComponent, vnode).hydrate(vnode, node, container, null, parentComponent, parentSuspense);
1584
- else mountComponent(vnode, container, null, parentComponent, parentSuspense, getContainerType(container), optimized);
1585
- if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
1586
- let subTree;
1587
- if (isFragmentStart) {
1588
- subTree = createVNode(Fragment);
1589
- subTree.anchor = nextNode ? nextNode.previousSibling : container.lastChild;
1590
- } else subTree = node.nodeType === 3 ? createTextVNode("") : createVNode("div");
1591
- subTree.el = node;
1592
- 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
+ }
1593
1671
  }
1594
1672
  } else if (shapeFlag & 64) if (domType !== 8) nextNode = onMismatch();
1595
1673
  else nextNode = vnode.type.hydrate(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, rendererInternals, hydrateChildren);
@@ -1601,9 +1679,10 @@ function createHydrationFunctions(rendererInternals) {
1601
1679
  };
1602
1680
  const hydrateElement = (el, vnode, parentComponent, parentSuspense, slotScopeIds, optimized) => {
1603
1681
  optimized = optimized || !!vnode.dynamicChildren;
1604
- const { type, props, patchFlag, shapeFlag, dirs, transition } = vnode;
1682
+ const { type, dynamicProps, props, patchFlag, shapeFlag, dirs, transition } = vnode;
1605
1683
  const forcePatch = type === "input" || type === "option";
1606
- if (!!(process.env.NODE_ENV !== "production") || forcePatch || patchFlag !== -1) {
1684
+ const hasDynamicProps = !!dynamicProps;
1685
+ if (!!(process.env.NODE_ENV !== "production") || forcePatch || hasDynamicProps || patchFlag !== -1) {
1607
1686
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "created");
1608
1687
  let needCallTransitionHooks = false;
1609
1688
  if (isTemplateNode(el)) {
@@ -1619,15 +1698,11 @@ function createHydrationFunctions(rendererInternals) {
1619
1698
  }
1620
1699
  if (shapeFlag & 16 && !(props && (props.innerHTML || props.textContent))) {
1621
1700
  let next = hydrateChildren(el.firstChild, vnode, el, parentComponent, parentSuspense, slotScopeIds, optimized);
1622
- 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
+ }
1623
1705
  while (next) {
1624
- if (!isMismatchAllowed(el, 1)) {
1625
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
1626
- warn$1(`Hydration children mismatch on`, el, `\nServer rendered element contains more child nodes than client vdom.`);
1627
- hasWarned = true;
1628
- }
1629
- logMismatchError();
1630
- }
1631
1706
  const cur = next;
1632
1707
  next = next.nextSibling;
1633
1708
  remove(cur);
@@ -1645,11 +1720,12 @@ function createHydrationFunctions(rendererInternals) {
1645
1720
  }
1646
1721
  }
1647
1722
  if (props) {
1648
- 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) {
1649
1724
  const isCustomElement = el.tagName.includes("-");
1725
+ const namespace = el.namespaceURI.includes("svg") ? "svg" : el.namespaceURI.includes("MathML") ? "mathml" : void 0;
1650
1726
  for (const key in props) {
1651
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();
1652
- 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);
1653
1729
  }
1654
1730
  } else if (props.onClick) patchProp(el, "onClick", null, props.onClick, void 0, parentComponent);
1655
1731
  else if (patchFlag & 4 && isReactive$1(props.style)) for (const key in props.style) props.style[key];
@@ -1669,7 +1745,7 @@ function createHydrationFunctions(rendererInternals) {
1669
1745
  optimized = optimized || !!parentVNode.dynamicChildren;
1670
1746
  const children = parentVNode.children;
1671
1747
  const l = children.length;
1672
- let hasWarned = false;
1748
+ let hasCheckedMismatch = false;
1673
1749
  for (let i = 0; i < l; i++) {
1674
1750
  const vnode = optimized ? children[i] : children[i] = normalizeVNode(children[i]);
1675
1751
  const isText = vnode.type === Text;
@@ -1683,12 +1759,12 @@ function createHydrationFunctions(rendererInternals) {
1683
1759
  node = hydrateNode(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized);
1684
1760
  } else if (isText && !vnode.children) insert(vnode.el = createText(""), container);
1685
1761
  else {
1686
- if (!isMismatchAllowed(container, 1)) {
1687
- if ((!!(process.env.NODE_ENV !== "production") || __VUE_PROD_HYDRATION_MISMATCH_DETAILS__) && !hasWarned) {
1688
- warn$1(`Hydration children mismatch on`, container, `\nServer rendered element contains fewer child nodes than client vdom.`);
1689
- 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();
1690
1767
  }
1691
- logMismatchError();
1692
1768
  }
1693
1769
  patch(null, vnode, container, null, parentComponent, parentSuspense, getContainerType(container), slotScopeIds);
1694
1770
  }
@@ -1708,7 +1784,7 @@ function createHydrationFunctions(rendererInternals) {
1708
1784
  }
1709
1785
  };
1710
1786
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
1711
- if (!isMismatchAllowed(node.parentElement, 1)) {
1787
+ if (!isNodeMismatchAllowed(node, vnode)) {
1712
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);
1713
1789
  logMismatchError();
1714
1790
  }
@@ -1884,7 +1960,9 @@ const MismatchTypeString = {
1884
1960
  };
1885
1961
  function isMismatchAllowed(el, allowedType) {
1886
1962
  if (allowedType === 0 || allowedType === 1) while (el && !el.hasAttribute(allowMismatchAttr)) el = el.parentElement;
1887
- const allowedAttr = el && el.getAttribute(allowMismatchAttr);
1963
+ return isMismatchAllowedByAttr(el && el.getAttribute(allowMismatchAttr), allowedType);
1964
+ }
1965
+ function isMismatchAllowedByAttr(allowedAttr, allowedType) {
1888
1966
  if (allowedAttr == null) return false;
1889
1967
  else if (allowedAttr === "") return true;
1890
1968
  else {
@@ -1893,6 +1971,16 @@ function isMismatchAllowed(el, allowedType) {
1893
1971
  return list.includes(MismatchTypeString[allowedType]);
1894
1972
  }
1895
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
+ }
1896
1984
  //#endregion
1897
1985
  //#region packages/runtime-core/src/hydrationStrategies.ts
1898
1986
  let requestIdleCallback;
@@ -2011,11 +2099,16 @@ function defineAsyncComponent(source) {
2011
2099
  onError(err);
2012
2100
  return () => errorComponent ? createVNode(errorComponent, { error: err }) : null;
2013
2101
  });
2014
- const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError);
2102
+ const { loaded, error, delayed } = useAsyncComponentState(delay, timeout, onError, instance);
2015
2103
  load().then(() => {
2104
+ if (instance.isUnmounted) return;
2016
2105
  loaded.value = true;
2017
2106
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) instance.parent.update();
2018
2107
  }).catch((err) => {
2108
+ if (instance.isUnmounted) {
2109
+ setPendingRequest(null);
2110
+ return;
2111
+ }
2019
2112
  onError(err);
2020
2113
  error.value = err;
2021
2114
  });
@@ -2073,14 +2166,22 @@ function createAsyncComponentContext(source) {
2073
2166
  setPendingRequest: (request) => pendingRequest = request
2074
2167
  };
2075
2168
  }
2076
- const useAsyncComponentState = (delay, timeout, onError) => {
2169
+ const useAsyncComponentState = (delay, timeout, onError, instance = currentInstance) => {
2077
2170
  const loaded = ref$1(false);
2078
2171
  const error = ref$1();
2079
2172
  const delayed = ref$1(!!delay);
2080
- 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;
2081
2181
  delayed.value = false;
2082
2182
  }, delay);
2083
- if (timeout != null) setTimeout(() => {
2183
+ if (timeout != null) timeoutTimer = setTimeout(() => {
2184
+ if (instance && instance.isUnmounted) return;
2084
2185
  if (!loaded.value && !error.value) {
2085
2186
  const err = /* @__PURE__ */ new Error(`Async component timed out after ${timeout}ms.`);
2086
2187
  onError(err);
@@ -2098,6 +2199,7 @@ const useAsyncComponentState = (delay, timeout, onError) => {
2098
2199
  * @internal
2099
2200
  */
2100
2201
  function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
2202
+ const wasConnected = el.isConnected;
2101
2203
  let patched = false;
2102
2204
  (instance.bu || (instance.bu = [])).push(() => patched = true);
2103
2205
  const performHydrate = () => {
@@ -2108,6 +2210,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
2108
2210
  }
2109
2211
  return;
2110
2212
  }
2213
+ if (!el.parentNode || wasConnected && !el.isConnected) return;
2111
2214
  hydrate();
2112
2215
  };
2113
2216
  const doHydrate = hydrateStrategy ? () => {
@@ -2477,8 +2580,9 @@ function createSlots(slots, dynamicSlots) {
2477
2580
  * Compiler runtime helper for rendering `<slot/>`
2478
2581
  * @private
2479
2582
  */
2480
- function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2583
+ function renderSlot(slots, name, props = {}, fallback, noSlotted, branchKey) {
2481
2584
  let slot = slots[name];
2585
+ if (fallback) fallback.__vdom = true;
2482
2586
  const vaporSlot = slot && (slot.__vs || (slot.__vapor ? slot : null));
2483
2587
  if (vaporSlot) {
2484
2588
  const ret = (openBlock(), createBlock(VaporSlot, props));
@@ -2486,25 +2590,35 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2486
2590
  slot: vaporSlot,
2487
2591
  fallback
2488
2592
  };
2593
+ if (!noSlotted && ret.scopeId) ret.slotScopeIds = [ret.scopeId + "-s"];
2489
2594
  return ret;
2490
2595
  }
2491
2596
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
2492
- const hasProps = Object.keys(props).length > 0;
2493
- if (name !== "default") props.name = name;
2494
- 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);
2495
2601
  }
2496
2602
  if (!!(process.env.NODE_ENV !== "production") && slot && slot.length > 1) {
2497
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.");
2498
2604
  slot = () => [];
2499
2605
  }
2500
2606
  if (slot && slot._c) slot._d = false;
2607
+ const prevStackSize = blockStack.length;
2501
2608
  openBlock();
2502
- const validSlotContent = slot && ensureValidVNode(slot(props));
2503
- ensureVaporSlotFallback(validSlotContent, fallback);
2504
- const slotKey = props.key || validSlotContent && validSlotContent.key;
2505
- 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
+ }
2506
2621
  if (!noSlotted && rendered.scopeId) rendered.slotScopeIds = [rendered.scopeId + "-s"];
2507
- if (slot && slot._c) slot._d = true;
2508
2622
  return rendered;
2509
2623
  }
2510
2624
  function ensureValidVNode(vnodes) {
@@ -2517,9 +2631,7 @@ function ensureValidVNode(vnodes) {
2517
2631
  }
2518
2632
  function ensureVaporSlotFallback(vnodes, fallback) {
2519
2633
  let vaporSlot;
2520
- if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
2521
- if (!vaporSlot.fallback && fallback) vaporSlot.fallback = fallback;
2522
- }
2634
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) vaporSlot.outletFallback = fallback;
2523
2635
  }
2524
2636
  //#endregion
2525
2637
  //#region packages/runtime-core/src/helpers/toHandlers.ts
@@ -2885,26 +2997,39 @@ function createPropsRestProxy(props, excludedKeys) {
2885
2997
  function withAsyncContext(getAwaitable) {
2886
2998
  const ctx = getCurrentGenericInstance();
2887
2999
  const inSSRSetup = isInSSRComponentSetup;
3000
+ const restoreAsyncContext = ctx && ctx.restoreAsyncContext ? ctx.restoreAsyncContext.bind(ctx) : void 0;
2888
3001
  if (!!(process.env.NODE_ENV !== "production") && !ctx) warn$1("withAsyncContext called without active current instance. This is likely a bug.");
2889
3002
  let awaitable = getAwaitable();
2890
3003
  setCurrentInstance(null, void 0);
2891
3004
  if (inSSRSetup) setInSSRSetupState(false);
2892
3005
  const restore = () => {
3006
+ const resetStoppedScope = ctx && !ctx.scope.active ? ctx.scope : void 0;
2893
3007
  setCurrentInstance(ctx);
2894
3008
  if (inSSRSetup) setInSSRSetupState(true);
3009
+ const reset = restoreAsyncContext && restoreAsyncContext();
3010
+ return () => {
3011
+ if (reset) reset();
3012
+ if (resetStoppedScope) resetStoppedScope.reset();
3013
+ };
2895
3014
  };
2896
3015
  const cleanup = () => {
2897
3016
  setCurrentInstance(null, void 0);
2898
3017
  if (inSSRSetup) setInSSRSetupState(false);
2899
3018
  };
2900
3019
  if (isPromise(awaitable)) awaitable = awaitable.catch((e) => {
2901
- restore();
2902
- 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
+ }));
2903
3025
  throw e;
2904
3026
  });
2905
3027
  return [awaitable, () => {
2906
- restore();
2907
- Promise.resolve().then(cleanup);
3028
+ const reset = restore();
3029
+ Promise.resolve().then(() => {
3030
+ if (reset) reset();
3031
+ cleanup();
3032
+ });
2908
3033
  }];
2909
3034
  }
2910
3035
  //#endregion
@@ -3336,12 +3461,13 @@ function useModel(props, name, options = EMPTY_OBJ) {
3336
3461
  for (const key of rawPropKeys) if (key === name || key === camelizedName || key === hyphenatedName) parentPassedModelValue = true;
3337
3462
  else if (key === `onUpdate:${name}` || key === `onUpdate:${camelizedName}` || key === `onUpdate:${hyphenatedName}`) parentPassedModelUpdater = true;
3338
3463
  }
3339
- if (!parentPassedModelValue || !parentPassedModelUpdater) {
3464
+ const hasVModel = parentPassedModelValue && parentPassedModelUpdater;
3465
+ if (!hasVModel) {
3340
3466
  localValue = value;
3341
3467
  trigger();
3342
3468
  }
3343
3469
  i.emit(`update:${name}`, emittedValue);
3344
- 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();
3345
3471
  prevSetValue = value;
3346
3472
  prevEmittedValue = emittedValue;
3347
3473
  }
@@ -3448,7 +3574,8 @@ function normalizeEmitsOptions(comp, appContext, asMixin = false) {
3448
3574
  */
3449
3575
  function isEmitListener(options, key) {
3450
3576
  if (!options || !isOn(key)) return false;
3451
- key = key.slice(2).replace(/Once$/, "");
3577
+ key = key.slice(2);
3578
+ key = key === "Once" ? key : key.replace(/Once$/, "");
3452
3579
  return hasOwn(options, key[0].toLowerCase() + key.slice(1)) || hasOwn(options, hyphenate(key)) || hasOwn(options, key);
3453
3580
  }
3454
3581
  //#endregion
@@ -3636,15 +3763,19 @@ function hasPropValueChanged(nextProps, prevProps, key) {
3636
3763
  if (key === "style" && isObject(nextProp) && isObject(prevProp)) return !looseEqual(nextProp, prevProp);
3637
3764
  return nextProp !== prevProp;
3638
3765
  }
3639
- function updateHOCHostEl({ vnode, parent }, el) {
3766
+ function updateHOCHostEl({ vnode, parent, suspense }, el) {
3640
3767
  while (parent && !parent.vapor) {
3641
3768
  const root = parent.subTree;
3642
- if (root.suspense && root.suspense.activeBranch === vnode) root.el = vnode.el;
3769
+ if (root.suspense && root.suspense.activeBranch === vnode) {
3770
+ root.suspense.vnode.el = root.el = el;
3771
+ vnode = root;
3772
+ }
3643
3773
  if (root === vnode) {
3644
3774
  (vnode = parent.vnode).el = el;
3645
3775
  parent = parent.parent;
3646
3776
  } else break;
3647
3777
  }
3778
+ if (suspense && suspense.activeBranch === vnode) suspense.vnode.el = el;
3648
3779
  }
3649
3780
  //#endregion
3650
3781
  //#region packages/runtime-core/src/internalObject.ts
@@ -3923,7 +4054,7 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
3923
4054
  const receivedType = toRawType(value);
3924
4055
  const expectedValue = styleValue(value, expectedType);
3925
4056
  const receivedValue = styleValue(value, receivedType);
3926
- 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}`;
3927
4058
  message += `, got ${receivedType} `;
3928
4059
  if (isExplicable(receivedType)) message += `with value ${receivedValue}.`;
3929
4060
  return message;
@@ -3932,7 +4063,8 @@ function getInvalidTypeMessage(name, value, expectedTypes) {
3932
4063
  * dev only
3933
4064
  */
3934
4065
  function styleValue(value, type) {
3935
- if (type === "String") return `"${value}"`;
4066
+ if (isSymbol(value)) return value.toString();
4067
+ else if (type === "String") return `"${value}"`;
3936
4068
  else if (type === "Number") return `${Number(value)}`;
3937
4069
  else return `${value}`;
3938
4070
  }
@@ -3949,8 +4081,11 @@ function isExplicable(type) {
3949
4081
  /**
3950
4082
  * dev only
3951
4083
  */
3952
- function isBoolean(...args) {
3953
- 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
+ });
3954
4089
  }
3955
4090
  //#endregion
3956
4091
  //#region packages/runtime-core/src/componentSlots.ts
@@ -4252,10 +4387,19 @@ function baseCreateRenderer(options, createHydrationFns) {
4252
4387
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4253
4388
  if (transition) performTransitionEnter(el, transition, () => hostInsert(el, container, anchor), parentSuspense);
4254
4389
  else hostInsert(el, container, anchor);
4255
- if ((vnodeHook = props && props.onVnodeMounted) || dirs) queuePostRenderEffect(() => {
4256
- vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4257
- dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4258
- }, void 0, parentSuspense);
4390
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
4391
+ const isHmr = !!(process.env.NODE_ENV !== "production") && isHmrUpdating;
4392
+ queuePostRenderEffect(() => {
4393
+ let prev;
4394
+ if (!!(process.env.NODE_ENV !== "production")) prev = setHmrUpdating(isHmr);
4395
+ try {
4396
+ vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4397
+ dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
4398
+ } finally {
4399
+ if (!!(process.env.NODE_ENV !== "production")) setHmrUpdating(prev);
4400
+ }
4401
+ }, void 0, parentSuspense);
4402
+ }
4259
4403
  };
4260
4404
  const setScopeId = (el, vnode, scopeId, slotScopeIds, parentComponent) => {
4261
4405
  if (scopeId) hostSetScopeId(el, scopeId);
@@ -4278,7 +4422,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4278
4422
  if (vnodeHook = newProps.onVnodeBeforeUpdate) invokeVNodeHook(vnodeHook, parentComponent, n2, n1);
4279
4423
  if (dirs) invokeDirectiveHook(n2, n1, parentComponent, "beforeUpdate");
4280
4424
  parentComponent && toggleRecurse(parentComponent, true);
4281
- if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating) {
4425
+ if (!!(process.env.NODE_ENV !== "production") && isHmrUpdating || dynamicChildren && (!n1.dynamicChildren || n1.dynamicChildren.length !== dynamicChildren.length)) {
4282
4426
  patchFlag = 0;
4283
4427
  optimized = false;
4284
4428
  dynamicChildren = null;
@@ -4359,19 +4503,35 @@ function baseCreateRenderer(options, createHydrationFns) {
4359
4503
  n2.slotScopeIds = slotScopeIds;
4360
4504
  if (n2.type.__vapor) if (n1 == null) if (n2.shapeFlag & 512) getVaporInterface(parentComponent, n2).activate(n2, container, anchor, parentComponent);
4361
4505
  else {
4506
+ const vnodeBeforeMountHook = !isAsyncWrapper(n2) && n2.props && n2.props.onVnodeBeforeMount;
4362
4507
  getVaporInterface(parentComponent, n2).mount(n2, container, anchor, parentComponent, parentSuspense, () => {
4363
4508
  if (n2.dirs) {
4364
4509
  invokeDirectiveHook(n2, null, parentComponent, "created");
4365
4510
  invokeDirectiveHook(n2, null, parentComponent, "beforeMount");
4366
4511
  }
4512
+ }, () => {
4513
+ if (vnodeBeforeMountHook) invokeVNodeHook(vnodeBeforeMountHook, parentComponent, n2);
4367
4514
  });
4368
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
+ }
4369
4521
  }
4370
4522
  else {
4371
- 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, () => {
4372
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);
4373
4529
  });
4374
- 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);
4375
4535
  }
4376
4536
  else if (n1 == null) if (n2.shapeFlag & 512) parentComponent.ctx.activate(n2, container, anchor, namespace, optimized);
4377
4537
  else mountComponent(n2, container, anchor, parentComponent, parentSuspense, namespace, optimized);
@@ -4723,8 +4883,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4723
4883
  else hostInsert(el, container, anchor);
4724
4884
  };
4725
4885
  const performLeave = () => {
4886
+ const wasLeaving = el._isLeaving || !!el[leaveCbKey];
4726
4887
  if (el._isLeaving) el[leaveCbKey](true);
4727
- leave(el, () => {
4888
+ if (transition.persisted && !wasLeaving) remove();
4889
+ else leave(el, () => {
4728
4890
  remove();
4729
4891
  afterLeave && afterLeave();
4730
4892
  });
@@ -4735,7 +4897,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4735
4897
  else hostInsert(el, container, anchor);
4736
4898
  };
4737
4899
  const unmount = (vnode, parentComponent, parentSuspense, doRemove = false, optimized = false) => {
4738
- const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex } = vnode;
4900
+ const { type, props, ref, children, dynamicChildren, shapeFlag, patchFlag, dirs, cacheIndex, memo } = vnode;
4739
4901
  if (patchFlag === -2) optimized = false;
4740
4902
  if (ref != null) {
4741
4903
  const prevSub = setActiveSub();
@@ -4755,7 +4917,10 @@ function baseCreateRenderer(options, createHydrationFns) {
4755
4917
  if (shapeFlag & 6) if (isVaporComponent(type)) {
4756
4918
  if (dirs) invokeDirectiveHook(vnode, null, parentComponent, "beforeUnmount");
4757
4919
  getVaporInterface(parentComponent, vnode).unmount(vnode, doRemove);
4758
- 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);
4759
4924
  return;
4760
4925
  } else unmountComponent(vnode.component, parentSuspense, doRemove);
4761
4926
  else {
@@ -4773,9 +4938,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4773
4938
  }
4774
4939
  if (doRemove) remove(vnode);
4775
4940
  }
4776
- if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs) queuePostRenderEffect(() => {
4941
+ const shouldInvalidateMemo = memo != null && cacheIndex == null;
4942
+ if (shouldInvokeVnodeHook && (vnodeHook = props && props.onVnodeUnmounted) || shouldInvokeDirs || shouldInvalidateMemo) queuePostRenderEffect(() => {
4777
4943
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
4778
4944
  shouldInvokeDirs && invokeDirectiveHook(vnode, null, parentComponent, "unmounted");
4945
+ if (shouldInvalidateMemo) vnode.el = null;
4779
4946
  }, void 0, parentSuspense);
4780
4947
  };
4781
4948
  const remove = (vnode) => {
@@ -4814,7 +4981,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4814
4981
  if (effect) {
4815
4982
  effect.stop();
4816
4983
  unmount(subTree, instance, parentSuspense, doRemove);
4817
- }
4984
+ } else if (doRemove && subTree && instance.vnode.el) remove(subTree);
4818
4985
  if (um) queuePostRenderEffect(um, void 0, parentSuspense);
4819
4986
  queuePostRenderEffect(() => instance.isUnmounted = true, void 0, parentSuspense);
4820
4987
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) devtoolsComponentRemoved(instance);
@@ -4940,6 +5107,10 @@ function invalidateMount(hooks) {
4940
5107
  if (hooks) for (let i = 0; i < hooks.length; i++) hooks[i].flags |= 4;
4941
5108
  }
4942
5109
  function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
5110
+ if (force && transition.persisted && !el[leaveCbKey]) {
5111
+ insert();
5112
+ return;
5113
+ }
4943
5114
  if (force || needTransition(parentSuspense, transition)) {
4944
5115
  transition.beforeEnter(el);
4945
5116
  insert();
@@ -5128,6 +5299,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5128
5299
  pendingId: suspenseId++,
5129
5300
  timeout: typeof timeout === "number" ? timeout : -1,
5130
5301
  activeBranch: null,
5302
+ isFallbackMountPending: false,
5131
5303
  pendingBranch: null,
5132
5304
  isInFallback: !isHydrating,
5133
5305
  isHydrating,
@@ -5143,20 +5315,25 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5143
5315
  if (suspense.isHydrating) suspense.isHydrating = false;
5144
5316
  else if (!resume) {
5145
5317
  delayEnter = activeBranch && pendingBranch.transition && pendingBranch.transition.mode === "out-in";
5318
+ let hasUpdatedAnchor = false;
5146
5319
  if (delayEnter) activeBranch.transition.afterLeave = () => {
5147
5320
  if (pendingId === suspense.pendingId) {
5148
- move(pendingBranch, container, anchor === initialAnchor ? next(activeBranch) : anchor, 0, parentComponent);
5321
+ move(pendingBranch, container, anchor === initialAnchor && !hasUpdatedAnchor ? next(activeBranch) : anchor, 0, parentComponent);
5149
5322
  queuePostFlushCb(effects);
5150
5323
  if (isInFallback && vnode.ssFallback) vnode.ssFallback.el = null;
5151
5324
  }
5152
5325
  };
5153
- if (activeBranch) {
5154
- if (parentNode(activeBranch.el) === container) anchor = next(activeBranch);
5326
+ if (activeBranch && !suspense.isFallbackMountPending) {
5327
+ if (parentNode(activeBranch.el) === container) {
5328
+ anchor = next(activeBranch);
5329
+ hasUpdatedAnchor = true;
5330
+ }
5155
5331
  unmount(activeBranch, parentComponent, suspense, true);
5156
5332
  if (!delayEnter && isInFallback && vnode.ssFallback) queuePostRenderEffect(() => vnode.ssFallback.el = null, void 0, suspense);
5157
5333
  }
5158
5334
  if (!delayEnter) move(pendingBranch, container, anchor, 0, parentComponent);
5159
5335
  }
5336
+ suspense.isFallbackMountPending = false;
5160
5337
  setActiveBranch(suspense, pendingBranch);
5161
5338
  suspense.pendingBranch = null;
5162
5339
  suspense.isInFallback = false;
@@ -5186,12 +5363,16 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5186
5363
  triggerEvent(vnode, "onFallback");
5187
5364
  const anchor = next(activeBranch);
5188
5365
  const mountFallback = () => {
5366
+ suspense.isFallbackMountPending = false;
5189
5367
  if (!suspense.isInFallback) return;
5190
5368
  patch(null, fallbackVNode, container, anchor, parentComponent, null, namespace, slotScopeIds, optimized);
5191
5369
  setActiveBranch(suspense, fallbackVNode);
5192
5370
  };
5193
5371
  const delayEnter = fallbackVNode.transition && fallbackVNode.transition.mode === "out-in";
5194
- if (delayEnter) activeBranch.transition.afterLeave = mountFallback;
5372
+ if (delayEnter) {
5373
+ suspense.isFallbackMountPending = true;
5374
+ activeBranch.transition.afterLeave = mountFallback;
5375
+ }
5195
5376
  suspense.isInFallback = true;
5196
5377
  unmount(activeBranch, parentComponent, null, true);
5197
5378
  if (!delayEnter) mountFallback();
@@ -5210,6 +5391,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5210
5391
  handleError(err, instance, 0);
5211
5392
  }).then((asyncSetupResult) => {
5212
5393
  if (instance.isUnmounted || suspense.isUnmounted || suspense.pendingId !== instance.suspenseId) return;
5394
+ setCurrentInstance(null, void 0);
5213
5395
  instance.asyncResolved = true;
5214
5396
  onResolve(asyncSetupResult);
5215
5397
  if (isInPendingSuspense && --suspense.deps === 0) suspense.resolve();
@@ -5499,11 +5681,29 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
5499
5681
  el: vnode.el,
5500
5682
  anchor: vnode.anchor,
5501
5683
  ctx: vnode.ctx,
5502
- ce: vnode.ce
5684
+ ce: vnode.ce,
5685
+ vi: vnode.vi,
5686
+ vs: cloneVaporSlotMeta(vnode),
5687
+ vb: vnode.vb
5503
5688
  };
5504
5689
  if (transition && cloneTransition) setTransitionHooks(cloned, transition.clone(cloned));
5505
5690
  return cloned;
5506
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
+ }
5507
5707
  /**
5508
5708
  * Dev only, for HMR of hoisted vnodes reused in v-for
5509
5709
  * https://github.com/vitejs/vite/issues/2022
@@ -5566,6 +5766,10 @@ function normalizeChildren(vnode, children) {
5566
5766
  }
5567
5767
  }
5568
5768
  else if (isFunction(children)) {
5769
+ if (shapeFlag & 65) {
5770
+ normalizeChildren(vnode, { default: children });
5771
+ return;
5772
+ }
5569
5773
  children = {
5570
5774
  default: children,
5571
5775
  _ctx: currentRenderingInstance
@@ -5592,6 +5796,7 @@ function mergeProps(...args) {
5592
5796
  const existing = ret[key];
5593
5797
  const incoming = toMerge[key];
5594
5798
  if (incoming && existing !== incoming && !(isArray(existing) && existing.includes(incoming))) ret[key] = existing ? [].concat(existing, incoming) : incoming;
5799
+ else if (incoming == null && existing == null && !isModelListener(key)) ret[key] = incoming;
5595
5800
  } else if (key !== "") ret[key] = toMerge[key];
5596
5801
  }
5597
5802
  return ret;
@@ -6187,7 +6392,7 @@ function isMemoSame(cached, memo) {
6187
6392
  }
6188
6393
  //#endregion
6189
6394
  //#region packages/runtime-core/src/index.ts
6190
- const version = "3.6.0-beta.8";
6395
+ const version = "3.6.0-rc.1";
6191
6396
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
6192
6397
  /**
6193
6398
  * Runtime error messages. Only exposed in dev or esm builds.
@@ -6222,4 +6427,4 @@ const resolveFilter = null;
6222
6427
  const compatUtils = null;
6223
6428
  const DeprecationTypes = null;
6224
6429
  //#endregion
6225
- 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, 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, 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 };