vue 3.6.0-alpha.1 → 3.6.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,9 +1,8 @@
1
1
  /**
2
- * vue v3.6.0-alpha.1
2
+ * vue v3.6.0-alpha.3
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
6
- /*! #__NO_SIDE_EFFECTS__ */
7
6
  // @__NO_SIDE_EFFECTS__
8
7
  function makeMap(str) {
9
8
  const map = /* @__PURE__ */ Object.create(null);
@@ -59,10 +58,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
59
58
  );
60
59
  const cacheStringFunction = (fn) => {
61
60
  const cache = /* @__PURE__ */ Object.create(null);
62
- return (str) => {
61
+ return ((str) => {
63
62
  const hit = cache[str];
64
63
  return hit || (cache[str] = fn(str));
65
- };
64
+ });
66
65
  };
67
66
  const camelizeRE = /-(\w)/g;
68
67
  const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
@@ -308,6 +307,9 @@ function shouldSetAsAttr(tagName, key) {
308
307
  if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
309
308
  return true;
310
309
  }
310
+ if (key === "sandbox" && tagName === "IFRAME") {
311
+ return true;
312
+ }
311
313
  return false;
312
314
  }
313
315
 
@@ -497,6 +499,7 @@ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
497
499
  const notifyBuffer = [];
498
500
  let batchDepth = 0;
499
501
  let activeSub = void 0;
502
+ let globalVersion = 0;
500
503
  let notifyIndex = 0;
501
504
  let notifyBufferLength = 0;
