@vue/runtime-vapor 3.6.0-alpha.7 → 3.6.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @vue/runtime-vapor v3.6.0-alpha.7
2
+ * @vue/runtime-vapor v3.6.0-beta.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- import { isMismatchAllowed, warn, callWithAsyncErrorHandling, currentInstance, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp, queuePostFlushCb, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, watch, onMounted, onUpdated, onBeforeUnmount, isAsyncWrapper, getComponentName, matches, devtoolsComponentAdded, resetShapeFlag, isKeepAlive, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, ensureVaporSlotFallback, createVNode, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, activate as activate$1, setTransitionHooks as setTransitionHooks$1, normalizeRef, isVNode, Fragment, isRef, ensureHydrationRenderer, setRef as setRef$1, deactivate as deactivate$1, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, resolvePropValue, setCurrentInstance, startMeasure, queueJob, TransitionPropsValidators, leaveCbKey, baseResolveTransitionHooks, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, warnExtraneousAttributes, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, markAsyncBoundary, getFunctionalFallthrough, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, useAsyncComponentState, performAsyncHydrate, handleError, VueElementBase, createCanSetSetupRefChecker, baseUseCssVars, setVarsOnNode, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation } from '@vue/runtime-dom';
6
+ import { queuePostFlushCb, isMismatchAllowed, warn, callWithAsyncErrorHandling, currentInstance, unsafeToTrustedHTML, patchStyle, xlinkNS, mergeProps, shouldSetAsProp, toClassSet, isSetEqual, warnPropMismatch, toStyleMap, vShowHidden, isMapEqual, isValidHtmlOrSvgAttribute, getAttributeMismatch, TransitionPropsValidators, isAsyncWrapper, getComponentName, isTemplateNode, checkTransitionMode, resolveTransitionProps, useTransitionState, baseResolveTransitionHooks, leaveCbKey, watch, onMounted, onUpdated, onBeforeUnmount, matches, devtoolsComponentAdded, resetShapeFlag, isKeepAlive, ensureRenderer, shallowRef, simpleSetCurrentInstance, renderSlot, ensureVaporSlotFallback, createVNode, shallowReactive, createInternalObject, isEmitListener, onScopeDispose, activate as activate$1, setTransitionHooks as setTransitionHooks$1, normalizeRef, setRef as setRef$1, Fragment, isRef, ensureHydrationRenderer, deactivate as deactivate$1, isVNode, baseEmit, baseNormalizePropsOptions, pushWarningContext, validateProps, popWarningContext, setCurrentInstance, resolvePropValue, startMeasure, queueJob, warnExtraneousAttributes, resolveTeleportTarget, isTeleportDisabled, isTeleportDeferred, performTransitionEnter, performTransitionLeave, getInheritedScopeIds, registerHMR, endMeasure, unregisterHMR, nextUid, EffectScope as EffectScope$1, expose, callWithErrorHandling, markAsyncBoundary, getFunctionalFallthrough, createAppAPI, initFeatureFlags, setDevtoolsHook, flushOnAppMount, normalizeContainer, createAsyncComponentContext, useAsyncComponentState, performAsyncHydrate, handleError, VueElementBase, createCanSetSetupRefChecker, baseUseCssVars, setVarsOnNode, resolveDynamicComponent, vShowOriginalDisplay, vModelTextInit, vModelCheckboxInit, vModelSelectInit, vModelTextUpdate, vModelCheckboxUpdate, vModelGetValue, vModelSetSelected, onBeforeUpdate, hasCSSTransform, callPendingCbs, forceReflow, handleMovedChildren, baseApplyTranslation } from '@vue/runtime-dom';
7
7
  import { isArray, normalizeClass, normalizeStyle, includeBooleanAttr, toDisplayString, isString, parseStringStyle, isOn, canSetValueDirectly, camelize, stringifyStyle, normalizeCssVarValue, getEscapedCssVarName, isFunction, extend, invokeArrayFns, isReservedProp, EMPTY_OBJ, hasOwn, EMPTY_ARR, NO, YES, isPromise, getGlobalThis, isPlainObject, isObject, remove as remove$1, NOOP, looseEqual } from '@vue/shared';
8
- import { onEffectCleanup, pauseTracking, resetTracking, computed, ReactiveEffect, setActiveSub, EffectScope, onScopeDispose as onScopeDispose$1, markRaw, unref, proxyRefs, toRaw, watch as watch$1, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, isRef as isRef$1, traverse } from '@vue/reactivity';
8
+ import { onEffectCleanup, computed, onScopeDispose as onScopeDispose$1, pauseTracking, resetTracking, ReactiveEffect, setActiveSub, EffectScope, markRaw, unref, proxyRefs, toRaw, watch as watch$1, isReactive, isShallow, shallowReadArray, isReadonly, toReadonly, toReactive, shallowRef as shallowRef$1, isRef as isRef$1, traverse } from '@vue/reactivity';
9
9
 
10
10
  let insertionParent;
11
11
  let insertionAnchor;
@@ -30,22 +30,22 @@ function resetInsertionState() {
30
30
  insertionParent = insertionAnchor = isLastInsertion = void 0;
31
31
  }
32
32
 
33
- const isHydratingStack = [];
34
- let isHydrating = false;
35
33
  let currentHydrationNode = null;
36
- function pushIsHydrating(value) {
37
- isHydratingStack.push(isHydrating = value);
38
- }
39
- function popIsHydrating() {
40
- isHydratingStack.pop();
41
- isHydrating = isHydratingStack[isHydratingStack.length - 1] || false;
34
+ let _hydrateDynamicFragment;
35
+ let isHydrating = false;
36
+ function setIsHydrating(value) {
37
+ try {
38
+ return isHydrating;
39
+ } finally {
40
+ isHydrating = value;
41
+ }
42
42
  }
43
43
  function runWithoutHydration(fn) {
44
+ const prev = setIsHydrating(false);
44
45
  try {
45
- pushIsHydrating(false);
46
46
  return fn();
47
47
  } finally {
48
- popIsHydrating();
48
+ setIsHydrating(prev);
49
49
  }
50
50
  }
51
51
  let isOptimized$1 = false;
@@ -53,6 +53,7 @@ function performHydration(fn, setup, cleanup) {
53
53
  if (!isOptimized$1) {
54
54
  adoptTemplate = adoptTemplateImpl;
55
55
  locateHydrationNode = locateHydrationNodeImpl;
56
+ _hydrateDynamicFragment = hydrateDynamicFragmentImpl;
56
57
  Comment.prototype.$fe = void 0;
57
58
  Node.prototype.$pns = void 0;
58
59
  Node.prototype.$idx = void 0;
@@ -64,12 +65,12 @@ function performHydration(fn, setup, cleanup) {
64
65
  isOptimized$1 = true;
65
66
  }
66
67
  enableHydrationNodeLookup();
67
- pushIsHydrating(true);
68
+ const prev = setIsHydrating(true);
68
69
  setup();
69
70
  const res = fn();
70
71
  cleanup();
71
72
  currentHydrationNode = null;
72
- popIsHydrating();
73
+ setIsHydrating(prev);
73
74
  if (!isHydrating) disableHydrationNodeLookup();
74
75
  return res;
75
76
  }
@@ -229,6 +230,50 @@ function removeFragmentNodes(node, endAnchor) {
229
230
  }
230
231
  }
231
232
  }
