@vue/compat 3.5.20 → 3.5.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vue.cjs.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.20
2
+ * @vue/compat v3.5.22
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -10,7 +10,6 @@ var estreeWalker = require('estree-walker');
10
10
  var decode_js = require('entities/lib/decode.js');
11
11
  var sourceMapJs = require('source-map-js');
12
12
 
13
- /*! #__NO_SIDE_EFFECTS__ */
14
13
  // @__NO_SIDE_EFFECTS__
15
14
  function makeMap(str) {
16
15
  const map = /* @__PURE__ */ Object.create(null);
@@ -68,10 +67,10 @@ const cacheStringFunction = (fn) => {
68
67
  return hit || (cache[str] = fn(str));
69
68
  });
70
69
  };
71
- const camelizeRE = /-(\w)/g;
70
+ const camelizeRE = /-\w/g;
72
71
  const camelize = cacheStringFunction(
73
72
  (str) => {
74
- return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
73
+ return str.replace(camelizeRE, (c) => c.slice(1).toUpperCase());
75
74
  }
76
75
  );
77
76
  const hyphenateRE = /\B([A-Z])/g;
@@ -1269,7 +1268,7 @@ function iterator(self, method, wrapValue) {
1269
1268
  iter._next = iter.next;
1270
1269
  iter.next = () => {
1271
1270
  const result = iter._next();
1272
- if (result.value) {
1271
+ if (!result.done) {
1273
1272
  result.value = wrapValue(result.value);
1274
1273
  }
1275
1274
  return result;
@@ -1396,7 +1395,8 @@ class BaseReactiveHandler {
1396
1395
  return res;
1397
1396
  }
1398
1397
  if (isRef(res)) {
1399
- return targetIsArray && isIntegerKey(key) ? res : res.value;
1398
+ const value = targetIsArray && isIntegerKey(key) ? res : res.value;
1399
+ return isReadonly2 && isObject(value) ? readonly(value) : value;
1400
1400
  }
1401
1401
  if (isObject(res)) {
1402
1402
  return isReadonly2 ? readonly(res) : reactive(res);
@@ -2280,11 +2280,11 @@ function traverse(value, depth = Infinity, seen) {
2280
2280
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2281
2281
  return value;
2282
2282
  }
2283
- seen = seen || /* @__PURE__ */ new Set();
2284
- if (seen.has(value)) {
2283
+ seen = seen || /* @__PURE__ */ new Map();
2284
+ if ((seen.get(value) || 0) >= depth) {
2285
2285
  return value;
2286
2286
  }
2287
- seen.add(value);
2287
+ seen.set(value, depth);
2288
2288
  depth--;
2289
2289
  if (isRef(value)) {
2290
2290
  traverse(value.value, depth, seen);
@@ -2823,10 +2823,12 @@ function reload(id, newComp) {
2823
2823
  dirtyInstances.delete(instance);
2824
2824
  } else if (instance.parent) {
2825
2825
  queueJob(() => {
2826
- isHmrUpdating = true;
2827
- instance.parent.update();
2828
- isHmrUpdating = false;
2829
- dirtyInstances.delete(instance);
2826
+ if (!(instance.job.flags & 8)) {
2827
+ isHmrUpdating = true;
2828
+ instance.parent.update();
2829
+ isHmrUpdating = false;
2830
+ dirtyInstances.delete(instance);
2831
+ }
2830
2832
  });
2831
2833
  } else if (instance.appContext.reload) {
2832
2834
  instance.appContext.reload();
@@ -2930,7 +2932,6 @@ const devtoolsComponentRemoved = (component) => {
2930
2932
  _devtoolsComponentRemoved(component);
2931
2933
  }
2932
2934
  };
2933
- /*! #__NO_SIDE_EFFECTS__ */
2934
2935
  // @__NO_SIDE_EFFECTS__
2935
2936
  function createDevtoolsComponentHook(hook) {
2936
2937
  return (component) => {
@@ -3644,9 +3645,6 @@ const TeleportImpl = {
3644
3645
  insert(mainAnchor, container, anchor);
3645
3646
  const mount = (container2, anchor2) => {
3646
3647
  if (shapeFlag & 16) {
3647
- if (parentComponent && parentComponent.isCE) {
3648
- parentComponent.ce._teleportTarget = container2;
3649
- }
3650
3648
  mountChildren(
3651
3649
  children,
3652
3650
  container2,
@@ -3668,6 +3666,9 @@ const TeleportImpl = {
3668
3666
  } else if (namespace !== "mathml" && isTargetMathML(target)) {
3669
3667
  namespace = "mathml";
3670
3668
  }
3669
+ if (parentComponent && parentComponent.isCE) {
3670
+ (parentComponent.ce._teleportTargets || (parentComponent.ce._teleportTargets = /* @__PURE__ */ new Set())).add(target);
3671
+ }
3671
3672
  if (!disabled) {
3672
3673
  mount(target, targetAnchor);
3673
3674
  updateCssVars(n2, false);
@@ -3856,26 +3857,34 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
3856
3857
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
3857
3858
  o: { nextSibling, parentNode, querySelector, insert, createText }
3858
3859
  }, hydrateChildren) {
3860
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
3861
+ vnode2.anchor = hydrateChildren(
3862
+ nextSibling(node2),
3863
+ vnode2,
3864
+ parentNode(node2),
3865
+ parentComponent,
3866
+ parentSuspense,
3867
+ slotScopeIds,
3868
+ optimized
3869
+ );
3870
+ vnode2.targetStart = targetStart;
3871
+ vnode2.targetAnchor = targetAnchor;
3872
+ }
3859
3873
  const target = vnode.target = resolveTarget(
3860
3874
  vnode.props,
3861
3875
  querySelector
3862
3876
  );
3877
+ const disabled = isTeleportDisabled(vnode.props);
3863
3878
  if (target) {
3864
- const disabled = isTeleportDisabled(vnode.props);
3865
3879
  const targetNode = target._lpa || target.firstChild;
3866
3880
  if (vnode.shapeFlag & 16) {
3867
3881
  if (disabled) {
3868
- vnode.anchor = hydrateChildren(
3869
- nextSibling(node),
3882
+ hydrateDisabledTeleport(
3883
+ node,
3870
3884
  vnode,
3871
- parentNode(node),
3872
- parentComponent,
3873
- parentSuspense,
3874
- slotScopeIds,
3875
- optimized
3885
+ targetNode,
3886
+ targetNode && nextSibling(targetNode)
3876
3887
  );
3877
- vnode.targetStart = targetNode;
3878
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
3879
3888
  } else {
3880
3889
  vnode.anchor = nextSibling(node);
3881
3890
  let targetAnchor = targetNode;
@@ -3906,6 +3915,10 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
3906
3915
  }
3907
3916
  }
3908
3917
  updateCssVars(vnode, disabled);
3918
+ } else if (disabled) {
3919
+ if (vnode.shapeFlag & 16) {
3920
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
3921
+ }
3909
3922
  }
3910
3923
  return vnode.anchor && nextSibling(vnode.anchor);
3911
3924
  }
@@ -4017,7 +4030,7 @@ const BaseTransitionImpl = {
4017
4030
  setTransitionHooks(innerChild, enterHooks);
4018
4031
  }
4019
4032
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
4020
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
4033
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
4021
4034
  let leavingHooks = resolveTransitionHooks(
4022
4035
  oldInnerChild,
4023
4036
  rawProps,
@@ -4300,7 +4313,6 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
4300
4313
  return ret;
4301
4314
  }
4302
4315
 
4303
- /*! #__NO_SIDE_EFFECTS__ */
4304
4316
  // @__NO_SIDE_EFFECTS__
4305
4317
  function defineComponent(options, extraOptions) {
4306
4318
  return isFunction(options) ? (
@@ -4353,6 +4365,7 @@ function useTemplateRef(key) {
4353
4365
  return ret;
4354
4366
  }
4355
4367
 
4368
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
4356
4369
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4357
4370
  if (isArray(rawRef)) {
4358
4371
  rawRef.forEach(
@@ -4402,6 +4415,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4402
4415
  return !knownTemplateRefs.has(ref2);
4403
4416
  };
4404
4417
  if (oldRef != null && oldRef !== ref) {
4418
+ invalidatePendingSetRef(oldRawRef);
4405
4419
  if (isString(oldRef)) {
4406
4420
  refs[oldRef] = null;
4407
4421
  if (canSetSetupRef(oldRef)) {
@@ -4459,9 +4473,15 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4459
4473
  }
4460
4474
  };
4461
4475
  if (value) {
4462
- doSet.id = -1;
4463
- queuePostRenderEffect(doSet, parentSuspense);
4476
+ const job = () => {
4477
+ doSet();
4478
+ pendingSetRefMap.delete(rawRef);
4479
+ };
4480
+ job.id = -1;
4481
+ pendingSetRefMap.set(rawRef, job);
4482
+ queuePostRenderEffect(job, parentSuspense);
4464
4483
  } else {
4484
+ invalidatePendingSetRef(rawRef);
4465
4485
  doSet();
4466
4486
  }
4467
4487
  } else {
@@ -4469,6 +4489,13 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4469
4489
  }
4470
4490
  }
4471
4491
  }
4492
+ function invalidatePendingSetRef(rawRef) {
4493
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
4494
+ if (pendingSetRef) {
4495
+ pendingSetRef.flags |= 8;
4496
+ pendingSetRefMap.delete(rawRef);
4497
+ }
4498
+ }
4472
4499
 
4473
4500
  let hasLoggedMismatchError = false;
4474
4501
  const logMismatchError = () => {
@@ -5201,7 +5228,6 @@ function forEachElement(node, cb) {
5201
5228
  }
5202
5229
 
5203
5230
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
5204
- /*! #__NO_SIDE_EFFECTS__ */
5205
5231
  // @__NO_SIDE_EFFECTS__
5206
5232
  function defineAsyncComponent(source) {
5207
5233
  if (isFunction(source)) {
@@ -6099,12 +6125,13 @@ function createSlots(slots, dynamicSlots) {
6099
6125
 
6100
6126
  function renderSlot(slots, name, props = {}, fallback, noSlotted) {
6101
6127
  if (currentRenderingInstance.ce || currentRenderingInstance.parent && isAsyncWrapper(currentRenderingInstance.parent) && currentRenderingInstance.parent.ce) {
6128
+ const hasProps = Object.keys(props).length > 0;
6102
6129
  if (name !== "default") props.name = name;
6103
6130
  return openBlock(), createBlock(
6104
6131
  Fragment,
6105
6132
  null,
6106
6133
  [createVNode("slot", props, fallback && fallback())],
6107
- 64
6134
+ hasProps ? -2 : 64
6108
6135
  );
6109
6136
  }
6110
6137
  let slot = slots[name];
@@ -7295,7 +7322,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7295
7322
  return vm;
7296
7323
  }
7297
7324
  }
7298
- Vue.version = `2.6.14-compat:${"3.5.20"}`;
7325
+ Vue.version = `2.6.14-compat:${"3.5.22"}`;
7299
7326
  Vue.config = singletonApp.config;
7300
7327
  Vue.use = (plugin, ...options) => {
7301
7328
  if (plugin && isFunction(plugin.install)) {
@@ -7553,7 +7580,7 @@ function installCompatMount(app, context, render) {
7553
7580
  {
7554
7581
  for (let i = 0; i < container.attributes.length; i++) {
7555
7582
  const attr = container.attributes[i];
7556
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
7583
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
7557
7584
  warnDeprecation$1("GLOBAL_MOUNT_CONTAINER", null);
7558
7585
  break;
7559
7586
  }
@@ -10365,8 +10392,9 @@ function emit(instance, event, ...rawArgs) {
10365
10392
  return emit$1(instance, event, args);
10366
10393
  }
10367
10394
  }
10395
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
10368
10396
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
10369
- const cache = appContext.emitsCache;
10397
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
10370
10398
  const cached = cache.get(comp);
10371
10399
  if (cached !== void 0) {
10372
10400
  return cached;
@@ -10838,7 +10866,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
10838
10866
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
10839
10867
  if (pendingBranch) {
10840
10868
  suspense.pendingBranch = newBranch;
10841
- if (isSameVNodeType(newBranch, pendingBranch)) {
10869
+ if (isSameVNodeType(pendingBranch, newBranch)) {
10842
10870
  patch(
10843
10871
  pendingBranch,
10844
10872
  newBranch,
@@ -10909,7 +10937,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
10909
10937
  );
10910
10938
  setActiveBranch(suspense, newFallback);
10911
10939
  }
10912
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
10940
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
10913
10941
  patch(
10914
10942
  activeBranch,
10915
10943
  newBranch,
@@ -10940,7 +10968,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
10940
10968
  }
10941
10969
  }
10942
10970
  } else {
10943
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
10971
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
10944
10972
  patch(
10945
10973
  activeBranch,
10946
10974
  newBranch,
@@ -12176,7 +12204,7 @@ function getComponentPublicInstance(instance) {
12176
12204
  return instance.proxy;
12177
12205
  }
12178
12206
  }
12179
- const classifyRE = /(?:^|[-_])(\w)/g;
12207
+ const classifyRE = /(?:^|[-_])\w/g;
12180
12208
  const classify = (str) => str.replace(classifyRE, (c) => c.toUpperCase()).replace(/[-_]/g, "");
12181
12209
  function getComponentName(Component, includeInferred = true) {
12182
12210
  return isFunction(Component) ? Component.displayName || Component.name : Component.name || includeInferred && Component.__name;
@@ -12219,23 +12247,28 @@ const computed = (getterOrOptions, debugOptions) => {
12219
12247
  };
12220
12248
 
12221
12249
  function h(type, propsOrChildren, children) {
12222
- const l = arguments.length;
12223
- if (l === 2) {
12224
- if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12225
- if (isVNode(propsOrChildren)) {
12226
- return createVNode(type, null, [propsOrChildren]);
12250
+ try {
12251
+ setBlockTracking(-1);
12252
+ const l = arguments.length;
12253
+ if (l === 2) {
12254
+ if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
12255
+ if (isVNode(propsOrChildren)) {
12256
+ return createVNode(type, null, [propsOrChildren]);
12257
+ }
12258
+ return createVNode(type, propsOrChildren);
12259
+ } else {
12260
+ return createVNode(type, null, propsOrChildren);
12227
12261
  }
12228
- return createVNode(type, propsOrChildren);
12229
12262
  } else {
12230
- return createVNode(type, null, propsOrChildren);
12231
- }
12232
- } else {
12233
- if (l > 3) {
12234
- children = Array.prototype.slice.call(arguments, 2);
12235
- } else if (l === 3 && isVNode(children)) {
12236
- children = [children];
12263
+ if (l > 3) {
12264
+ children = Array.prototype.slice.call(arguments, 2);
12265
+ } else if (l === 3 && isVNode(children)) {
12266
+ children = [children];
12267
+ }
12268
+ return createVNode(type, propsOrChildren, children);
12237
12269
  }
12238
- return createVNode(type, propsOrChildren, children);
12270
+ } finally {
12271
+ setBlockTracking(1);
12239
12272
  }
12240
12273
  }
12241
12274
 
@@ -12445,7 +12478,7 @@ function isMemoSame(cached, memo) {
12445
12478
  return true;
12446
12479
  }
12447
12480
 
12448
- const version = "3.5.20";
12481
+ const version = "3.5.22";
12449
12482
  const warn = warn$1 ;
12450
12483
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12451
12484
  const devtools = devtools$1 ;
@@ -12715,11 +12748,11 @@ function resolveTransitionProps(rawProps) {
12715
12748
  addTransitionClass(el, legacyLeaveFromClass);
12716
12749
  }
12717
12750
  if (!el._enterCancelled) {
12718
- forceReflow();
12751
+ forceReflow(el);
12719
12752
  addTransitionClass(el, leaveActiveClass);
12720
12753
  } else {
12721
12754
  addTransitionClass(el, leaveActiveClass);
12722
- forceReflow();
12755
+ forceReflow(el);
12723
12756
  }
12724
12757
  nextFrame(() => {
12725
12758
  if (!el._isLeaving) {
@@ -12848,7 +12881,7 @@ function getTransitionInfo(el, expectedType) {
12848
12881
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
12849
12882
  propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
12850
12883
  }
12851
- const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
12884
+ const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
12852
12885
  getStyleProperties(`${TRANSITION$1}Property`).toString()
12853
12886
  );
12854
12887
  return {
@@ -12868,8 +12901,9 @@ function toMs(s) {
12868
12901
  if (s === "auto") return 0;
12869
12902
  return Number(s.slice(0, -1).replace(",", ".")) * 1e3;
12870
12903
  }
12871
- function forceReflow() {
12872
- return document.body.offsetHeight;
12904
+ function forceReflow(el) {
12905
+ const targetDocument = el ? el.ownerDocument : document;
12906
+ return targetDocument.body.offsetHeight;
12873
12907
  }
12874
12908
 
12875
12909
  function patchClass(el, value, isSVG) {
@@ -12941,7 +12975,7 @@ function useCssVars(getter) {
12941
12975
  return;
12942
12976
  }
12943
12977
 
12944
- const displayRE = /(^|;)\s*display\s*:/;
12978
+ const displayRE = /(?:^|;)\s*display\s*:/;
12945
12979
  function patchStyle(el, prev, next) {
12946
12980
  const style = el.style;
12947
12981
  const isCssString = isString(next);
@@ -13308,11 +13342,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
13308
13342
  }
13309
13343
 
13310
13344
  const REMOVAL = {};
13311
- /*! #__NO_SIDE_EFFECTS__ */
13312
13345
  // @__NO_SIDE_EFFECTS__
13313
13346
  function defineCustomElement(options, extraOptions, _createApp) {
13314
- const Comp = defineComponent(options, extraOptions);
13315
- if (isPlainObject(Comp)) extend(Comp, extraOptions);
13347
+ let Comp = defineComponent(options, extraOptions);
13348
+ if (isPlainObject(Comp)) Comp = extend({}, Comp, extraOptions);
13316
13349
  class VueCustomElement extends VueElement {
13317
13350
  constructor(initialProps) {
13318
13351
  super(Comp, initialProps, _createApp);
@@ -13321,7 +13354,6 @@ function defineCustomElement(options, extraOptions, _createApp) {
13321
13354
  VueCustomElement.def = Comp;
13322
13355
  return VueCustomElement;
13323
13356
  }
13324
-
13325
13357
  const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13326
13358
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13327
13359
  });
@@ -13360,7 +13392,11 @@ class VueElement extends BaseClass {
13360
13392
  );
13361
13393
  }
13362
13394
  if (_def.shadowRoot !== false) {
13363
- this.attachShadow({ mode: "open" });
13395
+ this.attachShadow(
13396
+ extend({}, _def.shadowRootOptions, {
13397
+ mode: "open"
13398
+ })
13399
+ );
13364
13400
  this._root = this.shadowRoot;
13365
13401
  } else {
13366
13402
  this._root = this;
@@ -13420,9 +13456,18 @@ class VueElement extends BaseClass {
13420
13456
  this._app && this._app.unmount();
13421
13457
  if (this._instance) this._instance.ce = void 0;
13422
13458
  this._app = this._instance = null;
13459
+ if (this._teleportTargets) {
13460
+ this._teleportTargets.clear();
13461
+ this._teleportTargets = void 0;
13462
+ }
13423
13463
  }
13424
13464
  });
13425
13465
  }
13466
+ _processMutations(mutations) {
13467
+ for (const m of mutations) {
13468
+ this._setAttr(m.attributeName);
13469
+ }
13470
+ }
13426
13471
  /**
13427
13472
  * resolve inner component definition (handle possible async component)
13428
13473
  */
@@ -13433,11 +13478,7 @@ class VueElement extends BaseClass {
13433
13478
  for (let i = 0; i < this.attributes.length; i++) {
13434
13479
  this._setAttr(this.attributes[i].name);
13435
13480
  }
13436
- this._ob = new MutationObserver((mutations) => {
13437
- for (const m of mutations) {
13438
- this._setAttr(m.attributeName);
13439
- }
13440
- });
13481
+ this._ob = new MutationObserver(this._processMutations.bind(this));
13441
13482
  this._ob.observe(this, { attributes: true });
13442
13483
  const resolve = (def, isAsync = false) => {
13443
13484
  this._resolved = true;
@@ -13553,7 +13594,10 @@ class VueElement extends BaseClass {
13553
13594
  }
13554
13595
  if (shouldReflect) {
13555
13596
  const ob = this._ob;
13556
- ob && ob.disconnect();
13597
+ if (ob) {
13598
+ this._processMutations(ob.takeRecords());
13599
+ ob.disconnect();
13600
+ }
13557
13601
  if (val === true) {
13558
13602
  this.setAttribute(hyphenate(key), "");
13559
13603
  } else if (typeof val === "string" || typeof val === "number") {
@@ -13657,7 +13701,7 @@ class VueElement extends BaseClass {
13657
13701
  * Only called when shadowRoot is false
13658
13702
  */
13659
13703
  _renderSlots() {
13660
- const outlets = (this._teleportTarget || this).querySelectorAll("slot");
13704
+ const outlets = this._getSlots();
13661
13705
  const scopeId = this._instance.type.__scopeId;
13662
13706
  for (let i = 0; i < outlets.length; i++) {
13663
13707
  const o = outlets[i];
@@ -13683,6 +13727,19 @@ class VueElement extends BaseClass {
13683
13727
  parent.removeChild(o);
13684
13728
  }
13685
13729
  }
13730
+ /**
13731
+ * @internal
13732
+ */
13733
+ _getSlots() {
13734
+ const roots = [this];
13735
+ if (this._teleportTargets) {
13736
+ roots.push(...this._teleportTargets);
13737
+ }
13738
+ return roots.reduce((res, i) => {
13739
+ res.push(...Array.from(i.querySelectorAll("slot")));
13740
+ return res;
13741
+ }, []);
13742
+ }
13686
13743
  /**
13687
13744
  * @internal
13688
13745
  */
@@ -13787,7 +13844,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13787
13844
  prevChildren.forEach(callPendingCbs);
13788
13845
  prevChildren.forEach(recordPosition);
13789
13846
  const movedChildren = prevChildren.filter(applyTranslation);
13790
- forceReflow();
13847
+ forceReflow(instance.vnode.el);
13791
13848
  movedChildren.forEach((c) => {
13792
13849
  const el = c.el;
13793
13850
  const style = el.style;
@@ -13797,7 +13854,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
13797
13854
  if (e && e.target !== el) {
13798
13855
  return;
13799
13856
  }
13800
- if (!e || /transform$/.test(e.propertyName)) {
13857
+ if (!e || e.propertyName.endsWith("transform")) {
13801
13858
  el.removeEventListener("transitionend", cb);
13802
13859
  el[moveCbKey] = null;
13803
13860
  removeTransitionClass(el, moveClass);
@@ -14296,7 +14353,7 @@ const createApp = ((...args) => {
14296
14353
  if (container.nodeType === 1) {
14297
14354
  for (let i = 0; i < container.attributes.length; i++) {
14298
14355
  const attr = container.attributes[i];
14299
- if (attr.name !== "v-cloak" && /^(v-|:|@)/.test(attr.name)) {
14356
+ if (attr.name !== "v-cloak" && /^(?:v-|:|@)/.test(attr.name)) {
14300
14357
  compatUtils.warnDeprecation(
14301
14358
  "GLOBAL_MOUNT_CONTAINER",
14302
14359
  null
@@ -15903,16 +15960,34 @@ function walkIdentifiers(root, onIdentifier, includeAll = false, parentStack = [
15903
15960
  (id) => markScopeIdentifier(node, id, knownIds)
15904
15961
  );
15905
15962
  }
15963
+ } else if (node.type === "SwitchStatement") {
15964
+ if (node.scopeIds) {
15965
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
15966
+ } else {
15967
+ walkSwitchStatement(
15968
+ node,
15969
+ false,
15970
+ (id) => markScopeIdentifier(node, id, knownIds)
15971
+ );
15972
+ }
15906
15973
  } else if (node.type === "CatchClause" && node.param) {
15907
- for (const id of extractIdentifiers(node.param)) {
15908
- markScopeIdentifier(node, id, knownIds);
15974
+ if (node.scopeIds) {
15975
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
15976
+ } else {
15977
+ for (const id of extractIdentifiers(node.param)) {
15978
+ markScopeIdentifier(node, id, knownIds);
15979
+ }
15909
15980
  }
15910
15981
  } else if (isForStatement(node)) {
15911
- walkForStatement(
15912
- node,
15913
- false,
15914
- (id) => markScopeIdentifier(node, id, knownIds)
15915
- );
15982
+ if (node.scopeIds) {
15983
+ node.scopeIds.forEach((id) => markKnownIds(id, knownIds));
15984
+ } else {
15985
+ walkForStatement(
15986
+ node,
15987
+ false,
15988
+ (id) => markScopeIdentifier(node, id, knownIds)
15989
+ );
15990
+ }
15916
15991
  }
15917
15992
  },
15918
15993
  leave(node, parent) {
@@ -15983,7 +16058,8 @@ function walkFunctionParams(node, onIdent) {
15983
16058
  }
15984
16059
  }
15985
16060
  function walkBlockDeclarations(block, onIdent) {
15986
- for (const stmt of block.body) {
16061
+ const body = block.type === "SwitchCase" ? block.consequent : block.body;
16062
+ for (const stmt of body) {
15987
16063
  if (stmt.type === "VariableDeclaration") {
15988
16064
  if (stmt.declare) continue;
15989
16065
  for (const decl of stmt.declarations) {
@@ -15996,6 +16072,8 @@ function walkBlockDeclarations(block, onIdent) {
15996
16072
  onIdent(stmt.id);
15997
16073
  } else if (isForStatement(stmt)) {
15998
16074
  walkForStatement(stmt, true, onIdent);
16075
+ } else if (stmt.type === "SwitchStatement") {
16076
+ walkSwitchStatement(stmt, true, onIdent);
15999
16077
  }
16000
16078
  }
16001
16079
  }
@@ -16012,6 +16090,20 @@ function walkForStatement(stmt, isVar, onIdent) {
16012
16090
  }
16013
16091
  }
16014
16092
  }
16093
+ function walkSwitchStatement(stmt, isVar, onIdent) {
16094
+ for (const cs of stmt.cases) {
16095
+ for (const stmt2 of cs.consequent) {
16096
+ if (stmt2.type === "VariableDeclaration" && (stmt2.kind === "var" ? isVar : !isVar)) {
16097
+ for (const decl of stmt2.declarations) {
16098
+ for (const id of extractIdentifiers(decl.id)) {
16099
+ onIdent(id);
16100
+ }
16101
+ }
16102
+ }
16103
+ }
16104
+ walkBlockDeclarations(cs, onIdent);
16105
+ }
16106
+ }
16015
16107
  function extractIdentifiers(param, nodes = []) {
16016
16108
  switch (param.type) {
16017
16109
  case "Identifier":
@@ -16247,6 +16339,7 @@ function isCoreComponent(tag) {
16247
16339
  }
16248
16340
  const nonIdentifierRE = /^$|^\d|[^\$\w\xA0-\uFFFF]/;
16249
16341
  const isSimpleIdentifier = (name) => !nonIdentifierRE.test(name);
16342
+ const validFirstIdentCharRE = /[A-Za-z_$\xA0-\uFFFF]/;
16250
16343
  const getExpSource = (exp) => exp.type === 4 ? exp.content : exp.loc.source;
16251
16344
  const isMemberExpressionNode = (exp, context) => {
16252
16345
  try {
@@ -18882,7 +18975,7 @@ function isConst(type) {
18882
18975
  }
18883
18976
 
18884
18977
  const transformIf = createStructuralDirectiveTransform(
18885
- /^(if|else|else-if)$/,
18978
+ /^(?:if|else|else-if)$/,
18886
18979
  (node, dir, context) => {
18887
18980
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
18888
18981
  const siblings = context.parent.children;
@@ -19100,90 +19193,6 @@ function getParentCondition(node) {
19100
19193
  }
19101
19194
  }
19102
19195
 
19103
- const transformBind = (dir, _node, context) => {
19104
- const { modifiers, loc } = dir;
19105
- const arg = dir.arg;
19106
- let { exp } = dir;
19107
- if (exp && exp.type === 4 && !exp.content.trim()) {
19108
- {
19109
- context.onError(
19110
- createCompilerError(34, loc)
19111
- );
19112
- return {
19113
- props: [
19114
- createObjectProperty(arg, createSimpleExpression("", true, loc))
19115
- ]
19116
- };
19117
- }
19118
- }
19119
- if (!exp) {
19120
- if (arg.type !== 4 || !arg.isStatic) {
19121
- context.onError(
19122
- createCompilerError(
19123
- 52,
19124
- arg.loc
19125
- )
19126
- );
19127
- return {
19128
- props: [
19129
- createObjectProperty(arg, createSimpleExpression("", true, loc))
19130
- ]
19131
- };
19132
- }
19133
- transformBindShorthand(dir, context);
19134
- exp = dir.exp;
19135
- }
19136
- if (arg.type !== 4) {
19137
- arg.children.unshift(`(`);
19138
- arg.children.push(`) || ""`);
19139
- } else if (!arg.isStatic) {
19140
- arg.content = arg.content ? `${arg.content} || ""` : `""`;
19141
- }
19142
- if (modifiers.some((mod) => mod.content === "camel")) {
19143
- if (arg.type === 4) {
19144
- if (arg.isStatic) {
19145
- arg.content = camelize(arg.content);
19146
- } else {
19147
- arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
19148
- }
19149
- } else {
19150
- arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
19151
- arg.children.push(`)`);
19152
- }
19153
- }
19154
- if (!context.inSSR) {
19155
- if (modifiers.some((mod) => mod.content === "prop")) {
19156
- injectPrefix(arg, ".");
19157
- }
19158
- if (modifiers.some((mod) => mod.content === "attr")) {
19159
- injectPrefix(arg, "^");
19160
- }
19161
- }
19162
- return {
19163
- props: [createObjectProperty(arg, exp)]
19164
- };
19165
- };
19166
- const transformBindShorthand = (dir, context) => {
19167
- const arg = dir.arg;
19168
- const propName = camelize(arg.content);
19169
- dir.exp = createSimpleExpression(propName, false, arg.loc);
19170
- {
19171
- dir.exp = processExpression(dir.exp, context);
19172
- }
19173
- };
19174
- const injectPrefix = (arg, prefix) => {
19175
- if (arg.type === 4) {
19176
- if (arg.isStatic) {
19177
- arg.content = prefix + arg.content;
19178
- } else {
19179
- arg.content = `\`${prefix}\${${arg.content}}\``;
19180
- }
19181
- } else {
19182
- arg.children.unshift(`'${prefix}' + (`);
19183
- arg.children.push(`)`);
19184
- }
19185
- };
19186
-
19187
19196
  const transformFor = createStructuralDirectiveTransform(
19188
19197
  "for",
19189
19198
  (node, dir, context) => {
@@ -19196,9 +19205,6 @@ const transformFor = createStructuralDirectiveTransform(
19196
19205
  const memo = findDir(node, "memo");
19197
19206
  const keyProp = findProp(node, `key`, false, true);
19198
19207
  const isDirKey = keyProp && keyProp.type === 7;
19199
- if (isDirKey && !keyProp.exp) {
19200
- transformBindShorthand(keyProp, context);
19201
- }
19202
19208
  let keyExp = keyProp && (keyProp.type === 6 ? keyProp.value ? createSimpleExpression(keyProp.value.content, true) : void 0 : keyProp.exp);
19203
19209
  if (memo && keyExp && isDirKey) {
19204
19210
  {
@@ -19479,7 +19485,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19479
19485
  const dynamicSlots = [];
19480
19486
  let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
19481
19487
  if (!context.ssr && context.prefixIdentifiers) {
19482
- hasDynamicSlots = hasScopeRef(node, context.identifiers);
19488
+ hasDynamicSlots = node.props.some(
19489
+ (prop) => isVSlot(prop) && (hasScopeRef(prop.arg, context.identifiers) || hasScopeRef(prop.exp, context.identifiers))
19490
+ ) || children.some((child) => hasScopeRef(child, context.identifiers));
19483
19491
  }
19484
19492
  const onComponentSlot = findDir(node, "slot", true);
19485
19493
  if (onComponentSlot) {
@@ -19542,7 +19550,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19542
19550
  );
19543
19551
  } else if (vElse = findDir(
19544
19552
  slotElement,
19545
- /^else(-if)?$/,
19553
+ /^else(?:-if)?$/,
19546
19554
  true
19547
19555
  /* allowEmpty */
19548
19556
  )) {
@@ -19554,7 +19562,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
19554
19562
  break;
19555
19563
  }
19556
19564
  }
19557
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
19565
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
19558
19566
  let conditional = dynamicSlots[dynamicSlots.length - 1];
19559
19567
  while (conditional.alternate.type === 19) {
19560
19568
  conditional = conditional.alternate;
@@ -20512,6 +20520,65 @@ const transformOn$1 = (dir, node, context, augmentor) => {
20512
20520
  return ret;
20513
20521
  };
20514
20522
 
20523
+ const transformBind = (dir, _node, context) => {
20524
+ const { modifiers, loc } = dir;
20525
+ const arg = dir.arg;
20526
+ let { exp } = dir;
20527
+ if (exp && exp.type === 4 && !exp.content.trim()) {
20528
+ {
20529
+ context.onError(
20530
+ createCompilerError(34, loc)
20531
+ );
20532
+ return {
20533
+ props: [
20534
+ createObjectProperty(arg, createSimpleExpression("", true, loc))
20535
+ ]
20536
+ };
20537
+ }
20538
+ }
20539
+ if (arg.type !== 4) {
20540
+ arg.children.unshift(`(`);
20541
+ arg.children.push(`) || ""`);
20542
+ } else if (!arg.isStatic) {
20543
+ arg.content = arg.content ? `${arg.content} || ""` : `""`;
20544
+ }
20545
+ if (modifiers.some((mod) => mod.content === "camel")) {
20546
+ if (arg.type === 4) {
20547
+ if (arg.isStatic) {
20548
+ arg.content = camelize(arg.content);
20549
+ } else {
20550
+ arg.content = `${context.helperString(CAMELIZE)}(${arg.content})`;
20551
+ }
20552
+ } else {
20553
+ arg.children.unshift(`${context.helperString(CAMELIZE)}(`);
20554
+ arg.children.push(`)`);
20555
+ }
20556
+ }
20557
+ if (!context.inSSR) {
20558
+ if (modifiers.some((mod) => mod.content === "prop")) {
20559
+ injectPrefix(arg, ".");
20560
+ }
20561
+ if (modifiers.some((mod) => mod.content === "attr")) {
20562
+ injectPrefix(arg, "^");
20563
+ }
20564
+ }
20565
+ return {
20566
+ props: [createObjectProperty(arg, exp)]
20567
+ };
20568
+ };
20569
+ const injectPrefix = (arg, prefix) => {
20570
+ if (arg.type === 4) {
20571
+ if (arg.isStatic) {
20572
+ arg.content = prefix + arg.content;
20573
+ } else {
20574
+ arg.content = `\`${prefix}\${${arg.content}}\``;
20575
+ }
20576
+ } else {
20577
+ arg.children.unshift(`'${prefix}' + (`);
20578
+ arg.children.push(`)`);
20579
+ }
20580
+ };
20581
+
20515
20582
  const transformText = (node, context) => {
20516
20583
  if (node.type === 0 || node.type === 1 || node.type === 11 || node.type === 10) {
20517
20584
  return () => {
@@ -20867,9 +20934,35 @@ const transformMemo = (node, context) => {
20867
20934
  }
20868
20935
  };
20869
20936
 
20937
+ const transformVBindShorthand = (node, context) => {
20938
+ if (node.type === 1) {
20939
+ for (const prop of node.props) {
20940
+ if (prop.type === 7 && prop.name === "bind" && !prop.exp) {
20941
+ const arg = prop.arg;
20942
+ if (arg.type !== 4 || !arg.isStatic) {
20943
+ context.onError(
20944
+ createCompilerError(
20945
+ 52,
20946
+ arg.loc
20947
+ )
20948
+ );
20949
+ prop.exp = createSimpleExpression("", true, arg.loc);
20950
+ } else {
20951
+ const propName = camelize(arg.content);
20952
+ if (validFirstIdentCharRE.test(propName[0]) || // allow hyphen first char for https://github.com/vuejs/language-tools/pull/3424
20953
+ propName[0] === "-") {
20954
+ prop.exp = createSimpleExpression(propName, false, arg.loc);
20955
+ }
20956
+ }
20957
+ }
20958
+ }
20959
+ }
20960
+ };
20961
+
20870
20962
  function getBaseTransformPreset(prefixIdentifiers) {
20871
20963
  return [
20872
20964
  [
20965
+ transformVBindShorthand,
20873
20966
  transformOnce,
20874
20967
  transformIf,
20875
20968
  transformMemo,
@@ -21420,7 +21513,7 @@ const getCachedNode = (node) => {
21420
21513
  return node.codegenNode;
21421
21514
  }
21422
21515
  };
21423
- const dataAriaRE = /^(data|aria)-/;
21516
+ const dataAriaRE = /^(?:data|aria)-/;
21424
21517
  const isStringifiableAttr = (name, ns) => {
21425
21518
  return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : ns === 2 ? isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
21426
21519
  };
@@ -21431,6 +21524,9 @@ function analyzeNode(node) {
21431
21524
  if (node.type === 1 && isNonStringifiable(node.tag)) {
21432
21525
  return false;
21433
21526
  }
21527
+ if (node.type === 1 && findDir(node, "once", true)) {
21528
+ return false;
21529
+ }
21434
21530
  if (node.type === 12) {
21435
21531
  return [1, 0];
21436
21532
  }