@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.
@@ -1,12 +1,11 @@
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
  **/
6
6
  var Vue = (function () {
7
7
  'use strict';
8
8
 
9
- /*! #__NO_SIDE_EFFECTS__ */
10
9
  // @__NO_SIDE_EFFECTS__
11
10
  function makeMap(str) {
12
11
  const map = /* @__PURE__ */ Object.create(null);
@@ -62,10 +61,10 @@ var Vue = (function () {
62
61
  );
63
62
  const cacheStringFunction = (fn) => {
64
63
  const cache = /* @__PURE__ */ Object.create(null);
65
- return (str) => {
64
+ return ((str) => {
66
65
  const hit = cache[str];
67
66
  return hit || (cache[str] = fn(str));
68
- };
67
+ });
69
68
  };
70
69
  const camelizeRE = /-(\w)/g;
71
70
  const camelizeReplacer = (_, c) => c ? c.toUpperCase() : "";
@@ -85,6 +84,9 @@ var Vue = (function () {
85
84
  return s;
86
85
  }
87
86
  );
87
+ const getModifierPropName = (name) => {
88
+ return `${name === "modelValue" || name === "model-value" ? "model" : name}Modifiers${name === "model" ? "$" : ""}`;
89
+ };
88
90
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
89
91
  const invokeArrayFns = (fns, ...arg) => {
90
92
  for (let i = 0; i < fns.length; i++) {
@@ -311,6 +313,9 @@ var Vue = (function () {
311
313
  if ((key === "width" || key === "height") && (tagName === "IMG" || tagName === "VIDEO" || tagName === "CANVAS" || tagName === "SOURCE")) {
312
314
  return true;
313
315
  }
316
+ if (key === "sandbox" && tagName === "IFRAME") {
317
+ return true;
318
+ }
314
319
  return false;
315
320
  }
316
321
 
@@ -500,6 +505,7 @@ var Vue = (function () {
500
505
  const notifyBuffer = [];
501
506
  let batchDepth = 0;
502
507
  let activeSub = void 0;
508
+ let globalVersion = 0;
503
509
  let notifyIndex = 0;
504
510
  let notifyBufferLength = 0;
505
511
  function setActiveSub(sub) {
@@ -522,17 +528,18 @@ var Vue = (function () {
522
528
  if (prevDep !== void 0 && prevDep.dep === dep) {
523
529
  return;
524
530
  }
525
- let nextDep = void 0;
526
- const recursedCheck = sub.flags & 4 /* RecursedCheck */;
527
- if (recursedCheck) {
528
- nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
529
- if (nextDep !== void 0 && nextDep.dep === dep) {
530
- sub.depsTail = nextDep;
531
- return;
532
- }
531
+ const nextDep = prevDep !== void 0 ? prevDep.nextDep : sub.deps;
532
+ if (nextDep !== void 0 && nextDep.dep === dep) {
533
+ nextDep.version = globalVersion;
534
+ sub.depsTail = nextDep;
535
+ return;
533
536
  }
534
537
  const prevSub = dep.subsTail;
538
+ if (prevSub !== void 0 && prevSub.version === globalVersion && prevSub.sub === sub) {
539
+ return;
540
+ }
535
541
  const newLink = sub.depsTail = dep.subsTail = {
542
+ version: globalVersion,
536
543
  dep,
537
544
  sub,
538
545
  prevDep,
@@ -638,6 +645,7 @@ var Vue = (function () {
638
645
  } while (true);
639
646
  }
640
647
  function startTracking(sub) {
648
+ ++globalVersion;
641
649
  sub.depsTail = void 0;
642
650
  sub.flags = sub.flags & -57 | 4 /* RecursedCheck */;
643
651
  return setActiveSub(sub);
@@ -738,18 +746,12 @@ var Vue = (function () {
738
746
  } while (link2 !== void 0);
739
747
  }
740
748
  function isValidLink(checkLink, sub) {
741
- const depsTail = sub.depsTail;
742
- if (depsTail !== void 0) {
743
- let link2 = sub.deps;
744
- do {
745
- if (link2 === checkLink) {
746
- return true;
747
- }
748
- if (link2 === depsTail) {
749
- break;
750
- }
751
- link2 = link2.nextDep;
752
- } while (link2 !== void 0);
749
+ let link2 = sub.depsTail;
750
+ while (link2 !== void 0) {
751
+ if (link2 === checkLink) {
752
+ return true;
753
+ }
754
+ link2 = link2.prevDep;
753
755
  }
754
756
  return false;
755
757
  }
@@ -989,7 +991,7 @@ var Vue = (function () {
989
991
  join(separator) {
990
992
  return reactiveReadArray(this).join(separator);
991
993
  },
992
- // keys() iterator only reads `length`, no optimisation required
994
+ // keys() iterator only reads `length`, no optimization required
993
995
  lastIndexOf(...args) {
994
996
  return searchProxy(this, "lastIndexOf", args);
995
997
  },
@@ -1041,7 +1043,7 @@ var Vue = (function () {
1041
1043
  iter._next = iter.next;
1042
1044
  iter.next = () => {
1043
1045
  const result = iter._next();
1044
- if (result.value) {
1046
+ if (!result.done) {
1045
1047
  result.value = wrapValue(result.value);
1046
1048
  }
1047
1049
  return result;
@@ -1172,7 +1174,8 @@ var Vue = (function () {
1172
1174
  return res;
1173
1175
  }
1174
1176
  if (isRef(res)) {
1175
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1177
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1178
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1176
1179
  }
1177
1180
  if (isObject(res)) {
1178
1181
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -1194,7 +1197,13 @@ var Vue = (function () {
1194
1197
  }
1195
1198
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1196
1199
  if (isOldValueReadonly) {
1197
- return false;
1200
+ {
1201
+ warn$2(
1202
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1203
+ target[key]
1204
+ );
1205
+ }
1206
+ return true;
1198
1207
  } else {
1199
1208
  oldValue.value = value;
1200
1209
  return true;
@@ -1339,7 +1348,7 @@ var Vue = (function () {
1339
1348
  get size() {
1340
1349
  const target = this["__v_raw"];
1341
1350
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1342
- return Reflect.get(target, "size", target);
1351
+ return target.size;
1343
1352
  },
1344
1353
  has(key) {
1345
1354
  const target = this["__v_raw"];
@@ -2342,11 +2351,11 @@ var Vue = (function () {
2342
2351
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2343
2352
  return value;
2344
2353
  }
2345
- seen = seen || /* @__PURE__ */ new Set();
2346
- if (seen.has(value)) {
2354
+ seen = seen || /* @__PURE__ */ new Map();
2355
+ if ((seen.get(value) || 0) >= depth) {
2347
2356
  return value;
2348
2357
  }
2349
- seen.add(value);
2358
+ seen.set(value, depth);
2350
2359
  depth--;
2351
2360
  if (isRef(value)) {
2352
2361
  traverse(value.value, depth, seen);
@@ -2892,8 +2901,10 @@ var Vue = (function () {
2892
2901
  instance.hmrRerender();
2893
2902
  } else {
2894
2903
  const i = instance;
2895
- i.renderCache = [];
2896
- i.effect.run();
2904
+ if (!(i.effect.flags & 1024)) {
2905
+ i.renderCache = [];
2906
+ i.effect.run();
2907
+ }
2897
2908
  }
2898
2909
  nextTick(() => {
2899
2910
  isHmrUpdating = false;
@@ -2906,7 +2917,12 @@ var Vue = (function () {
2906
2917
  newComp = normalizeClassComponent(newComp);
2907
2918
  updateComponentDef(record.initialDef, newComp);
2908
2919
  const instances = [...record.instances];
2909
- if (newComp.__vapor) {
2920
+ if (newComp.__vapor && !instances.some((i) => i.ceReload)) {
2921
+ for (const instance of instances) {
2922
+ if (instance.root && instance.root.ce && instance !== instance.root) {
2923
+ instance.root.ce._removeChildStyle(instance.type);
2924
+ }
2925
+ }
2910
2926
  for (const instance of instances) {
2911
2927
  instance.hmrReload(newComp);
2912
2928
  }
@@ -2935,7 +2951,10 @@ var Vue = (function () {
2935
2951
  if (parent.vapor) {
2936
2952
  parent.hmrRerender();
2937
2953
  } else {
2938
- parent.effect.run();
2954
+ if (!(parent.effect.flags & 1024)) {
2955
+ parent.renderCache = [];
2956
+ parent.effect.run();
2957
+ }
2939
2958
  }
2940
2959
  nextTick(() => {
2941
2960
  isHmrUpdating = false;
@@ -3045,7 +3064,6 @@ var Vue = (function () {
3045
3064
  _devtoolsComponentRemoved(component);
3046
3065
  }
3047
3066
  };
3048
- /*! #__NO_SIDE_EFFECTS__ */
3049
3067
  // @__NO_SIDE_EFFECTS__
3050
3068
  function createDevtoolsComponentHook(hook) {
3051
3069
  return (component) => {
@@ -3759,9 +3777,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3759
3777
  insert(mainAnchor, container, anchor);
3760
3778
  const mount = (container2, anchor2) => {
3761
3779
  if (shapeFlag & 16) {
3762
- if (parentComponent && parentComponent.isCE) {
3763
- parentComponent.ce._teleportTarget = container2;
3764
- }
3765
3780
  mountChildren(
3766
3781
  children,
3767
3782
  container2,
@@ -3783,6 +3798,9 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3783
3798
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3784
3799
  namespace = "mathml";
3785
3800
  }
3801
+ if (parentComponent && parentComponent.isCE) {
3802
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3803
+ }
3786
3804
  if (!disabled) {
3787
3805
  mount(target, targetAnchor);
3788
3806
  updateCssVars(n2, false);
@@ -3983,26 +4001,34 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
3983
4001
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3984
4002
  o: { nextSibling, parentNode, querySelector, insert, createText }
3985
4003
  }, hydrateChildren) {
4004
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
4005
+ vnode2.anchor = hydrateChildren(
4006
+ nextSibling(node2),
4007
+ vnode2,
4008
+ parentNode(node2),
4009
+ parentComponent,
4010
+ parentSuspense,
4011
+ slotScopeIds,
4012
+ optimized
4013
+ );
4014
+ vnode2.targetStart = targetStart;
4015
+ vnode2.targetAnchor = targetAnchor;
4016
+ }
3986
4017
  const target = vnode.target = resolveTarget(
3987
4018
  vnode.props,
3988
4019
  querySelector
3989
4020
  );
4021
+ const disabled = isTeleportDisabled(vnode.props);
3990
4022
  if (target) {
3991
- const disabled = isTeleportDisabled(vnode.props);
3992
4023
  const targetNode = target._lpa || target.firstChild;
3993
4024
  if (vnode.shapeFlag & 16) {
3994
4025
  if (disabled) {
3995
- vnode.anchor = hydrateChildren(
3996
- nextSibling(node),
4026
+ hydrateDisabledTeleport(
4027
+ node,
3997
4028
  vnode,
3998
- parentNode(node),
3999
- parentComponent,
4000
- parentSuspense,
4001
- slotScopeIds,
4002
- optimized
4029
+ targetNode,
4030
+ targetNode && nextSibling(targetNode)
4003
4031
  );
4004
- vnode.targetStart = targetNode;
4005
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
4006
4032
  } else {
4007
4033
  vnode.anchor = nextSibling(node);
4008
4034
  let targetAnchor = targetNode;
@@ -4033,6 +4059,10 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4033
4059
  }
4034
4060
  }
4035
4061
  updateCssVars(vnode, disabled);
4062
+ } else if (disabled) {
4063
+ if (vnode.shapeFlag & 16) {
4064
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
4065
+ }
4036
4066
  }
4037
4067
  return vnode.anchor && nextSibling(vnode.anchor);
4038
4068
  }
@@ -4073,7 +4103,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4073
4103
  isMounted: false,
4074
4104
  isLeaving: false,
4075
4105
  isUnmounting: false,
4076
- leavingVNodes: /* @__PURE__ */ new Map()
4106
+ leavingNodes: /* @__PURE__ */ new Map()
4077
4107
  };
4078
4108
  onMounted(() => {
4079
4109
  state.isMounted = true;
@@ -4105,7 +4135,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4105
4135
  onAppearCancelled: TransitionHookValidator
4106
4136
  };
4107
4137
  const recursiveGetSubtree = (instance) => {
4108
- const subTree = instance.subTree;
4138
+ const subTree = instance.type.__vapor ? instance.block : instance.subTree;
4109
4139
  return subTree.component ? recursiveGetSubtree(subTree.component) : subTree;
4110
4140
  };
4111
4141
  const BaseTransitionImpl = {
@@ -4122,9 +4152,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4122
4152
  const child = findNonCommentChild(children);
4123
4153
  const rawProps = toRaw(props);
4124
4154
  const { mode } = rawProps;
4125
- if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
4126
- warn$1(`invalid <transition> mode: ${mode}`);
4127
- }
4155
+ checkTransitionMode(mode);
4128
4156
  if (state.isLeaving) {
4129
4157
  return emptyPlaceholder(child);
4130
4158
  }
@@ -4144,7 +4172,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4144
4172
  setTransitionHooks(innerChild, enterHooks);
4145
4173
  }
4146
4174
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
4147
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
4175
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
4148
4176
  let leavingHooks = resolveTransitionHooks(
4149
4177
  oldInnerChild,
4150
4178
  rawProps,
@@ -4216,15 +4244,53 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4216
4244
  }
4217
4245
  const BaseTransition = BaseTransitionImpl;
4218
4246
  function getLeavingNodesForType(state, vnode) {
4219
- const { leavingVNodes } = state;
4220
- let leavingVNodesCache = leavingVNodes.get(vnode.type);
4247
+ const { leavingNodes } = state;
4248
+ let leavingVNodesCache = leavingNodes.get(vnode.type);
4221
4249
  if (!leavingVNodesCache) {
4222
4250
  leavingVNodesCache = /* @__PURE__ */ Object.create(null);
4223
- leavingVNodes.set(vnode.type, leavingVNodesCache);
4251
+ leavingNodes.set(vnode.type, leavingVNodesCache);
4224
4252
  }
4225
4253
  return leavingVNodesCache;
4226
4254
  }
4227
4255
  function resolveTransitionHooks(vnode, props, state, instance, postClone) {
4256
+ const key = String(vnode.key);
4257
+ const leavingVNodesCache = getLeavingNodesForType(state, vnode);
4258
+ const context = {
4259
+ setLeavingNodeCache: () => {
4260
+ leavingVNodesCache[key] = vnode;
4261
+ },
4262
+ unsetLeavingNodeCache: () => {
4263
+ if (leavingVNodesCache[key] === vnode) {
4264
+ delete leavingVNodesCache[key];
4265
+ }
4266
+ },
4267
+ earlyRemove: () => {
4268
+ const leavingVNode = leavingVNodesCache[key];
4269
+ if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
4270
+ leavingVNode.el[leaveCbKey]();
4271
+ }
4272
+ },
4273
+ cloneHooks: (vnode2) => {
4274
+ const hooks = resolveTransitionHooks(
4275
+ vnode2,
4276
+ props,
4277
+ state,
4278
+ instance,
4279
+ postClone
4280
+ );
4281
+ if (postClone) postClone(hooks);
4282
+ return hooks;
4283
+ }
4284
+ };
4285
+ return baseResolveTransitionHooks(context, props, state, instance);
4286
+ }
4287
+ function baseResolveTransitionHooks(context, props, state, instance) {
4288
+ const {
4289
+ setLeavingNodeCache,
4290
+ unsetLeavingNodeCache,
4291
+ earlyRemove,
4292
+ cloneHooks
4293
+ } = context;
4228
4294
  const {
4229
4295
  appear,
4230
4296
  mode,
@@ -4242,8 +4308,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4242
4308
  onAfterAppear,
4243
4309
  onAppearCancelled
4244
4310
  } = props;
4245
- const key = String(vnode.key);
4246
- const leavingVNodesCache = getLeavingNodesForType(state, vnode);
4247
4311
  const callHook = (hook, args) => {
4248
4312
  hook && callWithAsyncErrorHandling(
4249
4313
  hook,
@@ -4279,10 +4343,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4279
4343
  /* cancelled */
4280
4344
  );
4281
4345
  }
4282
- const leavingVNode = leavingVNodesCache[key];
4283
- if (leavingVNode && isSameVNodeType(vnode, leavingVNode) && leavingVNode.el[leaveCbKey]) {
4284
- leavingVNode.el[leaveCbKey]();
4285
- }
4346
+ earlyRemove();
4286
4347
  callHook(hook, [el]);
4287
4348
  },
4288
4349
  enter(el) {
@@ -4319,7 +4380,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4319
4380
  }
4320
4381
  },
4321
4382
  leave(el, remove) {
4322
- const key2 = String(vnode.key);
4323
4383
  if (el[enterCbKey$1]) {
4324
4384
  el[enterCbKey$1](
4325
4385
  true
@@ -4341,27 +4401,17 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4341
4401
  callHook(onAfterLeave, [el]);
4342
4402
  }
4343
4403
  el[leaveCbKey] = void 0;
4344
- if (leavingVNodesCache[key2] === vnode) {
4345
- delete leavingVNodesCache[key2];
4346
- }
4404
+ unsetLeavingNodeCache(el);
4347
4405
  };
4348
- leavingVNodesCache[key2] = vnode;
4406
+ setLeavingNodeCache(el);
4349
4407
  if (onLeave) {
4350
4408
  callAsyncHook(onLeave, [el, done]);
4351
4409
  } else {
4352
4410
  done();
4353
4411
  }
4354
4412
  },
4355
- clone(vnode2) {
4356
- const hooks2 = resolveTransitionHooks(
4357
- vnode2,
4358
- props,
4359
- state,
4360
- instance,
4361
- postClone
4362
- );
4363
- if (postClone) postClone(hooks2);
4364
- return hooks2;
4413
+ clone(node) {
4414
+ return cloneHooks(node);
4365
4415
  }
4366
4416
  };
4367
4417
  return hooks;
@@ -4395,8 +4445,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4395
4445
  }
4396
4446
  function setTransitionHooks(vnode, hooks) {
4397
4447
  if (vnode.shapeFlag & 6 && vnode.component) {
4398
- vnode.transition = hooks;
4399
- setTransitionHooks(vnode.component.subTree, hooks);
4448
+ if (vnode.type.__vapor) {
4449
+ getVaporInterface(vnode.component, vnode).setTransitionHooks(
4450
+ vnode.component,
4451
+ hooks
4452
+ );
4453
+ } else {
4454
+ vnode.transition = hooks;
4455
+ setTransitionHooks(vnode.component.subTree, hooks);
4456
+ }
4400
4457
  } else if (vnode.shapeFlag & 128) {
4401
4458
  vnode.ssContent.transition = hooks.clone(vnode.ssContent);
4402
4459
  vnode.ssFallback.transition = hooks.clone(vnode.ssFallback);
@@ -4426,8 +4483,12 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4426
4483
  }
4427
4484
  return ret;
4428
4485
  }
4486
+ function checkTransitionMode(mode) {
4487
+ if (mode && mode !== "in-out" && mode !== "out-in" && mode !== "default") {
4488
+ warn$1(`invalid <transition> mode: ${mode}`);
4489
+ }
4490
+ }
4429
4491
 
4430
- /*! #__NO_SIDE_EFFECTS__ */
4431
4492
  // @__NO_SIDE_EFFECTS__
4432
4493
  function defineComponent(options, extraOptions) {
4433
4494
  return isFunction(options) ? (
@@ -4480,6 +4541,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4480
4541
  return ret;
4481
4542
  }
4482
4543
 
4544
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
4483
4545
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4484
4546
  if (isArray(rawRef)) {
4485
4547
  rawRef.forEach(
@@ -4511,28 +4573,23 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4511
4573
  const oldRef = oldRawRef && oldRawRef.r;
4512
4574
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4513
4575
  const setupState = owner.setupState;
4514
- const rawSetupState = toRaw(setupState);
4515
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4516
- {
4517
- if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4518
- warn$1(
4519
- `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
4520
- );
4521
- }
4522
- if (knownTemplateRefs.has(rawSetupState[key])) {
4523
- return false;
4524
- }
4525
- }
4526
- return hasOwn(rawSetupState, key);
4576
+ const canSetSetupRef = createCanSetSetupRefChecker(setupState);
4577
+ const canSetRef = (ref2) => {
4578
+ return !knownTemplateRefs.has(ref2);
4527
4579
  };
4528
4580
  if (oldRef != null && oldRef !== ref) {
4581
+ invalidatePendingSetRef(oldRawRef);
4529
4582
  if (isString(oldRef)) {
4530
4583
  refs[oldRef] = null;
4531
4584
  if (canSetSetupRef(oldRef)) {
4532
4585
  setupState[oldRef] = null;
4533
4586
  }
4534
4587
  } else if (isRef(oldRef)) {
4535
- oldRef.value = null;
4588
+ if (canSetRef(oldRef)) {
4589
+ oldRef.value = null;
4590
+ }
4591
+ const oldRawRefAtom = oldRawRef;
4592
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4536
4593
  }
4537
4594
  }
4538
4595
  if (isFunction(ref)) {
@@ -4543,7 +4600,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4543
4600
  if (_isString || _isRef) {
4544
4601
  const doSet = () => {
4545
4602
  if (rawRef.f) {
4546
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4603
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4547
4604
  if (isUnmount) {
4548
4605
  isArray(existing) && remove(existing, refValue);
4549
4606
  } else {
@@ -4554,8 +4611,11 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4554
4611
  setupState[ref] = refs[ref];
4555
4612
  }
4556
4613
  } else {
4557
- ref.value = [refValue];
4558
- if (rawRef.k) refs[rawRef.k] = ref.value;
4614
+ const newVal = [refValue];
4615
+ if (canSetRef(ref)) {
4616
+ ref.value = newVal;
4617
+ }
4618
+ if (rawRef.k) refs[rawRef.k] = newVal;
4559
4619
  }
4560
4620
  } else if (!existing.includes(refValue)) {
4561
4621
  existing.push(refValue);
@@ -4567,15 +4627,23 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4567
4627
  setupState[ref] = value;
4568
4628
  }
4569
4629
  } else if (_isRef) {
4570
- ref.value = value;
4630
+ if (canSetRef(ref)) {
4631
+ ref.value = value;
4632
+ }
4571
4633
  if (rawRef.k) refs[rawRef.k] = value;
4572
4634
  } else {
4573
4635
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
4574
4636
  }
4575
4637
  };
4576
4638
  if (value) {
4577
- queuePostRenderEffect(doSet, -1, parentSuspense);
4639
+ const job = () => {
4640
+ doSet();
4641
+ pendingSetRefMap.delete(rawRef);
4642
+ };
4643
+ pendingSetRefMap.set(rawRef, job);
4644
+ queuePostRenderEffect(job, -1, parentSuspense);
4578
4645
  } else {
4646
+ invalidatePendingSetRef(rawRef);
4579
4647
  doSet();
4580
4648
  }
4581
4649
  } else {
@@ -4583,6 +4651,29 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4583
4651
  }
4584
4652
  }
4585
4653
  }
4654
+ function createCanSetSetupRefChecker(setupState) {
4655
+ const rawSetupState = toRaw(setupState);
4656
+ return setupState === void 0 || setupState === EMPTY_OBJ ? NO : (key) => {
4657
+ {
4658
+ if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4659
+ warn$1(
4660
+ `Template ref "${key}" used on a non-ref value. It will not work in the production build.`
4661
+ );
4662
+ }
4663
+ if (knownTemplateRefs.has(rawSetupState[key])) {
4664
+ return false;
4665
+ }
4666
+ }
4667
+ return hasOwn(rawSetupState, key);
4668
+ };
4669
+ }
4670
+ function invalidatePendingSetRef(rawRef) {
4671
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
4672
+ if (pendingSetRef) {
4673
+ pendingSetRef.flags |= 4;
4674
+ pendingSetRefMap.delete(rawRef);
4675
+ }
4676
+ }
4586
4677
 
4587
4678
  let hasLoggedMismatchError = false;
4588
4679
  const logMismatchError = () => {
@@ -4679,7 +4770,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4679
4770
  }
4680
4771
  break;
4681
4772
  case Comment:
4682
- if (isTemplateNode(node)) {
4773
+ if (isTemplateNode$1(node)) {
4683
4774
  nextNode = nextSibling(node);
4684
4775
  replaceNode(
4685
4776
  vnode.el = node.content.firstChild,
@@ -4727,9 +4818,15 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4727
4818
  );
4728
4819
  }
4729
4820
  break;
4821
+ case VaporSlot:
4822
+ nextNode = getVaporInterface(parentComponent, vnode).hydrateSlot(
4823
+ vnode,
4824
+ node
4825
+ );
4826
+ break;
4730
4827
  default:
4731
4828
  if (shapeFlag & 1) {
4732
- if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode(node)) {
4829
+ if ((domType !== 1 || vnode.type.toLowerCase() !== node.tagName.toLowerCase()) && !isTemplateNode$1(node)) {
4733
4830
  nextNode = onMismatch();
4734
4831
  } else {
4735
4832
  nextNode = hydrateElement(
@@ -4742,9 +4839,6 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4742
4839
  );
4743
4840
  }
4744
4841
  } else if (shapeFlag & 6) {
4745
- if (vnode.type.__vapor) {
4746
- throw new Error("Vapor component hydration is not supported yet.");
4747
- }
4748
4842
  vnode.slotScopeIds = slotScopeIds;
4749
4843
  const container = parentNode(node);
4750
4844
  if (isFragmentStart) {
@@ -4754,15 +4848,25 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4754
4848
  } else {
4755
4849
  nextNode = nextSibling(node);
4756
4850
  }
4757
- mountComponent(
4758
- vnode,
4759
- container,
4760
- null,
4761
- parentComponent,
4762
- parentSuspense,
4763
- getContainerType(container),
4764
- optimized
4765
- );
4851
+ if (vnode.type.__vapor) {
4852
+ getVaporInterface(parentComponent, vnode).hydrate(
4853
+ vnode,
4854
+ node,
4855
+ container,
4856
+ null,
4857
+ parentComponent
4858
+ );
4859
+ } else {
4860
+ mountComponent(
4861
+ vnode,
4862
+ container,
4863
+ null,
4864
+ parentComponent,
4865
+ parentSuspense,
4866
+ getContainerType(container),
4867
+ optimized
4868
+ );
4869
+ }
4766
4870
  if (isAsyncWrapper(vnode) && !vnode.type.__asyncResolved) {
4767
4871
  let subTree;
4768
4872
  if (isFragmentStart) {
@@ -4819,7 +4923,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4819
4923
  invokeDirectiveHook(vnode, null, parentComponent, "created");
4820
4924
  }
4821
4925
  let needCallTransitionHooks = false;
4822
- if (isTemplateNode(el)) {
4926
+ if (isTemplateNode$1(el)) {
4823
4927
  needCallTransitionHooks = needTransition(
4824
4928
  null,
4825
4929
  // no need check parentSuspense in hydration
@@ -4847,7 +4951,7 @@ Details: https://v3-migration.vuejs.org/breaking-changes/migration-build.html`
4847
4951
  );
4848
4952
  let hasWarned = false;
4849
4953
  while (next) {
4850
- if (!isMismatchAllowed(el, 1 /* CHILDREN */)) {
4954
+ if (!isMismatchAllowed(el, 1)) {
4851
4955
  if (!hasWarned) {
4852
4956
  warn$1(
4853
4957
  `Hydration children mismatch on`,
@@ -4868,14 +4972,16 @@ Server rendered element contains more child nodes than client vdom.`
4868
4972
  if (clientText[0] === "\n" && (el.tagName === "PRE" || el.tagName === "TEXTAREA")) {
4869
4973
  clientText = clientText.slice(1);
4870
4974
  }
4871
- if (el.textContent !== clientText) {
4872
- if (!isMismatchAllowed(el, 0 /* TEXT */)) {
4975
+ const { textContent } = el;
4976
+ if (textContent !== clientText && // innerHTML normalize \r\n or \r into a single \n in the DOM
4977
+ textContent !== clientText.replace(/\r\n|\r/g, "\n")) {
4978
+ if (!isMismatchAllowed(el, 0)) {
4873
4979
  warn$1(
4874
4980
  `Hydration text content mismatch on`,
4875
4981
  el,
4876
4982
  `
4877
- - rendered on server: ${el.textContent}
4878
- - expected on client: ${vnode.children}`
4983
+ - rendered on server: ${textContent}
4984
+ - expected on client: ${clientText}`
4879
4985
  );
4880
4986
  logMismatchError();
4881
4987
  }
@@ -4951,7 +5057,7 @@ Server rendered element contains more child nodes than client vdom.`
4951
5057
  } else if (isText && !vnode.children) {
4952
5058
  insert(vnode.el = createText(""), container);
4953
5059
  } else {
4954
- if (!isMismatchAllowed(container, 1 /* CHILDREN */)) {
5060
+ if (!isMismatchAllowed(container, 1)) {
4955
5061
  if (!hasWarned) {
4956
5062
  warn$1(
4957
5063
  `Hydration children mismatch on`,
@@ -5001,7 +5107,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5001
5107
  }
5002
5108
  };
5003
5109
  const handleMismatch = (node, vnode, parentComponent, parentSuspense, slotScopeIds, isFragment) => {
5004
- if (!isMismatchAllowed(node.parentElement, 1 /* CHILDREN */)) {
5110
+ if (!isMismatchAllowed(node.parentElement, 1)) {
5005
5111
  warn$1(
5006
5112
  `Hydration node mismatch:
5007
5113
  - rendered on server:`,
@@ -5074,11 +5180,11 @@ Server rendered element contains fewer child nodes than client vdom.`
5074
5180
  parent = parent.parent;
5075
5181
  }
5076
5182
  };
5077
- const isTemplateNode = (node) => {
5078
- return node.nodeType === 1 && node.tagName === "TEMPLATE";
5079
- };
5080
5183
  return [hydrate, hydrateNode];
5081
5184
  }
5185
+ const isTemplateNode$1 = (node) => {
5186
+ return node.nodeType === 1 && node.tagName === "TEMPLATE";
5187
+ };
5082
5188
  function propHasMismatch(el, key, clientValue, vnode, instance) {
5083
5189
  let mismatchType;
5084
5190
  let mismatchKey;
@@ -5093,7 +5199,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5093
5199
  }
5094
5200
  expected = normalizeClass(clientValue);
5095
5201
  if (!isSetEqual(toClassSet(actual || ""), toClassSet(expected))) {
5096
- mismatchType = 2 /* CLASS */;
5202
+ mismatchType = 2;
5097
5203
  mismatchKey = `class`;
5098
5204
  }
5099
5205
  } else if (key === "style") {
@@ -5112,31 +5218,43 @@ Server rendered element contains fewer child nodes than client vdom.`
5112
5218
  resolveCssVars(instance, vnode, expectedMap);
5113
5219
  }
5114
5220
  if (!isMapEqual(actualMap, expectedMap)) {
5115
- mismatchType = 3 /* STYLE */;
5221
+ mismatchType = 3;
5116
5222
  mismatchKey = "style";
5117
5223
  }
5118
- } else if (el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key))) {
5119
- if (isBooleanAttr(key)) {
5120
- actual = el.hasAttribute(key);
5121
- expected = includeBooleanAttr(clientValue);
5122
- } else if (clientValue == null) {
5123
- actual = el.hasAttribute(key);
5124
- expected = false;
5125
- } else {
5126
- if (el.hasAttribute(key)) {
5127
- actual = el.getAttribute(key);
5128
- } else if (key === "value" && el.tagName === "TEXTAREA") {
5129
- actual = el.value;
5130
- } else {
5131
- actual = false;
5132
- }
5133
- expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
5134
- }
5224
+ } else if (isValidHtmlOrSvgAttribute(el, key)) {
5225
+ ({ actual, expected } = getAttributeMismatch(el, key, clientValue));
5135
5226
  if (actual !== expected) {
5136
- mismatchType = 4 /* ATTRIBUTE */;
5227
+ mismatchType = 4;
5137
5228
  mismatchKey = key;
5138
5229
  }
5139
5230
  }
5231
+ return warnPropMismatch(el, mismatchKey, mismatchType, actual, expected);
5232
+ }
5233
+ function getAttributeMismatch(el, key, clientValue) {
5234
+ let actual;
5235
+ let expected;
5236
+ if (isBooleanAttr(key)) {
5237
+ actual = el.hasAttribute(key);
5238
+ expected = includeBooleanAttr(clientValue);
5239
+ } else if (clientValue == null) {
5240
+ actual = el.hasAttribute(key);
5241
+ expected = false;
5242
+ } else {
5243
+ if (el.hasAttribute(key)) {
5244
+ actual = el.getAttribute(key);
5245
+ } else if (key === "value" && el.tagName === "TEXTAREA") {
5246
+ actual = el.value;
5247
+ } else {
5248
+ actual = false;
5249
+ }
5250
+ expected = isRenderableAttrValue(clientValue) ? String(clientValue) : false;
5251
+ }
5252
+ return { actual, expected };
5253
+ }
5254
+ function isValidHtmlOrSvgAttribute(el, key) {
5255
+ return el instanceof SVGElement && isKnownSvgAttr(key) || el instanceof HTMLElement && (isBooleanAttr(key) || isKnownHtmlAttr(key));
5256
+ }
5257
+ function warnPropMismatch(el, mismatchKey, mismatchType, actual, expected) {
5140
5258
  if (mismatchType != null && !isMismatchAllowed(el, mismatchType)) {
5141
5259
  const format = (v) => v === false ? `(not rendered)` : `${mismatchKey}="${v}"`;
5142
5260
  const preSegment = `Hydration ${MismatchTypeString[mismatchType]} mismatch on`;
@@ -5208,14 +5326,14 @@ Server rendered element contains fewer child nodes than client vdom.`
5208
5326
  }
5209
5327
  const allowMismatchAttr = "data-allow-mismatch";
5210
5328
  const MismatchTypeString = {
5211
- [0 /* TEXT */]: "text",
5212
- [1 /* CHILDREN */]: "children",
5213
- [2 /* CLASS */]: "class",
5214
- [3 /* STYLE */]: "style",
5215
- [4 /* ATTRIBUTE */]: "attribute"
5329
+ [0]: "text",
5330
+ [1]: "children",
5331
+ [2]: "class",
5332
+ [3]: "style",
5333
+ [4]: "attribute"
5216
5334
  };
5217
5335
  function isMismatchAllowed(el, allowedType) {
5218
- if (allowedType === 0 /* TEXT */ || allowedType === 1 /* CHILDREN */) {
5336
+ if (allowedType === 0 || allowedType === 1) {
5219
5337
  while (el && !el.hasAttribute(allowMismatchAttr)) {
5220
5338
  el = el.parentElement;
5221
5339
  }
@@ -5227,7 +5345,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5227
5345
  return true;
5228
5346
  } else {
5229
5347
  const list = allowedAttr.split(",");
5230
- if (allowedType === 0 /* TEXT */ && list.includes("children")) {
5348
+ if (allowedType === 0 && list.includes("children")) {
5231
5349
  return true;
5232
5350
  }
5233
5351
  return list.includes(MismatchTypeString[allowedType]);
@@ -5284,7 +5402,9 @@ Server rendered element contains fewer child nodes than client vdom.`
5284
5402
  hasHydrated = true;
5285
5403
  teardown();
5286
5404
  hydrate();
5287
- e.target.dispatchEvent(new e.constructor(e.type, e));
5405
+ if (!(`$evt${e.type}` in e.target)) {
5406
+ e.target.dispatchEvent(new e.constructor(e.type, e));
5407
+ }
5288
5408
  }
5289
5409
  };
5290
5410
  const teardown = () => {
@@ -5326,104 +5446,46 @@ Server rendered element contains fewer child nodes than client vdom.`
5326
5446
  }
5327
5447
 
5328
5448
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
5329
- /*! #__NO_SIDE_EFFECTS__ */
5330
5449
  // @__NO_SIDE_EFFECTS__
5331
5450
  function defineAsyncComponent(source) {
5332
- if (isFunction(source)) {
5333
- source = { loader: source };
5334
- }
5335
5451
  const {
5336
- loader,
5337
- loadingComponent,
5338
- errorComponent,
5339
- delay = 200,
5340
- hydrate: hydrateStrategy,
5341
- timeout,
5342
- // undefined = never times out
5343
- suspensible = true,
5344
- onError: userOnError
5345
- } = source;
5346
- let pendingRequest = null;
5347
- let resolvedComp;
5348
- let retries = 0;
5349
- const retry = () => {
5350
- retries++;
5351
- pendingRequest = null;
5352
- return load();
5353
- };
5354
- const load = () => {
5355
- let thisRequest;
5356
- return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
5357
- err = err instanceof Error ? err : new Error(String(err));
5358
- if (userOnError) {
5359
- return new Promise((resolve, reject) => {
5360
- const userRetry = () => resolve(retry());
5361
- const userFail = () => reject(err);
5362
- userOnError(err, userRetry, userFail, retries + 1);
5363
- });
5364
- } else {
5365
- throw err;
5366
- }
5367
- }).then((comp) => {
5368
- if (thisRequest !== pendingRequest && pendingRequest) {
5369
- return pendingRequest;
5370
- }
5371
- if (!comp) {
5372
- warn$1(
5373
- `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
5374
- );
5375
- }
5376
- if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
5377
- comp = comp.default;
5378
- }
5379
- if (comp && !isObject(comp) && !isFunction(comp)) {
5380
- throw new Error(`Invalid async component load result: ${comp}`);
5381
- }
5382
- resolvedComp = comp;
5383
- return comp;
5384
- }));
5385
- };
5452
+ load,
5453
+ getResolvedComp,
5454
+ setPendingRequest,
5455
+ source: {
5456
+ loadingComponent,
5457
+ errorComponent,
5458
+ delay,
5459
+ hydrate: hydrateStrategy,
5460
+ timeout,
5461
+ suspensible = true
5462
+ }
5463
+ } = createAsyncComponentContext(source);
5386
5464
  return defineComponent({
5387
5465
  name: "AsyncComponentWrapper",
5388
5466
  __asyncLoader: load,
5389
5467
  __asyncHydrate(el, instance, hydrate) {
5390
- let patched = false;
5391
- const doHydrate = hydrateStrategy ? () => {
5392
- const performHydrate = () => {
5393
- if (patched) {
5394
- warn$1(
5395
- `Skipping lazy hydration for component '${getComponentName(resolvedComp)}': it was updated before lazy hydration performed.`
5396
- );
5397
- return;
5398
- }
5399
- hydrate();
5400
- };
5401
- const teardown = hydrateStrategy(
5402
- performHydrate,
5403
- (cb) => forEachElement(el, cb)
5404
- );
5405
- if (teardown) {
5406
- (instance.bum || (instance.bum = [])).push(teardown);
5407
- }
5408
- (instance.u || (instance.u = [])).push(() => patched = true);
5409
- } : hydrate;
5410
- if (resolvedComp) {
5411
- doHydrate();
5412
- } else {
5413
- load().then(() => !instance.isUnmounted && doHydrate());
5414
- }
5468
+ performAsyncHydrate(
5469
+ el,
5470
+ instance,
5471
+ hydrate,
5472
+ getResolvedComp,
5473
+ load,
5474
+ hydrateStrategy
5475
+ );
5415
5476
  },
5416
5477
  get __asyncResolved() {
5417
- return resolvedComp;
5478
+ return getResolvedComp();
5418
5479
  },
5419
5480
  setup() {
5420
5481
  const instance = currentInstance;
5421
5482
  markAsyncBoundary(instance);
5483
+ let resolvedComp = getResolvedComp();
5422
5484
  if (resolvedComp) {
5423
5485
  return () => createInnerComp(resolvedComp, instance);
5424
5486
  }
5425
5487
  const onError = (err) => {
5426
- pendingRequest = null;
5488
+ setPendingRequest(null);
5427
5489
  handleError(
5428
5490
  err,
5429
5491
  instance,
@@ -5441,25 +5503,11 @@ Server rendered element contains fewer child nodes than client vdom.`
5441
5503
  }) : null;
5442
5504
  });
5443
5505
  }
5444
- const loaded = ref(false);
5445
- const error = ref();
5446
- const delayed = ref(!!delay);
5447
- if (delay) {
5448
- setTimeout(() => {
5449
- delayed.value = false;
5450
- }, delay);
5451
- }
5452
- if (timeout != null) {
5453
- setTimeout(() => {
5454
- if (!loaded.value && !error.value) {
5455
- const err = new Error(
5456
- `Async component timed out after ${timeout}ms.`
5457
- );
5458
- onError(err);
5459
- error.value = err;
5460
- }
5461
- }, timeout);
5462
- }
5506
+ const { loaded, error, delayed } = useAsyncComponentState(
5507
+ delay,
5508
+ timeout,
5509
+ onError
5510
+ );
5463
5511
  load().then(() => {
5464
5512
  loaded.value = true;
5465
5513
  if (instance.parent && instance.parent.vnode && isKeepAlive(instance.parent.vnode)) {
@@ -5470,6 +5518,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5470
5518
  error.value = err;
5471
5519
  });
5472
5520
  return () => {
5521
+ resolvedComp = getResolvedComp();
5473
5522
  if (loaded.value && resolvedComp) {
5474
5523
  return createInnerComp(resolvedComp, instance);
5475
5524
  } else if (error.value && errorComponent) {
@@ -5477,7 +5526,10 @@ Server rendered element contains fewer child nodes than client vdom.`
5477
5526
  error: error.value
5478
5527
  });
5479
5528
  } else if (loadingComponent && !delayed.value) {
5480
- return createVNode(loadingComponent);
5529
+ return createInnerComp(
5530
+ loadingComponent,
5531
+ instance
5532
+ );
5481
5533
  }
5482
5534
  };
5483
5535
  }
@@ -5491,6 +5543,108 @@ Server rendered element contains fewer child nodes than client vdom.`
5491
5543
  delete parent.vnode.ce;
5492
5544
  return vnode;
5493
5545
  }
5546
+ function createAsyncComponentContext(source) {
5547
+ if (isFunction(source)) {
5548
+ source = { loader: source };
5549
+ }
5550
+ const { loader, onError: userOnError } = source;
5551
+ let pendingRequest = null;
5552
+ let resolvedComp;
5553
+ let retries = 0;
5554
+ const retry = () => {
5555
+ retries++;
5556
+ pendingRequest = null;
5557
+ return load();
5558
+ };
5559
+ const load = () => {
5560
+ let thisRequest;
5561
+ return pendingRequest || (thisRequest = pendingRequest = loader().catch((err) => {
5562
+ err = err instanceof Error ? err : new Error(String(err));
5563
+ if (userOnError) {
5564
+ return new Promise((resolve, reject) => {
5565
+ const userRetry = () => resolve(retry());
5566
+ const userFail = () => reject(err);
5567
+ userOnError(err, userRetry, userFail, retries + 1);
5568
+ });
5569
+ } else {
5570
+ throw err;
5571
+ }
5572
+ }).then((comp) => {
5573
+ if (thisRequest !== pendingRequest && pendingRequest) {
5574
+ return pendingRequest;
5575
+ }
5576
+ if (!comp) {
5577
+ warn$1(
5578
+ `Async component loader resolved to undefined. If you are using retry(), make sure to return its return value.`
5579
+ );
5580
+ }
5581
+ if (comp && (comp.__esModule || comp[Symbol.toStringTag] === "Module")) {
5582
+ comp = comp.default;
5583
+ }
5584
+ if (comp && !isObject(comp) && !isFunction(comp)) {
5585
+ throw new Error(`Invalid async component load result: ${comp}`);
5586
+ }
5587
+ resolvedComp = comp;
5588
+ return comp;
5589
+ }));
5590
+ };
5591
+ return {
5592
+ load,
5593
+ source,
5594
+ getResolvedComp: () => resolvedComp,
5595
+ setPendingRequest: (request) => pendingRequest = request
5596
+ };
5597
+ }
5598
+ const useAsyncComponentState = (delay, timeout, onError) => {
5599
+ const loaded = ref(false);
5600
+ const error = ref();
5601
+ const delayed = ref(!!delay);
5602
+ if (delay) {
5603
+ setTimeout(() => {
5604
+ delayed.value = false;
5605
+ }, delay);
5606
+ }
5607
+ if (timeout != null) {
5608
+ setTimeout(() => {
5609
+ if (!loaded.value && !error.value) {
5610
+ const err = new Error(`Async component timed out after ${timeout}ms.`);
5611
+ onError(err);
5612
+ error.value = err;
5613
+ }
5614
+ }, timeout);
5615
+ }
5616
+ return { loaded, error, delayed };
5617
+ };
5618
+ function performAsyncHydrate(el, instance, hydrate, getResolvedComp, load, hydrateStrategy) {
5619
+ let patched = false;
5620
+ (instance.bu || (instance.bu = [])).push(() => patched = true);
5621
+ const performHydrate = () => {
5622
+ if (patched) {
5623
+ {
5624
+ const resolvedComp = getResolvedComp();
5625
+ warn$1(
5626
+ `Skipping lazy hydration for component '${getComponentName(resolvedComp) || resolvedComp.__file}': it was updated before lazy hydration performed.`
5627
+ );
5628
+ }
5629
+ return;
5630
+ }
5631
+ hydrate();
5632
+ };
5633
+ const doHydrate = hydrateStrategy ? () => {
5634
+ const teardown = hydrateStrategy(
5635
+ performHydrate,
5636
+ (cb) => forEachElement(el, cb)
5637
+ );
5638
+ if (teardown) {
5639
+ (instance.bum || (instance.bum = [])).push(teardown);
5640
+ }
5641
+ } : performHydrate;
5642
+ if (getResolvedComp()) {
5643
+ doHydrate();
5644
+ } else {
5645
+ load().then(() => !instance.isUnmounted && doHydrate());
5646
+ }
5647
+ }
5494
5648
 
5495
5649
  const isKeepAlive = (vnode) => vnode.type.__isKeepAlive;
5496
5650
  const KeepAliveImpl = {
@@ -5514,86 +5668,37 @@ Server rendered element contains fewer child nodes than client vdom.`
5514
5668
  keepAliveInstance.__v_cache = cache;
5515
5669
  }
5516
5670
  const parentSuspense = keepAliveInstance.suspense;
5671
+ const { renderer } = sharedContext;
5517
5672
  const {
5518
- renderer: {
5519
- p: patch,
5520
- m: move,
5521
- um: _unmount,
5522
- o: { createElement }
5523
- }
5524
- } = sharedContext;
5673
+ um: _unmount,
5674
+ o: { createElement }
5675
+ } = renderer;
5525
5676
  const storageContainer = createElement("div");
5677
+ sharedContext.getStorageContainer = () => storageContainer;
5678
+ sharedContext.getCachedComponent = (vnode) => {
5679
+ const key = vnode.key == null ? vnode.type : vnode.key;
5680
+ return cache.get(key);
5681
+ };
5526
5682
  sharedContext.activate = (vnode, container, anchor, namespace, optimized) => {
5527
- const instance = vnode.component;
5528
- move(
5683
+ activate(
5529
5684
  vnode,
5530
5685
  container,
5531
5686
  anchor,
5532
- 0,
5687
+ renderer,
5533
5688
  keepAliveInstance,
5534
- parentSuspense
5535
- );
5536
- patch(
5537
- instance.vnode,
5538
- vnode,
5539
- container,
5540
- anchor,
5541
- instance,
5542
5689
  parentSuspense,
5543
5690
  namespace,
5544
- vnode.slotScopeIds,
5545
5691
  optimized
5546
5692
  );
5547
- queuePostRenderEffect(
5548
- () => {
5549
- instance.isDeactivated = false;
5550
- if (instance.a) {
5551
- invokeArrayFns(instance.a);
5552
- }
5553
- const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
5554
- if (vnodeHook) {
5555
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
5556
- }
5557
- },
5558
- void 0,
5559
- parentSuspense
5560
- );
5561
- {
5562
- devtoolsComponentAdded(instance);
5563
- }
5564
5693
  };
5565
5694
  sharedContext.deactivate = (vnode) => {
5566
- const instance = vnode.component;
5567
- invalidateMount(instance.m);
5568
- invalidateMount(instance.a);
5569
- move(
5695
+ deactivate(
5570
5696
  vnode,
5571
5697
  storageContainer,
5572
- null,
5573
- 1,
5698
+ renderer,
5574
5699
  keepAliveInstance,
5575
5700
  parentSuspense
5576
5701
  );
5577
- queuePostRenderEffect(
5578
- () => {
5579
- if (instance.da) {
5580
- invokeArrayFns(instance.da);
5581
- }
5582
- const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
5583
- if (vnodeHook) {
5584
- invokeVNodeHook(vnodeHook, instance.parent, vnode);
5585
- }
5586
- instance.isDeactivated = true;
5587
- },
5588
- void 0,
5589
- parentSuspense
5590
- );
5591
- {
5592
- devtoolsComponentAdded(instance);
5593
- }
5594
- {
5595
- instance.__keepAliveStorageContainer = storageContainer;
5596
- }
5597
5702
  };
5598
5703
  function unmount(vnode) {
5599
5704
  resetShapeFlag(vnode);
@@ -5744,7 +5849,7 @@ Server rendered element contains fewer child nodes than client vdom.`
5744
5849
  function onDeactivated(hook, target) {
5745
5850
  registerKeepAliveHook(hook, "da", target);
5746
5851
  }
5747
- function registerKeepAliveHook(hook, type, target = getCurrentInstance()) {
5852
+ function registerKeepAliveHook(hook, type, target = getCurrentGenericInstance()) {
5748
5853
  const wrappedHook = hook.__wdc || (hook.__wdc = () => {
5749
5854
  let current = target;
5750
5855
  while (current) {
@@ -5758,32 +5863,98 @@ Server rendered element contains fewer child nodes than client vdom.`
5758
5863
  injectHook(type, wrappedHook, target);
5759
5864
  if (target) {
5760
5865
  let current = target.parent;
5761
- while (current && current.parent && current.parent.vnode) {
5762
- if (isKeepAlive(current.parent.vnode)) {
5866
+ while (current && current.parent) {
5867
+ let parent = current.parent;
5868
+ if (isKeepAlive(parent.vapor ? parent : parent.vnode)) {
5763
5869
  injectToKeepAliveRoot(wrappedHook, type, target, current);
5764
5870
  }
5765
5871
  current = current.parent;
5766
5872
  }
5767
5873
  }
5768
5874
  }
5769
- function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
5770
- const injected = injectHook(
5771
- type,
5772
- hook,
5773
- keepAliveRoot,
5774
- true
5775
- /* prepend */
5875
+ function injectToKeepAliveRoot(hook, type, target, keepAliveRoot) {
5876
+ const injected = injectHook(
5877
+ type,
5878
+ hook,
5879
+ keepAliveRoot,
5880
+ true
5881
+ /* prepend */
5882
+ );
5883
+ onUnmounted(() => {
5884
+ remove(keepAliveRoot[type], injected);
5885
+ }, target);
5886
+ }
5887
+ function resetShapeFlag(vnode) {
5888
+ vnode.shapeFlag &= -257;
5889
+ vnode.shapeFlag &= -513;
5890
+ }
5891
+ function getInnerChild(vnode) {
5892
+ return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
5893
+ }
5894
+ function activate(vnode, container, anchor, { p: patch, m: move }, parentComponent, parentSuspense, namespace, optimized) {
5895
+ const instance = vnode.component;
5896
+ move(
5897
+ vnode,
5898
+ container,
5899
+ anchor,
5900
+ 0,
5901
+ parentComponent,
5902
+ parentSuspense
5903
+ );
5904
+ patch(
5905
+ instance.vnode,
5906
+ vnode,
5907
+ container,
5908
+ anchor,
5909
+ instance,
5910
+ parentSuspense,
5911
+ namespace,
5912
+ vnode.slotScopeIds,
5913
+ optimized
5914
+ );
5915
+ queuePostRenderEffect(
5916
+ () => {
5917
+ instance.isDeactivated = false;
5918
+ if (instance.a) {
5919
+ invokeArrayFns(instance.a);
5920
+ }
5921
+ const vnodeHook = vnode.props && vnode.props.onVnodeMounted;
5922
+ if (vnodeHook) {
5923
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
5924
+ }
5925
+ },
5926
+ void 0,
5927
+ parentSuspense
5928
+ );
5929
+ {
5930
+ devtoolsComponentAdded(instance);
5931
+ }
5932
+ }
5933
+ function deactivate(vnode, container, { m: move }, parentComponent, parentSuspense) {
5934
+ const instance = vnode.component;
5935
+ invalidateMount(instance.m);
5936
+ invalidateMount(instance.a);
5937
+ move(vnode, container, null, 1, parentComponent, parentSuspense);
5938
+ queuePostRenderEffect(
5939
+ () => {
5940
+ if (instance.da) {
5941
+ invokeArrayFns(instance.da);
5942
+ }
5943
+ const vnodeHook = vnode.props && vnode.props.onVnodeUnmounted;
5944
+ if (vnodeHook) {
5945
+ invokeVNodeHook(vnodeHook, instance.parent, vnode);
5946
+ }
5947
+ instance.isDeactivated = true;
5948
+ },
5949
+ void 0,
5950
+ parentSuspense
5776
5951
  );
5777
- onUnmounted(() => {
5778
- remove(keepAliveRoot[type], injected);
5779
- }, target);
5780
- }
5781
- function resetShapeFlag(vnode) {
5782
- vnode.shapeFlag &= -257;
5783
- vnode.shapeFlag &= -513;
5784
- }
5785
- function getInnerChild(vnode) {
5786
- return vnode.shapeFlag & 128 ? vnode.ssContent : vnode;
5952
+ {
5953
+ devtoolsComponentAdded(instance);
5954
+ }
5955
+ {
5956
+ instance.__keepAliveStorageContainer = container;
5957
+ }
5787
5958
  }
5788
5959
 
5789
5960
  function injectHook(type, hook, target = currentInstance, prepend = false) {
@@ -6260,12 +6431,13 @@ If this is a native custom element, make sure to exclude it from component resol
6260
6431
  return ret;
6261
6432
  }
6262
6433
  if (currentRenderingInstance && (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce)) {
6434
+ const hasProps = Object.keys(props).length > 0;
6263
6435
  if (name !== "default") props.name = name;
6264
6436
  return openBlock(), createBlock(
6265
6437
  Fragment,
6266
6438
  null,
6267
6439
  [createVNode("slot", props, fallback && fallback())],
6268
- 64
6440
+ hasProps ? -2 : 64
6269
6441
  );
6270
6442
  }
6271
6443
  if (slot && slot.length > 1) {
@@ -6279,6 +6451,7 @@ If this is a native custom element, make sure to exclude it from component resol
6279
6451
  }
6280
6452
  openBlock();
6281
6453
  const validSlotContent = slot && ensureValidVNode(slot(props));
6454
+ ensureVaporSlotFallback(validSlotContent, fallback);
6282
6455
  const slotKey = props.key || // slot content array of a dynamic conditional slot may have a branch
6283
6456
  // key attached in the `createSlots` helper, respect that
6284
6457
  validSlotContent && validSlotContent.key;
@@ -6308,6 +6481,14 @@ If this is a native custom element, make sure to exclude it from component resol
6308
6481
  return true;
6309
6482
  }) ? vnodes : null;
6310
6483
  }
6484
+ function ensureVaporSlotFallback(vnodes, fallback) {
6485
+ let vaporSlot;
6486
+ if (vnodes && vnodes.length === 1 && isVNode(vnodes[0]) && (vaporSlot = vnodes[0].vs)) {
6487
+ if (!vaporSlot.fallback && fallback) {
6488
+ vaporSlot.fallback = fallback;
6489
+ }
6490
+ }
6491
+ }
6311
6492
 
6312
6493
  function toHandlers(obj, preserveCaseIfNecessary) {
6313
6494
  const ret = {};
@@ -6369,7 +6550,7 @@ If this is a native custom element, make sure to exclude it from component resol
6369
6550
  }
6370
6551
  return renderSlot(instance.slots, name, props, fallback && (() => fallback));
6371
6552
  }
6372
- function legacyresolveScopedSlots(fns, raw, hasDynamicKeys) {
6553
+ function legacyResolveScopedSlots(fns, raw, hasDynamicKeys) {
6373
6554
  return createSlots(
6374
6555
  raw || { $stable: !hasDynamicKeys },
6375
6556
  mapKeyToName(fns)
@@ -6536,7 +6717,7 @@ If this is a native custom element, make sure to exclude it from component resol
6536
6717
  _b: () => legacyBindObjectProps,
6537
6718
  _v: () => createTextVNode,
6538
6719
  _e: () => createCommentVNode,
6539
- _u: () => legacyresolveScopedSlots,
6720
+ _u: () => legacyResolveScopedSlots,
6540
6721
  _g: () => legacyBindObjectListeners,
6541
6722
  _d: () => legacyBindDynamicKeys,
6542
6723
  _p: () => legacyPrependModifier
@@ -6708,10 +6889,10 @@ If this is a native custom element, make sure to exclude it from component resol
6708
6889
  return true;
6709
6890
  },
6710
6891
  has({
6711
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
6892
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6712
6893
  }, key) {
6713
- let normalizedProps;
6714
- 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);
6894
+ let normalizedProps, cssModules;
6895
+ 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]);
6715
6896
  },
6716
6897
  defineProperty(target, key, descriptor) {
6717
6898
  if (descriptor.get != null) {
@@ -6863,15 +7044,15 @@ If this is a native custom element, make sure to exclude it from component resol
6863
7044
  return null;
6864
7045
  }
6865
7046
  function useSlots() {
6866
- return getContext().slots;
7047
+ return getContext("useSlots").slots;
6867
7048
  }
6868
7049
  function useAttrs() {
6869
- return getContext().attrs;
7050
+ return getContext("useAttrs").attrs;
6870
7051
  }
6871
- function getContext() {
7052
+ function getContext(calledFunctionName) {
6872
7053
  const i = getCurrentGenericInstance();
6873
7054
  if (!i) {
6874
- warn$1(`useContext() called without active instance.`);
7055
+ warn$1(`${calledFunctionName}() called without active instance.`);
6875
7056
  }
6876
7057
  if (i.vapor) {
6877
7058
  return i;
@@ -7135,7 +7316,8 @@ If this is a native custom element, make sure to exclude it from component resol
7135
7316
  expose.forEach((key) => {
7136
7317
  Object.defineProperty(exposed, key, {
7137
7318
  get: () => publicThis[key],
7138
- set: (val) => publicThis[key] = val
7319
+ set: (val) => publicThis[key] = val,
7320
+ enumerable: true
7139
7321
  });
7140
7322
  });
7141
7323
  } else if (!instance.exposed) {
@@ -7458,7 +7640,7 @@ If this is a native custom element, make sure to exclude it from component resol
7458
7640
  return vm;
7459
7641
  }
7460
7642
  }
7461
- Vue.version = `2.6.14-compat:${"3.6.0-alpha.2"}`;
7643
+ Vue.version = `2.6.14-compat:${"3.6.0-alpha.4"}`;
7462
7644
  Vue.config = singletonApp.config;
7463
7645
  Vue.use = (plugin, ...options) => {
7464
7646
  if (plugin && isFunction(plugin.install)) {
@@ -7472,22 +7654,22 @@ If this is a native custom element, make sure to exclude it from component resol
7472
7654
  singletonApp.mixin(m);
7473
7655
  return Vue;
7474
7656
  };
7475
- Vue.component = (name, comp) => {
7657
+ Vue.component = ((name, comp) => {
7476
7658
  if (comp) {
7477
7659
  singletonApp.component(name, comp);
7478
7660
  return Vue;
7479
7661
  } else {
7480
7662
  return singletonApp.component(name);
7481
7663
  }
7482
- };
7483
- Vue.directive = (name, dir) => {
7664
+ });
7665
+ Vue.directive = ((name, dir) => {
7484
7666
  if (dir) {
7485
7667
  singletonApp.directive(name, dir);
7486
7668
  return Vue;
7487
7669
  } else {
7488
7670
  return singletonApp.directive(name);
7489
7671
  }
7490
- };
7672
+ });
7491
7673
  Vue.options = { _base: Vue };
7492
7674
  let cid = 1;
7493
7675
  Vue.cid = cid;
@@ -7550,14 +7732,14 @@ If this is a native custom element, make sure to exclude it from component resol
7550
7732
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
7551
7733
  return reactive(target);
7552
7734
  };
7553
- Vue.filter = (name, filter) => {
7735
+ Vue.filter = ((name, filter) => {
7554
7736
  if (filter) {
7555
7737
  singletonApp.filter(name, filter);
7556
7738
  return Vue;
7557
7739
  } else {
7558
7740
  return singletonApp.filter(name);
7559
7741
  }
7560
- };
7742
+ });
7561
7743
  const util = {
7562
7744
  warn: warn$1 ,
7563
7745
  extend,
@@ -7716,7 +7898,7 @@ If this is a native custom element, make sure to exclude it from component resol
7716
7898
  {
7717
7899
  for (let i = 0; i < container.attributes.length; i++) {
7718
7900
  const attr = container.attributes[i];
7719
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
7901
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
7720
7902
  warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
7721
7903
  break;
7722
7904
  }
@@ -8550,7 +8732,7 @@ If you want to remount the same app, move your app creation logic into a factory
8550
8732
  return args.some((elem) => elem.toLowerCase() === "boolean");
8551
8733
  }
8552
8734
 
8553
- const isInternalKey = (key) => key[0] === "_" || key === "$stable";
8735
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
8554
8736
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8555
8737
  const normalizeSlot = (key, rawSlot, ctx) => {
8556
8738
  if (rawSlot._n) {
@@ -8604,8 +8786,6 @@ If you want to remount the same app, move your app creation logic into a factory
8604
8786
  const initSlots = (instance, children, optimized) => {
8605
8787
  const slots = instance.slots = createInternalObject();
8606
8788
  if (instance.vnode.shapeFlag & 32) {
8607
- const cacheIndexes = children.__;
8608
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8609
8789
  const type = children._;
8610
8790
  if (type) {
8611
8791
  assignSlots(slots, children, optimized);
@@ -8669,12 +8849,10 @@ If you want to remount the same app, move your app creation logic into a factory
8669
8849
  if (instance.appContext.config.performance && isSupported()) {
8670
8850
  const startTag = `vue-${type}-${instance.uid}`;
8671
8851
  const endTag = startTag + `:end`;
8852
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
8672
8853
  perf.mark(endTag);
8673
- perf.measure(
8674
- `<${formatComponentName(instance, instance.type)}> ${type}`,
8675
- startTag,
8676
- endTag
8677
- );
8854
+ perf.measure(measureName, startTag, endTag);
8855
+ perf.clearMeasures(measureName);
8678
8856
  perf.clearMarks(startTag);
8679
8857
  perf.clearMarks(endTag);
8680
8858
  }
@@ -8913,15 +9091,25 @@ If you want to remount the same app, move your app creation logic into a factory
8913
9091
  optimized
8914
9092
  );
8915
9093
  } else {
8916
- patchElement(
8917
- n1,
8918
- n2,
8919
- parentComponent,
8920
- parentSuspense,
8921
- namespace,
8922
- slotScopeIds,
8923
- optimized
8924
- );
9094
+ const customElement = !!(n1.el && n1.el._isVueCE) ? n1.el : null;
9095
+ try {
9096
+ if (customElement) {
9097
+ customElement._beginPatch();
9098
+ }
9099
+ patchElement(
9100
+ n1,
9101
+ n2,
9102
+ parentComponent,
9103
+ parentSuspense,
9104
+ namespace,
9105
+ slotScopeIds,
9106
+ optimized
9107
+ );
9108
+ } finally {
9109
+ if (customElement) {
9110
+ customElement._endPatch();
9111
+ }
9112
+ }
8925
9113
  }
8926
9114
  };
8927
9115
  const mountElement = (vnode, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized) => {
@@ -8972,16 +9160,20 @@ If you want to remount the same app, move your app creation logic into a factory
8972
9160
  if (dirs) {
8973
9161
  invokeDirectiveHook(vnode, null, parentComponent, "beforeMount");
8974
9162
  }
8975
- const needCallTransitionHooks = needTransition(parentSuspense, transition);
8976
- if (needCallTransitionHooks) {
8977
- transition.beforeEnter(el);
9163
+ if (transition) {
9164
+ performTransitionEnter(
9165
+ el,
9166
+ transition,
9167
+ () => hostInsert(el, container, anchor),
9168
+ parentSuspense
9169
+ );
9170
+ } else {
9171
+ hostInsert(el, container, anchor);
8978
9172
  }
8979
- hostInsert(el, container, anchor);
8980
- if ((vnodeHook = props && props.onVnodeMounted) || needCallTransitionHooks || dirs) {
9173
+ if ((vnodeHook = props && props.onVnodeMounted) || dirs) {
8981
9174
  queuePostRenderEffect(
8982
9175
  () => {
8983
9176
  vnodeHook && invokeVNodeHook(vnodeHook, parentComponent, vnode);
8984
- needCallTransitionHooks && transition.enter(el);
8985
9177
  dirs && invokeDirectiveHook(vnode, null, parentComponent, "mounted");
8986
9178
  },
8987
9179
  void 0,
@@ -8998,21 +9190,9 @@ If you want to remount the same app, move your app creation logic into a factory
8998
9190
  hostSetScopeId(el, slotScopeIds[i]);
8999
9191
  }
9000
9192
  }
9001
- let subTree = parentComponent && parentComponent.subTree;
9002
- if (subTree) {
9003
- if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
9004
- subTree = filterSingleRoot(subTree.children) || subTree;
9005
- }
9006
- if (vnode === subTree || isSuspense(subTree.type) && (subTree.ssContent === vnode || subTree.ssFallback === vnode)) {
9007
- const parentVNode = parentComponent.vnode;
9008
- setScopeId(
9009
- el,
9010
- parentVNode,
9011
- parentVNode.scopeId,
9012
- parentVNode.slotScopeIds,
9013
- parentComponent.parent
9014
- );
9015
- }
9193
+ const inheritedScopeIds = getInheritedScopeIds(vnode, parentComponent);
9194
+ for (let i = 0; i < inheritedScopeIds.length; i++) {
9195
+ hostSetScopeId(el, inheritedScopeIds[i]);
9016
9196
  }
9017
9197
  };
9018
9198
  const mountChildren = (children, container, anchor, parentComponent, parentSuspense, namespace, slotScopeIds, optimized, start = 0) => {
@@ -9253,12 +9433,21 @@ If you want to remount the same app, move your app creation logic into a factory
9253
9433
  n2.slotScopeIds = slotScopeIds;
9254
9434
  if (n2.type.__vapor) {
9255
9435
  if (n1 == null) {
9256
- getVaporInterface(parentComponent, n2).mount(
9257
- n2,
9258
- container,
9259
- anchor,
9260
- parentComponent
9261
- );
9436
+ if (n2.shapeFlag & 512) {
9437
+ getVaporInterface(parentComponent, n2).activate(
9438
+ n2,
9439
+ container,
9440
+ anchor,
9441
+ parentComponent
9442
+ );
9443
+ } else {
9444
+ getVaporInterface(parentComponent, n2).mount(
9445
+ n2,
9446
+ container,
9447
+ anchor,
9448
+ parentComponent
9449
+ );
9450
+ }
9262
9451
  } else {
9263
9452
  getVaporInterface(parentComponent, n2).update(
9264
9453
  n1,
@@ -9322,6 +9511,7 @@ If you want to remount the same app, move your app creation logic into a factory
9322
9511
  if (!initialVNode.el) {
9323
9512
  const placeholder = instance.subTree = createVNode(Comment);
9324
9513
  processCommentNode(null, placeholder, container, anchor);
9514
+ initialVNode.placeholder = placeholder.el;
9325
9515
  }
9326
9516
  } else {
9327
9517
  setupRenderEffect(
@@ -9889,7 +10079,11 @@ If you want to remount the same app, move your app creation logic into a factory
9889
10079
  for (i = toBePatched - 1; i >= 0; i--) {
9890
10080
  const nextIndex = s2 + i;
9891
10081
  const nextChild = c2[nextIndex];
9892
- const anchor = nextIndex + 1 < l2 ? c2[nextIndex + 1].el : parentAnchor;
10082
+ const anchorVNode = c2[nextIndex + 1];
10083
+ const anchor = nextIndex + 1 < l2 ? (
10084
+ // #13559, fallback to el placeholder for unresolved async component
10085
+ anchorVNode.el || anchorVNode.placeholder
10086
+ ) : parentAnchor;
9893
10087
  if (newIndexToOldIndexMap[i] === 0) {
9894
10088
  patch(
9895
10089
  null,
@@ -9969,12 +10163,12 @@ If you want to remount the same app, move your app creation logic into a factory
9969
10163
  const needTransition2 = moveType !== 2 && shapeFlag & 1 && transition;
9970
10164
  if (needTransition2) {
9971
10165
  if (moveType === 0) {
9972
- transition.beforeEnter(el);
9973
- hostInsert(el, container, anchor);
9974
- queuePostRenderEffect(
9975
- () => transition.enter(el),
9976
- void 0,
9977
- parentSuspense
10166
+ performTransitionEnter(
10167
+ el,
10168
+ transition,
10169
+ () => hostInsert(el, container, anchor),
10170
+ parentSuspense,
10171
+ true
9978
10172
  );
9979
10173
  } else {
9980
10174
  const { leave, delayLeave, afterLeave } = transition;
@@ -9986,6 +10180,12 @@ If you want to remount the same app, move your app creation logic into a factory
9986
10180
  }
9987
10181
  };
9988
10182
  const performLeave = () => {
10183
+ if (el._isLeaving) {
10184
+ el[leaveCbKey](
10185
+ true
10186
+ /* cancelled */
10187
+ );
10188
+ }
9989
10189
  leave(el, () => {
9990
10190
  remove2();
9991
10191
  afterLeave && afterLeave();
@@ -10025,7 +10225,14 @@ If you want to remount the same app, move your app creation logic into a factory
10025
10225
  parentComponent.renderCache[cacheIndex] = void 0;
10026
10226
  }
10027
10227
  if (shapeFlag & 256) {
10028
- parentComponent.ctx.deactivate(vnode);
10228
+ if (vnode.type.__vapor) {
10229
+ getVaporInterface(parentComponent, vnode).deactivate(
10230
+ vnode,
10231
+ parentComponent.ctx.getStorageContainer()
10232
+ );
10233
+ } else {
10234
+ parentComponent.ctx.deactivate(vnode);
10235
+ }
10029
10236
  return;
10030
10237
  }
10031
10238
  const shouldInvokeDirs = shapeFlag & 1 && dirs;
@@ -10113,22 +10320,15 @@ If you want to remount the same app, move your app creation logic into a factory
10113
10320
  removeStaticNode(vnode);
10114
10321
  return;
10115
10322
  }
10116
- const performRemove = () => {
10117
- hostRemove(el);
10118
- if (transition && !transition.persisted && transition.afterLeave) {
10119
- transition.afterLeave();
10120
- }
10121
- };
10122
- if (vnode.shapeFlag & 1 && transition && !transition.persisted) {
10123
- const { leave, delayLeave } = transition;
10124
- const performLeave = () => leave(el, performRemove);
10125
- if (delayLeave) {
10126
- delayLeave(vnode.el, performRemove, performLeave);
10127
- } else {
10128
- performLeave();
10129
- }
10323
+ if (transition) {
10324
+ performTransitionLeave(
10325
+ el,
10326
+ transition,
10327
+ () => hostRemove(el),
10328
+ !!(vnode.shapeFlag & 1)
10329
+ );
10130
10330
  } else {
10131
- performRemove();
10331
+ hostRemove(el);
10132
10332
  }
10133
10333
  };
10134
10334
  const removeFragment = (cur, end) => {
@@ -10144,27 +10344,12 @@ If you want to remount the same app, move your app creation logic into a factory
10144
10344
  if (instance.type.__hmrId) {
10145
10345
  unregisterHMR(instance);
10146
10346
  }
10147
- const {
10148
- bum,
10149
- scope,
10150
- effect,
10151
- subTree,
10152
- um,
10153
- m,
10154
- a,
10155
- parent,
10156
- slots: { __: slotCacheKeys }
10157
- } = instance;
10347
+ const { bum, scope, effect, subTree, um, m, a } = instance;
10158
10348
  invalidateMount(m);
10159
10349
  invalidateMount(a);
10160
10350
  if (bum) {
10161
10351
  invokeArrayFns(bum);
10162
10352
  }
10163
- if (parent && isArray(slotCacheKeys)) {
10164
- slotCacheKeys.forEach((v) => {
10165
- parent.renderCache[v] = void 0;
10166
- });
10167
- }
10168
10353
  if (isCompatEnabled$1("INSTANCE_EVENT_HOOKS", instance)) {
10169
10354
  instance.emit("hook:beforeDestroy");
10170
10355
  }
@@ -10188,12 +10373,6 @@ If you want to remount the same app, move your app creation logic into a factory
10188
10373
  void 0,
10189
10374
  parentSuspense
10190
10375
  );
10191
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
10192
- parentSuspense.deps--;
10193
- if (parentSuspense.deps === 0) {
10194
- parentSuspense.resolve();
10195
- }
10196
- }
10197
10376
  {
10198
10377
  devtoolsComponentRemoved(instance);
10199
10378
  }
@@ -10206,7 +10385,7 @@ If you want to remount the same app, move your app creation logic into a factory
10206
10385
  const getNextHostNode = (vnode) => {
10207
10386
  if (vnode.shapeFlag & 6) {
10208
10387
  if (vnode.type.__vapor) {
10209
- return hostNextSibling(vnode.component.block);
10388
+ return hostNextSibling(vnode.anchor);
10210
10389
  }
10211
10390
  return getNextHostNode(vnode.component.subTree);
10212
10391
  }
@@ -10284,6 +10463,7 @@ If you want to remount the same app, move your app creation logic into a factory
10284
10463
  return {
10285
10464
  render,
10286
10465
  hydrate,
10466
+ hydrateNode,
10287
10467
  internals,
10288
10468
  createApp: createAppAPI(
10289
10469
  mountApp,
@@ -10325,7 +10505,8 @@ If you want to remount the same app, move your app creation logic into a factory
10325
10505
  if (!shallow && c2.patchFlag !== -2)
10326
10506
  traverseStaticChildren(c1, c2);
10327
10507
  }
10328
- if (c2.type === Text) {
10508
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
10509
+ c2.patchFlag !== -1) {
10329
10510
  c2.el = c1.el;
10330
10511
  }
10331
10512
  if (c2.type === Comment && !c2.el) {
@@ -10338,7 +10519,7 @@ If you want to remount the same app, move your app creation logic into a factory
10338
10519
  }
10339
10520
  }
10340
10521
  function locateNonHydratedAsyncRoot(instance) {
10341
- const subComponent = instance.vapor ? null : instance.subTree.component;
10522
+ const subComponent = instance.subTree && instance.subTree.component;
10342
10523
  if (subComponent) {
10343
10524
  if (subComponent.asyncDep && !subComponent.asyncResolved) {
10344
10525
  return subComponent;
@@ -10353,6 +10534,34 @@ If you want to remount the same app, move your app creation logic into a factory
10353
10534
  hooks[i].flags |= 4;
10354
10535
  }
10355
10536
  }
10537
+ function performTransitionEnter(el, transition, insert, parentSuspense, force = false) {
10538
+ if (force || needTransition(parentSuspense, transition)) {
10539
+ transition.beforeEnter(el);
10540
+ insert();
10541
+ queuePostRenderEffect(() => transition.enter(el), void 0, parentSuspense);
10542
+ } else {
10543
+ insert();
10544
+ }
10545
+ }
10546
+ function performTransitionLeave(el, transition, remove, isElement = true) {
10547
+ const performRemove = () => {
10548
+ remove();
10549
+ if (transition && !transition.persisted && transition.afterLeave) {
10550
+ transition.afterLeave();
10551
+ }
10552
+ };
10553
+ if (isElement && transition && !transition.persisted) {
10554
+ const { leave, delayLeave } = transition;
10555
+ const performLeave = () => leave(el, performRemove);
10556
+ if (delayLeave) {
10557
+ delayLeave(el, performRemove, performLeave);
10558
+ } else {
10559
+ performLeave();
10560
+ }
10561
+ } else {
10562
+ performRemove();
10563
+ }
10564
+ }
10356
10565
  function getVaporInterface(instance, vnode) {
10357
10566
  const ctx = instance ? instance.appContext : vnode.appContext;
10358
10567
  const res = ctx && ctx.vapor;
@@ -10367,6 +10576,32 @@ app.use(vaporInteropPlugin)
10367
10576
  }
10368
10577
  return res;
10369
10578
  }
10579
+ function getInheritedScopeIds(vnode, parentComponent) {
10580
+ const inheritedScopeIds = [];
10581
+ let currentParent = parentComponent;
10582
+ let currentVNode = vnode;
10583
+ while (currentParent) {
10584
+ let subTree = currentParent.subTree;
10585
+ if (!subTree) break;
10586
+ if (subTree.patchFlag > 0 && subTree.patchFlag & 2048) {
10587
+ subTree = filterSingleRoot(subTree.children) || subTree;
10588
+ }
10589
+ if (currentVNode === subTree || isSuspense(subTree.type) && (subTree.ssContent === currentVNode || subTree.ssFallback === currentVNode)) {
10590
+ const parentVNode = currentParent.vnode;
10591
+ if (parentVNode.scopeId) {
10592
+ inheritedScopeIds.push(parentVNode.scopeId);
10593
+ }
10594
+ if (parentVNode.slotScopeIds) {
10595
+ inheritedScopeIds.push(...parentVNode.slotScopeIds);
10596
+ }
10597
+ currentVNode = parentVNode;
10598
+ currentParent = currentParent.parent;
10599
+ } else {
10600
+ break;
10601
+ }
10602
+ }
10603
+ return inheritedScopeIds;
10604
+ }
10370
10605
 
10371
10606
  const ssrContextKey = Symbol.for("v-scx");
10372
10607
  const useSSRContext = () => {
@@ -10582,7 +10817,7 @@ app.use(vaporInteropPlugin)
10582
10817
  return res;
10583
10818
  }
10584
10819
  const getModelModifiers = (props, modelName, getter) => {
10585
- return modelName === "modelValue" || modelName === "model-value" ? getter(props, "modelModifiers") : getter(props, `${modelName}Modifiers`) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
10820
+ return getter(props, getModifierPropName(modelName)) || getter(props, `${camelize(modelName)}Modifiers`) || getter(props, `${hyphenate(modelName)}Modifiers`);
10586
10821
  };
10587
10822
 
10588
10823
  function emit(instance, event, ...rawArgs) {
@@ -10687,8 +10922,9 @@ app.use(vaporInteropPlugin)
10687
10922
  function defaultPropGetter(props, key) {
10688
10923
  return props[key];
10689
10924
  }
10925
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
10690
10926
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
10691
- const cache = appContext.emitsCache;
10927
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
10692
10928
  const cached = cache.get(comp);
10693
10929
  if (cached !== void 0) {
10694
10930
  return cached;
@@ -11160,7 +11396,7 @@ app.use(vaporInteropPlugin)
11160
11396
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
11161
11397
  if (pendingBranch) {
11162
11398
  suspense.pendingBranch = newBranch;
11163
- if (isSameVNodeType(newBranch, pendingBranch)) {
11399
+ if (isSameVNodeType(pendingBranch, newBranch)) {
11164
11400
  patch(
11165
11401
  pendingBranch,
11166
11402
  newBranch,
@@ -11231,7 +11467,7 @@ app.use(vaporInteropPlugin)
11231
11467
  );
11232
11468
  setActiveBranch(suspense, newFallback);
11233
11469
  }
11234
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
11470
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
11235
11471
  patch(
11236
11472
  activeBranch,
11237
11473
  newBranch,
@@ -11262,7 +11498,7 @@ app.use(vaporInteropPlugin)
11262
11498
  }
11263
11499
  }
11264
11500
  } else {
11265
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
11501
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
11266
11502
  patch(
11267
11503
  activeBranch,
11268
11504
  newBranch,
@@ -11375,7 +11611,8 @@ app.use(vaporInteropPlugin)
11375
11611
  pendingId,
11376
11612
  effects,
11377
11613
  parentComponent: parentComponent2,
11378
- container: container2
11614
+ container: container2,
11615
+ isInFallback
11379
11616
  } = suspense;
11380
11617
  let delayEnter = false;
11381
11618
  if (suspense.isHydrating) {
@@ -11393,6 +11630,9 @@ app.use(vaporInteropPlugin)
11393
11630
  parentComponent2
11394
11631
  );
11395
11632
  queuePostFlushCb(effects);
11633
+ if (isInFallback && vnode2.ssFallback) {
11634
+ vnode2.ssFallback.el = null;
11635
+ }
11396
11636
  }
11397
11637
  };
11398
11638
  }
@@ -11401,6 +11641,9 @@ app.use(vaporInteropPlugin)
11401
11641
  anchor = next(activeBranch);
11402
11642
  }
11403
11643
  unmount(activeBranch, parentComponent2, suspense, true);
11644
+ if (!delayEnter && isInFallback && vnode2.ssFallback) {
11645
+ vnode2.ssFallback.el = null;
11646
+ }
11404
11647
  }
11405
11648
  if (!delayEnter) {
11406
11649
  move(
@@ -11525,6 +11768,7 @@ app.use(vaporInteropPlugin)
11525
11768
  optimized2
11526
11769
  );
11527
11770
  if (placeholder) {
11771
+ vnode2.placeholder = null;
11528
11772
  remove(placeholder);
11529
11773
  }
11530
11774
  updateHOCHostEl(instance, vnode2.el);
@@ -11787,15 +12031,11 @@ app.use(vaporInteropPlugin)
11787
12031
  );
11788
12032
  };
11789
12033
  const normalizeKey = ({ key }) => key != null ? key : null;
11790
- const normalizeRef = ({
11791
- ref,
11792
- ref_key,
11793
- ref_for
11794
- }) => {
12034
+ const normalizeRef = ({ ref, ref_key, ref_for }, i = currentRenderingInstance) => {
11795
12035
  if (typeof ref === "number") {
11796
12036
  ref = "" + ref;
11797
12037
  }
11798
- return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i: currentRenderingInstance, r: ref, k: ref_key, f: !!ref_for } : ref : null;
12038
+ return ref != null ? isString(ref) || isRef(ref) || isFunction(ref) ? { i, r: ref, k: ref_key, f: !!ref_for } : ref : null;
11799
12039
  };
11800
12040
  function createBaseVNode(type, props = null, children = null, patchFlag = 0, dynamicProps = null, shapeFlag = type === Fragment ? 0 : 1, isBlockNode = false, needFullChildrenNormalization = false) {
11801
12041
  const vnode = {
@@ -11968,6 +12208,7 @@ Component that was made reactive: `,
11968
12208
  suspense: vnode.suspense,
11969
12209
  ssContent: vnode.ssContent && cloneVNode(vnode.ssContent),
11970
12210
  ssFallback: vnode.ssFallback && cloneVNode(vnode.ssFallback),
12211
+ placeholder: vnode.placeholder,
11971
12212
  el: vnode.el,
11972
12213
  anchor: vnode.anchor,
11973
12214
  ctx: vnode.ctx,
@@ -12118,6 +12359,25 @@ Component that was made reactive: `,
12118
12359
  simpleSetCurrentInstance(instance);
12119
12360
  }
12120
12361
  };
12362
+ const internalOptions = ["ce", "type"];
12363
+ const useInstanceOption = (key, silent = false) => {
12364
+ const instance = getCurrentGenericInstance();
12365
+ if (!instance) {
12366
+ if (!silent) {
12367
+ warn$1(`useInstanceOption called without an active component instance.`);
12368
+ }
12369
+ return { hasInstance: false, value: void 0 };
12370
+ }
12371
+ if (!internalOptions.includes(key)) {
12372
+ {
12373
+ warn$1(
12374
+ `useInstanceOption only accepts ${internalOptions.map((k) => `'${k}'`).join(", ")} as key, got '${key}'.`
12375
+ );
12376
+ }
12377
+ return { hasInstance: true, value: void 0 };
12378
+ }
12379
+ return { hasInstance: true, value: instance[key] };
12380
+ };
12121
12381
 
12122
12382
  const emptyAppContext = createAppContext();
12123
12383
  let uid = 0;
@@ -12495,7 +12755,7 @@ Component that was made reactive: `,
12495
12755
  return instance.proxy;
12496
12756
  }
12497
12757
  }
12498
- const classifyRE = /(?:^|[-_])(\w)/g;
12758
+ const classifyRE = /(?:^|[-_])\w/g;
12499
12759
  const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
12500
12760
  function getComponentName(Component, includeInferred = true) {
12501
12761
  return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
@@ -12531,23 +12791,28 @@ Component that was made reactive: `,
12531
12791
  };
12532
12792
 
12533
12793
  function h(type, propsOrChildren, children) {
12534
- const l = arguments.length;
12535
- if (l === 2) {
12536
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12537
- if (isVNode(propsOrChildren)) {
12538
- return createVNode(type, null, [propsOrChildren]);
12794
+ try {
12795
+ setBlockTracking(-1);
12796
+ const l = arguments.length;
12797
+ if (l === 2) {
12798
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12799
+ if (isVNode(propsOrChildren)) {
12800
+ return createVNode(type, null, [propsOrChildren]);
12801
+ }
12802
+ return createVNode(type, propsOrChildren);
12803
+ } else {
12804
+ return createVNode(type, null, propsOrChildren);
12539
12805
  }
12540
- return createVNode(type, propsOrChildren);
12541
12806
  } else {
12542
- return createVNode(type, null, propsOrChildren);
12543
- }
12544
- } else {
12545
- if (l > 3) {
12546
- children = Array.prototype.slice.call(arguments, 2);
12547
- } else if (l === 3 && isVNode(children)) {
12548
- children = [children];
12807
+ if (l > 3) {
12808
+ children = Array.prototype.slice.call(arguments, 2);
12809
+ } else if (l === 3 && isVNode(children)) {
12810
+ children = [children];
12811
+ }
12812
+ return createVNode(type, propsOrChildren, children);
12549
12813
  }
12550
- return createVNode(type, propsOrChildren, children);
12814
+ } finally {
12815
+ setBlockTracking(1);
12551
12816
  }
12552
12817
  }
12553
12818
 
@@ -12757,7 +13022,7 @@ Component that was made reactive: `,
12757
13022
  return true;
12758
13023
  }
12759
13024
 
12760
- const version = "3.6.0-alpha.2";
13025
+ const version = "3.6.0-alpha.4";
12761
13026
  const warn = warn$1 ;
12762
13027
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12763
13028
  const devtools = devtools$1 ;
@@ -13015,11 +13280,11 @@ Component that was made reactive: `,
13015
13280
  addTransitionClass(el, legacyLeaveFromClass);
13016
13281
  }
13017
13282
  if (!el._enterCancelled) {
13018
- forceReflow();
13283
+ forceReflow(el);
13019
13284
  addTransitionClass(el, leaveActiveClass);
13020
13285
  } else {
13021
13286
  addTransitionClass(el, leaveActiveClass);
13022
- forceReflow();
13287
+ forceReflow(el);
13023
13288
  }
13024
13289
  nextFrame(() => {
13025
13290
  if (!el._isLeaving) {
@@ -13148,7 +13413,7 @@ Component that was made reactive: `,
13148
13413
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
13149
13414
  propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
13150
13415
  }
13151
- const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
13416
+ const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
13152
13417
  getStyleProperties(`${TRANSITION$1}Property`).toString()
13153
13418
  );
13154
13419
  return {
@@ -13168,8 +13433,9 @@ Component that was made reactive: `,
13168
13433
  if (s === "auto") return 0;
13169
13434
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
13170
13435
  }
13171
- function forceReflow() {
13172
- return document.body.offsetHeight;
13436
+ function forceReflow(el) {
13437
+ const targetDocument = el ? el.ownerDocument : document;
13438
+ return targetDocument.body.offsetHeight;
13173
13439
  }
13174
13440
 
13175
13441
  function patchClass(el, value, isSVG) {
@@ -13189,6 +13455,8 @@ Component that was made reactive: `,
13189
13455
  const vShowOriginalDisplay = Symbol("_vod");
13190
13456
  const vShowHidden = Symbol("_vsh");
13191
13457
  const vShow = {
13458
+ // used for prop mismatch check during hydration
13459
+ name: "show",
13192
13460
  beforeMount(el, { value }, { transition }) {
13193
13461
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
13194
13462
  if (transition && value) {
@@ -13222,9 +13490,6 @@ Component that was made reactive: `,
13222
13490
  setDisplay(el, value);
13223
13491
  }
13224
13492
  };
13225
- {
13226
- vShow.name = "show";
13227
- }
13228
13493
  function setDisplay(el, value) {
13229
13494
  el.style.display = value ? el[vShowOriginalDisplay] : "none";
13230
13495
  el[vShowHidden] = !value;
@@ -13303,7 +13568,7 @@ Component that was made reactive: `,
13303
13568
  }
13304
13569
  }
13305
13570
 
13306
- const displayRE = /(^|;)\s*display\s*:/;
13571
+ const displayRE = /(?:^|;)\s*display\s*:/;
13307
13572
  function patchStyle(el, prev, next) {
13308
13573
  const style = el.style;
13309
13574
  const isCssString = isString(next);
@@ -13652,11 +13917,10 @@ Expected function or array of functions, received type ${typeof value}.`
13652
13917
  }
13653
13918
 
13654
13919
  const REMOVAL = {};
13655
- /*! #__NO_SIDE_EFFECTS__ */
13656
13920
  // @__NO_SIDE_EFFECTS__
13657
13921
  function defineCustomElement(options, extraOptions, _createApp) {
13658
- const Comp = defineComponent(options, extraOptions);
13659
- if (isPlainObject(Comp)) extend(Comp, extraOptions);
13922
+ let Comp = defineComponent(options, extraOptions);
13923
+ if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
13660
13924
  class VueCustomElement extends VueElement {
13661
13925
  constructor(initialProps) {
13662
13926
  super(Comp, initialProps, _createApp);
@@ -13665,18 +13929,14 @@ Expected function or array of functions, received type ${typeof value}.`
13665
13929
  VueCustomElement.def = Comp;
13666
13930
  return VueCustomElement;
13667
13931
  }
13668
- /*! #__NO_SIDE_EFFECTS__ */
13669
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13932
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13670
13933
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13671
- };
13934
+ });
13672
13935
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13673
13936
  };
13674
- class VueElement extends BaseClass {
13675
- constructor(_def, _props = {}, _createApp = createApp) {
13937
+ class VueElementBase extends BaseClass {
13938
+ constructor(def, props = {}, createAppFn) {
13676
13939
  super();
13677
- this._def = _def;
13678
- this._props = _props;
13679
- this._createApp = _createApp;
13680
13940
  this._isVueCE = true;
13681
13941
  /**
13682
13942
  * @internal
@@ -13686,25 +13946,26 @@ Expected function or array of functions, received type ${typeof value}.`
13686
13946
  * @internal
13687
13947
  */
13688
13948
  this._app = null;
13689
- /**
13690
- * @internal
13691
- */
13692
- this._nonce = this._def.nonce;
13693
13949
  this._connected = false;
13694
13950
  this._resolved = false;
13695
13951
  this._numberProps = null;
13696
13952
  this._styleChildren = /* @__PURE__ */ new WeakSet();
13953
+ this._patching = false;
13954
+ this._dirty = false;
13697
13955
  this._ob = null;
13698
- if (this.shadowRoot && _createApp !== createApp) {
13956
+ this._def = def;
13957
+ this._props = props;
13958
+ this._createApp = createAppFn;
13959
+ this._nonce = def.nonce;
13960
+ if (this._needsHydration()) {
13699
13961
  this._root = this.shadowRoot;
13700
13962
  } else {
13701
- if (this.shadowRoot) {
13702
- warn(
13703
- `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
13963
+ if (def.shadowRoot !== false) {
13964
+ this.attachShadow(
13965
+ extend({}, def.shadowRootOptions, {
13966
+ mode: "open"
13967
+ })
13704
13968
  );
13705
- }
13706
- if (_def.shadowRoot !== false) {
13707
- this.attachShadow({ mode: "open" });
13708
13969
  this._root = this.shadowRoot;
13709
13970
  } else {
13710
13971
  this._root = this;
@@ -13719,14 +13980,14 @@ Expected function or array of functions, received type ${typeof value}.`
13719
13980
  this._connected = true;
13720
13981
  let parent = this;
13721
13982
  while (parent = parent && (parent.parentNode || parent.host)) {
13722
- if (parent instanceof VueElement) {
13983
+ if (parent instanceof VueElementBase) {
13723
13984
  this._parent = parent;
13724
13985
  break;
13725
13986
  }
13726
13987
  }
13727
13988
  if (!this._instance) {
13728
13989
  if (this._resolved) {
13729
- this._mount(this._def);
13990
+ this._mountComponent(this._def);
13730
13991
  } else {
13731
13992
  if (parent && parent._pendingResolve) {
13732
13993
  this._pendingResolve = parent._pendingResolve.then(() => {
@@ -13739,8 +14000,24 @@ Expected function or array of functions, received type ${typeof value}.`
13739
14000
  }
13740
14001
  }
13741
14002
  }
14003
+ disconnectedCallback() {
14004
+ this._connected = false;
14005
+ nextTick(() => {
14006
+ if (!this._connected) {
14007
+ if (this._ob) {
14008
+ this._ob.disconnect();
14009
+ this._ob = null;
14010
+ }
14011
+ this._unmount();
14012
+ if (this._teleportTargets) {
14013
+ this._teleportTargets.clear();
14014
+ this._teleportTargets = void 0;
14015
+ }
14016
+ }
14017
+ });
14018
+ }
13742
14019
  _setParent(parent = this._parent) {
13743
- if (parent) {
14020
+ if (parent && this._instance) {
13744
14021
  this._instance.parent = parent._instance;
13745
14022
  this._inheritParentContext(parent);
13746
14023
  }
@@ -13753,19 +14030,10 @@ Expected function or array of functions, received type ${typeof value}.`
13753
14030
  );
13754
14031
  }
13755
14032
  }
13756
- disconnectedCallback() {
13757
- this._connected = false;
13758
- nextTick(() => {
13759
- if (!this._connected) {
13760
- if (this._ob) {
13761
- this._ob.disconnect();
13762
- this._ob = null;
13763
- }
13764
- this._app && this._app.unmount();
13765
- if (this._instance) this._instance.ce = void 0;
13766
- this._app = this._instance = null;
13767
- }
13768
- });
14033
+ _processMutations(mutations) {
14034
+ for (const m of mutations) {
14035
+ this._setAttr(m.attributeName);
14036
+ }
13769
14037
  }
13770
14038
  /**
13771
14039
  * resolve inner component definition (handle possible async component)
@@ -13777,13 +14045,9 @@ Expected function or array of functions, received type ${typeof value}.`
13777
14045
  for (let i = 0; i < this.attributes.length; i++) {
13778
14046
  this._setAttr(this.attributes[i].name);
13779
14047
  }
13780
- this._ob = new MutationObserver((mutations) => {
13781
- for (const m of mutations) {
13782
- this._setAttr(m.attributeName);
13783
- }
13784
- });
14048
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13785
14049
  this._ob.observe(this, { attributes: true });
13786
- const resolve = (def, isAsync = false) => {
14050
+ const resolve = (def) => {
13787
14051
  this._resolved = true;
13788
14052
  this._pendingResolve = void 0;
13789
14053
  const { props, styles } = def;
@@ -13808,29 +14072,25 @@ Expected function or array of functions, received type ${typeof value}.`
13808
14072
  "Custom element style injection is not supported when using shadowRoot: false"
13809
14073
  );
13810
14074
  }
13811
- this._mount(def);
14075
+ this._mountComponent(def);
13812
14076
  };
13813
14077
  const asyncDef = this._def.__asyncLoader;
13814
14078
  if (asyncDef) {
14079
+ const { configureApp } = this._def;
13815
14080
  this._pendingResolve = asyncDef().then((def) => {
13816
- def.configureApp = this._def.configureApp;
13817
- resolve(this._def = def, true);
14081
+ def.configureApp = configureApp;
14082
+ this._def = def;
14083
+ resolve(def);
13818
14084
  });
13819
14085
  } else {
13820
14086
  resolve(this._def);
13821
14087
  }
13822
14088
  }
13823
- _mount(def) {
13824
- if (!def.name) {
13825
- def.name = "VueElement";
13826
- }
13827
- this._app = this._createApp(def);
13828
- this._inheritParentContext();
13829
- if (def.configureApp) {
13830
- def.configureApp(this._app);
13831
- }
13832
- this._app._ceVNode = this._createVNode();
13833
- this._app.mount(this._root);
14089
+ _mountComponent(def) {
14090
+ this._mount(def);
14091
+ this._processExposed();
14092
+ }
14093
+ _processExposed() {
13834
14094
  const exposed = this._instance && this._instance.exposed;
13835
14095
  if (!exposed) return;
13836
14096
  for (const key in exposed) {
@@ -13844,6 +14104,38 @@ Expected function or array of functions, received type ${typeof value}.`
13844
14104
  }
13845
14105
  }
13846
14106
  }
14107
+ _processInstance() {
14108
+ this._instance.ce = this;
14109
+ this._instance.isCE = true;
14110
+ {
14111
+ this._instance.ceReload = (newStyles) => {
14112
+ if (this._styles) {
14113
+ this._styles.forEach((s) => this._root.removeChild(s));
14114
+ this._styles.length = 0;
14115
+ }
14116
+ this._applyStyles(newStyles);
14117
+ if (!this._instance.vapor) {
14118
+ this._instance = null;
14119
+ }
14120
+ this._update();
14121
+ };
14122
+ }
14123
+ const dispatch = (event, args) => {
14124
+ this.dispatchEvent(
14125
+ new CustomEvent(
14126
+ event,
14127
+ isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
14128
+ )
14129
+ );
14130
+ };
14131
+ this._instance.emit = (event, ...args) => {
14132
+ dispatch(event, args);
14133
+ if (hyphenate(event) !== event) {
14134
+ dispatch(hyphenate(event), args);
14135
+ }
14136
+ };
14137
+ this._setParent();
14138
+ }
13847
14139
  _resolveProps(def) {
13848
14140
  const { props } = def;
13849
14141
  const declaredPropKeys = isArray(props) ? props : Object.keys(props || {});
@@ -13858,7 +14150,7 @@ Expected function or array of functions, received type ${typeof value}.`
13858
14150
  return this._getProp(key);
13859
14151
  },
13860
14152
  set(val) {
13861
- this._setProp(key, val, true, true);
14153
+ this._setProp(key, val, true, !this._patching);
13862
14154
  }
13863
14155
  });
13864
14156
  }
@@ -13884,11 +14176,12 @@ Expected function or array of functions, received type ${typeof value}.`
13884
14176
  */
13885
14177
  _setProp(key, val, shouldReflect = true, shouldUpdate = false) {
13886
14178
  if (val !== this._props[key]) {
14179
+ this._dirty = true;
13887
14180
  if (val === REMOVAL) {
13888
14181
  delete this._props[key];
13889
14182
  } else {
13890
14183
  this._props[key] = val;
13891
- if (key === "key" && this._app) {
14184
+ if (key === "key" && this._app && this._app._ceVNode) {
13892
14185
  this._app._ceVNode.key = val;
13893
14186
  }
13894
14187
  }
@@ -13897,7 +14190,10 @@ Expected function or array of functions, received type ${typeof value}.`
13897
14190
  }
13898
14191
  if (shouldReflect) {
13899
14192
  const ob = this._ob;
13900
- ob && ob.disconnect();
14193
+ if (ob) {
14194
+ this._processMutations(ob.takeRecords());
14195
+ ob.disconnect();
14196
+ }
13901
14197
  if (val === true) {
13902
14198
  this.setAttribute(hyphenate(key), "");
13903
14199
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13909,52 +14205,6 @@ Expected function or array of functions, received type ${typeof value}.`
13909
14205
  }
13910
14206
  }
13911
14207
  }
13912
- _update() {
13913
- const vnode = this._createVNode();
13914
- if (this._app) vnode.appContext = this._app._context;
13915
- render(vnode, this._root);
13916
- }
13917
- _createVNode() {
13918
- const baseProps = {};
13919
- if (!this.shadowRoot) {
13920
- baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
13921
- }
13922
- const vnode = createVNode(this._def, extend(baseProps, this._props));
13923
- if (!this._instance) {
13924
- vnode.ce = (instance) => {
13925
- this._instance = instance;
13926
- instance.ce = this;
13927
- instance.isCE = true;
13928
- {
13929
- instance.ceReload = (newStyles) => {
13930
- if (this._styles) {
13931
- this._styles.forEach((s) => this._root.removeChild(s));
13932
- this._styles.length = 0;
13933
- }
13934
- this._applyStyles(newStyles);
13935
- this._instance = null;
13936
- this._update();
13937
- };
13938
- }
13939
- const dispatch = (event, args) => {
13940
- this.dispatchEvent(
13941
- new CustomEvent(
13942
- event,
13943
- isPlainObject(args[0]) ? extend({ detail: args }, args[0]) : { detail: args }
13944
- )
13945
- );
13946
- };
13947
- instance.emit = (event, ...args) => {
13948
- dispatch(event, args);
13949
- if (hyphenate(event) !== event) {
13950
- dispatch(hyphenate(event), args);
13951
- }
13952
- };
13953
- this._setParent();
13954
- };
13955
- }
13956
- return vnode;
13957
- }
13958
14208
  _applyStyles(styles, owner) {
13959
14209
  if (!styles) return;
13960
14210
  if (owner) {
@@ -14001,13 +14251,15 @@ Expected function or array of functions, received type ${typeof value}.`
14001
14251
  * Only called when shadowRoot is false
14002
14252
  */
14003
14253
  _renderSlots() {
14004
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
14254
+ const outlets = this._getSlots();
14005
14255
  const scopeId = this._instance.type.__scopeId;
14256
+ const slotReplacements = /* @__PURE__ */ new Map();
14006
14257
  for (let i = 0; i < outlets.length; i++) {
14007
14258
  const o = outlets[i];
14008
14259
  const slotName = o.getAttribute("name") || "default";
14009
14260
  const content = this._slots[slotName];
14010
14261
  const parent = o.parentNode;
14262
+ const replacementNodes = [];
14011
14263
  if (content) {
14012
14264
  for (const n of content) {
14013
14265
  if (scopeId && n.nodeType === 1) {
@@ -14020,18 +14272,58 @@ Expected function or array of functions, received type ${typeof value}.`
14020
14272
  }
14021
14273
  }
14022
14274
  parent.insertBefore(n, o);
14275
+ replacementNodes.push(n);
14023
14276
  }
14024
14277
  } else {
14025
- while (o.firstChild) parent.insertBefore(o.firstChild, o);
14278
+ while (o.firstChild) {
14279
+ const child = o.firstChild;
14280
+ parent.insertBefore(child, o);
14281
+ replacementNodes.push(child);
14282
+ }
14026
14283
  }
14027
14284
  parent.removeChild(o);
14285
+ slotReplacements.set(o, replacementNodes);
14286
+ }
14287
+ this._updateSlotNodes(slotReplacements);
14288
+ }
14289
+ /**
14290
+ * @internal
14291
+ */
14292
+ _getSlots() {
14293
+ const roots = [this];
14294
+ if (this._teleportTargets) {
14295
+ roots.push(...this._teleportTargets);
14028
14296
  }
14297
+ const slots = /* @__PURE__ */ new Set();
14298
+ for (const root of roots) {
14299
+ const found = root.querySelectorAll("slot");
14300
+ for (let i = 0; i < found.length; i++) {
14301
+ slots.add(found[i]);
14302
+ }
14303
+ }
14304
+ return Array.from(slots);
14305
+ }
14306
+ /**
14307
+ * @internal
14308
+ */
14309
+ _injectChildStyle(comp) {
14310
+ this._applyStyles(comp.styles, comp);
14029
14311
  }
14030
14312
  /**
14031
14313
  * @internal
14032
14314
  */
14033
- _injectChildStyle(comp) {
14034
- this._applyStyles(comp.styles, comp);
14315
+ _beginPatch() {
14316
+ this._patching = true;
14317
+ this._dirty = false;
14318
+ }
14319
+ /**
14320
+ * @internal
14321
+ */
14322
+ _endPatch() {
14323
+ this._patching = false;
14324
+ if (this._dirty && this._instance) {
14325
+ this._update();
14326
+ }
14035
14327
  }
14036
14328
  /**
14037
14329
  * @internal
@@ -14049,13 +14341,76 @@ Expected function or array of functions, received type ${typeof value}.`
14049
14341
  }
14050
14342
  }
14051
14343
  }
14344
+ class VueElement extends VueElementBase {
14345
+ constructor(def, props = {}, createAppFn = createApp) {
14346
+ super(def, props, createAppFn);
14347
+ }
14348
+ _needsHydration() {
14349
+ if (this.shadowRoot && this._createApp !== createApp) {
14350
+ return true;
14351
+ } else {
14352
+ if (this.shadowRoot) {
14353
+ warn(
14354
+ `Custom element has pre-rendered declarative shadow root but is not defined as hydratable. Use \`defineSSRCustomElement\`.`
14355
+ );
14356
+ }
14357
+ }
14358
+ return false;
14359
+ }
14360
+ _mount(def) {
14361
+ if (!def.name) {
14362
+ def.name = "VueElement";
14363
+ }
14364
+ this._app = this._createApp(def);
14365
+ this._inheritParentContext();
14366
+ if (def.configureApp) {
14367
+ def.configureApp(this._app);
14368
+ }
14369
+ this._app._ceVNode = this._createVNode();
14370
+ this._app.mount(this._root);
14371
+ }
14372
+ _update() {
14373
+ if (!this._app) return;
14374
+ const vnode = this._createVNode();
14375
+ vnode.appContext = this._app._context;
14376
+ render(vnode, this._root);
14377
+ }
14378
+ _unmount() {
14379
+ if (this._app) {
14380
+ this._app.unmount();
14381
+ }
14382
+ if (this._instance && this._instance.ce) {
14383
+ this._instance.ce = void 0;
14384
+ }
14385
+ this._app = this._instance = null;
14386
+ }
14387
+ /**
14388
+ * Only called when shadowRoot is false
14389
+ */
14390
+ _updateSlotNodes(replacements) {
14391
+ }
14392
+ _createVNode() {
14393
+ const baseProps = {};
14394
+ if (!this.shadowRoot) {
14395
+ baseProps.onVnodeMounted = baseProps.onVnodeUpdated = this._renderSlots.bind(this);
14396
+ }
14397
+ const vnode = createVNode(this._def, extend(baseProps, this._props));
14398
+ if (!this._instance) {
14399
+ vnode.ce = (instance) => {
14400
+ this._instance = instance;
14401
+ this._processInstance();
14402
+ };
14403
+ }
14404
+ return vnode;
14405
+ }
14406
+ }
14052
14407
  function useHost(caller) {
14053
- const instance = getCurrentInstance();
14054
- const el = instance && instance.ce;
14408
+ const { hasInstance, value } = useInstanceOption("ce", true);
14409
+ const el = value;
14055
14410
  if (el) {
14056
14411
  return el;
14057
14412
  } else {
14058
- if (!instance) {
14413
+ if (!hasInstance) {
14059
14414
  warn(
14060
14415
  `${caller || "useHost"} called without an active component instance.`
14061
14416
  );
@@ -14116,26 +14471,13 @@ Expected function or array of functions, received type ${typeof value}.`
14116
14471
  prevChildren = [];
14117
14472
  return;
14118
14473
  }
14119
- prevChildren.forEach(callPendingCbs);
14474
+ prevChildren.forEach((vnode) => callPendingCbs(vnode.el));
14120
14475
  prevChildren.forEach(recordPosition);
14121
14476
  const movedChildren = prevChildren.filter(applyTranslation);
14122
- forceReflow();
14477
+ forceReflow(instance.vnode.el);
14123
14478
  movedChildren.forEach((c) => {
14124
14479
  const el = c.el;
14125
- const style = el.style;
14126
- addTransitionClass(el, moveClass);
14127
- style.transform = style.webkitTransform = style.transitionDuration = "";
14128
- const cb = el[moveCbKey] = (e) => {
14129
- if (e && e.target !== el) {
14130
- return;
14131
- }
14132
- if (!e || /transform$/.test(e.propertyName)) {
14133
- el.removeEventListener("transitionend", cb);
14134
- el[moveCbKey] = null;
14135
- removeTransitionClass(el, moveClass);
14136
- }
14137
- };
14138
- el.addEventListener("transitionend", cb);
14480
+ handleMovedChildren(el, moveClass);
14139
14481
  });
14140
14482
  prevChildren = [];
14141
14483
  });
@@ -14164,10 +14506,10 @@ Expected function or array of functions, received type ${typeof value}.`
14164
14506
  instance
14165
14507
  )
14166
14508
  );
14167
- positionMap.set(
14168
- child,
14169
- child.el.getBoundingClientRect()
14170
- );
14509
+ positionMap.set(child, {
14510
+ left: child.el.offsetLeft,
14511
+ top: child.el.offsetTop
14512
+ });
14171
14513
  }
14172
14514
  }
14173
14515
  }
@@ -14188,8 +14530,7 @@ Expected function or array of functions, received type ${typeof value}.`
14188
14530
  }
14189
14531
  });
14190
14532
  const TransitionGroup = TransitionGroupImpl;
14191
- function callPendingCbs(c) {
14192
- const el = c.el;
14533
+ function callPendingCbs(el) {
14193
14534
  if (el[moveCbKey]) {
14194
14535
  el[moveCbKey]();
14195
14536
  }
@@ -14198,19 +14539,30 @@ Expected function or array of functions, received type ${typeof value}.`
14198
14539
  }
14199
14540
  }
14200
14541
  function recordPosition(c) {
14201
- newPositionMap.set(c, c.el.getBoundingClientRect());
14542
+ newPositionMap.set(c, {
14543
+ left: c.el.offsetLeft,
14544
+ top: c.el.offsetTop
14545
+ });
14202
14546
  }
14203
14547
  function applyTranslation(c) {
14204
- const oldPos = positionMap.get(c);
14205
- const newPos = newPositionMap.get(c);
14548
+ if (baseApplyTranslation(
14549
+ positionMap.get(c),
14550
+ newPositionMap.get(c),
14551
+ c.el
14552
+ )) {
14553
+ return c;
14554
+ }
14555
+ }
14556
+ function baseApplyTranslation(oldPos, newPos, el) {
14206
14557
  const dx = oldPos.left - newPos.left;
14207
14558
  const dy = oldPos.top - newPos.top;
14208
14559
  if (dx || dy) {
14209
- const s = c.el.style;
14560
+ const s = el.style;
14210
14561
  s.transform = s.webkitTransform = `translate(${dx}px,${dy}px)`;
14211
14562
  s.transitionDuration = "0s";
14212
- return c;
14563
+ return true;
14213
14564
  }
14565
+ return false;
14214
14566
  }
14215
14567
  function hasCSSTransform(el, root, moveClass) {
14216
14568
  const clone = el.cloneNode();
@@ -14228,6 +14580,22 @@ Expected function or array of functions, received type ${typeof value}.`
14228
14580
  container.removeChild(clone);
14229
14581
  return hasTransform;
14230
14582
  }
14583
+ const handleMovedChildren = (el, moveClass) => {
14584
+ const style = el.style;
14585
+ addTransitionClass(el, moveClass);
14586
+ style.transform = style.webkitTransform = style.transitionDuration = "";
14587
+ const cb = el[moveCbKey] = (e) => {
14588
+ if (e && e.target !== el) {
14589
+ return;
14590
+ }
14591
+ if (!e || e.propertyName.endsWith("transform")) {
14592
+ el.removeEventListener("transitionend", cb);
14593
+ el[moveCbKey] = null;
14594
+ removeTransitionClass(el, moveClass);
14595
+ }
14596
+ };
14597
+ el.addEventListener("transitionend", cb);
14598
+ };
14231
14599
 
14232
14600
  const getModelAssigner = (vnode) => {
14233
14601
  const fn = vnode.props["onUpdate:modelValue"] || vnode.props["onModelCompat:input"];
@@ -14263,21 +14631,21 @@ Expected function or array of functions, received type ${typeof value}.`
14263
14631
  vModelTextUpdate(el, oldValue, value, trim, number, lazy);
14264
14632
  }
14265
14633
  };
14634
+ function castValue(value, trim, number) {
14635
+ if (trim) value = value.trim();
14636
+ if (number) value = looseToNumber(value);
14637
+ return value;
14638
+ }
14266
14639
  const vModelTextInit = (el, trim, number, lazy, set) => {
14267
14640
  addEventListener(el, lazy ? "change" : "input", (e) => {
14268
14641
  if (e.target.composing) return;
14269
- let domValue = el.value;
14270
- if (trim) {
14271
- domValue = domValue.trim();
14272
- }
14273
- if (number || el.type === "number") {
14274
- domValue = looseToNumber(domValue);
14275
- }
14276
- (0, el[assignKey])(domValue);
14642
+ (0, el[assignKey])(
14643
+ castValue(el.value, trim, number || el.type === "number")
14644
+ );
14277
14645
  });
14278
- if (trim) {
14646
+ if (trim || number) {
14279
14647
  addEventListener(el, "change", () => {
14280
- el.value = el.value.trim();
14648
+ el.value = castValue(el.value, trim, number || el.type === "number");
14281
14649
  });
14282
14650
  }
14283
14651
  if (!lazy) {
@@ -14526,13 +14894,13 @@ Expected function or array of functions, received type ${typeof value}.`
14526
14894
  const withModifiers = (fn, modifiers) => {
14527
14895
  const cache = fn._withMods || (fn._withMods = {});
14528
14896
  const cacheKey = modifiers.join(".");
14529
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14897
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14530
14898
  for (let i = 0; i < modifiers.length; i++) {
14531
14899
  const guard = modifierGuards[modifiers[i]];
14532
14900
  if (guard && guard(event, modifiers)) return;
14533
14901
  }
14534
14902
  return fn(event, ...args);
14535
- });
14903
+ }));
14536
14904
  };
14537
14905
  const keyNames = {
14538
14906
  esc: "escape",
@@ -14562,7 +14930,7 @@ Expected function or array of functions, received type ${typeof value}.`
14562
14930
  }
14563
14931
  const cache = fn._withKeys || (fn._withKeys = {});
14564
14932
  const cacheKey = modifiers.join(".");
14565
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
14933
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14566
14934
  if (!("key" in event)) {
14567
14935
  return;
14568
14936
  }
@@ -14592,7 +14960,7 @@ Expected function or array of functions, received type ${typeof value}.`
14592
14960
  }
14593
14961
  }
14594
14962
  }
14595
- });
14963
+ }));
14596
14964
  };
14597
14965
 
14598
14966
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14606,13 +14974,13 @@ Expected function or array of functions, received type ${typeof value}.`
14606
14974
  enabledHydration = true;
14607
14975
  return renderer;
14608
14976
  }
14609
- const render = (...args) => {
14977
+ const render = ((...args) => {
14610
14978
  ensureRenderer().render(...args);
14611
- };
14612
- const hydrate = (...args) => {
14979
+ });
14980
+ const hydrate = ((...args) => {
14613
14981
  ensureHydrationRenderer().hydrate(...args);
14614
- };
14615
- const createApp = (...args) => {
14982
+ });
14983
+ const createApp = ((...args) => {
14616
14984
  const app = ensureRenderer().createApp(...args);
14617
14985
  {
14618
14986
  injectNativeTagCheck(app);
@@ -14628,7 +14996,7 @@ Expected function or array of functions, received type ${typeof value}.`
14628
14996
  if (container.nodeType === 1) {
14629
14997
  for (let i = 0; i < container.attributes.length; i++) {
14630
14998
  const attr = container.attributes[i];
14631
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
14999
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
14632
15000
  compatUtils.warnDeprecation(
14633
15001
  "GLOBAL_MOUNT_CONTAINER",
14634
15002
  null
@@ -14649,8 +15017,8 @@ Expected function or array of functions, received type ${typeof value}.`
14649
15017
  return proxy;
14650
15018
  };
14651
15019
  return app;
14652
- };
14653
- const createSSRApp = (...args) => {
15020
+ });
15021
+ const createSSRApp = ((...args) => {
14654
15022
  const app = ensureHydrationRenderer().createApp(...args);
14655
15023
  {
14656
15024
  injectNativeTagCheck(app);
@@ -14664,7 +15032,7 @@ Expected function or array of functions, received type ${typeof value}.`
14664
15032
  }
14665
15033
  };
14666
15034
  return app;
14667
- };
15035
+ });
14668
15036
  function resolveRootNamespace(container) {
14669
15037
  if (container instanceof SVGElement) {
14670
15038
  return "svg";
@@ -14748,6 +15116,7 @@ Expected function or array of functions, received type ${typeof value}.`
14748
15116
  TransitionGroup: TransitionGroup,
14749
15117
  TriggerOpTypes: TriggerOpTypes,
14750
15118
  VueElement: VueElement,
15119
+ VueElementBase: VueElementBase,
14751
15120
  assertNumber: assertNumber,
14752
15121
  callWithAsyncErrorHandling: callWithAsyncErrorHandling,
14753
15122
  callWithErrorHandling: callWithErrorHandling,
@@ -14812,6 +15181,7 @@ Expected function or array of functions, received type ${typeof value}.`
14812
15181
  mergeModels: mergeModels,
14813
15182
  mergeProps: mergeProps,
14814
15183
  nextTick: nextTick,
15184
+ nodeOps: nodeOps,
14815
15185
  normalizeClass: normalizeClass,
14816
15186
  normalizeProps: normalizeProps,
14817
15187
  normalizeStyle: normalizeStyle,
@@ -14830,6 +15200,7 @@ Expected function or array of functions, received type ${typeof value}.`
14830
15200
  onUpdated: onUpdated,
14831
15201
  onWatcherCleanup: onWatcherCleanup,
14832
15202
  openBlock: openBlock,
15203
+ patchProp: patchProp,
14833
15204
  popScopeId: popScopeId,
14834
15205
  provide: provide,
14835
15206
  proxyRefs: proxyRefs,
@@ -14871,6 +15242,7 @@ Expected function or array of functions, received type ${typeof value}.`
14871
15242
  useCssVars: useCssVars,
14872
15243
  useHost: useHost,
14873
15244
  useId: useId,
15245
+ useInstanceOption: useInstanceOption,
14874
15246
  useModel: useModel,
14875
15247
  useSSRContext: useSSRContext,
14876
15248
  useShadowRoot: useShadowRoot,
@@ -16163,7 +16535,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16163
16535
  return BASE_TRANSITION;
16164
16536
  }
16165
16537
  }
16166
- const nonIdentifierRE = /^\d|[^\$\w\xA0-\uFFFF]/;
16538
+ const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
16167
16539
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
16168
16540
  const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
16169
16541
  const validIdentCharRE = /[\.\?\w$\xA0-\uFFFF]/;
@@ -16232,7 +16604,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16232
16604
  return !currentOpenBracketCount && !currentOpenParensCount;
16233
16605
  };
16234
16606
  const isMemberExpression = isMemberExpressionBrowser ;
16235
- const fnExpRE = /^\s*(async\s*)?(\([^)]*?\)|[\w$_]+)\s*(:[^=]+)?=>|^\s*(async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16607
+ const fnExpRE = /^\s*(?:async\s*)?(?:\([^)]*?\)|[\w$_]+)\s*(?::[^=]+)?=>|^\s*(?:async\s+)?function(?:\s+[\w$]+)?\s*\(/;
16236
16608
  const isFnExpressionBrowser = (exp) => fnExpRE.test(getExpSource(exp));
16237
16609
  const isFnExpression = isFnExpressionBrowser ;
16238
16610
  function assert(condition, msg) {
@@ -16275,6 +16647,9 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16275
16647
  function isText$1(node) {
16276
16648
  return node.type === 5 || node.type === 2;
16277
16649
  }
16650
+ function isVPre(p) {
16651
+ return p.type === 7 && p.name === "pre";
16652
+ }
16278
16653
  function isVSlot(p) {
16279
16654
  return p.type === 7 && p.name === "slot";
16280
16655
  }
@@ -16533,7 +16908,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16533
16908
  ondirarg(start, end) {
16534
16909
  if (start === end) return;
16535
16910
  const arg = getSlice(start, end);
16536
- if (inVPre) {
16911
+ if (inVPre && !isVPre(currentProp)) {
16537
16912
  currentProp.name += arg;
16538
16913
  setLocEnd(currentProp.nameLoc, end);
16539
16914
  } else {
@@ -16548,7 +16923,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
16548
16923
  },
16549
16924
  ondirmodifier(start, end) {
16550
16925
  const mod = getSlice(start, end);
16551
- if (inVPre) {
16926
+ if (inVPre && !isVPre(currentProp)) {
16552
16927
  currentProp.name += "." + mod;
16553
16928
  setLocEnd(currentProp.nameLoc, end);
16554
16929
  } else if (currentProp.name === "slot") {
@@ -17176,6 +17551,11 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17176
17551
  } else if (child.type === 12) {
17177
17552
  const constantType = doNotHoistNode ? 0 : getConstantType(child, context);
17178
17553
  if (constantType >= 2) {
17554
+ if (child.codegenNode.type === 14 && child.codegenNode.arguments.length > 0) {
17555
+ child.codegenNode.arguments.push(
17556
+ -1 + (` /* ${PatchFlagNames[-1]} */` )
17557
+ );
17558
+ }
17179
17559
  toCache.push(child);
17180
17560
  continue;
17181
17561
  }
@@ -17204,7 +17584,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17204
17584
  }
17205
17585
  }
17206
17586
  let cachedAsArray = false;
17207
- const slotCacheKeys = [];
17208
17587
  if (toCache.length === children.length && node.type === 1) {
17209
17588
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
17210
17589
  node.codegenNode.children = getCacheExpression(
@@ -17214,7 +17593,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17214
17593
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
17215
17594
  const slot = getSlotNode(node.codegenNode, "default");
17216
17595
  if (slot) {
17217
- slotCacheKeys.push(context.cached.length);
17218
17596
  slot.returns = getCacheExpression(
17219
17597
  createArrayExpression(slot.returns)
17220
17598
  );
@@ -17224,7 +17602,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17224
17602
  const slotName = findDir(node, "slot", true);
17225
17603
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
17226
17604
  if (slot) {
17227
- slotCacheKeys.push(context.cached.length);
17228
17605
  slot.returns = getCacheExpression(
17229
17606
  createArrayExpression(slot.returns)
17230
17607
  );
@@ -17234,23 +17611,12 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
17234
17611
  }
17235
17612
  if (!cachedAsArray) {
17236
17613
  for (const child of toCache) {
17237
- slotCacheKeys.push(context.cached.length);
17238
17614
  child.codegenNode = context.cache(child.codegenNode);
17239
17615
  }
17240
17616
  }
17241
- 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) {
17242
- node.codegenNode.children.properties.push(
17243
- createObjectProperty(
17244
- `__`,
17245
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
17246
- )
17247
- );
17248
- }
17249
17617
  function getCacheExpression(value) {
17250
17618
  const exp = context.cache(value);
17251
- if (inFor && context.hmr) {
17252
- exp.needArraySpread = true;
17253
- }
17619
+ exp.needArraySpread = true;
17254
17620
  return exp;
17255
17621
  }
17256
17622
  function getSlotNode(node2, name) {
@@ -18381,7 +18747,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18381
18747
  }
18382
18748
 
18383
18749
  const transformIf = createStructuralDirectiveTransform(
18384
- /^(if|else|else-if)$/,
18750
+ /^(?:if|else|else-if)$/,
18385
18751
  (node, dir, context) => {
18386
18752
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
18387
18753
  const siblings = context.parent.children;
@@ -18450,7 +18816,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18450
18816
  continue;
18451
18817
  }
18452
18818
  if (sibling && sibling.type === 9) {
18453
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18819
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
18454
18820
  context.onError(
18455
18821
  createCompilerError(30, node.loc)
18456
18822
  );
@@ -18599,80 +18965,6 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18599
18965
  }
18600
18966
  }
18601
18967
 
18602
- const transformBind = (dir, _node, context) => {
18603
- const { modifiers, loc } = dir;
18604
- const arg = dir.arg;
18605
- let { exp } = dir;
18606
- if (exp && exp.type === 4 && !exp.content.trim()) {
18607
- {
18608
- exp = void 0;
18609
- }
18610
- }
18611
- if (!exp) {
18612
- if (arg.type !== 4 || !arg.isStatic) {
18613
- context.onError(
18614
- createCompilerError(
18615
- 52,
18616
- arg.loc
18617
- )
18618
- );
18619
- return {
18620
- props: [
18621
- createObjectProperty(arg, createSimpleExpression("", true, loc))
18622
- ]
18623
- };
18624
- }
18625
- transformBindShorthand(dir);
18626
- exp = dir.exp;
18627
- }
18628
- if (arg.type !== 4) {
18629
- arg.children.unshift(`(`);
18630
- arg.children.push(`) || ""`);
18631
- } else if (!arg.isStatic) {
18632
- arg.content = `${arg.content} || ""`;
18633
- }
18634
- if (modifiers.some((mod) => mod.content === "camel")) {
18635
- if (arg.type === 4) {
18636
- if (arg.isStatic) {
18637
- arg.content = camelize(arg.content);
18638
- } else {
18639
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
18640
- }
18641
- } else {
18642
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
18643
- arg.children.push(`)`);
18644
- }
18645
- }
18646
- if (!context.inSSR) {
18647
- if (modifiers.some((mod) => mod.content === "prop")) {
18648
- injectPrefix(arg, ".");
18649
- }
18650
- if (modifiers.some((mod) => mod.content === "attr")) {
18651
- injectPrefix(arg, "^");
18652
- }
18653
- }
18654
- return {
18655
- props: [createObjectProperty(arg, exp)]
18656
- };
18657
- };
18658
- const transformBindShorthand = (dir, context) => {
18659
- const arg = dir.arg;
18660
- const propName = camelize(arg.content);
18661
- dir.exp = createSimpleExpression(propName, false, arg.loc);
18662
- };
18663
- const injectPrefix = (arg, prefix) => {
18664
- if (arg.type === 4) {
18665
- if (arg.isStatic) {
18666
- arg.content = prefix + arg.content;
18667
- } else {
18668
- arg.content = `\`${prefix}\${${arg.content}}\``;
18669
- }
18670
- } else {
18671
- arg.children.unshift(`'${prefix}' + (`);
18672
- arg.children.push(`)`);
18673
- }
18674
- };
18675
-
18676
18968
  const transformFor = createStructuralDirectiveTransform(
18677
18969
  "for",
18678
18970
  (node, dir, context) => {
@@ -18684,10 +18976,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18684
18976
  const isTemplate = isTemplateNode(node);
18685
18977
  const memo = findDir(node, "memo");
18686
18978
  const keyProp = findProp(node, `key`, false, true);
18687
- const isDirKey = keyProp && keyProp.type === 7;
18688
- if (isDirKey && !keyProp.exp) {
18689
- transformBindShorthand(keyProp);
18690
- }
18979
+ keyProp && keyProp.type === 7;
18691
18980
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
18692
18981
  const keyProperty = keyProp && keyExp ? createObjectProperty(`key`, keyExp) : null;
18693
18982
  const isStableFragment = forNode.source.type === 4 && forNode.source.constType > 0;
@@ -18968,7 +19257,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18968
19257
  );
18969
19258
  } else if (vElse = findDir(
18970
19259
  slotElement,
18971
- /^else(-if)?$/,
19260
+ /^else(?:-if)?$/,
18972
19261
  true
18973
19262
  /* allowEmpty */
18974
19263
  )) {
@@ -18980,7 +19269,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
18980
19269
  break;
18981
19270
  }
18982
19271
  }
18983
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
19272
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
18984
19273
  let conditional = dynamicSlots[dynamicSlots.length - 1];
18985
19274
  while (conditional.alternate.type === 19) {
18986
19275
  conditional = conditional.alternate;
@@ -19840,6 +20129,58 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19840
20129
  return ret;
19841
20130
  };
19842
20131
 
20132
+ const transformBind = (dir, _node, context) => {
20133
+ const { modifiers, loc } = dir;
20134
+ const arg = dir.arg;
20135
+ let { exp } = dir;
20136
+ if (exp && exp.type === 4 && !exp.content.trim()) {
20137
+ {
20138
+ exp = void 0;
20139
+ }
20140
+ }
20141
+ if (arg.type !== 4) {
20142
+ arg.children.unshift(`(`);
20143
+ arg.children.push(`) || ""`);
20144
+ } else if (!arg.isStatic) {
20145
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
20146
+ }
20147
+ if (modifiers.some((mod) => mod.content === "camel")) {
20148
+ if (arg.type === 4) {
20149
+ if (arg.isStatic) {
20150
+ arg.content = camelize(arg.content);
20151
+ } else {
20152
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
20153
+ }
20154
+ } else {
20155
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
20156
+ arg.children.push(`)`);
20157
+ }
20158
+ }
20159
+ if (!context.inSSR) {
20160
+ if (modifiers.some((mod) => mod.content === "prop")) {
20161
+ injectPrefix(arg, ".");
20162
+ }
20163
+ if (modifiers.some((mod) => mod.content === "attr")) {
20164
+ injectPrefix(arg, "^");
20165
+ }
20166
+ }
20167
+ return {
20168
+ props: [createObjectProperty(arg, exp)]
20169
+ };
20170
+ };
20171
+ const injectPrefix = (arg, prefix) => {
20172
+ if (arg.type === 4) {
20173
+ if (arg.isStatic) {
20174
+ arg.content = prefix + arg.content;
20175
+ } else {
20176
+ arg.content = `\`${prefix}\${${arg.content}}\``;
20177
+ }
20178
+ } else {
20179
+ arg.children.unshift(`'${prefix}' + (`);
20180
+ arg.children.push(`)`);
20181
+ }
20182
+ };
20183
+
19843
20184
  const transformText = (node, context) => {
19844
20185
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
19845
20186
  return () => {
@@ -19976,7 +20317,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
19976
20317
  ];
19977
20318
  if (dir.modifiers.length && node.tagType === 1) {
19978
20319
  const modifiers = dir.modifiers.map((m) => m.content).map((m) => (isSimpleIdentifier(m) ? m : JSON.stringify(m)) + `: true`).join(`, `);
19979
- const modifiersKey = arg ? isStaticExp(arg) ? `${arg.content}Modifiers` : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
20320
+ const modifiersKey = arg ? isStaticExp(arg) ? getModifierPropName(arg.content) : createCompoundExpression([arg, ' + "Modifiers"']) : `modelModifiers`;
19980
20321
  props.push(
19981
20322
  createObjectProperty(
19982
20323
  modifiersKey,
@@ -20148,7 +20489,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
20148
20489
  const transformMemo = (node, context) => {
20149
20490
  if (node.type === 1) {
20150
20491
  const dir = findDir(node, "memo");
20151
- if (!dir || seen.has(node)) {
20492
+ if (!dir || seen.has(node) || context.inSSR) {
20152
20493
  return;
20153
20494
  }
20154
20495
  seen.add(node);
@@ -20170,9 +20511,36 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
20170
20511
  }
20171
20512
  };
20172
20513
 
20514
+ const transformVBindShorthand = (node, context) => {
20515
+ if (node.type === 1) {
20516
+ for (const prop of node.props) {
20517
+ if (prop.type === 7 && prop.name === "bind" && (!prop.exp || // #13930 :foo in in-DOM templates will be parsed into :foo="" by browser
20518
+ prop.exp.type === 4 && !prop.exp.content.trim()) && prop.arg) {
20519
+ const arg = prop.arg;
20520
+ if (arg.type !== 4 || !arg.isStatic) {
20521
+ context.onError(
20522
+ createCompilerError(
20523
+ 52,
20524
+ arg.loc
20525
+ )
20526
+ );
20527
+ prop.exp = createSimpleExpression("", true, arg.loc);
20528
+ } else {
20529
+ const propName = camelize(arg.content);
20530
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
20531
+ propName[0] === "-") {
20532
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
20533
+ }
20534
+ }
20535
+ }
20536
+ }
20537
+ }
20538
+ };
20539
+
20173
20540
  function getBaseTransformPreset(prefixIdentifiers) {
20174
20541
  return [
20175
20542
  [
20543
+ transformVBindShorthand,
20176
20544
  transformOnce,
20177
20545
  transformIf,
20178
20546
  transformMemo,
@@ -20302,7 +20670,7 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
20302
20670
  let ns = parent ? parent.ns : rootNamespace;
20303
20671
  if (parent && ns === 2) {
20304
20672
  if (parent.tag === "annotation-xml") {
20305
- if (tag === "svg") {
20673
+ if (isSVGTag(tag)) {
20306
20674
  return 1;
20307
20675
  }
20308
20676
  if (parent.props.some(
@@ -20319,10 +20687,10 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
20319
20687
  }
20320
20688
  }
20321
20689
  if (ns === 0) {
20322
- if (tag === "svg") {
20690
+ if (isSVGTag(tag)) {
20323
20691
  return 1;
20324
20692
  }
20325
- if (tag === "math") {
20693
+ if (isMathMLTag(tag)) {
20326
20694
  return 2;
20327
20695
  }
20328
20696
  }
@@ -20623,46 +20991,46 @@ Use a v-bind binding combined with a v-on listener that emits update:x event ins
20623
20991
  if (node.type === 1 && node.tagType === 1) {
20624
20992
  const component = context.isBuiltInComponent(node.tag);
20625
20993
  if (component === TRANSITION) {
20626
- return () => {
20627
- if (!node.children.length) {
20628
- return;
20629
- }
20630
- if (hasMultipleChildren(node)) {
20631
- context.onError(
20632
- createDOMCompilerError(
20633
- 62,
20634
- {
20635
- start: node.children[0].loc.start,
20636
- end: node.children[node.children.length - 1].loc.end,
20637
- source: ""
20638
- }
20639
- )
20640
- );
20641
- }
20642
- const child = node.children[0];
20643
- if (child.type === 1) {
20644
- for (const p of child.props) {
20645
- if (p.type === 7 && p.name === "show") {
20646
- node.props.push({
20647
- type: 6,
20648
- name: "persisted",
20649
- nameLoc: node.loc,
20650
- value: void 0,
20651
- loc: node.loc
20652
- });
20653
- }
20654
- }
20655
- }
20656
- };
20994
+ return postTransformTransition(node, context.onError);
20657
20995
  }
20658
20996
  }
20659
20997
  };
20660
- function hasMultipleChildren(node) {
20998
+ function postTransformTransition(node, onError, hasMultipleChildren = defaultHasMultipleChildren) {
20999
+ return () => {
21000
+ if (!node.children.length) {
21001
+ return;
21002
+ }
21003
+ if (hasMultipleChildren(node)) {
21004
+ onError(
21005
+ createDOMCompilerError(62, {
21006
+ start: node.children[0].loc.start,
21007
+ end: node.children[node.children.length - 1].loc.end,
21008
+ source: ""
21009
+ })
21010
+ );
21011
+ }
21012
+ const child = node.children[0];
21013
+ if (child.type === 1) {
21014
+ for (const p of child.props) {
21015
+ if (p.type === 7 && p.name === "show") {
21016
+ node.props.push({
21017
+ type: 6,
21018
+ name: "persisted",
21019
+ nameLoc: node.loc,
21020
+ value: void 0,
21021
+ loc: node.loc
21022
+ });
21023
+ }
21024
+ }
21025
+ }
21026
+ };
21027
+ }
21028
+ function defaultHasMultipleChildren(node) {
20661
21029
  const children = node.children = node.children.filter(
20662
21030
  (c) => c.type !== 3 && !(c.type === 2 && !c.content.trim())
20663
21031
  );
20664
21032
  const child = children[0];
20665
- return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(hasMultipleChildren);
21033
+ return children.length !== 1 || child.type === 11 || child.type === 9 && child.branches.some(defaultHasMultipleChildren);
20666
21034
  }
20667
21035
 
20668
21036
  const ignoreSideEffectTags = (node, context) => {