@vue/compat 3.6.0-alpha.2 → 3.6.0-alpha.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.6.0-alpha.2
2
+ * @vue/compat v3.6.0-alpha.4
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -10,7 +10,6 @@ var estreeWalker = require('estree-walker');
10
10
  var decode_js = require('entities/lib/decode.js');
11
11
  var sourceMapJs = require('source-map-js');
12
12
 
13
- /*! #__NO_SIDE_EFFECTS__ */
14
13
  // @__NO_SIDE_EFFECTS__
15
14
  function makeMap(str) {
16
15
  const map = /* @__PURE__ */ Object.create(null);
@@ -66,10 +65,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
66
65
  );
67
66
  const cacheStringFunction = (fn) => {
68
67
  const cache = /* @__PURE__ */ Object.create(null);
69
- return (str) => {
68
+ return ((str) => {
70
69
  const hit = cache[str];
71
70
  return hit || (cache[str] = fn(str));
72
- };
71
+ });
73
72
  };
74
73
  const camelizeRE = /-(\w)/g;
75
74
  const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
@@ -89,6 +88,9 @@ const toHandlerKey = cacheStringFunction(
89
88
  return s;
90
89
  }
91
90
  );
91
+ const getModifierPropName = (name) => {
92
+ return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
93
+ };
92
94
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
93
95
  const invokeArrayFns = (fns, ...arg) => {
94
96
  for (let i = 0; i < fns.length; i++) {
@@ -322,6 +324,9 @@ function shouldSetAsAttr(tagName, key) {
322
324
  if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
323
325
  return true;
324
326
  }
327
+ if (key === "sandbox" && tagName === "IFRAME") {
328
+ return true;
329
+ }
325
330
  return false;
326
331
  }
327
332
 
@@ -550,6 +555,7 @@ var ReactiveFlags = /* @__PURE__ */ ((ReactiveFlags2) => {
550
555
  const notifyBuffer = [];
551
556
  let batchDepth = 0;
552
557
  let activeSub = void 0;
558
+ let globalVersion = 0;
553
559
  let notifyIndex = 0;
554
560
  let notifyBufferLength = 0;
555
561
  function setActiveSub(sub) {
@@ -572,17 +578,18 @@ function link(dep, sub) {
572
578
  if (prevDep !== void 0 && prevDep.dep === dep) {
573
579
  return;
574
580
  }
575
- let nextDep = void 0;
576
- const recursedCheck = sub.flags & 4 /* RecursedCheck */;
577
- if (recursedCheck) {
578
- nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
579
- if (nextDep !== void 0 && nextDep.dep === dep) {
580
- sub.depsTail = nextDep;
581
- return;
582
- }
581
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
582
+ if (nextDep !== void 0 && nextDep.dep === dep) {
583
+ nextDep.version = globalVersion;
584
+ sub.depsTail = nextDep;
585
+ return;
583
586
  }
584
587
  const prevSub = dep.subsTail;
588
+ if (prevSub !== void 0 && prevSub.version === globalVersion && prevSub.sub === sub) {
589
+ return;
590
+ }
585
591
  const newLink = sub.depsTail = dep.subsTail = {
592
+ version: globalVersion,
586
593
  dep,
587
594
  sub,
588
595
  prevDep,
@@ -688,6 +695,7 @@ function propagate(link2) {
688
695
  } while (true);
689
696
  }
690
697
  function startTracking(sub) {
698
+ ++globalVersion;
691
699
  sub.depsTail = void 0;
692
700
  sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
693
701
  return setActiveSub(sub);
@@ -788,18 +796,12 @@ function shallowPropagate(link2) {
788
796
  } while (link2 !== void 0);
789
797
  }
790
798
  function isValidLink(checkLink, sub) {
791
- const depsTail = sub.depsTail;
792
- if (depsTail !== void 0) {
793
- let link2 = sub.deps;
794
- do {
795
- if (link2 === checkLink) {
796
- return true;
797
- }
798
- if (link2 === depsTail) {
799
- break;
800
- }
801
- link2 = link2.nextDep;
802
- } while (link2 !== void 0);
799
+ let link2 = sub.depsTail;
800
+ while (link2 !== void 0) {
801
+ if (link2 === checkLink) {
802
+ return true;
803
+ }
804
+ link2 = link2.prevDep;
803
805
  }
804
806
  return false;
805
807
  }
@@ -1039,7 +1041,7 @@ const arrayInstrumentations = {
1039
1041
  join(separator) {
1040
1042
  return reactiveReadArray(this).join(separator);
1041
1043
  },
1042
- // keys() iterator only reads `length`, no optimisation required
1044
+ // keys() iterator only reads `length`, no optimization required
1043
1045
  lastIndexOf(...args) {
1044
1046
  return searchProxy(this, "lastIndexOf", args);
1045
1047
  },
@@ -1091,7 +1093,7 @@ function iterator(self, method, wrapValue) {
1091
1093
  iter._next = iter.next;
1092
1094
  iter.next = () => {
1093
1095
  const result = iter._next();
1094
- if (result.value) {
1096
+ if (!result.done) {
1095
1097
  result.value = wrapValue(result.value);
1096
1098
  }
1097
1099
  return result;
@@ -1222,7 +1224,8 @@ class BaseReactiveHandler {
1222
1224
  return res;
1223
1225
  }
1224
1226
  if (isRef(res)) {
1225
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1227
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1228
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1226
1229
  }
1227
1230
  if (isObject(res)) {
1228
1231
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -1244,7 +1247,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1244
1247
  }
1245
1248
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1246
1249
  if (isOldValueReadonly) {
1247
- return false;
1250
+ {
1251
+ warn$2(
1252
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1253
+ target[key]
1254
+ );
1255
+ }
1256
+ return true;
1248
1257
  } else {
1249
1258
  oldValue.value = value;
1250
1259
  return true;
@@ -1389,7 +1398,7 @@ function createInstrumentations(readonly, shallow) {
1389
1398
  get size() {
1390
1399
  const target = this["__v_raw"];
1391
1400
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1392
- return Reflect.get(target, "size", target);
1401
+ return target.size;
1393
1402
  },
1394
1403
  has(key) {
1395
1404
  const target = this["__v_raw"];
@@ -2392,11 +2401,11 @@ function traverse(value, depth = Infinity, seen) {
2392
2401
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2393
2402
  return value;
2394
2403
  }
2395
- seen = seen || /* @__PURE__ */ new Set();
2396
- if (seen.has(value)) {
2404
+ seen = seen || /* @__PURE__ */ new Map();
2405
+ if ((seen.get(value) || 0) >= depth) {
2397
2406
  return value;
2398
2407
  }
2399
- seen.add(value);
2408
+ seen.set(value, depth);
2400
2409
  depth--;
2401
2410
  if (isRef(value)) {
2402
2411
  traverse(value.value, depth, seen);
@@ -2942,8 +2951,10 @@ function rerender(id, newRender) {
2942
2951
  instance.hmrRerender();
2943
2952
  } else {
2944
2953
  const i = instance;
2945
- i.renderCache = [];
2946
- i.effect.run();
2954
+ if (!(i.effect.flags & 1024)) {
2955
+ i.renderCache = [];
2956
+ i.effect.run();
2957
+ }
2947
2958
  }
2948
2959
  nextTick(() => {
2949
2960
  isHmrUpdating = false;
@@ -2956,7 +2967,12 @@ function reload(id, newComp) {
2956
2967
  newComp = normalizeClassComponent(newComp);
2957
2968
  updateComponentDef(record.initialDef, newComp);
2958
2969
  const instances = [...record.instances];
2959
- if (newComp.__vapor) {
2970
+ if (newComp.__vapor && !instances.some((i) => i.ceReload)) {
2971
+ for (const instance of instances) {
2972
+ if (instance.root && instance.root.ce && instance !== instance.root) {
2973
+ instance.root.ce._removeChildStyle(instance.type);
2974
+ }
2975
+ }
2960
2976
  for (const instance of instances) {
2961
2977
  instance.hmrReload(newComp);
2962
2978
  }
@@ -2985,7 +3001,10 @@ function reload(id, newComp) {
2985
3001
  if (parent.vapor) {
2986
3002
  parent.hmrRerender();
2987
3003
  } else {
2988
- parent.effect.run();
3004
+ if (!(parent.effect.flags & 1024)) {
3005
+ parent.renderCache = [];
3006
+ parent.effect.run();
3007
+ }
2989
3008
  }
2990
3009
  nextTick(() => {
2991
3010
  isHmrUpdating = false;
@@ -3095,7 +3114,6 @@ const devtoolsComponentRemoved = (component) => {
3095
3114
  _devtoolsComponentRemoved(component);
3096
3115
  }
3097
3116
  };
3098
- /*! #__NO_SIDE_EFFECTS__ */
3099
3117
  // @__NO_SIDE_EFFECTS__
3100
3118
  function createDevtoolsComponentHook(hook) {
3101
3119
  return (component) => {
@@ -3809,9 +3827,6 @@ const TeleportImpl = {
3809
3827
  insert(mainAnchor, container, anchor);
3810
3828
  const mount = (container2, anchor2) => {
3811
3829
  if (shapeFlag & 16) {
3812
- if (parentComponent && parentComponent.isCE) {
3813
- parentComponent.ce._teleportTarget = container2;
3814
- }
3815
3830
  mountChildren(
3816
3831
  children,
3817
3832
  container2,
@@ -3833,6 +3848,9 @@ const TeleportImpl = {
3833
3848
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3834
3849
  namespace = "mathml";
3835
3850
  }
3851
+ if (parentComponent && parentComponent.isCE) {
3852
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3853
+ }
3836
3854
  if (!disabled) {
3837
3855
  mount(target, targetAnchor);
3838
3856
  updateCssVars(n2, false);
@@ -4033,26 +4051,34 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
4033
4051
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
4034
4052
  o: { nextSibling, parentNode, querySelector, insert, createText }
4035
4053
  }, hydrateChildren) {
4054
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
4055
+ vnode2.anchor = hydrateChildren(
4056
+ nextSibling(node2),
4057
+ vnode2,
4058
+ parentNode(node2),
4059
+ parentComponent,
4060
+ parentSuspense,
4061
+ slotScopeIds,
4062
+ optimized
4063
+ );
4064
+ vnode2.targetStart = targetStart;
4065
+ vnode2.targetAnchor = targetAnchor;
4066
+ }
4036
4067
  const target = vnode.target = resolveTarget(
4037
4068
  vnode.props,
4038
4069
  querySelector
4039
4070
  );
4071
+ const disabled = isTeleportDisabled(vnode.props);
4040
4072
  if (target) {
4041
- const disabled = isTeleportDisabled(vnode.props);
4042
4073
  const targetNode = target._lpa || target.firstChild;
4043
4074
  if (vnode.shapeFlag & 16) {
4044
4075
  if (disabled) {
4045
- vnode.anchor = hydrateChildren(
4046
- nextSibling(node),
4076
+ hydrateDisabledTeleport(
4077
+ node,
4047
4078
  vnode,
4048
- parentNode(node),
4049
- parentComponent,
4050
- parentSuspense,
4051
- slotScopeIds,
4052
- optimized
4079
+ targetNode,
4080
+ targetNode && nextSibling(targetNode)
4053
4081
  );
4054
- vnode.targetStart = targetNode;
4055
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
4056
4082
  } else {
4057
4083
  vnode.anchor = nextSibling(node);
4058
4084
  let targetAnchor = targetNode;
@@ -4083,6 +4109,10 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
4083
4109
  }
4084
4110
  }
4085
4111
  updateCssVars(vnode, disabled);
4112
+ } else if (disabled) {
4113
+ if (vnode.shapeFlag & 16) {
4114
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
4115
+ }
4086
4116
  }
4087
4117
  return vnode.anchor && nextSibling(vnode.anchor);
4088
4118
  }
@@ -4123,7 +4153,7 @@ function useTransitionState() {
4123
4153
  isMounted: false,
4124
4154
  isLeaving: false,
4125
4155
  isUnmounting: false,
4126
- leavingVNodes: /* @__PURE__ */ new Map()
4156
+ leavingNodes: /* @__PURE__ */ new Map()
4127
4157
  };
4128
4158
  onMounted(() => {
4129
4159
  state.isMounted = true;
@@ -4155,7 +4185,7 @@ const BaseTransitionPropsValidators = {
4155
4185
  onAppearCancelled: TransitionHookValidator
4156
4186
  };
4157
4187
  const recursiveGetSubtree = (instance) => {
4158
- const subTree = instance.subTree;
4188
+ const subTree = instance.type.__vapor ? instance.block : instance.subTree;
4159
4189
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
4160
4190
  };
4161
4191
  const BaseTransitionImpl = {
@@ -4172,9 +4202,7 @@ const BaseTransitionImpl = {
4172
4202
  const child = findNonCommentChild(children);
4173
4203
  const rawProps = toRaw(props);
4174
4204
  const { mode } = rawProps;
4175
- if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
4176
- warn$1(`invalid <transition> mode: ${mode}`);
4177
- }
4205
+ checkTransitionMode(mode);
4178
4206
  if (state.isLeaving) {
4179
4207
  return emptyPlaceholder(child);
4180
4208
  }
@@ -4194,7 +4222,7 @@ const BaseTransitionImpl = {
4194
4222
  setTransitionHooks(innerChild, enterHooks);
4195
4223
  }
4196
4224
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
4197
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
4225
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
4198
4226
  let leavingHooks = resolveTransitionHooks(
4199
4227
  oldInnerChild,
4200
4228
  rawProps,
@@ -4266,15 +4294,53 @@ function findNonCommentChild(children) {
4266
4294
  }
4267
4295
  const BaseTransition = BaseTransitionImpl;
4268
4296
  function getLeavingNodesForType(state, vnode) {
4269
- const { leavingVNodes } = state;
4270
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
4297
+ const { leavingNodes } = state;
4298
+ let leavingVNodesCache = leavingNodes.get(vnode.type);
4271
4299
  if (!leavingVNodesCache) {
4272
4300
  leavingVNodesCache = /* @__PURE__ */ Object.create(null);
4273
- leavingVNodes.set(vnode.type, leavingVNodesCache);
4301
+ leavingNodes.set(vnode.type, leavingVNodesCache);
4274
4302
  }
4275
4303
  return leavingVNodesCache;
4276
4304
  }
4277
4305
  function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4306
+ const key = String(vnode.key);
4307
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
4308
+ const context = {
4309
+ setLeavingNodeCache: () => {
4310
+ leavingVNodesCache[key] = vnode;
4311
+ },
4312
+ unsetLeavingNodeCache: () => {
4313
+ if (leavingVNodesCache[key] === vnode) {
4314
+ delete leavingVNodesCache[key];
4315
+ }
4316
+ },
4317
+ earlyRemove: () => {
4318
+ const leavingVNode = leavingVNodesCache[key];
4319
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
4320
+ leavingVNode.el[leaveCbKey]();
4321
+ }
4322
+ },
4323
+ cloneHooks: (vnode2) => {
4324
+ const hooks = resolveTransitionHooks(
4325
+ vnode2,
4326
+ props,
4327
+ state,
4328
+ instance,
4329
+ postClone
4330
+ );
4331
+ if (postClone) postClone(hooks);
4332
+ return hooks;
4333
+ }
4334
+ };
4335
+ return baseResolveTransitionHooks(context, props, state, instance);
4336
+ }
4337
+ function baseResolveTransitionHooks(context, props, state, instance) {
4338
+ const {
4339
+ setLeavingNodeCache,
4340
+ unsetLeavingNodeCache,
4341
+ earlyRemove,
4342
+ cloneHooks
4343
+ } = context;
4278
4344
  const {
4279
4345
  appear,
4280
4346
  mode,
@@ -4292,8 +4358,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4292
4358
  onAfterAppear,
4293
4359
  onAppearCancelled
4294
4360
  } = props;
4295
- const key = String(vnode.key);
4296
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
4297
4361
  const callHook = (hook, args) => {
4298
4362
  hook && callWithAsyncErrorHandling(
4299
4363
  hook,
@@ -4329,10 +4393,7 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4329
4393
  /* cancelled */
4330
4394
  );
4331
4395
  }
4332
- const leavingVNode = leavingVNodesCache[key];
4333
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
4334
- leavingVNode.el[leaveCbKey]();
4335
- }
4396
+ earlyRemove();
4336
4397
  callHook(hook, [el]);
4337
4398
  },
4338
4399
  enter(el) {
@@ -4369,7 +4430,6 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4369
4430
  }
4370
4431
  },
4371
4432
  leave(el, remove) {
4372
- const key2 = String(vnode.key);
4373
4433
  if (el[enterCbKey$1]) {
4374
4434
  el[enterCbKey$1](
4375
4435
  true
@@ -4391,27 +4451,17 @@ function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4391
4451
  callHook(onAfterLeave, [el]);
4392
4452
  }
4393
4453
  el[leaveCbKey] = void 0;
4394
- if (leavingVNodesCache[key2] === vnode) {
4395
- delete leavingVNodesCache[key2];
4396
- }
4454
+ unsetLeavingNodeCache(el);
4397
4455
  };
4398
- leavingVNodesCache[key2] = vnode;
4456
+ setLeavingNodeCache(el);
4399
4457
  if (onLeave) {
4400
4458
  callAsyncHook(onLeave, [el, done]);
4401
4459
  } else {
4402
4460
  done();
4403
4461
  }
4404
4462
  },
4405
- clone(vnode2) {
4406
- const hooks2 = resolveTransitionHooks(
4407
- vnode2,
4408
- props,
4409
- state,
4410
- instance,
4411
- postClone
4412
- );
4413
- if (postClone) postClone(hooks2);
4414
- return hooks2;
4463
+ clone(node) {
4464
+ return cloneHooks(node);
4415
4465
  }
4416
4466
  };
4417
4467
  return hooks;
@@ -4445,8 +4495,15 @@ function getInnerChild$1(vnode) {
4445
4495
  }
4446
4496
  function setTransitionHooks(vnode, hooks) {
4447
4497
  if (vnode.shapeFlag & 6 && vnode.component) {
4448
- vnode.transition = hooks;
4449
- setTransitionHooks(vnode.component.subTree, hooks);
4498
+ if (vnode.type.__vapor) {
4499
+ getVaporInterface(vnode.component, vnode).setTransitionHooks(
4500
+ vnode.component,
4501
+ hooks
4502
+ );
4503
+ } else {
4504
+ vnode.transition = hooks;
4505
+ setTransitionHooks(vnode.component.subTree, hooks);
4506
+ }
4450
4507
  } else if (vnode.shapeFlag & 128) {
4451
4508
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4452
4509
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4476,8 +4533,12 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4476
4533
  }
4477
4534
  return ret;
4478
4535
  }
4536
+ function checkTransitionMode(mode) {
4537
+ if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
4538
+ warn$1(`invalid <transition> mode: ${mode}`);
4539
+ }
4540
+ }
4479
4541
 
4480
- /*! #__NO_SIDE_EFFECTS__ */
4481
4542
  // @__NO_SIDE_EFFECTS__
4482
4543
  function defineComponent(options, extraOptions) {
4483
4544
  return isFunction(options) ? (
@@ -4530,6 +4591,7 @@ function useTemplateRef(key) {
4530
4591
  return ret;
4531
4592
  }
4532
4593
 
4594
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
4533
4595
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4534
4596
  if (isArray(rawRef)) {
4535
4597
  rawRef.forEach(
@@ -4561,28 +4623,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4561
4623
  const oldRef = oldRawRef && oldRawRef.r;
4562
4624
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4563
4625
  const setupState = owner.setupState;
4564
- const rawSetupState = toRaw(setupState);
4565
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4566
- {
4567
- if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4568
- warn$1(
4569
- `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
4570
- );
4571
- }
4572
- if (knownTemplateRefs.has(rawSetupState[key])) {
4573
- return false;
4574
- }
4575
- }
4576
- return hasOwn(rawSetupState, key);
4626
+ const canSetSetupRef = createCanSetSetupRefChecker(setupState);
4627
+ const canSetRef = (ref2) => {
4628
+ return !knownTemplateRefs.has(ref2);
4577
4629
  };
4578
4630
  if (oldRef != null && oldRef !== ref) {
4631
+ invalidatePendingSetRef(oldRawRef);
4579
4632
  if (isString(oldRef)) {
4580
4633
  refs[oldRef] = null;
4581
4634
  if (canSetSetupRef(oldRef)) {
4582
4635
  setupState[oldRef] = null;
4583
4636
  }
4584
4637
  } else if (isRef(oldRef)) {
4585
- oldRef.value = null;
4638
+ if (canSetRef(oldRef)) {
4639
+ oldRef.value = null;
4640
+ }
4641
+ const oldRawRefAtom = oldRawRef;
4642
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4586
4643
  }
4587
4644
  }
4588
4645
  if (isFunction(ref)) {
@@ -4593,7 +4650,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4593
4650
  if (_isString || _isRef) {
4594
4651
  const doSet = () => {
4595
4652
  if (rawRef.f) {
4596
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4653
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4597
4654
  if (isUnmount) {
4598
4655
  isArray(existing) && remove(existing, refValue);
4599
4656
  } else {
@@ -4604,8 +4661,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4604
4661
  setupState[ref] = refs[ref];
4605
4662
  }
4606
4663
  } else {
4607
- ref.value = [refValue];
4608
- if (rawRef.k) refs[rawRef.k] = ref.value;
4664
+ const newVal = [refValue];
4665
+ if (canSetRef(ref)) {
4666
+ ref.value = newVal;
4667
+ }
4668
+ if (rawRef.k) refs[rawRef.k] = newVal;
4609
4669
  }
4610
4670
  } else if (!existing.includes(refValue)) {
4611
4671
  existing.push(refValue);
@@ -4617,15 +4677,23 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4617
4677
  setupState[ref] = value;
4618
4678
  }
4619
4679
  } else if (_isRef) {
4620
- ref.value = value;
4680
+ if (canSetRef(ref)) {
4681
+ ref.value = value;
4682
+ }
4621
4683
  if (rawRef.k) refs[rawRef.k] = value;
4622
4684
  } else {
4623
4685
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
4624
4686
  }
4625
4687
  };
4626
4688
  if (value) {
4627
- queuePostRenderEffect(doSet, -1, parentSuspense);
4689
+ const job = () => {
4690
+ doSet();
4691
+ pendingSetRefMap.delete(rawRef);
4692
+ };
4693
+ pendingSetRefMap.set(rawRef, job);
4694
+ queuePostRenderEffect(job, -1, parentSuspense);
4628
4695
  } else {
4696
+ invalidatePendingSetRef(rawRef);
4629
4697
  doSet();
4630
4698
  }
4631
4699
  } else {
@@ -4633,6 +4701,29 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4633
4701
  }
4634
4702
  }
4635
4703
  }
4704
+ function createCanSetSetupRefChecker(setupState) {
4705
+ const rawSetupState = toRaw(setupState);
4706
+ return setupState === void 0 || setupState === EMPTY_OBJ ? NO : (key) => {
4707
+ {
4708
+ if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4709
+ warn$1(
4710
+ `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
4711
+ );
4712
+ }
4713
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4714
+ return false;
4715
+ }
4716
+ }
4717
+ return hasOwn(rawSetupState, key);
4718
+ };
4719
+ }
4720
+ function invalidatePendingSetRef(rawRef) {
4721
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
4722
+ if (pendingSetRef) {
4723
+ pendingSetRef.flags |= 4;
4724
+ pendingSetRefMap.delete(rawRef);
4725
+ }
4726
+ }
4636
4727
 
4637
4728
  let hasLoggedMismatchError = false;
4638
4729
  const logMismatchError = () => {
@@ -4729,7 +4820,7 @@ function createHydrationFunctions(rendererInternals) {
4729
4820
  }
4730
4821
  break;
4731
4822
  case Comment:
4732
- if (isTemplateNode(node)) {
4823
+ if (isTemplateNode$1(node)) {
4733
4824
  nextNode = nextSibling(node);
4734
4825
  replaceNode(
4735
4826
  vnode.el = node.content.firstChild,
@@ -4777,9 +4868,15 @@ function createHydrationFunctions(rendererInternals) {
4777
4868
  );
4778
4869
  }
4779
4870
  break;
4871
+ case VaporSlot:
4872
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(
4873
+ vnode,
4874
+ node
4875
+ );
4876
+ break;
4780
4877
  default:
4781
4878
  if (shapeFlag & 1) {
4782
- if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
4879
+ if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode$1(node)) {
4783
4880
  nextNode = onMismatch();
4784
4881
  } else {
4785
4882
  nextNode = hydrateElement(
@@ -4792,9 +4889,6 @@ function createHydrationFunctions(rendererInternals) {
4792
4889
  );
4793
4890
  }
4794
4891
  } else if (shapeFlag & 6) {
4795
- if (vnode.type.__vapor) {
4796
- throw new Error("Vapor component hydration is not supported yet.");
4797
- }
4798
4892
  vnode.slotScopeIds = slotScopeIds;
4799
4893
  const container = parentNode(node);
4800
4894
  if (isFragmentStart) {
@@ -4804,15 +4898,25 @@ function createHydrationFunctions(rendererInternals) {
4804
4898
  } else {
4805
4899
  nextNode = nextSibling(node);
4806
4900
  }
4807
- mountComponent(
4808
- vnode,
4809
- container,
4810
- null,
4811
- parentComponent,
4812
- parentSuspense,
4813
- getContainerType(container),
4814
- optimized
4815
- );
4901
+ if (vnode.type.__vapor) {
4902
+ getVaporInterface(parentComponent, vnode).hydrate(
4903
+ vnode,
4904
+ node,
4905
+ container,
4906
+ null,
4907
+ parentComponent
4908
+ );
4909
+ } else {
4910
+ mountComponent(
4911
+ vnode,
4912
+ container,
4913
+ null,
4914
+ parentComponent,
4915
+ parentSuspense,
4916
+ getContainerType(container),
4917
+ optimized
4918
+ );
4919
+ }
4816
4920
  if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4817
4921
  let subTree;
4818
4922
  if (isFragmentStart) {
@@ -4869,7 +4973,7 @@ function createHydrationFunctions(rendererInternals) {
4869
4973
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4870
4974
  }
4871
4975
  let needCallTransitionHooks = false;
4872
- if (isTemplateNode(el)) {
4976
+ if (isTemplateNode$1(el)) {
4873
4977
  needCallTransitionHooks = needTransition(
4874
4978
  null,
4875
4979
  // no need check parentSuspense in hydration
@@ -4897,7 +5001,7 @@ function createHydrationFunctions(rendererInternals) {
4897
5001
  );
4898
5002
  let hasWarned = false;
4899
5003
  while (next) {
4900
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
5004
+ if (!isMismatchAllowed(el, 1)) {
4901
5005
  if (!hasWarned) {
4902
5006
  warn$1(
4903
5007
  `Hydration children mismatch on`,
@@ -4918,14 +5022,16 @@ Server rendered element contains more child nodes than client vdom.`
4918
5022
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4919
5023
  clientText = clientText.slice(1);
4920
5024
  }
4921
- if (el.textContent !== clientText) {
4922
- if (!isMismatchAllowed(el, 0 /* TEXT */)) {
5025
+ const { textContent } = el;
5026
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
5027
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
5028
+ if (!isMismatchAllowed(el, 0)) {
4923
5029
  warn$1(
4924
5030
  `Hydration text content mismatch on`,
4925
5031
  el,
4926
5032
  `
4927
- - rendered on server: ${el.textContent}
4928
- - expected on client: ${vnode.children}`
5033
+ - rendered on server: ${textContent}
5034
+ - expected on client: ${clientText}`
4929
5035
  );
4930
5036
  logMismatchError();
4931
5037
  }
@@ -5001,7 +5107,7 @@ Server rendered element contains more child nodes than client vdom.`
5001
5107
  } else if (isText && !vnode.children) {
5002
5108
  insert(vnode.el = createText(""), container);
5003
5109
  } else {
5004
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5110
+ if (!isMismatchAllowed(container, 1)) {
5005
5111
  if (!hasWarned) {
5006
5112
  warn$1(
5007
5113
  `Hydration children mismatch on`,
@@ -5051,7 +5157,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5051
5157
  }
5052
5158
  };
5053
5159
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5054
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5160
+ if (!isMismatchAllowed(node.parentElement, 1)) {
5055
5161
  warn$1(
5056
5162
  `Hydration node mismatch:
5057
5163
  - rendered on server:`,
@@ -5124,11 +5230,11 @@ Server rendered element contains fewer child nodes than client vdom.`
5124
5230
  parent = parent.parent;
5125
5231
  }
5126
5232
  };
5127
- const isTemplateNode = (node) => {
5128
- return node.nodeType === 1 && node.tagName === "TEMPLATE";
5129
- };
5130
5233
  return [hydrate, hydrateNode];
5131
5234
  }
5235
+ const isTemplateNode$1 = (node) => {
5236
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
5237
+ };
5132
5238
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5133
5239
  let mismatchType;
5134
5240
  let mismatchKey;
@@ -5143,7 +5249,7 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5143
5249
  }
5144
5250
  expected = normalizeClass(clientValue);
5145
5251
  if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
5146
- mismatchType = 2 /* CLASS */;
5252
+ mismatchType = 2;
5147
5253
  mismatchKey = `class`;
5148
5254
  }
5149
5255
  } else if (key === "style") {
@@ -5162,31 +5268,43 @@ function propHasMismatch(el, key, clientValue, vnode, instance) {
5162
5268
  resolveCssVars(instance, vnode, expectedMap);
5163
5269
  }
5164
5270
  if (!isMapEqual(actualMap, expectedMap)) {
5165
- mismatchType = 3 /* STYLE */;
5271
+ mismatchType = 3;
5166
5272
  mismatchKey = "style";
5167
5273
  }
5168
- } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5169
- if (isBooleanAttr(key)) {
5170
- actual = el.hasAttribute(key);
5171
- expected = includeBooleanAttr(clientValue);
5172
- } else if (clientValue == null) {
5173
- actual = el.hasAttribute(key);
5174
- expected = false;
5175
- } else {
5176
- if (el.hasAttribute(key)) {
5177
- actual = el.getAttribute(key);
5178
- } else if (key === "value" && el.tagName === "TEXTAREA") {
5179
- actual = el.value;
5180
- } else {
5181
- actual = false;
5182
- }
5183
- expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
5184
- }
5274
+ } else if (isValidHtmlOrSvgAttribute(el, key)) {
5275
+ ({ actual, expected } = getAttributeMismatch(el, key, clientValue));
5185
5276
  if (actual !== expected) {
5186
- mismatchType = 4 /* ATTRIBUTE */;
5277
+ mismatchType = 4;
5187
5278
  mismatchKey = key;
5188
5279
  }
5189
5280
  }
5281
+ return warnPropMismatch(el, mismatchKey, mismatchType, actual, expected);
5282
+ }
5283
+ function getAttributeMismatch(el, key, clientValue) {
5284
+ let actual;
5285
+ let expected;
5286
+ if (isBooleanAttr(key)) {
5287
+ actual = el.hasAttribute(key);
5288
+ expected = includeBooleanAttr(clientValue);
5289
+ } else if (clientValue == null) {
5290
+ actual = el.hasAttribute(key);
5291
+ expected = false;
5292
+ } else {
5293
+ if (el.hasAttribute(key)) {
5294
+ actual = el.getAttribute(key);
5295
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
5296
+ actual = el.value;
5297
+ } else {
5298
+ actual = false;
5299
+ }
5300
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
5301
+ }
5302
+ return { actual, expected };
5303
+ }
5304
+ function isValidHtmlOrSvgAttribute(el, key) {
5305
+ return el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key));
5306
+ }
5307
+ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
5190
5308
  if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
5191
5309
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
5192
5310
  const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
@@ -5258,14 +5376,14 @@ function resolveCssVars(instance, vnode, expectedMap) {
5258
5376
  }
5259
5377
  const allowMismatchAttr = "data-allow-mismatch";
5260
5378
  const MismatchTypeString = {
5261
- [0 /* TEXT */]: "text",
5262
- [1 /* CHILDREN */]: "children",
5263
- [2 /* CLASS */]: "class",
5264
- [3 /* STYLE */]: "style",
5265
- [4 /* ATTRIBUTE */]: "attribute"
5379
+ [0]: "text",
5380
+ [1]: "children",
5381
+ [2]: "class",
5382
+ [3]: "style",
5383
+ [4]: "attribute"
5266
5384
  };
5267
5385
  function isMismatchAllowed(el, allowedType) {
5268
- if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
5386
+ if (allowedType === 0 || allowedType === 1) {
5269
5387
  while (el && !el.hasAttribute(allowMismatchAttr)) {
5270
5388
  el = el.parentElement;
5271
5389
  }
@@ -5277,7 +5395,7 @@ function isMismatchAllowed(el, allowedType) {
5277
5395
  return true;
5278
5396
  } else {
5279
5397
  const list = allowedAttr.split(",");
5280
- if (allowedType === 0 /* TEXT */ && list.includes("children")) {
5398
+ if (allowedType === 0 && list.includes("children")) {
5281
5399
  return true;
5282
5400
  }
5283
5401
  return list.includes(MismatchTypeString[allowedType]);
@@ -5334,7 +5452,9 @@ const hydrateOnInteraction = (interactions = []) => (hydrate, forEach) => {
5334
5452
  hasHydrated = true;
5335
5453
  teardown();
5336
5454
  hydrate();
5337
- e.target.dispatchEvent(new e.constructor(e.type, e));
5455
+ if (!(`$evt${e.type}` in e.target)) {
5456
+ e.target.dispatchEvent(new e.constructor(e.type, e));
5457
+ }
5338
5458
  }
5339
5459
  };
5340
5460
  const teardown = () => {
@@ -5376,104 +5496,46 @@ function forEachElement(node, cb) {
5376
5496
  }
5377
5497
 
5378
5498
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
5379
- /*! #__NO_SIDE_EFFECTS__ */
5380
5499
  // @__NO_SIDE_EFFECTS__
5381
5500
  function defineAsyncComponent(source) {
5382
- if (isFunction(source)) {
5383
- source = { loader: source };
5384
- }
5385
5501
  const {
5386
- loader,
5387
- loadingComponent,
5388
- errorComponent,
5389
- delay = 200,
5390
- hydrate: hydrateStrategy,
5391
- timeout,
5392
- // undefined = never times out
5393
- suspensible = true,
5394
- onError: userOnError
5395
- } = source;
5396
- let pendingRequest = null;
5397
- let resolvedComp;
5398
- let retries = 0;
5399
- const retry = () => {
5400
- retries++;
5401
- pendingRequest = null;
5402
- return load();
5403
- };
5404
- const load = () => {
5405
- let thisRequest;
5406
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
5407
- err = err instanceof Error ? err : new Error(String(err));
5408
- if (userOnError) {
5409
- return new Promise((resolve, reject) => {
5410
- const userRetry = () => resolve(retry());
5411
- const userFail = () => reject(err);
5412
- userOnError(err, userRetry, userFail, retries + 1);
5413
- });
5414
- } else {
5415
- throw err;
5416
- }
5417
- }).then((comp) => {
5418
- if (thisRequest !== pendingRequest && pendingRequest) {
5419
- return pendingRequest;
5420
- }
5421
- if (!comp) {
5422
- warn$1(
5423
- `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
5424
- );
5425
- }
5426
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
5427
- comp = comp.default;
5428
- }
5429
- if (comp && !isObject(comp) && !isFunction(comp)) {
5430
- throw new Error(`Invalid async component load result: ${comp}`);
5431
- }
5432
- resolvedComp = comp;
5433
- return comp;
5434
- }));
5435
- };
5502
+ load,
5503
+ getResolvedComp,
5504
+ setPendingRequest,
5505
+ source: {
5506
+ loadingComponent,
5507
+ errorComponent,
5508
+ delay,
5509
+ hydrate: hydrateStrategy,
5510
+ timeout,
5511
+ suspensible = true
5512
+ }
5513
+ } = createAsyncComponentContext(source);
5436
5514
  return defineComponent({
5437
5515
  name: "AsyncComponentWrapper",
5438
5516
  __asyncLoader: load,
5439
5517
  __asyncHydrate(el, instance, hydrate) {
5440
- let patched = false;
5441
- const doHydrate = hydrateStrategy ? () => {
5442
- const performHydrate = () => {
5443
- if (patched) {
5444
- warn$1(
5445
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
5446
- );
5447
- return;
5448
- }
5449
- hydrate();
5450
- };
5451
- const teardown = hydrateStrategy(
5452
- performHydrate,
5453
- (cb) => forEachElement(el, cb)
5454
- );
5455
- if (teardown) {
5456
- (instance.bum || (instance.bum = [])).push(teardown);
5457
- }
5458
- (instance.u || (instance.u = [])).push(() => patched = true);
5459
- } : hydrate;
5460
- if (resolvedComp) {
5461
- doHydrate();
5462
- } else {
5463
- load().then(() => !instance.isUnmounted && doHydrate());
5464
- }
5518
+ performAsyncHydrate(
5519
+ el,
5520
+ instance,
5521
+ hydrate,
5522
+ getResolvedComp,
5523
+ load,
5524
+ hydrateStrategy
5525
+ );
5465
5526
  },
5466
5527
  get __asyncResolved() {
5467
- return resolvedComp;
5528
+ return getResolvedComp();
5468
5529
  },
5469
5530
  setup() {
5470
5531
  const instance = currentInstance;
5471
5532
  markAsyncBoundary(instance);
5533
+ let resolvedComp = getResolvedComp();
5472
5534
  if (resolvedComp) {
5473
5535
  return () => createInnerComp(resolvedComp, instance);
5474
5536
  }
5475
5537
  const onError = (err) => {
5476
- pendingRequest = null;
5538
+ setPendingRequest(null);
5477
5539
  handleError(
5478
5540
  err,
5479
5541
  instance,
@@ -5491,25 +5553,11 @@ function defineAsyncComponent(source) {
5491
5553
  }) : null;
5492
5554
  });
5493
5555
  }
5494
- const loaded = ref(false);
5495
- const error = ref();
5496
- const delayed = ref(!!delay);
5497
- if (delay) {
5498
- setTimeout(() => {
5499
- delayed.value = false;
5500
- }, delay);
5501
- }
5502
- if (timeout != null) {
5503
- setTimeout(() => {
5504
- if (!loaded.value && !error.value) {
5505
- const err = new Error(
5506
- `Async component timed out after ${timeout}ms.`
5507
- );
5508
- onError(err);
5509
- error.value = err;
5510
- }
5511
- }, timeout);
5512
- }
5556
+ const { loaded, error, delayed } = useAsyncComponentState(
5557
+ delay,
5558
+ timeout,
5559
+ onError
5560
+ );
5513
5561
  load().then(() => {
5514
5562
  loaded.value = true;
5515
5563
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
@@ -5520,6 +5568,7 @@ function defineAsyncComponent(source) {
5520
5568
  error.value = err;
5521
5569
  });
5522
5570
  return () => {
5571
+ resolvedComp = getResolvedComp();
5523
5572
  if (loaded.value && resolvedComp) {
5524
5573
  return createInnerComp(resolvedComp, instance);
5525
5574
  } else if (error.value && errorComponent) {
@@ -5527,7 +5576,10 @@ function defineAsyncComponent(source) {
5527
5576
  error: error.value
5528
5577
  });
5529
5578
  } else if (loadingComponent && !delayed.value) {
5530
- return createVNode(loadingComponent);
5579
+ return createInnerComp(
5580
+ loadingComponent,
5581
+ instance
5582
+ );
5531
5583
  }
5532
5584
  };
5533
5585
  }
@@ -5541,112 +5593,168 @@ function createInnerComp(comp, parent) {
5541
5593
  delete parent.vnode.ce;
5542
5594
  return vnode;
5543
5595
  }
5544
-
5545
- const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
5546
- const KeepAliveImpl = {
5547
- name: `KeepAlive`,
5548
- // Marker for special handling inside the renderer. We are not using a ===
5549
- // check directly on KeepAlive in the renderer, because importing it directly
5550
- // would prevent it from being tree-shaken.
5551
- __isKeepAlive: true,
5552
- props: {
5553
- include: [String, RegExp, Array],
5554
- exclude: [String, RegExp, Array],
5555
- max: [String, Number]
5556
- },
5557
- setup(props, { slots }) {
5558
- const keepAliveInstance = getCurrentInstance();
5559
- const sharedContext = keepAliveInstance.ctx;
5560
- if (!sharedContext.renderer) {
5561
- return () => {
5562
- const children = slots.default && slots.default();
5563
- return children && children.length === 1 ? children[0] : children;
5564
- };
5565
- }
5566
- const cache = /* @__PURE__ */ new Map();
5567
- const keys = /* @__PURE__ */ new Set();
5568
- let current = null;
5569
- {
5570
- keepAliveInstance.__v_cache = cache;
5571
- }
5572
- const parentSuspense = keepAliveInstance.suspense;
5573
- const {
5574
- renderer: {
5575
- p: patch,
5576
- m: move,
5577
- um: _unmount,
5578
- o: { createElement }
5596
+ function createAsyncComponentContext(source) {
5597
+ if (isFunction(source)) {
5598
+ source = { loader: source };
5599
+ }
5600
+ const { loader, onError: userOnError } = source;
5601
+ let pendingRequest = null;
5602
+ let resolvedComp;
5603
+ let retries = 0;
5604
+ const retry = () => {
5605
+ retries++;
5606
+ pendingRequest = null;
5607
+ return load();
5608
+ };
5609
+ const load = () => {
5610
+ let thisRequest;
5611
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
5612
+ err = err instanceof Error ? err : new Error(String(err));
5613
+ if (userOnError) {
5614
+ return new Promise((resolve, reject) => {
5615
+ const userRetry = () => resolve(retry());
5616
+ const userFail = () => reject(err);
5617
+ userOnError(err, userRetry, userFail, retries + 1);
5618
+ });
5619
+ } else {
5620
+ throw err;
5621
+ }
5622
+ }).then((comp) => {
5623
+ if (thisRequest !== pendingRequest && pendingRequest) {
5624
+ return pendingRequest;
5579
5625
  }
5580
- } = sharedContext;
5626
+ if (!comp) {
5627
+ warn$1(
5628
+ `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
5629
+ );
5630
+ }
5631
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
5632
+ comp = comp.default;
5633
+ }
5634
+ if (comp && !isObject(comp) && !isFunction(comp)) {
5635
+ throw new Error(`Invalid async component load result: ${comp}`);
5636
+ }
5637
+ resolvedComp = comp;
5638
+ return comp;
5639
+ }));
5640
+ };
5641
+ return {
5642
+ load,
5643
+ source,
5644
+ getResolvedComp: () => resolvedComp,
5645
+ setPendingRequest: (request) => pendingRequest = request
5646
+ };
5647
+ }
5648
+ const useAsyncComponentState = (delay, timeout, onError) => {
5649
+ const loaded = ref(false);
5650
+ const error = ref();
5651
+ const delayed = ref(!!delay);
5652
+ if (delay) {
5653
+ setTimeout(() => {
5654
+ delayed.value = false;
5655
+ }, delay);
5656
+ }
5657
+ if (timeout != null) {
5658
+ setTimeout(() => {
5659
+ if (!loaded.value && !error.value) {
5660
+ const err = new Error(`Async component timed out after ${timeout}ms.`);
5661
+ onError(err);
5662
+ error.value = err;
5663
+ }
5664
+ }, timeout);
5665
+ }
5666
+ return { loaded, error, delayed };
5667
+ };
5668
+ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
5669
+ let patched = false;
5670
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5671
+ const performHydrate = () => {
5672
+ if (patched) {
5673
+ {
5674
+ const resolvedComp = getResolvedComp();
5675
+ warn$1(
5676
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
5677
+ );
5678
+ }
5679
+ return;
5680
+ }
5681
+ hydrate();
5682
+ };
5683
+ const doHydrate = hydrateStrategy ? () => {
5684
+ const teardown = hydrateStrategy(
5685
+ performHydrate,
5686
+ (cb) => forEachElement(el, cb)
5687
+ );
5688
+ if (teardown) {
5689
+ (instance.bum || (instance.bum = [])).push(teardown);
5690
+ }
5691
+ } : performHydrate;
5692
+ if (getResolvedComp()) {
5693
+ doHydrate();
5694
+ } else {
5695
+ load().then(() => !instance.isUnmounted && doHydrate());
5696
+ }
5697
+ }
5698
+
5699
+ const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
5700
+ const KeepAliveImpl = {
5701
+ name: `KeepAlive`,
5702
+ // Marker for special handling inside the renderer. We are not using a ===
5703
+ // check directly on KeepAlive in the renderer, because importing it directly
5704
+ // would prevent it from being tree-shaken.
5705
+ __isKeepAlive: true,
5706
+ props: {
5707
+ include: [String, RegExp, Array],
5708
+ exclude: [String, RegExp, Array],
5709
+ max: [String, Number]
5710
+ },
5711
+ setup(props, { slots }) {
5712
+ const keepAliveInstance = getCurrentInstance();
5713
+ const sharedContext = keepAliveInstance.ctx;
5714
+ if (!sharedContext.renderer) {
5715
+ return () => {
5716
+ const children = slots.default && slots.default();
5717
+ return children && children.length === 1 ? children[0] : children;
5718
+ };
5719
+ }
5720
+ const cache = /* @__PURE__ */ new Map();
5721
+ const keys = /* @__PURE__ */ new Set();
5722
+ let current = null;
5723
+ {
5724
+ keepAliveInstance.__v_cache = cache;
5725
+ }
5726
+ const parentSuspense = keepAliveInstance.suspense;
5727
+ const { renderer } = sharedContext;
5728
+ const {
5729
+ um: _unmount,
5730
+ o: { createElement }
5731
+ } = renderer;
5581
5732
  const storageContainer = createElement("div");
5733
+ sharedContext.getStorageContainer = () => storageContainer;
5734
+ sharedContext.getCachedComponent = (vnode) => {
5735
+ const key = vnode.key == null ? vnode.type : vnode.key;
5736
+ return cache.get(key);
5737
+ };
5582
5738
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
5583
- const instance = vnode.component;
5584
- move(
5739
+ activate(
5585
5740
  vnode,
5586
5741
  container,
5587
5742
  anchor,
5588
- 0,
5743
+ renderer,
5589
5744
  keepAliveInstance,
5590
- parentSuspense
5591
- );
5592
- patch(
5593
- instance.vnode,
5594
- vnode,
5595
- container,
5596
- anchor,
5597
- instance,
5598
5745
  parentSuspense,
5599
5746
  namespace,
5600
- vnode.slotScopeIds,
5601
5747
  optimized
5602
5748
  );
5603
- queuePostRenderEffect(
5604
- () => {
5605
- instance.isDeactivated = false;
5606
- if (instance.a) {
5607
- invokeArrayFns(instance.a);
5608
- }
5609
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
5610
- if (vnodeHook) {
5611
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
5612
- }
5613
- },
5614
- void 0,
5615
- parentSuspense
5616
- );
5617
- {
5618
- devtoolsComponentAdded(instance);
5619
- }
5620
5749
  };
5621
5750
  sharedContext.deactivate = (vnode) => {
5622
- const instance = vnode.component;
5623
- invalidateMount(instance.m);
5624
- invalidateMount(instance.a);
5625
- move(
5751
+ deactivate(
5626
5752
  vnode,
5627
5753
  storageContainer,
5628
- null,
5629
- 1,
5754
+ renderer,
5630
5755
  keepAliveInstance,
5631
5756
  parentSuspense
5632
5757
  );
5633
- queuePostRenderEffect(
5634
- () => {
5635
- if (instance.da) {
5636
- invokeArrayFns(instance.da);
5637
- }
5638
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
5639
- if (vnodeHook) {
5640
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
5641
- }
5642
- instance.isDeactivated = true;
5643
- },
5644
- void 0,
5645
- parentSuspense
5646
- );
5647
- {
5648
- devtoolsComponentAdded(instance);
5649
- }
5650
5758
  };
5651
5759
  function unmount(vnode) {
5652
5760
  resetShapeFlag(vnode);
@@ -5797,7 +5905,7 @@ function onActivated(hook, target) {
5797
5905
  function onDeactivated(hook, target) {
5798
5906
  registerKeepAliveHook(hook, "da", target);
5799
5907
  }
5800
- function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
5908
+ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance()) {
5801
5909
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
5802
5910
  let current = target;
5803
5911
  while (current) {
@@ -5811,8 +5919,9 @@ function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
5811
5919
  injectHook(type, wrappedHook, target);
5812
5920
  if (target) {
5813
5921
  let current = target.parent;
5814
- while (current && current.parent && current.parent.vnode) {
5815
- if (isKeepAlive(current.parent.vnode)) {
5922
+ while (current && current.parent) {
5923
+ let parent = current.parent;
5924
+ if (isKeepAlive(parent.vapor ? parent : parent.vnode)) {
5816
5925
  injectToKeepAliveRoot(wrappedHook, type, target, current);
5817
5926
  }
5818
5927
  current = current.parent;
@@ -5838,6 +5947,68 @@ function resetShapeFlag(vnode) {
5838
5947
  function getInnerChild(vnode) {
5839
5948
  return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
5840
5949
  }
5950
+ function activate(vnode, container, anchor, { p: patch, m: move }, parentComponent, parentSuspense, namespace, optimized) {
5951
+ const instance = vnode.component;
5952
+ move(
5953
+ vnode,
5954
+ container,
5955
+ anchor,
5956
+ 0,
5957
+ parentComponent,
5958
+ parentSuspense
5959
+ );
5960
+ patch(
5961
+ instance.vnode,
5962
+ vnode,
5963
+ container,
5964
+ anchor,
5965
+ instance,
5966
+ parentSuspense,
5967
+ namespace,
5968
+ vnode.slotScopeIds,
5969
+ optimized
5970
+ );
5971
+ queuePostRenderEffect(
5972
+ () => {
5973
+ instance.isDeactivated = false;
5974
+ if (instance.a) {
5975
+ invokeArrayFns(instance.a);
5976
+ }
5977
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
5978
+ if (vnodeHook) {
5979
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
5980
+ }
5981
+ },
5982
+ void 0,
5983
+ parentSuspense
5984
+ );
5985
+ {
5986
+ devtoolsComponentAdded(instance);
5987
+ }
5988
+ }
5989
+ function deactivate(vnode, container, { m: move }, parentComponent, parentSuspense) {
5990
+ const instance = vnode.component;
5991
+ invalidateMount(instance.m);
5992
+ invalidateMount(instance.a);
5993
+ move(vnode, container, null, 1, parentComponent, parentSuspense);
5994
+ queuePostRenderEffect(
5995
+ () => {
5996
+ if (instance.da) {
5997
+ invokeArrayFns(instance.da);
5998
+ }
5999
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
6000
+ if (vnodeHook) {
6001
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
6002
+ }
6003
+ instance.isDeactivated = true;
6004
+ },
6005
+ void 0,
6006
+ parentSuspense
6007
+ );
6008
+ {
6009
+ devtoolsComponentAdded(instance);
6010
+ }
6011
+ }
5841
6012
 
5842
6013
  function injectHook(type, hook, target = currentInstance, prepend = false) {
5843
6014
  if (target) {
@@ -6313,12 +6484,13 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6313
6484
  return ret;
6314
6485
  }
6315
6486
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
6487
+ const hasProps = Object.keys(props).length > 0;
6316
6488
  if (name !== "default") props.name = name;
6317
6489
  return openBlock(), createBlock(
6318
6490
  Fragment,
6319
6491
  null,
6320
6492
  [createVNode("slot", props, fallback && fallback())],
6321
- 64
6493
+ hasProps ? -2 : 64
6322
6494
  );
6323
6495
  }
6324
6496
  if (slot && slot.length > 1) {
@@ -6332,6 +6504,7 @@ function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6332
6504
  }
6333
6505
  openBlock();
6334
6506
  const validSlotContent = slot && ensureValidVNode(slot(props));
6507
+ ensureVaporSlotFallback(validSlotContent, fallback);
6335
6508
  const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
6336
6509
  // key attached in the `createSlots` helper, respect that
6337
6510
  validSlotContent && validSlotContent.key;
@@ -6361,6 +6534,14 @@ function ensureValidVNode(vnodes) {
6361
6534
  return true;
6362
6535
  }) ? vnodes : null;
6363
6536
  }
6537
+ function ensureVaporSlotFallback(vnodes, fallback) {
6538
+ let vaporSlot;
6539
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
6540
+ if (!vaporSlot.fallback && fallback) {
6541
+ vaporSlot.fallback = fallback;
6542
+ }
6543
+ }
6544
+ }
6364
6545
 
6365
6546
  function toHandlers(obj, preserveCaseIfNecessary) {
6366
6547
  const ret = {};
@@ -6422,7 +6603,7 @@ function legacyRenderSlot(instance, name, fallback, props, bindObject) {
6422
6603
  }
6423
6604
  return renderSlot(instance.slots, name, props, fallback && (() => fallback));
6424
6605
  }
6425
- function legacyresolveScopedSlots(fns, raw, hasDynamicKeys) {
6606
+ function legacyResolveScopedSlots(fns, raw, hasDynamicKeys) {
6426
6607
  return createSlots(
6427
6608
  raw || { $stable: !hasDynamicKeys },
6428
6609
  mapKeyToName(fns)
@@ -6589,7 +6770,7 @@ function installCompatInstanceProperties(map) {
6589
6770
  _b: () => legacyBindObjectProps,
6590
6771
  _v: () => createTextVNode,
6591
6772
  _e: () => createCommentVNode,
6592
- _u: () => legacyresolveScopedSlots,
6773
+ _u: () => legacyResolveScopedSlots,
6593
6774
  _g: () => legacyBindObjectListeners,
6594
6775
  _d: () => legacyBindDynamicKeys,
6595
6776
  _p: () => legacyPrependModifier
@@ -6761,10 +6942,10 @@ const PublicInstanceProxyHandlers = {
6761
6942
  return true;
6762
6943
  },
6763
6944
  has({
6764
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
6945
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6765
6946
  }, key) {
6766
- let normalizedProps;
6767
- 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);
6947
+ let normalizedProps, cssModules;
6948
+ 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]);
6768
6949
  },
6769
6950
  defineProperty(target, key, descriptor) {
6770
6951
  if (descriptor.get != null) {
@@ -6916,15 +7097,15 @@ function withDefaults(props, defaults) {
6916
7097
  return null;
6917
7098
  }
6918
7099
  function useSlots() {
6919
- return getContext().slots;
7100
+ return getContext("useSlots").slots;
6920
7101
  }
6921
7102
  function useAttrs() {
6922
- return getContext().attrs;
7103
+ return getContext("useAttrs").attrs;
6923
7104
  }
6924
- function getContext() {
7105
+ function getContext(calledFunctionName) {
6925
7106
  const i = getCurrentGenericInstance();
6926
7107
  if (!i) {
6927
- warn$1(`useContext() called without active instance.`);
7108
+ warn$1(`${calledFunctionName}() called without active instance.`);
6928
7109
  }
6929
7110
  if (i.vapor) {
6930
7111
  return i;
@@ -7188,7 +7369,8 @@ function applyOptions(instance) {
7188
7369
  expose.forEach((key) => {
7189
7370
  Object.defineProperty(exposed, key, {
7190
7371
  get: () => publicThis[key],
7191
- set: (val) => publicThis[key] = val
7372
+ set: (val) => publicThis[key] = val,
7373
+ enumerable: true
7192
7374
  });
7193
7375
  });
7194
7376
  } else if (!instance.exposed) {
@@ -7514,7 +7696,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7514
7696
  return vm;
7515
7697
  }
7516
7698
  }
7517
- Vue.version = `2.6.14-compat:${"3.6.0-alpha.2"}`;
7699
+ Vue.version = `2.6.14-compat:${"3.6.0-alpha.4"}`;
7518
7700
  Vue.config = singletonApp.config;
7519
7701
  Vue.use = (plugin, ...options) => {
7520
7702
  if (plugin && isFunction(plugin.install)) {
@@ -7528,22 +7710,22 @@ function createCompatVue$1(createApp, createSingletonApp) {
7528
7710
  singletonApp.mixin(m);
7529
7711
  return Vue;
7530
7712
  };
7531
- Vue.component = (name, comp) => {
7713
+ Vue.component = ((name, comp) => {
7532
7714
  if (comp) {
7533
7715
  singletonApp.component(name, comp);
7534
7716
  return Vue;
7535
7717
  } else {
7536
7718
  return singletonApp.component(name);
7537
7719
  }
7538
- };
7539
- Vue.directive = (name, dir) => {
7720
+ });
7721
+ Vue.directive = ((name, dir) => {
7540
7722
  if (dir) {
7541
7723
  singletonApp.directive(name, dir);
7542
7724
  return Vue;
7543
7725
  } else {
7544
7726
  return singletonApp.directive(name);
7545
7727
  }
7546
- };
7728
+ });
7547
7729
  Vue.options = { _base: Vue };
7548
7730
  let cid = 1;
7549
7731
  Vue.cid = cid;
@@ -7606,14 +7788,14 @@ function createCompatVue$1(createApp, createSingletonApp) {
7606
7788
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
7607
7789
  return reactive(target);
7608
7790
  };
7609
- Vue.filter = (name, filter) => {
7791
+ Vue.filter = ((name, filter) => {
7610
7792
  if (filter) {
7611
7793
  singletonApp.filter(name, filter);
7612
7794
  return Vue;
7613
7795
  } else {
7614
7796
  return singletonApp.filter(name);
7615
7797
  }
7616
- };
7798
+ });
7617
7799
  const util = {
7618
7800
  warn: warn$1 ,
7619
7801
  extend,
@@ -7772,7 +7954,7 @@ function installCompatMount(app, context, render) {
7772
7954
  {
7773
7955
  for (let i = 0; i < container.attributes.length; i++) {
7774
7956
  const attr = container.attributes[i];
7775
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
7957
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
7776
7958
  warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
7777
7959
  break;
7778
7960
  }
@@ -8606,7 +8788,7 @@ function isBoolean(...args) {
8606
8788
  return args.some((elem) => elem.toLowerCase() === "boolean");
8607
8789
  }
8608
8790
 
8609
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
8791
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
8610
8792
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8611
8793
  const normalizeSlot = (key, rawSlot, ctx) => {
8612
8794
  if (rawSlot._n) {
@@ -8660,8 +8842,6 @@ const assignSlots = (slots, children, optimized) => {
8660
8842
  const initSlots = (instance, children, optimized) => {
8661
8843
  const slots = instance.slots = createInternalObject();
8662
8844
  if (instance.vnode.shapeFlag & 32) {
8663
- const cacheIndexes = children.__;
8664
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8665
8845
  const type = children._;
8666
8846
  if (type) {
8667
8847
  assignSlots(slots, children, optimized);
@@ -8725,12 +8905,10 @@ function endMeasure(instance, type) {
8725
8905
  if (instance.appContext.config.performance && isSupported()) {
8726
8906
  const startTag = `vue-${type}-${instance.uid}`;
8727
8907
  const endTag = startTag + `:end`;
8908
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
8728
8909
  perf.mark(endTag);
8729
- perf.measure(
8730
- `<${formatComponentName(instance, instance.type)}> ${type}`,
8731
- startTag,
8732
- endTag
8733
- );
8910
+ perf.measure(measureName, startTag, endTag);
8911
+ perf.clearMeasures(measureName);
8734
8912
  perf.clearMarks(startTag);
8735
8913
  perf.clearMarks(endTag);
8736
8914
  }
@@ -8969,15 +9147,25 @@ function baseCreateRenderer(options, createHydrationFns) {
8969
9147
  optimized
8970
9148
  );
8971
9149
  } else {
8972
- patchElement(
8973
- n1,
8974
- n2,
8975
- parentComponent,
8976
- parentSuspense,
8977
- namespace,
8978
- slotScopeIds,
8979
- optimized
8980
- );
9150
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
9151
+ try {
9152
+ if (customElement) {
9153
+ customElement._beginPatch();
9154
+ }
9155
+ patchElement(
9156
+ n1,
9157
+ n2,
9158
+ parentComponent,
9159
+ parentSuspense,
9160
+ namespace,
9161
+ slotScopeIds,
9162
+ optimized
9163
+ );
9164
+ } finally {
9165
+ if (customElement) {
9166
+ customElement._endPatch();
9167
+ }
9168
+ }
8981
9169
  }
8982
9170
  };
8983
9171
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -9028,16 +9216,20 @@ function baseCreateRenderer(options, createHydrationFns) {
9028
9216
  if (dirs) {
9029
9217
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
9030
9218
  }
9031
- const needCallTransitionHooks = needTransition(parentSuspense, transition);
9032
- if (needCallTransitionHooks) {
9033
- transition.beforeEnter(el);
9219
+ if (transition) {
9220
+ performTransitionEnter(
9221
+ el,
9222
+ transition,
9223
+ () => hostInsert(el, container, anchor),
9224
+ parentSuspense
9225
+ );
9226
+ } else {
9227
+ hostInsert(el, container, anchor);
9034
9228
  }
9035
- hostInsert(el, container, anchor);
9036
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
9229
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
9037
9230
  queuePostRenderEffect(
9038
9231
  () => {
9039
9232
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
9040
- needCallTransitionHooks && transition.enter(el);
9041
9233
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
9042
9234
  },
9043
9235
  void 0,
@@ -9054,21 +9246,9 @@ function baseCreateRenderer(options, createHydrationFns) {
9054
9246
  hostSetScopeId(el, slotScopeIds[i]);
9055
9247
  }
9056
9248
  }
9057
- let subTree = parentComponent && parentComponent.subTree;
9058
- if (subTree) {
9059
- if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
9060
- subTree = filterSingleRoot(subTree.children) || subTree;
9061
- }
9062
- if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
9063
- const parentVNode = parentComponent.vnode;
9064
- setScopeId(
9065
- el,
9066
- parentVNode,
9067
- parentVNode.scopeId,
9068
- parentVNode.slotScopeIds,
9069
- parentComponent.parent
9070
- );
9071
- }
9249
+ const inheritedScopeIds = getInheritedScopeIds(vnode, parentComponent);
9250
+ for (let i = 0; i < inheritedScopeIds.length; i++) {
9251
+ hostSetScopeId(el, inheritedScopeIds[i]);
9072
9252
  }
9073
9253
  };
9074
9254
  const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
@@ -9309,12 +9489,21 @@ function baseCreateRenderer(options, createHydrationFns) {
9309
9489
  n2.slotScopeIds = slotScopeIds;
9310
9490
  if (n2.type.__vapor) {
9311
9491
  if (n1 == null) {
9312
- getVaporInterface(parentComponent, n2).mount(
9313
- n2,
9314
- container,
9315
- anchor,
9316
- parentComponent
9317
- );
9492
+ if (n2.shapeFlag & 512) {
9493
+ getVaporInterface(parentComponent, n2).activate(
9494
+ n2,
9495
+ container,
9496
+ anchor,
9497
+ parentComponent
9498
+ );
9499
+ } else {
9500
+ getVaporInterface(parentComponent, n2).mount(
9501
+ n2,
9502
+ container,
9503
+ anchor,
9504
+ parentComponent
9505
+ );
9506
+ }
9318
9507
  } else {
9319
9508
  getVaporInterface(parentComponent, n2).update(
9320
9509
  n1,
@@ -9378,6 +9567,7 @@ function baseCreateRenderer(options, createHydrationFns) {
9378
9567
  if (!initialVNode.el) {
9379
9568
  const placeholder = instance.subTree = createVNode(Comment);
9380
9569
  processCommentNode(null, placeholder, container, anchor);
9570
+ initialVNode.placeholder = placeholder.el;
9381
9571
  }
9382
9572
  } else {
9383
9573
  setupRenderEffect(
@@ -9945,7 +10135,11 @@ function baseCreateRenderer(options, createHydrationFns) {
9945
10135
  for (i = toBePatched - 1; i >= 0; i--) {
9946
10136
  const nextIndex = s2 + i;
9947
10137
  const nextChild = c2[nextIndex];
9948
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
10138
+ const anchorVNode = c2[nextIndex + 1];
10139
+ const anchor = nextIndex + 1 < l2 ? (
10140
+ // #13559, fallback to el placeholder for unresolved async component
10141
+ anchorVNode.el || anchorVNode.placeholder
10142
+ ) : parentAnchor;
9949
10143
  if (newIndexToOldIndexMap[i] === 0) {
9950
10144
  patch(
9951
10145
  null,
@@ -10025,12 +10219,12 @@ function baseCreateRenderer(options, createHydrationFns) {
10025
10219
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
10026
10220
  if (needTransition2) {
10027
10221
  if (moveType === 0) {
10028
- transition.beforeEnter(el);
10029
- hostInsert(el, container, anchor);
10030
- queuePostRenderEffect(
10031
- () => transition.enter(el),
10032
- void 0,
10033
- parentSuspense
10222
+ performTransitionEnter(
10223
+ el,
10224
+ transition,
10225
+ () => hostInsert(el, container, anchor),
10226
+ parentSuspense,
10227
+ true
10034
10228
  );
10035
10229
  } else {
10036
10230
  const { leave, delayLeave, afterLeave } = transition;
@@ -10042,6 +10236,12 @@ function baseCreateRenderer(options, createHydrationFns) {
10042
10236
  }
10043
10237
  };
10044
10238
  const performLeave = () => {
10239
+ if (el._isLeaving) {
10240
+ el[leaveCbKey](
10241
+ true
10242
+ /* cancelled */
10243
+ );
10244
+ }
10045
10245
  leave(el, () => {
10046
10246
  remove2();
10047
10247
  afterLeave && afterLeave();
@@ -10081,7 +10281,14 @@ function baseCreateRenderer(options, createHydrationFns) {
10081
10281
  parentComponent.renderCache[cacheIndex] = void 0;
10082
10282
  }
10083
10283
  if (shapeFlag & 256) {
10084
- parentComponent.ctx.deactivate(vnode);
10284
+ if (vnode.type.__vapor) {
10285
+ getVaporInterface(parentComponent, vnode).deactivate(
10286
+ vnode,
10287
+ parentComponent.ctx.getStorageContainer()
10288
+ );
10289
+ } else {
10290
+ parentComponent.ctx.deactivate(vnode);
10291
+ }
10085
10292
  return;
10086
10293
  }
10087
10294
  const shouldInvokeDirs = shapeFlag & 1 && dirs;
@@ -10169,22 +10376,15 @@ function baseCreateRenderer(options, createHydrationFns) {
10169
10376
  removeStaticNode(vnode);
10170
10377
  return;
10171
10378
  }
10172
- const performRemove = () => {
10173
- hostRemove(el);
10174
- if (transition && !transition.persisted && transition.afterLeave) {
10175
- transition.afterLeave();
10176
- }
10177
- };
10178
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
10179
- const { leave, delayLeave } = transition;
10180
- const performLeave = () => leave(el, performRemove);
10181
- if (delayLeave) {
10182
- delayLeave(vnode.el, performRemove, performLeave);
10183
- } else {
10184
- performLeave();
10185
- }
10379
+ if (transition) {
10380
+ performTransitionLeave(
10381
+ el,
10382
+ transition,
10383
+ () => hostRemove(el),
10384
+ !!(vnode.shapeFlag & 1)
10385
+ );
10186
10386
  } else {
10187
- performRemove();
10387
+ hostRemove(el);
10188
10388
  }
10189
10389
  };
10190
10390
  const removeFragment = (cur, end) => {
@@ -10200,27 +10400,12 @@ function baseCreateRenderer(options, createHydrationFns) {
10200
10400
  if (instance.type.__hmrId) {
10201
10401
  unregisterHMR(instance);
10202
10402
  }
10203
- const {
10204
- bum,
10205
- scope,
10206
- effect,
10207
- subTree,
10208
- um,
10209
- m,
10210
- a,
10211
- parent,
10212
- slots: { __: slotCacheKeys }
10213
- } = instance;
10403
+ const { bum, scope, effect, subTree, um, m, a } = instance;
10214
10404
  invalidateMount(m);
10215
10405
  invalidateMount(a);
10216
10406
  if (bum) {
10217
10407
  invokeArrayFns(bum);
10218
10408
  }
10219
- if (parent && isArray(slotCacheKeys)) {
10220
- slotCacheKeys.forEach((v) => {
10221
- parent.renderCache[v] = void 0;
10222
- });
10223
- }
10224
10409
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
10225
10410
  instance.emit("hook:beforeDestroy");
10226
10411
  }
@@ -10244,12 +10429,6 @@ function baseCreateRenderer(options, createHydrationFns) {
10244
10429
  void 0,
10245
10430
  parentSuspense
10246
10431
  );
10247
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
10248
- parentSuspense.deps--;
10249
- if (parentSuspense.deps === 0) {
10250
- parentSuspense.resolve();
10251
- }
10252
- }
10253
10432
  {
10254
10433
  devtoolsComponentRemoved(instance);
10255
10434
  }
@@ -10262,7 +10441,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10262
10441
  const getNextHostNode = (vnode) => {
10263
10442
  if (vnode.shapeFlag & 6) {
10264
10443
  if (vnode.type.__vapor) {
10265
- return hostNextSibling(vnode.component.block);
10444
+ return hostNextSibling(vnode.anchor);
10266
10445
  }
10267
10446
  return getNextHostNode(vnode.component.subTree);
10268
10447
  }
@@ -10340,6 +10519,7 @@ function baseCreateRenderer(options, createHydrationFns) {
10340
10519
  return {
10341
10520
  render,
10342
10521
  hydrate,
10522
+ hydrateNode,
10343
10523
  internals,
10344
10524
  createApp: createAppAPI(
10345
10525
  mountApp,
@@ -10381,7 +10561,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
10381
10561
  if (!shallow && c2.patchFlag !== -2)
10382
10562
  traverseStaticChildren(c1, c2);
10383
10563
  }
10384
- if (c2.type === Text) {
10564
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
10565
+ c2.patchFlag !== -1) {
10385
10566
  c2.el = c1.el;
10386
10567
  }
10387
10568
  if (c2.type === Comment && !c2.el) {
@@ -10394,7 +10575,7 @@ function traverseStaticChildren(n1, n2, shallow = false) {
10394
10575
  }
10395
10576
  }
10396
10577
  function locateNonHydratedAsyncRoot(instance) {
10397
- const subComponent = instance.vapor ? null : instance.subTree.component;
10578
+ const subComponent = instance.subTree && instance.subTree.component;
10398
10579
  if (subComponent) {
10399
10580
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
10400
10581
  return subComponent;
@@ -10409,6 +10590,34 @@ function invalidateMount(hooks) {
10409
10590
  hooks[i].flags |= 4;
10410
10591
  }
10411
10592
  }
10593
+ function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
10594
+ if (force || needTransition(parentSuspense, transition)) {
10595
+ transition.beforeEnter(el);
10596
+ insert();
10597
+ queuePostRenderEffect(() => transition.enter(el), void 0, parentSuspense);
10598
+ } else {
10599
+ insert();
10600
+ }
10601
+ }
10602
+ function performTransitionLeave(el, transition, remove, isElement = true) {
10603
+ const performRemove = () => {
10604
+ remove();
10605
+ if (transition && !transition.persisted && transition.afterLeave) {
10606
+ transition.afterLeave();
10607
+ }
10608
+ };
10609
+ if (isElement && transition && !transition.persisted) {
10610
+ const { leave, delayLeave } = transition;
10611
+ const performLeave = () => leave(el, performRemove);
10612
+ if (delayLeave) {
10613
+ delayLeave(el, performRemove, performLeave);
10614
+ } else {
10615
+ performLeave();
10616
+ }
10617
+ } else {
10618
+ performRemove();
10619
+ }
10620
+ }
10412
10621
  function getVaporInterface(instance, vnode) {
10413
10622
  const ctx = instance ? instance.appContext : vnode.appContext;
10414
10623
  const res = ctx && ctx.vapor;
@@ -10423,6 +10632,32 @@ app.use(vaporInteropPlugin)
10423
10632
  }
10424
10633
  return res;
10425
10634
  }
10635
+ function getInheritedScopeIds(vnode, parentComponent) {
10636
+ const inheritedScopeIds = [];
10637
+ let currentParent = parentComponent;
10638
+ let currentVNode = vnode;
10639
+ while (currentParent) {
10640
+ let subTree = currentParent.subTree;
10641
+ if (!subTree) break;
10642
+ if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
10643
+ subTree = filterSingleRoot(subTree.children) || subTree;
10644
+ }
10645
+ if (currentVNode === subTree || isSuspense(subTree.type) && (subTree.ssContent === currentVNode || subTree.ssFallback === currentVNode)) {
10646
+ const parentVNode = currentParent.vnode;
10647
+ if (parentVNode.scopeId) {
10648
+ inheritedScopeIds.push(parentVNode.scopeId);
10649
+ }
10650
+ if (parentVNode.slotScopeIds) {
10651
+ inheritedScopeIds.push(...parentVNode.slotScopeIds);
10652
+ }
10653
+ currentVNode = parentVNode;
10654
+ currentParent = currentParent.parent;
10655
+ } else {
10656
+ break;
10657
+ }
10658
+ }
10659
+ return inheritedScopeIds;
10660
+ }
10426
10661
 
10427
10662
  const ssrContextKey = Symbol.for("v-scx");
10428
10663
  const useSSRContext = () => {
@@ -10666,7 +10901,7 @@ function useModel(props, name, options = EMPTY_OBJ) {
10666
10901
  return res;
10667
10902
  }
10668
10903
  const getModelModifiers = (props, modelName, getter) => {
10669
- return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
10904
+ return getter(props, getModifierPropName(modelName)) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
10670
10905
  };
10671
10906
 
10672
10907
  function emit(instance, event, ...rawArgs) {
@@ -10771,8 +11006,9 @@ function baseEmit(instance, props, getter, event, ...rawArgs) {
10771
11006
  function defaultPropGetter(props, key) {
10772
11007
  return props[key];
10773
11008
  }
11009
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
10774
11010
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
10775
- const cache = appContext.emitsCache;
11011
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
10776
11012
  const cached = cache.get(comp);
10777
11013
  if (cached !== void 0) {
10778
11014
  return cached;
@@ -11244,7 +11480,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11244
11480
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
11245
11481
  if (pendingBranch) {
11246
11482
  suspense.pendingBranch = newBranch;
11247
- if (isSameVNodeType(newBranch, pendingBranch)) {
11483
+ if (isSameVNodeType(pendingBranch, newBranch)) {
11248
11484
  patch(
11249
11485
  pendingBranch,
11250
11486
  newBranch,
@@ -11315,7 +11551,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11315
11551
  );
11316
11552
  setActiveBranch(suspense, newFallback);
11317
11553
  }
11318
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
11554
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
11319
11555
  patch(
11320
11556
  activeBranch,
11321
11557
  newBranch,
@@ -11346,7 +11582,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
11346
11582
  }
11347
11583
  }
11348
11584
  } else {
11349
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
11585
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
11350
11586
  patch(
11351
11587
  activeBranch,
11352
11588
  newBranch,
@@ -11459,7 +11695,8 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11459
11695
  pendingId,
11460
11696
  effects,
11461
11697
  parentComponent: parentComponent2,
11462
- container: container2
11698
+ container: container2,
11699
+ isInFallback
11463
11700
  } = suspense;
11464
11701
  let delayEnter = false;
11465
11702
  if (suspense.isHydrating) {
@@ -11477,6 +11714,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11477
11714
  parentComponent2
11478
11715
  );
11479
11716
  queuePostFlushCb(effects);
11717
+ if (isInFallback && vnode2.ssFallback) {
11718
+ vnode2.ssFallback.el = null;
11719
+ }
11480
11720
  }
11481
11721
  };
11482
11722
  }
@@ -11485,6 +11725,9 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11485
11725
  anchor = next(activeBranch);
11486
11726
  }
11487
11727
  unmount(activeBranch, parentComponent2, suspense, true);
11728
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
11729
+ vnode2.ssFallback.el = null;
11730
+ }
11488
11731
  }
11489
11732
  if (!delayEnter) {
11490
11733
  move(
@@ -11609,6 +11852,7 @@ function createSuspenseBoundary(vnode, parentSuspense, parentComponent, containe
11609
11852
  optimized2
11610
11853
  );
11611
11854
  if (placeholder) {
11855
+ vnode2.placeholder = null;
11612
11856
  remove(placeholder);
11613
11857
  }
11614
11858
  updateHOCHostEl(instance, vnode2.el);
@@ -11871,15 +12115,11 @@ const createVNodeWithArgsTransform = (...args) => {
11871
12115
  );
11872
12116
  };
11873
12117
  const normalizeKey = ({ key }) => key != null ? key : null;
11874
- const normalizeRef = ({
11875
- ref,
11876
- ref_key,
11877
- ref_for
11878
- }) => {
12118
+ const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
11879
12119
  if (typeof ref === "number") {
11880
12120
  ref = "" + ref;
11881
12121
  }
11882
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
12122
+ return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i, r: ref, k: ref_key, f: !!ref_for } : ref : null;
11883
12123
  };
11884
12124
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
11885
12125
  const vnode = {
@@ -12052,6 +12292,7 @@ function cloneVNode(vnode, extraProps, mergeRef = false, cloneTransition = false
12052
12292
  suspense: vnode.suspense,
12053
12293
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
12054
12294
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
12295
+ placeholder: vnode.placeholder,
12055
12296
  el: vnode.el,
12056
12297
  anchor: vnode.anchor,
12057
12298
  ctx: vnode.ctx,
@@ -12214,6 +12455,25 @@ const setCurrentInstance = (instance, scope = instance !== null ? instance.scope
12214
12455
  simpleSetCurrentInstance(instance);
12215
12456
  }
12216
12457
  };
12458
+ const internalOptions = ["ce", "type"];
12459
+ const useInstanceOption = (key, silent = false) => {
12460
+ const instance = getCurrentGenericInstance();
12461
+ if (!instance) {
12462
+ if (!silent) {
12463
+ warn$1(`useInstanceOption called without an active component instance.`);
12464
+ }
12465
+ return { hasInstance: false, value: void 0 };
12466
+ }
12467
+ if (!internalOptions.includes(key)) {
12468
+ {
12469
+ warn$1(
12470
+ `useInstanceOption only accepts ${internalOptions.map((k) => `'${k}'`).join(", ")} as key, got '${key}'.`
12471
+ );
12472
+ }
12473
+ return { hasInstance: true, value: void 0 };
12474
+ }
12475
+ return { hasInstance: true, value: instance[key] };
12476
+ };
12217
12477
 
12218
12478
  const emptyAppContext = createAppContext();
12219
12479
  let uid = 0;
@@ -12593,7 +12853,7 @@ function getComponentPublicInstance(instance) {
12593
12853
  return instance.proxy;
12594
12854
  }
12595
12855
  }
12596
- const classifyRE = /(?:^|[-_])(\w)/g;
12856
+ const classifyRE = /(?:^|[-_])\w/g;
12597
12857
  const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
12598
12858
  function getComponentName(Component, includeInferred = true) {
12599
12859
  return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
@@ -12629,23 +12889,28 @@ const computed = (getterOrOptions, debugOptions) => {
12629
12889
  };
12630
12890
 
12631
12891
  function h(type, propsOrChildren, children) {
12632
- const l = arguments.length;
12633
- if (l === 2) {
12634
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12635
- if (isVNode(propsOrChildren)) {
12636
- return createVNode(type, null, [propsOrChildren]);
12892
+ try {
12893
+ setBlockTracking(-1);
12894
+ const l = arguments.length;
12895
+ if (l === 2) {
12896
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12897
+ if (isVNode(propsOrChildren)) {
12898
+ return createVNode(type, null, [propsOrChildren]);
12899
+ }
12900
+ return createVNode(type, propsOrChildren);
12901
+ } else {
12902
+ return createVNode(type, null, propsOrChildren);
12637
12903
  }
12638
- return createVNode(type, propsOrChildren);
12639
12904
  } else {
12640
- return createVNode(type, null, propsOrChildren);
12641
- }
12642
- } else {
12643
- if (l > 3) {
12644
- children = Array.prototype.slice.call(arguments, 2);
12645
- } else if (l === 3 && isVNode(children)) {
12646
- children = [children];
12905
+ if (l > 3) {
12906
+ children = Array.prototype.slice.call(arguments, 2);
12907
+ } else if (l === 3 && isVNode(children)) {
12908
+ children = [children];
12909
+ }
12910
+ return createVNode(type, propsOrChildren, children);
12647
12911
  }
12648
- return createVNode(type, propsOrChildren, children);
12912
+ } finally {
12913
+ setBlockTracking(1);
12649
12914
  }
12650
12915
  }
12651
12916
 
@@ -12855,7 +13120,7 @@ function isMemoSame(cached, memo) {
12855
13120
  return true;
12856
13121
  }
12857
13122
 
12858
- const version = "3.6.0-alpha.2";
13123
+ const version = "3.6.0-alpha.4";
12859
13124
  const warn = warn$1 ;
12860
13125
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12861
13126
  const devtools = devtools$1 ;
@@ -13125,11 +13390,11 @@ function resolveTransitionProps(rawProps) {
13125
13390
  addTransitionClass(el, legacyLeaveFromClass);
13126
13391
  }
13127
13392
  if (!el._enterCancelled) {
13128
- forceReflow();
13393
+ forceReflow(el);
13129
13394
  addTransitionClass(el, leaveActiveClass);
13130
13395
  } else {
13131
13396
  addTransitionClass(el, leaveActiveClass);
13132
- forceReflow();
13397
+ forceReflow(el);
13133
13398
  }
13134
13399
  nextFrame(() => {
13135
13400
  if (!el._isLeaving) {
@@ -13258,7 +13523,7 @@ function getTransitionInfo(el, expectedType) {
13258
13523
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
13259
13524
  propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
13260
13525
  }
13261
- const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
13526
+ const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
13262
13527
  getStyleProperties(`${TRANSITION$1}Property`).toString()
13263
13528
  );
13264
13529
  return {
@@ -13278,8 +13543,9 @@ function toMs(s) {
13278
13543
  if (s === "auto") return 0;
13279
13544
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
13280
13545
  }
13281
- function forceReflow() {
13282
- return document.body.offsetHeight;
13546
+ function forceReflow(el) {
13547
+ const targetDocument = el ? el.ownerDocument : document;
13548
+ return targetDocument.body.offsetHeight;
13283
13549
  }
13284
13550
 
13285
13551
  function patchClass(el, value, isSVG) {
@@ -13299,6 +13565,8 @@ function patchClass(el, value, isSVG) {
13299
13565
  const vShowOriginalDisplay = Symbol("_vod");
13300
13566
  const vShowHidden = Symbol("_vsh");
13301
13567
  const vShow = {
13568
+ // used for prop mismatch check during hydration
13569
+ name: "show",
13302
13570
  beforeMount(el, { value }, { transition }) {
13303
13571
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
13304
13572
  if (transition && value) {
@@ -13332,9 +13600,6 @@ const vShow = {
13332
13600
  setDisplay(el, value);
13333
13601
  }
13334
13602
  };
13335
- {
13336
- vShow.name = "show";
13337
- }
13338
13603
  function setDisplay(el, value) {
13339
13604
  el.style.display = value ? el[vShowOriginalDisplay] : "none";
13340
13605
  el[vShowHidden] = !value;
@@ -13352,7 +13617,7 @@ function useCssVars(getter) {
13352
13617
  return;
13353
13618
  }
13354
13619
 
13355
- const displayRE = /(^|;)\s*display\s*:/;
13620
+ const displayRE = /(?:^|;)\s*display\s*:/;
13356
13621
  function patchStyle(el, prev, next) {
13357
13622
  const style = el.style;
13358
13623
  const isCssString = isString(next);
@@ -13701,11 +13966,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
13701
13966
  }
13702
13967
 
13703
13968
  const REMOVAL = {};
13704
- /*! #__NO_SIDE_EFFECTS__ */
13705
13969
  // @__NO_SIDE_EFFECTS__
13706
13970
  function defineCustomElement(options, extraOptions, _createApp) {
13707
- const Comp = defineComponent(options, extraOptions);
13708
- if (isPlainObject(Comp)) extend(Comp, extraOptions);
13971
+ let Comp = defineComponent(options, extraOptions);
13972
+ if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
13709
13973
  class VueCustomElement extends VueElement {
13710
13974
  constructor(initialProps) {
13711
13975
  super(Comp, initialProps, _createApp);
@@ -13714,18 +13978,14 @@ function defineCustomElement(options, extraOptions, _createApp) {
13714
13978
  VueCustomElement.def = Comp;
13715
13979
  return VueCustomElement;
13716
13980
  }
13717
- /*! #__NO_SIDE_EFFECTS__ */
13718
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13981
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13719
13982
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13720
- };
13983
+ });
13721
13984
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13722
13985
  };
13723
- class VueElement extends BaseClass {
13724
- constructor(_def, _props = {}, _createApp = createApp) {
13986
+ class VueElementBase extends BaseClass {
13987
+ constructor(def, props = {}, createAppFn) {
13725
13988
  super();
13726
- this._def = _def;
13727
- this._props = _props;
13728
- this._createApp = _createApp;
13729
13989
  this._isVueCE = true;
13730
13990
  /**
13731
13991
  * @internal
@@ -13735,25 +13995,26 @@ class VueElement extends BaseClass {
13735
13995
  * @internal
13736
13996
  */
13737
13997
  this._app = null;
13738
- /**
13739
- * @internal
13740
- */
13741
- this._nonce = this._def.nonce;
13742
13998
  this._connected = false;
13743
13999
  this._resolved = false;
13744
14000
  this._numberProps = null;
13745
14001
  this._styleChildren = /* @__PURE__ */ new WeakSet();
14002
+ this._patching = false;
14003
+ this._dirty = false;
13746
14004
  this._ob = null;
13747
- if (this.shadowRoot && _createApp !== createApp) {
14005
+ this._def = def;
14006
+ this._props = props;
14007
+ this._createApp = createAppFn;
14008
+ this._nonce = def.nonce;
14009
+ if (this._needsHydration()) {
13748
14010
  this._root = this.shadowRoot;
13749
14011
  } else {
13750
- if (this.shadowRoot) {
13751
- warn(
13752
- `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
14012
+ if (def.shadowRoot !== false) {
14013
+ this.attachShadow(
14014
+ extend({}, def.shadowRootOptions, {
14015
+ mode: "open"
14016
+ })
13753
14017
  );
13754
- }
13755
- if (_def.shadowRoot !== false) {
13756
- this.attachShadow({ mode: "open" });
13757
14018
  this._root = this.shadowRoot;
13758
14019
  } else {
13759
14020
  this._root = this;
@@ -13768,14 +14029,14 @@ class VueElement extends BaseClass {
13768
14029
  this._connected = true;
13769
14030
  let parent = this;
13770
14031
  while (parent = parent && (parent.parentNode || parent.host)) {
13771
- if (parent instanceof VueElement) {
14032
+ if (parent instanceof VueElementBase) {
13772
14033
  this._parent = parent;
13773
14034
  break;
13774
14035
  }
13775
14036
  }
13776
14037
  if (!this._instance) {
13777
14038
  if (this._resolved) {
13778
- this._mount(this._def);
14039
+ this._mountComponent(this._def);
13779
14040
  } else {
13780
14041
  if (parent && parent._pendingResolve) {
13781
14042
  this._pendingResolve = parent._pendingResolve.then(() => {
@@ -13788,8 +14049,24 @@ class VueElement extends BaseClass {
13788
14049
  }
13789
14050
  }
13790
14051
  }
14052
+ disconnectedCallback() {
14053
+ this._connected = false;
14054
+ nextTick(() => {
14055
+ if (!this._connected) {
14056
+ if (this._ob) {
14057
+ this._ob.disconnect();
14058
+ this._ob = null;
14059
+ }
14060
+ this._unmount();
14061
+ if (this._teleportTargets) {
14062
+ this._teleportTargets.clear();
14063
+ this._teleportTargets = void 0;
14064
+ }
14065
+ }
14066
+ });
14067
+ }
13791
14068
  _setParent(parent = this._parent) {
13792
- if (parent) {
14069
+ if (parent && this._instance) {
13793
14070
  this._instance.parent = parent._instance;
13794
14071
  this._inheritParentContext(parent);
13795
14072
  }
@@ -13802,19 +14079,10 @@ class VueElement extends BaseClass {
13802
14079
  );
13803
14080
  }
13804
14081
  }
13805
- disconnectedCallback() {
13806
- this._connected = false;
13807
- nextTick(() => {
13808
- if (!this._connected) {
13809
- if (this._ob) {
13810
- this._ob.disconnect();
13811
- this._ob = null;
13812
- }
13813
- this._app && this._app.unmount();
13814
- if (this._instance) this._instance.ce = void 0;
13815
- this._app = this._instance = null;
13816
- }
13817
- });
14082
+ _processMutations(mutations) {
14083
+ for (const m of mutations) {
14084
+ this._setAttr(m.attributeName);
14085
+ }
13818
14086
  }
13819
14087
  /**
13820
14088
  * resolve inner component definition (handle possible async component)
@@ -13826,13 +14094,9 @@ class VueElement extends BaseClass {
13826
14094
  for (let i = 0; i < this.attributes.length; i++) {
13827
14095
  this._setAttr(this.attributes[i].name);
13828
14096
  }
13829
- this._ob = new MutationObserver((mutations) => {
13830
- for (const m of mutations) {
13831
- this._setAttr(m.attributeName);
13832
- }
13833
- });
14097
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13834
14098
  this._ob.observe(this, { attributes: true });
13835
- const resolve = (def, isAsync = false) => {
14099
+ const resolve = (def) => {
13836
14100
  this._resolved = true;
13837
14101
  this._pendingResolve = void 0;
13838
14102
  const { props, styles } = def;
@@ -13857,29 +14121,25 @@ class VueElement extends BaseClass {
13857
14121
  "Custom element style injection is not supported when using shadowRoot: false"
13858
14122
  );
13859
14123
  }
13860
- this._mount(def);
14124
+ this._mountComponent(def);
13861
14125
  };
13862
14126
  const asyncDef = this._def.__asyncLoader;
13863
14127
  if (asyncDef) {
14128
+ const { configureApp } = this._def;
13864
14129
  this._pendingResolve = asyncDef().then((def) => {
13865
- def.configureApp = this._def.configureApp;
13866
- resolve(this._def = def, true);
14130
+ def.configureApp = configureApp;
14131
+ this._def = def;
14132
+ resolve(def);
13867
14133
  });
13868
14134
  } else {
13869
14135
  resolve(this._def);
13870
14136
  }
13871
14137
  }
13872
- _mount(def) {
13873
- if (!def.name) {
13874
- def.name = "VueElement";
13875
- }
13876
- this._app = this._createApp(def);
13877
- this._inheritParentContext();
13878
- if (def.configureApp) {
13879
- def.configureApp(this._app);
13880
- }
13881
- this._app._ceVNode = this._createVNode();
13882
- this._app.mount(this._root);
14138
+ _mountComponent(def) {
14139
+ this._mount(def);
14140
+ this._processExposed();
14141
+ }
14142
+ _processExposed() {
13883
14143
  const exposed = this._instance && this._instance.exposed;
13884
14144
  if (!exposed) return;
13885
14145
  for (const key in exposed) {
@@ -13893,6 +14153,38 @@ class VueElement extends BaseClass {
13893
14153
  }
13894
14154
  }
13895
14155
  }
14156
+ _processInstance() {
14157
+ this._instance.ce = this;
14158
+ this._instance.isCE = true;
14159
+ {
14160
+ this._instance.ceReload = (newStyles) => {
14161
+ if (this._styles) {
14162
+ this._styles.forEach((s) => this._root.removeChild(s));
14163
+ this._styles.length = 0;
14164
+ }
14165
+ this._applyStyles(newStyles);
14166
+ if (!this._instance.vapor) {
14167
+ this._instance = null;
14168
+ }
14169
+ this._update();
14170
+ };
14171
+ }
14172
+ const dispatch = (event, args) => {
14173
+ this.dispatchEvent(
14174
+ new CustomEvent(
14175
+ event,
14176
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
14177
+ )
14178
+ );
14179
+ };
14180
+ this._instance.emit = (event, ...args) => {
14181
+ dispatch(event, args);
14182
+ if (hyphenate(event) !== event) {
14183
+ dispatch(hyphenate(event), args);
14184
+ }
14185
+ };
14186
+ this._setParent();
14187
+ }
13896
14188
  _resolveProps(def) {
13897
14189
  const { props } = def;
13898
14190
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
@@ -13907,7 +14199,7 @@ class VueElement extends BaseClass {
13907
14199
  return this._getProp(key);
13908
14200
  },
13909
14201
  set(val) {
13910
- this._setProp(key, val, true, true);
14202
+ this._setProp(key, val, true, !this._patching);
13911
14203
  }
13912
14204
  });
13913
14205
  }
@@ -13933,11 +14225,12 @@ class VueElement extends BaseClass {
13933
14225
  */
13934
14226
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13935
14227
  if (val !== this._props[key]) {
14228
+ this._dirty = true;
13936
14229
  if (val === REMOVAL) {
13937
14230
  delete this._props[key];
13938
14231
  } else {
13939
14232
  this._props[key] = val;
13940
- if (key === "key" && this._app) {
14233
+ if (key === "key" && this._app && this._app._ceVNode) {
13941
14234
  this._app._ceVNode.key = val;
13942
14235
  }
13943
14236
  }
@@ -13946,7 +14239,10 @@ class VueElement extends BaseClass {
13946
14239
  }
13947
14240
  if (shouldReflect) {
13948
14241
  const ob = this._ob;
13949
- ob && ob.disconnect();
14242
+ if (ob) {
14243
+ this._processMutations(ob.takeRecords());
14244
+ ob.disconnect();
14245
+ }
13950
14246
  if (val === true) {
13951
14247
  this.setAttribute(hyphenate(key), "");
13952
14248
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13958,52 +14254,6 @@ class VueElement extends BaseClass {
13958
14254
  }
13959
14255
  }
13960
14256
  }
13961
- _update() {
13962
- const vnode = this._createVNode();
13963
- if (this._app) vnode.appContext = this._app._context;
13964
- render(vnode, this._root);
13965
- }
13966
- _createVNode() {
13967
- const baseProps = {};
13968
- if (!this.shadowRoot) {
13969
- baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
13970
- }
13971
- const vnode = createVNode(this._def, extend(baseProps, this._props));
13972
- if (!this._instance) {
13973
- vnode.ce = (instance) => {
13974
- this._instance = instance;
13975
- instance.ce = this;
13976
- instance.isCE = true;
13977
- {
13978
- instance.ceReload = (newStyles) => {
13979
- if (this._styles) {
13980
- this._styles.forEach((s) => this._root.removeChild(s));
13981
- this._styles.length = 0;
13982
- }
13983
- this._applyStyles(newStyles);
13984
- this._instance = null;
13985
- this._update();
13986
- };
13987
- }
13988
- const dispatch = (event, args) => {
13989
- this.dispatchEvent(
13990
- new CustomEvent(
13991
- event,
13992
- isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
13993
- )
13994
- );
13995
- };
13996
- instance.emit = (event, ...args) => {
13997
- dispatch(event, args);
13998
- if (hyphenate(event) !== event) {
13999
- dispatch(hyphenate(event), args);
14000
- }
14001
- };
14002
- this._setParent();
14003
- };
14004
- }
14005
- return vnode;
14006
- }
14007
14257
  _applyStyles(styles, owner) {
14008
14258
  if (!styles) return;
14009
14259
  if (owner) {
@@ -14050,13 +14300,15 @@ class VueElement extends BaseClass {
14050
14300
  * Only called when shadowRoot is false
14051
14301
  */
14052
14302
  _renderSlots() {
14053
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
14303
+ const outlets = this._getSlots();
14054
14304
  const scopeId = this._instance.type.__scopeId;
14305
+ const slotReplacements = /* @__PURE__ */ new Map();
14055
14306
  for (let i = 0; i < outlets.length; i++) {
14056
14307
  const o = outlets[i];
14057
14308
  const slotName = o.getAttribute("name") || "default";
14058
14309
  const content = this._slots[slotName];
14059
14310
  const parent = o.parentNode;
14311
+ const replacementNodes = [];
14060
14312
  if (content) {
14061
14313
  for (const n of content) {
14062
14314
  if (scopeId && n.nodeType === 1) {
@@ -14069,12 +14321,36 @@ class VueElement extends BaseClass {
14069
14321
  }
14070
14322
  }
14071
14323
  parent.insertBefore(n, o);
14324
+ replacementNodes.push(n);
14072
14325
  }
14073
14326
  } else {
14074
- while (o.firstChild) parent.insertBefore(o.firstChild, o);
14327
+ while (o.firstChild) {
14328
+ const child = o.firstChild;
14329
+ parent.insertBefore(child, o);
14330
+ replacementNodes.push(child);
14331
+ }
14075
14332
  }
14076
14333
  parent.removeChild(o);
14334
+ slotReplacements.set(o, replacementNodes);
14077
14335
  }
14336
+ this._updateSlotNodes(slotReplacements);
14337
+ }
14338
+ /**
14339
+ * @internal
14340
+ */
14341
+ _getSlots() {
14342
+ const roots = [this];
14343
+ if (this._teleportTargets) {
14344
+ roots.push(...this._teleportTargets);
14345
+ }
14346
+ const slots = /* @__PURE__ */ new Set();
14347
+ for (const root of roots) {
14348
+ const found = root.querySelectorAll("slot");
14349
+ for (let i = 0; i < found.length; i++) {
14350
+ slots.add(found[i]);
14351
+ }
14352
+ }
14353
+ return Array.from(slots);
14078
14354
  }
14079
14355
  /**
14080
14356
  * @internal
@@ -14082,6 +14358,22 @@ class VueElement extends BaseClass {
14082
14358
  _injectChildStyle(comp) {
14083
14359
  this._applyStyles(comp.styles, comp);
14084
14360
  }
14361
+ /**
14362
+ * @internal
14363
+ */
14364
+ _beginPatch() {
14365
+ this._patching = true;
14366
+ this._dirty = false;
14367
+ }
14368
+ /**
14369
+ * @internal
14370
+ */
14371
+ _endPatch() {
14372
+ this._patching = false;
14373
+ if (this._dirty && this._instance) {
14374
+ this._update();
14375
+ }
14376
+ }
14085
14377
  /**
14086
14378
  * @internal
14087
14379
  */
@@ -14098,13 +14390,76 @@ class VueElement extends BaseClass {
14098
14390
  }
14099
14391
  }
14100
14392
  }
14393
+ class VueElement extends VueElementBase {
14394
+ constructor(def, props = {}, createAppFn = createApp) {
14395
+ super(def, props, createAppFn);
14396
+ }
14397
+ _needsHydration() {
14398
+ if (this.shadowRoot && this._createApp !== createApp) {
14399
+ return true;
14400
+ } else {
14401
+ if (this.shadowRoot) {
14402
+ warn(
14403
+ `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
14404
+ );
14405
+ }
14406
+ }
14407
+ return false;
14408
+ }
14409
+ _mount(def) {
14410
+ if (!def.name) {
14411
+ def.name = "VueElement";
14412
+ }
14413
+ this._app = this._createApp(def);
14414
+ this._inheritParentContext();
14415
+ if (def.configureApp) {
14416
+ def.configureApp(this._app);
14417
+ }
14418
+ this._app._ceVNode = this._createVNode();
14419
+ this._app.mount(this._root);
14420
+ }
14421
+ _update() {
14422
+ if (!this._app) return;
14423
+ const vnode = this._createVNode();
14424
+ vnode.appContext = this._app._context;
14425
+ render(vnode, this._root);
14426
+ }
14427
+ _unmount() {
14428
+ if (this._app) {
14429
+ this._app.unmount();
14430
+ }
14431
+ if (this._instance && this._instance.ce) {
14432
+ this._instance.ce = void 0;
14433
+ }
14434
+ this._app = this._instance = null;
14435
+ }
14436
+ /**
14437
+ * Only called when shadowRoot is false
14438
+ */
14439
+ _updateSlotNodes(replacements) {
14440
+ }
14441
+ _createVNode() {
14442
+ const baseProps = {};
14443
+ if (!this.shadowRoot) {
14444
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
14445
+ }
14446
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
14447
+ if (!this._instance) {
14448
+ vnode.ce = (instance) => {
14449
+ this._instance = instance;
14450
+ this._processInstance();
14451
+ };
14452
+ }
14453
+ return vnode;
14454
+ }
14455
+ }
14101
14456
  function useHost(caller) {
14102
- const instance = getCurrentInstance();
14103
- const el = instance && instance.ce;
14457
+ const { hasInstance, value } = useInstanceOption("ce", true);
14458
+ const el = value;
14104
14459
  if (el) {
14105
14460
  return el;
14106
14461
  } else {
14107
- if (!instance) {
14462
+ if (!hasInstance) {
14108
14463
  warn(
14109
14464
  `${caller || "useHost"} called without an active component instance.`
14110
14465
  );
@@ -14123,12 +14478,12 @@ function useShadowRoot() {
14123
14478
 
14124
14479
  function useCssModule(name = "$style") {
14125
14480
  {
14126
- const instance = getCurrentInstance();
14127
- if (!instance) {
14481
+ const { hasInstance, value: type } = useInstanceOption("type", true);
14482
+ if (!hasInstance) {
14128
14483
  warn(`useCssModule must be called inside setup()`);
14129
14484
  return EMPTY_OBJ;
14130
14485
  }
14131
- const modules = instance.type.__cssModules;
14486
+ const modules = type.__cssModules;
14132
14487
  if (!modules) {
14133
14488
  warn(`Current instance does not have CSS modules injected.`);
14134
14489
  return EMPTY_OBJ;
@@ -14177,26 +14532,13 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14177
14532
  prevChildren = [];
14178
14533
  return;
14179
14534
  }
14180
- prevChildren.forEach(callPendingCbs);
14535
+ prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
14181
14536
  prevChildren.forEach(recordPosition);
14182
14537
  const movedChildren = prevChildren.filter(applyTranslation);
14183
- forceReflow();
14184
- movedChildren.forEach((c) => {
14185
- const el = c.el;
14186
- const style = el.style;
14187
- addTransitionClass(el, moveClass);
14188
- style.transform = style.webkitTransform = style.transitionDuration = "";
14189
- const cb = el[moveCbKey] = (e) => {
14190
- if (e && e.target !== el) {
14191
- return;
14192
- }
14193
- if (!e || /transform$/.test(e.propertyName)) {
14194
- el.removeEventListener("transitionend", cb);
14195
- el[moveCbKey] = null;
14196
- removeTransitionClass(el, moveClass);
14197
- }
14198
- };
14199
- el.addEventListener("transitionend", cb);
14538
+ forceReflow(instance.vnode.el);
14539
+ movedChildren.forEach((c) => {
14540
+ const el = c.el;
14541
+ handleMovedChildren(el, moveClass);
14200
14542
  });
14201
14543
  prevChildren = [];
14202
14544
  });
@@ -14225,10 +14567,10 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14225
14567
  instance
14226
14568
  )
14227
14569
  );
14228
- positionMap.set(
14229
- child,
14230
- child.el.getBoundingClientRect()
14231
- );
14570
+ positionMap.set(child, {
14571
+ left: child.el.offsetLeft,
14572
+ top: child.el.offsetTop
14573
+ });
14232
14574
  }
14233
14575
  }
14234
14576
  }
@@ -14249,8 +14591,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
14249
14591
  }
14250
14592
  });
14251
14593
  const TransitionGroup = TransitionGroupImpl;
14252
- function callPendingCbs(c) {
14253
- const el = c.el;
14594
+ function callPendingCbs(el) {
14254
14595
  if (el[moveCbKey]) {
14255
14596
  el[moveCbKey]();
14256
14597
  }
@@ -14259,19 +14600,30 @@ function callPendingCbs(c) {
14259
14600
  }
14260
14601
  }
14261
14602
  function recordPosition(c) {
14262
- newPositionMap.set(c, c.el.getBoundingClientRect());
14603
+ newPositionMap.set(c, {
14604
+ left: c.el.offsetLeft,
14605
+ top: c.el.offsetTop
14606
+ });
14263
14607
  }
14264
14608
  function applyTranslation(c) {
14265
- const oldPos = positionMap.get(c);
14266
- const newPos = newPositionMap.get(c);
14609
+ if (baseApplyTranslation(
14610
+ positionMap.get(c),
14611
+ newPositionMap.get(c),
14612
+ c.el
14613
+ )) {
14614
+ return c;
14615
+ }
14616
+ }
14617
+ function baseApplyTranslation(oldPos, newPos, el) {
14267
14618
  const dx = oldPos.left - newPos.left;
14268
14619
  const dy = oldPos.top - newPos.top;
14269
14620
  if (dx || dy) {
14270
- const s = c.el.style;
14621
+ const s = el.style;
14271
14622
  s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
14272
14623
  s.transitionDuration = "0s";
14273
- return c;
14624
+ return true;
14274
14625
  }
14626
+ return false;
14275
14627
  }
14276
14628
  function hasCSSTransform(el, root, moveClass) {
14277
14629
  const clone = el.cloneNode();
@@ -14289,6 +14641,22 @@ function hasCSSTransform(el, root, moveClass) {
14289
14641
  container.removeChild(clone);
14290
14642
  return hasTransform;
14291
14643
  }
14644
+ const handleMovedChildren = (el, moveClass) => {
14645
+ const style = el.style;
14646
+ addTransitionClass(el, moveClass);
14647
+ style.transform = style.webkitTransform = style.transitionDuration = "";
14648
+ const cb = el[moveCbKey] = (e) => {
14649
+ if (e && e.target !== el) {
14650
+ return;
14651
+ }
14652
+ if (!e || e.propertyName.endsWith("transform")) {
14653
+ el.removeEventListener("transitionend", cb);
14654
+ el[moveCbKey] = null;
14655
+ removeTransitionClass(el, moveClass);
14656
+ }
14657
+ };
14658
+ el.addEventListener("transitionend", cb);
14659
+ };
14292
14660
 
14293
14661
  const getModelAssigner = (vnode) => {
14294
14662
  const fn = vnode.props["onUpdate:modelValue"] || vnode.props["onModelCompat:input"];
@@ -14324,21 +14692,21 @@ const vModelText = {
14324
14692
  vModelTextUpdate(el, oldValue, value, trim, number, lazy);
14325
14693
  }
14326
14694
  };
14695
+ function castValue(value, trim, number) {
14696
+ if (trim) value = value.trim();
14697
+ if (number) value = looseToNumber(value);
14698
+ return value;
14699
+ }
14327
14700
  const vModelTextInit = (el, trim, number, lazy, set) => {
14328
14701
  addEventListener(el, lazy ? "change" : "input", (e) => {
14329
14702
  if (e.target.composing) return;
14330
- let domValue = el.value;
14331
- if (trim) {
14332
- domValue = domValue.trim();
14333
- }
14334
- if (number || el.type === "number") {
14335
- domValue = looseToNumber(domValue);
14336
- }
14337
- (0, el[assignKey])(domValue);
14703
+ (0, el[assignKey])(
14704
+ castValue(el.value, trim, number || el.type === "number")
14705
+ );
14338
14706
  });
14339
- if (trim) {
14707
+ if (trim || number) {
14340
14708
  addEventListener(el, "change", () => {
14341
- el.value = el.value.trim();
14709
+ el.value = castValue(el.value, trim, number || el.type === "number");
14342
14710
  });
14343
14711
  }
14344
14712
  if (!lazy) {
@@ -14621,13 +14989,13 @@ const modifierGuards = {
14621
14989
  const withModifiers = (fn, modifiers) => {
14622
14990
  const cache = fn._withMods || (fn._withMods = {});
14623
14991
  const cacheKey = modifiers.join(".");
14624
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14992
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14625
14993
  for (let i = 0; i < modifiers.length; i++) {
14626
14994
  const guard = modifierGuards[modifiers[i]];
14627
14995
  if (guard && guard(event, modifiers)) return;
14628
14996
  }
14629
14997
  return fn(event, ...args);
14630
- });
14998
+ }));
14631
14999
  };
14632
15000
  const keyNames = {
14633
15001
  esc: "escape",
@@ -14657,7 +15025,7 @@ const withKeys = (fn, modifiers) => {
14657
15025
  }
14658
15026
  const cache = fn._withKeys || (fn._withKeys = {});
14659
15027
  const cacheKey = modifiers.join(".");
14660
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
15028
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14661
15029
  if (!("key" in event)) {
14662
15030
  return;
14663
15031
  }
@@ -14687,7 +15055,7 @@ const withKeys = (fn, modifiers) => {
14687
15055
  }
14688
15056
  }
14689
15057
  }
14690
- });
15058
+ }));
14691
15059
  };
14692
15060
 
14693
15061
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14701,13 +15069,13 @@ function ensureHydrationRenderer() {
14701
15069
  enabledHydration = true;
14702
15070
  return renderer;
14703
15071
  }
14704
- const render = (...args) => {
15072
+ const render = ((...args) => {
14705
15073
  ensureRenderer().render(...args);
14706
- };
14707
- const hydrate = (...args) => {
15074
+ });
15075
+ const hydrate = ((...args) => {
14708
15076
  ensureHydrationRenderer().hydrate(...args);
14709
- };
14710
- const createApp = (...args) => {
15077
+ });
15078
+ const createApp = ((...args) => {
14711
15079
  const app = ensureRenderer().createApp(...args);
14712
15080
  {
14713
15081
  injectNativeTagCheck(app);
@@ -14723,7 +15091,7 @@ const createApp = (...args) => {
14723
15091
  if (container.nodeType === 1) {
14724
15092
  for (let i = 0; i < container.attributes.length; i++) {
14725
15093
  const attr = container.attributes[i];
14726
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
15094
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
14727
15095
  compatUtils.warnDeprecation(
14728
15096
  "GLOBAL_MOUNT_CONTAINER",
14729
15097
  null
@@ -14744,8 +15112,8 @@ const createApp = (...args) => {
14744
15112
  return proxy;
14745
15113
  };
14746
15114
  return app;
14747
- };
14748
- const createSSRApp = (...args) => {
15115
+ });
15116
+ const createSSRApp = ((...args) => {
14749
15117
  const app = ensureHydrationRenderer().createApp(...args);
14750
15118
  {
14751
15119
  injectNativeTagCheck(app);
@@ -14759,7 +15127,7 @@ const createSSRApp = (...args) => {
14759
15127
  }
14760
15128
  };
14761
15129
  return app;
14762
- };
15130
+ });
14763
15131
  function resolveRootNamespace(container) {
14764
15132
  if (container instanceof SVGElement) {
14765
15133
  return "svg";
@@ -14850,6 +15218,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
14850
15218
  TransitionGroup: TransitionGroup,
14851
15219
  TriggerOpTypes: TriggerOpTypes,
14852
15220
  VueElement: VueElement,
15221
+ VueElementBase: VueElementBase,
14853
15222
  assertNumber: assertNumber,
14854
15223
  callWithAsyncErrorHandling: callWithAsyncErrorHandling,
14855
15224
  callWithErrorHandling: callWithErrorHandling,
@@ -14914,6 +15283,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
14914
15283
  mergeModels: mergeModels,
14915
15284
  mergeProps: mergeProps,
14916
15285
  nextTick: nextTick,
15286
+ nodeOps: nodeOps,
14917
15287
  normalizeClass: normalizeClass,
14918
15288
  normalizeProps: normalizeProps,
14919
15289
  normalizeStyle: normalizeStyle,
@@ -14932,6 +15302,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
14932
15302
  onUpdated: onUpdated,
14933
15303
  onWatcherCleanup: onWatcherCleanup,
14934
15304
  openBlock: openBlock,
15305
+ patchProp: patchProp,
14935
15306
  popScopeId: popScopeId,
14936
15307
  provide: provide,
14937
15308
  proxyRefs: proxyRefs,
@@ -14973,6 +15344,7 @@ var runtimeDom = /*#__PURE__*/Object.freeze({
14973
15344
  useCssVars: useCssVars,
14974
15345
  useHost: useHost,
14975
15346
  useId: useId,
15347
+ useInstanceOption: useInstanceOption,
14976
15348
  useModel: useModel,
14977
15349
  useSSRContext: useSSRContext,
14978
15350
  useShadowRoot: useShadowRoot,
@@ -16330,16 +16702,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
16330
16702
  (id) => markScopeIdentifier(node, id, knownIds)
16331
16703
  );
16332
16704
  }
16705
+ } else if (node.type === "SwitchStatement") {
16706
+ if (node.scopeIds) {
16707
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
16708
+ } else {
16709
+ walkSwitchStatement(
16710
+ node,
16711
+ false,
16712
+ (id) => markScopeIdentifier(node, id, knownIds)
16713
+ );
16714
+ }
16333
16715
  } else if (node.type === "CatchClause" && node.param) {
16334
- for (const id of extractIdentifiers(node.param)) {
16335
- markScopeIdentifier(node, id, knownIds);
16716
+ if (node.scopeIds) {
16717
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
16718
+ } else {
16719
+ for (const id of extractIdentifiers(node.param)) {
16720
+ markScopeIdentifier(node, id, knownIds);
16721
+ }
16336
16722
  }
16337
16723
  } else if (isForStatement(node)) {
16338
- walkForStatement(
16339
- node,
16340
- false,
16341
- (id) => markScopeIdentifier(node, id, knownIds)
16342
- );
16724
+ if (node.scopeIds) {
16725
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
16726
+ } else {
16727
+ walkForStatement(
16728
+ node,
16729
+ false,
16730
+ (id) => markScopeIdentifier(node, id, knownIds)
16731
+ );
16732
+ }
16343
16733
  }
16344
16734
  },
16345
16735
  leave(node, parent) {
@@ -16362,14 +16752,15 @@ function isReferencedIdentifier(id, parent, parentStack) {
16362
16752
  if (id.name === "arguments") {
16363
16753
  return false;
16364
16754
  }
16365
- if (isReferenced(id, parent)) {
16755
+ if (isReferenced(id, parent, parentStack[parentStack.length - 2])) {
16366
16756
  return true;
16367
16757
  }
16368
16758
  switch (parent.type) {
16369
16759
  case "AssignmentExpression":
16370
16760
  case "AssignmentPattern":
16371
16761
  return true;
16372
- case "ObjectPattern":
16762
+ case "ObjectProperty":
16763
+ return parent.key !== id && isInDestructureAssignment(parent, parentStack);
16373
16764
  case "ArrayPattern":
16374
16765
  return isInDestructureAssignment(parent, parentStack);
16375
16766
  }
@@ -16409,7 +16800,8 @@ function walkFunctionParams(node, onIdent) {
16409
16800
  }
16410
16801
  }
16411
16802
  function walkBlockDeclarations(block, onIdent) {
16412
- for (const stmt of block.body) {
16803
+ const body = block.type === "SwitchCase" ? block.consequent : block.body;
16804
+ for (const stmt of body) {
16413
16805
  if (stmt.type === "VariableDeclaration") {
16414
16806
  if (stmt.declare) continue;
16415
16807
  for (const decl of stmt.declarations) {
@@ -16422,6 +16814,8 @@ function walkBlockDeclarations(block, onIdent) {
16422
16814
  onIdent(stmt.id);
16423
16815
  } else if (isForStatement(stmt)) {
16424
16816
  walkForStatement(stmt, true, onIdent);
16817
+ } else if (stmt.type === "SwitchStatement") {
16818
+ walkSwitchStatement(stmt, true, onIdent);
16425
16819
  }
16426
16820
  }
16427
16821
  }
@@ -16438,6 +16832,20 @@ function walkForStatement(stmt, isVar, onIdent) {
16438
16832
  }
16439
16833
  }
16440
16834
  }
16835
+ function walkSwitchStatement(stmt, isVar, onIdent) {
16836
+ for (const cs of stmt.cases) {
16837
+ for (const stmt2 of cs.consequent) {
16838
+ if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
16839
+ for (const decl of stmt2.declarations) {
16840
+ for (const id of extractIdentifiers(decl.id)) {
16841
+ onIdent(id);
16842
+ }
16843
+ }
16844
+ }
16845
+ }
16846
+ walkBlockDeclarations(cs, onIdent);
16847
+ }
16848
+ }
16441
16849
  function extractIdentifiers(param, nodes = []) {
16442
16850
  switch (param.type) {
16443
16851
  case "Identifier":
@@ -16538,7 +16946,7 @@ function isReferenced(node, parent, grandparent) {
16538
16946
  if (parent.key === node) {
16539
16947
  return !!parent.computed;
16540
16948
  }
16541
- return true;
16949
+ return !grandparent || grandparent.type !== "ObjectPattern";
16542
16950
  // no: class { NODE = value; }
16543
16951
  // yes: class { [NODE] = value; }
16544
16952
  // yes: class { key = NODE; }
@@ -16588,6 +16996,9 @@ function isReferenced(node, parent, grandparent) {
16588
16996
  // yes: export { NODE as foo };
16589
16997
  // no: export { NODE as foo } from "foo";
16590
16998
  case "ExportSpecifier":
16999
+ if (grandparent == null ? void 0 : grandparent.source) {
17000
+ return false;
17001
+ }
16591
17002
  return parent.local === node;
16592
17003
  // no: import NODE from "foo";
16593
17004
  // no: import * as NODE from "foo";
@@ -16668,8 +17079,9 @@ function isCoreComponent(tag) {
16668
17079
  return BASE_TRANSITION;
16669
17080
  }
16670
17081
  }
16671
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
17082
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
16672
17083
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
17084
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
16673
17085
  const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
16674
17086
  const isMemberExpressionNode = (exp, context) => {
16675
17087
  try {
@@ -16766,6 +17178,9 @@ function hasDynamicKeyVBind(node) {
16766
17178
  function isText$1(node) {
16767
17179
  return node.type === 5 || node.type === 2;
16768
17180
  }
17181
+ function isVPre(p) {
17182
+ return p.type === 7 && p.name === "pre";
17183
+ }
16769
17184
  function isVSlot(p) {
16770
17185
  return p.type === 7 && p.name === "slot";
16771
17186
  }
@@ -17064,7 +17479,7 @@ const tokenizer = new Tokenizer(stack, {
17064
17479
  ondirarg(start, end) {
17065
17480
  if (start === end) return;
17066
17481
  const arg = getSlice(start, end);
17067
- if (inVPre) {
17482
+ if (inVPre && !isVPre(currentProp)) {
17068
17483
  currentProp.name += arg;
17069
17484
  setLocEnd(currentProp.nameLoc, end);
17070
17485
  } else {
@@ -17079,7 +17494,7 @@ const tokenizer = new Tokenizer(stack, {
17079
17494
  },
17080
17495
  ondirmodifier(start, end) {
17081
17496
  const mod = getSlice(start, end);
17082
- if (inVPre) {
17497
+ if (inVPre && !isVPre(currentProp)) {
17083
17498
  currentProp.name += "." + mod;
17084
17499
  setLocEnd(currentProp.nameLoc, end);
17085
17500
  } else if (currentProp.name === "slot") {
@@ -17726,6 +18141,11 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17726
18141
  } else if (child.type === 12) {
17727
18142
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
17728
18143
  if (constantType >= 2) {
18144
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
18145
+ child.codegenNode.arguments.push(
18146
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
18147
+ );
18148
+ }
17729
18149
  toCache.push(child);
17730
18150
  continue;
17731
18151
  }
@@ -17754,7 +18174,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17754
18174
  }
17755
18175
  }
17756
18176
  let cachedAsArray = false;
17757
- const slotCacheKeys = [];
17758
18177
  if (toCache.length === children.length && node.type === 1) {
17759
18178
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
17760
18179
  node.codegenNode.children = getCacheExpression(
@@ -17764,7 +18183,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17764
18183
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
17765
18184
  const slot = getSlotNode(node.codegenNode, "default");
17766
18185
  if (slot) {
17767
- slotCacheKeys.push(context.cached.length);
17768
18186
  slot.returns = getCacheExpression(
17769
18187
  createArrayExpression(slot.returns)
17770
18188
  );
@@ -17774,7 +18192,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17774
18192
  const slotName = findDir(node, "slot", true);
17775
18193
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
17776
18194
  if (slot) {
17777
- slotCacheKeys.push(context.cached.length);
17778
18195
  slot.returns = getCacheExpression(
17779
18196
  createArrayExpression(slot.returns)
17780
18197
  );
@@ -17784,23 +18201,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
17784
18201
  }
17785
18202
  if (!cachedAsArray) {
17786
18203
  for (const child of toCache) {
17787
- slotCacheKeys.push(context.cached.length);
17788
18204
  child.codegenNode = context.cache(child.codegenNode);
17789
18205
  }
17790
18206
  }
17791
- 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) {
17792
- node.codegenNode.children.properties.push(
17793
- createObjectProperty(
17794
- `__`,
17795
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
17796
- )
17797
- );
17798
- }
17799
18207
  function getCacheExpression(value) {
17800
18208
  const exp = context.cache(value);
17801
- if (inFor && context.hmr) {
17802
- exp.needArraySpread = true;
17803
- }
18209
+ exp.needArraySpread = true;
17804
18210
  return exp;
17805
18211
  }
17806
18212
  function getSlotNode(node2, name) {
@@ -19315,7 +19721,7 @@ function isConst(type) {
19315
19721
  }
19316
19722
 
19317
19723
  const transformIf = createStructuralDirectiveTransform(
19318
- /^(if|else|else-if)$/,
19724
+ /^(?:if|else|else-if)$/,
19319
19725
  (node, dir, context) => {
19320
19726
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
19321
19727
  const siblings = context.parent.children;
@@ -19384,7 +19790,7 @@ function processIf(node, dir, context, processCodegen) {
19384
19790
  continue;
19385
19791
  }
19386
19792
  if (sibling && sibling.type === 9) {
19387
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
19793
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
19388
19794
  context.onError(
19389
19795
  createCompilerError(30, node.loc)
19390
19796
  );
@@ -19533,90 +19939,6 @@ function getParentCondition(node) {
19533
19939
  }
19534
19940
  }
19535
19941
 
19536
- const transformBind = (dir, _node, context) => {
19537
- const { modifiers, loc } = dir;
19538
- const arg = dir.arg;
19539
- let { exp } = dir;
19540
- if (exp && exp.type === 4 && !exp.content.trim()) {
19541
- {
19542
- context.onError(
19543
- createCompilerError(34, loc)
19544
- );
19545
- return {
19546
- props: [
19547
- createObjectProperty(arg, createSimpleExpression("", true, loc))
19548
- ]
19549
- };
19550
- }
19551
- }
19552
- if (!exp) {
19553
- if (arg.type !== 4 || !arg.isStatic) {
19554
- context.onError(
19555
- createCompilerError(
19556
- 52,
19557
- arg.loc
19558
- )
19559
- );
19560
- return {
19561
- props: [
19562
- createObjectProperty(arg, createSimpleExpression("", true, loc))
19563
- ]
19564
- };
19565
- }
19566
- transformBindShorthand(dir, context);
19567
- exp = dir.exp;
19568
- }
19569
- if (arg.type !== 4) {
19570
- arg.children.unshift(`(`);
19571
- arg.children.push(`) || ""`);
19572
- } else if (!arg.isStatic) {
19573
- arg.content = `${arg.content} || ""`;
19574
- }
19575
- if (modifiers.some((mod) => mod.content === "camel")) {
19576
- if (arg.type === 4) {
19577
- if (arg.isStatic) {
19578
- arg.content = camelize(arg.content);
19579
- } else {
19580
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
19581
- }
19582
- } else {
19583
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
19584
- arg.children.push(`)`);
19585
- }
19586
- }
19587
- if (!context.inSSR) {
19588
- if (modifiers.some((mod) => mod.content === "prop")) {
19589
- injectPrefix(arg, ".");
19590
- }
19591
- if (modifiers.some((mod) => mod.content === "attr")) {
19592
- injectPrefix(arg, "^");
19593
- }
19594
- }
19595
- return {
19596
- props: [createObjectProperty(arg, exp)]
19597
- };
19598
- };
19599
- const transformBindShorthand = (dir, context) => {
19600
- const arg = dir.arg;
19601
- const propName = camelize(arg.content);
19602
- dir.exp = createSimpleExpression(propName, false, arg.loc);
19603
- {
19604
- dir.exp = processExpression(dir.exp, context);
19605
- }
19606
- };
19607
- const injectPrefix = (arg, prefix) => {
19608
- if (arg.type === 4) {
19609
- if (arg.isStatic) {
19610
- arg.content = prefix + arg.content;
19611
- } else {
19612
- arg.content = `\`${prefix}\${${arg.content}}\``;
19613
- }
19614
- } else {
19615
- arg.children.unshift(`'${prefix}' + (`);
19616
- arg.children.push(`)`);
19617
- }
19618
- };
19619
-
19620
19942
  const transformFor = createStructuralDirectiveTransform(
19621
19943
  "for",
19622
19944
  (node, dir, context) => {
@@ -19629,9 +19951,6 @@ const transformFor = createStructuralDirectiveTransform(
19629
19951
  const memo = findDir(node, "memo");
19630
19952
  const keyProp = findProp(node, `key`, false, true);
19631
19953
  const isDirKey = keyProp && keyProp.type === 7;
19632
- if (isDirKey && !keyProp.exp) {
19633
- transformBindShorthand(keyProp, context);
19634
- }
19635
19954
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
19636
19955
  if (memo && keyExp && isDirKey) {
19637
19956
  {
@@ -19912,7 +20231,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19912
20231
  const dynamicSlots = [];
19913
20232
  let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
19914
20233
  if (!context.ssr && context.prefixIdentifiers) {
19915
- hasDynamicSlots = hasScopeRef(node, context.identifiers);
20234
+ hasDynamicSlots = node.props.some(
20235
+ (prop) => isVSlot(prop) && (hasScopeRef(prop.arg, context.identifiers) || hasScopeRef(prop.exp, context.identifiers))
20236
+ ) || children.some((child) => hasScopeRef(child, context.identifiers));
19916
20237
  }
19917
20238
  const onComponentSlot = findDir(node, "slot", true);
19918
20239
  if (onComponentSlot) {
@@ -19975,7 +20296,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19975
20296
  );
19976
20297
  } else if (vElse = findDir(
19977
20298
  slotElement,
19978
- /^else(-if)?$/,
20299
+ /^else(?:-if)?$/,
19979
20300
  true
19980
20301
  /* allowEmpty */
19981
20302
  )) {
@@ -19987,7 +20308,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19987
20308
  break;
19988
20309
  }
19989
20310
  }
19990
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
20311
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
19991
20312
  let conditional = dynamicSlots[dynamicSlots.length - 1];
19992
20313
  while (conditional.alternate.type === 19) {
19993
20314
  conditional = conditional.alternate;
@@ -20945,6 +21266,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
20945
21266
  return ret;
20946
21267
  };
20947
21268
 
21269
+ const transformBind = (dir, _node, context) => {
21270
+ const { modifiers, loc } = dir;
21271
+ const arg = dir.arg;
21272
+ let { exp } = dir;
21273
+ if (exp && exp.type === 4 && !exp.content.trim()) {
21274
+ {
21275
+ context.onError(
21276
+ createCompilerError(34, loc)
21277
+ );
21278
+ return {
21279
+ props: [
21280
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
21281
+ ]
21282
+ };
21283
+ }
21284
+ }
21285
+ if (arg.type !== 4) {
21286
+ arg.children.unshift(`(`);
21287
+ arg.children.push(`) || ""`);
21288
+ } else if (!arg.isStatic) {
21289
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
21290
+ }
21291
+ if (modifiers.some((mod) => mod.content === "camel")) {
21292
+ if (arg.type === 4) {
21293
+ if (arg.isStatic) {
21294
+ arg.content = camelize(arg.content);
21295
+ } else {
21296
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
21297
+ }
21298
+ } else {
21299
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
21300
+ arg.children.push(`)`);
21301
+ }
21302
+ }
21303
+ if (!context.inSSR) {
21304
+ if (modifiers.some((mod) => mod.content === "prop")) {
21305
+ injectPrefix(arg, ".");
21306
+ }
21307
+ if (modifiers.some((mod) => mod.content === "attr")) {
21308
+ injectPrefix(arg, "^");
21309
+ }
21310
+ }
21311
+ return {
21312
+ props: [createObjectProperty(arg, exp)]
21313
+ };
21314
+ };
21315
+ const injectPrefix = (arg, prefix) => {
21316
+ if (arg.type === 4) {
21317
+ if (arg.isStatic) {
21318
+ arg.content = prefix + arg.content;
21319
+ } else {
21320
+ arg.content = `\`${prefix}\${${arg.content}}\``;
21321
+ }
21322
+ } else {
21323
+ arg.children.unshift(`'${prefix}' + (`);
21324
+ arg.children.push(`)`);
21325
+ }
21326
+ };
21327
+
20948
21328
  const transformText = (node, context) => {
20949
21329
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
20950
21330
  return () => {
@@ -21106,7 +21486,7 @@ const transformModel$1 = (dir, node, context) => {
21106
21486
  }
21107
21487
  if (dir.modifiers.length && node.tagType === 1) {
21108
21488
  const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
21109
- const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
21489
+ const modifiersKey = arg ? isStaticExp(arg) ? getModifierPropName(arg.content) : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
21110
21490
  props.push(
21111
21491
  createObjectProperty(
21112
21492
  modifiersKey,
@@ -21278,7 +21658,7 @@ const seen = /* @__PURE__ */ new WeakSet();
21278
21658
  const transformMemo = (node, context) => {
21279
21659
  if (node.type === 1) {
21280
21660
  const dir = findDir(node, "memo");
21281
- if (!dir || seen.has(node)) {
21661
+ if (!dir || seen.has(node) || context.inSSR) {
21282
21662
  return;
21283
21663
  }
21284
21664
  seen.add(node);
@@ -21300,9 +21680,36 @@ const transformMemo = (node, context) => {
21300
21680
  }
21301
21681
  };
21302
21682
 
21683
+ const transformVBindShorthand = (node, context) => {
21684
+ if (node.type === 1) {
21685
+ for (const prop of node.props) {
21686
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
21687
+ false) && prop.arg) {
21688
+ const arg = prop.arg;
21689
+ if (arg.type !== 4 || !arg.isStatic) {
21690
+ context.onError(
21691
+ createCompilerError(
21692
+ 52,
21693
+ arg.loc
21694
+ )
21695
+ );
21696
+ prop.exp = createSimpleExpression("", true, arg.loc);
21697
+ } else {
21698
+ const propName = camelize(arg.content);
21699
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
21700
+ propName[0] === "-") {
21701
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
21702
+ }
21703
+ }
21704
+ }
21705
+ }
21706
+ }
21707
+ };
21708
+
21303
21709
  function getBaseTransformPreset(prefixIdentifiers) {
21304
21710
  return [
21305
21711
  [
21712
+ transformVBindShorthand,
21306
21713
  transformOnce,
21307
21714
  transformIf,
21308
21715
  transformMemo,
@@ -21421,7 +21828,7 @@ const parserOptions = {
21421
21828
  let ns = parent ? parent.ns : rootNamespace;
21422
21829
  if (parent && ns === 2) {
21423
21830
  if (parent.tag === "annotation-xml") {
21424
- if (tag === "svg") {
21831
+ if (isSVGTag(tag)) {
21425
21832
  return 1;
21426
21833
  }
21427
21834
  if (parent.props.some(
@@ -21438,10 +21845,10 @@ const parserOptions = {
21438
21845
  }
21439
21846
  }
21440
21847
  if (ns === 0) {
21441
- if (tag === "svg") {
21848
+ if (isSVGTag(tag)) {
21442
21849
  return 1;
21443
21850
  }
21444
- if (tag === "math") {
21851
+ if (isMathMLTag(tag)) {
21445
21852
  return 2;
21446
21853
  }
21447
21854
  }
@@ -21742,46 +22149,46 @@ const transformTransition = (node, context) => {
21742
22149
  if (node.type === 1 && node.tagType === 1) {
21743
22150
  const component = context.isBuiltInComponent(node.tag);
21744
22151
  if (component === TRANSITION) {
21745
- return () => {
21746
- if (!node.children.length) {
21747
- return;
21748
- }
21749
- if (hasMultipleChildren(node)) {
21750
- context.onError(
21751
- createDOMCompilerError(
21752
- 62,
21753
- {
21754
- start: node.children[0].loc.start,
21755
- end: node.children[node.children.length - 1].loc.end,
21756
- source: ""
21757
- }
21758
- )
21759
- );
21760
- }
21761
- const child = node.children[0];
21762
- if (child.type === 1) {
21763
- for (const p of child.props) {
21764
- if (p.type === 7 && p.name === "show") {
21765
- node.props.push({
21766
- type: 6,
21767
- name: "persisted",
21768
- nameLoc: node.loc,
21769
- value: void 0,
21770
- loc: node.loc
21771
- });
21772
- }
21773
- }
21774
- }
21775
- };
22152
+ return postTransformTransition(node, context.onError);
21776
22153
  }
21777
22154
  }
21778
22155
  };
21779
- function hasMultipleChildren(node) {
22156
+ function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
22157
+ return () => {
22158
+ if (!node.children.length) {
22159
+ return;
22160
+ }
22161
+ if (hasMultipleChildren(node)) {
22162
+ onError(
22163
+ createDOMCompilerError(62, {
22164
+ start: node.children[0].loc.start,
22165
+ end: node.children[node.children.length - 1].loc.end,
22166
+ source: ""
22167
+ })
22168
+ );
22169
+ }
22170
+ const child = node.children[0];
22171
+ if (child.type === 1) {
22172
+ for (const p of child.props) {
22173
+ if (p.type === 7 && p.name === "show") {
22174
+ node.props.push({
22175
+ type: 6,
22176
+ name: "persisted",
22177
+ nameLoc: node.loc,
22178
+ value: void 0,
22179
+ loc: node.loc
22180
+ });
22181
+ }
22182
+ }
22183
+ }
22184
+ };
22185
+ }
22186
+ function defaultHasMultipleChildren(node) {
21780
22187
  const children = node.children = node.children.filter(
21781
22188
  (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
21782
22189
  );
21783
22190
  const child = children[0];
21784
- return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
22191
+ return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
21785
22192
  }
21786
22193
 
21787
22194
  const expReplaceRE = /__VUE_EXP_START__(.*?)__VUE_EXP_END__/g;
@@ -21856,7 +22263,7 @@ const getCachedNode = (node) => {
21856
22263
  return node.codegenNode;
21857
22264
  }
21858
22265
  };
21859
- const dataAriaRE = /^(data|aria)-/;
22266
+ const dataAriaRE = /^(?:data|aria)-/;
21860
22267
  const isStringifiableAttr = (name, ns) => {
21861
22268
  return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : ns === 2 ? isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
21862
22269
  };
@@ -21867,6 +22274,9 @@ function analyzeNode(node) {
21867
22274
  if (node.type === 1 && isNonStringifiable(node.tag)) {
21868
22275
  return false;
21869
22276
  }
22277
+ if (node.type === 1 && findDir(node, "once", true)) {
22278
+ return false;
22279
+ }
21870
22280
  if (node.type === 12) {
21871
22281
  return [1, 0];
21872
22282
  }