233
+ function hydrateDynamicFragment(frag, isEmpty) {
234
+ _hydrateDynamicFragment && _hydrateDynamicFragment(frag, isEmpty);
235
+ }
236
+ function hydrateDynamicFragmentImpl(frag, isEmpty) {
237
+ if (frag.anchor) return;
238
+ if (frag.anchorLabel === "if") {
239
+ if (isEmpty) {
240
+ frag.anchor = locateFragmentEndAnchor("");
241
+ if (!!(process.env.NODE_ENV !== "production") && !frag.anchor) {
242
+ throw new Error(
243
+ "Failed to locate if anchor. this is likely a Vue internal bug."
244
+ );
245
+ } else {
246
+ if (!!(process.env.NODE_ENV !== "production")) {
247
+ frag.anchor.data = frag.anchorLabel;
248
+ }
249
+ return;
250
+ }
251
+ }
252
+ } else if (frag.anchorLabel === "slot") {
253
+ if (isEmpty && isComment(currentHydrationNode, "")) {
254
+ frag.anchor = currentHydrationNode;
255
+ if (!!(process.env.NODE_ENV !== "production")) {
256
+ frag.anchor.data = frag.anchorLabel;
257
+ }
258
+ return;
259
+ }
260
+ frag.anchor = locateFragmentEndAnchor();
261
+ if (!!(process.env.NODE_ENV !== "production") && !frag.anchor) {
262
+ throw new Error(
263
+ "Failed to locate slot anchor. this is likely a Vue internal bug."
264
+ );
265
+ } else {
266
+ return;
267
+ }
268
+ }
269
+ const { parentNode: pn, nextNode } = findBlockNode(frag.nodes);
270
+ queuePostFlushCb(() => {
271
+ pn.insertBefore(
272
+ frag.anchor = !!(process.env.NODE_ENV !== "production") ? createComment(frag.anchorLabel) : createTextNode(),
273
+ nextNode
274
+ );
275
+ });
276
+ }
232
277
 
233
278
  // @__NO_SIDE_EFFECTS__
234
279
  function createElement(tagName) {
@@ -847,7 +892,242 @@ function shouldForceHydrate(el, key) {
847
892
  tagName.includes("-");
848
893
  }
849
894
 
850
- /*! #__NO_SIDE_EFFECTS__ */
895
+ const displayName = "VaporTransition";
896
+ let registered = false;
897
+ const ensureTransitionHooksRegistered = () => {
898
+ if (!registered) {
899
+ registered = true;
900
+ registerTransitionHooks(
901
+ applyTransitionHooksImpl,
902
+ applyTransitionLeaveHooksImpl
903
+ );
904
+ }
905
+ };
906
+ const decorate$1 = (t) => {
907
+ t.displayName = displayName;
908
+ t.props = TransitionPropsValidators;
909
+ t.__vapor = true;
910
+ return t;
911
+ };
912
+ const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots }) => {
913
+ ensureTransitionHooksRegistered();
914
+ let resetDisplay;
915
+ if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
916
+ const {
917
+ content: { firstChild },
918
+ parentNode
919
+ } = currentHydrationNode;
920
+ if (firstChild) {
921
+ if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
922
+ const originalDisplay = firstChild.style.display;
923
+ firstChild.style.display = "none";
924
+ resetDisplay = () => firstChild.style.display = originalDisplay;
925
+ }
926
+ parentNode.replaceChild(firstChild, currentHydrationNode);
927
+ setCurrentHydrationNode(firstChild);
928
+ }
929
+ }
930
+ const children = slots.default && slots.default();
931
+ if (!children) return [];
932
+ const instance = currentInstance;
933
+ const { mode } = props;
934
+ checkTransitionMode(mode);
935
+ let resolvedProps;
936
+ renderEffect(() => resolvedProps = resolveTransitionProps(props));
937
+ const hooks = applyTransitionHooksImpl(children, {
938
+ state: useTransitionState(),
939
+ // use proxy to keep props reference stable
940
+ props: new Proxy({}, {
941
+ get(_, key) {
942
+ return resolvedProps[key];
943
+ }
944
+ }),
945
+ instance
946
+ });
947
+ if (resetDisplay && resolvedProps.appear) {
948
+ const child = findTransitionBlock(children);
949
+ hooks.beforeEnter(child);
950
+ resetDisplay();
951
+ queuePostFlushCb(() => hooks.enter(child));
952
+ }
953
+ return children;
954
+ });
955
+ const getTransitionHooksContext = (key, props, state, instance, postClone) => {
956
+ const { leavingNodes } = state;
957
+ const context = {
958
+ setLeavingNodeCache: (el) => {
959
+ leavingNodes.set(key, el);
960
+ },
961
+ unsetLeavingNodeCache: (el) => {
962
+ const leavingNode = leavingNodes.get(key);
963
+ if (leavingNode === el) {
964
+ leavingNodes.delete(key);
965
+ }
966
+ },
967
+ earlyRemove: () => {
968
+ const leavingNode = leavingNodes.get(key);
969
+ if (leavingNode && leavingNode[leaveCbKey]) {
970
+ leavingNode[leaveCbKey]();
971
+ }
972
+ },
973
+ cloneHooks: (block) => {
974
+ const hooks = resolveTransitionHooks(
975
+ block,
976
+ props,
977
+ state,
978
+ instance,
979
+ postClone
980
+ );
981
+ if (postClone) postClone(hooks);
982
+ return hooks;
983
+ }
984
+ };
985
+ return context;
986
+ };
987
+ function resolveTransitionHooks(block, props, state, instance, postClone) {
988
+ const context = getTransitionHooksContext(
989
+ String(block.$key),
990
+ props,
991
+ state,
992
+ instance,
993
+ postClone
994
+ );
995
+ const hooks = baseResolveTransitionHooks(
996
+ context,
997
+ props,
998
+ state,
999
+ instance
1000
+ );
1001
+ hooks.state = state;
1002
+ hooks.props = props;
1003
+ hooks.instance = instance;
1004
+ return hooks;
1005
+ }
1006
+ function applyTransitionHooksImpl(block, hooks) {
1007
+ if (isArray(block)) {
1008
+ block = block.filter((b) => !(b instanceof Comment));
1009
+ if (block.length === 1) {
1010
+ block = block[0];
1011
+ } else if (block.length === 0) {
1012
+ return hooks;
1013
+ }
1014
+ }
1015
+ const fragments = [];
1016
+ const child = findTransitionBlock(block, (frag) => fragments.push(frag));
1017
+ if (!child) {
1018
+ fragments.forEach((f) => f.$transition = hooks);
1019
+ if (!!(process.env.NODE_ENV !== "production") && fragments.length === 0) {
1020
+ warn("Transition component has no valid child element");
1021
+ }
1022
+ return hooks;
1023
+ }
1024
+ const { props, instance, state, delayedLeave } = hooks;
1025
+ let resolvedHooks = resolveTransitionHooks(
1026
+ child,
1027
+ props,
1028
+ state,
1029
+ instance,
1030
+ (hooks2) => resolvedHooks = hooks2
1031
+ );
1032
+ resolvedHooks.delayedLeave = delayedLeave;
1033
+ child.$transition = resolvedHooks;
1034
+ fragments.forEach((f) => f.$transition = resolvedHooks);
1035
+ return resolvedHooks;
1036
+ }
1037
+ function applyTransitionLeaveHooksImpl(block, enterHooks, afterLeaveCb) {
1038
+ const leavingBlock = findTransitionBlock(block);
1039
+ if (!leavingBlock) return void 0;
1040
+ const { props, state, instance } = enterHooks;
1041
+ const leavingHooks = resolveTransitionHooks(
1042
+ leavingBlock,
1043
+ props,
1044
+ state,
1045
+ instance
1046
+ );
1047
+ leavingBlock.$transition = leavingHooks;
1048
+ const { mode } = props;
1049
+ if (mode === "out-in") {
1050
+ state.isLeaving = true;
1051
+ leavingHooks.afterLeave = () => {
1052
+ state.isLeaving = false;
1053
+ afterLeaveCb();
1054
+ leavingBlock.$transition = void 0;
1055
+ delete leavingHooks.afterLeave;
1056
+ };
1057
+ } else if (mode === "in-out") {
1058
+ leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
1059
+ state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
1060
+ block2[leaveCbKey] = () => {
1061
+ earlyRemove();
1062
+ block2[leaveCbKey] = void 0;
1063
+ leavingBlock.$transition = void 0;
1064
+ delete enterHooks.delayedLeave;
1065
+ };
1066
+ enterHooks.delayedLeave = () => {
1067
+ delayedLeave();
1068
+ leavingBlock.$transition = void 0;
1069
+ delete enterHooks.delayedLeave;
1070
+ };
1071
+ };
1072
+ }
1073
+ }
1074
+ function findTransitionBlock(block, onFragment) {
1075
+ let child;
1076
+ if (block instanceof Node) {
1077
+ if (block instanceof Element) child = block;
1078
+ } else if (isVaporComponent(block)) {
1079
+ if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
1080
+ child = block;
1081
+ } else {
1082
+ if (getComponentName(block.type) === displayName) return void 0;
1083
+ child = findTransitionBlock(block.block, onFragment);
1084
+ if (child && child.$key === void 0) child.$key = block.uid;
1085
+ }
1086
+ } else if (isArray(block)) {
1087
+ let hasFound = false;
1088
+ for (const c of block) {
1089
+ if (c instanceof Comment) continue;
1090
+ const item = findTransitionBlock(c, onFragment);
1091
+ if (!!(process.env.NODE_ENV !== "production") && hasFound) {
1092
+ warn(
1093
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
1094
+ );
1095
+ break;
1096
+ }
1097
+ child = item;
1098
+ hasFound = true;
1099
+ if (!!!(process.env.NODE_ENV !== "production")) break;
1100
+ }
1101
+ } else if (isFragment(block)) {
1102
+ if (block.insert) {
1103
+ child = block;
1104
+ } else {
1105
+ if (onFragment) onFragment(block);
1106
+ child = findTransitionBlock(block.nodes, onFragment);
1107
+ }
1108
+ }
1109
+ return child;
1110
+ }
1111
+ function setTransitionHooksOnFragment(block, hooks) {
1112
+ if (isFragment(block)) {
1113
+ block.$transition = hooks;
1114
+ if (block.nodes && isFragment(block.nodes)) {
1115
+ setTransitionHooksOnFragment(block.nodes, hooks);
1116
+ }
1117
+ } else if (isArray(block)) {
1118
+ for (let i = 0; i < block.length; i++) {
1119
+ setTransitionHooksOnFragment(block[i], hooks);
1120
+ }
1121
+ }
1122
+ }
1123
+ function setTransitionHooks(block, hooks) {
1124
+ if (isVaporComponent(block)) {
1125
+ block = findTransitionBlock(block.block);
1126
+ if (!block) return;
1127
+ }
1128
+ block.$transition = hooks;
1129
+ }
1130
+
851
1131
  // @__NO_SIDE_EFFECTS__