502
505
  function setActiveSub(sub) {
@@ -519,20 +522,18 @@ function link(dep, sub) {
519
522
  if (prevDep !== void 0 && prevDep.dep === dep) {
520
523
  return;
521
524
  }
522
- let nextDep = void 0;
523
- const recursedCheck = sub.flags & 4 /* RecursedCheck */;
524
- if (recursedCheck) {
525
- nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
526
- if (nextDep !== void 0 && nextDep.dep === dep) {
527
- sub.depsTail = nextDep;
528
- return;
529
- }
525
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
526
+ if (nextDep !== void 0 && nextDep.dep === dep) {
527
+ nextDep.version = globalVersion;
528
+ sub.depsTail = nextDep;
529
+ return;
530
530
  }
531
531
  const prevSub = dep.subsTail;
532
- if (prevSub !== void 0 && prevSub.sub === sub && (!recursedCheck || isValidLink(prevSub, sub))) {
532
+ if (prevSub !== void 0 && prevSub.version === globalVersion && prevSub.sub === sub) {
533
533
  return;
534
534
  }
535
535
  const newLink = sub.depsTail = dep.subsTail = {
536
+ version: globalVersion,
536
537
  dep,
537
538
  sub,
538
539
  prevDep,
@@ -638,6 +639,7 @@ function propagate(link2) {
638
639
  } while (true);
639
640
  }
640
641
  function startTracking(sub) {
642
+ ++globalVersion;
641
643
  sub.depsTail = void 0;
642
644
  sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
643
645
  return setActiveSub(sub);
@@ -738,18 +740,12 @@ function shallowPropagate(link2) {
738
740
  } while (link2 !== void 0);
739
741
  }
740
742
  function isValidLink(checkLink, sub) {
741
- const depsTail = sub.depsTail;
742
- if (depsTail !== void 0) {
743
- let link2 = sub.deps;
744
- do {
745
- if (link2 === checkLink) {
746
- return true;
747
- }
748
- if (link2 === depsTail) {
749
- break;
750
- }
751
- link2 = link2.nextDep;
752
- } while (link2 !== void 0);
743
+ let link2 = sub.depsTail;
744
+ while (link2 !== void 0) {
745
+ if (link2 === checkLink) {
746
+ return true;
747
+ }
748
+ link2 = link2.prevDep;
753
749
  }
754
750
  return false;
755
751
  }
@@ -989,7 +985,7 @@ const arrayInstrumentations = {
989
985
  join(separator) {
990
986
  return reactiveReadArray(this).join(separator);
991
987
  },
992
- // keys() iterator only reads `length`, no optimisation required
988
+ // keys() iterator only reads `length`, no optimization required
993
989
  lastIndexOf(...args) {
994
990
  return searchProxy(this, "lastIndexOf", args);
995
991
  },
@@ -1041,7 +1037,7 @@ function iterator(self, method, wrapValue) {
1041
1037
  iter._next = iter.next;
1042
1038
  iter.next = () => {
1043
1039
  const result = iter._next();
1044
- if (result.value) {
1040
+ if (!result.done) {
1045
1041
  result.value = wrapValue(result.value);
1046
1042
  }
1047
1043
  return result;
@@ -1172,7 +1168,8 @@ class BaseReactiveHandler {
1172
1168
  return res;
1173
1169
  }
1174
1170
  if (isRef(res)) {
1175
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1171
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1172
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1176
1173
  }
1177
1174
  if (isObject(res)) {
1178
1175
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -1194,7 +1191,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1194
1191
  }
1195
1192
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1196
1193
  if (isOldValueReadonly) {
1197
- return false;
1194
+ {
1195
+ warn$2(
1196
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1197
+ target[key]
1198
+ );
1199
+ }
1200
+ return true;
1198
1201
  } else {
1199
1202
  oldValue.value = value;
1200
1203
  return true;
@@ -1339,7 +1342,7 @@ function createInstrumentations(readonly, shallow) {
1339
1342
  get size() {
1340
1343
  const target = this["__v_raw"];
1341
1344
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1342
- return Reflect.get(target, "size", target);
1345
+ return target.size;
1343
1346
  },
1344
1347
  has(key) {
1345
1348
  const target = this["__v_raw"];
@@ -2005,14 +2008,12 @@ class EffectScope {
2005
2008
  }
2006
2009
  }
2007
2010
  run(fn) {
2008
- const prevSub = setActiveSub();
2009
2011
  const prevScope = activeEffectScope;
2010
2012
  try {
2011
2013
  activeEffectScope = this;
2012
2014
  return fn();
2013
2015
  } finally {
2014
2016
  activeEffectScope = prevScope;
2015
- setActiveSub(prevSub);
2016
2017
  }
2017
2018
  }
2018
2019
  stop() {
@@ -2344,11 +2345,11 @@ function traverse(value, depth = Infinity, seen) {
2344
2345
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2345
2346
  return value;
2346
2347
  }
2347
- seen = seen || /* @__PURE__ */ new Set();
2348
- if (seen.has(value)) {
2348
+ seen = seen || /* @__PURE__ */ new Map();
2349
+ if ((seen.get(value) || 0) >= depth) {
2349
2350
  return value;
2350
2351
  }
2351
- seen.add(value);
2352
+ seen.set(value, depth);
2352
2353
  depth--;
2353
2354
  if (isRef(value)) {
2354
2355
  traverse(value.value, depth, seen);
@@ -2894,8 +2895,10 @@ function rerender(id, newRender) {
2894
2895
  instance.hmrRerender();
2895
2896
  } else {
2896
2897
  const i = instance;
2897
- i.renderCache = [];
2898
- i.effect.run();
2898
+ if (!(i.effect.flags & 1024)) {
2899
+ i.renderCache = [];
2900
+ i.effect.run();
2901
+ }
2899
2902
  }
2900
2903
  nextTick(() => {
2901
2904
  isHmrUpdating = false;
@@ -2908,7 +2911,7 @@ function reload(id, newComp) {
2908
2911
  newComp = normalizeClassComponent(newComp);
2909
2912
  updateComponentDef(record.initialDef, newComp);
2910
2913
  const instances = [...record.instances];
2911
- if (newComp.vapor) {
2914
+ if (newComp.__vapor) {
2912
2915
  for (const instance of instances) {
2913
2916
  instance.hmrReload(newComp);
2914
2917
  }
@@ -2937,7 +2940,10 @@ function reload(id, newComp) {
2937
2940
  if (parent.vapor) {
2938
2941
  parent.hmrRerender();
2939
2942
  } else {
2940
- parent.effect.run();
2943
+ if (!(parent.effect.flags & 1024)) {
2944
+ parent.renderCache = [];
2945
+ parent.effect.run();
2946
+ }
2941
2947
  }
2942
2948
  nextTick(() => {
2943
2949
  isHmrUpdating = false;
@@ -3047,7 +3053,6 @@ const devtoolsComponentRemoved = (component) => {
3047
3053
  _devtoolsComponentRemoved(component);
3048
3054
  }
3049
3055
  };
3050
- /*! #__NO_SIDE_EFFECTS__ */
3051
3056
  // @__NO_SIDE_EFFECTS__
3052
3057
  function createDevtoolsComponentHook(hook) {
3053
3058
  return (component) => {
@@ -3233,9 +3238,6 @@ const TeleportImpl = {
3233
3238
  insert(mainAnchor, container, anchor);
3234
3239
  const mount = (container2, anchor2) => {
3235
3240
  if (shapeFlag & 16) {
3236
- if (parentComponent && parentComponent.isCE) {
3237
- parentComponent.ce._teleportTarget = container2;
3238
- }
3239
3241
  mountChildren(
3240
3242
  children,
3241
3243
  container2,
@@ -3257,6 +3259,9 @@ const TeleportImpl = {
3257
3259
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3258
3260
  namespace = "mathml";
3259
3261
  }
3262
+ if (parentComponent && parentComponent.isCE) {
3263
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3264
+ }
3260
3265
  if (!disabled) {
3261
3266
  mount(target, targetAnchor);
3262
3267
  updateCssVars(n2, false);
@@ -3457,26 +3462,34 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3457
3462
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3458
3463
  o: { nextSibling, parentNode, querySelector, insert, createText }
3459
3464
  }, hydrateChildren) {
3465
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
3466
+ vnode2.anchor = hydrateChildren(
3467
+ nextSibling(node2),
3468
+ vnode2,
3469
+ parentNode(node2),
3470
+ parentComponent,
3471
+ parentSuspense,
3472
+ slotScopeIds,
3473
+ optimized
3474
+ );
3475
+ vnode2.targetStart = targetStart;
3476
+ vnode2.targetAnchor = targetAnchor;
3477
+ }
3460
3478
  const target = vnode.target = resolveTarget(
3461
3479
  vnode.props,
3462
3480
  querySelector
3463
3481
  );
3482
+ const disabled = isTeleportDisabled(vnode.props);
3464
3483
  if (target) {
3465
- const disabled = isTeleportDisabled(vnode.props);
3466
3484
  const targetNode = target._lpa || target.firstChild;
3467
3485
  if (vnode.shapeFlag & 16) {
3468
3486
  if (disabled) {
3469
- vnode.anchor = hydrateChildren(
3470
- nextSibling(node),
3487
+ hydrateDisabledTeleport(
3488
+ node,
3471
3489
  vnode,
3472
- parentNode(node),
3473
- parentComponent,
3474
- parentSuspense,
3475
- slotScopeIds,
3476
- optimized
3490
+ targetNode,
3491
+ targetNode && nextSibling(targetNode)
3477
3492
  );
3478
- vnode.targetStart = targetNode;
3479
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
3480
3493
  } else {
3481
3494
  vnode.anchor = nextSibling(node);
3482
3495
  let targetAnchor = targetNode;
@@ -3507,6 +3520,10 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
3507
3520
  }
3508
3521
  }
3509
3522
  updateCssVars(vnode, disabled);
3523
+ } else if (disabled) {
3524
+ if (vnode.shapeFlag & 16) {
3525
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
3526
+ }
3510
3527
  }
3511
3528
  return vnode.anchor && nextSibling(vnode.anchor);
3512
3529
  }
@@ -3547,7 +3564,7 @@ function useTransitionState() {
3547
3564
  isMounted: false,
3548
3565
  isLeaving: false,
3549
3566
  isUnmounting: false,
3550
- leavingVNodes: /* @__PURE__ */ new Map()
3567
+ leavingNodes: /* @__PURE__ */ new Map()
3551
3568
  };
3552
3569
  onMounted(() => {
3553
3570
  state.isMounted = true;
@@ -3579,7 +3596,7 @@ const BaseTransitionPropsValidators = {
3579
3596
  onAppearCancelled: TransitionHookValidator
3580
3597
  };
3581
3598
  const recursiveGetSubtree = (instance) => {
3582
- const subTree = instance.subTree;
3599
+ const subTree = instance.type.__vapor ? instance.block : instance.subTree;
3583
3600
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
3584
3601
  };
3585
3602
  const BaseTransitionImpl = {
@@ -3596,9 +3613,7 @@ const BaseTransitionImpl = {
3596
3613
  const child = findNonCommentChild(children);
3597
3614
  const rawProps = toRaw(props);
3598
3615
  const { mode } = rawProps;
3599
- if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
3600
- warn$1(`invalid <transition> mode: ${mode}`);
3601
- }
3616
+ checkTransitionMode(mode);
3602
3617
  if (state.isLeaving) {
3603
3618
  return emptyPlaceholder(child);
3604
3619
  }
@@ -3618,7 +3633,7 @@ const BaseTransitionImpl = {
3618
3633
  setTransitionHooks(innerChild, enterHooks);
3619
3634
  }
3620
3635
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3621
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
3636
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
3622
3637
  let leavingHooks = resolveTransitionHooks(
3623
3638
  oldInnerChild,
3624
3639
  rawProps,
@@ -3687,15 +3702,53 @@ function findNonCommentChild(children) {
3687
3702
  }
3688
3703
  const BaseTransition = BaseTransitionImpl;
3689
3704
  function getLeavingNodesForType(state, vnode) {
3690
- const { leavingVNodes } = state;
3691
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
3705
+ const { leavingNodes } = state;
3706
+ let leavingVNodesCache = leavingNodes.get(vnode.type);
3692
3707
  if (!leavingVNodesCache) {
3693
3708
  leavingVNodesCache = /* @__PURE__ */ Object.create(null);
3694
- leavingVNodes.set(vnode.type, leavingVNodesCache);
3709
+ leavingNodes.set(vnode.type, leavingVNodesCache);
3695
3710
  }
3696
3711
  return leavingVNodesCache;
3697
3712
  }
3698
3713
  function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3714
+ const key = String(vnode.key);
3715
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3716
+ const context = {
3717
+ setLeavingNodeCache: () => {
3718
+ leavingVNodesCache[key] = vnode;
3719
+ },
3720
+ unsetLeavingNodeCache: () => {
3721
+ if (leavingVNodesCache[key] === vnode) {
3722
+ delete leavingVNodesCache[key];
3723
+ }
3724
+ },
3725
+ earlyRemove: () => {
3726
+ const leavingVNode = leavingVNodesCache[key];
3727
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
3728
+ leavingVNode.el[leaveCbKey]();
3729
+ }
3730
+ },
3731
+ cloneHooks: (vnode2) => {
3732
+ const hooks = resolveTransitionHooks(
3733
+ vnode2,
3734
+ props,
3735
+ state,
3736
+ instance,
3737
+ postClone
3738
+ );
3739
+ if (postClone) postClone(hooks);
3740
+ return hooks;
3741
+ }
3742
+ };
3743
+ return baseResolveTransitionHooks(context, props, state, instance);
3744
+ }
3745
+ function baseResolveTransitionHooks(context, props, state, instance) {
3746
+ const {
3747
+ setLeavingNodeCache,
3748
+ unsetLeavingNodeCache,
3749
+ earlyRemove,
3750
+ cloneHooks
3751
+ } = context;
3699
3752
  const {
3700
3753
  appear,
3701
3754
  mode,
@@ -3713,8 +3766,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3713
3766
  onAfterAppear,
3714
3767
  onAppearCancelled
3715
3768
  } = props;
3716
- const key = String(vnode.key);
3717
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
3718
3769
  const callHook = (hook, args) => {
3719
3770
  hook && callWithAsyncErrorHandling(
3720
3771
  hook,
@@ -3750,10 +3801,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3750
3801
  /* cancelled */
3751
3802
  );
3752
3803
  }
3753
- const leavingVNode = leavingVNodesCache[key];
3754
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
3755
- leavingVNode.el[leaveCbKey]();
3756
- }
3804
+ earlyRemove();
3757
3805
  callHook(hook, [el]);
3758
3806
  },
3759
3807
  enter(el) {
@@ -3790,7 +3838,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3790
3838
  }
3791
3839
  },
3792
3840
  leave(el, remove) {
3793
- const key2 = String(vnode.key);
3794
3841
  if (el[enterCbKey$1]) {
3795
3842
  el[enterCbKey$1](
3796
3843
  true
@@ -3812,27 +3859,17 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
3812
3859
  callHook(onAfterLeave, [el]);
3813
3860
  }
3814
3861
  el[leaveCbKey] = void 0;
3815
- if (leavingVNodesCache[key2] === vnode) {
3816
- delete leavingVNodesCache[key2];
3817
- }
3862
+ unsetLeavingNodeCache(el);
3818
3863
  };
3819
- leavingVNodesCache[key2] = vnode;
3864
+ setLeavingNodeCache(el);
3820
3865
  if (onLeave) {
3821
3866
  callAsyncHook(onLeave, [el, done]);
3822
3867
  } else {
3823
3868
  done();
3824
3869
  }
3825
3870
  },
3826
- clone(vnode2) {
3827
- const hooks2 = resolveTransitionHooks(
3828
- vnode2,
3829
- props,
3830
- state,
3831
- instance,
3832
- postClone
3833
- );
3834
- if (postClone) postClone(hooks2);
3835
- return hooks2;
3871
+ clone(node) {
3872
+ return cloneHooks(node);
3836
3873
  }
3837
3874
  };
3838
3875
  return hooks;
@@ -3866,8 +3903,15 @@ function getInnerChild$1(vnode) {
3866
3903
  }
3867
3904
  function setTransitionHooks(vnode, hooks) {
3868
3905
  if (vnode.shapeFlag & 6 && vnode.component) {
3869
- vnode.transition = hooks;
3870
- setTransitionHooks(vnode.component.subTree, hooks);
3906
+ if (vnode.type.__vapor) {
3907
+ getVaporInterface(vnode.component, vnode).setTransitionHooks(
3908
+ vnode.component,
3909
+ hooks
3910
+ );
3911
+ } else {
3912
+ vnode.transition = hooks;
3913
+ setTransitionHooks(vnode.component.subTree, hooks);
3914
+ }
3871
3915
  } else if (vnode.shapeFlag & 128) {
3872
3916
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
3873
3917
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -3897,8 +3941,12 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
3897
3941
  }
3898
3942
  return ret;
3899
3943
  }
3944
+ function checkTransitionMode(mode) {
3945
+ if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
3946
+ warn$1(`invalid <transition> mode: ${mode}`);
3947
+ }
3948
+ }
3900
3949
 
3901
- /*! #__NO_SIDE_EFFECTS__ */
3902
3950
  // @__NO_SIDE_EFFECTS__
3903
3951
  function defineComponent(options, extraOptions) {
3904
3952
  return isFunction(options) ? (
@@ -3951,6 +3999,7 @@ function useTemplateRef(key) {
3951
3999
  return ret;
3952
4000
  }
3953
4001
 
4002
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
3954
4003
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3955
4004
  if (isArray(rawRef)) {
3956
4005
  rawRef.forEach(
@@ -3982,28 +4031,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3982
4031
  const oldRef = oldRawRef && oldRawRef.r;
3983
4032
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3984
4033
  const setupState = owner.setupState;
3985
- const rawSetupState = toRaw(setupState);
3986
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3987
- {
3988
- if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
3989
- warn$1(
3990
- `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
3991
- );
3992
- }
3993
- if (knownTemplateRefs.has(rawSetupState[key])) {
3994
- return false;
3995
- }
3996
- }
3997
- return hasOwn(rawSetupState, key);
4034
+ const canSetSetupRef = createCanSetSetupRefChecker(setupState);
4035
+ const canSetRef = (ref2) => {
4036
+ return !knownTemplateRefs.has(ref2);
3998
4037
  };
3999
4038
  if (oldRef != null && oldRef !== ref) {
4039
+ invalidatePendingSetRef(oldRawRef);
4000
4040
  if (isString(oldRef)) {
4001
4041
  refs[oldRef] = null;
4002
4042
  if (canSetSetupRef(oldRef)) {
4003
4043
  setupState[oldRef] = null;
4004
4044
  }
4005
4045
  } else if (isRef(oldRef)) {
4006
- oldRef.value = null;
4046
+ if (canSetRef(oldRef)) {
4047
+ oldRef.value = null;
4048
+ }
4049
+ const oldRawRefAtom = oldRawRef;
4050
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4007
4051
  }
4008
4052
  }
4009
4053
  if (isFunction(ref)) {
@@ -4014,7 +4058,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4014
4058
  if (_isString || _isRef) {
4015
4059
  const doSet = () => {
4016
4060
  if (rawRef.f) {
4017
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4061
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4018
4062
  if (isUnmount) {
4019
4063
  isArray(existing) && remove(existing, refValue);
4020
4064
  } else {
@@ -4025,8 +4069,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4025
4069
  setupState[ref] = refs[ref];
4026
4070
  }
4027
4071
  } else {
4028
- ref.value = [refValue];
4029
- if (rawRef.k) refs[rawRef.k] = ref.value;
4072
+ const newVal = [refValue];
4073
+ if (canSetRef(ref)) {
4074
+ ref.value = newVal;
4075
+ }
4076
+ if (rawRef.k) refs[rawRef.k] = newVal;
4030
4077
  }
4031
4078
  } else if (!existing.includes(refValue)) {
4032
4079
  existing.push(refValue);
@@ -4038,15 +4085,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4038
4085
  setupState[ref] = value;
4039
4086
  }
4040
4087
  } else if (_isRef) {
4041
- ref.value = value;
4088
+ if (canSetRef(ref)) {
4089
+ ref.value = value;
4090
+ }
4042
4091
  if (rawRef.k) refs[rawRef.k] = value;
4043
4092
  } else {
4044
4093
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
4045
4094
  }
4046
4095
  };
4047
4096
  if (value) {
4048
- queuePostRenderEffect(doSet, -1, parentSuspense);
4097
+ const job = () => {
4098
+ doSet();
4099
+ pendingSetRefMap.delete(rawRef);
4100
+ };
4101
+ pendingSetRefMap.set(rawRef, job);
4102
+ queuePostRenderEffect(job, -1, parentSuspense);
4049
4103
  } else {
4104
+ invalidatePendingSetRef(rawRef);
4050
4105
  doSet();
4051
4106
  }
4052
4107
  } else {
@@ -4054,6 +4109,29 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4054
4109
  }
4055
4110
  }
4056
4111
  }
4112
+ function createCanSetSetupRefChecker(setupState) {
4113
+ const rawSetupState = toRaw(setupState);
4114
+ return setupState === void 0 || setupState === EMPTY_OBJ ? NO : (key) => {
4115
+ {
4116
+ if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4117
+ warn$1(
4118
+ `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
4119
+ );
4120
+ }
4121
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4122
+ return false;
4123
+ }
4124
+ }
4125
+ return hasOwn(rawSetupState, key);
4126
+ };
4127
+ }
4128
+ function invalidatePendingSetRef(rawRef) {
4129
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
4130
+ if (pendingSetRef) {
4131
+ pendingSetRef.flags |= 4;
4132
+ pendingSetRefMap.delete(rawRef);
4133
+ }
4134
+ }
4057
4135
 
4058
4136
  let hasLoggedMismatchError = false;
4059
4137
  const logMismatchError = () => {
@@ -4150,7 +4228,7 @@ function createHydrationFunctions(rendererInternals) {
4150
4228
  }
4151
4229
  break;
4152
4230
  case Comment:
4153
- if (isTemplateNode(node)) {
4231
+ if (isTemplateNode$1(node)) {
4154
4232
  nextNode = nextSibling(node);
4155
4233
  replaceNode(
4156
4234
  vnode.el = node.content.firstChild,
@@ -4198,9 +4276,15 @@ function createHydrationFunctions(rendererInternals) {
4198
4276
  );
4199
4277
  }
4200
4278
  break;
4279
+ case VaporSlot:
4280
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(
4281
+ vnode,
4282
+ node
4283
+ );
4284
+ break;
4201
4285
  default:
4202
4286
  if (shapeFlag & 1) {
4203
- if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
4287
+ if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode$1(node)) {
4204
4288
  nextNode = onMismatch();
4205
4289
  } else {
4206
4290
  nextNode = hydrateElement(
@@ -4213,9 +4297,6 @@ function createHydrationFunctions(rendererInternals) {
4213
4297
  );
4214
4298
  }
4215
4299
  } else if (shapeFlag & 6) {
4216
- if (vnode.type.__vapor) {
4217
- throw new Error("Vapor component hydration is not supported yet.");
4218
- }
4219
4300
  vnode.slotScopeIds = slotScopeIds;
4220
4301
  const container = parentNode(node);
4221
4302
  if (isFragmentStart) {
@@ -4225,15 +4306,25 @@ function createHydrationFunctions(rendererInternals) {
4225
4306
  } else {
4226
4307
  nextNode = nextSibling(node);
4227
4308
  }
4228
- mountComponent(
4229
- vnode,
4230
- container,
4231
- null,
4232
- parentComponent,
4233
- parentSuspense,
4234
- getContainerType(container),
4235
- optimized
4236
- );
4309
+ if (vnode.type.__vapor) {
4310
+ getVaporInterface(parentComponent, vnode).hydrate(
4311
+ vnode,
4312
+ node,
4313
+ container,
4314
+ null,
4315
+ parentComponent
4316
+ );
4317
+ } else {
4318
+ mountComponent(
4319
+ vnode,
4320
+ container,
4321
+ null,
4322
+ parentComponent,
4323
+ parentSuspense,
4324
+ getContainerType(container),
4325
+ optimized
4326
+ );
4327
+ }
4237
4328
  if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4238
4329
  let subTree;
4239
4330
  if (isFragmentStart) {
@@ -4290,7 +4381,7 @@ function createHydrationFunctions(rendererInternals) {
4290
4381
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4291
4382
  }
4292
4383
  let needCallTransitionHooks = false;
4293
- if (isTemplateNode(el)) {
4384
+ if (isTemplateNode$1(el)) {
4294
4385
  needCallTransitionHooks = needTransition(
4295
4386
  null,
4296
4387
  // no need check parentSuspense in hydration
@@ -4318,7 +4409,7 @@ function createHydrationFunctions(rendererInternals) {
4318
4409
  );
4319
4410
  let hasWarned = false;
4320
4411
  while (next) {
4321
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4412
+ if (!isMismatchAllowed(el, 1)) {
4322
4413
  if (!hasWarned) {
4323
4414
  warn$1(
4324
4415
  `Hydration children mismatch on`,
@@ -4339,14 +4430,16 @@ Server rendered element contains more child nodes than client vdom.`
4339
4430
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4340
4431
  clientText = clientText.slice(1);
4341
4432
  }
4342
- if (el.textContent !== clientText) {
4343
- if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4433
+ const { textContent } = el;
4434
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4435
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4436
+ if (!isMismatchAllowed(el, 0)) {
4344
4437
  warn$1(
4345
4438
  `Hydration text content mismatch on`,
4346
4439
  el,
4347
4440
  `
4348
- - rendered on server: ${el.textContent}
4349
- - expected on client: ${vnode.children}`
4441
+ - rendered on server: ${textContent}
4442
+ - expected on client: ${clientText}`
4350
4443
  );
4351
4444
  logMismatchError();
4352
4445
  }
@@ -4422,7 +4515,7 @@ Server rendered element contains more child nodes than client vdom.`
4422
4515
  } else if (isText && !vnode.children) {
4423
4516
  insert(vnode.el = createText(""), container);
4424
4517
  } else {
4425
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
4518
+ if (!isMismatchAllowed(container, 1)) {
4426
4519
  if (!hasWarned) {
4427
4520
  warn$1(
4428
4521
  `Hydration children mismatch on`,
@@ -4472,7 +4565,7 @@ Server rendered element contains fewer child nodes than client vdom.`
4472
4565
  }
4473
4566
  };
4474
4567
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
4475
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
4568
+ if (!isMismatchAllowed(node.parentElement, 1)) {
4476
4569
  warn$1(
4477
4570
  `Hydration node mismatch:
4478
4571
  - rendered on server:`,
@@ -4545,11 +4638,11 @@ Server rendered element contains fewer child nodes than client vdom.`
4545
4638
  parent = parent.parent;
4546
4639
  }
4547
4640
  };
4548
- const isTemplateNode = (node) => {
4549
- return node.nodeType === 1 && node.tagName === "TEMPLATE";
4550
- };
4551
4641
  return [hydrate, hydrateNode];
4552
4642
  }
4643
+ const isTemplateNode$1 = (node) => {
4644
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
4645
+ };
4553
4646
  function propHasMismatch(el, key, clientValue, vnode, instance) {
4554
4647
  let mismatchType;
4555
4648
  let mismatchKey;
@@ -4564,7 +4657,7 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4564
4657
  }
4565
4658
  expected = normalizeClass(clientValue);
4566
4659
  if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
4567
- mismatchType = 2 /* CLASS */;
4660
+ mismatchType = 2;
4568
4661
  mismatchKey = `class`;
4569
4662
  }
4570
4663
  } else if (key === "style") {
@@ -4583,31 +4676,43 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
4583
4676
  resolveCssVars(instance, vnode, expectedMap);
4584
4677
  }
4585
4678
  if (!isMapEqual(actualMap, expectedMap)) {
4586
- mismatchType = 3 /* STYLE */;
4679
+ mismatchType = 3;
4587
4680
  mismatchKey = "style";
4588
4681
  }
4589
- } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
4590
- if (isBooleanAttr(key)) {
4591
- actual = el.hasAttribute(key);
4592
- expected = includeBooleanAttr(clientValue);
4593
- } else if (clientValue == null) {
4594
- actual = el.hasAttribute(key);
4595
- expected = false;
4596
- } else {
4597
- if (el.hasAttribute(key)) {
4598
- actual = el.getAttribute(key);
4599
- } else if (key === "value" && el.tagName === "TEXTAREA") {
4600
- actual = el.value;
4601
- } else {
4602
- actual = false;
4603
- }
4604
- expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
4605
- }
4682
+ } else if (isValidHtmlOrSvgAttribute(el, key)) {
4683
+ ({ actual, expected } = getAttributeMismatch(el, key, clientValue));
4606
4684
  if (actual !== expected) {
4607
- mismatchType = 4 /* ATTRIBUTE */;
4685
+ mismatchType = 4;
4608
4686
  mismatchKey = key;
4609
4687
  }
4610
4688
  }
4689
+ return warnPropMismatch(el, mismatchKey, mismatchType, actual, expected);
4690
+ }
4691
+ function getAttributeMismatch(el, key, clientValue) {
4692
+ let actual;
4693
+ let expected;
4694
+ if (isBooleanAttr(key)) {
4695
+ actual = el.hasAttribute(key);
4696
+ expected = includeBooleanAttr(clientValue);
4697
+ } else if (clientValue == null) {
4698
+ actual = el.hasAttribute(key);
4699
+ expected = false;
4700
+ } else {
4701
+ if (el.hasAttribute(key)) {
4702
+ actual = el.getAttribute(key);
4703
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
4704
+ actual = el.value;
4705
+ } else {
4706
+ actual = false;
4707
+ }
4708
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
4709
+ }
4710
+ return { actual, expected };
4711
+ }
4712
+ function isValidHtmlOrSvgAttribute(el, key) {
4713
+ return el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key));
4714
+ }
4715
+ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
4611
4716
  if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
4612
4717
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
4613
4718
  const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
@@ -4679,14 +4784,14 @@ function resolveCssVars(instance, vnode, expectedMap) {
4679
4784
  }
4680
4785
  const allowMismatchAttr = "data-allow-mismatch";
4681
4786
  const MismatchTypeString = {
4682
- [0 /* TEXT */]: "text",
4683
- [1 /* CHILDREN */]: "children",
4684
- [2 /* CLASS */]: "class",
4685
- [3 /* STYLE */]: "style",
4686
- [4 /* ATTRIBUTE */]: "attribute"
4787
+ [0]: "text",
4788
+ [1]: "children",
4789
+ [2]: "class",
4790
+ [3]: "style",
4791
+ [4]: "attribute"
4687
4792
  };
4688
4793
  function isMismatchAllowed(el, allowedType) {
4689
- if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
4794
+ if (allowedType === 0 || allowedType === 1) {
4690
4795
  while (el && !el.hasAttribute(allowMismatchAttr)) {
4691
4796
  el = el.parentElement;
4692
4797
  }
@@ -4698,7 +4803,7 @@ function isMismatchAllowed(el, allowedType) {
4698
4803
  return true;
4699
4804
  } else {
4700
4805
  const list = allowedAttr.split(",");
4701
- if (allowedType === 0 /* TEXT */ && list.includes("children")) {
4806
+ if (allowedType === 0 && list.includes("children")) {
4702
4807
  return true;
4703
4808
  }
4704
4809
  return list.includes(MismatchTypeString[allowedType]);
@@ -4755,7 +4860,9 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
4755
4860
  hasHydrated = true;
4756
4861
  teardown();
4757
4862
  hydrate();
4758
- e.target.dispatchEvent(new e.constructor(e.type, e));
4863
+ if (!(`$evt${e.type}` in e.target)) {
4864
+ e.target.dispatchEvent(new e.constructor(e.type, e));
4865
+ }
4759
4866
  }
4760
4867
  };
4761
4868
  const teardown = () => {
@@ -4797,104 +4904,46 @@ function forEachElement(node, cb) {
4797
4904
  }
4798
4905
 
4799
4906
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
4800
- /*! #__NO_SIDE_EFFECTS__ */
4801
4907
  // @__NO_SIDE_EFFECTS__
4802
4908
  function defineAsyncComponent(source) {
4803
- if (isFunction(source)) {
4804
- source = { loader: source };
4805
- }
4806
4909
  const {
4807
- loader,
4808
- loadingComponent,
4809
- errorComponent,
4810
- delay = 200,
4811
- hydrate: hydrateStrategy,
4812
- timeout,
4813
- // undefined = never times out
4814
- suspensible = true,
4815
- onError: userOnError
4816
- } = source;
4817
- let pendingRequest = null;
4818
- let resolvedComp;
4819
- let retries = 0;
4820
- const retry = () => {
4821
- retries++;
4822
- pendingRequest = null;
4823
- return load();
4824
- };
4825
- const load = () => {
4826
- let thisRequest;
4827
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
4828
- err = err instanceof Error ? err : new Error(String(err));
4829
- if (userOnError) {
4830
- return new Promise((resolve, reject) => {
4831
- const userRetry = () => resolve(retry());
4832
- const userFail = () => reject(err);
4833
- userOnError(err, userRetry, userFail, retries + 1);
4834
- });
4835
- } else {
4836
- throw err;
4837
- }
4838
- }).then((comp) => {
4839
- if (thisRequest !== pendingRequest && pendingRequest) {
4840
- return pendingRequest;
4841
- }
4842
- if (!comp) {
4843
- warn$1(
4844
- `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
4845
- );
4846
- }
4847
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
4848
- comp = comp.default;
4849
- }
4850
- if (comp && !isObject(comp) && !isFunction(comp)) {
4851
- throw new Error(`Invalid async component load result: ${comp}`);
4852
- }
4853
- resolvedComp = comp;
4854
- return comp;
4855
- }));
4856
- };
4910
+ load,
4911
+ getResolvedComp,
4912
+ setPendingRequest,
4913
+ source: {
4914
+ loadingComponent,
4915
+ errorComponent,
4916
+ delay,
4917
+ hydrate: hydrateStrategy,
4918
+ timeout,
4919
+ suspensible = true
4920
+ }
4921
+ } = createAsyncComponentContext(source);
4857
4922
  return defineComponent({
4858
4923
  name: "AsyncComponentWrapper",
4859
4924
  __asyncLoader: load,
4860
4925
  __asyncHydrate(el, instance, hydrate) {
4861
- let patched = false;
4862
- const doHydrate = hydrateStrategy ? () => {
4863
- const performHydrate = () => {
4864
- if (patched) {
4865
- warn$1(
4866
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
4867
- );
4868
- return;
4869
- }
4870
- hydrate();
4871
- };
4872
- const teardown = hydrateStrategy(
4873
- performHydrate,
4874
- (cb) => forEachElement(el, cb)
4875
- );
4876
- if (teardown) {
4877
- (instance.bum || (instance.bum = [])).push(teardown);
4878
- }
4879
- (instance.u || (instance.u = [])).push(() => patched = true);
4880
- } : hydrate;
4881
- if (resolvedComp) {
4882
- doHydrate();
4883
- } else {
4884
- load().then(() => !instance.isUnmounted && doHydrate());
4885
- }
4926
+ performAsyncHydrate(
4927
+ el,
4928
+ instance,
4929
+ hydrate,
4930
+ getResolvedComp,
4931
+ load,
4932
+ hydrateStrategy
4933
+ );
4886
4934
  },
4887
4935
  get __asyncResolved() {
4888
- return resolvedComp;
4936
+ return getResolvedComp();
4889
4937
  },
4890
4938
  setup() {
4891
4939
  const instance = currentInstance;
4892
4940
  markAsyncBoundary(instance);
4941
+ let resolvedComp = getResolvedComp();
4893
4942
  if (resolvedComp) {
4894
4943
  return () => createInnerComp(resolvedComp, instance);
4895
4944
  }
4896
4945
  const onError = (err) => {
4897
- pendingRequest = null;
4946
+ setPendingRequest(null);
4898
4947
  handleError(
4899
4948
  err,
4900
4949
  instance,
@@ -4912,25 +4961,11 @@ function defineAsyncComponent(source) {
4912
4961
  }) : null;
4913
4962
  });
4914
4963
  }
4915
- const loaded = ref(false);
4916
- const error = ref();
4917
- const delayed = ref(!!delay);
4918
- if (delay) {
4919
- setTimeout(() => {
4920
- delayed.value = false;
4921
- }, delay);
4922
- }
4923
- if (timeout != null) {
4924
- setTimeout(() => {
4925
- if (!loaded.value && !error.value) {
4926
- const err = new Error(
4927
- `Async component timed out after ${timeout}ms.`
4928
- );
4929
- onError(err);
4930
- error.value = err;
4931
- }
4932
- }, timeout);
4933
- }
4964
+ const { loaded, error, delayed } = useAsyncComponentState(
4965
+ delay,
4966
+ timeout,
4967
+ onError
4968
+ );
4934
4969
  load().then(() => {
4935
4970
  loaded.value = true;
4936
4971
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
@@ -4941,6 +4976,7 @@ function defineAsyncComponent(source) {
4941
4976
  error.value = err;
4942
4977
  });
4943
4978
  return () => {
4979
+ resolvedComp = getResolvedComp();
4944
4980
  if (loaded.value && resolvedComp) {
4945
4981
  return createInnerComp(resolvedComp, instance);
4946
4982
  } else if (error.value && errorComponent) {
@@ -4948,7 +4984,10 @@ function defineAsyncComponent(source) {
4948
4984
  error: error.value
4949
4985
  });
4950
4986
  } else if (loadingComponent && !delayed.value) {
4951
- return createVNode(loadingComponent);
4987
+ return createInnerComp(
4988
+ loadingComponent,
4989
+ instance
4990
+ );
4952
4991
  }
4953
4992
  };
4954
4993
  }
@@ -4962,6 +5001,108 @@ function createInnerComp(comp, parent) {
4962
5001
  delete parent.vnode.ce;
4963
5002
  return vnode;
4964
5003
  }
5004
+ function createAsyncComponentContext(source) {
5005
+ if (isFunction(source)) {
5006
+ source = { loader: source };
5007
+ }
5008
+ const { loader, onError: userOnError } = source;
5009
+ let pendingRequest = null;
5010
+ let resolvedComp;
5011
+ let retries = 0;
5012
+ const retry = () => {
5013
+ retries++;
5014
+ pendingRequest = null;
5015
+ return load();
5016
+ };
5017
+ const load = () => {
5018
+ let thisRequest;
5019
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
5020
+ err = err instanceof Error ? err : new Error(String(err));
5021
+ if (userOnError) {
5022
+ return new Promise((resolve, reject) => {
5023
+ const userRetry = () => resolve(retry());
5024
+ const userFail = () => reject(err);
5025
+ userOnError(err, userRetry, userFail, retries + 1);
5026
+ });
5027
+ } else {
5028
+ throw err;
5029
+ }
5030
+ }).then((comp) => {
5031
+ if (thisRequest !== pendingRequest && pendingRequest) {
5032
+ return pendingRequest;
5033
+ }
5034
+ if (!comp) {
5035
+ warn$1(
5036
+ `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
5037
+ );
5038
+ }
5039
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
5040
+ comp = comp.default;
5041
+ }
5042
+ if (comp && !isObject(comp) && !isFunction(comp)) {
5043
+ throw new Error(`Invalid async component load result: ${comp}`);
5044
+ }
5045
+ resolvedComp = comp;
5046
+ return comp;
5047
+ }));
5048
+ };
5049
+ return {
5050
+ load,
5051
+ source,
5052
+ getResolvedComp: () => resolvedComp,
5053
+ setPendingRequest: (request) => pendingRequest = request
5054
+ };
5055
+ }
5056
+ const useAsyncComponentState = (delay, timeout, onError) => {
5057
+ const loaded = ref(false);
5058
+ const error = ref();
5059
+ const delayed = ref(!!delay);
5060
+ if (delay) {
5061
+ setTimeout(() => {
5062
+ delayed.value = false;
5063
+ }, delay);
5064
+ }
5065
+ if (timeout != null) {
5066
+ setTimeout(() => {
5067
+ if (!loaded.value && !error.value) {
5068
+ const err = new Error(`Async component timed out after ${timeout}ms.`);
5069
+ onError(err);
5070
+ error.value = err;
5071
+ }
5072
+ }, timeout);
5073
+ }
5074
+ return { loaded, error, delayed };
5075
+ };
5076
+ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
5077
+ let patched = false;
5078
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5079
+ const performHydrate = () => {
5080
+ if (patched) {
5081
+ {
5082
+ const resolvedComp = getResolvedComp();
5083
+ warn$1(
5084
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
5085
+ );
5086
+ }
5087
+ return;
5088
+ }
5089
+ hydrate();
5090
+ };
5091
+ const doHydrate = hydrateStrategy ? () => {
5092
+ const teardown = hydrateStrategy(
5093
+ performHydrate,
5094
+ (cb) => forEachElement(el, cb)
5095
+ );
5096
+ if (teardown) {
5097
+ (instance.bum || (instance.bum = [])).push(teardown);
5098
+ }
5099
+ } : performHydrate;
5100
+ if (getResolvedComp()) {
5101
+ doHydrate();
5102
+ } else {
5103
+ load().then(() => !instance.isUnmounted && doHydrate());
5104
+ }
5105
+ }
4965
5106
 
4966
5107
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
4967
5108
  const KeepAliveImpl = {
@@ -4991,86 +5132,37 @@ const KeepAliveImpl = {
4991
5132
  keepAliveInstance.__v_cache = cache;
4992
5133
  }
4993
5134
  const parentSuspense = keepAliveInstance.suspense;
5135
+ const { renderer } = sharedContext;
4994
5136
  const {
4995
- renderer: {
4996
- p: patch,
4997
- m: move,
4998
- um: _unmount,
4999
- o: { createElement }
5000
- }
5001
- } = sharedContext;
5137
+ um: _unmount,
5138
+ o: { createElement }
5139
+ } = renderer;
5002
5140
  const storageContainer = createElement("div");
5141
+ sharedContext.getStorageContainer = () => storageContainer;
5142
+ sharedContext.getCachedComponent = (vnode) => {
5143
+ const key = vnode.key == null ? vnode.type : vnode.key;
5144
+ return cache.get(key);
5145
+ };
5003
5146
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
5004
- const instance = vnode.component;
5005
- move(
5147
+ activate(
5006
5148
  vnode,
5007
5149
  container,
5008
5150
  anchor,
5009
- 0,
5151
+ renderer,
5010
5152
  keepAliveInstance,
5011
- parentSuspense
5012
- );
5013
- patch(
5014
- instance.vnode,
5015
- vnode,
5016
- container,
5017
- anchor,
5018
- instance,
5019
5153
  parentSuspense,
5020
5154
  namespace,
5021
- vnode.slotScopeIds,
5022
5155
  optimized
5023
5156
  );
5024
- queuePostRenderEffect(
5025
- () => {
5026
- instance.isDeactivated = false;
5027
- if (instance.a) {
5028
- invokeArrayFns(instance.a);
5029
- }
5030
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
5031
- if (vnodeHook) {
5032
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
5033
- }
5034
- },
5035
- void 0,
5036
- parentSuspense
5037
- );
5038
- {
5039
- devtoolsComponentAdded(instance);
5040
- }
5041
5157
  };
5042
5158
  sharedContext.deactivate = (vnode) => {
5043
- const instance = vnode.component;
5044
- invalidateMount(instance.m);
5045
- invalidateMount(instance.a);
5046
- move(
5159
+ deactivate(
5047
5160
  vnode,
5048
5161
  storageContainer,
5049
- null,
5050
- 1,
5162
+ renderer,
5051
5163
  keepAliveInstance,
5052
5164
  parentSuspense
5053
5165
  );
5054
- queuePostRenderEffect(
5055
- () => {
5056
- if (instance.da) {
5057
- invokeArrayFns(instance.da);
5058
- }
5059
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
5060
- if (vnodeHook) {
5061
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
5062
- }
5063
- instance.isDeactivated = true;
5064
- },
5065
- void 0,
5066
- parentSuspense
5067
- );
5068
- {
5069
- devtoolsComponentAdded(instance);
5070
- }
5071
- {
5072
- instance.__keepAliveStorageContainer = storageContainer;
5073
- }
5074
5166
  };
5075
5167
  function unmount(vnode) {
5076
5168
  resetShapeFlag(vnode);
@@ -5217,7 +5309,7 @@ function onActivated(hook, target) {
5217
5309
  function onDeactivated(hook, target) {
5218
5310
  registerKeepAliveHook(hook, "da", target);
5219
5311
  }
5220
- function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
5312
+ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance()) {
5221
5313
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
5222
5314
  let current = target;
5223
5315
  while (current) {
@@ -5231,8 +5323,9 @@ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
5231
5323
  injectHook(type, wrappedHook, target);
5232
5324
  if (target) {
5233
5325
  let current = target.parent;
5234
- while (current && current.parent && current.parent.vnode) {
5235
- if (isKeepAlive(current.parent.vnode)) {
5326
+ while (current && current.parent) {
5327
+ let parent = current.parent;
5328
+ if (isKeepAlive(parent.vapor ? parent : parent.vnode)) {
5236
5329
  injectToKeepAliveRoot(wrappedHook, type, target, current);
5237
5330
  }
5238
5331
  current = current.parent;
@@ -5258,6 +5351,71 @@ function resetShapeFlag(vnode) {
5258
5351
  function getInnerChild(vnode) {
5259
5352
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
5260
5353
  }
5354
+ function activate(vnode, container, anchor, { p: patch, m: move }, parentComponent, parentSuspense, namespace, optimized) {
5355
+ const instance = vnode.component;
5356
+ move(
5357
+ vnode,
5358
+ container,
5359
+ anchor,
5360
+ 0,
5361
+ parentComponent,
5362
+ parentSuspense
5363
+ );
5364
+ patch(
5365
+ instance.vnode,
5366
+ vnode,
5367
+ container,
5368
+ anchor,
5369
+ instance,
5370
+ parentSuspense,
5371
+ namespace,
5372
+ vnode.slotScopeIds,
5373
+ optimized
5374
+ );
5375
+ queuePostRenderEffect(
5376
+ () => {
5377
+ instance.isDeactivated = false;
5378
+ if (instance.a) {
5379
+ invokeArrayFns(instance.a);
5380
+ }
5381
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
5382
+ if (vnodeHook) {
5383
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
5384
+ }
5385
+ },
5386
+ void 0,
5387
+ parentSuspense
5388
+ );
5389
+ {
5390
+ devtoolsComponentAdded(instance);
5391
+ }
5392
+ }
5393
+ function deactivate(vnode, container, { m: move }, parentComponent, parentSuspense) {
5394
+ const instance = vnode.component;
5395
+ invalidateMount(instance.m);
5396
+ invalidateMount(instance.a);
5397
+ move(vnode, container, null, 1, parentComponent, parentSuspense);
5398
+ queuePostRenderEffect(
5399
+ () => {
5400
+ if (instance.da) {
5401
+ invokeArrayFns(instance.da);
5402
+ }
5403
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
5404
+ if (vnodeHook) {
5405
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
5406
+ }
5407
+ instance.isDeactivated = true;
5408
+ },
5409
+ void 0,
5410
+ parentSuspense
5411
+ );
5412
+ {
5413
+ devtoolsComponentAdded(instance);
5414
+ }
5415
+ {
5416
+ instance.__keepAliveStorageContainer = container;
5417
+ }
5418
+ }
5261
5419
 
5262
5420
  function injectHook(type, hook, target = currentInstance, prepend = false) {
5263
5421
  if (target) {
@@ -5446,12 +5604,13 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5446
5604
  return ret;
5447
5605
  }
5448
5606
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
5607
+ const hasProps = Object.keys(props).length > 0;
5449
5608
  if (name !== "default") props.name = name;
5450
5609
  return openBlock(), createBlock(
5451
5610
  Fragment,
5452
5611
  null,
5453
5612
  [createVNode("slot", props, fallback && fallback())],
5454
- 64
5613
+ hasProps ? -2 : 64
5455
5614
  );
5456
5615
  }
5457
5616
  if (slot && slot.length > 1) {
@@ -5465,6 +5624,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
5465
5624
  }
5466
5625
  openBlock();
5467
5626
  const validSlotContent = slot && ensureValidVNode(slot(props));
5627
+ ensureVaporSlotFallback(validSlotContent, fallback);
5468
5628
  const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
5469
5629
  // key attached in the `createSlots` helper, respect that
5470
5630
  validSlotContent && validSlotContent.key;
@@ -5494,6 +5654,14 @@ function ensureValidVNode(vnodes) {
5494
5654
  return true;
5495
5655
  }) ? vnodes : null;
5496
5656
  }
5657
+ function ensureVaporSlotFallback(vnodes, fallback) {
5658
+ let vaporSlot;
5659
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
5660
+ if (!vaporSlot.fallback && fallback) {
5661
+ vaporSlot.fallback = fallback;
5662
+ }
5663
+ }
5664
+ }
5497
5665
 
5498
5666
  function toHandlers(obj, preserveCaseIfNecessary) {
5499
5667
  const ret = {};
@@ -5656,10 +5824,10 @@ const PublicInstanceProxyHandlers = {
5656
5824
  return true;
5657
5825
  },
5658
5826
  has({
5659
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
5827
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
5660
5828
  }, key) {
5661
- let normalizedProps;
5662
- return !!accessCache[key] || data !== EMPTY_OBJ && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key);
5829
+ let normalizedProps, cssModules;
5830
+ return !!(accessCache[key] || data !== EMPTY_OBJ && key[0] !== "$" && hasOwn(data, key) || hasSetupBinding(setupState, key) || (normalizedProps = propsOptions[0]) && hasOwn(normalizedProps, key) || hasOwn(ctx, key) || hasOwn(publicPropertiesMap, key) || hasOwn(appContext.config.globalProperties, key) || (cssModules = type.__cssModules) && cssModules[key]);
5663
5831
  },
5664
5832
  defineProperty(target, key, descriptor) {
5665
5833
  if (descriptor.get != null) {
@@ -5797,15 +5965,15 @@ function withDefaults(props, defaults) {
5797
5965
  return null;
5798
5966
  }
5799
5967
  function useSlots() {
5800
- return getContext().slots;
5968
+ return getContext("useSlots").slots;
5801
5969
  }
5802
5970
  function useAttrs() {
5803
- return getContext().attrs;
5971
+ return getContext("useAttrs").attrs;
5804
5972
  }
5805
- function getContext() {
5973
+ function getContext(calledFunctionName) {
5806
5974
  const i = getCurrentGenericInstance();
5807
5975
  if (!i) {
5808
- warn$1(`useContext() called without active instance.`);
5976
+ warn$1(`${calledFunctionName}() called without active instance.`);
5809
5977
  }
5810
5978
  if (i.vapor) {
5811
5979
  return i;
@@ -6061,7 +6229,8 @@ function applyOptions(instance) {
6061
6229
  expose.forEach((key) => {
6062
6230
  Object.defineProperty(exposed, key, {
6063
6231
  get: () => publicThis[key],
6064
- set: (val) => publicThis[key] = val
6232
+ set: (val) => publicThis[key] = val,
6233
+ enumerable: true
6065
6234
  });
6066
6235
  });
6067
6236
  } else if (!instance.exposed) {
@@ -6934,7 +7103,7 @@ function isBoolean(...args) {
6934
7103
  return args.some((elem) => elem.toLowerCase() === "boolean");
6935
7104
  }
6936
7105
 
6937
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
7106
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
6938
7107
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6939
7108
  const normalizeSlot = (key, rawSlot, ctx) => {
6940
7109
  if (rawSlot._n) {
@@ -6988,8 +7157,6 @@ const assignSlots = (slots, children, optimized) => {
6988
7157
  const initSlots = (instance, children, optimized) => {
6989
7158
  const slots = instance.slots = createInternalObject();
6990
7159
  if (instance.vnode.shapeFlag & 32) {
6991
- const cacheIndexes = children.__;
6992
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6993
7160
  const type = children._;
6994
7161
  if (type) {
6995
7162
  assignSlots(slots, children, optimized);
@@ -7053,12 +7220,10 @@ function endMeasure(instance, type) {
7053
7220
  if (instance.appContext.config.performance && isSupported()) {
7054
7221
  const startTag = `vue-${type}-${instance.uid}`;
7055
7222
  const endTag = startTag + `:end`;
7223
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
7056
7224
  perf.mark(endTag);
7057
- perf.measure(
7058
- `<${formatComponentName(instance, instance.type)}> ${type}`,
7059
- startTag,
7060
- endTag
7061
- );
7225
+ perf.measure(measureName, startTag, endTag);
7226
+ perf.clearMeasures(measureName);
7062
7227
  perf.clearMarks(startTag);
7063
7228
  perf.clearMarks(endTag);
7064
7229
  }
@@ -7297,15 +7462,25 @@ function baseCreateRenderer(options, createHydrationFns) {
7297
7462
  optimized
7298
7463
  );
7299
7464
  } else {
7300
- patchElement(
7301
- n1,
7302
- n2,
7303
- parentComponent,
7304
- parentSuspense,
7305
- namespace,
7306
- slotScopeIds,
7307
- optimized
7308
- );
7465
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
7466
+ try {
7467
+ if (customElement) {
7468
+ customElement._beginPatch();
7469
+ }
7470
+ patchElement(
7471
+ n1,
7472
+ n2,
7473
+ parentComponent,
7474
+ parentSuspense,
7475
+ namespace,
7476
+ slotScopeIds,
7477
+ optimized
7478
+ );
7479
+ } finally {
7480
+ if (customElement) {
7481
+ customElement._endPatch();
7482
+ }
7483
+ }
7309
7484
  }
7310
7485
  };
7311
7486
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -7356,16 +7531,20 @@ function baseCreateRenderer(options, createHydrationFns) {
7356
7531
  if (dirs) {
7357
7532
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
7358
7533
  }
7359
- const needCallTransitionHooks = needTransition(parentSuspense, transition);
7360
- if (needCallTransitionHooks) {
7361
- transition.beforeEnter(el);
7534
+ if (transition) {
7535
+ performTransitionEnter(
7536
+ el,
7537
+ transition,
7538
+ () => hostInsert(el, container, anchor),
7539
+ parentSuspense
7540
+ );
7541
+ } else {
7542
+ hostInsert(el, container, anchor);
7362
7543
  }
7363
- hostInsert(el, container, anchor);
7364
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
7544
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
7365
7545
  queuePostRenderEffect(
7366
7546
  () => {
7367
7547
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
7368
- needCallTransitionHooks && transition.enter(el);
7369
7548
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
7370
7549
  },
7371
7550
  void 0,
@@ -7382,21 +7561,9 @@ function baseCreateRenderer(options, createHydrationFns) {
7382
7561
  hostSetScopeId(el, slotScopeIds[i]);
7383
7562
  }
7384
7563
  }
7385
- let subTree = parentComponent && parentComponent.subTree;
7386
- if (subTree) {
7387
- if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
7388
- subTree = filterSingleRoot(subTree.children) || subTree;
7389
- }
7390
- if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
7391
- const parentVNode = parentComponent.vnode;
7392
- setScopeId(
7393
- el,
7394
- parentVNode,
7395
- parentVNode.scopeId,
7396
- parentVNode.slotScopeIds,
7397
- parentComponent.parent
7398
- );
7399
- }
7564
+ const inheritedScopeIds = getInheritedScopeIds(vnode, parentComponent);
7565
+ for (let i = 0; i < inheritedScopeIds.length; i++) {
7566
+ hostSetScopeId(el, inheritedScopeIds[i]);
7400
7567
  }
7401
7568
  };
7402
7569
  const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
@@ -7637,12 +7804,21 @@ function baseCreateRenderer(options, createHydrationFns) {
7637
7804
  n2.slotScopeIds = slotScopeIds;
7638
7805
  if (n2.type.__vapor) {
7639
7806
  if (n1 == null) {
7640
- getVaporInterface(parentComponent, n2).mount(
7641
- n2,
7642
- container,
7643
- anchor,
7644
- parentComponent
7645
- );
7807
+ if (n2.shapeFlag & 512) {
7808
+ getVaporInterface(parentComponent, n2).activate(
7809
+ n2,
7810
+ container,
7811
+ anchor,
7812
+ parentComponent
7813
+ );
7814
+ } else {
7815
+ getVaporInterface(parentComponent, n2).mount(
7816
+ n2,
7817
+ container,
7818
+ anchor,
7819
+ parentComponent
7820
+ );
7821
+ }
7646
7822
  } else {
7647
7823
  getVaporInterface(parentComponent, n2).update(
7648
7824
  n1,
@@ -7705,6 +7881,7 @@ function baseCreateRenderer(options, createHydrationFns) {
7705
7881
  if (!initialVNode.el) {
7706
7882
  const placeholder = instance.subTree = createVNode(Comment);
7707
7883
  processCommentNode(null, placeholder, container, anchor);
7884
+ initialVNode.placeholder = placeholder.el;
7708
7885
  }
7709
7886
  } else {
7710
7887
  setupRenderEffect(
@@ -8245,7 +8422,11 @@ function baseCreateRenderer(options, createHydrationFns) {
8245
8422
  for (i = toBePatched - 1; i >= 0; i--) {
8246
8423
  const nextIndex = s2 + i;
8247
8424
  const nextChild = c2[nextIndex];
8248
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
8425
+ const anchorVNode = c2[nextIndex + 1];
8426
+ const anchor = nextIndex + 1 < l2 ? (
8427
+ // #13559, fallback to el placeholder for unresolved async component
8428
+ anchorVNode.el || anchorVNode.placeholder
8429
+ ) : parentAnchor;
8249
8430
  if (newIndexToOldIndexMap[i] === 0) {
8250
8431
  patch(
8251
8432
  null,
@@ -8325,12 +8506,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8325
8506
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
8326
8507
  if (needTransition2) {
8327
8508
  if (moveType === 0) {
8328
- transition.beforeEnter(el);
8329
- hostInsert(el, container, anchor);
8330
- queuePostRenderEffect(
8331
- () => transition.enter(el),
8332
- void 0,
8333
- parentSuspense
8509
+ performTransitionEnter(
8510
+ el,
8511
+ transition,
8512
+ () => hostInsert(el, container, anchor),
8513
+ parentSuspense,
8514
+ true
8334
8515
  );
8335
8516
  } else {
8336
8517
  const { leave, delayLeave, afterLeave } = transition;
@@ -8342,6 +8523,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8342
8523
  }
8343
8524
  };
8344
8525
  const performLeave = () => {
8526
+ if (el._isLeaving) {
8527
+ el[leaveCbKey](
8528
+ true
8529
+ /* cancelled */
8530
+ );
8531
+ }
8345
8532
  leave(el, () => {
8346
8533
  remove2();
8347
8534
  afterLeave && afterLeave();
@@ -8381,7 +8568,14 @@ function baseCreateRenderer(options, createHydrationFns) {
8381
8568
  parentComponent.renderCache[cacheIndex] = void 0;
8382
8569
  }
8383
8570
  if (shapeFlag & 256) {
8384
- parentComponent.ctx.deactivate(vnode);
8571
+ if (vnode.type.__vapor) {
8572
+ getVaporInterface(parentComponent, vnode).deactivate(
8573
+ vnode,
8574
+ parentComponent.ctx.getStorageContainer()
8575
+ );
8576
+ } else {
8577
+ parentComponent.ctx.deactivate(vnode);
8578
+ }
8385
8579
  return;
8386
8580
  }
8387
8581
  const shouldInvokeDirs = shapeFlag & 1 && dirs;
@@ -8469,22 +8663,15 @@ function baseCreateRenderer(options, createHydrationFns) {
8469
8663
  removeStaticNode(vnode);
8470
8664
  return;
8471
8665
  }
8472
- const performRemove = () => {
8473
- hostRemove(el);
8474
- if (transition && !transition.persisted && transition.afterLeave) {
8475
- transition.afterLeave();
8476
- }
8477
- };
8478
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
8479
- const { leave, delayLeave } = transition;
8480
- const performLeave = () => leave(el, performRemove);
8481
- if (delayLeave) {
8482
- delayLeave(vnode.el, performRemove, performLeave);
8483
- } else {
8484
- performLeave();
8485
- }
8666
+ if (transition) {
8667
+ performTransitionLeave(
8668
+ el,
8669
+ transition,
8670
+ () => hostRemove(el),
8671
+ !!(vnode.shapeFlag & 1)
8672
+ );
8486
8673
  } else {
8487
- performRemove();
8674
+ hostRemove(el);
8488
8675
  }
8489
8676
  };
8490
8677
  const removeFragment = (cur, end) => {
@@ -8500,27 +8687,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8500
8687
  if (instance.type.__hmrId) {
8501
8688
  unregisterHMR(instance);
8502
8689
  }
8503
- const {
8504
- bum,
8505
- scope,
8506
- effect,
8507
- subTree,
8508
- um,
8509
- m,
8510
- a,
8511
- parent,
8512
- slots: { __: slotCacheKeys }
8513
- } = instance;
8690
+ const { bum, scope, effect, subTree, um, m, a } = instance;
8514
8691
  invalidateMount(m);
8515
8692
  invalidateMount(a);
8516
8693
  if (bum) {
8517
8694
  invokeArrayFns(bum);
8518
8695
  }
8519
- if (parent && isArray(slotCacheKeys)) {
8520
- slotCacheKeys.forEach((v) => {
8521
- parent.renderCache[v] = void 0;
8522
- });
8523
- }
8524
8696
  scope.stop();
8525
8697
  if (effect) {
8526
8698
  effect.stop();
@@ -8534,12 +8706,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8534
8706
  void 0,
8535
8707
  parentSuspense
8536
8708
  );
8537
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8538
- parentSuspense.deps--;
8539
- if (parentSuspense.deps === 0) {
8540
- parentSuspense.resolve();
8541
- }
8542
- }
8543
8709
  {
8544
8710
  devtoolsComponentRemoved(instance);
8545
8711
  }
@@ -8552,7 +8718,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8552
8718
  const getNextHostNode = (vnode) => {
8553
8719
  if (vnode.shapeFlag & 6) {
8554
8720
  if (vnode.type.__vapor) {
8555
- return hostNextSibling(vnode.component.block);
8721
+ return hostNextSibling(vnode.anchor);
8556
8722
  }
8557
8723
  return getNextHostNode(vnode.component.subTree);
8558
8724
  }
@@ -8630,6 +8796,7 @@ function baseCreateRenderer(options, createHydrationFns) {
8630
8796
  return {
8631
8797
  render,
8632
8798
  hydrate,
8799
+ hydrateNode,
8633
8800
  internals,
8634
8801
  createApp: createAppAPI(
8635
8802
  mountApp,
@@ -8669,7 +8836,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
8669
8836
  if (!shallow && c2.patchFlag !== -2)
8670
8837
  traverseStaticChildren(c1, c2);
8671
8838
  }
8672
- if (c2.type === Text) {
8839
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
8840
+ c2.patchFlag !== -1) {
8673
8841
  c2.el = c1.el;
8674
8842
  }
8675
8843
  if (c2.type === Comment && !c2.el) {
@@ -8682,7 +8850,7 @@ function traverseStaticChildren(n1, n2, shallow = false) {
8682
8850
  }
8683
8851
  }
8684
8852
  function locateNonHydratedAsyncRoot(instance) {
8685
- const subComponent = instance.subTree.component;
8853
+ const subComponent = instance.subTree && instance.subTree.component;
8686
8854
  if (subComponent) {
8687
8855
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
8688
8856
  return subComponent;
@@ -8697,6 +8865,34 @@ function invalidateMount(hooks) {
8697
8865
  hooks[i].flags |= 4;
8698
8866
  }
8699
8867
  }
8868
+ function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
8869
+ if (force || needTransition(parentSuspense, transition)) {
8870
+ transition.beforeEnter(el);
8871
+ insert();
8872
+ queuePostRenderEffect(() => transition.enter(el), void 0, parentSuspense);
8873
+ } else {
8874
+ insert();
8875
+ }
8876
+ }
8877
+ function performTransitionLeave(el, transition, remove, isElement = true) {
8878
+ const performRemove = () => {
8879
+ remove();
8880
+ if (transition && !transition.persisted && transition.afterLeave) {
8881
+ transition.afterLeave();
8882
+ }
8883
+ };
8884
+ if (isElement && transition && !transition.persisted) {
8885
+ const { leave, delayLeave } = transition;
8886
+ const performLeave = () => leave(el, performRemove);
8887
+ if (delayLeave) {
8888
+ delayLeave(el, performRemove, performLeave);
8889
+ } else {
8890
+ performLeave();
8891
+ }
8892
+ } else {
8893
+ performRemove();
8894
+ }
8895
+ }
8700
8896
  function getVaporInterface(instance, vnode) {
8701
8897
  const ctx = instance ? instance.appContext : vnode.appContext;
8702
8898
  const res = ctx && ctx.vapor;
@@ -8711,6 +8907,32 @@ app.use(vaporInteropPlugin)
8711
8907
  }
8712
8908
  return res;
8713
8909
  }
8910
+ function getInheritedScopeIds(vnode, parentComponent) {
8911
+ const inheritedScopeIds = [];
8912
+ let currentParent = parentComponent;
8913
+ let currentVNode = vnode;
8914
+ while (currentParent) {
8915
+ let subTree = currentParent.subTree;
8916
+ if (!subTree) break;
8917
+ if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
8918
+ subTree = filterSingleRoot(subTree.children) || subTree;
8919
+ }
8920
+ if (currentVNode === subTree || isSuspense(subTree.type) && (subTree.ssContent === currentVNode || subTree.ssFallback === currentVNode)) {
8921
+ const parentVNode = currentParent.vnode;
8922
+ if (parentVNode.scopeId) {
8923
+ inheritedScopeIds.push(parentVNode.scopeId);
8924
+ }
8925
+ if (parentVNode.slotScopeIds) {
8926
+ inheritedScopeIds.push(...parentVNode.slotScopeIds);
8927
+ }
8928
+ currentVNode = parentVNode;
8929
+ currentParent = currentParent.parent;
8930
+ } else {
8931
+ break;
8932
+ }
8933
+ }
8934
+ return inheritedScopeIds;
8935
+ }
8714
8936
 
8715
8937
  const ssrContextKey = Symbol.for("v-scx");
8716
8938
  const useSSRContext = () => {
@@ -9050,8 +9272,9 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
9050
9272
  function defaultPropGetter(props, key) {
9051
9273
  return props[key];
9052
9274
  }
9275
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
9053
9276
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
9054
- const cache = appContext.emitsCache;
9277
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
9055
9278
  const cached = cache.get(comp);
9056
9279
  if (cached !== void 0) {
9057
9280
  return cached;
@@ -9499,7 +9722,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9499
9722
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
9500
9723
  if (pendingBranch) {
9501
9724
  suspense.pendingBranch = newBranch;
9502
- if (isSameVNodeType(newBranch, pendingBranch)) {
9725
+ if (isSameVNodeType(pendingBranch, newBranch)) {
9503
9726
  patch(
9504
9727
  pendingBranch,
9505
9728
  newBranch,
@@ -9570,7 +9793,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9570
9793
  );
9571
9794
  setActiveBranch(suspense, newFallback);
9572
9795
  }
9573
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
9796
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
9574
9797
  patch(
9575
9798
  activeBranch,
9576
9799
  newBranch,
@@ -9601,7 +9824,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
9601
9824
  }
9602
9825
  }
9603
9826
  } else {
9604
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
9827
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
9605
9828
  patch(
9606
9829
  activeBranch,
9607
9830
  newBranch,
@@ -9714,7 +9937,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9714
9937
  pendingId,
9715
9938
  effects,
9716
9939
  parentComponent: parentComponent2,
9717
- container: container2
9940
+ container: container2,
9941
+ isInFallback
9718
9942
  } = suspense;
9719
9943
  let delayEnter = false;
9720
9944
  if (suspense.isHydrating) {
@@ -9732,6 +9956,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9732
9956
  parentComponent2
9733
9957
  );
9734
9958
  queuePostFlushCb(effects);
9959
+ if (isInFallback && vnode2.ssFallback) {
9960
+ vnode2.ssFallback.el = null;
9961
+ }
9735
9962
  }
9736
9963
  };
9737
9964
  }
@@ -9740,6 +9967,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9740
9967
  anchor = next(activeBranch);
9741
9968
  }
9742
9969
  unmount(activeBranch, parentComponent2, suspense, true);
9970
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
9971
+ vnode2.ssFallback.el = null;
9972
+ }
9743
9973
  }
9744
9974
  if (!delayEnter) {
9745
9975
  move(
@@ -9864,6 +10094,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
9864
10094
  optimized2
9865
10095
  );
9866
10096
  if (placeholder) {
10097
+ vnode2.placeholder = null;
9867
10098
  remove(placeholder);
9868
10099
  }
9869
10100
  updateHOCHostEl(instance, vnode2.el);
@@ -10069,15 +10300,11 @@ const createVNodeWithArgsTransform = (...args) => {
10069
10300
  );
10070
10301
  };
10071
10302
  const normalizeKey = ({ key }) => key != null ? key : null;
10072
- const normalizeRef = ({
10073
- ref,
10074
- ref_key,
10075
- ref_for
10076
- }) => {
10303
+ const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
10077
10304
  if (typeof ref === "number") {
10078
10305
  ref = "" + ref;
10079
10306
  }
10080
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
10307
+ return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i, r: ref, k: ref_key, f: !!ref_for } : ref : null;
10081
10308
  };
10082
10309
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
10083
10310
  const vnode = {
@@ -10243,6 +10470,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
10243
10470
  suspense: vnode.suspense,
10244
10471
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
10245
10472
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
10473
+ placeholder: vnode.placeholder,
10246
10474
  el: vnode.el,
10247
10475
  anchor: vnode.anchor,
10248
10476
  ctx: vnode.ctx,
@@ -10769,7 +10997,7 @@ function getComponentPublicInstance(instance) {
10769
10997
  return instance.proxy;
10770
10998
  }
10771
10999
  }
10772
- const classifyRE = /(?:^|[-_])(\w)/g;
11000
+ const classifyRE = /(?:^|[-_])\w/g;
10773
11001
  const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
10774
11002
  function getComponentName(Component, includeInferred = true) {
10775
11003
  return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
@@ -10805,23 +11033,28 @@ const computed = (getterOrOptions, debugOptions) => {
10805
11033
  };
10806
11034
 
10807
11035
  function h(type, propsOrChildren, children) {
10808
- const l = arguments.length;
10809
- if (l === 2) {
10810
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
10811
- if (isVNode(propsOrChildren)) {
10812
- return createVNode(type, null, [propsOrChildren]);
11036
+ try {
11037
+ setBlockTracking(-1);
11038
+ const l = arguments.length;
11039
+ if (l === 2) {
11040
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
11041
+ if (isVNode(propsOrChildren)) {
11042
+ return createVNode(type, null, [propsOrChildren]);
11043
+ }
11044
+ return createVNode(type, propsOrChildren);
11045
+ } else {
11046
+ return createVNode(type, null, propsOrChildren);
10813
11047
  }
10814
- return createVNode(type, propsOrChildren);
10815
11048
  } else {
10816
- return createVNode(type, null, propsOrChildren);
10817
- }
10818
- } else {
10819
- if (l > 3) {
10820
- children = Array.prototype.slice.call(arguments, 2);
10821
- } else if (l === 3 && isVNode(children)) {
10822
- children = [children];
11049
+ if (l > 3) {
11050
+ children = Array.prototype.slice.call(arguments, 2);
11051
+ } else if (l === 3 && isVNode(children)) {
11052
+ children = [children];
11053
+ }
11054
+ return createVNode(type, propsOrChildren, children);
10823
11055
  }
10824
- return createVNode(type, propsOrChildren, children);
11056
+ } finally {
11057
+ setBlockTracking(1);
10825
11058
  }
10826
11059
  }
10827
11060
 
@@ -11031,7 +11264,7 @@ function isMemoSame(cached, memo) {
11031
11264
  return true;
11032
11265
  }
11033
11266
 
11034
- const version = "3.6.0-alpha.1";
11267
+ const version = "3.6.0-alpha.3";
11035
11268
  const warn = warn$1 ;
11036
11269
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
11037
11270
  const devtools = devtools$1 ;
@@ -11260,11 +11493,11 @@ function resolveTransitionProps(rawProps) {
11260
11493
  const resolve = () => finishLeave(el, done);
11261
11494
  addTransitionClass(el, leaveFromClass);
11262
11495
  if (!el._enterCancelled) {
11263
- forceReflow();
11496
+ forceReflow(el);
11264
11497
  addTransitionClass(el, leaveActiveClass);
11265
11498
  } else {
11266
11499
  addTransitionClass(el, leaveActiveClass);
11267
- forceReflow();
11500
+ forceReflow(el);
11268
11501
  }
11269
11502
  nextFrame(() => {
11270
11503
  if (!el._isLeaving) {
@@ -11390,7 +11623,7 @@ function getTransitionInfo(el, expectedType) {
11390
11623
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
11391
11624
  propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
11392
11625
  }
11393
- const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
11626
+ const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
11394
11627
  getStyleProperties(`${TRANSITION$1}Property`).toString()
11395
11628
  );
11396
11629
  return {
@@ -11410,8 +11643,9 @@ function toMs(s) {
11410
11643
  if (s === "auto") return 0;
11411
11644
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
11412
11645
  }
11413
- function forceReflow() {
11414
- return document.body.offsetHeight;
11646
+ function forceReflow(el) {
11647
+ const targetDocument = el ? el.ownerDocument : document;
11648
+ return targetDocument.body.offsetHeight;
11415
11649
  }
11416
11650
 
11417
11651
  function patchClass(el, value, isSVG) {
@@ -11431,6 +11665,8 @@ function patchClass(el, value, isSVG) {
11431
11665
  const vShowOriginalDisplay = Symbol("_vod");
11432
11666
  const vShowHidden = Symbol("_vsh");
11433
11667
  const vShow = {
11668
+ // used for prop mismatch check during hydration
11669
+ name: "show",
11434
11670
  beforeMount(el, { value }, { transition }) {
11435
11671
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11436
11672
  if (transition && value) {
@@ -11464,9 +11700,6 @@ const vShow = {
11464
11700
  setDisplay(el, value);
11465
11701
  }
11466
11702
  };
11467
- {
11468
- vShow.name = "show";
11469
- }
11470
11703
  function setDisplay(el, value) {
11471
11704
  el.style.display = value ? el[vShowOriginalDisplay] : "none";
11472
11705
  el[vShowHidden] = !value;
@@ -11552,7 +11785,7 @@ function setVarsOnNode(el, vars) {
11552
11785
  }
11553
11786
  }
11554
11787
 
11555
- const displayRE = /(^|;)\s*display\s*:/;
11788
+ const displayRE = /(?:^|;)\s*display\s*:/;
11556
11789
  function patchStyle(el, prev, next) {
11557
11790
  const style = el.style;
11558
11791
  const isCssString = isString(next);
@@ -11857,11 +12090,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
11857
12090
  }
11858
12091
 
11859
12092
  const REMOVAL = {};
11860
- /*! #__NO_SIDE_EFFECTS__ */
11861
12093
  // @__NO_SIDE_EFFECTS__
11862
12094
  function defineCustomElement(options, extraOptions, _createApp) {
11863
- const Comp = defineComponent(options, extraOptions);
11864
- if (isPlainObject(Comp)) extend(Comp, extraOptions);
12095
+ let Comp = defineComponent(options, extraOptions);
12096
+ if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
11865
12097
  class VueCustomElement extends VueElement {
11866
12098
  constructor(initialProps) {
11867
12099
  super(Comp, initialProps, _createApp);
@@ -11870,10 +12102,9 @@ function defineCustomElement(options, extraOptions, _createApp) {
11870
12102
  VueCustomElement.def = Comp;
11871
12103
  return VueCustomElement;
11872
12104
  }
11873
- /*! #__NO_SIDE_EFFECTS__ */
11874
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
12105
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11875
12106
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
11876
- };
12107
+ });
11877
12108
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
11878
12109
  };
11879
12110
  class VueElement extends BaseClass {
@@ -11897,6 +12128,8 @@ class VueElement extends BaseClass {
11897
12128
  this._nonce = this._def.nonce;
11898
12129
  this._connected = false;
11899
12130
  this._resolved = false;
12131
+ this._patching = false;
12132
+ this._dirty = false;
11900
12133
  this._numberProps = null;
11901
12134
  this._styleChildren = /* @__PURE__ */ new WeakSet();
11902
12135
  this._ob = null;
@@ -11909,7 +12142,11 @@ class VueElement extends BaseClass {
11909
12142
  );
11910
12143
  }
11911
12144
  if (_def.shadowRoot !== false) {
11912
- this.attachShadow({ mode: "open" });
12145
+ this.attachShadow(
12146
+ extend({}, _def.shadowRootOptions, {
12147
+ mode: "open"
12148
+ })
12149
+ );
11913
12150
  this._root = this.shadowRoot;
11914
12151
  } else {
11915
12152
  this._root = this;
@@ -11969,9 +12206,18 @@ class VueElement extends BaseClass {
11969
12206
  this._app && this._app.unmount();
11970
12207
  if (this._instance) this._instance.ce = void 0;
11971
12208
  this._app = this._instance = null;
12209
+ if (this._teleportTargets) {
12210
+ this._teleportTargets.clear();
12211
+ this._teleportTargets = void 0;
12212
+ }
11972
12213
  }
11973
12214
  });
11974
12215
  }
12216
+ _processMutations(mutations) {
12217
+ for (const m of mutations) {
12218
+ this._setAttr(m.attributeName);
12219
+ }
12220
+ }
11975
12221
  /**
11976
12222
  * resolve inner component definition (handle possible async component)
11977
12223
  */
@@ -11982,11 +12228,7 @@ class VueElement extends BaseClass {
11982
12228
  for (let i = 0; i < this.attributes.length; i++) {
11983
12229
  this._setAttr(this.attributes[i].name);
11984
12230
  }
11985
- this._ob = new MutationObserver((mutations) => {
11986
- for (const m of mutations) {
11987
- this._setAttr(m.attributeName);
11988
- }
11989
- });
12231
+ this._ob = new MutationObserver(this._processMutations.bind(this));
11990
12232
  this._ob.observe(this, { attributes: true });
11991
12233
  const resolve = (def, isAsync = false) => {
11992
12234
  this._resolved = true;
@@ -12063,7 +12305,7 @@ class VueElement extends BaseClass {
12063
12305
  return this._getProp(key);
12064
12306
  },
12065
12307
  set(val) {
12066
- this._setProp(key, val, true, true);
12308
+ this._setProp(key, val, true, !this._patching);
12067
12309
  }
12068
12310
  });
12069
12311
  }
@@ -12089,6 +12331,7 @@ class VueElement extends BaseClass {
12089
12331
  */
12090
12332
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
12091
12333
  if (val !== this._props[key]) {
12334
+ this._dirty = true;
12092
12335
  if (val === REMOVAL) {
12093
12336
  delete this._props[key];
12094
12337
  } else {
@@ -12102,7 +12345,10 @@ class VueElement extends BaseClass {
12102
12345
  }
12103
12346
  if (shouldReflect) {
12104
12347
  const ob = this._ob;
12105
- ob && ob.disconnect();
12348
+ if (ob) {
12349
+ this._processMutations(ob.takeRecords());
12350
+ ob.disconnect();
12351
+ }
12106
12352
  if (val === true) {
12107
12353
  this.setAttribute(hyphenate(key), "");
12108
12354
  } else if (typeof val === "string" || typeof val === "number") {
@@ -12206,7 +12452,7 @@ class VueElement extends BaseClass {
12206
12452
  * Only called when shadowRoot is false
12207
12453
  */
12208
12454
  _renderSlots() {
12209
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
12455
+ const outlets = this._getSlots();
12210
12456
  const scopeId = this._instance.type.__scopeId;
12211
12457
  for (let i = 0; i < outlets.length; i++) {
12212
12458
  const o = outlets[i];
@@ -12232,12 +12478,45 @@ class VueElement extends BaseClass {
12232
12478
  parent.removeChild(o);
12233
12479
  }
12234
12480
  }
12481
+ /**
12482
+ * @internal
12483
+ */
12484
+ _getSlots() {
12485
+ const roots = [this];
12486
+ if (this._teleportTargets) {
12487
+ roots.push(...this._teleportTargets);
12488
+ }
12489
+ const slots = /* @__PURE__ */ new Set();
12490
+ for (const root of roots) {
12491
+ const found = root.querySelectorAll("slot");
12492
+ for (let i = 0; i < found.length; i++) {
12493
+ slots.add(found[i]);
12494
+ }
12495
+ }
12496
+ return Array.from(slots);
12497
+ }
12235
12498
  /**
12236
12499
  * @internal
12237
12500
  */
12238
12501
  _injectChildStyle(comp) {
12239
12502
  this._applyStyles(comp.styles, comp);
12240
12503
  }
12504
+ /**
12505
+ * @internal
12506
+ */
12507
+ _beginPatch() {
12508
+ this._patching = true;
12509
+ this._dirty = false;
12510
+ }
12511
+ /**
12512
+ * @internal
12513
+ */
12514
+ _endPatch() {
12515
+ this._patching = false;
12516
+ if (this._dirty && this._instance) {
12517
+ this._update();
12518
+ }
12519
+ }
12241
12520
  /**
12242
12521
  * @internal
12243
12522
  */
@@ -12330,26 +12609,13 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
12330
12609
  prevChildren = [];
12331
12610
  return;
12332
12611
  }
12333
- prevChildren.forEach(callPendingCbs);
12612
+ prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
12334
12613
  prevChildren.forEach(recordPosition);
12335
12614
  const movedChildren = prevChildren.filter(applyTranslation);
12336
- forceReflow();
12615
+ forceReflow(instance.vnode.el);
12337
12616
  movedChildren.forEach((c) => {
12338
12617
  const el = c.el;
12339
- const style = el.style;
12340
- addTransitionClass(el, moveClass);
12341
- style.transform = style.webkitTransform = style.transitionDuration = "";
12342
- const cb = el[moveCbKey] = (e) => {
12343
- if (e && e.target !== el) {
12344
- return;
12345
- }
12346
- if (!e || /transform$/.test(e.propertyName)) {
12347
- el.removeEventListener("transitionend", cb);
12348
- el[moveCbKey] = null;
12349
- removeTransitionClass(el, moveClass);
12350
- }
12351
- };
12352
- el.addEventListener("transitionend", cb);
12618
+ handleMovedChildren(el, moveClass);
12353
12619
  });
12354
12620
  prevChildren = [];
12355
12621
  });
@@ -12372,10 +12638,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
12372
12638
  instance
12373
12639
  )
12374
12640
  );
12375
- positionMap.set(
12376
- child,
12377
- child.el.getBoundingClientRect()
12378
- );
12641
+ positionMap.set(child, {
12642
+ left: child.el.offsetLeft,
12643
+ top: child.el.offsetTop
12644
+ });
12379
12645
  }
12380
12646
  }
12381
12647
  }
@@ -12396,8 +12662,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
12396
12662
  }
12397
12663
  });
12398
12664
  const TransitionGroup = TransitionGroupImpl;
12399
- function callPendingCbs(c) {
12400
- const el = c.el;
12665
+ function callPendingCbs(el) {
12401
12666
  if (el[moveCbKey]) {
12402
12667
  el[moveCbKey]();
12403
12668
  }
@@ -12406,19 +12671,30 @@ function callPendingCbs(c) {
12406
12671
  }
12407
12672
  }
12408
12673
  function recordPosition(c) {
12409
- newPositionMap.set(c, c.el.getBoundingClientRect());
12674
+ newPositionMap.set(c, {
12675
+ left: c.el.offsetLeft,
12676
+ top: c.el.offsetTop
12677
+ });
12410
12678
  }
12411
12679
  function applyTranslation(c) {
12412
- const oldPos = positionMap.get(c);
12413
- const newPos = newPositionMap.get(c);
12680
+ if (baseApplyTranslation(
12681
+ positionMap.get(c),
12682
+ newPositionMap.get(c),
12683
+ c.el
12684
+ )) {
12685
+ return c;
12686
+ }
12687
+ }
12688
+ function baseApplyTranslation(oldPos, newPos, el) {
12414
12689
  const dx = oldPos.left - newPos.left;
12415
12690
  const dy = oldPos.top - newPos.top;
12416
12691
  if (dx || dy) {
12417
- const s = c.el.style;
12692
+ const s = el.style;
12418
12693
  s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
12419
12694
  s.transitionDuration = "0s";
12420
- return c;
12695
+ return true;
12421
12696
  }
12697
+ return false;
12422
12698
  }
12423
12699
  function hasCSSTransform(el, root, moveClass) {
12424
12700
  const clone = el.cloneNode();
@@ -12436,6 +12712,22 @@ function hasCSSTransform(el, root, moveClass) {
12436
12712
  container.removeChild(clone);
12437
12713
  return hasTransform;
12438
12714
  }
12715
+ const handleMovedChildren = (el, moveClass) => {
12716
+ const style = el.style;
12717
+ addTransitionClass(el, moveClass);
12718
+ style.transform = style.webkitTransform = style.transitionDuration = "";
12719
+ const cb = el[moveCbKey] = (e) => {
12720
+ if (e && e.target !== el) {
12721
+ return;
12722
+ }
12723
+ if (!e || e.propertyName.endsWith("transform")) {
12724
+ el.removeEventListener("transitionend", cb);
12725
+ el[moveCbKey] = null;
12726
+ removeTransitionClass(el, moveClass);
12727
+ }
12728
+ };
12729
+ el.addEventListener("transitionend", cb);
12730
+ };
12439
12731
 
12440
12732
  const getModelAssigner = (vnode) => {
12441
12733
  const fn = vnode.props["onUpdate:modelValue"] || false;
@@ -12471,21 +12763,21 @@ const vModelText = {
12471
12763
  vModelTextUpdate(el, oldValue, value, trim, number, lazy);
12472
12764
  }
12473
12765
  };
12766
+ function castValue(value, trim, number) {
12767
+ if (trim) value = value.trim();
12768
+ if (number) value = looseToNumber(value);
12769
+ return value;
12770
+ }
12474
12771
  const vModelTextInit = (el, trim, number, lazy, set) => {
12475
12772
  addEventListener(el, lazy ? "change" : "input", (e) => {
12476
12773
  if (e.target.composing) return;
12477
- let domValue = el.value;
12478
- if (trim) {
12479
- domValue = domValue.trim();
12480
- }
12481
- if (number || el.type === "number") {
12482
- domValue = looseToNumber(domValue);
12483
- }
12484
- (0, el[assignKey])(domValue);
12774
+ (0, el[assignKey])(
12775
+ castValue(el.value, trim, number || el.type === "number")
12776
+ );
12485
12777
  });
12486
- if (trim) {
12778
+ if (trim || number) {
12487
12779
  addEventListener(el, "change", () => {
12488
- el.value = el.value.trim();
12780
+ el.value = castValue(el.value, trim, number || el.type === "number");
12489
12781
  });
12490
12782
  }
12491
12783
  if (!lazy) {
@@ -12768,13 +13060,13 @@ const modifierGuards = {
12768
13060
  const withModifiers = (fn, modifiers) => {
12769
13061
  const cache = fn._withMods || (fn._withMods = {});
12770
13062
  const cacheKey = modifiers.join(".");
12771
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
13063
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
12772
13064
  for (let i = 0; i < modifiers.length; i++) {
12773
13065
  const guard = modifierGuards[modifiers[i]];
12774
13066
  if (guard && guard(event, modifiers)) return;
12775
13067
  }
12776
13068
  return fn(event, ...args);
12777
- });
13069
+ }));
12778
13070
  };
12779
13071
  const keyNames = {
12780
13072
  esc: "escape",
@@ -12788,7 +13080,7 @@ const keyNames = {
12788
13080
  const withKeys = (fn, modifiers) => {
12789
13081
  const cache = fn._withKeys || (fn._withKeys = {});
12790
13082
  const cacheKey = modifiers.join(".");
12791
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
13083
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
12792
13084
  if (!("key" in event)) {
12793
13085
  return;
12794
13086
  }
@@ -12798,7 +13090,7 @@ const withKeys = (fn, modifiers) => {
12798
13090
  )) {
12799
13091
  return fn(event);
12800
13092
  }
12801
- });
13093
+ }));
12802
13094
  };
12803
13095
 
12804
13096
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -12812,13 +13104,13 @@ function ensureHydrationRenderer() {
12812
13104
  enabledHydration = true;
12813
13105
  return renderer;
12814
13106
  }
12815
- const render = (...args) => {
13107
+ const render = ((...args) => {
12816
13108
  ensureRenderer().render(...args);
12817
- };
12818
- const hydrate = (...args) => {
13109
+ });
13110
+ const hydrate = ((...args) => {
12819
13111
  ensureHydrationRenderer().hydrate(...args);
12820
- };
12821
- const createApp = (...args) => {
13112
+ });
13113
+ const createApp = ((...args) => {
12822
13114
  const app = ensureRenderer().createApp(...args);
12823
13115
  {
12824
13116
  injectNativeTagCheck(app);
@@ -12843,8 +13135,8 @@ const createApp = (...args) => {
12843
13135
  return proxy;
12844
13136
  };
12845
13137
  return app;
12846
- };
12847
- const createSSRApp = (...args) => {
13138
+ });
13139
+ const createSSRApp = ((...args) => {
12848
13140
  const app = ensureHydrationRenderer().createApp(...args);
12849
13141
  {
12850
13142
  injectNativeTagCheck(app);
@@ -12858,7 +13150,7 @@ const createSSRApp = (...args) => {
12858
13150
  }
12859
13151
  };
12860
13152
  return app;
12861
- };
13153
+ });
12862
13154
  function resolveRootNamespace(container) {
12863
13155
  if (container instanceof SVGElement) {
12864
13156
  return "svg";
@@ -14277,7 +14569,7 @@ function isCoreComponent(tag) {
14277
14569
  return BASE_TRANSITION;
14278
14570
  }
14279
14571
  }
14280
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
14572
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
14281
14573
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
14282
14574
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
14283
14575
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -14346,7 +14638,7 @@ const isMemberExpressionBrowser = (exp) => {
14346
14638
  return !currentOpenBracketCount && !currentOpenParensCount;
14347
14639
  };
14348
14640
  const isMemberExpression = isMemberExpressionBrowser ;
14349
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
14641
+ const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
14350
14642
  const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
14351
14643
  const isFnExpression = isFnExpressionBrowser ;
14352
14644
  function assert(condition, msg) {
@@ -14389,6 +14681,9 @@ function hasDynamicKeyVBind(node) {
14389
14681
  function isText$1(node) {
14390
14682
  return node.type === 5 || node.type === 2;
14391
14683
  }
14684
+ function isVPre(p) {
14685
+ return p.type === 7 && p.name === "pre";
14686
+ }
14392
14687
  function isVSlot(p) {
14393
14688
  return p.type === 7 && p.name === "slot";
14394
14689
  }
@@ -14647,7 +14942,7 @@ const tokenizer = new Tokenizer(stack, {
14647
14942
  ondirarg(start, end) {
14648
14943
  if (start === end) return;
14649
14944
  const arg = getSlice(start, end);
14650
- if (inVPre) {
14945
+ if (inVPre && !isVPre(currentProp)) {
14651
14946
  currentProp.name += arg;
14652
14947
  setLocEnd(currentProp.nameLoc, end);
14653
14948
  } else {
@@ -14662,7 +14957,7 @@ const tokenizer = new Tokenizer(stack, {
14662
14957
  },
14663
14958
  ondirmodifier(start, end) {
14664
14959
  const mod = getSlice(start, end);
14665
- if (inVPre) {
14960
+ if (inVPre && !isVPre(currentProp)) {
14666
14961
  currentProp.name += "." + mod;
14667
14962
  setLocEnd(currentProp.nameLoc, end);
14668
14963
  } else if (currentProp.name === "slot") {
@@ -15207,6 +15502,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
15207
15502
  } else if (child.type === 12) {
15208
15503
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
15209
15504
  if (constantType >= 2) {
15505
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
15506
+ child.codegenNode.arguments.push(
15507
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
15508
+ );
15509
+ }
15210
15510
  toCache.push(child);
15211
15511
  continue;
15212
15512
  }
@@ -15235,7 +15535,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
15235
15535
  }
15236
15536
  }
15237
15537
  let cachedAsArray = false;
15238
- const slotCacheKeys = [];
15239
15538
  if (toCache.length === children.length && node.type === 1) {
15240
15539
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
15241
15540
  node.codegenNode.children = getCacheExpression(
@@ -15245,7 +15544,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
15245
15544
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
15246
15545
  const slot = getSlotNode(node.codegenNode, "default");
15247
15546
  if (slot) {
15248
- slotCacheKeys.push(context.cached.length);
15249
15547
  slot.returns = getCacheExpression(
15250
15548
  createArrayExpression(slot.returns)
15251
15549
  );
@@ -15255,7 +15553,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
15255
15553
  const slotName = findDir(node, "slot", true);
15256
15554
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
15257
15555
  if (slot) {
15258
- slotCacheKeys.push(context.cached.length);
15259
15556
  slot.returns = getCacheExpression(
15260
15557
  createArrayExpression(slot.returns)
15261
15558
  );
@@ -15265,23 +15562,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
15265
15562
  }
15266
15563
  if (!cachedAsArray) {
15267
15564
  for (const child of toCache) {
15268
- slotCacheKeys.push(context.cached.length);
15269
15565
  child.codegenNode = context.cache(child.codegenNode);
15270
15566
  }
15271
15567
  }
15272
- if (slotCacheKeys.length && node.type === 1 && node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
15273
- node.codegenNode.children.properties.push(
15274
- createObjectProperty(
15275
- `__`,
15276
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
15277
- )
15278
- );
15279
- }
15280
15568
  function getCacheExpression(value) {
15281
15569
  const exp = context.cache(value);
15282
- if (inFor && context.hmr) {
15283
- exp.needArraySpread = true;
15284
- }
15570
+ exp.needArraySpread = true;
15285
15571
  return exp;
15286
15572
  }
15287
15573
  function getSlotNode(node2, name) {
@@ -16398,7 +16684,7 @@ function processExpression(node, context, asParams = false, asRawStatements = fa
16398
16684
  }
16399
16685
 
16400
16686
  const transformIf = createStructuralDirectiveTransform(
16401
- /^(if|else|else-if)$/,
16687
+ /^(?:if|else|else-if)$/,
16402
16688
  (node, dir, context) => {
16403
16689
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
16404
16690
  const siblings = context.parent.children;
@@ -16467,7 +16753,7 @@ function processIf(node, dir, context, processCodegen) {
16467
16753
  continue;
16468
16754
  }
16469
16755
  if (sibling && sibling.type === 9) {
16470
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16756
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16471
16757
  context.onError(
16472
16758
  createCompilerError(30, node.loc)
16473
16759
  );
@@ -16616,80 +16902,6 @@ function getParentCondition(node) {
16616
16902
  }
16617
16903
  }
16618
16904
 
16619
- const transformBind = (dir, _node, context) => {
16620
- const { modifiers, loc } = dir;
16621
- const arg = dir.arg;
16622
- let { exp } = dir;
16623
- if (exp && exp.type === 4 && !exp.content.trim()) {
16624
- {
16625
- exp = void 0;
16626
- }
16627
- }
16628
- if (!exp) {
16629
- if (arg.type !== 4 || !arg.isStatic) {
16630
- context.onError(
16631
- createCompilerError(
16632
- 52,
16633
- arg.loc
16634
- )
16635
- );
16636
- return {
16637
- props: [
16638
- createObjectProperty(arg, createSimpleExpression("", true, loc))
16639
- ]
16640
- };
16641
- }
16642
- transformBindShorthand(dir);
16643
- exp = dir.exp;
16644
- }
16645
- if (arg.type !== 4) {
16646
- arg.children.unshift(`(`);
16647
- arg.children.push(`) || ""`);
16648
- } else if (!arg.isStatic) {
16649
- arg.content = `${arg.content} || ""`;
16650
- }
16651
- if (modifiers.some((mod) => mod.content === "camel")) {
16652
- if (arg.type === 4) {
16653
- if (arg.isStatic) {
16654
- arg.content = camelize(arg.content);
16655
- } else {
16656
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
16657
- }
16658
- } else {
16659
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
16660
- arg.children.push(`)`);
16661
- }
16662
- }
16663
- if (!context.inSSR) {
16664
- if (modifiers.some((mod) => mod.content === "prop")) {
16665
- injectPrefix(arg, ".");
16666
- }
16667
- if (modifiers.some((mod) => mod.content === "attr")) {
16668
- injectPrefix(arg, "^");
16669
- }
16670
- }
16671
- return {
16672
- props: [createObjectProperty(arg, exp)]
16673
- };
16674
- };
16675
- const transformBindShorthand = (dir, context) => {
16676
- const arg = dir.arg;
16677
- const propName = camelize(arg.content);
16678
- dir.exp = createSimpleExpression(propName, false, arg.loc);
16679
- };
16680
- const injectPrefix = (arg, prefix) => {
16681
- if (arg.type === 4) {
16682
- if (arg.isStatic) {
16683
- arg.content = prefix + arg.content;
16684
- } else {
16685
- arg.content = `\`${prefix}\${${arg.content}}\``;
16686
- }
16687
- } else {
16688
- arg.children.unshift(`'${prefix}' + (`);
16689
- arg.children.push(`)`);
16690
- }
16691
- };
16692
-
16693
16905
  const transformFor = createStructuralDirectiveTransform(
16694
16906
  "for",
16695
16907
  (node, dir, context) => {
@@ -16701,10 +16913,7 @@ const transformFor = createStructuralDirectiveTransform(
16701
16913
  const isTemplate = isTemplateNode(node);
16702
16914
  const memo = findDir(node, "memo");
16703
16915
  const keyProp = findProp(node, `key`, false, true);
16704
- const isDirKey = keyProp && keyProp.type === 7;
16705
- if (isDirKey && !keyProp.exp) {
16706
- transformBindShorthand(keyProp);
16707
- }
16916
+ keyProp && keyProp.type === 7;
16708
16917
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
16709
16918
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
16710
16919
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
@@ -16985,7 +17194,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16985
17194
  );
16986
17195
  } else if (vElse = findDir(
16987
17196
  slotElement,
16988
- /^else(-if)?$/,
17197
+ /^else(?:-if)?$/,
16989
17198
  true
16990
17199
  /* allowEmpty */
16991
17200
  )) {
@@ -16997,7 +17206,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16997
17206
  break;
16998
17207
  }
16999
17208
  }
17000
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
17209
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
17001
17210
  let conditional = dynamicSlots[dynamicSlots.length - 1];
17002
17211
  while (conditional.alternate.type === 19) {
17003
17212
  conditional = conditional.alternate;
@@ -17814,6 +18023,58 @@ const transformOn$1 = (dir, node, context, augmentor) => {
17814
18023
  return ret;
17815
18024
  };
17816
18025
 
18026
+ const transformBind = (dir, _node, context) => {
18027
+ const { modifiers, loc } = dir;
18028
+ const arg = dir.arg;
18029
+ let { exp } = dir;
18030
+ if (exp && exp.type === 4 && !exp.content.trim()) {
18031
+ {
18032
+ exp = void 0;
18033
+ }
18034
+ }
18035
+ if (arg.type !== 4) {
18036
+ arg.children.unshift(`(`);
18037
+ arg.children.push(`) || ""`);
18038
+ } else if (!arg.isStatic) {
18039
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
18040
+ }
18041
+ if (modifiers.some((mod) => mod.content === "camel")) {
18042
+ if (arg.type === 4) {
18043
+ if (arg.isStatic) {
18044
+ arg.content = camelize(arg.content);
18045
+ } else {
18046
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
18047
+ }
18048
+ } else {
18049
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
18050
+ arg.children.push(`)`);
18051
+ }
18052
+ }
18053
+ if (!context.inSSR) {
18054
+ if (modifiers.some((mod) => mod.content === "prop")) {
18055
+ injectPrefix(arg, ".");
18056
+ }
18057
+ if (modifiers.some((mod) => mod.content === "attr")) {
18058
+ injectPrefix(arg, "^");
18059
+ }
18060
+ }
18061
+ return {
18062
+ props: [createObjectProperty(arg, exp)]
18063
+ };
18064
+ };
18065
+ const injectPrefix = (arg, prefix) => {
18066
+ if (arg.type === 4) {
18067
+ if (arg.isStatic) {
18068
+ arg.content = prefix + arg.content;
18069
+ } else {
18070
+ arg.content = `\`${prefix}\${${arg.content}}\``;
18071
+ }
18072
+ } else {
18073
+ arg.children.unshift(`'${prefix}' + (`);
18074
+ arg.children.push(`)`);
18075
+ }
18076
+ };
18077
+
17817
18078
  const transformText = (node, context) => {
17818
18079
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
17819
18080
  return () => {
@@ -17973,7 +18234,7 @@ const seen = /* @__PURE__ */ new WeakSet();
17973
18234
  const transformMemo = (node, context) => {
17974
18235
  if (node.type === 1) {
17975
18236
  const dir = findDir(node, "memo");
17976
- if (!dir || seen.has(node)) {
18237
+ if (!dir || seen.has(node) || context.inSSR) {
17977
18238
  return;
17978
18239
  }
17979
18240
  seen.add(node);
@@ -17995,9 +18256,36 @@ const transformMemo = (node, context) => {
17995
18256
  }
17996
18257
  };
17997
18258
 
18259
+ const transformVBindShorthand = (node, context) => {
18260
+ if (node.type === 1) {
18261
+ for (const prop of node.props) {
18262
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
18263
+ prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
18264
+ const arg = prop.arg;
18265
+ if (arg.type !== 4 || !arg.isStatic) {
18266
+ context.onError(
18267
+ createCompilerError(
18268
+ 52,
18269
+ arg.loc
18270
+ )
18271
+ );
18272
+ prop.exp = createSimpleExpression("", true, arg.loc);
18273
+ } else {
18274
+ const propName = camelize(arg.content);
18275
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
18276
+ propName[0] === "-") {
18277
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
18278
+ }
18279
+ }
18280
+ }
18281
+ }
18282
+ }
18283
+ };
18284
+
17998
18285
  function getBaseTransformPreset(prefixIdentifiers) {
17999
18286
  return [
18000
18287
  [
18288
+ transformVBindShorthand,
18001
18289
  transformOnce,
18002
18290
  transformIf,
18003
18291
  transformMemo,
@@ -18442,46 +18730,46 @@ const transformTransition = (node, context) => {
18442
18730
  if (node.type === 1 && node.tagType === 1) {
18443
18731
  const component = context.isBuiltInComponent(node.tag);
18444
18732
  if (component === TRANSITION) {
18445
- return () => {
18446
- if (!node.children.length) {
18447
- return;
18448
- }
18449
- if (hasMultipleChildren(node)) {
18450
- context.onError(
18451
- createDOMCompilerError(
18452
- 62,
18453
- {
18454
- start: node.children[0].loc.start,
18455
- end: node.children[node.children.length - 1].loc.end,
18456
- source: ""
18457
- }
18458
- )
18459
- );
18460
- }
18461
- const child = node.children[0];
18462
- if (child.type === 1) {
18463
- for (const p of child.props) {
18464
- if (p.type === 7 && p.name === "show") {
18465
- node.props.push({
18466
- type: 6,
18467
- name: "persisted",
18468
- nameLoc: node.loc,
18469
- value: void 0,
18470
- loc: node.loc
18471
- });
18472
- }
18473
- }
18474
- }
18475
- };
18733
+ return postTransformTransition(node, context.onError);
18476
18734
  }
18477
18735
  }
18478
18736
  };
18479
- function hasMultipleChildren(node) {
18737
+ function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
18738
+ return () => {
18739
+ if (!node.children.length) {
18740
+ return;
18741
+ }
18742
+ if (hasMultipleChildren(node)) {
18743
+ onError(
18744
+ createDOMCompilerError(62, {
18745
+ start: node.children[0].loc.start,
18746
+ end: node.children[node.children.length - 1].loc.end,
18747
+ source: ""
18748
+ })
18749
+ );
18750
+ }
18751
+ const child = node.children[0];
18752
+ if (child.type === 1) {
18753
+ for (const p of child.props) {
18754
+ if (p.type === 7 && p.name === "show") {
18755
+ node.props.push({
18756
+ type: 6,
18757
+ name: "persisted",
18758
+ nameLoc: node.loc,
18759
+ value: void 0,
18760
+ loc: node.loc
18761
+ });
18762
+ }
18763
+ }
18764
+ }
18765
+ };
18766
+ }
18767
+ function defaultHasMultipleChildren(node) {
18480
18768
  const children = node.children = node.children.filter(
18481
18769
  (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
18482
18770
  );
18483
18771
  const child = children[0];
18484
- return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
18772
+ return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
18485
18773
  }
18486
18774
 
18487
18775
  const ignoreSideEffectTags = (node, context) => {