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

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.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -531,8 +531,10 @@ function rerender(id, newRender) {
531
531
  instance.hmrRerender();
532
532
  } else {
533
533
  const i = instance;
534
- i.renderCache = [];
535
- i.effect.run();
534
+ if (!(i.effect.flags & 1024)) {
535
+ i.renderCache = [];
536
+ i.effect.run();
537
+ }
536
538
  }
537
539
  nextTick(() => {
538
540
  isHmrUpdating = false;
@@ -545,7 +547,12 @@ function reload(id, newComp) {
545
547
  newComp = normalizeClassComponent(newComp);
546
548
  updateComponentDef(record.initialDef, newComp);
547
549
  const instances = [...record.instances];
548
- if (newComp.__vapor) {
550
+ if (newComp.__vapor && !instances.some((i) => i.ceReload)) {
551
+ for (const instance of instances) {
552
+ if (instance.root && instance.root.ce && instance !== instance.root) {
553
+ instance.root.ce._removeChildStyle(instance.type);
554
+ }
555
+ }
549
556
  for (const instance of instances) {
550
557
  instance.hmrReload(newComp);
551
558
  }
@@ -574,7 +581,10 @@ function reload(id, newComp) {
574
581
  if (parent.vapor) {
575
582
  parent.hmrRerender();
576
583
  } else {
577
- parent.effect.run();
584
+ if (!(parent.effect.flags & 1024)) {
585
+ parent.renderCache = [];
586
+ parent.effect.run();
587
+ }
578
588
  }
579
589
  nextTick(() => {
580
590
  isHmrUpdating = false;
@@ -684,7 +694,6 @@ const devtoolsComponentRemoved = (component) => {
684
694
  _devtoolsComponentRemoved(component);
685
695
  }
686
696
  };
687
- /*! #__NO_SIDE_EFFECTS__ */
688
697
  // @__NO_SIDE_EFFECTS__
689
698
  function createDevtoolsComponentHook(hook) {
690
699
  return (component) => {
@@ -870,9 +879,6 @@ const TeleportImpl = {
870
879
  insert(mainAnchor, container, anchor);
871
880
  const mount = (container2, anchor2) => {
872
881
  if (shapeFlag & 16) {
873
- if (parentComponent && parentComponent.isCE) {
874
- parentComponent.ce._teleportTarget = container2;
875
- }
876
882
  mountChildren(
877
883
  children,
878
884
  container2,
@@ -894,6 +900,9 @@ const TeleportImpl = {
894
900
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
895
901
  namespace = "mathml";
896
902
  }
903
+ if (parentComponent && parentComponent.isCE) {
904
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
905
+ }
897
906
  if (!disabled) {
898
907
  mount(target, targetAnchor);
899
908
  updateCssVars(n2, false);
@@ -1094,26 +1103,34 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
1094
1103
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
1095
1104
  o: { nextSibling, parentNode, querySelector, insert, createText }
1096
1105
  }, hydrateChildren) {
1106
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
1107
+ vnode2.anchor = hydrateChildren(
1108
+ nextSibling(node2),
1109
+ vnode2,
1110
+ parentNode(node2),
1111
+ parentComponent,
1112
+ parentSuspense,
1113
+ slotScopeIds,
1114
+ optimized
1115
+ );
1116
+ vnode2.targetStart = targetStart;
1117
+ vnode2.targetAnchor = targetAnchor;
1118
+ }
1097
1119
  const target = vnode.target = resolveTarget(
1098
1120
  vnode.props,
1099
1121
  querySelector
1100
1122
  );
1123
+ const disabled = isTeleportDisabled(vnode.props);
1101
1124
  if (target) {
1102
- const disabled = isTeleportDisabled(vnode.props);
1103
1125
  const targetNode = target._lpa || target.firstChild;
1104
1126
  if (vnode.shapeFlag & 16) {
1105
1127
  if (disabled) {
1106
- vnode.anchor = hydrateChildren(
1107
- nextSibling(node),
1128
+ hydrateDisabledTeleport(
1129
+ node,
1108
1130
  vnode,
1109
- parentNode(node),
1110
- parentComponent,
1111
- parentSuspense,
1112
- slotScopeIds,
1113
- optimized
1131
+ targetNode,
1132
+ targetNode && nextSibling(targetNode)
1114
1133
  );
1115
- vnode.targetStart = targetNode;
1116
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
1117
1134
  } else {
1118
1135
  vnode.anchor = nextSibling(node);
1119
1136
  let targetAnchor = targetNode;
@@ -1144,6 +1161,10 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
1144
1161
  }
1145
1162
  }
1146
1163
  updateCssVars(vnode, disabled);
1164
+ } else if (disabled) {
1165
+ if (vnode.shapeFlag & 16) {
1166
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
1167
+ }
1147
1168
  }
1148
1169
  return vnode.anchor && nextSibling(vnode.anchor);
1149
1170
  }
@@ -1184,7 +1205,7 @@ function useTransitionState() {
1184
1205
  isMounted: false,
1185
1206
  isLeaving: false,
1186
1207
  isUnmounting: false,
1187
- leavingVNodes: /* @__PURE__ */ new Map()
1208
+ leavingNodes: /* @__PURE__ */ new Map()
1188
1209
  };
1189
1210
  onMounted(() => {
1190
1211
  state.isMounted = true;
@@ -1216,7 +1237,7 @@ const BaseTransitionPropsValidators = {
1216
1237
  onAppearCancelled: TransitionHookValidator
1217
1238
  };
1218
1239
  const recursiveGetSubtree = (instance) => {
1219
- const subTree = instance.subTree;
1240
+ const subTree = instance.type.__vapor ? instance.block : instance.subTree;
1220
1241
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
1221
1242
  };
1222
1243
  const BaseTransitionImpl = {
@@ -1233,9 +1254,7 @@ const BaseTransitionImpl = {
1233
1254
  const child = findNonCommentChild(children);
1234
1255
  const rawProps = reactivity.toRaw(props);
1235
1256
  const { mode } = rawProps;
1236
- if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
1237
- warn$1(`invalid <transition> mode: ${mode}`);
1238
- }
1257
+ checkTransitionMode(mode);
1239
1258
  if (state.isLeaving) {
1240
1259
  return emptyPlaceholder(child);
1241
1260
  }
@@ -1255,7 +1274,7 @@ const BaseTransitionImpl = {
1255
1274
  setTransitionHooks(innerChild, enterHooks);
1256
1275
  }
1257
1276
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
1258
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
1277
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
1259
1278
  let leavingHooks = resolveTransitionHooks(
1260
1279
  oldInnerChild,
1261
1280
  rawProps,
@@ -1324,15 +1343,53 @@ function findNonCommentChild(children) {
1324
1343
  }
1325
1344
  const BaseTransition = BaseTransitionImpl;
1326
1345
  function getLeavingNodesForType(state, vnode) {
1327
- const { leavingVNodes } = state;
1328
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
1346
+ const { leavingNodes } = state;
1347
+ let leavingVNodesCache = leavingNodes.get(vnode.type);
1329
1348
  if (!leavingVNodesCache) {
1330
1349
  leavingVNodesCache = /* @__PURE__ */ Object.create(null);
1331
- leavingVNodes.set(vnode.type, leavingVNodesCache);
1350
+ leavingNodes.set(vnode.type, leavingVNodesCache);
1332
1351
  }
1333
1352
  return leavingVNodesCache;
1334
1353
  }
1335
1354
  function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1355
+ const key = String(vnode.key);
1356
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
1357
+ const context = {
1358
+ setLeavingNodeCache: () => {
1359
+ leavingVNodesCache[key] = vnode;
1360
+ },
1361
+ unsetLeavingNodeCache: () => {
1362
+ if (leavingVNodesCache[key] === vnode) {
1363
+ delete leavingVNodesCache[key];
1364
+ }
1365
+ },
1366
+ earlyRemove: () => {
1367
+ const leavingVNode = leavingVNodesCache[key];
1368
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
1369
+ leavingVNode.el[leaveCbKey]();
1370
+ }
1371
+ },
1372
+ cloneHooks: (vnode2) => {
1373
+ const hooks = resolveTransitionHooks(
1374
+ vnode2,
1375
+ props,
1376
+ state,
1377
+ instance,
1378
+ postClone
1379
+ );
1380
+ if (postClone) postClone(hooks);
1381
+ return hooks;
1382
+ }
1383
+ };
1384
+ return baseResolveTransitionHooks(context, props, state, instance);
1385
+ }
1386
+ function baseResolveTransitionHooks(context, props, state, instance) {
1387
+ const {
1388
+ setLeavingNodeCache,
1389
+ unsetLeavingNodeCache,
1390
+ earlyRemove,
1391
+ cloneHooks
1392
+ } = context;
1336
1393
  const {
1337
1394
  appear,
1338
1395
  mode,
@@ -1350,8 +1407,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1350
1407
  onAfterAppear,
1351
1408
  onAppearCancelled
1352
1409
  } = props;
1353
- const key = String(vnode.key);
1354
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
1355
1410
  const callHook = (hook, args) => {
1356
1411
  hook && callWithAsyncErrorHandling(
1357
1412
  hook,
@@ -1387,10 +1442,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1387
1442
  /* cancelled */
1388
1443
  );
1389
1444
  }
1390
- const leavingVNode = leavingVNodesCache[key];
1391
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
1392
- leavingVNode.el[leaveCbKey]();
1393
- }
1445
+ earlyRemove();
1394
1446
  callHook(hook, [el]);
1395
1447
  },
1396
1448
  enter(el) {
@@ -1427,7 +1479,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1427
1479
  }
1428
1480
  },
1429
1481
  leave(el, remove) {
1430
- const key2 = String(vnode.key);
1431
1482
  if (el[enterCbKey]) {
1432
1483
  el[enterCbKey](
1433
1484
  true
@@ -1449,27 +1500,17 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
1449
1500
  callHook(onAfterLeave, [el]);
1450
1501
  }
1451
1502
  el[leaveCbKey] = void 0;
1452
- if (leavingVNodesCache[key2] === vnode) {
1453
- delete leavingVNodesCache[key2];
1454
- }
1503
+ unsetLeavingNodeCache(el);
1455
1504
  };
1456
- leavingVNodesCache[key2] = vnode;
1505
+ setLeavingNodeCache(el);
1457
1506
  if (onLeave) {
1458
1507
  callAsyncHook(onLeave, [el, done]);
1459
1508
  } else {
1460
1509
  done();
1461
1510
  }
1462
1511
  },
1463
- clone(vnode2) {
1464
- const hooks2 = resolveTransitionHooks(
1465
- vnode2,
1466
- props,
1467
- state,
1468
- instance,
1469
- postClone
1470
- );
1471
- if (postClone) postClone(hooks2);
1472
- return hooks2;
1512
+ clone(node) {
1513
+ return cloneHooks(node);
1473
1514
  }
1474
1515
  };
1475
1516
  return hooks;
@@ -1503,8 +1544,15 @@ function getInnerChild$1(vnode) {
1503
1544
  }
1504
1545
  function setTransitionHooks(vnode, hooks) {
1505
1546
  if (vnode.shapeFlag & 6 && vnode.component) {
1506
- vnode.transition = hooks;
1507
- setTransitionHooks(vnode.component.subTree, hooks);
1547
+ if (vnode.type.__vapor) {
1548
+ getVaporInterface(vnode.component, vnode).setTransitionHooks(
1549
+ vnode.component,
1550
+ hooks
1551
+ );
1552
+ } else {
1553
+ vnode.transition = hooks;
1554
+ setTransitionHooks(vnode.component.subTree, hooks);
1555
+ }
1508
1556
  } else if (vnode.shapeFlag & 128) {
1509
1557
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
1510
1558
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -1534,8 +1582,12 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
1534
1582
  }
1535
1583
  return ret;
1536
1584
  }
1585
+ function checkTransitionMode(mode) {
1586
+ if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
1587
+ warn$1(`invalid <transition> mode: ${mode}`);
1588
+ }
1589
+ }
1537
1590
 
1538
- /*! #__NO_SIDE_EFFECTS__ */
1539
1591
  // @__NO_SIDE_EFFECTS__
1540
1592
  function defineComponent(options, extraOptions) {
1541
1593
  return shared.isFunction(options) ? (
@@ -1588,6 +1640,7 @@ function useTemplateRef(key) {
1588
1640
  return ret;
1589
1641
  }
1590
1642
 
1643
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
1591
1644
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1592
1645
  if (shared.isArray(rawRef)) {
1593
1646
  rawRef.forEach(
@@ -1619,28 +1672,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1619
1672
  const oldRef = oldRawRef && oldRawRef.r;
1620
1673
  const refs = owner.refs === shared.EMPTY_OBJ ? owner.refs = {} : owner.refs;
1621
1674
  const setupState = owner.setupState;
1622
- const rawSetupState = reactivity.toRaw(setupState);
1623
- const canSetSetupRef = setupState === shared.EMPTY_OBJ ? () => false : (key) => {
1624
- {
1625
- if (shared.hasOwn(rawSetupState, key) && !reactivity.isRef(rawSetupState[key])) {
1626
- warn$1(
1627
- `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
1628
- );
1629
- }
1630
- if (knownTemplateRefs.has(rawSetupState[key])) {
1631
- return false;
1632
- }
1633
- }
1634
- return shared.hasOwn(rawSetupState, key);
1675
+ const canSetSetupRef = createCanSetSetupRefChecker(setupState);
1676
+ const canSetRef = (ref2) => {
1677
+ return !knownTemplateRefs.has(ref2);
1635
1678
  };
1636
1679
  if (oldRef != null && oldRef !== ref) {
1680
+ invalidatePendingSetRef(oldRawRef);
1637
1681
  if (shared.isString(oldRef)) {
1638
1682
  refs[oldRef] = null;
1639
1683
  if (canSetSetupRef(oldRef)) {
1640
1684
  setupState[oldRef] = null;
1641
1685
  }
1642
1686
  } else if (reactivity.isRef(oldRef)) {
1643
- oldRef.value = null;
1687
+ if (canSetRef(oldRef)) {
1688
+ oldRef.value = null;
1689
+ }
1690
+ const oldRawRefAtom = oldRawRef;
1691
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
1644
1692
  }
1645
1693
  }
1646
1694
  if (shared.isFunction(ref)) {
@@ -1651,7 +1699,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1651
1699
  if (_isString || _isRef) {
1652
1700
  const doSet = () => {
1653
1701
  if (rawRef.f) {
1654
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
1702
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
1655
1703
  if (isUnmount) {
1656
1704
  shared.isArray(existing) && shared.remove(existing, refValue);
1657
1705
  } else {
@@ -1662,8 +1710,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1662
1710
  setupState[ref] = refs[ref];
1663
1711
  }
1664
1712
  } else {
1665
- ref.value = [refValue];
1666
- if (rawRef.k) refs[rawRef.k] = ref.value;
1713
+ const newVal = [refValue];
1714
+ if (canSetRef(ref)) {
1715
+ ref.value = newVal;
1716
+ }
1717
+ if (rawRef.k) refs[rawRef.k] = newVal;
1667
1718
  }
1668
1719
  } else if (!existing.includes(refValue)) {
1669
1720
  existing.push(refValue);
@@ -1675,15 +1726,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1675
1726
  setupState[ref] = value;
1676
1727
  }
1677
1728
  } else if (_isRef) {
1678
- ref.value = value;
1729
+ if (canSetRef(ref)) {
1730
+ ref.value = value;
1731
+ }
1679
1732
  if (rawRef.k) refs[rawRef.k] = value;
1680
1733
  } else {
1681
1734
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
1682
1735
  }
1683
1736
  };
1684
1737
  if (value) {
1685
- queuePostRenderEffect(doSet, -1, parentSuspense);
1738
+ const job = () => {
1739
+ doSet();
1740
+ pendingSetRefMap.delete(rawRef);
1741
+ };
1742
+ pendingSetRefMap.set(rawRef, job);
1743
+ queuePostRenderEffect(job, -1, parentSuspense);
1686
1744
  } else {
1745
+ invalidatePendingSetRef(rawRef);
1687
1746
  doSet();
1688
1747
  }
1689
1748
  } else {
@@ -1691,6 +1750,29 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
1691
1750
  }
1692
1751
  }
1693
1752
  }
1753
+ function createCanSetSetupRefChecker(setupState) {
1754
+ const rawSetupState = reactivity.toRaw(setupState);
1755
+ return setupState === void 0 || setupState === shared.EMPTY_OBJ ? shared.NO : (key) => {
1756
+ {
1757
+ if (shared.hasOwn(rawSetupState, key) && !reactivity.isRef(rawSetupState[key])) {
1758
+ warn$1(
1759
+ `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
1760
+ );
1761
+ }
1762
+ if (knownTemplateRefs.has(rawSetupState[key])) {
1763
+ return false;
1764
+ }
1765
+ }
1766
+ return shared.hasOwn(rawSetupState, key);
1767
+ };
1768
+ }
1769
+ function invalidatePendingSetRef(rawRef) {
1770
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
1771
+ if (pendingSetRef) {
1772
+ pendingSetRef.flags |= 4;
1773
+ pendingSetRefMap.delete(rawRef);
1774
+ }
1775
+ }
1694
1776
 
1695
1777
  let hasLoggedMismatchError = false;
1696
1778
  const logMismatchError = () => {
@@ -1835,6 +1917,12 @@ function createHydrationFunctions(rendererInternals) {
1835
1917
  );
1836
1918
  }
1837
1919
  break;
1920
+ case VaporSlot:
1921
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(
1922
+ vnode,
1923
+ node
1924
+ );
1925
+ break;
1838
1926
  default:
1839
1927
  if (shapeFlag & 1) {
1840
1928
  if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
@@ -1850,9 +1938,6 @@ function createHydrationFunctions(rendererInternals) {
1850
1938
  );
1851
1939
  }
1852
1940
  } else if (shapeFlag & 6) {
1853
- if (vnode.type.__vapor) {
1854
- throw new Error("Vapor component hydration is not supported yet.");
1855
- }
1856
1941
  vnode.slotScopeIds = slotScopeIds;
1857
1942
  const container = parentNode(node);
1858
1943
  if (isFragmentStart) {
@@ -1862,15 +1947,25 @@ function createHydrationFunctions(rendererInternals) {
1862
1947
  } else {
1863
1948
  nextNode = nextSibling(node);
1864
1949
  }
1865
- mountComponent(
1866
- vnode,
1867
- container,
1868
- null,
1869
- parentComponent,
1870
- parentSuspense,
1871
- getContainerType(container),
1872
- optimized
1873
- );
1950
+ if (vnode.type.__vapor) {
1951
+ getVaporInterface(parentComponent, vnode).hydrate(
1952
+ vnode,
1953
+ node,
1954
+ container,
1955
+ null,
1956
+ parentComponent
1957
+ );
1958
+ } else {
1959
+ mountComponent(
1960
+ vnode,
1961
+ container,
1962
+ null,
1963
+ parentComponent,
1964
+ parentSuspense,
1965
+ getContainerType(container),
1966
+ optimized
1967
+ );
1968
+ }
1874
1969
  if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
1875
1970
  let subTree;
1876
1971
  if (isFragmentStart) {
@@ -1955,7 +2050,7 @@ function createHydrationFunctions(rendererInternals) {
1955
2050
  );
1956
2051
  let hasWarned = false;
1957
2052
  while (next) {
1958
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
2053
+ if (!isMismatchAllowed(el, 1)) {
1959
2054
  if (!hasWarned) {
1960
2055
  warn$1(
1961
2056
  `Hydration children mismatch on`,
@@ -1976,14 +2071,16 @@ Server rendered element contains more child nodes than client vdom.`
1976
2071
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
1977
2072
  clientText = clientText.slice(1);
1978
2073
  }
1979
- if (el.textContent !== clientText) {
1980
- if (!isMismatchAllowed(el, 0 /* TEXT */)) {
2074
+ const { textContent } = el;
2075
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
2076
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
2077
+ if (!isMismatchAllowed(el, 0)) {
1981
2078
  warn$1(
1982
2079
  `Hydration text content mismatch on`,
1983
2080
  el,
1984
2081
  `
1985
- - rendered on server: ${el.textContent}
1986
- - expected on client: ${vnode.children}`
2082
+ - rendered on server: ${textContent}
2083
+ - expected on client: ${clientText}`
1987
2084
  );
1988
2085
  logMismatchError();
1989
2086
  }
@@ -2059,7 +2156,7 @@ Server rendered element contains more child nodes than client vdom.`
2059
2156
  } else if (isText && !vnode.children) {
2060
2157
  insert(vnode.el = createText(""), container);
2061
2158
  } else {
2062
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
2159
+ if (!isMismatchAllowed(container, 1)) {
2063
2160
  if (!hasWarned) {
2064
2161
  warn$1(
2065
2162
  `Hydration children mismatch on`,
@@ -2109,7 +2206,7 @@ Server rendered element contains fewer child nodes than client vdom.`
2109
2206
  }
2110
2207
  };
2111
2208
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
2112
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
2209
+ if (!isMismatchAllowed(node.parentElement, 1)) {
2113
2210
  warn$1(
2114
2211
  `Hydration node mismatch:
2115
2212
  - rendered on server:`,
@@ -2182,11 +2279,11 @@ Server rendered element contains fewer child nodes than client vdom.`
2182
2279
  parent = parent.parent;
2183
2280
  }
2184
2281
  };
2185
- const isTemplateNode = (node) => {
2186
- return node.nodeType === 1 && node.tagName === "TEMPLATE";
2187
- };
2188
2282
  return [hydrate, hydrateNode];
2189
2283
  }
2284
+ const isTemplateNode = (node) => {
2285
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
2286
+ };
2190
2287
  function propHasMismatch(el, key, clientValue, vnode, instance) {
2191
2288
  let mismatchType;
2192
2289
  let mismatchKey;
@@ -2201,7 +2298,7 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
2201
2298
  }
2202
2299
  expected = shared.normalizeClass(clientValue);
2203
2300
  if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
2204
- mismatchType = 2 /* CLASS */;
2301
+ mismatchType = 2;
2205
2302
  mismatchKey = `class`;
2206
2303
  }
2207
2304
  } else if (key === "style") {
@@ -2220,31 +2317,43 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
2220
2317
  resolveCssVars(instance, vnode, expectedMap);
2221
2318
  }
2222
2319
  if (!isMapEqual(actualMap, expectedMap)) {
2223
- mismatchType = 3 /* STYLE */;
2320
+ mismatchType = 3;
2224
2321
  mismatchKey = "style";
2225
2322
  }
2226
- } else if (el instanceof SVGElement && shared.isKnownSvgAttr(key) || el instanceof HTMLElement && (shared.isBooleanAttr(key) || shared.isKnownHtmlAttr(key))) {
2227
- if (shared.isBooleanAttr(key)) {
2228
- actual = el.hasAttribute(key);
2229
- expected = shared.includeBooleanAttr(clientValue);
2230
- } else if (clientValue == null) {
2231
- actual = el.hasAttribute(key);
2232
- expected = false;
2233
- } else {
2234
- if (el.hasAttribute(key)) {
2235
- actual = el.getAttribute(key);
2236
- } else if (key === "value" && el.tagName === "TEXTAREA") {
2237
- actual = el.value;
2238
- } else {
2239
- actual = false;
2240
- }
2241
- expected = shared.isRenderableAttrValue(clientValue) ? String(clientValue) : false;
2242
- }
2323
+ } else if (isValidHtmlOrSvgAttribute(el, key)) {
2324
+ ({ actual, expected } = getAttributeMismatch(el, key, clientValue));
2243
2325
  if (actual !== expected) {
2244
- mismatchType = 4 /* ATTRIBUTE */;
2326
+ mismatchType = 4;
2245
2327
  mismatchKey = key;
2246
2328
  }
2247
2329
  }
2330
+ return warnPropMismatch(el, mismatchKey, mismatchType, actual, expected);
2331
+ }
2332
+ function getAttributeMismatch(el, key, clientValue) {
2333
+ let actual;
2334
+ let expected;
2335
+ if (shared.isBooleanAttr(key)) {
2336
+ actual = el.hasAttribute(key);
2337
+ expected = shared.includeBooleanAttr(clientValue);
2338
+ } else if (clientValue == null) {
2339
+ actual = el.hasAttribute(key);
2340
+ expected = false;
2341
+ } else {
2342
+ if (el.hasAttribute(key)) {
2343
+ actual = el.getAttribute(key);
2344
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
2345
+ actual = el.value;
2346
+ } else {
2347
+ actual = false;
2348
+ }
2349
+ expected = shared.isRenderableAttrValue(clientValue) ? String(clientValue) : false;
2350
+ }
2351
+ return { actual, expected };
2352
+ }
2353
+ function isValidHtmlOrSvgAttribute(el, key) {
2354
+ return el instanceof SVGElement && shared.isKnownSvgAttr(key) || el instanceof HTMLElement && (shared.isBooleanAttr(key) || shared.isKnownHtmlAttr(key));
2355
+ }
2356
+ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
2248
2357
  if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
2249
2358
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
2250
2359
  const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
@@ -2316,14 +2425,14 @@ function resolveCssVars(instance, vnode, expectedMap) {
2316
2425
  }
2317
2426
  const allowMismatchAttr = "data-allow-mismatch";
2318
2427
  const MismatchTypeString = {
2319
- [0 /* TEXT */]: "text",
2320
- [1 /* CHILDREN */]: "children",
2321
- [2 /* CLASS */]: "class",
2322
- [3 /* STYLE */]: "style",
2323
- [4 /* ATTRIBUTE */]: "attribute"
2428
+ [0]: "text",
2429
+ [1]: "children",
2430
+ [2]: "class",
2431
+ [3]: "style",
2432
+ [4]: "attribute"
2324
2433
  };
2325
2434
  function isMismatchAllowed(el, allowedType) {
2326
- if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
2435
+ if (allowedType === 0 || allowedType === 1) {
2327
2436
  while (el && !el.hasAttribute(allowMismatchAttr)) {
2328
2437
  el = el.parentElement;
2329
2438
  }
@@ -2335,7 +2444,7 @@ function isMismatchAllowed(el, allowedType) {
2335
2444
  return true;
2336
2445
  } else {
2337
2446
  const list = allowedAttr.split(",");
2338
- if (allowedType === 0 /* TEXT */ && list.includes("children")) {
2447
+ if (allowedType === 0 && list.includes("children")) {
2339
2448
  return true;
2340
2449
  }
2341
2450
  return list.includes(MismatchTypeString[allowedType]);
@@ -2392,7 +2501,9 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
2392
2501
  hasHydrated = true;
2393
2502
  teardown();
2394
2503
  hydrate();
2395
- e.target.dispatchEvent(new e.constructor(e.type, e));
2504
+ if (!(`$evt${e.type}` in e.target)) {
2505
+ e.target.dispatchEvent(new e.constructor(e.type, e));
2506
+ }
2396
2507
  }
2397
2508
  };
2398
2509
  const teardown = () => {
@@ -2434,104 +2545,46 @@ function forEachElement(node, cb) {
2434
2545
  }
2435
2546
 
2436
2547
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
2437
- /*! #__NO_SIDE_EFFECTS__ */
2438
2548
  // @__NO_SIDE_EFFECTS__
2439
2549
  function defineAsyncComponent(source) {
2440
- if (shared.isFunction(source)) {
2441
- source = { loader: source };
2442
- }
2443
2550
  const {
2444
- loader,
2445
- loadingComponent,
2446
- errorComponent,
2447
- delay = 200,
2448
- hydrate: hydrateStrategy,
2449
- timeout,
2450
- // undefined = never times out
2451
- suspensible = true,
2452
- onError: userOnError
2453
- } = source;
2454
- let pendingRequest = null;
2455
- let resolvedComp;
2456
- let retries = 0;
2457
- const retry = () => {
2458
- retries++;
2459
- pendingRequest = null;
2460
- return load();
2461
- };
2462
- const load = () => {
2463
- let thisRequest;
2464
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
2465
- err = err instanceof Error ? err : new Error(String(err));
2466
- if (userOnError) {
2467
- return new Promise((resolve, reject) => {
2468
- const userRetry = () => resolve(retry());
2469
- const userFail = () => reject(err);
2470
- userOnError(err, userRetry, userFail, retries + 1);
2471
- });
2472
- } else {
2473
- throw err;
2474
- }
2475
- }).then((comp) => {
2476
- if (thisRequest !== pendingRequest && pendingRequest) {
2477
- return pendingRequest;
2478
- }
2479
- if (!comp) {
2480
- warn$1(
2481
- `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
2482
- );
2483
- }
2484
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2485
- comp = comp.default;
2486
- }
2487
- if (comp && !shared.isObject(comp) && !shared.isFunction(comp)) {
2488
- throw new Error(`Invalid async component load result: ${comp}`);
2489
- }
2490
- resolvedComp = comp;
2491
- return comp;
2492
- }));
2493
- };
2551
+ load,
2552
+ getResolvedComp,
2553
+ setPendingRequest,
2554
+ source: {
2555
+ loadingComponent,
2556
+ errorComponent,
2557
+ delay,
2558
+ hydrate: hydrateStrategy,
2559
+ timeout,
2560
+ suspensible = true
2561
+ }
2562
+ } = createAsyncComponentContext(source);
2494
2563
  return defineComponent({
2495
2564
  name: "AsyncComponentWrapper",
2496
2565
  __asyncLoader: load,
2497
2566
  __asyncHydrate(el, instance, hydrate) {
2498
- let patched = false;
2499
- const doHydrate = hydrateStrategy ? () => {
2500
- const performHydrate = () => {
2501
- if (patched) {
2502
- warn$1(
2503
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
2504
- );
2505
- return;
2506
- }
2507
- hydrate();
2508
- };
2509
- const teardown = hydrateStrategy(
2510
- performHydrate,
2511
- (cb) => forEachElement(el, cb)
2512
- );
2513
- if (teardown) {
2514
- (instance.bum || (instance.bum = [])).push(teardown);
2515
- }
2516
- (instance.u || (instance.u = [])).push(() => patched = true);
2517
- } : hydrate;
2518
- if (resolvedComp) {
2519
- doHydrate();
2520
- } else {
2521
- load().then(() => !instance.isUnmounted && doHydrate());
2522
- }
2567
+ performAsyncHydrate(
2568
+ el,
2569
+ instance,
2570
+ hydrate,
2571
+ getResolvedComp,
2572
+ load,
2573
+ hydrateStrategy
2574
+ );
2523
2575
  },
2524
2576
  get __asyncResolved() {
2525
- return resolvedComp;
2577
+ return getResolvedComp();
2526
2578
  },
2527
2579
  setup() {
2528
2580
  const instance = currentInstance;
2529
2581
  markAsyncBoundary(instance);
2582
+ let resolvedComp = getResolvedComp();
2530
2583
  if (resolvedComp) {
2531
2584
  return () => createInnerComp(resolvedComp, instance);
2532
2585
  }
2533
2586
  const onError = (err) => {
2534
- pendingRequest = null;
2587
+ setPendingRequest(null);
2535
2588
  handleError(
2536
2589
  err,
2537
2590
  instance,
@@ -2549,25 +2602,11 @@ function defineAsyncComponent(source) {
2549
2602
  }) : null;
2550
2603
  });
2551
2604
  }
2552
- const loaded = reactivity.ref(false);
2553
- const error = reactivity.ref();
2554
- const delayed = reactivity.ref(!!delay);
2555
- if (delay) {
2556
- setTimeout(() => {
2557
- delayed.value = false;
2558
- }, delay);
2559
- }
2560
- if (timeout != null) {
2561
- setTimeout(() => {
2562
- if (!loaded.value && !error.value) {
2563
- const err = new Error(
2564
- `Async component timed out after ${timeout}ms.`
2565
- );
2566
- onError(err);
2567
- error.value = err;
2568
- }
2569
- }, timeout);
2570
- }
2605
+ const { loaded, error, delayed } = useAsyncComponentState(
2606
+ delay,
2607
+ timeout,
2608
+ onError
2609
+ );
2571
2610
  load().then(() => {
2572
2611
  loaded.value = true;
2573
2612
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
@@ -2578,6 +2617,7 @@ function defineAsyncComponent(source) {
2578
2617
  error.value = err;
2579
2618
  });
2580
2619
  return () => {
2620
+ resolvedComp = getResolvedComp();
2581
2621
  if (loaded.value && resolvedComp) {
2582
2622
  return createInnerComp(resolvedComp, instance);
2583
2623
  } else if (error.value && errorComponent) {
@@ -2585,7 +2625,10 @@ function defineAsyncComponent(source) {
2585
2625
  error: error.value
2586
2626
  });
2587
2627
  } else if (loadingComponent && !delayed.value) {
2588
- return createVNode(loadingComponent);
2628
+ return createInnerComp(
2629
+ loadingComponent,
2630
+ instance
2631
+ );
2589
2632
  }
2590
2633
  };
2591
2634
  }
@@ -2599,6 +2642,108 @@ function createInnerComp(comp, parent) {
2599
2642
  delete parent.vnode.ce;
2600
2643
  return vnode;
2601
2644
  }
2645
+ function createAsyncComponentContext(source) {
2646
+ if (shared.isFunction(source)) {
2647
+ source = { loader: source };
2648
+ }
2649
+ const { loader, onError: userOnError } = source;
2650
+ let pendingRequest = null;
2651
+ let resolvedComp;
2652
+ let retries = 0;
2653
+ const retry = () => {
2654
+ retries++;
2655
+ pendingRequest = null;
2656
+ return load();
2657
+ };
2658
+ const load = () => {
2659
+ let thisRequest;
2660
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
2661
+ err = err instanceof Error ? err : new Error(String(err));
2662
+ if (userOnError) {
2663
+ return new Promise((resolve, reject) => {
2664
+ const userRetry = () => resolve(retry());
2665
+ const userFail = () => reject(err);
2666
+ userOnError(err, userRetry, userFail, retries + 1);
2667
+ });
2668
+ } else {
2669
+ throw err;
2670
+ }
2671
+ }).then((comp) => {
2672
+ if (thisRequest !== pendingRequest && pendingRequest) {
2673
+ return pendingRequest;
2674
+ }
2675
+ if (!comp) {
2676
+ warn$1(
2677
+ `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
2678
+ );
2679
+ }
2680
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
2681
+ comp = comp.default;
2682
+ }
2683
+ if (comp && !shared.isObject(comp) && !shared.isFunction(comp)) {
2684
+ throw new Error(`Invalid async component load result: ${comp}`);
2685
+ }
2686
+ resolvedComp = comp;
2687
+ return comp;
2688
+ }));
2689
+ };
2690
+ return {
2691
+ load,
2692
+ source,
2693
+ getResolvedComp: () => resolvedComp,
2694
+ setPendingRequest: (request) => pendingRequest = request
2695
+ };
2696
+ }
2697
+ const useAsyncComponentState = (delay, timeout, onError) => {
2698
+ const loaded = reactivity.ref(false);
2699
+ const error = reactivity.ref();
2700
+ const delayed = reactivity.ref(!!delay);
2701
+ if (delay) {
2702
+ setTimeout(() => {
2703
+ delayed.value = false;
2704
+ }, delay);
2705
+ }
2706
+ if (timeout != null) {
2707
+ setTimeout(() => {
2708
+ if (!loaded.value && !error.value) {
2709
+ const err = new Error(`Async component timed out after ${timeout}ms.`);
2710
+ onError(err);
2711
+ error.value = err;
2712
+ }
2713
+ }, timeout);
2714
+ }
2715
+ return { loaded, error, delayed };
2716
+ };
2717
+ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
2718
+ let patched = false;
2719
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
2720
+ const performHydrate = () => {
2721
+ if (patched) {
2722
+ {
2723
+ const resolvedComp = getResolvedComp();
2724
+ warn$1(
2725
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
2726
+ );
2727
+ }
2728
+ return;
2729
+ }
2730
+ hydrate();
2731
+ };
2732
+ const doHydrate = hydrateStrategy ? () => {
2733
+ const teardown = hydrateStrategy(
2734
+ performHydrate,
2735
+ (cb) => forEachElement(el, cb)
2736
+ );
2737
+ if (teardown) {
2738
+ (instance.bum || (instance.bum = [])).push(teardown);
2739
+ }
2740
+ } : performHydrate;
2741
+ if (getResolvedComp()) {
2742
+ doHydrate();
2743
+ } else {
2744
+ load().then(() => !instance.isUnmounted && doHydrate());
2745
+ }
2746
+ }
2602
2747
 
2603
2748
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
2604
2749
  const KeepAliveImpl = {
@@ -2628,83 +2773,37 @@ const KeepAliveImpl = {
2628
2773
  keepAliveInstance.__v_cache = cache;
2629
2774
  }
2630
2775
  const parentSuspense = keepAliveInstance.suspense;
2776
+ const { renderer } = sharedContext;
2631
2777
  const {
2632
- renderer: {
2633
- p: patch,
2634
- m: move,
2635
- um: _unmount,
2636
- o: { createElement }
2637
- }
2638
- } = sharedContext;
2778
+ um: _unmount,
2779
+ o: { createElement }
2780
+ } = renderer;
2639
2781
  const storageContainer = createElement("div");
2782
+ sharedContext.getStorageContainer = () => storageContainer;
2783
+ sharedContext.getCachedComponent = (vnode) => {
2784
+ const key = vnode.key == null ? vnode.type : vnode.key;
2785
+ return cache.get(key);
2786
+ };
2640
2787
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
2641
- const instance = vnode.component;
2642
- move(
2788
+ activate(
2643
2789
  vnode,
2644
2790
  container,
2645
2791
  anchor,
2646
- 0,
2792
+ renderer,
2647
2793
  keepAliveInstance,
2648
- parentSuspense
2649
- );
2650
- patch(
2651
- instance.vnode,
2652
- vnode,
2653
- container,
2654
- anchor,
2655
- instance,
2656
2794
  parentSuspense,
2657
2795
  namespace,
2658
- vnode.slotScopeIds,
2659
2796
  optimized
2660
2797
  );
2661
- queuePostRenderEffect(
2662
- () => {
2663
- instance.isDeactivated = false;
2664
- if (instance.a) {
2665
- shared.invokeArrayFns(instance.a);
2666
- }
2667
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
2668
- if (vnodeHook) {
2669
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
2670
- }
2671
- },
2672
- void 0,
2673
- parentSuspense
2674
- );
2675
- {
2676
- devtoolsComponentAdded(instance);
2677
- }
2678
2798
  };
2679
2799
  sharedContext.deactivate = (vnode) => {
2680
- const instance = vnode.component;
2681
- invalidateMount(instance.m);
2682
- invalidateMount(instance.a);
2683
- move(
2800
+ deactivate(
2684
2801
  vnode,
2685
2802
  storageContainer,
2686
- null,
2687
- 1,
2803
+ renderer,
2688
2804
  keepAliveInstance,
2689
2805
  parentSuspense
2690
2806
  );
2691
- queuePostRenderEffect(
2692
- () => {
2693
- if (instance.da) {
2694
- shared.invokeArrayFns(instance.da);
2695
- }
2696
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
2697
- if (vnodeHook) {
2698
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
2699
- }
2700
- instance.isDeactivated = true;
2701
- },
2702
- void 0,
2703
- parentSuspense
2704
- );
2705
- {
2706
- devtoolsComponentAdded(instance);
2707
- }
2708
2807
  };
2709
2808
  function unmount(vnode) {
2710
2809
  resetShapeFlag(vnode);
@@ -2851,7 +2950,7 @@ function onActivated(hook, target) {
2851
2950
  function onDeactivated(hook, target) {
2852
2951
  registerKeepAliveHook(hook, "da", target);
2853
2952
  }
2854
- function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
2953
+ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance()) {
2855
2954
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
2856
2955
  let current = target;
2857
2956
  while (current) {
@@ -2865,8 +2964,9 @@ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
2865
2964
  injectHook(type, wrappedHook, target);
2866
2965
  if (target) {
2867
2966
  let current = target.parent;
2868
- while (current && current.parent && current.parent.vnode) {
2869
- if (isKeepAlive(current.parent.vnode)) {
2967
+ while (current && current.parent) {
2968
+ let parent = current.parent;
2969
+ if (isKeepAlive(parent.vapor ? parent : parent.vnode)) {
2870
2970
  injectToKeepAliveRoot(wrappedHook, type, target, current);
2871
2971
  }
2872
2972
  current = current.parent;
@@ -2892,6 +2992,68 @@ function resetShapeFlag(vnode) {
2892
2992
  function getInnerChild(vnode) {
2893
2993
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
2894
2994
  }
2995
+ function activate(vnode, container, anchor, { p: patch, m: move }, parentComponent, parentSuspense, namespace, optimized) {
2996
+ const instance = vnode.component;
2997
+ move(
2998
+ vnode,
2999
+ container,
3000
+ anchor,
3001
+ 0,
3002
+ parentComponent,
3003
+ parentSuspense
3004
+ );
3005
+ patch(
3006
+ instance.vnode,
3007
+ vnode,
3008
+ container,
3009
+ anchor,
3010
+ instance,
3011
+ parentSuspense,
3012
+ namespace,
3013
+ vnode.slotScopeIds,
3014
+ optimized
3015
+ );
3016
+ queuePostRenderEffect(
3017
+ () => {
3018
+ instance.isDeactivated = false;
3019
+ if (instance.a) {
3020
+ shared.invokeArrayFns(instance.a);
3021
+ }
3022
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
3023
+ if (vnodeHook) {
3024
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
3025
+ }
3026
+ },
3027
+ void 0,
3028
+ parentSuspense
3029
+ );
3030
+ {
3031
+ devtoolsComponentAdded(instance);
3032
+ }
3033
+ }
3034
+ function deactivate(vnode, container, { m: move }, parentComponent, parentSuspense) {
3035
+ const instance = vnode.component;
3036
+ invalidateMount(instance.m);
3037
+ invalidateMount(instance.a);
3038
+ move(vnode, container, null, 1, parentComponent, parentSuspense);
3039
+ queuePostRenderEffect(
3040
+ () => {
3041
+ if (instance.da) {
3042
+ shared.invokeArrayFns(instance.da);
3043
+ }
3044
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
3045
+ if (vnodeHook) {
3046
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
3047
+ }
3048
+ instance.isDeactivated = true;
3049
+ },
3050
+ void 0,
3051
+ parentSuspense
3052
+ );
3053
+ {
3054
+ devtoolsComponentAdded(instance);
3055
+ }
3056
+ }
2895
3057
 
2896
3058
  function injectHook(type, hook, target = currentInstance, prepend = false) {
2897
3059
  if (target) {
@@ -3080,12 +3242,13 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
3080
3242
  return ret;
3081
3243
  }
3082
3244
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
3245
+ const hasProps = Object.keys(props).length > 0;
3083
3246
  if (name !== "default") props.name = name;
3084
3247
  return openBlock(), createBlock(
3085
3248
  Fragment,
3086
3249
  null,
3087
3250
  [createVNode("slot", props, fallback && fallback())],
3088
- 64
3251
+ hasProps ? -2 : 64
3089
3252
  );
3090
3253
  }
3091
3254
  if (slot && slot.length > 1) {
@@ -3099,6 +3262,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
3099
3262
  }
3100
3263
  openBlock();
3101
3264
  const validSlotContent = slot && ensureValidVNode(slot(props));
3265
+ ensureVaporSlotFallback(validSlotContent, fallback);
3102
3266
  const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
3103
3267
  // key attached in the `createSlots` helper, respect that
3104
3268
  validSlotContent && validSlotContent.key;
@@ -3128,6 +3292,14 @@ function ensureValidVNode(vnodes) {
3128
3292
  return true;
3129
3293
  }) ? vnodes : null;
3130
3294
  }
3295
+ function ensureVaporSlotFallback(vnodes, fallback) {
3296
+ let vaporSlot;
3297
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
3298
+ if (!vaporSlot.fallback && fallback) {
3299
+ vaporSlot.fallback = fallback;
3300
+ }
3301
+ }
3302
+ }
3131
3303
 
3132
3304
  function toHandlers(obj, preserveCaseIfNecessary) {
3133
3305
  const ret = {};
@@ -3290,10 +3462,10 @@ const PublicInstanceProxyHandlers = {
3290
3462
  return true;
3291
3463
  },
3292
3464
  has({
3293
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
3465
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
3294
3466
  }, key) {
3295
- let normalizedProps;
3296
- 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);
3467
+ let normalizedProps, cssModules;
3468
+ 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]);
3297
3469
  },
3298
3470
  defineProperty(target, key, descriptor) {
3299
3471
  if (descriptor.get != null) {
@@ -3431,15 +3603,15 @@ function withDefaults(props, defaults) {
3431
3603
  return null;
3432
3604
  }
3433
3605
  function useSlots() {
3434
- return getContext().slots;
3606
+ return getContext("useSlots").slots;
3435
3607
  }
3436
3608
  function useAttrs() {
3437
- return getContext().attrs;
3609
+ return getContext("useAttrs").attrs;
3438
3610
  }
3439
- function getContext() {
3611
+ function getContext(calledFunctionName) {
3440
3612
  const i = getCurrentGenericInstance();
3441
3613
  if (!i) {
3442
- warn$1(`useContext() called without active instance.`);
3614
+ warn$1(`${calledFunctionName}() called without active instance.`);
3443
3615
  }
3444
3616
  if (i.vapor) {
3445
3617
  return i;
@@ -3695,7 +3867,8 @@ function applyOptions(instance) {
3695
3867
  expose.forEach((key) => {
3696
3868
  Object.defineProperty(exposed, key, {
3697
3869
  get: () => publicThis[key],
3698
- set: (val) => publicThis[key] = val
3870
+ set: (val) => publicThis[key] = val,
3871
+ enumerable: true
3699
3872
  });
3700
3873
  });
3701
3874
  } else if (!instance.exposed) {
@@ -4568,7 +4741,7 @@ function isBoolean(...args) {
4568
4741
  return args.some((elem) => elem.toLowerCase() === "boolean");
4569
4742
  }
4570
4743
 
4571
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
4744
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
4572
4745
  const normalizeSlotValue = (value) => shared.isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
4573
4746
  const normalizeSlot = (key, rawSlot, ctx) => {
4574
4747
  if (rawSlot._n) {
@@ -4622,8 +4795,6 @@ const assignSlots = (slots, children, optimized) => {
4622
4795
  const initSlots = (instance, children, optimized) => {
4623
4796
  const slots = instance.slots = createInternalObject();
4624
4797
  if (instance.vnode.shapeFlag & 32) {
4625
- const cacheIndexes = children.__;
4626
- if (cacheIndexes) shared.def(slots, "__", cacheIndexes, true);
4627
4798
  const type = children._;
4628
4799
  if (type) {
4629
4800
  assignSlots(slots, children, optimized);
@@ -4687,12 +4858,10 @@ function endMeasure(instance, type) {
4687
4858
  if (instance.appContext.config.performance && isSupported()) {
4688
4859
  const startTag = `vue-${type}-${instance.uid}`;
4689
4860
  const endTag = startTag + `:end`;
4861
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
4690
4862
  perf.mark(endTag);
4691
- perf.measure(
4692
- `<${formatComponentName(instance, instance.type)}> ${type}`,
4693
- startTag,
4694
- endTag
4695
- );
4863
+ perf.measure(measureName, startTag, endTag);
4864
+ perf.clearMeasures(measureName);
4696
4865
  perf.clearMarks(startTag);
4697
4866
  perf.clearMarks(endTag);
4698
4867
  }
@@ -4931,15 +5100,25 @@ function baseCreateRenderer(options, createHydrationFns) {
4931
5100
  optimized
4932
5101
  );
4933
5102
  } else {
4934
- patchElement(
4935
- n1,
4936
- n2,
4937
- parentComponent,
4938
- parentSuspense,
4939
- namespace,
4940
- slotScopeIds,
4941
- optimized
4942
- );
5103
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
5104
+ try {
5105
+ if (customElement) {
5106
+ customElement._beginPatch();
5107
+ }
5108
+ patchElement(
5109
+ n1,
5110
+ n2,
5111
+ parentComponent,
5112
+ parentSuspense,
5113
+ namespace,
5114
+ slotScopeIds,
5115
+ optimized
5116
+ );
5117
+ } finally {
5118
+ if (customElement) {
5119
+ customElement._endPatch();
5120
+ }
5121
+ }
4943
5122
  }
4944
5123
  };
4945
5124
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -4990,16 +5169,20 @@ function baseCreateRenderer(options, createHydrationFns) {
4990
5169
  if (dirs) {
4991
5170
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
4992
5171
  }
4993
- const needCallTransitionHooks = needTransition(parentSuspense, transition);
4994
- if (needCallTransitionHooks) {
4995
- transition.beforeEnter(el);
5172
+ if (transition) {
5173
+ performTransitionEnter(
5174
+ el,
5175
+ transition,
5176
+ () => hostInsert(el, container, anchor),
5177
+ parentSuspense
5178
+ );
5179
+ } else {
5180
+ hostInsert(el, container, anchor);
4996
5181
  }
4997
- hostInsert(el, container, anchor);
4998
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
5182
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
4999
5183
  queuePostRenderEffect(
5000
5184
  () => {
5001
5185
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
5002
- needCallTransitionHooks && transition.enter(el);
5003
5186
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
5004
5187
  },
5005
5188
  void 0,
@@ -5016,21 +5199,9 @@ function baseCreateRenderer(options, createHydrationFns) {
5016
5199
  hostSetScopeId(el, slotScopeIds[i]);
5017
5200
  }
5018
5201
  }
5019
- let subTree = parentComponent && parentComponent.subTree;
5020
- if (subTree) {
5021
- if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
5022
- subTree = filterSingleRoot(subTree.children) || subTree;
5023
- }
5024
- if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
5025
- const parentVNode = parentComponent.vnode;
5026
- setScopeId(
5027
- el,
5028
- parentVNode,
5029
- parentVNode.scopeId,
5030
- parentVNode.slotScopeIds,
5031
- parentComponent.parent
5032
- );
5033
- }
5202
+ const inheritedScopeIds = getInheritedScopeIds(vnode, parentComponent);
5203
+ for (let i = 0; i < inheritedScopeIds.length; i++) {
5204
+ hostSetScopeId(el, inheritedScopeIds[i]);
5034
5205
  }
5035
5206
  };
5036
5207
  const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
@@ -5271,12 +5442,21 @@ function baseCreateRenderer(options, createHydrationFns) {
5271
5442
  n2.slotScopeIds = slotScopeIds;
5272
5443
  if (n2.type.__vapor) {
5273
5444
  if (n1 == null) {
5274
- getVaporInterface(parentComponent, n2).mount(
5275
- n2,
5276
- container,
5277
- anchor,
5278
- parentComponent
5279
- );
5445
+ if (n2.shapeFlag & 512) {
5446
+ getVaporInterface(parentComponent, n2).activate(
5447
+ n2,
5448
+ container,
5449
+ anchor,
5450
+ parentComponent
5451
+ );
5452
+ } else {
5453
+ getVaporInterface(parentComponent, n2).mount(
5454
+ n2,
5455
+ container,
5456
+ anchor,
5457
+ parentComponent
5458
+ );
5459
+ }
5280
5460
  } else {
5281
5461
  getVaporInterface(parentComponent, n2).update(
5282
5462
  n1,
@@ -5339,6 +5519,7 @@ function baseCreateRenderer(options, createHydrationFns) {
5339
5519
  if (!initialVNode.el) {
5340
5520
  const placeholder = instance.subTree = createVNode(Comment);
5341
5521
  processCommentNode(null, placeholder, container, anchor);
5522
+ initialVNode.placeholder = placeholder.el;
5342
5523
  }
5343
5524
  } else {
5344
5525
  setupRenderEffect(
@@ -5879,7 +6060,11 @@ function baseCreateRenderer(options, createHydrationFns) {
5879
6060
  for (i = toBePatched - 1; i >= 0; i--) {
5880
6061
  const nextIndex = s2 + i;
5881
6062
  const nextChild = c2[nextIndex];
5882
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
6063
+ const anchorVNode = c2[nextIndex + 1];
6064
+ const anchor = nextIndex + 1 < l2 ? (
6065
+ // #13559, fallback to el placeholder for unresolved async component
6066
+ anchorVNode.el || anchorVNode.placeholder
6067
+ ) : parentAnchor;
5883
6068
  if (newIndexToOldIndexMap[i] === 0) {
5884
6069
  patch(
5885
6070
  null,
@@ -5959,12 +6144,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5959
6144
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
5960
6145
  if (needTransition2) {
5961
6146
  if (moveType === 0) {
5962
- transition.beforeEnter(el);
5963
- hostInsert(el, container, anchor);
5964
- queuePostRenderEffect(
5965
- () => transition.enter(el),
5966
- void 0,
5967
- parentSuspense
6147
+ performTransitionEnter(
6148
+ el,
6149
+ transition,
6150
+ () => hostInsert(el, container, anchor),
6151
+ parentSuspense,
6152
+ true
5968
6153
  );
5969
6154
  } else {
5970
6155
  const { leave, delayLeave, afterLeave } = transition;
@@ -5976,6 +6161,12 @@ function baseCreateRenderer(options, createHydrationFns) {
5976
6161
  }
5977
6162
  };
5978
6163
  const performLeave = () => {
6164
+ if (el._isLeaving) {
6165
+ el[leaveCbKey](
6166
+ true
6167
+ /* cancelled */
6168
+ );
6169
+ }
5979
6170
  leave(el, () => {
5980
6171
  remove2();
5981
6172
  afterLeave && afterLeave();
@@ -6015,7 +6206,14 @@ function baseCreateRenderer(options, createHydrationFns) {
6015
6206
  parentComponent.renderCache[cacheIndex] = void 0;
6016
6207
  }
6017
6208
  if (shapeFlag & 256) {
6018
- parentComponent.ctx.deactivate(vnode);
6209
+ if (vnode.type.__vapor) {
6210
+ getVaporInterface(parentComponent, vnode).deactivate(
6211
+ vnode,
6212
+ parentComponent.ctx.getStorageContainer()
6213
+ );
6214
+ } else {
6215
+ parentComponent.ctx.deactivate(vnode);
6216
+ }
6019
6217
  return;
6020
6218
  }
6021
6219
  const shouldInvokeDirs = shapeFlag & 1 && dirs;
@@ -6103,22 +6301,15 @@ function baseCreateRenderer(options, createHydrationFns) {
6103
6301
  removeStaticNode(vnode);
6104
6302
  return;
6105
6303
  }
6106
- const performRemove = () => {
6107
- hostRemove(el);
6108
- if (transition && !transition.persisted && transition.afterLeave) {
6109
- transition.afterLeave();
6110
- }
6111
- };
6112
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
6113
- const { leave, delayLeave } = transition;
6114
- const performLeave = () => leave(el, performRemove);
6115
- if (delayLeave) {
6116
- delayLeave(vnode.el, performRemove, performLeave);
6117
- } else {
6118
- performLeave();
6119
- }
6304
+ if (transition) {
6305
+ performTransitionLeave(
6306
+ el,
6307
+ transition,
6308
+ () => hostRemove(el),
6309
+ !!(vnode.shapeFlag & 1)
6310
+ );
6120
6311
  } else {
6121
- performRemove();
6312
+ hostRemove(el);
6122
6313
  }
6123
6314
  };
6124
6315
  const removeFragment = (cur, end) => {
@@ -6134,27 +6325,12 @@ function baseCreateRenderer(options, createHydrationFns) {
6134
6325
  if (instance.type.__hmrId) {
6135
6326
  unregisterHMR(instance);
6136
6327
  }
6137
- const {
6138
- bum,
6139
- scope,
6140
- effect,
6141
- subTree,
6142
- um,
6143
- m,
6144
- a,
6145
- parent,
6146
- slots: { __: slotCacheKeys }
6147
- } = instance;
6328
+ const { bum, scope, effect, subTree, um, m, a } = instance;
6148
6329
  invalidateMount(m);
6149
6330
  invalidateMount(a);
6150
6331
  if (bum) {
6151
6332
  shared.invokeArrayFns(bum);
6152
6333
  }
6153
- if (parent && shared.isArray(slotCacheKeys)) {
6154
- slotCacheKeys.forEach((v) => {
6155
- parent.renderCache[v] = void 0;
6156
- });
6157
- }
6158
6334
  scope.stop();
6159
6335
  if (effect) {
6160
6336
  effect.stop();
@@ -6168,12 +6344,6 @@ function baseCreateRenderer(options, createHydrationFns) {
6168
6344
  void 0,
6169
6345
  parentSuspense
6170
6346
  );
6171
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
6172
- parentSuspense.deps--;
6173
- if (parentSuspense.deps === 0) {
6174
- parentSuspense.resolve();
6175
- }
6176
- }
6177
6347
  {
6178
6348
  devtoolsComponentRemoved(instance);
6179
6349
  }
@@ -6186,7 +6356,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6186
6356
  const getNextHostNode = (vnode) => {
6187
6357
  if (vnode.shapeFlag & 6) {
6188
6358
  if (vnode.type.__vapor) {
6189
- return hostNextSibling(vnode.component.block);
6359
+ return hostNextSibling(vnode.anchor);
6190
6360
  }
6191
6361
  return getNextHostNode(vnode.component.subTree);
6192
6362
  }
@@ -6264,6 +6434,7 @@ function baseCreateRenderer(options, createHydrationFns) {
6264
6434
  return {
6265
6435
  render,
6266
6436
  hydrate,
6437
+ hydrateNode,
6267
6438
  internals,
6268
6439
  createApp: createAppAPI(
6269
6440
  mountApp,
@@ -6303,7 +6474,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6303
6474
  if (!shallow && c2.patchFlag !== -2)
6304
6475
  traverseStaticChildren(c1, c2);
6305
6476
  }
6306
- if (c2.type === Text) {
6477
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
6478
+ c2.patchFlag !== -1) {
6307
6479
  c2.el = c1.el;
6308
6480
  }
6309
6481
  if (c2.type === Comment && !c2.el) {
@@ -6316,7 +6488,7 @@ function traverseStaticChildren(n1, n2, shallow = false) {
6316
6488
  }
6317
6489
  }
6318
6490
  function locateNonHydratedAsyncRoot(instance) {
6319
- const subComponent = instance.vapor ? null : instance.subTree.component;
6491
+ const subComponent = instance.subTree && instance.subTree.component;
6320
6492
  if (subComponent) {
6321
6493
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
6322
6494
  return subComponent;
@@ -6331,6 +6503,34 @@ function invalidateMount(hooks) {
6331
6503
  hooks[i].flags |= 4;
6332
6504
  }
6333
6505
  }
6506
+ function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
6507
+ if (force || needTransition(parentSuspense, transition)) {
6508
+ transition.beforeEnter(el);
6509
+ insert();
6510
+ queuePostRenderEffect(() => transition.enter(el), void 0, parentSuspense);
6511
+ } else {
6512
+ insert();
6513
+ }
6514
+ }
6515
+ function performTransitionLeave(el, transition, remove, isElement = true) {
6516
+ const performRemove = () => {
6517
+ remove();
6518
+ if (transition && !transition.persisted && transition.afterLeave) {
6519
+ transition.afterLeave();
6520
+ }
6521
+ };
6522
+ if (isElement && transition && !transition.persisted) {
6523
+ const { leave, delayLeave } = transition;
6524
+ const performLeave = () => leave(el, performRemove);
6525
+ if (delayLeave) {
6526
+ delayLeave(el, performRemove, performLeave);
6527
+ } else {
6528
+ performLeave();
6529
+ }
6530
+ } else {
6531
+ performRemove();
6532
+ }
6533
+ }
6334
6534
  function getVaporInterface(instance, vnode) {
6335
6535
  const ctx = instance ? instance.appContext : vnode.appContext;
6336
6536
  const res = ctx && ctx.vapor;
@@ -6345,6 +6545,32 @@ app.use(vaporInteropPlugin)
6345
6545
  }
6346
6546
  return res;
6347
6547
  }
6548
+ function getInheritedScopeIds(vnode, parentComponent) {
6549
+ const inheritedScopeIds = [];
6550
+ let currentParent = parentComponent;
6551
+ let currentVNode = vnode;
6552
+ while (currentParent) {
6553
+ let subTree = currentParent.subTree;
6554
+ if (!subTree) break;
6555
+ if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
6556
+ subTree = filterSingleRoot(subTree.children) || subTree;
6557
+ }
6558
+ if (currentVNode === subTree || isSuspense(subTree.type) && (subTree.ssContent === currentVNode || subTree.ssFallback === currentVNode)) {
6559
+ const parentVNode = currentParent.vnode;
6560
+ if (parentVNode.scopeId) {
6561
+ inheritedScopeIds.push(parentVNode.scopeId);
6562
+ }
6563
+ if (parentVNode.slotScopeIds) {
6564
+ inheritedScopeIds.push(...parentVNode.slotScopeIds);
6565
+ }
6566
+ currentVNode = parentVNode;
6567
+ currentParent = currentParent.parent;
6568
+ } else {
6569
+ break;
6570
+ }
6571
+ }
6572
+ return inheritedScopeIds;
6573
+ }
6348
6574
 
6349
6575
  const ssrContextKey = Symbol.for("v-scx");
6350
6576
  const useSSRContext = () => {
@@ -6588,7 +6814,7 @@ function useModel(props, name, options = shared.EMPTY_OBJ) {
6588
6814
  return res;
6589
6815
  }
6590
6816
  const getModelModifiers = (props, modelName, getter) => {
6591
- return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${shared.camelize(modelName)}Modifiers`) || getter(props, `${shared.hyphenate(modelName)}Modifiers`);
6817
+ return getter(props, shared.getModifierPropName(modelName)) || getter(props, `${shared.camelize(modelName)}Modifiers`) || getter(props, `${shared.hyphenate(modelName)}Modifiers`);
6592
6818
  };
6593
6819
 
6594
6820
  function emit(instance, event, ...rawArgs) {
@@ -6684,8 +6910,9 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
6684
6910
  function defaultPropGetter(props, key) {
6685
6911
  return props[key];
6686
6912
  }
6913
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
6687
6914
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
6688
- const cache = appContext.emitsCache;
6915
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
6689
6916
  const cached = cache.get(comp);
6690
6917
  if (cached !== void 0) {
6691
6918
  return cached;
@@ -7133,7 +7360,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
7133
7360
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
7134
7361
  if (pendingBranch) {
7135
7362
  suspense.pendingBranch = newBranch;
7136
- if (isSameVNodeType(newBranch, pendingBranch)) {
7363
+ if (isSameVNodeType(pendingBranch, newBranch)) {
7137
7364
  patch(
7138
7365
  pendingBranch,
7139
7366
  newBranch,
@@ -7204,7 +7431,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
7204
7431
  );
7205
7432
  setActiveBranch(suspense, newFallback);
7206
7433
  }
7207
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
7434
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
7208
7435
  patch(
7209
7436
  activeBranch,
7210
7437
  newBranch,
@@ -7235,7 +7462,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
7235
7462
  }
7236
7463
  }
7237
7464
  } else {
7238
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
7465
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
7239
7466
  patch(
7240
7467
  activeBranch,
7241
7468
  newBranch,
@@ -7348,7 +7575,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7348
7575
  pendingId,
7349
7576
  effects,
7350
7577
  parentComponent: parentComponent2,
7351
- container: container2
7578
+ container: container2,
7579
+ isInFallback
7352
7580
  } = suspense;
7353
7581
  let delayEnter = false;
7354
7582
  if (suspense.isHydrating) {
@@ -7366,6 +7594,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7366
7594
  parentComponent2
7367
7595
  );
7368
7596
  queuePostFlushCb(effects);
7597
+ if (isInFallback && vnode2.ssFallback) {
7598
+ vnode2.ssFallback.el = null;
7599
+ }
7369
7600
  }
7370
7601
  };
7371
7602
  }
@@ -7374,6 +7605,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7374
7605
  anchor = next(activeBranch);
7375
7606
  }
7376
7607
  unmount(activeBranch, parentComponent2, suspense, true);
7608
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
7609
+ vnode2.ssFallback.el = null;
7610
+ }
7377
7611
  }
7378
7612
  if (!delayEnter) {
7379
7613
  move(
@@ -7498,6 +7732,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
7498
7732
  optimized2
7499
7733
  );
7500
7734
  if (placeholder) {
7735
+ vnode2.placeholder = null;
7501
7736
  remove(placeholder);
7502
7737
  }
7503
7738
  updateHOCHostEl(instance, vnode2.el);
@@ -7703,15 +7938,11 @@ const createVNodeWithArgsTransform = (...args) => {
7703
7938
  );
7704
7939
  };
7705
7940
  const normalizeKey = ({ key }) => key != null ? key : null;
7706
- const normalizeRef = ({
7707
- ref,
7708
- ref_key,
7709
- ref_for
7710
- }) => {
7941
+ const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
7711
7942
  if (typeof ref === "number") {
7712
7943
  ref = "" + ref;
7713
7944
  }
7714
- return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
7945
+ return ref != null ? shared.isString(ref) || reactivity.isRef(ref) || shared.isFunction(ref) ? { i, r: ref, k: ref_key, f: !!ref_for } : ref : null;
7715
7946
  };
7716
7947
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
7717
7948
  const vnode = {
@@ -7877,6 +8108,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
7877
8108
  suspense: vnode.suspense,
7878
8109
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
7879
8110
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
8111
+ placeholder: vnode.placeholder,
7880
8112
  el: vnode.el,
7881
8113
  anchor: vnode.anchor,
7882
8114
  ctx: vnode.ctx,
@@ -8036,6 +8268,25 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
8036
8268
  simpleSetCurrentInstance(instance);
8037
8269
  }
8038
8270
  };
8271
+ const internalOptions = ["ce", "type"];
8272
+ const useInstanceOption = (key, silent = false) => {
8273
+ const instance = getCurrentGenericInstance();
8274
+ if (!instance) {
8275
+ if (!silent) {
8276
+ warn$1(`useInstanceOption called without an active component instance.`);
8277
+ }
8278
+ return { hasInstance: false, value: void 0 };
8279
+ }
8280
+ if (!internalOptions.includes(key)) {
8281
+ {
8282
+ warn$1(
8283
+ `useInstanceOption only accepts ${internalOptions.map((k) => `'${k}'`).join(", ")} as key, got '${key}'.`
8284
+ );
8285
+ }
8286
+ return { hasInstance: true, value: void 0 };
8287
+ }
8288
+ return { hasInstance: true, value: instance[key] };
8289
+ };
8039
8290
 
8040
8291
  const emptyAppContext = createAppContext();
8041
8292
  let uid = 0;
@@ -8403,7 +8654,7 @@ function getComponentPublicInstance(instance) {
8403
8654
  return instance.proxy;
8404
8655
  }
8405
8656
  }
8406
- const classifyRE = /(?:^|[-_])(\w)/g;
8657
+ const classifyRE = /(?:^|[-_])\w/g;
8407
8658
  const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
8408
8659
  function getComponentName(Component, includeInferred = true) {
8409
8660
  return shared.isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
@@ -8439,23 +8690,28 @@ const computed = (getterOrOptions, debugOptions) => {
8439
8690
  };
8440
8691
 
8441
8692
  function h(type, propsOrChildren, children) {
8442
- const l = arguments.length;
8443
- if (l === 2) {
8444
- if (shared.isObject(propsOrChildren) && !shared.isArray(propsOrChildren)) {
8445
- if (isVNode(propsOrChildren)) {
8446
- return createVNode(type, null, [propsOrChildren]);
8693
+ try {
8694
+ setBlockTracking(-1);
8695
+ const l = arguments.length;
8696
+ if (l === 2) {
8697
+ if (shared.isObject(propsOrChildren) && !shared.isArray(propsOrChildren)) {
8698
+ if (isVNode(propsOrChildren)) {
8699
+ return createVNode(type, null, [propsOrChildren]);
8700
+ }
8701
+ return createVNode(type, propsOrChildren);
8702
+ } else {
8703
+ return createVNode(type, null, propsOrChildren);
8447
8704
  }
8448
- return createVNode(type, propsOrChildren);
8449
8705
  } else {
8450
- return createVNode(type, null, propsOrChildren);
8451
- }
8452
- } else {
8453
- if (l > 3) {
8454
- children = Array.prototype.slice.call(arguments, 2);
8455
- } else if (l === 3 && isVNode(children)) {
8456
- children = [children];
8706
+ if (l > 3) {
8707
+ children = Array.prototype.slice.call(arguments, 2);
8708
+ } else if (l === 3 && isVNode(children)) {
8709
+ children = [children];
8710
+ }
8711
+ return createVNode(type, propsOrChildren, children);
8457
8712
  }
8458
- return createVNode(type, propsOrChildren, children);
8713
+ } finally {
8714
+ setBlockTracking(1);
8459
8715
  }
8460
8716
  }
8461
8717
 
@@ -8665,7 +8921,7 @@ function isMemoSame(cached, memo) {
8665
8921
  return true;
8666
8922
  }
8667
8923
 
8668
- const version = "3.6.0-alpha.2";
8924
+ const version = "3.6.0-alpha.4";
8669
8925
  const warn = warn$1 ;
8670
8926
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
8671
8927
  const devtools = devtools$1 ;
@@ -8816,6 +9072,7 @@ exports.toHandlers = toHandlers;
8816
9072
  exports.transformVNodeArgs = transformVNodeArgs;
8817
9073
  exports.useAttrs = useAttrs;
8818
9074
  exports.useId = useId;
9075
+ exports.useInstanceOption = useInstanceOption;
8819
9076
  exports.useModel = useModel;
8820
9077
  exports.useSSRContext = useSSRContext;
8821
9078
  exports.useSlots = useSlots;