852
1132
  function defineVaporComponent(comp, extraOptions) {
853
1133
  if (isFunction(comp)) {
@@ -860,7 +1140,7 @@ function defineVaporComponent(comp, extraOptions) {
860
1140
  return comp;
861
1141
  }
862
1142
 
863
- const VaporKeepAliveImpl = defineVaporComponent({
1143
+ const KeepAliveImpl = defineVaporComponent({
864
1144
  name: "VaporKeepAlive",
865
1145
  __isKeepAlive: true,
866
1146
  props: {
@@ -916,22 +1196,19 @@ const VaporKeepAliveImpl = defineVaporComponent({
916
1196
  };
917
1197
  const processFragment = (frag) => {
918
1198
  const [innerBlock, interop] = getInnerBlock(frag.nodes);
919
- if (!innerBlock || !shouldCache(innerBlock, props, interop)) return;
1199
+ if (!innerBlock || !shouldCache(innerBlock, props, interop)) return false;
920
1200
  if (interop) {
921
1201
  if (cache.has(innerBlock.vnode.type)) {
922
1202
  innerBlock.vnode.shapeFlag |= 512;
923
1203
  }
924
- if (shouldCache(innerBlock, props, true)) {
925
- innerBlock.vnode.shapeFlag |= 256;
926
- }
1204
+ innerBlock.vnode.shapeFlag |= 256;
927
1205
  } else {
928
1206
  if (cache.has(innerBlock.type)) {
929
1207
  innerBlock.shapeFlag |= 512;
930
1208
  }
931
- if (shouldCache(innerBlock, props)) {
932
- innerBlock.shapeFlag |= 256;
933
- }
1209
+ innerBlock.shapeFlag |= 256;
934
1210
  }
1211
+ return true;
935
1212
  };
936
1213
  const cacheFragment = (fragment) => {
937
1214
  const [innerBlock, interop] = getInnerBlock(fragment.nodes);
@@ -1008,9 +1285,11 @@ const VaporKeepAliveImpl = defineVaporComponent({
1008
1285
  const injectKeepAliveHooks = (frag) => {
1009
1286
  (frag.onBeforeTeardown || (frag.onBeforeTeardown = [])).push(
1010
1287
  (oldKey, nodes, scope) => {
1011
- processFragment(frag);
1012
- keptAliveScopes.set(oldKey, scope);
1013
- return true;
1288
+ if (processFragment(frag)) {
1289
+ keptAliveScopes.set(oldKey, scope);
1290
+ return true;
1291
+ }
1292
+ return false;
1014
1293
  }
1015
1294
  );
1016
1295
  (frag.onBeforeMount || (frag.onBeforeMount = [])).push(
@@ -1041,6 +1320,7 @@ const VaporKeepAliveImpl = defineVaporComponent({
1041
1320
  return children;
1042
1321
  }
1043
1322
  });
1323
+ const VaporKeepAliveImpl = KeepAliveImpl;
1044
1324
  const shouldCache = (block, props, interop = false) => {
1045
1325
  const isAsync = !interop && isAsyncWrapper(block);
1046
1326
  const type = interop ? block.vnode.type : block.type;
@@ -1078,7 +1358,7 @@ function getInstanceFromCache(cached) {
1078
1358
  return cached.vnode.component;
1079
1359
  }
1080
1360
  function activate(instance, parentNode, anchor) {
1081
- insert(instance.block, parentNode, anchor);
1361
+ move(instance.block, parentNode, anchor, 0, instance);
1082
1362
  queuePostFlushCb(() => {
1083
1363
  instance.isDeactivated = false;
1084
1364
  if (instance.a) invokeArrayFns(instance.a);
@@ -1088,7 +1368,7 @@ function activate(instance, parentNode, anchor) {
1088
1368
  }
1089
1369
  }
1090
1370
  function deactivate(instance, container) {
1091
- insert(instance.block, container);
1371
+ move(instance.block, container, null, 1, instance);
1092
1372
  queuePostFlushCb(() => {
1093
1373
  if (instance.da) invokeArrayFns(instance.da);
1094
1374
  instance.isDeactivated = true;
@@ -1117,7 +1397,7 @@ function setParentSuspense(suspense) {
1117
1397
  }
1118
1398
  }
1119
1399
 
1120
- const interopKey = Symbol(`interop`);
1400
+ const interopKey = /* @__PURE__ */ Symbol(`interop`);
1121
1401
  const vaporInteropImpl = {
1122
1402
  mount(vnode, container, anchor, parentComponent, parentSuspense) {
1123
1403
  let selfAnchor = vnode.el = vnode.anchor = createTextNode();
@@ -1385,6 +1665,9 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
1385
1665
  },
1386
1666
  instance
1387
1667
  );
1668
+ if (isMounted && rawRef) {
1669
+ setRef$1(rawRef, null, null, vnode);
1670
+ }
1388
1671
  };
1389
1672
  return frag;
1390
1673
  }
@@ -1576,7 +1859,26 @@ function propGetter(rawProps, key) {
1576
1859
  }
1577
1860
 
1578
1861
  function resolveSource(source) {
1579
- return isFunction(source) ? source() : source;
1862
+ return isFunction(source) ? resolveFunctionSource(source) : source;
1863
+ }
1864
+ function resolveFunctionSource(source) {
1865
+ if (source._cache) {
1866
+ return source._cache.value;
1867
+ }
1868
+ const parent = currentInstance && currentInstance.parent;
1869
+ if (parent) {
1870
+ source._cache = computed(() => {
1871
+ const prev = setCurrentInstance(parent);
1872
+ try {
1873
+ return source();
1874
+ } finally {
1875
+ setCurrentInstance(...prev);
1876
+ }
1877
+ });
1878
+ onScopeDispose$1(() => source._cache = void 0);
1879
+ return source._cache.value;
1880
+ }
1881
+ return source();
1580
1882
  }
1581
1883
  function getPropsProxyHandlers(comp, once) {
1582
1884
  if (comp.__propsHandlers) {
@@ -1597,13 +1899,15 @@ function getPropsProxyHandlers(comp, once) {
1597
1899
  while (i--) {
1598
1900
  source = dynamicSources[i];
1599
1901
  isDynamic = isFunction(source);
1600
- source = isDynamic ? source() : source;
1902
+ source = isDynamic ? resolveFunctionSource(
1903
+ source
1904
+ ) : source;
1601
1905
  for (rawKey in source) {
1602
1906
  if (camelize(rawKey) === key) {
1603
1907
  return resolvePropValue(
1604
1908
  propsOptions,
1605
1909
  key,
1606
- isDynamic ? source[rawKey] : source[rawKey](),
1910
+ isDynamic ? source[rawKey] : resolveFunctionSource(source[rawKey]),
1607
1911
  instance,
1608
1912
  resolveDefault
1609
1913
  );
@@ -1631,14 +1935,23 @@ function getPropsProxyHandlers(comp, once) {
1631
1935
  true
1632
1936
  );
1633
1937
  };
1634
- const getPropValue = once ? (...args) => {
1635
- pauseTracking();
1636
- const value = getProp(...args);
1637
- resetTracking();
1638
- return value;
1639
- } : getProp;
1938
+ const withOnceCache = (getter) => {
1939
+ return ((instance, key) => {
1940
+ const cache = instance.oncePropsCache || (instance.oncePropsCache = {});
1941
+ if (!(key in cache)) {
1942
+ pauseTracking();
1943
+ try {
1944
+ cache[key] = getter(instance, key);
1945
+ } finally {
1946
+ resetTracking();
1947
+ }
1948
+ }
1949
+ return cache[key];
1950
+ });
1951
+ };
1952
+ const getOnceProp = withOnceCache(getProp);
1640
1953
  const propsHandlers = propsOptions ? {
1641
- get: (target, key) => getPropValue(target, key),
1954
+ get: (target, key) => (once ? getOnceProp : getProp)(target, key),
1642
1955
  has: (_, key) => isProp(key),
1643
1956
  ownKeys: () => Object.keys(propsOptions),
1644
1957
  getOwnPropertyDescriptor(target, key) {
@@ -1646,7 +1959,7 @@ function getPropsProxyHandlers(comp, once) {
1646
1959
  return {
1647
1960
  configurable: true,
1648
1961
  enumerable: true,
1649
- get: () => getPropValue(target, key)
1962
+ get: () => (once ? getOnceProp : getProp)(target, key)
1650
1963
  };
1651
1964
  }
1652
1965
  }
@@ -1669,14 +1982,11 @@ function getPropsProxyHandlers(comp, once) {
1669
1982
  return false;
1670
1983
  }
1671
1984
  };
1672
- const getAttrValue = once ? (...args) => {
1673
- pauseTracking();
1674
- const value = getAttr(...args);
1675
- resetTracking();
1676
- return value;
1677
- } : getAttr;
1985
+ const getOnceAttr = withOnceCache(
1986
+ (instance, key) => getAttr(instance.rawProps, key)
1987
+ );
1678
1988
  const attrsHandlers = {
1679
- get: (target, key) => getAttrValue(target.rawProps, key),
1989
+ get: (target, key) => once ? getOnceAttr(target, key) : getAttr(target.rawProps, key),
1680
1990
  has: (target, key) => hasAttr(target.rawProps, key),
1681
1991
  ownKeys: (target) => getKeysFromRawProps(target.rawProps).filter(isAttr),
1682
1992
  getOwnPropertyDescriptor(target, key) {
@@ -1684,7 +1994,7 @@ function getPropsProxyHandlers(comp, once) {
1684
1994
  return {
1685
1995
  configurable: true,
1686
1996
  enumerable: true,
1687
- get: () => getAttrValue(target.rawProps, key)
1997
+ get: () => once ? getOnceAttr(target, key) : getAttr(target.rawProps, key)
1688
1998
  };
1689
1999
  }
1690
2000
  }
@@ -1707,9 +2017,9 @@ function getAttrFromRawProps(rawProps, key) {
1707
2017
  while (i--) {
1708
2018
  source = dynamicSources[i];
1709
2019
  isDynamic = isFunction(source);
1710
- source = isDynamic ? source() : source;
2020
+ source = isDynamic ? resolveFunctionSource(source) : source;
1711
2021
  if (source && hasOwn(source, key)) {
1712
- const value = isDynamic ? source[key] : source[key]();
2022
+ const value = isDynamic ? source[key] : resolveFunctionSource(source[key]);
1713
2023
  if (merged) {
1714
2024
  merged.push(value);
1715
2025
  } else {
@@ -1754,7 +2064,9 @@ function getKeysFromRawProps(rawProps) {
1754
2064
  let i = dynamicSources.length;
1755
2065
  let source;
1756
2066
  while (i--) {
1757
- source = resolveSource(dynamicSources[i]);
2067
+ source = isFunction(dynamicSources[i]) ? resolveFunctionSource(
2068
+ dynamicSources[i]
2069
+ ) : dynamicSources[i];
1758
2070
  for (const key in source) {
1759
2071
  keys.push(key);
1760
2072
  }
@@ -1820,9 +2132,9 @@ function resolveDynamicProps(props) {
1820
2132
  if (props.$) {
1821
2133
  for (const source of props.$) {
1822
2134
  const isDynamic = isFunction(source);
1823
- const resolved = isDynamic ? source() : source;
2135
+ const resolved = isDynamic ? resolveFunctionSource(source) : source;
1824
2136
  for (const key in resolved) {
1825
- const value = isDynamic ? resolved[key] : resolved[key]();
2137
+ const value = isDynamic ? resolved[key] : resolveFunctionSource(source[key]);
1826
2138
  if (key === "class" || key === "style") {
1827
2139
  const existing = mergedRawProps[key];
1828
2140
  if (isArray(existing)) {
@@ -1874,12 +2186,6 @@ function setCurrentSlotScopeIds(scopeIds) {
1874
2186
  currentSlotScopeIds = scopeIds;
1875
2187
  }
1876
2188
  }
1877
- function resolveDynamicSlot(source) {
1878
- if (!source._cache) {
1879
- source._cache = computed(source);
1880
- }
1881
- return source._cache.value;
1882
- }
1883
2189
  const dynamicSlotsProxyHandlers = {
1884
2190
  get: getSlot,
1885
2191
  has: (target, key) => !!getSlot(target, key),
@@ -1900,11 +2206,13 @@ const dynamicSlotsProxyHandlers = {
1900
2206
  keys = keys.filter((k) => k !== "$");
1901
2207
  for (const source of dynamicSources) {
1902
2208
  if (isFunction(source)) {
1903
- const slot = resolveDynamicSlot(source);
1904
- if (isArray(slot)) {
1905
- for (const s of slot) keys.push(String(s.name));
1906
- } else {
1907
- keys.push(String(slot.name));
2209
+ const slot = resolveFunctionSource(source);
2210
+ if (slot) {
2211
+ if (isArray(slot)) {
2212
+ for (const s of slot) keys.push(String(s.name));
2213
+ } else {
2214
+ keys.push(String(slot.name));
2215
+ }
1908
2216
  }
1909
2217
  } else {
1910
2218
  keys.push(...Object.keys(source));
@@ -1925,7 +2233,7 @@ function getSlot(target, key) {
1925
2233
  while (i--) {
1926
2234
  source = dynamicSources[i];
1927
2235
  if (isFunction(source)) {
1928
- const slot = resolveDynamicSlot(source);
2236
+ const slot = resolveFunctionSource(source);
1929
2237
  if (slot) {
1930
2238
  if (isArray(slot)) {
1931
2239
  for (const s of slot) {
@@ -2028,335 +2336,98 @@ function createSlot(name, rawProps, fallback, noSlotted, once) {
2028
2336
  );
2029
2337
  } else {
2030
2338
  fragment.update(fallback);
2031
- }
2032
- };
2033
- if (!once && (isDynamicName || rawSlots.$)) {
2034
- renderEffect(renderSlot);
2035
- } else {
2036
- renderSlot();
2037
- }
2038
- }
2039
- if (!isHydrating) {
2040
- if (!noSlotted) {
2041
- const scopeId = instance.type.__scopeId;
2042
- if (scopeId) {
2043
- setScopeId(fragment, [`${scopeId}-s`]);
2044
- }
2045
- }
2046
- if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
2047
- } else {
2048
- if (fragment.insert) {
2049
- fragment.hydrate();
2050
- }
2051
- if (_isLastInsertion) {
2052
- advanceHydrationNode(_insertionParent);
2053
- }
2054
- }
2055
- return fragment;
2056
- }
2057
-
2058
- class RenderEffect extends ReactiveEffect {
2059
- constructor(render) {
2060
- super();
2061
- this.render = render;
2062
- const instance = currentInstance;
2063
- if (!!(process.env.NODE_ENV !== "production") && true && !this.subs && !isVaporComponent(instance)) {
2064
- warn("renderEffect called without active EffectScope or Vapor instance.");
2065
- }
2066
- const job = () => {
2067
- if (this.dirty) {
2068
- this.run();
2069
- }
2070
- };
2071
- this.updateJob = () => {
2072
- instance.isUpdating = false;
2073
- instance.u && invokeArrayFns(instance.u);
2074
- };
2075
- if (instance) {
2076
- if (!!(process.env.NODE_ENV !== "production")) {
2077
- this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
2078
- this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
2079
- }
2080
- if (instance.type.ce) {
2081
- (instance.renderEffects || (instance.renderEffects = [])).push(this);
2082
- }
2083
- job.i = instance;
2084
- }
2085
- this.job = job;
2086
- this.i = instance;
2087
- }
2088
- fn() {
2089
- const instance = this.i;
2090
- const scope = this.subs ? this.subs.sub : void 0;
2091
- const hasUpdateHooks = instance && (instance.bu || instance.u);
2092
- if (!!(process.env.NODE_ENV !== "production") && instance) {
2093
- startMeasure(instance, `renderEffect`);
2094
- }
2095
- const prev = setCurrentInstance(instance, scope);
2096
- if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
2097
- instance.isUpdating = true;
2098
- instance.bu && invokeArrayFns(instance.bu);
2099
- this.render();
2100
- queuePostFlushCb(this.updateJob);
2101
- } else {
2102
- this.render();
2103
- }
2104
- setCurrentInstance(...prev);
2105
- if (!!(process.env.NODE_ENV !== "production") && instance) {
2106
- startMeasure(instance, `renderEffect`);
2107
- }
2108
- }
2109
- notify() {
2110
- const flags = this.flags;
2111
- if (!(flags & 256)) {
2112
- queueJob(this.job, this.i ? this.i.uid : void 0);
2113
- }
2114
- }
2115
- }
2116
- function renderEffect(fn, noLifecycle = false) {
2117
- if (inOnceSlot) return fn();
2118
- const effect = new RenderEffect(fn);
2119
- if (noLifecycle) {
2120
- effect.fn = fn;
2121
- }
2122
- effect.run();
2123
- }
2124
-
2125
- const displayName = "VaporTransition";
2126
- const decorate$1 = (t) => {
2127
- t.displayName = displayName;
2128
- t.props = TransitionPropsValidators;
2129
- t.__vapor = true;
2130
- return t;
2131
- };
2132
- const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots }) => {
2133
- let resetDisplay;
2134
- if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
2135
- const {
2136
- content: { firstChild },
2137
- parentNode
2138
- } = currentHydrationNode;
2139
- if (firstChild) {
2140
- if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
2141
- const originalDisplay = firstChild.style.display;
2142
- firstChild.style.display = "none";
2143
- resetDisplay = () => firstChild.style.display = originalDisplay;
2144
- }
2145
- parentNode.replaceChild(firstChild, currentHydrationNode);
2146
- setCurrentHydrationNode(firstChild);
2147
- }
2148
- }
2149
- const children = slots.default && slots.default();
2150
- if (!children) return [];
2151
- const instance = currentInstance;
2152
- const { mode } = props;
2153
- checkTransitionMode(mode);
2154
- let resolvedProps;
2155
- let isMounted = false;
2156
- renderEffect(() => {
2157
- resolvedProps = resolveTransitionProps(props);
2158
- if (isMounted) {
2159
- if (isFragment(children)) {
2160
- children.$transition.props = resolvedProps;
2161
- } else {
2162
- const child = findTransitionBlock(children);
2163
- if (child) {
2164
- child.$transition.props = resolvedProps;
2165
- applyTransitionHooks(child, child.$transition, true);
2166
- }
2167
- }
2168
- } else {
2169
- isMounted = true;
2170
- }
2171
- });
2172
- const hooks = applyTransitionHooks(children, {
2173
- state: useTransitionState(),
2174
- props: resolvedProps,
2175
- instance
2176
- });
2177
- if (resetDisplay && resolvedProps.appear) {
2178
- const child = findTransitionBlock(children);
2179
- hooks.beforeEnter(child);
2180
- resetDisplay();
2181
- queuePostFlushCb(() => hooks.enter(child));
2182
- }
2183
- return children;
2184
- });
2185
- const getTransitionHooksContext = (key, props, state, instance, postClone) => {
2186
- const { leavingNodes } = state;
2187
- const context = {
2188
- setLeavingNodeCache: (el) => {
2189
- leavingNodes.set(key, el);
2190
- },
2191
- unsetLeavingNodeCache: (el) => {
2192
- const leavingNode = leavingNodes.get(key);
2193
- if (leavingNode === el) {
2194
- leavingNodes.delete(key);
2195
- }
2196
- },
2197
- earlyRemove: () => {
2198
- const leavingNode = leavingNodes.get(key);
2199
- if (leavingNode && leavingNode[leaveCbKey]) {
2200
- leavingNode[leaveCbKey]();
2201
- }
2202
- },
2203
- cloneHooks: (block) => {
2204
- const hooks = resolveTransitionHooks(
2205
- block,
2206
- props,
2207
- state,
2208
- instance,
2209
- postClone
2210
- );
2211
- if (postClone) postClone(hooks);
2212
- return hooks;
2213
- }
2214
- };
2215
- return context;
2216
- };
2217
- function resolveTransitionHooks(block, props, state, instance, postClone) {
2218
- const context = getTransitionHooksContext(
2219
- String(block.$key),
2220
- props,
2221
- state,
2222
- instance,
2223
- postClone
2224
- );
2225
- const hooks = baseResolveTransitionHooks(
2226
- context,
2227
- props,
2228
- state,
2229
- instance
2230
- );
2231
- hooks.state = state;
2232
- hooks.props = props;
2233
- hooks.instance = instance;
2234
- return hooks;
2235
- }
2236
- function applyTransitionHooks(block, hooks, isResolved = false) {
2237
- if (isArray(block)) {
2238
- block = block.filter((b) => !(b instanceof Comment));
2239
- if (block.length === 1) {
2240
- block = block[0];
2241
- } else if (block.length === 0) {
2242
- return hooks;
2339
+ }
2340
+ };
2341
+ if (!once && (isDynamicName || rawSlots.$)) {
2342
+ renderEffect(renderSlot);
2343
+ } else {
2344
+ renderSlot();
2243
2345
  }
2244
2346
  }
2245
- const isFrag = isFragment(block);
2246
- const child = isResolved ? block : findTransitionBlock(block, isFrag);
2247
- if (!child) {
2248
- if (isFrag) setTransitionHooksOnFragment(block, hooks);
2249
- return hooks;
2347
+ if (!isHydrating) {
2348
+ if (!noSlotted) {
2349
+ const scopeId = instance.type.__scopeId;
2350
+ if (scopeId) {
2351
+ setScopeId(fragment, [`${scopeId}-s`]);
2352
+ }
2353
+ }
2354
+ if (_insertionParent) insert(fragment, _insertionParent, _insertionAnchor);
2355
+ } else {
2356
+ if (fragment.insert) {
2357
+ fragment.hydrate();
2358
+ }
2359
+ if (_isLastInsertion) {
2360
+ advanceHydrationNode(_insertionParent);
2361
+ }
2250
2362
  }
2251
- const { props, instance, state, delayedLeave } = hooks;
2252
- let resolvedHooks = resolveTransitionHooks(
2253
- child,
2254
- props,
2255
- state,
2256
- instance,
2257
- (hooks2) => resolvedHooks = hooks2
2258
- );
2259
- resolvedHooks.delayedLeave = delayedLeave;
2260
- child.$transition = resolvedHooks;
2261
- if (isFrag) setTransitionHooksOnFragment(block, resolvedHooks);
2262
- return resolvedHooks;
2363
+ return fragment;
2263
2364
  }
2264
- function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
2265
- const leavingBlock = findTransitionBlock(block);
2266
- if (!leavingBlock) return void 0;
2267
- const { props, state, instance } = enterHooks;
2268
- const leavingHooks = resolveTransitionHooks(
2269
- leavingBlock,
2270
- props,
2271
- state,
2272
- instance
2273
- );
2274
- leavingBlock.$transition = leavingHooks;
2275
- const { mode } = props;
2276
- if (mode === "out-in") {
2277
- state.isLeaving = true;
2278
- leavingHooks.afterLeave = () => {
2279
- state.isLeaving = false;
2280
- afterLeaveCb();
2281
- leavingBlock.$transition = void 0;
2282
- delete leavingHooks.afterLeave;
2365
+
2366
+ class RenderEffect extends ReactiveEffect {
2367
+ constructor(render) {
2368
+ super();
2369
+ this.render = render;
2370
+ const instance = currentInstance;
2371
+ if (!!(process.env.NODE_ENV !== "production") && true && !this.subs && !isVaporComponent(instance)) {
2372
+ warn("renderEffect called without active EffectScope or Vapor instance.");
2373
+ }
2374
+ const job = () => {
2375
+ if (this.dirty) {
2376
+ this.run();
2377
+ }
2283
2378
  };
2284
- } else if (mode === "in-out") {
2285
- leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
2286
- state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
2287
- block2[leaveCbKey] = () => {
2288
- earlyRemove();
2289
- block2[leaveCbKey] = void 0;
2290
- leavingBlock.$transition = void 0;
2291
- delete enterHooks.delayedLeave;
2292
- };
2293
- enterHooks.delayedLeave = () => {
2294
- delayedLeave();
2295
- leavingBlock.$transition = void 0;
2296
- delete enterHooks.delayedLeave;
2297
- };
2379
+ this.updateJob = () => {
2380
+ instance.isUpdating = false;
2381
+ instance.u && invokeArrayFns(instance.u);
2298
2382
  };
2299
- }
2300
- }
2301
- function findTransitionBlock(block, inFragment = false) {
2302
- let child;
2303
- if (block instanceof Node) {
2304
- if (block instanceof Element) child = block;
2305
- } else if (isVaporComponent(block)) {
2306
- if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
2307
- child = block;
2308
- } else {
2309
- if (getComponentName(block.type) === displayName) return void 0;
2310
- child = findTransitionBlock(block.block, inFragment);
2311
- if (child && child.$key === void 0) child.$key = block.uid;
2312
- }
2313
- } else if (isArray(block)) {
2314
- let hasFound = false;
2315
- for (const c of block) {
2316
- if (c instanceof Comment) continue;
2317
- if (isFragment(c)) inFragment = true;
2318
- const item = findTransitionBlock(c, inFragment);
2319
- if (!!(process.env.NODE_ENV !== "production") && hasFound) {
2320
- warn(
2321
- "<transition> can only be used on a single element or component. Use <transition-group> for lists."
2322
- );
2323
- break;
2383
+ if (instance) {
2384
+ if (!!(process.env.NODE_ENV !== "production")) {
2385
+ this.onTrack = instance.rtc ? (e) => invokeArrayFns(instance.rtc, e) : void 0;
2386
+ this.onTrigger = instance.rtg ? (e) => invokeArrayFns(instance.rtg, e) : void 0;
2324
2387
  }
2325
- child = item;
2326
- hasFound = true;
2327
- if (!!!(process.env.NODE_ENV !== "production")) break;
2388
+ if (instance.type.ce) {
2389
+ (instance.renderEffects || (instance.renderEffects = [])).push(this);
2390
+ }
2391
+ job.i = instance;
2328
2392
  }
2329
- } else if (isFragment(block)) {
2330
- inFragment = true;
2331
- if (block.insert) {
2332
- child = block;
2393
+ this.job = job;
2394
+ this.i = instance;
2395
+ }
2396
+ fn() {
2397
+ const instance = this.i;
2398
+ const scope = this.subs ? this.subs.sub : void 0;
2399
+ const hasUpdateHooks = instance && (instance.bu || instance.u);
2400
+ if (!!(process.env.NODE_ENV !== "production") && instance) {
2401
+ startMeasure(instance, `renderEffect`);
2402
+ }
2403
+ const prev = setCurrentInstance(instance, scope);
2404
+ if (hasUpdateHooks && instance.isMounted && !instance.isUpdating) {
2405
+ instance.isUpdating = true;
2406
+ instance.bu && invokeArrayFns(instance.bu);
2407
+ this.render();
2408
+ queuePostFlushCb(this.updateJob);
2333
2409
  } else {
2334
- child = findTransitionBlock(block.nodes, true);
2410
+ this.render();
2335
2411
  }
2336
- }
2337
- if (!!(process.env.NODE_ENV !== "production") && !child && !inFragment) {
2338
- warn("Transition component has no valid child element");
2339
- }
2340
- return child;
2341
- }
2342
- function setTransitionHooksOnFragment(block, hooks) {
2343
- if (isFragment(block)) {
2344
- block.$transition = hooks;
2345
- if (block.nodes && isFragment(block.nodes)) {
2346
- setTransitionHooksOnFragment(block.nodes, hooks);
2412
+ setCurrentInstance(...prev);
2413
+ if (!!(process.env.NODE_ENV !== "production") && instance) {
2414
+ startMeasure(instance, `renderEffect`);
2347
2415
  }
2348
- } else if (isArray(block)) {
2349
- for (let i = 0; i < block.length; i++) {
2350
- setTransitionHooksOnFragment(block[i], hooks);
2416
+ }
2417
+ notify() {
2418
+ const flags = this.flags;
2419
+ if (!(flags & 256)) {
2420
+ queueJob(this.job, this.i ? this.i.uid : void 0);
2351
2421
  }
2352
2422
  }
2353
2423
  }
2354
- function setTransitionHooks(block, hooks) {
2355
- if (isVaporComponent(block)) {
2356
- block = findTransitionBlock(block.block);
2357
- if (!block) return;
2424
+ function renderEffect(fn, noLifecycle = false) {
2425
+ if (inOnceSlot) return fn();
2426
+ const effect = new RenderEffect(fn);
2427
+ if (noLifecycle) {
2428
+ effect.fn = fn;
2358
2429
  }
2359
- block.$transition = hooks;
2430
+ effect.run();
2360
2431
  }
2361
2432
 
2362
2433
  class VaporFragment {
@@ -2374,45 +2445,7 @@ class DynamicFragment extends VaporFragment {
2374
2445
  constructor(anchorLabel) {
2375
2446
  super([]);
2376
2447
  this.hydrate = (isEmpty = false) => {
2377
- if (this.anchor) return;
2378
- if (this.anchorLabel === "if") {
2379
- if (isEmpty) {
2380
- this.anchor = locateFragmentEndAnchor("");
2381
- if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
2382
- throw new Error(
2383
- "Failed to locate if anchor. this is likely a Vue internal bug."
2384
- );
2385
- } else {
2386
- if (!!(process.env.NODE_ENV !== "production")) {
2387
- this.anchor.data = this.anchorLabel;
2388
- }
2389
- return;
2390
- }
2391
- }
2392
- } else if (this.anchorLabel === "slot") {
2393
- if (isEmpty && isComment(currentHydrationNode, "")) {
2394
- this.anchor = currentHydrationNode;
2395
- if (!!(process.env.NODE_ENV !== "production")) {
2396
- this.anchor.data = this.anchorLabel;
2397
- }
2398
- return;
2399
- }
2400
- this.anchor = locateFragmentEndAnchor();
2401
- if (!!(process.env.NODE_ENV !== "production") && !this.anchor) {
2402
- throw new Error(
2403
- "Failed to locate slot anchor. this is likely a Vue internal bug."
2404
- );
2405
- } else {
2406
- return;
2407
- }
2408
- }
2409
- const { parentNode, nextNode } = findBlockNode(this.nodes);
2410
- queuePostFlushCb(() => {
2411
- parentNode.insertBefore(
2412
- this.anchor = !!(process.env.NODE_ENV !== "production") ? createComment(this.anchorLabel) : createTextNode(),
2413
- nextNode
2414
- );
2415
- });
2448
+ hydrateDynamicFragment(this, isEmpty);
2416
2449
  };
2417
2450
  this.slotOwner = currentSlotOwner;
2418
2451
  if (isHydrating) {
@@ -2428,28 +2461,41 @@ class DynamicFragment extends VaporFragment {
2428
2461
  if (isHydrating) this.hydrate(true);
2429
2462
  return;
2430
2463
  }
2464
+ const transition = this.$transition;
2465
+ if (transition && transition.state.isLeaving) {
2466
+ this.current = key;
2467
+ this.pending = { render, key };
2468
+ return;
2469
+ }
2470
+ const prevKey = this.current;
2431
2471
  this.current = key;
2432
2472
  const instance = currentInstance;
2433
2473
  const prevSub = setActiveSub();
2434
2474
  const parent = isHydrating ? null : this.anchor.parentNode;
2435
- const transition = this.$transition;
2436
2475
  if (this.scope) {
2437
2476
  let preserveScope = false;
2438
2477
  if (this.onBeforeTeardown) {
2439
- preserveScope = this.onBeforeTeardown.some(
2440
- (hook) => hook(this.current, this.nodes, this.scope)
2441
- );
2478
+ for (const teardown of this.onBeforeTeardown) {
2479
+ if (teardown(prevKey, this.nodes, this.scope)) {
2480
+ preserveScope = true;
2481
+ }
2482
+ }
2442
2483
  }
2443
2484
  if (!preserveScope) {
2444
2485
  this.scope.stop();
2445
2486
  }
2446
2487
  const mode = transition && transition.mode;
2447
2488
  if (mode) {
2448
- applyTransitionLeaveHooks(
2449
- this.nodes,
2450
- transition,
2451
- () => this.renderBranch(render, transition, parent, instance)
2452
- );
2489
+ applyTransitionLeaveHooks(this.nodes, transition, () => {
2490
+ const pending = this.pending;
2491
+ if (pending) {
2492
+ this.pending = void 0;
2493
+ this.current = pending.key;
2494
+ this.renderBranch(pending.render, transition, parent, instance);
2495
+ } else {
2496
+ this.renderBranch(render, transition, parent, instance);
2497
+ }
2498
+ });
2453
2499
  parent && remove(this.nodes, parent);
2454
2500
  if (mode === "out-in") {
2455
2501
  setActiveSub(prevSub);
@@ -2581,6 +2627,11 @@ const VaporTeleportImpl = {
2581
2627
  class TeleportFragment extends VaporFragment {
2582
2628
  constructor(props, slots) {
2583
2629
  super([]);
2630
+ /**
2631
+ * @internal marker for duck typing to avoid direct instanceof check
2632
+ * which prevents tree-shaking of TeleportFragment
2633
+ */
2634
+ this.__isTeleportFragment = true;
2584
2635
  this.insert = (container, anchor) => {
2585
2636
  if (isHydrating) return;
2586
2637
  this.placeholder = !!(process.env.NODE_ENV !== "production") ? createComment("teleport start") : createTextNode();
@@ -2794,7 +2845,10 @@ Server rendered element contains fewer child nodes than client nodes.`
2794
2845
  }
2795
2846
  }
2796
2847
  function isVaporTeleport(value) {
2797
- return value === VaporTeleportImpl;
2848
+ return !!(value && value.__isTeleport && value.__vapor);
2849
+ }
2850
+ function isTeleportFragment(value) {
2851
+ return !!(value && value.__isTeleportFragment);
2798
2852
  }
2799
2853
  function locateTeleportEndAnchor(node = currentHydrationNode) {
2800
2854
  while (node) {
@@ -2876,6 +2930,79 @@ function insert(block, parent, anchor = null, parentSuspense) {
2876
2930
  }
2877
2931
  }
2878
2932
  }
2933
+ function move(block, parent, anchor = null, moveType = 1, parentComponent, parentSuspense) {
2934
+ anchor = anchor === 0 ? parent.$fc || _child(parent) : anchor;
2935
+ if (block instanceof Node) {
2936
+ if (block instanceof Element && block.$transition && !block.$transition.disabled && moveType !== 2) {
2937
+ if (moveType === 0) {
2938
+ performTransitionEnter(
2939
+ block,
2940
+ block.$transition,
2941
+ () => parent.insertBefore(block, anchor),
2942
+ parentSuspense,
2943
+ true
2944
+ );
2945
+ } else {
2946
+ performTransitionLeave(
2947
+ block,
2948
+ block.$transition,
2949
+ () => {
2950
+ if (moveType === 1 && parentComponent && parentComponent.isUnmounted) {
2951
+ block.remove();
2952
+ } else {
2953
+ parent.insertBefore(block, anchor);
2954
+ }
2955
+ },
2956
+ parentSuspense,
2957
+ true
2958
+ );
2959
+ }
2960
+ } else {
2961
+ parent.insertBefore(block, anchor);
2962
+ }
2963
+ } else if (isVaporComponent(block)) {
2964
+ if (block.isMounted) {
2965
+ move(
2966
+ block.block,
2967
+ parent,
2968
+ anchor,
2969
+ moveType,
2970
+ parentComponent,
2971
+ parentSuspense
2972
+ );
2973
+ } else {
2974
+ mountComponent(block, parent, anchor);
2975
+ }
2976
+ } else if (isArray(block)) {
2977
+ for (const b of block) {
2978
+ move(b, parent, anchor, moveType, parentComponent, parentSuspense);
2979
+ }
2980
+ } else {
2981
+ if (block.anchor) {
2982
+ move(
2983
+ block.anchor,
2984
+ parent,
2985
+ anchor,
2986
+ moveType,
2987
+ parentComponent,
2988
+ parentSuspense
2989
+ );
2990
+ anchor = block.anchor;
2991
+ }
2992
+ if (block.insert) {
2993
+ block.insert(parent, anchor, block.$transition);
2994
+ } else {
2995
+ move(
2996
+ block.nodes,
2997
+ parent,
2998
+ anchor,
2999
+ moveType,
3000
+ parentComponent,
3001
+ parentSuspense
3002
+ );
3003
+ }
3004
+ }
3005
+ }
2879
3006
  function prepend(parent, ...blocks) {
2880
3007
  let i = blocks.length;
2881
3008
  while (i--) insert(blocks[i], parent, 0);
@@ -2923,7 +3050,7 @@ function normalizeBlock(block) {
2923
3050
  } else if (isVaporComponent(block)) {
2924
3051
  nodes.push(...normalizeBlock(block.block));
2925
3052
  } else {
2926
- if (block instanceof TeleportFragment) {
3053
+ if (isTeleportFragment(block)) {
2927
3054
  nodes.push(block.placeholder, block.anchor);
2928
3055
  } else {
2929
3056
  nodes.push(...normalizeBlock(block.nodes));
@@ -2999,6 +3126,18 @@ function setComponentScopeId(instance) {
2999
3126
  setScopeId(instance.block, scopeIds);
3000
3127
  }
3001
3128
  }
3129
+ let _applyTransitionHooks;
3130
+ let _applyTransitionLeaveHooks;
3131
+ function registerTransitionHooks(applyHooks, applyLeaveHooks) {
3132
+ _applyTransitionHooks = applyHooks;
3133
+ _applyTransitionLeaveHooks = applyLeaveHooks;
3134
+ }
3135
+ function applyTransitionHooks(block, hooks) {
3136
+ return _applyTransitionHooks ? _applyTransitionHooks(block, hooks) : hooks;
3137
+ }
3138
+ function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
3139
+ _applyTransitionLeaveHooks && _applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb);
3140
+ }
3002
3141
 
3003
3142
  function hmrRerender(instance) {
3004
3143
  const normalized = normalizeBlock(instance.block);
@@ -3450,7 +3589,7 @@ function unmountComponent(instance, parentNode) {
3450
3589
  return;
3451
3590
  }
3452
3591
  if (instance.isMounted && !instance.isUnmounted) {
3453
- if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
3592
+ if (!!(process.env.NODE_ENV !== "production")) {
3454
3593
  unregisterHMR(instance);
3455
3594
  }
3456
3595
  if (instance.bum) {
@@ -3480,7 +3619,7 @@ function getRootElement(block, onDynamicFragment, recurse = true) {
3480
3619
  if (recurse && isVaporComponent(block)) {
3481
3620
  return getRootElement(block.block, onDynamicFragment, recurse);
3482
3621
  }
3483
- if (isFragment(block) && !(block instanceof TeleportFragment)) {
3622
+ if (isFragment(block) && !isTeleportFragment(block)) {
3484
3623
  if (block instanceof DynamicFragment && onDynamicFragment) {
3485
3624
  onDynamicFragment(block);
3486
3625
  }
@@ -3558,7 +3697,7 @@ function handleSetupResult(setupResult, component, instance) {
3558
3697
  });
3559
3698
  } else if (!!(process.env.NODE_ENV !== "production") && (!instance.accessedAttrs && isArray(instance.block) && instance.block.length || // preventing attrs fallthrough on Teleport
3560
3699
  // consistent with VDOM Teleport behavior
3561
- instance.block instanceof TeleportFragment)) {
3700
+ isTeleportFragment(instance.block))) {
3562
3701
  warnExtraneousAttributes(instance.attrs);
3563
3702
  }
3564
3703
  }
@@ -3895,7 +4034,6 @@ class VaporElement extends VueElementBase {
3895
4034
  }
3896
4035
 
3897
4036
  let t;
3898
- /*! #__NO_SIDE_EFFECTS__ */
3899
4037
  // @__NO_SIDE_EFFECTS__
3900
4038
  function template(html, root, ns) {
3901
4039
  let node;
@@ -3932,7 +4070,7 @@ function createIf(condition, b1, b2, once) {
3932
4070
  if (!isHydrating) resetInsertionState();
3933
4071
  let frag;
3934
4072
  if (once) {
3935
- frag = condition() ? b1() : b2 ? b2() : [];
4073
+ frag = condition() ? b1() : b2 ? b2() : [!!(process.env.NODE_ENV !== "production") ? createComment("if") : createTextNode()];
3936
4074
  } else {
3937
4075
  frag = isHydrating || !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("if") : new DynamicFragment();
3938
4076
  renderEffect(() => frag.update(condition() ? b1 : b2));
@@ -3953,9 +4091,7 @@ function createKeyedFragment(key, render) {
3953
4091
  const _isLastInsertion = isLastInsertion;
3954
4092
  if (!isHydrating) resetInsertionState();
3955
4093
  const frag = !!(process.env.NODE_ENV !== "production") ? new DynamicFragment("keyed") : new DynamicFragment();
3956
- renderEffect(() => {
3957
- frag.update(render, key());
3958
- });
4094
+ renderEffect(() => frag.update(render, key()));
3959
4095
  if (!isHydrating) {
3960
4096
  if (_insertionParent) insert(frag, _insertionParent, _insertionAnchor);
3961
4097
  } else {
@@ -4565,11 +4701,11 @@ function resolveParentNode(block) {
4565
4701
  if (block instanceof Node) {
4566
4702
  return block.parentNode;
4567
4703
  } else if (isArray(block)) {
4568
- return resolveParentNode(block[0]);
4704
+ return resolveParentNode(block[block.length - 1]);
4569
4705
  } else if (isVaporComponent(block)) {
4570
4706
  return resolveParentNode(block.block);
4571
4707
  } else {
4572
- return resolveParentNode(block.nodes);
4708
+ return resolveParentNode(block.anchor || block.nodes);
4573
4709
  }
4574
4710
  }
4575
4711
  function setVars(instance, vars) {
@@ -4601,13 +4737,16 @@ function createDynamicComponent(getter, rawProps, rawSlots, isSingleRoot, once)
4601
4737
  const value = getter();
4602
4738
  const appContext = currentInstance && currentInstance.appContext || emptyContext;
4603
4739
  frag.update(
4604
- () => createComponentWithFallback(
4605
- resolveDynamicComponent(value),
4606
- rawProps,
4607
- rawSlots,
4608
- isSingleRoot,
4609
- once,
4610
- appContext
4740
+ () => (
4741
+ // Support integration with VaporRouterView/VaporRouterLink by accepting blocks
4742
+ isBlock(value) ? value : createComponentWithFallback(
4743
+ resolveDynamicComponent(value),
4744
+ rawProps,
4745
+ rawSlots,
4746
+ isSingleRoot,
4747
+ once,
4748
+ appContext
4749
+ )
4611
4750
  ),
4612
4751
  value
4613
4752
  );
@@ -4789,16 +4928,25 @@ const decorate = (t) => {
4789
4928
  t.__vapor = true;
4790
4929
  return t;
4791
4930
  };
4792
- const VaporTransitionGroup = decorate({
4931
+ const VaporTransitionGroupImpl = {
4793
4932
  name: "VaporTransitionGroup",
4794
4933
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
4795
4934
  tag: String,
4796
4935
  moveClass: String
4797
4936
  }),
4798
4937
  setup(props, { slots }) {
4938
+ ensureTransitionHooksRegistered();
4799
4939
  const instance = currentInstance;
4800
4940
  const state = useTransitionState();
4801
- const cssTransitionProps = resolveTransitionProps(props);
4941
+ let cssTransitionProps = resolveTransitionProps(props);
4942
+ const propsProxy = new Proxy({}, {
4943
+ get(_, key) {
4944
+ return cssTransitionProps[key];
4945
+ }
4946
+ });
4947
+ renderEffect(() => {
4948
+ cssTransitionProps = resolveTransitionProps(props);
4949
+ });
4802
4950
  let prevChildren;
4803
4951
  let children;
4804
4952
  const slottedBlock = slots.default && slots.default();
@@ -4849,7 +4997,7 @@ const VaporTransitionGroup = decorate({
4849
4997
  prevChildren = [];
4850
4998
  });
4851
4999
  setTransitionHooksOnFragment(slottedBlock, {
4852
- props: cssTransitionProps,
5000
+ props: propsProxy,
4853
5001
  state,
4854
5002
  instance
4855
5003
  });
@@ -4860,7 +5008,7 @@ const VaporTransitionGroup = decorate({
4860
5008
  if (child.$key != null) {
4861
5009
  const hooks = resolveTransitionHooks(
4862
5010
  child,
4863
- cssTransitionProps,
5011
+ propsProxy,
4864
5012
  state,
4865
5013
  instance
4866
5014
  );
@@ -4879,7 +5027,8 @@ const VaporTransitionGroup = decorate({
4879
5027
  return slottedBlock;
4880
5028
  }
4881
5029
  }
4882
- });
5030
+ };
5031
+ const VaporTransitionGroup = /* @__PURE__ */ decorate(VaporTransitionGroupImpl);
4883
5032
  function getTransitionBlocks(block) {
4884
5033
  let children = [];
4885
5034
  if (block instanceof Node) {