@vue/runtime-core 3.6.0-alpha.2 → 3.6.0-alpha.3

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-alpha.2
2
+ * @vue/runtime-core v3.6.0-alpha.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -449,9 +449,6 @@ const TeleportImpl = {
449
449
  insert(mainAnchor, container, anchor);
450
450
  const mount = (container2, anchor2) => {
451
451
  if (shapeFlag & 16) {
452
- if (parentComponent && parentComponent.isCE) {
453
- parentComponent.ce._teleportTarget = container2;
454
- }
455
452
  mountChildren(
456
453
  children,
457
454
  container2,
@@ -473,6 +470,9 @@ const TeleportImpl = {
473
470
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
474
471
  namespace = "mathml";
475
472
  }
473
+ if (parentComponent && parentComponent.isCE) {
474
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
475
+ }
476
476
  if (!disabled) {
477
477
  mount(target, targetAnchor);
478
478
  updateCssVars(n2, false);
@@ -661,26 +661,34 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
661
661
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
662
662
  o: { nextSibling, parentNode, querySelector, insert, createText }
663
663
  }, hydrateChildren) {
664
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
665
+ vnode2.anchor = hydrateChildren(
666
+ nextSibling(node2),
667
+ vnode2,
668
+ parentNode(node2),
669
+ parentComponent,
670
+ parentSuspense,
671
+ slotScopeIds,
672
+ optimized
673
+ );
674
+ vnode2.targetStart = targetStart;
675
+ vnode2.targetAnchor = targetAnchor;
676
+ }
664
677
  const target = vnode.target = resolveTarget(
665
678
  vnode.props,
666
679
  querySelector
667
680
  );
681
+ const disabled = isTeleportDisabled(vnode.props);
668
682
  if (target) {
669
- const disabled = isTeleportDisabled(vnode.props);
670
683
  const targetNode = target._lpa || target.firstChild;
671
684
  if (vnode.shapeFlag & 16) {
672
685
  if (disabled) {
673
- vnode.anchor = hydrateChildren(
674
- nextSibling(node),
686
+ hydrateDisabledTeleport(
687
+ node,
675
688
  vnode,
676
- parentNode(node),
677
- parentComponent,
678
- parentSuspense,
679
- slotScopeIds,
680
- optimized
689
+ targetNode,
690
+ targetNode && nextSibling(targetNode)
681
691
  );
682
- vnode.targetStart = targetNode;
683
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
684
692
  } else {
685
693
  vnode.anchor = nextSibling(node);
686
694
  let targetAnchor = targetNode;
@@ -711,6 +719,10 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
711
719
  }
712
720
  }
713
721
  updateCssVars(vnode, disabled);
722
+ } else if (disabled) {
723
+ if (vnode.shapeFlag & 16) {
724
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
725
+ }
714
726
  }
715
727
  return vnode.anchor && nextSibling(vnode.anchor);
716
728
  }
@@ -751,7 +763,7 @@ function useTransitionState() {
751
763
  isMounted: false,
752
764
  isLeaving: false,
753
765
  isUnmounting: false,
754
- leavingVNodes: /* @__PURE__ */ new Map()
766
+ leavingNodes: /* @__PURE__ */ new Map()
755
767
  };
756
768
  onMounted(() => {
757
769
  state.isMounted = true;
@@ -783,7 +795,7 @@ const BaseTransitionPropsValidators = {
783
795
  onAppearCancelled: TransitionHookValidator
784
796
  };
785
797
  const recursiveGetSubtree = (instance) => {
786
- const subTree = instance.subTree;
798
+ const subTree = instance.type.__vapor ? instance.block : instance.subTree;
787
799
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
788
800
  };
789
801
  const BaseTransitionImpl = {
@@ -819,7 +831,7 @@ const BaseTransitionImpl = {
819
831
  setTransitionHooks(innerChild, enterHooks);
820
832
  }
821
833
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
822
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
834
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
823
835
  let leavingHooks = resolveTransitionHooks(
824
836
  oldInnerChild,
825
837
  rawProps,
@@ -881,15 +893,53 @@ function findNonCommentChild(children) {
881
893
  }
882
894
  const BaseTransition = BaseTransitionImpl;
883
895
  function getLeavingNodesForType(state, vnode) {
884
- const { leavingVNodes } = state;
885
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
896
+ const { leavingNodes } = state;
897
+ let leavingVNodesCache = leavingNodes.get(vnode.type);
886
898
  if (!leavingVNodesCache) {
887
899
  leavingVNodesCache = /* @__PURE__ */ Object.create(null);
888
- leavingVNodes.set(vnode.type, leavingVNodesCache);
900
+ leavingNodes.set(vnode.type, leavingVNodesCache);
889
901
  }
890
902
  return leavingVNodesCache;
891
903
  }
892
904
  function resolveTransitionHooks(vnode, props, state, instance, postClone) {
905
+ const key = String(vnode.key);
906
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
907
+ const context = {
908
+ setLeavingNodeCache: () => {
909
+ leavingVNodesCache[key] = vnode;
910
+ },
911
+ unsetLeavingNodeCache: () => {
912
+ if (leavingVNodesCache[key] === vnode) {
913
+ delete leavingVNodesCache[key];
914
+ }
915
+ },
916
+ earlyRemove: () => {
917
+ const leavingVNode = leavingVNodesCache[key];
918
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
919
+ leavingVNode.el[leaveCbKey]();
920
+ }
921
+ },
922
+ cloneHooks: (vnode2) => {
923
+ const hooks = resolveTransitionHooks(
924
+ vnode2,
925
+ props,
926
+ state,
927
+ instance,
928
+ postClone
929
+ );
930
+ if (postClone) postClone(hooks);
931
+ return hooks;
932
+ }
933
+ };
934
+ return baseResolveTransitionHooks(context, props, state, instance);
935
+ }
936
+ function baseResolveTransitionHooks(context, props, state, instance) {
937
+ const {
938
+ setLeavingNodeCache,
939
+ unsetLeavingNodeCache,
940
+ earlyRemove,
941
+ cloneHooks
942
+ } = context;
893
943
  const {
894
944
  appear,
895
945
  mode,
@@ -907,8 +957,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
907
957
  onAfterAppear,
908
958
  onAppearCancelled
909
959
  } = props;
910
- const key = String(vnode.key);
911
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
912
960
  const callHook = (hook, args) => {
913
961
  hook && callWithAsyncErrorHandling(
914
962
  hook,
@@ -944,10 +992,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
944
992
  /* cancelled */
945
993
  );
946
994
  }
947
- const leavingVNode = leavingVNodesCache[key];
948
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
949
- leavingVNode.el[leaveCbKey]();
950
- }
995
+ earlyRemove();
951
996
  callHook(hook, [el]);
952
997
  },
953
998
  enter(el) {
@@ -984,7 +1029,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
984
1029
  }
985
1030
  },
986
1031
  leave(el, remove) {
987
- const key2 = String(vnode.key);
988
1032
  if (el[enterCbKey]) {
989
1033
  el[enterCbKey](
990
1034
  true
@@ -1006,27 +1050,17 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1006
1050
  callHook(onAfterLeave, [el]);
1007
1051
  }
1008
1052
  el[leaveCbKey] = void 0;
1009
- if (leavingVNodesCache[key2] === vnode) {
1010
- delete leavingVNodesCache[key2];
1011
- }
1053
+ unsetLeavingNodeCache(el);
1012
1054
  };
1013
- leavingVNodesCache[key2] = vnode;
1055
+ setLeavingNodeCache(el);
1014
1056
  if (onLeave) {
1015
1057
  callAsyncHook(onLeave, [el, done]);
1016
1058
  } else {
1017
1059
  done();
1018
1060
  }
1019
1061
  },
1020
- clone(vnode2) {
1021
- const hooks2 = resolveTransitionHooks(
1022
- vnode2,
1023
- props,
1024
- state,
1025
- instance,
1026
- postClone
1027
- );
1028
- if (postClone) postClone(hooks2);
1029
- return hooks2;
1062
+ clone(node) {
1063
+ return cloneHooks(node);
1030
1064
  }
1031
1065
  };
1032
1066
  return hooks;
@@ -1060,8 +1094,15 @@ function getInnerChild$1(vnode) {
1060
1094
  }
1061
1095
  function setTransitionHooks(vnode, hooks) {
1062
1096
  if (vnode.shapeFlag & 6 && vnode.component) {
1063
- vnode.transition = hooks;
1064
- setTransitionHooks(vnode.component.subTree, hooks);
1097
+ if (vnode.type.__vapor) {
1098
+ getVaporInterface(vnode.component, vnode).setTransitionHooks(
1099
+ vnode.component,
1100
+ hooks
1101
+ );
1102
+ } else {
1103
+ vnode.transition = hooks;
1104
+ setTransitionHooks(vnode.component.subTree, hooks);
1105
+ }
1065
1106
  } else if (vnode.shapeFlag & 128) {
1066
1107
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1067
1108
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -1092,7 +1133,6 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1092
1133
  return ret;
1093
1134
  }
1094
1135
 
1095
- /*! #__NO_SIDE_EFFECTS__ */
1096
1136
  // @__NO_SIDE_EFFECTS__
1097
1137
  function defineComponent(options, extraOptions) {
1098
1138
  return shared.isFunction(options) ? (
@@ -1130,6 +1170,7 @@ function useTemplateRef(key) {
1130
1170
  return ret;
1131
1171
  }
1132
1172
 
1173
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
1133
1174
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1134
1175
  if (shared.isArray(rawRef)) {
1135
1176
  rawRef.forEach(
@@ -1155,18 +1196,20 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1155
1196
  const oldRef = oldRawRef && oldRawRef.r;
1156
1197
  const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
1157
1198
  const setupState = owner.setupState;
1158
- const rawSetupState = reactivity.toRaw(setupState);
1159
- const canSetSetupRef = setupState === shared.EMPTY_OBJ ? () => false : (key) => {
1160
- return shared.hasOwn(rawSetupState, key);
1161
- };
1199
+ const canSetSetupRef = createCanSetSetupRefChecker(setupState);
1162
1200
  if (oldRef != null && oldRef !== ref) {
1201
+ invalidatePendingSetRef(oldRawRef);
1163
1202
  if (shared.isString(oldRef)) {
1164
1203
  refs[oldRef] = null;
1165
1204
  if (canSetSetupRef(oldRef)) {
1166
1205
  setupState[oldRef] = null;
1167
1206
  }
1168
1207
  } else if (reactivity.isRef(oldRef)) {
1169
- oldRef.value = null;
1208
+ {
1209
+ oldRef.value = null;
1210
+ }
1211
+ const oldRawRefAtom = oldRawRef;
1212
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
1170
1213
  }
1171
1214
  }
1172
1215
  if (shared.isFunction(ref)) {
@@ -1177,7 +1220,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1177
1220
  if (_isString || _isRef) {
1178
1221
  const doSet = () => {
1179
1222
  if (rawRef.f) {
1180
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
1223
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value ;
1181
1224
  if (isUnmount) {
1182
1225
  shared.isArray(existing) && shared.remove(existing, refValue);
1183
1226
  } else {
@@ -1188,8 +1231,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1188
1231
  setupState[ref] = refs[ref];
1189
1232
  }
1190
1233
  } else {
1191
- ref.value = [refValue];
1192
- if (rawRef.k) refs[rawRef.k] = ref.value;
1234
+ const newVal = [refValue];
1235
+ {
1236
+ ref.value = newVal;
1237
+ }
1238
+ if (rawRef.k) refs[rawRef.k] = newVal;
1193
1239
  }
1194
1240
  } else if (!existing.includes(refValue)) {
1195
1241
  existing.push(refValue);
@@ -1201,18 +1247,39 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1201
1247
  setupState[ref] = value;
1202
1248
  }
1203
1249
  } else if (_isRef) {
1204
- ref.value = value;
1250
+ {
1251
+ ref.value = value;
1252
+ }
1205
1253
  if (rawRef.k) refs[rawRef.k] = value;
1206
1254
  } else ;
1207
1255
  };
1208
1256
  if (value) {
1209
- queuePostRenderEffect(doSet, -1, parentSuspense);
1257
+ const job = () => {
1258
+ doSet();
1259
+ pendingSetRefMap.delete(rawRef);
1260
+ };
1261
+ pendingSetRefMap.set(rawRef, job);
1262
+ queuePostRenderEffect(job, -1, parentSuspense);
1210
1263
  } else {
1264
+ invalidatePendingSetRef(rawRef);
1211
1265
  doSet();
1212
1266
  }
1213
1267
  }
1214
1268
  }
1215
1269
  }
1270
+ function createCanSetSetupRefChecker(setupState) {
1271
+ const rawSetupState = reactivity.toRaw(setupState);
1272
+ return setupState === void 0 || setupState === shared.EMPTY_OBJ ? shared.NO : (key) => {
1273
+ return shared.hasOwn(rawSetupState, key);
1274
+ };
1275
+ }
1276
+ function invalidatePendingSetRef(rawRef) {
1277
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
1278
+ if (pendingSetRef) {
1279
+ pendingSetRef.flags |= 4;
1280
+ pendingSetRefMap.delete(rawRef);
1281
+ }
1282
+ }
1216
1283
 
1217
1284
  let hasLoggedMismatchError = false;
1218
1285
  const logMismatchError = () => {
@@ -1341,6 +1408,12 @@ function createHydrationFunctions(rendererInternals) {
1341
1408
  );
1342
1409
  }
1343
1410
  break;
1411
+ case VaporSlot:
1412
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(
1413
+ vnode,
1414
+ node
1415
+ );
1416
+ break;
1344
1417
  default:
1345
1418
  if (shapeFlag & 1) {
1346
1419
  if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
@@ -1356,9 +1429,6 @@ function createHydrationFunctions(rendererInternals) {
1356
1429
  );
1357
1430
  }
1358
1431
  } else if (shapeFlag & 6) {
1359
- if (vnode.type.__vapor) {
1360
- throw new Error("Vapor component hydration is not supported yet.");
1361
- }
1362
1432
  vnode.slotScopeIds = slotScopeIds;
1363
1433
  const container = parentNode(node);
1364
1434
  if (isFragmentStart) {
@@ -1368,15 +1438,25 @@ function createHydrationFunctions(rendererInternals) {
1368
1438
  } else {
1369
1439
  nextNode = nextSibling(node);
1370
1440
  }
1371
- mountComponent(
1372
- vnode,
1373
- container,
1374
- null,
1375
- parentComponent,
1376
- parentSuspense,
1377
- getContainerType(container),
1378
- optimized
1379
- );
1441
+ if (vnode.type.__vapor) {
1442
+ getVaporInterface(parentComponent, vnode).hydrate(
1443
+ vnode,
1444
+ node,
1445
+ container,
1446
+ null,
1447
+ parentComponent
1448
+ );
1449
+ } else {
1450
+ mountComponent(
1451
+ vnode,
1452
+ container,
1453
+ null,
1454
+ parentComponent,
1455
+ parentSuspense,
1456
+ getContainerType(container),
1457
+ optimized
1458
+ );
1459
+ }
1380
1460
  if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
1381
1461
  let subTree;
1382
1462
  if (isFragmentStart) {
@@ -1458,7 +1538,7 @@ function createHydrationFunctions(rendererInternals) {
1458
1538
  optimized
1459
1539
  );
1460
1540
  while (next) {
1461
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
1541
+ if (!isMismatchAllowed(el, 1)) {
1462
1542
  logMismatchError();
1463
1543
  }
1464
1544
  const cur = next;
@@ -1470,8 +1550,10 @@ function createHydrationFunctions(rendererInternals) {
1470
1550
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
1471
1551
  clientText = clientText.slice(1);
1472
1552
  }
1473
- if (el.textContent !== clientText) {
1474
- if (!isMismatchAllowed(el, 0 /* TEXT */)) {
1553
+ const { textContent } = el;
1554
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
1555
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
1556
+ if (!isMismatchAllowed(el, 0)) {
1475
1557
  logMismatchError();
1476
1558
  }
1477
1559
  el.textContent = vnode.children;
@@ -1551,7 +1633,7 @@ function createHydrationFunctions(rendererInternals) {
1551
1633
  } else if (isText && !vnode.children) {
1552
1634
  insert(vnode.el = createText(""), container);
1553
1635
  } else {
1554
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
1636
+ if (!isMismatchAllowed(container, 1)) {
1555
1637
  logMismatchError();
1556
1638
  }
1557
1639
  patch(
@@ -1592,7 +1674,7 @@ function createHydrationFunctions(rendererInternals) {
1592
1674
  }
1593
1675
  };
1594
1676
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
1595
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
1677
+ if (!isMismatchAllowed(node.parentElement, 1)) {
1596
1678
  logMismatchError();
1597
1679
  }
1598
1680
  vnode.el = null;
@@ -1656,21 +1738,21 @@ function createHydrationFunctions(rendererInternals) {
1656
1738
  parent = parent.parent;
1657
1739
  }
1658
1740
  };
1659
- const isTemplateNode = (node) => {
1660
- return node.nodeType === 1 && node.tagName === "TEMPLATE";
1661
- };
1662
1741
  return [hydrate, hydrateNode];
1663
1742
  }
1743
+ const isTemplateNode = (node) => {
1744
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
1745
+ };
1664
1746
  const allowMismatchAttr = "data-allow-mismatch";
1665
1747
  const MismatchTypeString = {
1666
- [0 /* TEXT */]: "text",
1667
- [1 /* CHILDREN */]: "children",
1668
- [2 /* CLASS */]: "class",
1669
- [3 /* STYLE */]: "style",
1670
- [4 /* ATTRIBUTE */]: "attribute"
1748
+ [0]: "text",
1749
+ [1]: "children",
1750
+ [2]: "class",
1751
+ [3]: "style",
1752
+ [4]: "attribute"
1671
1753
  };
1672
1754
  function isMismatchAllowed(el, allowedType) {
1673
- if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
1755
+ if (allowedType === 0 || allowedType === 1) {
1674
1756
  while (el && !el.hasAttribute(allowMismatchAttr)) {
1675
1757
  el = el.parentElement;
1676
1758
  }
@@ -1682,7 +1764,7 @@ function isMismatchAllowed(el, allowedType) {
1682
1764
  return true;
1683
1765
  } else {
1684
1766
  const list = allowedAttr.split(",");
1685
- if (allowedType === 0 /* TEXT */ && list.includes("children")) {
1767
+ if (allowedType === 0 && list.includes("children")) {
1686
1768
  return true;
1687
1769
  }
1688
1770
  return list.includes(MismatchTypeString[allowedType]);
@@ -1739,7 +1821,9 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
1739
1821
  hasHydrated = true;
1740
1822
  teardown();
1741
1823
  hydrate();
1742
- e.target.dispatchEvent(new e.constructor(e.type, e));
1824
+ if (!(`$evt${e.type}` in e.target)) {
1825
+ e.target.dispatchEvent(new e.constructor(e.type, e));
1826
+ }
1743
1827
  }
1744
1828
  };
1745
1829
  const teardown = () => {
@@ -1781,89 +1865,46 @@ function forEachElement(node, cb) {
1781
1865
  }
1782
1866
 
1783
1867
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
1784
- /*! #__NO_SIDE_EFFECTS__ */
1785
1868
  // @__NO_SIDE_EFFECTS__
1786
1869
  function defineAsyncComponent(source) {
1787
- if (shared.isFunction(source)) {
1788
- source = { loader: source };
1789
- }
1790
1870
  const {
1791
- loader,
1792
- loadingComponent,
1793
- errorComponent,
1794
- delay = 200,
1795
- hydrate: hydrateStrategy,
1796
- timeout,
1797
- // undefined = never times out
1798
- suspensible = true,
1799
- onError: userOnError
1800
- } = source;
1801
- let pendingRequest = null;
1802
- let resolvedComp;
1803
- let retries = 0;
1804
- const retry = () => {
1805
- retries++;
1806
- pendingRequest = null;
1807
- return load();
1808
- };
1809
- const load = () => {
1810
- let thisRequest;
1811
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1812
- err = err instanceof Error ? err : new Error(String(err));
1813
- if (userOnError) {
1814
- return new Promise((resolve, reject) => {
1815
- const userRetry = () => resolve(retry());
1816
- const userFail = () => reject(err);
1817
- userOnError(err, userRetry, userFail, retries + 1);
1818
- });
1819
- } else {
1820
- throw err;
1821
- }
1822
- }).then((comp) => {
1823
- if (thisRequest !== pendingRequest && pendingRequest) {
1824
- return pendingRequest;
1825
- }
1826
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
1827
- comp = comp.default;
1828
- }
1829
- resolvedComp = comp;
1830
- return comp;
1831
- }));
1832
- };
1871
+ load,
1872
+ getResolvedComp,
1873
+ setPendingRequest,
1874
+ source: {
1875
+ loadingComponent,
1876
+ errorComponent,
1877
+ delay,
1878
+ hydrate: hydrateStrategy,
1879
+ timeout,
1880
+ suspensible = true
1881
+ }
1882
+ } = createAsyncComponentContext(source);
1833
1883
  return defineComponent({
1834
1884
  name: "AsyncComponentWrapper",
1835
1885
  __asyncLoader: load,
1836
1886
  __asyncHydrate(el, instance, hydrate) {
1837
- const doHydrate = hydrateStrategy ? () => {
1838
- const performHydrate = () => {
1839
- hydrate();
1840
- };
1841
- const teardown = hydrateStrategy(
1842
- performHydrate,
1843
- (cb) => forEachElement(el, cb)
1844
- );
1845
- if (teardown) {
1846
- (instance.bum || (instance.bum = [])).push(teardown);
1847
- }
1848
- (instance.u || (instance.u = [])).push(() => true);
1849
- } : hydrate;
1850
- if (resolvedComp) {
1851
- doHydrate();
1852
- } else {
1853
- load().then(() => !instance.isUnmounted && doHydrate());
1854
- }
1887
+ performAsyncHydrate(
1888
+ el,
1889
+ instance,
1890
+ hydrate,
1891
+ getResolvedComp,
1892
+ load,
1893
+ hydrateStrategy
1894
+ );
1855
1895
  },
1856
1896
  get __asyncResolved() {
1857
- return resolvedComp;
1897
+ return getResolvedComp();
1858
1898
  },
1859
1899
  setup() {
1860
1900
  const instance = currentInstance;
1861
1901
  markAsyncBoundary(instance);
1902
+ let resolvedComp = getResolvedComp();
1862
1903
  if (resolvedComp) {
1863
1904
  return () => createInnerComp(resolvedComp, instance);
1864
1905
  }
1865
1906
  const onError = (err) => {
1866
- pendingRequest = null;
1907
+ setPendingRequest(null);
1867
1908
  handleError(
1868
1909
  err,
1869
1910
  instance,
@@ -1881,25 +1922,11 @@ function defineAsyncComponent(source) {
1881
1922
  }) : null;
1882
1923
  });
1883
1924
  }
1884
- const loaded = reactivity.ref(false);
1885
- const error = reactivity.ref();
1886
- const delayed = reactivity.ref(!!delay);
1887
- if (delay) {
1888
- setTimeout(() => {
1889
- delayed.value = false;
1890
- }, delay);
1891
- }
1892
- if (timeout != null) {
1893
- setTimeout(() => {
1894
- if (!loaded.value && !error.value) {
1895
- const err = new Error(
1896
- `Async component timed out after ${timeout}ms.`
1897
- );
1898
- onError(err);
1899
- error.value = err;
1900
- }
1901
- }, timeout);
1902
- }
1925
+ const { loaded, error, delayed } = useAsyncComponentState(
1926
+ delay,
1927
+ timeout,
1928
+ onError
1929
+ );
1903
1930
  load().then(() => {
1904
1931
  loaded.value = true;
1905
1932
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
@@ -1910,6 +1937,7 @@ function defineAsyncComponent(source) {
1910
1937
  error.value = err;
1911
1938
  });
1912
1939
  return () => {
1940
+ resolvedComp = getResolvedComp();
1913
1941
  if (loaded.value && resolvedComp) {
1914
1942
  return createInnerComp(resolvedComp, instance);
1915
1943
  } else if (error.value && errorComponent) {
@@ -1917,7 +1945,10 @@ function defineAsyncComponent(source) {
1917
1945
  error: error.value
1918
1946
  });
1919
1947
  } else if (loadingComponent && !delayed.value) {
1920
- return createVNode(loadingComponent);
1948
+ return createInnerComp(
1949
+ loadingComponent,
1950
+ instance
1951
+ );
1921
1952
  }
1922
1953
  };
1923
1954
  }
@@ -1931,6 +1962,94 @@ function createInnerComp(comp, parent) {
1931
1962
  delete parent.vnode.ce;
1932
1963
  return vnode;
1933
1964
  }
1965
+ function createAsyncComponentContext(source) {
1966
+ if (shared.isFunction(source)) {
1967
+ source = { loader: source };
1968
+ }
1969
+ const { loader, onError: userOnError } = source;
1970
+ let pendingRequest = null;
1971
+ let resolvedComp;
1972
+ let retries = 0;
1973
+ const retry = () => {
1974
+ retries++;
1975
+ pendingRequest = null;
1976
+ return load();
1977
+ };
1978
+ const load = () => {
1979
+ let thisRequest;
1980
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
1981
+ err = err instanceof Error ? err : new Error(String(err));
1982
+ if (userOnError) {
1983
+ return new Promise((resolve, reject) => {
1984
+ const userRetry = () => resolve(retry());
1985
+ const userFail = () => reject(err);
1986
+ userOnError(err, userRetry, userFail, retries + 1);
1987
+ });
1988
+ } else {
1989
+ throw err;
1990
+ }
1991
+ }).then((comp) => {
1992
+ if (thisRequest !== pendingRequest && pendingRequest) {
1993
+ return pendingRequest;
1994
+ }
1995
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
1996
+ comp = comp.default;
1997
+ }
1998
+ resolvedComp = comp;
1999
+ return comp;
2000
+ }));
2001
+ };
2002
+ return {
2003
+ load,
2004
+ source,
2005
+ getResolvedComp: () => resolvedComp,
2006
+ setPendingRequest: (request) => pendingRequest = request
2007
+ };
2008
+ }
2009
+ const useAsyncComponentState = (delay, timeout, onError) => {
2010
+ const loaded = reactivity.ref(false);
2011
+ const error = reactivity.ref();
2012
+ const delayed = reactivity.ref(!!delay);
2013
+ if (delay) {
2014
+ setTimeout(() => {
2015
+ delayed.value = false;
2016
+ }, delay);
2017
+ }
2018
+ if (timeout != null) {
2019
+ setTimeout(() => {
2020
+ if (!loaded.value && !error.value) {
2021
+ const err = new Error(`Async component timed out after ${timeout}ms.`);
2022
+ onError(err);
2023
+ error.value = err;
2024
+ }
2025
+ }, timeout);
2026
+ }
2027
+ return { loaded, error, delayed };
2028
+ };
2029
+ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
2030
+ let patched = false;
2031
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
2032
+ const performHydrate = () => {
2033
+ if (patched) {
2034
+ return;
2035
+ }
2036
+ hydrate();
2037
+ };
2038
+ const doHydrate = hydrateStrategy ? () => {
2039
+ const teardown = hydrateStrategy(
2040
+ performHydrate,
2041
+ (cb) => forEachElement(el, cb)
2042
+ );
2043
+ if (teardown) {
2044
+ (instance.bum || (instance.bum = [])).push(teardown);
2045
+ }
2046
+ } : performHydrate;
2047
+ if (getResolvedComp()) {
2048
+ doHydrate();
2049
+ } else {
2050
+ load().then(() => !instance.isUnmounted && doHydrate());
2051
+ }
2052
+ }
1934
2053
 
1935
2054
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
1936
2055
  const KeepAliveImpl = {
@@ -1957,77 +2076,37 @@ const KeepAliveImpl = {
1957
2076
  const keys = /* @__PURE__ */ new Set();
1958
2077
  let current = null;
1959
2078
  const parentSuspense = keepAliveInstance.suspense;
2079
+ const { renderer } = sharedContext;
1960
2080
  const {
1961
- renderer: {
1962
- p: patch,
1963
- m: move,
1964
- um: _unmount,
1965
- o: { createElement }
1966
- }
1967
- } = sharedContext;
2081
+ um: _unmount,
2082
+ o: { createElement }
2083
+ } = renderer;
1968
2084
  const storageContainer = createElement("div");
2085
+ sharedContext.getStorageContainer = () => storageContainer;
2086
+ sharedContext.getCachedComponent = (vnode) => {
2087
+ const key = vnode.key == null ? vnode.type : vnode.key;
2088
+ return cache.get(key);
2089
+ };
1969
2090
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
1970
- const instance = vnode.component;
1971
- move(
2091
+ activate(
1972
2092
  vnode,
1973
2093
  container,
1974
2094
  anchor,
1975
- 0,
2095
+ renderer,
1976
2096
  keepAliveInstance,
1977
- parentSuspense
1978
- );
1979
- patch(
1980
- instance.vnode,
1981
- vnode,
1982
- container,
1983
- anchor,
1984
- instance,
1985
2097
  parentSuspense,
1986
2098
  namespace,
1987
- vnode.slotScopeIds,
1988
2099
  optimized
1989
2100
  );
1990
- queuePostRenderEffect(
1991
- () => {
1992
- instance.isDeactivated = false;
1993
- if (instance.a) {
1994
- shared.invokeArrayFns(instance.a);
1995
- }
1996
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
1997
- if (vnodeHook) {
1998
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
1999
- }
2000
- },
2001
- void 0,
2002
- parentSuspense
2003
- );
2004
2101
  };
2005
2102
  sharedContext.deactivate = (vnode) => {
2006
- const instance = vnode.component;
2007
- invalidateMount(instance.m);
2008
- invalidateMount(instance.a);
2009
- move(
2103
+ deactivate(
2010
2104
  vnode,
2011
2105
  storageContainer,
2012
- null,
2013
- 1,
2106
+ renderer,
2014
2107
  keepAliveInstance,
2015
2108
  parentSuspense
2016
2109
  );
2017
- queuePostRenderEffect(
2018
- () => {
2019
- if (instance.da) {
2020
- shared.invokeArrayFns(instance.da);
2021
- }
2022
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
2023
- if (vnodeHook) {
2024
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
2025
- }
2026
- instance.isDeactivated = true;
2027
- },
2028
- void 0,
2029
- parentSuspense
2030
- );
2031
2110
  };
2032
2111
  function unmount(vnode) {
2033
2112
  resetShapeFlag(vnode);
@@ -2171,7 +2250,7 @@ function onActivated(hook, target) {
2171
2250
  function onDeactivated(hook, target) {
2172
2251
  registerKeepAliveHook(hook, "da", target);
2173
2252
  }
2174
- function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
2253
+ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance()) {
2175
2254
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2176
2255
  let current = target;
2177
2256
  while (current) {
@@ -2185,8 +2264,9 @@ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
2185
2264
  injectHook(type, wrappedHook, target);
2186
2265
  if (target) {
2187
2266
  let current = target.parent;
2188
- while (current && current.parent && current.parent.vnode) {
2189
- if (isKeepAlive(current.parent.vnode)) {
2267
+ while (current && current.parent) {
2268
+ let parent = current.parent;
2269
+ if (isKeepAlive(parent.vapor ? parent : parent.vnode)) {
2190
2270
  injectToKeepAliveRoot(wrappedHook, type, target, current);
2191
2271
  }
2192
2272
  current = current.parent;
@@ -2212,6 +2292,62 @@ function resetShapeFlag(vnode) {
2212
2292
  function getInnerChild(vnode) {
2213
2293
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
2214
2294
  }
2295
+ function activate(vnode, container, anchor, { p: patch, m: move }, parentComponent, parentSuspense, namespace, optimized) {
2296
+ const instance = vnode.component;
2297
+ move(
2298
+ vnode,
2299
+ container,
2300
+ anchor,
2301
+ 0,
2302
+ parentComponent,
2303
+ parentSuspense
2304
+ );
2305
+ patch(
2306
+ instance.vnode,
2307
+ vnode,
2308
+ container,
2309
+ anchor,
2310
+ instance,
2311
+ parentSuspense,
2312
+ namespace,
2313
+ vnode.slotScopeIds,
2314
+ optimized
2315
+ );
2316
+ queuePostRenderEffect(
2317
+ () => {
2318
+ instance.isDeactivated = false;
2319
+ if (instance.a) {
2320
+ shared.invokeArrayFns(instance.a);
2321
+ }
2322
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
2323
+ if (vnodeHook) {
2324
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
2325
+ }
2326
+ },
2327
+ void 0,
2328
+ parentSuspense
2329
+ );
2330
+ }
2331
+ function deactivate(vnode, container, { m: move }, parentComponent, parentSuspense) {
2332
+ const instance = vnode.component;
2333
+ invalidateMount(instance.m);
2334
+ invalidateMount(instance.a);
2335
+ move(vnode, container, null, 1, parentComponent, parentSuspense);
2336
+ queuePostRenderEffect(
2337
+ () => {
2338
+ if (instance.da) {
2339
+ shared.invokeArrayFns(instance.da);
2340
+ }
2341
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
2342
+ if (vnodeHook) {
2343
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
2344
+ }
2345
+ instance.isDeactivated = true;
2346
+ },
2347
+ void 0,
2348
+ parentSuspense
2349
+ );
2350
+ }
2215
2351
 
2216
2352
  function injectHook(type, hook, target = currentInstance, prepend = false) {
2217
2353
  if (target) {
@@ -2383,12 +2519,13 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2383
2519
  return ret;
2384
2520
  }
2385
2521
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
2522
+ const hasProps = Object.keys(props).length > 0;
2386
2523
  if (name !== "default") props.name = name;
2387
2524
  return openBlock(), createBlock(
2388
2525
  Fragment,
2389
2526
  null,
2390
2527
  [createVNode("slot", props, fallback && fallback())],
2391
- 64
2528
+ hasProps ? -2 : 64
2392
2529
  );
2393
2530
  }
2394
2531
  if (slot && slot._c) {
@@ -2396,6 +2533,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
2396
2533
  }
2397
2534
  openBlock();
2398
2535
  const validSlotContent = slot && ensureValidVNode(slot(props));
2536
+ ensureVaporSlotFallback(validSlotContent, fallback);
2399
2537
  const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
2400
2538
  // key attached in the `createSlots` helper, respect that
2401
2539
  validSlotContent && validSlotContent.key;
@@ -2425,6 +2563,14 @@ function ensureValidVNode(vnodes) {
2425
2563
  return true;
2426
2564
  }) ? vnodes : null;
2427
2565
  }
2566
+ function ensureVaporSlotFallback(vnodes, fallback) {
2567
+ let vaporSlot;
2568
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
2569
+ if (!vaporSlot.fallback && fallback) {
2570
+ vaporSlot.fallback = fallback;
2571
+ }
2572
+ }
2573
+ }
2428
2574
 
2429
2575
  function toHandlers(obj, preserveCaseIfNecessary) {
2430
2576
  const ret = {};
@@ -2549,10 +2695,10 @@ const PublicInstanceProxyHandlers = {
2549
2695
  return true;
2550
2696
  },
2551
2697
  has({
2552
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
2698
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
2553
2699
  }, key) {
2554
- let normalizedProps;
2555
- return !!accessCache[key] || data !== shared.EMPTY_OBJ && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key);
2700
+ let normalizedProps, cssModules;
2701
+ return !!(accessCache[key] || data !== shared.EMPTY_OBJ && key[0] !== "$" && shared.hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && shared.hasOwn(normalizedProps, key) || shared.hasOwn(ctx, key) || shared.hasOwn(publicPropertiesMap, key) || shared.hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
2556
2702
  },
2557
2703
  defineProperty(target, key, descriptor) {
2558
2704
  if (descriptor.get != null) {
@@ -2600,7 +2746,7 @@ function useSlots() {
2600
2746
  function useAttrs() {
2601
2747
  return getContext().attrs;
2602
2748
  }
2603
- function getContext() {
2749
+ function getContext(calledFunctionName) {
2604
2750
  const i = getCurrentGenericInstance();
2605
2751
  if (i.vapor) {
2606
2752
  return i;
@@ -2784,7 +2930,8 @@ function applyOptions(instance) {
2784
2930
  expose.forEach((key) => {
2785
2931
  Object.defineProperty(exposed, key, {
2786
2932
  get: () => publicThis[key],
2787
- set: (val) => publicThis[key] = val
2933
+ set: (val) => publicThis[key] = val,
2934
+ enumerable: true
2788
2935
  });
2789
2936
  });
2790
2937
  } else if (!instance.exposed) {
@@ -3436,7 +3583,7 @@ function validatePropName(key) {
3436
3583
  return false;
3437
3584
  }
3438
3585
 
3439
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
3586
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
3440
3587
  const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
3441
3588
  const normalizeSlot = (key, rawSlot, ctx) => {
3442
3589
  if (rawSlot._n) {
@@ -3476,8 +3623,6 @@ const assignSlots = (slots, children, optimized) => {
3476
3623
  const initSlots = (instance, children, optimized) => {
3477
3624
  const slots = instance.slots = createInternalObject();
3478
3625
  if (instance.vnode.shapeFlag & 32) {
3479
- const cacheIndexes = children.__;
3480
- if (cacheIndexes) shared.def(slots, "__", cacheIndexes, true);
3481
3626
  const type = children._;
3482
3627
  if (type) {
3483
3628
  assignSlots(slots, children, optimized);
@@ -3717,15 +3862,25 @@ function baseCreateRenderer(options, createHydrationFns) {
3717
3862
  optimized
3718
3863
  );
3719
3864
  } else {
3720
- patchElement(
3721
- n1,
3722
- n2,
3723
- parentComponent,
3724
- parentSuspense,
3725
- namespace,
3726
- slotScopeIds,
3727
- optimized
3728
- );
3865
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
3866
+ try {
3867
+ if (customElement) {
3868
+ customElement._beginPatch();
3869
+ }
3870
+ patchElement(
3871
+ n1,
3872
+ n2,
3873
+ parentComponent,
3874
+ parentSuspense,
3875
+ namespace,
3876
+ slotScopeIds,
3877
+ optimized
3878
+ );
3879
+ } finally {
3880
+ if (customElement) {
3881
+ customElement._endPatch();
3882
+ }
3883
+ }
3729
3884
  }
3730
3885
  };
3731
3886
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -3772,16 +3927,20 @@ function baseCreateRenderer(options, createHydrationFns) {
3772
3927
  if (dirs) {
3773
3928
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
3774
3929
  }
3775
- const needCallTransitionHooks = needTransition(parentSuspense, transition);
3776
- if (needCallTransitionHooks) {
3777
- transition.beforeEnter(el);
3930
+ if (transition) {
3931
+ performTransitionEnter(
3932
+ el,
3933
+ transition,
3934
+ () => hostInsert(el, container, anchor),
3935
+ parentSuspense
3936
+ );
3937
+ } else {
3938
+ hostInsert(el, container, anchor);
3778
3939
  }
3779
- hostInsert(el, container, anchor);
3780
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
3940
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
3781
3941
  queuePostRenderEffect(
3782
3942
  () => {
3783
3943
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
3784
- needCallTransitionHooks && transition.enter(el);
3785
3944
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
3786
3945
  },
3787
3946
  void 0,
@@ -3798,18 +3957,9 @@ function baseCreateRenderer(options, createHydrationFns) {
3798
3957
  hostSetScopeId(el, slotScopeIds[i]);
3799
3958
  }
3800
3959
  }
3801
- let subTree = parentComponent && parentComponent.subTree;
3802
- if (subTree) {
3803
- if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
3804
- const parentVNode = parentComponent.vnode;
3805
- setScopeId(
3806
- el,
3807
- parentVNode,
3808
- parentVNode.scopeId,
3809
- parentVNode.slotScopeIds,
3810
- parentComponent.parent
3811
- );
3812
- }
3960
+ const inheritedScopeIds = getInheritedScopeIds(vnode, parentComponent);
3961
+ for (let i = 0; i < inheritedScopeIds.length; i++) {
3962
+ hostSetScopeId(el, inheritedScopeIds[i]);
3813
3963
  }
3814
3964
  };
3815
3965
  const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
@@ -4042,12 +4192,21 @@ function baseCreateRenderer(options, createHydrationFns) {
4042
4192
  n2.slotScopeIds = slotScopeIds;
4043
4193
  if (n2.type.__vapor) {
4044
4194
  if (n1 == null) {
4045
- getVaporInterface(parentComponent, n2).mount(
4046
- n2,
4047
- container,
4048
- anchor,
4049
- parentComponent
4050
- );
4195
+ if (n2.shapeFlag & 512) {
4196
+ getVaporInterface(parentComponent, n2).activate(
4197
+ n2,
4198
+ container,
4199
+ anchor,
4200
+ parentComponent
4201
+ );
4202
+ } else {
4203
+ getVaporInterface(parentComponent, n2).mount(
4204
+ n2,
4205
+ container,
4206
+ anchor,
4207
+ parentComponent
4208
+ );
4209
+ }
4051
4210
  } else {
4052
4211
  getVaporInterface(parentComponent, n2).update(
4053
4212
  n1,
@@ -4096,6 +4255,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4096
4255
  if (!initialVNode.el) {
4097
4256
  const placeholder = instance.subTree = createVNode(Comment);
4098
4257
  processCommentNode(null, placeholder, container, anchor);
4258
+ initialVNode.placeholder = placeholder.el;
4099
4259
  }
4100
4260
  } else {
4101
4261
  setupRenderEffect(
@@ -4567,7 +4727,11 @@ function baseCreateRenderer(options, createHydrationFns) {
4567
4727
  for (i = toBePatched - 1; i >= 0; i--) {
4568
4728
  const nextIndex = s2 + i;
4569
4729
  const nextChild = c2[nextIndex];
4570
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
4730
+ const anchorVNode = c2[nextIndex + 1];
4731
+ const anchor = nextIndex + 1 < l2 ? (
4732
+ // #13559, fallback to el placeholder for unresolved async component
4733
+ anchorVNode.el || anchorVNode.placeholder
4734
+ ) : parentAnchor;
4571
4735
  if (newIndexToOldIndexMap[i] === 0) {
4572
4736
  patch(
4573
4737
  null,
@@ -4647,12 +4811,12 @@ function baseCreateRenderer(options, createHydrationFns) {
4647
4811
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
4648
4812
  if (needTransition2) {
4649
4813
  if (moveType === 0) {
4650
- transition.beforeEnter(el);
4651
- hostInsert(el, container, anchor);
4652
- queuePostRenderEffect(
4653
- () => transition.enter(el),
4654
- void 0,
4655
- parentSuspense
4814
+ performTransitionEnter(
4815
+ el,
4816
+ transition,
4817
+ () => hostInsert(el, container, anchor),
4818
+ parentSuspense,
4819
+ true
4656
4820
  );
4657
4821
  } else {
4658
4822
  const { leave, delayLeave, afterLeave } = transition;
@@ -4664,6 +4828,12 @@ function baseCreateRenderer(options, createHydrationFns) {
4664
4828
  }
4665
4829
  };
4666
4830
  const performLeave = () => {
4831
+ if (el._isLeaving) {
4832
+ el[leaveCbKey](
4833
+ true
4834
+ /* cancelled */
4835
+ );
4836
+ }
4667
4837
  leave(el, () => {
4668
4838
  remove2();
4669
4839
  afterLeave && afterLeave();
@@ -4703,7 +4873,14 @@ function baseCreateRenderer(options, createHydrationFns) {
4703
4873
  parentComponent.renderCache[cacheIndex] = void 0;
4704
4874
  }
4705
4875
  if (shapeFlag & 256) {
4706
- parentComponent.ctx.deactivate(vnode);
4876
+ if (vnode.type.__vapor) {
4877
+ getVaporInterface(parentComponent, vnode).deactivate(
4878
+ vnode,
4879
+ parentComponent.ctx.getStorageContainer()
4880
+ );
4881
+ } else {
4882
+ parentComponent.ctx.deactivate(vnode);
4883
+ }
4707
4884
  return;
4708
4885
  }
4709
4886
  const shouldInvokeDirs = shapeFlag & 1 && dirs;
@@ -4783,22 +4960,15 @@ function baseCreateRenderer(options, createHydrationFns) {
4783
4960
  removeStaticNode(vnode);
4784
4961
  return;
4785
4962
  }
4786
- const performRemove = () => {
4787
- hostRemove(el);
4788
- if (transition && !transition.persisted && transition.afterLeave) {
4789
- transition.afterLeave();
4790
- }
4791
- };
4792
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
4793
- const { leave, delayLeave } = transition;
4794
- const performLeave = () => leave(el, performRemove);
4795
- if (delayLeave) {
4796
- delayLeave(vnode.el, performRemove, performLeave);
4797
- } else {
4798
- performLeave();
4799
- }
4963
+ if (transition) {
4964
+ performTransitionLeave(
4965
+ el,
4966
+ transition,
4967
+ () => hostRemove(el),
4968
+ !!(vnode.shapeFlag & 1)
4969
+ );
4800
4970
  } else {
4801
- performRemove();
4971
+ hostRemove(el);
4802
4972
  }
4803
4973
  };
4804
4974
  const removeFragment = (cur, end) => {
@@ -4811,27 +4981,12 @@ function baseCreateRenderer(options, createHydrationFns) {
4811
4981
  hostRemove(end);
4812
4982
  };
4813
4983
  const unmountComponent = (instance, parentSuspense, doRemove) => {
4814
- const {
4815
- bum,
4816
- scope,
4817
- effect,
4818
- subTree,
4819
- um,
4820
- m,
4821
- a,
4822
- parent,
4823
- slots: { __: slotCacheKeys }
4824
- } = instance;
4984
+ const { bum, scope, effect, subTree, um, m, a } = instance;
4825
4985
  invalidateMount(m);
4826
4986
  invalidateMount(a);
4827
4987
  if (bum) {
4828
4988
  shared.invokeArrayFns(bum);
4829
4989
  }
4830
- if (parent && shared.isArray(slotCacheKeys)) {
4831
- slotCacheKeys.forEach((v) => {
4832
- parent.renderCache[v] = void 0;
4833
- });
4834
- }
4835
4990
  scope.stop();
4836
4991
  if (effect) {
4837
4992
  effect.stop();
@@ -4845,12 +5000,6 @@ function baseCreateRenderer(options, createHydrationFns) {
4845
5000
  void 0,
4846
5001
  parentSuspense
4847
5002
  );
4848
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
4849
- parentSuspense.deps--;
4850
- if (parentSuspense.deps === 0) {
4851
- parentSuspense.resolve();
4852
- }
4853
- }
4854
5003
  };
4855
5004
  const unmountChildren = (children, parentComponent, parentSuspense, doRemove = false, optimized = false, start = 0) => {
4856
5005
  for (let i = start; i < children.length; i++) {
@@ -4860,7 +5009,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4860
5009
  const getNextHostNode = (vnode) => {
4861
5010
  if (vnode.shapeFlag & 6) {
4862
5011
  if (vnode.type.__vapor) {
4863
- return hostNextSibling(vnode.component.block);
5012
+ return hostNextSibling(vnode.anchor);
4864
5013
  }
4865
5014
  return getNextHostNode(vnode.component.subTree);
4866
5015
  }
@@ -4931,6 +5080,7 @@ function baseCreateRenderer(options, createHydrationFns) {
4931
5080
  return {
4932
5081
  render,
4933
5082
  hydrate,
5083
+ hydrateNode,
4934
5084
  internals,
4935
5085
  createApp: createAppAPI(
4936
5086
  mountApp,
@@ -4970,7 +5120,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
4970
5120
  if (!shallow && c2.patchFlag !== -2)
4971
5121
  traverseStaticChildren(c1, c2);
4972
5122
  }
4973
- if (c2.type === Text) {
5123
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
5124
+ c2.patchFlag !== -1) {
4974
5125
  c2.el = c1.el;
4975
5126
  }
4976
5127
  if (c2.type === Comment && !c2.el) {
@@ -4980,7 +5131,7 @@ function traverseStaticChildren(n1, n2, shallow = false) {
4980
5131
  }
4981
5132
  }
4982
5133
  function locateNonHydratedAsyncRoot(instance) {
4983
- const subComponent = instance.vapor ? null : instance.subTree.component;
5134
+ const subComponent = instance.subTree && instance.subTree.component;
4984
5135
  if (subComponent) {
4985
5136
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
4986
5137
  return subComponent;
@@ -4995,11 +5146,62 @@ function invalidateMount(hooks) {
4995
5146
  hooks[i].flags |= 4;
4996
5147
  }
4997
5148
  }
5149
+ function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
5150
+ if (force || needTransition(parentSuspense, transition)) {
5151
+ transition.beforeEnter(el);
5152
+ insert();
5153
+ queuePostRenderEffect(() => transition.enter(el), void 0, parentSuspense);
5154
+ } else {
5155
+ insert();
5156
+ }
5157
+ }
5158
+ function performTransitionLeave(el, transition, remove, isElement = true) {
5159
+ const performRemove = () => {
5160
+ remove();
5161
+ if (transition && !transition.persisted && transition.afterLeave) {
5162
+ transition.afterLeave();
5163
+ }
5164
+ };
5165
+ if (isElement && transition && !transition.persisted) {
5166
+ const { leave, delayLeave } = transition;
5167
+ const performLeave = () => leave(el, performRemove);
5168
+ if (delayLeave) {
5169
+ delayLeave(el, performRemove, performLeave);
5170
+ } else {
5171
+ performLeave();
5172
+ }
5173
+ } else {
5174
+ performRemove();
5175
+ }
5176
+ }
4998
5177
  function getVaporInterface(instance, vnode) {
4999
5178
  const ctx = instance ? instance.appContext : vnode.appContext;
5000
5179
  const res = ctx && ctx.vapor;
5001
5180
  return res;
5002
5181
  }
5182
+ function getInheritedScopeIds(vnode, parentComponent) {
5183
+ const inheritedScopeIds = [];
5184
+ let currentParent = parentComponent;
5185
+ let currentVNode = vnode;
5186
+ while (currentParent) {
5187
+ let subTree = currentParent.subTree;
5188
+ if (!subTree) break;
5189
+ if (currentVNode === subTree || isSuspense(subTree.type) && (subTree.ssContent === currentVNode || subTree.ssFallback === currentVNode)) {
5190
+ const parentVNode = currentParent.vnode;
5191
+ if (parentVNode.scopeId) {
5192
+ inheritedScopeIds.push(parentVNode.scopeId);
5193
+ }
5194
+ if (parentVNode.slotScopeIds) {
5195
+ inheritedScopeIds.push(...parentVNode.slotScopeIds);
5196
+ }
5197
+ currentVNode = parentVNode;
5198
+ currentParent = currentParent.parent;
5199
+ } else {
5200
+ break;
5201
+ }
5202
+ }
5203
+ return inheritedScopeIds;
5204
+ }
5003
5205
 
5004
5206
  const ssrContextKey = Symbol.for("v-scx");
5005
5207
  const useSSRContext = () => {
@@ -5265,8 +5467,9 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
5265
5467
  function defaultPropGetter(props, key) {
5266
5468
  return props[key];
5267
5469
  }
5470
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
5268
5471
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
5269
- const cache = appContext.emitsCache;
5472
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
5270
5473
  const cached = cache.get(comp);
5271
5474
  if (cached !== void 0) {
5272
5475
  return cached;
@@ -5635,7 +5838,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
5635
5838
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
5636
5839
  if (pendingBranch) {
5637
5840
  suspense.pendingBranch = newBranch;
5638
- if (isSameVNodeType(newBranch, pendingBranch)) {
5841
+ if (isSameVNodeType(pendingBranch, newBranch)) {
5639
5842
  patch(
5640
5843
  pendingBranch,
5641
5844
  newBranch,
@@ -5706,7 +5909,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
5706
5909
  );
5707
5910
  setActiveBranch(suspense, newFallback);
5708
5911
  }
5709
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
5912
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
5710
5913
  patch(
5711
5914
  activeBranch,
5712
5915
  newBranch,
@@ -5737,7 +5940,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
5737
5940
  }
5738
5941
  }
5739
5942
  } else {
5740
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
5943
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
5741
5944
  patch(
5742
5945
  activeBranch,
5743
5946
  newBranch,
@@ -5828,7 +6031,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5828
6031
  pendingId,
5829
6032
  effects,
5830
6033
  parentComponent: parentComponent2,
5831
- container: container2
6034
+ container: container2,
6035
+ isInFallback
5832
6036
  } = suspense;
5833
6037
  let delayEnter = false;
5834
6038
  if (suspense.isHydrating) {
@@ -5846,6 +6050,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5846
6050
  parentComponent2
5847
6051
  );
5848
6052
  queuePostFlushCb(effects);
6053
+ if (isInFallback && vnode2.ssFallback) {
6054
+ vnode2.ssFallback.el = null;
6055
+ }
5849
6056
  }
5850
6057
  };
5851
6058
  }
@@ -5854,6 +6061,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5854
6061
  anchor = next(activeBranch);
5855
6062
  }
5856
6063
  unmount(activeBranch, parentComponent2, suspense, true);
6064
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
6065
+ vnode2.ssFallback.el = null;
6066
+ }
5857
6067
  }
5858
6068
  if (!delayEnter) {
5859
6069
  move(
@@ -5975,6 +6185,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
5975
6185
  optimized2
5976
6186
  );
5977
6187
  if (placeholder) {
6188
+ vnode2.placeholder = null;
5978
6189
  remove(placeholder);
5979
6190
  }
5980
6191
  updateHOCHostEl(instance, vnode2.el);
@@ -6159,15 +6370,11 @@ function isSameVNodeType(n1, n2) {
6159
6370
  function transformVNodeArgs(transformer) {
6160
6371
  }
6161
6372
  const normalizeKey = ({ key }) => key != null ? key : null;
6162
- const normalizeRef = ({
6163
- ref,
6164
- ref_key,
6165
- ref_for
6166
- }) => {
6373
+ const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
6167
6374
  if (typeof ref === "number") {
6168
6375
  ref = "" + ref;
6169
6376
  }
6170
- return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
6377
+ return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i, r: ref, k: ref_key, f: !!ref_for } : ref : null;
6171
6378
  };
6172
6379
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
6173
6380
  const vnode = {
@@ -6318,6 +6525,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
6318
6525
  suspense: vnode.suspense,
6319
6526
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
6320
6527
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
6528
+ placeholder: vnode.placeholder,
6321
6529
  el: vnode.el,
6322
6530
  anchor: vnode.anchor,
6323
6531
  ctx: vnode.ctx,
@@ -6735,23 +6943,28 @@ const computed = (getterOrOptions, debugOptions) => {
6735
6943
  };
6736
6944
 
6737
6945
  function h(type, propsOrChildren, children) {
6738
- const l = arguments.length;
6739
- if (l === 2) {
6740
- if (shared.isObject(propsOrChildren) && !shared.isArray(propsOrChildren)) {
6741
- if (isVNode(propsOrChildren)) {
6742
- return createVNode(type, null, [propsOrChildren]);
6946
+ try {
6947
+ setBlockTracking(-1);
6948
+ const l = arguments.length;
6949
+ if (l === 2) {
6950
+ if (shared.isObject(propsOrChildren) && !shared.isArray(propsOrChildren)) {
6951
+ if (isVNode(propsOrChildren)) {
6952
+ return createVNode(type, null, [propsOrChildren]);
6953
+ }
6954
+ return createVNode(type, propsOrChildren);
6955
+ } else {
6956
+ return createVNode(type, null, propsOrChildren);
6743
6957
  }
6744
- return createVNode(type, propsOrChildren);
6745
6958
  } else {
6746
- return createVNode(type, null, propsOrChildren);
6747
- }
6748
- } else {
6749
- if (l > 3) {
6750
- children = Array.prototype.slice.call(arguments, 2);
6751
- } else if (l === 3 && isVNode(children)) {
6752
- children = [children];
6959
+ if (l > 3) {
6960
+ children = Array.prototype.slice.call(arguments, 2);
6961
+ } else if (l === 3 && isVNode(children)) {
6962
+ children = [children];
6963
+ }
6964
+ return createVNode(type, propsOrChildren, children);
6753
6965
  }
6754
- return createVNode(type, propsOrChildren, children);
6966
+ } finally {
6967
+ setBlockTracking(1);
6755
6968
  }
6756
6969
  }
6757
6970
 
@@ -6787,7 +7000,7 @@ function isMemoSame(cached, memo) {
6787
7000
  return true;
6788
7001
  }
6789
7002
 
6790
- const version = "3.6.0-alpha.2";
7003
+ const version = "3.6.0-alpha.3";
6791
7004
  const warn$1 = shared.NOOP;
6792
7005
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
6793
7006
  const devtools = void 0;