vue 3.6.0-beta.1 → 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,5 +1,5 @@
1
1
  /**
2
- * vue v3.6.0-beta.1
2
+ * vue v3.6.0-beta.2
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -2422,7 +2422,6 @@ function warn$1(msg, ...args) {
2422
2422
  instance,
2423
2423
  11,
2424
2424
  [
2425
- // eslint-disable-next-line no-restricted-syntax
2426
2425
  msg + args.map((a) => {
2427
2426
  var _a, _b;
2428
2427
  return (_b = (_a = a.toString) == null ? void 0 : _a.call(a)) != null ? _b : JSON.stringify(a);
@@ -3047,7 +3046,6 @@ function setDevtoolsHook$1(hook, target) {
3047
3046
  // (#4815)
3048
3047
  typeof window !== "undefined" && // some envs mock window but not fully
3049
3048
  window.HTMLElement && // also exclude jsdom
3050
- // eslint-disable-next-line no-restricted-syntax
3051
3049
  !((_b = (_a = window.navigator) == null ? void 0 : _a.userAgent) == null ? void 0 : _b.includes("jsdom"))
3052
3050
  ) {
3053
3051
  const replay = target.__VUE_DEVTOOLS_HOOK_REPLAY__ = target.__VUE_DEVTOOLS_HOOK_REPLAY__ || [];
@@ -5054,9 +5052,17 @@ function isMismatchAllowed(el, allowedType) {
5054
5052
  }
5055
5053
  }
5056
5054
 
5057
- const requestIdleCallback = getGlobalThis().requestIdleCallback || ((cb) => setTimeout(cb, 1));
5058
- const cancelIdleCallback = getGlobalThis().cancelIdleCallback || ((id) => clearTimeout(id));
5055
+ let requestIdleCallback;
5056
+ let cancelIdleCallback;
5057
+ function ensureIdleCallbacks() {
5058
+ if (!requestIdleCallback) {
5059
+ const g = getGlobalThis();
5060
+ requestIdleCallback = g.requestIdleCallback || ((cb) => setTimeout(cb, 1));
5061
+ cancelIdleCallback = g.cancelIdleCallback || ((id) => clearTimeout(id));
5062
+ }
5063
+ }
5059
5064
  const hydrateOnIdle = (timeout = 1e4) => (hydrate) => {
5065
+ ensureIdleCallbacks();
5060
5066
  const id = requestIdleCallback(hydrate, { timeout });
5061
5067
  return () => cancelIdleCallback(id);
5062
5068
  };
@@ -5349,7 +5355,7 @@ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydra
5349
5355
  }
5350
5356
 
5351
5357
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
5352
- const KeepAliveImpl = {
5358
+ const KeepAliveImpl$1 = {
5353
5359
  name: `KeepAlive`,
5354
5360
  // Marker for special handling inside the renderer. We are not using a ===
5355
5361
  // check directly on KeepAlive in the renderer, because importing it directly
@@ -5537,7 +5543,7 @@ const KeepAliveImpl = {
5537
5543
  };
5538
5544
  }
5539
5545
  };
5540
- const KeepAlive = KeepAliveImpl;
5546
+ const KeepAlive = KeepAliveImpl$1;
5541
5547
  function matches(pattern, name) {
5542
5548
  if (isArray(pattern)) {
5543
5549
  return pattern.some((p) => matches(p, name));
@@ -10258,7 +10264,7 @@ function hydrateSuspense(node, vnode, parentComponent, parentSuspense, namespace
10258
10264
  parentSuspense,
10259
10265
  parentComponent,
10260
10266
  node.parentNode,
10261
- // eslint-disable-next-line no-restricted-globals
10267
+ // oxlint-disable-next-line no-restricted-globals
10262
10268
  document.createElement("div"),
10263
10269
  null,
10264
10270
  namespace,
@@ -10754,7 +10760,7 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
10754
10760
  simpleSetCurrentInstance(instance);
10755
10761
  }
10756
10762
  };
10757
- const internalOptions = ["ce", "type"];
10763
+ const internalOptions = ["ce", "type", "uid"];
10758
10764
  const useInstanceOption = (key, silent = false) => {
10759
10765
  const instance = getCurrentGenericInstance();
10760
10766
  if (!instance) {
@@ -10774,7 +10780,7 @@ const useInstanceOption = (key, silent = false) => {
10774
10780
  return { hasInstance: true, value: instance[key] };
10775
10781
  };
10776
10782
 
10777
- const emptyAppContext = createAppContext();
10783
+ const emptyAppContext = /* @__PURE__ */ createAppContext();
10778
10784
  let uid = 0;
10779
10785
  function nextUid() {
10780
10786
  return uid++;
@@ -11409,7 +11415,7 @@ function isMemoSame(cached, memo) {
11409
11415
  return true;
11410
11416
  }
11411
11417
 
11412
- const version = "3.6.0-beta.1";
11418
+ const version = "3.6.0-beta.2";
11413
11419
  const warn = warn$1 ;
11414
11420
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11415
11421
  const devtools = devtools$1 ;
@@ -13468,22 +13474,22 @@ function resetInsertionState() {
13468
13474
  insertionParent = insertionAnchor = isLastInsertion = void 0;
13469
13475
  }
13470
13476
 
13471
- const isHydratingStack = [];
13472
- let isHydrating = false;
13473
13477
  let currentHydrationNode = null;
13474
- function pushIsHydrating(value) {
13475
- isHydratingStack.push(isHydrating = value);
13476
- }
13477
- function popIsHydrating() {
13478
- isHydratingStack.pop();
13479
- isHydrating = isHydratingStack[isHydratingStack.length - 1] || false;
13478
+ let _hydrateDynamicFragment;
13479
+ let isHydrating = false;
13480
+ function setIsHydrating(value) {
13481
+ try {
13482
+ return isHydrating;
13483
+ } finally {
13484
+ isHydrating = value;
13485
+ }
13480
13486
  }
13481
13487
  function runWithoutHydration(fn) {
13488
+ const prev = setIsHydrating(false);
13482
13489
  try {
13483
- pushIsHydrating(false);
13484
13490
  return fn();
13485
13491
  } finally {
13486
- popIsHydrating();
13492
+ setIsHydrating(prev);
13487
13493
  }
13488
13494
  }
13489
13495
  let isOptimized$1 = false;
@@ -13491,6 +13497,7 @@ function performHydration(fn, setup, cleanup) {
13491
13497
  if (!isOptimized$1) {
13492
13498
  adoptTemplate = adoptTemplateImpl;
13493
13499
  locateHydrationNode = locateHydrationNodeImpl;
13500
+ _hydrateDynamicFragment = hydrateDynamicFragmentImpl;
13494
13501
  Comment.prototype.$fe = void 0;
13495
13502
  Node.prototype.$pns = void 0;
13496
13503
  Node.prototype.$idx = void 0;
@@ -13502,12 +13509,12 @@ function performHydration(fn, setup, cleanup) {
13502
13509
  isOptimized$1 = true;
13503
13510
  }
13504
13511
  enableHydrationNodeLookup();
13505
- pushIsHydrating(true);
13512
+ const prev = setIsHydrating(true);
13506
13513
  setup();
13507
13514
  const res = fn();
13508
13515
  cleanup();
13509
13516
  currentHydrationNode = null;
13510
- popIsHydrating();
13517
+ setIsHydrating(prev);
13511
13518
  if (!isHydrating) disableHydrationNodeLookup();
13512
13519
  return res;
13513
13520
  }
@@ -13667,6 +13674,50 @@ function removeFragmentNodes(node, endAnchor) {
13667
13674
  }
13668
13675
  }
13669
13676
  }
13677
+ function hydrateDynamicFragment(frag, isEmpty) {
13678
+ _hydrateDynamicFragment && _hydrateDynamicFragment(frag, isEmpty);
13679
+ }
13680
+ function hydrateDynamicFragmentImpl(frag, isEmpty) {
13681
+ if (frag.anchor) return;
13682
+ if (frag.anchorLabel === "if") {
13683
+ if (isEmpty) {
13684
+ frag.anchor = locateFragmentEndAnchor("");
13685
+ if (!frag.anchor) {
13686
+ throw new Error(
13687
+ "Failed to locate if anchor. this is likely a Vue internal bug."
13688
+ );
13689
+ } else {
13690
+ {
13691
+ frag.anchor.data = frag.anchorLabel;
13692
+ }
13693
+ return;
13694
+ }
13695
+ }
13696
+ } else if (frag.anchorLabel === "slot") {
13697
+ if (isEmpty && isComment(currentHydrationNode, "")) {
13698
+ frag.anchor = currentHydrationNode;
13699
+ {
13700
+ frag.anchor.data = frag.anchorLabel;
13701
+ }
13702
+ return;
13703
+ }
13704
+ frag.anchor = locateFragmentEndAnchor();
13705
+ if (!frag.anchor) {
13706
+ throw new Error(
13707
+ "Failed to locate slot anchor. this is likely a Vue internal bug."
13708
+ );
13709
+ } else {
13710
+ return;
13711
+ }
13712
+ }
13713
+ const { parentNode: pn, nextNode } = findBlockNode(frag.nodes);
13714
+ queuePostFlushCb(() => {
13715
+ pn.insertBefore(
13716
+ frag.anchor = createComment(frag.anchorLabel) ,
13717
+ nextNode
13718
+ );
13719
+ });
13720
+ }
13670
13721
 
13671
13722
  // @__NO_SIDE_EFFECTS__
13672
13723
  function createElement(tagName) {
@@ -14285,7 +14336,241 @@ function shouldForceHydrate(el, key) {
14285
14336
  tagName.includes("-");
14286
14337
  }
14287
14338
 
14288
- /*! #__NO_SIDE_EFFECTS__ */
14339
+ const displayName = "VaporTransition";
14340
+ let registered = false;
14341
+ const ensureTransitionHooksRegistered = () => {
14342
+ if (!registered) {
14343
+ registered = true;
14344
+ registerTransitionHooks(
14345
+ applyTransitionHooksImpl,
14346
+ applyTransitionLeaveHooksImpl
14347
+ );
14348
+ }
14349
+ };
14350
+ const decorate$1 = (t) => {
14351
+ t.displayName = displayName;
14352
+ t.props = TransitionPropsValidators;
14353
+ t.__vapor = true;
14354
+ return t;
14355
+ };
14356
+ const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots }) => {
14357
+ ensureTransitionHooksRegistered();
14358
+ let resetDisplay;
14359
+ if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
14360
+ const {
14361
+ content: { firstChild },
14362
+ parentNode
14363
+ } = currentHydrationNode;
14364
+ if (firstChild) {
14365
+ if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
14366
+ const originalDisplay = firstChild.style.display;
14367
+ firstChild.style.display = "none";
14368
+ resetDisplay = () => firstChild.style.display = originalDisplay;
14369
+ }
14370
+ parentNode.replaceChild(firstChild, currentHydrationNode);
14371
+ setCurrentHydrationNode(firstChild);
14372
+ }
14373
+ }
14374
+ const children = slots.default && slots.default();
14375
+ if (!children) return [];
14376
+ const instance = currentInstance;
14377
+ const { mode } = props;
14378
+ checkTransitionMode(mode);
14379
+ let resolvedProps;
14380
+ renderEffect(() => resolvedProps = resolveTransitionProps(props));
14381
+ const hooks = applyTransitionHooksImpl(children, {
14382
+ state: useTransitionState(),
14383
+ // use proxy to keep props reference stable
14384
+ props: new Proxy({}, {
14385
+ get(_, key) {
14386
+ return resolvedProps[key];
14387
+ }
14388
+ }),
14389
+ instance
14390
+ });
14391
+ if (resetDisplay && resolvedProps.appear) {
14392
+ const child = findTransitionBlock(children);
14393
+ hooks.beforeEnter(child);
14394
+ resetDisplay();
14395
+ queuePostFlushCb(() => hooks.enter(child));
14396
+ }
14397
+ return children;
14398
+ });
14399
+ const getTransitionHooksContext = (key, props, state, instance, postClone) => {
14400
+ const { leavingNodes } = state;
14401
+ const context = {
14402
+ setLeavingNodeCache: (el) => {
14403
+ leavingNodes.set(key, el);
14404
+ },
14405
+ unsetLeavingNodeCache: (el) => {
14406
+ const leavingNode = leavingNodes.get(key);
14407
+ if (leavingNode === el) {
14408
+ leavingNodes.delete(key);
14409
+ }
14410
+ },
14411
+ earlyRemove: () => {
14412
+ const leavingNode = leavingNodes.get(key);
14413
+ if (leavingNode && leavingNode[leaveCbKey]) {
14414
+ leavingNode[leaveCbKey]();
14415
+ }
14416
+ },
14417
+ cloneHooks: (block) => {
14418
+ const hooks = resolveTransitionHooks(
14419
+ block,
14420
+ props,
14421
+ state,
14422
+ instance,
14423
+ postClone
14424
+ );
14425
+ if (postClone) postClone(hooks);
14426
+ return hooks;
14427
+ }
14428
+ };
14429
+ return context;
14430
+ };
14431
+ function resolveTransitionHooks(block, props, state, instance, postClone) {
14432
+ const context = getTransitionHooksContext(
14433
+ String(block.$key),
14434
+ props,
14435
+ state,
14436
+ instance,
14437
+ postClone
14438
+ );
14439
+ const hooks = baseResolveTransitionHooks(
14440
+ context,
14441
+ props,
14442
+ state,
14443
+ instance
14444
+ );
14445
+ hooks.state = state;
14446
+ hooks.props = props;
14447
+ hooks.instance = instance;
14448
+ return hooks;
14449
+ }
14450
+ function applyTransitionHooksImpl(block, hooks) {
14451
+ if (isArray(block)) {
14452
+ block = block.filter((b) => !(b instanceof Comment));
14453
+ if (block.length === 1) {
14454
+ block = block[0];
14455
+ } else if (block.length === 0) {
14456
+ return hooks;
14457
+ }
14458
+ }
14459
+ const fragments = [];
14460
+ const child = findTransitionBlock(block, (frag) => fragments.push(frag));
14461
+ if (!child) {
14462
+ fragments.forEach((f) => f.$transition = hooks);
14463
+ if (fragments.length === 0) {
14464
+ warn("Transition component has no valid child element");
14465
+ }
14466
+ return hooks;
14467
+ }
14468
+ const { props, instance, state, delayedLeave } = hooks;
14469
+ let resolvedHooks = resolveTransitionHooks(
14470
+ child,
14471
+ props,
14472
+ state,
14473
+ instance,
14474
+ (hooks2) => resolvedHooks = hooks2
14475
+ );
14476
+ resolvedHooks.delayedLeave = delayedLeave;
14477
+ child.$transition = resolvedHooks;
14478
+ fragments.forEach((f) => f.$transition = resolvedHooks);
14479
+ return resolvedHooks;
14480
+ }
14481
+ function applyTransitionLeaveHooksImpl(block, enterHooks, afterLeaveCb) {
14482
+ const leavingBlock = findTransitionBlock(block);
14483
+ if (!leavingBlock) return void 0;
14484
+ const { props, state, instance } = enterHooks;
14485
+ const leavingHooks = resolveTransitionHooks(
14486
+ leavingBlock,
14487
+ props,
14488
+ state,
14489
+ instance
14490
+ );
14491
+ leavingBlock.$transition = leavingHooks;
14492
+ const { mode } = props;
14493
+ if (mode === "out-in") {
14494
+ state.isLeaving = true;
14495
+ leavingHooks.afterLeave = () => {
14496
+ state.isLeaving = false;
14497
+ afterLeaveCb();
14498
+ leavingBlock.$transition = void 0;
14499
+ delete leavingHooks.afterLeave;
14500
+ };
14501
+ } else if (mode === "in-out") {
14502
+ leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
14503
+ state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
14504
+ block2[leaveCbKey] = () => {
14505
+ earlyRemove();
14506
+ block2[leaveCbKey] = void 0;
14507
+ leavingBlock.$transition = void 0;
14508
+ delete enterHooks.delayedLeave;
14509
+ };
14510
+ enterHooks.delayedLeave = () => {
14511
+ delayedLeave();
14512
+ leavingBlock.$transition = void 0;
14513
+ delete enterHooks.delayedLeave;
14514
+ };
14515
+ };
14516
+ }
14517
+ }
14518
+ function findTransitionBlock(block, onFragment) {
14519
+ let child;
14520
+ if (block instanceof Node) {
14521
+ if (block instanceof Element) child = block;
14522
+ } else if (isVaporComponent(block)) {
14523
+ if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
14524
+ child = block;
14525
+ } else {
14526
+ if (getComponentName(block.type) === displayName) return void 0;
14527
+ child = findTransitionBlock(block.block, onFragment);
14528
+ if (child && child.$key === void 0) child.$key = block.uid;
14529
+ }
14530
+ } else if (isArray(block)) {
14531
+ let hasFound = false;
14532
+ for (const c of block) {
14533
+ if (c instanceof Comment) continue;
14534
+ const item = findTransitionBlock(c, onFragment);
14535
+ if (hasFound) {
14536
+ warn(
14537
+ "<transition> can only be used on a single element or component. Use <transition-group> for lists."
14538
+ );
14539
+ break;
14540
+ }
14541
+ child = item;
14542
+ hasFound = true;
14543
+ }
14544
+ } else if (isFragment(block)) {
14545
+ if (block.insert) {
14546
+ child = block;
14547
+ } else {
14548
+ if (onFragment) onFragment(block);
14549
+ child = findTransitionBlock(block.nodes, onFragment);
14550
+ }
14551
+ }
14552
+ return child;
14553
+ }
14554
+ function setTransitionHooksOnFragment(block, hooks) {
14555
+ if (isFragment(block)) {
14556
+ block.$transition = hooks;
14557
+ if (block.nodes && isFragment(block.nodes)) {
14558
+ setTransitionHooksOnFragment(block.nodes, hooks);
14559
+ }
14560
+ } else if (isArray(block)) {
14561
+ for (let i = 0; i < block.length; i++) {
14562
+ setTransitionHooksOnFragment(block[i], hooks);
14563
+ }
14564
+ }
14565
+ }
14566
+ function setTransitionHooks(block, hooks) {
14567
+ if (isVaporComponent(block)) {
14568
+ block = findTransitionBlock(block.block);
14569
+ if (!block) return;
14570
+ }
14571
+ block.$transition = hooks;
14572
+ }
14573
+
14289
14574
  // @__NO_SIDE_EFFECTS__
14290
14575
  function defineVaporComponent(comp, extraOptions) {
14291
14576
  if (isFunction(comp)) {
@@ -14298,7 +14583,7 @@ function defineVaporComponent(comp, extraOptions) {
14298
14583
  return comp;
14299
14584
  }
14300
14585
 
14301
- const VaporKeepAliveImpl = defineVaporComponent({
14586
+ const KeepAliveImpl = defineVaporComponent({
14302
14587
  name: "VaporKeepAlive",
14303
14588
  __isKeepAlive: true,
14304
14589
  props: {
@@ -14478,6 +14763,7 @@ const VaporKeepAliveImpl = defineVaporComponent({
14478
14763
  return children;
14479
14764
  }
14480
14765
  });
14766
+ const VaporKeepAliveImpl = KeepAliveImpl;
14481
14767
  const shouldCache = (block, props, interop = false) => {
14482
14768
  const isAsync = !interop && isAsyncWrapper(block);
14483
14769
  const type = interop ? block.vnode.type : block.type;
@@ -14822,6 +15108,9 @@ function createVDOMComponent(internals, component, parentComponent, rawProps, ra
14822
15108
  },
14823
15109
  instance
14824
15110
  );
15111
+ if (isMounted && rawRef) {
15112
+ setRef$1(rawRef, null, null, vnode);
15113
+ }
14825
15114
  };
14826
15115
  return frag;
14827
15116
  }
@@ -15361,10 +15650,12 @@ const dynamicSlotsProxyHandlers = {
15361
15650
  for (const source of dynamicSources) {
15362
15651
  if (isFunction(source)) {
15363
15652
  const slot = resolveFunctionSource(source);
15364
- if (isArray(slot)) {
15365
- for (const s of slot) keys.push(String(s.name));
15366
- } else {
15367
- keys.push(String(slot.name));
15653
+ if (slot) {
15654
+ if (isArray(slot)) {
15655
+ for (const s of slot) keys.push(String(s.name));
15656
+ } else {
15657
+ keys.push(String(slot.name));
15658
+ }
15368
15659
  }
15369
15660
  } else {
15370
15661
  keys.push(...Object.keys(source));
@@ -15582,230 +15873,6 @@ function renderEffect(fn, noLifecycle = false) {
15582
15873
  effect.run();
15583
15874
  }
15584
15875
 
15585
- const displayName = "VaporTransition";
15586
- const decorate$1 = (t) => {
15587
- t.displayName = displayName;
15588
- t.props = TransitionPropsValidators;
15589
- t.__vapor = true;
15590
- return t;
15591
- };
15592
- const VaporTransition = /* @__PURE__ */ decorate$1((props, { slots }) => {
15593
- let resetDisplay;
15594
- if (isHydrating && currentHydrationNode && isTemplateNode(currentHydrationNode)) {
15595
- const {
15596
- content: { firstChild },
15597
- parentNode
15598
- } = currentHydrationNode;
15599
- if (firstChild) {
15600
- if (firstChild instanceof HTMLElement || firstChild instanceof SVGElement) {
15601
- const originalDisplay = firstChild.style.display;
15602
- firstChild.style.display = "none";
15603
- resetDisplay = () => firstChild.style.display = originalDisplay;
15604
- }
15605
- parentNode.replaceChild(firstChild, currentHydrationNode);
15606
- setCurrentHydrationNode(firstChild);
15607
- }
15608
- }
15609
- const children = slots.default && slots.default();
15610
- if (!children) return [];
15611
- const instance = currentInstance;
15612
- const { mode } = props;
15613
- checkTransitionMode(mode);
15614
- let resolvedProps;
15615
- renderEffect(() => resolvedProps = resolveTransitionProps(props));
15616
- const hooks = applyTransitionHooks(children, {
15617
- state: useTransitionState(),
15618
- // use proxy to keep props reference stable
15619
- props: new Proxy({}, {
15620
- get(_, key) {
15621
- return resolvedProps[key];
15622
- }
15623
- }),
15624
- instance
15625
- });
15626
- if (resetDisplay && resolvedProps.appear) {
15627
- const child = findTransitionBlock(children);
15628
- hooks.beforeEnter(child);
15629
- resetDisplay();
15630
- queuePostFlushCb(() => hooks.enter(child));
15631
- }
15632
- return children;
15633
- });
15634
- const getTransitionHooksContext = (key, props, state, instance, postClone) => {
15635
- const { leavingNodes } = state;
15636
- const context = {
15637
- setLeavingNodeCache: (el) => {
15638
- leavingNodes.set(key, el);
15639
- },
15640
- unsetLeavingNodeCache: (el) => {
15641
- const leavingNode = leavingNodes.get(key);
15642
- if (leavingNode === el) {
15643
- leavingNodes.delete(key);
15644
- }
15645
- },
15646
- earlyRemove: () => {
15647
- const leavingNode = leavingNodes.get(key);
15648
- if (leavingNode && leavingNode[leaveCbKey]) {
15649
- leavingNode[leaveCbKey]();
15650
- }
15651
- },
15652
- cloneHooks: (block) => {
15653
- const hooks = resolveTransitionHooks(
15654
- block,
15655
- props,
15656
- state,
15657
- instance,
15658
- postClone
15659
- );
15660
- if (postClone) postClone(hooks);
15661
- return hooks;
15662
- }
15663
- };
15664
- return context;
15665
- };
15666
- function resolveTransitionHooks(block, props, state, instance, postClone) {
15667
- const context = getTransitionHooksContext(
15668
- String(block.$key),
15669
- props,
15670
- state,
15671
- instance,
15672
- postClone
15673
- );
15674
- const hooks = baseResolveTransitionHooks(
15675
- context,
15676
- props,
15677
- state,
15678
- instance
15679
- );
15680
- hooks.state = state;
15681
- hooks.props = props;
15682
- hooks.instance = instance;
15683
- return hooks;
15684
- }
15685
- function applyTransitionHooks(block, hooks) {
15686
- if (isArray(block)) {
15687
- block = block.filter((b) => !(b instanceof Comment));
15688
- if (block.length === 1) {
15689
- block = block[0];
15690
- } else if (block.length === 0) {
15691
- return hooks;
15692
- }
15693
- }
15694
- const fragments = [];
15695
- const child = findTransitionBlock(block, (frag) => fragments.push(frag));
15696
- if (!child) {
15697
- fragments.forEach((f) => f.$transition = hooks);
15698
- if (fragments.length === 0) {
15699
- warn("Transition component has no valid child element");
15700
- }
15701
- return hooks;
15702
- }
15703
- const { props, instance, state, delayedLeave } = hooks;
15704
- let resolvedHooks = resolveTransitionHooks(
15705
- child,
15706
- props,
15707
- state,
15708
- instance,
15709
- (hooks2) => resolvedHooks = hooks2
15710
- );
15711
- resolvedHooks.delayedLeave = delayedLeave;
15712
- child.$transition = resolvedHooks;
15713
- fragments.forEach((f) => f.$transition = resolvedHooks);
15714
- return resolvedHooks;
15715
- }
15716
- function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
15717
- const leavingBlock = findTransitionBlock(block);
15718
- if (!leavingBlock) return void 0;
15719
- const { props, state, instance } = enterHooks;
15720
- const leavingHooks = resolveTransitionHooks(
15721
- leavingBlock,
15722
- props,
15723
- state,
15724
- instance
15725
- );
15726
- leavingBlock.$transition = leavingHooks;
15727
- const { mode } = props;
15728
- if (mode === "out-in") {
15729
- state.isLeaving = true;
15730
- leavingHooks.afterLeave = () => {
15731
- state.isLeaving = false;
15732
- afterLeaveCb();
15733
- leavingBlock.$transition = void 0;
15734
- delete leavingHooks.afterLeave;
15735
- };
15736
- } else if (mode === "in-out") {
15737
- leavingHooks.delayLeave = (block2, earlyRemove, delayedLeave) => {
15738
- state.leavingNodes.set(String(leavingBlock.$key), leavingBlock);
15739
- block2[leaveCbKey] = () => {
15740
- earlyRemove();
15741
- block2[leaveCbKey] = void 0;
15742
- leavingBlock.$transition = void 0;
15743
- delete enterHooks.delayedLeave;
15744
- };
15745
- enterHooks.delayedLeave = () => {
15746
- delayedLeave();
15747
- leavingBlock.$transition = void 0;
15748
- delete enterHooks.delayedLeave;
15749
- };
15750
- };
15751
- }
15752
- }
15753
- function findTransitionBlock(block, onFragment) {
15754
- let child;
15755
- if (block instanceof Node) {
15756
- if (block instanceof Element) child = block;
15757
- } else if (isVaporComponent(block)) {
15758
- if (isAsyncWrapper(block) && !block.type.__asyncResolved) {
15759
- child = block;
15760
- } else {
15761
- if (getComponentName(block.type) === displayName) return void 0;
15762
- child = findTransitionBlock(block.block, onFragment);
15763
- if (child && child.$key === void 0) child.$key = block.uid;
15764
- }
15765
- } else if (isArray(block)) {
15766
- let hasFound = false;
15767
- for (const c of block) {
15768
- if (c instanceof Comment) continue;
15769
- const item = findTransitionBlock(c, onFragment);
15770
- if (hasFound) {
15771
- warn(
15772
- "<transition> can only be used on a single element or component. Use <transition-group> for lists."
15773
- );
15774
- break;
15775
- }
15776
- child = item;
15777
- hasFound = true;
15778
- }
15779
- } else if (isFragment(block)) {
15780
- if (block.insert) {
15781
- child = block;
15782
- } else {
15783
- if (onFragment) onFragment(block);
15784
- child = findTransitionBlock(block.nodes, onFragment);
15785
- }
15786
- }
15787
- return child;
15788
- }
15789
- function setTransitionHooksOnFragment(block, hooks) {
15790
- if (isFragment(block)) {
15791
- block.$transition = hooks;
15792
- if (block.nodes && isFragment(block.nodes)) {
15793
- setTransitionHooksOnFragment(block.nodes, hooks);
15794
- }
15795
- } else if (isArray(block)) {
15796
- for (let i = 0; i < block.length; i++) {
15797
- setTransitionHooksOnFragment(block[i], hooks);
15798
- }
15799
- }
15800
- }
15801
- function setTransitionHooks(block, hooks) {
15802
- if (isVaporComponent(block)) {
15803
- block = findTransitionBlock(block.block);
15804
- if (!block) return;
15805
- }
15806
- block.$transition = hooks;
15807
- }
15808
-
15809
15876
  class VaporFragment {
15810
15877
  constructor(nodes) {
15811
15878
  this.vnode = null;
@@ -15821,45 +15888,7 @@ class DynamicFragment extends VaporFragment {
15821
15888
  constructor(anchorLabel) {
15822
15889
  super([]);
15823
15890
  this.hydrate = (isEmpty = false) => {
15824
- if (this.anchor) return;
15825
- if (this.anchorLabel === "if") {
15826
- if (isEmpty) {
15827
- this.anchor = locateFragmentEndAnchor("");
15828
- if (!this.anchor) {
15829
- throw new Error(
15830
- "Failed to locate if anchor. this is likely a Vue internal bug."
15831
- );
15832
- } else {
15833
- {
15834
- this.anchor.data = this.anchorLabel;
15835
- }
15836
- return;
15837
- }
15838
- }
15839
- } else if (this.anchorLabel === "slot") {
15840
- if (isEmpty && isComment(currentHydrationNode, "")) {
15841
- this.anchor = currentHydrationNode;
15842
- {
15843
- this.anchor.data = this.anchorLabel;
15844
- }
15845
- return;
15846
- }
15847
- this.anchor = locateFragmentEndAnchor();
15848
- if (!this.anchor) {
15849
- throw new Error(
15850
- "Failed to locate slot anchor. this is likely a Vue internal bug."
15851
- );
15852
- } else {
15853
- return;
15854
- }
15855
- }
15856
- const { parentNode, nextNode } = findBlockNode(this.nodes);
15857
- queuePostFlushCb(() => {
15858
- parentNode.insertBefore(
15859
- this.anchor = createComment(this.anchorLabel) ,
15860
- nextNode
15861
- );
15862
- });
15891
+ hydrateDynamicFragment(this, isEmpty);
15863
15892
  };
15864
15893
  this.slotOwner = currentSlotOwner;
15865
15894
  if (isHydrating) {
@@ -16043,6 +16072,11 @@ const VaporTeleportImpl = {
16043
16072
  class TeleportFragment extends VaporFragment {
16044
16073
  constructor(props, slots) {
16045
16074
  super([]);
16075
+ /**
16076
+ * @internal marker for duck typing to avoid direct instanceof check
16077
+ * which prevents tree-shaking of TeleportFragment
16078
+ */
16079
+ this.__isTeleportFragment = true;
16046
16080
  this.insert = (container, anchor) => {
16047
16081
  if (isHydrating) return;
16048
16082
  this.placeholder = createComment("teleport start") ;
@@ -16256,7 +16290,10 @@ Server rendered element contains fewer child nodes than client nodes.`
16256
16290
  }
16257
16291
  }
16258
16292
  function isVaporTeleport(value) {
16259
- return value === VaporTeleportImpl;
16293
+ return !!(value && value.__isTeleport && value.__vapor);
16294
+ }
16295
+ function isTeleportFragment(value) {
16296
+ return !!(value && value.__isTeleportFragment);
16260
16297
  }
16261
16298
  function locateTeleportEndAnchor(node = currentHydrationNode) {
16262
16299
  while (node) {
@@ -16453,7 +16490,7 @@ function normalizeBlock(block) {
16453
16490
  } else if (isVaporComponent(block)) {
16454
16491
  nodes.push(...normalizeBlock(block.block));
16455
16492
  } else {
16456
- if (block instanceof TeleportFragment) {
16493
+ if (isTeleportFragment(block)) {
16457
16494
  nodes.push(block.placeholder, block.anchor);
16458
16495
  } else {
16459
16496
  nodes.push(...normalizeBlock(block.nodes));
@@ -16529,6 +16566,18 @@ function setComponentScopeId(instance) {
16529
16566
  setScopeId(instance.block, scopeIds);
16530
16567
  }
16531
16568
  }
16569
+ let _applyTransitionHooks;
16570
+ let _applyTransitionLeaveHooks;
16571
+ function registerTransitionHooks(applyHooks, applyLeaveHooks) {
16572
+ _applyTransitionHooks = applyHooks;
16573
+ _applyTransitionLeaveHooks = applyLeaveHooks;
16574
+ }
16575
+ function applyTransitionHooks(block, hooks) {
16576
+ return _applyTransitionHooks ? _applyTransitionHooks(block, hooks) : hooks;
16577
+ }
16578
+ function applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb) {
16579
+ _applyTransitionLeaveHooks && _applyTransitionLeaveHooks(block, enterHooks, afterLeaveCb);
16580
+ }
16532
16581
 
16533
16582
  function hmrRerender(instance) {
16534
16583
  const normalized = normalizeBlock(instance.block);
@@ -17010,7 +17059,7 @@ function getRootElement(block, onDynamicFragment, recurse = true) {
17010
17059
  if (recurse && isVaporComponent(block)) {
17011
17060
  return getRootElement(block.block, onDynamicFragment, recurse);
17012
17061
  }
17013
- if (isFragment(block) && !(block instanceof TeleportFragment)) {
17062
+ if (isFragment(block) && !isTeleportFragment(block)) {
17014
17063
  if (block instanceof DynamicFragment && onDynamicFragment) {
17015
17064
  onDynamicFragment(block);
17016
17065
  }
@@ -17088,7 +17137,7 @@ function handleSetupResult(setupResult, component, instance) {
17088
17137
  });
17089
17138
  } else if (!instance.accessedAttrs && isArray(instance.block) && instance.block.length || // preventing attrs fallthrough on Teleport
17090
17139
  // consistent with VDOM Teleport behavior
17091
- instance.block instanceof TeleportFragment) {
17140
+ isTeleportFragment(instance.block)) {
17092
17141
  warnExtraneousAttributes(instance.attrs);
17093
17142
  }
17094
17143
  }
@@ -17422,7 +17471,6 @@ class VaporElement extends VueElementBase {
17422
17471
  }
17423
17472
 
17424
17473
  let t;
17425
- /*! #__NO_SIDE_EFFECTS__ */
17426
17474
  // @__NO_SIDE_EFFECTS__
17427
17475
  function template(html, root, ns) {
17428
17476
  let node;
@@ -17459,7 +17507,7 @@ function createIf(condition, b1, b2, once) {
17459
17507
  if (!isHydrating) resetInsertionState();
17460
17508
  let frag;
17461
17509
  if (once) {
17462
- frag = condition() ? b1() : b2 ? b2() : [];
17510
+ frag = condition() ? b1() : b2 ? b2() : [createComment("if") ];
17463
17511
  } else {
17464
17512
  frag = isHydrating || true ? new DynamicFragment("if") : new DynamicFragment();
17465
17513
  renderEffect(() => frag.update(condition() ? b1 : b2));
@@ -18090,11 +18138,11 @@ function resolveParentNode(block) {
18090
18138
  if (block instanceof Node) {
18091
18139
  return block.parentNode;
18092
18140
  } else if (isArray(block)) {
18093
- return resolveParentNode(block[0]);
18141
+ return resolveParentNode(block[block.length - 1]);
18094
18142
  } else if (isVaporComponent(block)) {
18095
18143
  return resolveParentNode(block.block);
18096
18144
  } else {
18097
- return resolveParentNode(block.nodes);
18145
+ return resolveParentNode(block.anchor || block.nodes);
18098
18146
  }
18099
18147
  }
18100
18148
  function setVars(instance, vars) {
@@ -18317,13 +18365,14 @@ const decorate = (t) => {
18317
18365
  t.__vapor = true;
18318
18366
  return t;
18319
18367
  };
18320
- const VaporTransitionGroup = decorate({
18368
+ const VaporTransitionGroupImpl = {
18321
18369
  name: "VaporTransitionGroup",
18322
18370
  props: /* @__PURE__ */ extend({}, TransitionPropsValidators, {
18323
18371
  tag: String,
18324
18372
  moveClass: String
18325
18373
  }),
18326
18374
  setup(props, { slots }) {
18375
+ ensureTransitionHooksRegistered();
18327
18376
  const instance = currentInstance;
18328
18377
  const state = useTransitionState();
18329
18378
  let cssTransitionProps = resolveTransitionProps(props);
@@ -18415,7 +18464,8 @@ const VaporTransitionGroup = decorate({
18415
18464
  return slottedBlock;
18416
18465
  }
18417
18466
  }
18418
- });
18467
+ };
18468
+ const VaporTransitionGroup = /* @__PURE__ */ decorate(VaporTransitionGroupImpl);
18419
18469
  function getTransitionBlocks(block) {
18420
18470
  let children = [];
18421
18471
  if (block instanceof Node) {