@vue/compat 3.5.19 → 3.5.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.19
2
+ * @vue/compat v3.5.21
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;
@@ -1062,7 +1061,7 @@ const arrayInstrumentations = {
1062
1061
  join(separator) {
1063
1062
  return reactiveReadArray(this).join(separator);
1064
1063
  },
1065
- // keys() iterator only reads `length`, no optimisation required
1064
+ // keys() iterator only reads `length`, no optimization required
1066
1065
  lastIndexOf(...args) {
1067
1066
  return searchProxy(this, "lastIndexOf", args);
1068
1067
  },
@@ -1389,7 +1388,7 @@ function createInstrumentations(readonly, shallow) {
1389
1388
  get size() {
1390
1389
  const target = this["__v_raw"];
1391
1390
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1392
- return Reflect.get(target, "size", target);
1391
+ return target.size;
1393
1392
  },
1394
1393
  has(key) {
1395
1394
  const target = this["__v_raw"];
@@ -2031,11 +2030,11 @@ function traverse(value, depth = Infinity, seen) {
2031
2030
  if (depth <= 0 || !isObject(value) || value["__v_skip"]) {
2032
2031
  return value;
2033
2032
  }
2034
- seen = seen || /* @__PURE__ */ new Set();
2035
- if (seen.has(value)) {
2033
+ seen = seen || /* @__PURE__ */ new Map();
2034
+ if ((seen.get(value) || 0) >= depth) {
2036
2035
  return value;
2037
2036
  }
2038
- seen.add(value);
2037
+ seen.set(value, depth);
2039
2038
  depth--;
2040
2039
  if (isRef(value)) {
2041
2040
  traverse(value.value, depth, seen);
@@ -2922,26 +2921,34 @@ function moveTeleport(vnode, container, parentAnchor, { o: { insert }, m: move }
2922
2921
  function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScopeIds, optimized, {
2923
2922
  o: { nextSibling, parentNode, querySelector, insert, createText }
2924
2923
  }, hydrateChildren) {
2924
+ function hydrateDisabledTeleport(node2, vnode2, targetStart, targetAnchor) {
2925
+ vnode2.anchor = hydrateChildren(
2926
+ nextSibling(node2),
2927
+ vnode2,
2928
+ parentNode(node2),
2929
+ parentComponent,
2930
+ parentSuspense,
2931
+ slotScopeIds,
2932
+ optimized
2933
+ );
2934
+ vnode2.targetStart = targetStart;
2935
+ vnode2.targetAnchor = targetAnchor;
2936
+ }
2925
2937
  const target = vnode.target = resolveTarget(
2926
2938
  vnode.props,
2927
2939
  querySelector
2928
2940
  );
2941
+ const disabled = isTeleportDisabled(vnode.props);
2929
2942
  if (target) {
2930
- const disabled = isTeleportDisabled(vnode.props);
2931
2943
  const targetNode = target._lpa || target.firstChild;
2932
2944
  if (vnode.shapeFlag & 16) {
2933
2945
  if (disabled) {
2934
- vnode.anchor = hydrateChildren(
2935
- nextSibling(node),
2946
+ hydrateDisabledTeleport(
2947
+ node,
2936
2948
  vnode,
2937
- parentNode(node),
2938
- parentComponent,
2939
- parentSuspense,
2940
- slotScopeIds,
2941
- optimized
2949
+ targetNode,
2950
+ targetNode && nextSibling(targetNode)
2942
2951
  );
2943
- vnode.targetStart = targetNode;
2944
- vnode.targetAnchor = targetNode && nextSibling(targetNode);
2945
2952
  } else {
2946
2953
  vnode.anchor = nextSibling(node);
2947
2954
  let targetAnchor = targetNode;
@@ -2972,6 +2979,10 @@ function hydrateTeleport(node, vnode, parentComponent, parentSuspense, slotScope
2972
2979
  }
2973
2980
  }
2974
2981
  updateCssVars(vnode, disabled);
2982
+ } else if (disabled) {
2983
+ if (vnode.shapeFlag & 16) {
2984
+ hydrateDisabledTeleport(node, vnode, node, nextSibling(node));
2985
+ }
2975
2986
  }
2976
2987
  return vnode.anchor && nextSibling(vnode.anchor);
2977
2988
  }
@@ -3080,7 +3091,7 @@ const BaseTransitionImpl = {
3080
3091
  setTransitionHooks(innerChild, enterHooks);
3081
3092
  }
3082
3093
  let oldInnerChild = instance.subTree && getInnerChild$1(instance.subTree);
3083
- if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(innerChild, oldInnerChild) && recursiveGetSubtree(instance).type !== Comment) {
3094
+ if (oldInnerChild && oldInnerChild.type !== Comment && !isSameVNodeType(oldInnerChild, innerChild) && recursiveGetSubtree(instance).type !== Comment) {
3084
3095
  let leavingHooks = resolveTransitionHooks(
3085
3096
  oldInnerChild,
3086
3097
  rawProps,
@@ -3356,7 +3367,6 @@ function getTransitionRawChildren(children, keepComment = false, parentKey) {
3356
3367
  return ret;
3357
3368
  }
3358
3369
 
3359
- /*! #__NO_SIDE_EFFECTS__ */
3360
3370
  // @__NO_SIDE_EFFECTS__
3361
3371
  function defineComponent(options, extraOptions) {
3362
3372
  return isFunction(options) ? (
@@ -3394,6 +3404,7 @@ function useTemplateRef(key) {
3394
3404
  return ret;
3395
3405
  }
3396
3406
 
3407
+ const pendingSetRefMap = /* @__PURE__ */ new WeakMap();
3397
3408
  function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3398
3409
  if (isArray(rawRef)) {
3399
3410
  rawRef.forEach(
@@ -3424,6 +3435,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3424
3435
  return hasOwn(rawSetupState, key);
3425
3436
  };
3426
3437
  if (oldRef != null && oldRef !== ref) {
3438
+ invalidatePendingSetRef(oldRawRef);
3427
3439
  if (isString(oldRef)) {
3428
3440
  refs[oldRef] = null;
3429
3441
  if (canSetSetupRef(oldRef)) {
@@ -3479,14 +3491,27 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3479
3491
  } else ;
3480
3492
  };
3481
3493
  if (value) {
3482
- doSet.id = -1;
3483
- queuePostRenderEffect(doSet, parentSuspense);
3494
+ const job = () => {
3495
+ doSet();
3496
+ pendingSetRefMap.delete(rawRef);
3497
+ };
3498
+ job.id = -1;
3499
+ pendingSetRefMap.set(rawRef, job);
3500
+ queuePostRenderEffect(job, parentSuspense);
3484
3501
  } else {
3502
+ invalidatePendingSetRef(rawRef);
3485
3503
  doSet();
3486
3504
  }
3487
3505
  }
3488
3506
  }
3489
3507
  }
3508
+ function invalidatePendingSetRef(rawRef) {
3509
+ const pendingSetRef = pendingSetRefMap.get(rawRef);
3510
+ if (pendingSetRef) {
3511
+ pendingSetRef.flags |= 8;
3512
+ pendingSetRefMap.delete(rawRef);
3513
+ }
3514
+ }
3490
3515
 
3491
3516
  let hasLoggedMismatchError = false;
3492
3517
  const logMismatchError = () => {
@@ -4048,7 +4073,6 @@ function forEachElement(node, cb) {
4048
4073
  }
4049
4074
 
4050
4075
  const isAsyncWrapper = (i) => !!i.type.__asyncLoader;
4051
- /*! #__NO_SIDE_EFFECTS__ */
4052
4076
  // @__NO_SIDE_EFFECTS__
4053
4077
  function defineAsyncComponent(source) {
4054
4078
  if (isFunction(source)) {
@@ -5004,7 +5028,7 @@ function legacyRenderSlot(instance, name, fallback, props, bindObject) {
5004
5028
  }
5005
5029
  return renderSlot(instance.slots, name, props, fallback && (() => fallback));
5006
5030
  }
5007
- function legacyresolveScopedSlots(fns, raw, hasDynamicKeys) {
5031
+ function legacyResolveScopedSlots(fns, raw, hasDynamicKeys) {
5008
5032
  return createSlots(
5009
5033
  raw || { $stable: !hasDynamicKeys },
5010
5034
  mapKeyToName(fns)
@@ -5165,7 +5189,7 @@ function installCompatInstanceProperties(map) {
5165
5189
  _b: () => legacyBindObjectProps,
5166
5190
  _v: () => createTextVNode,
5167
5191
  _e: () => createCommentVNode,
5168
- _u: () => legacyresolveScopedSlots,
5192
+ _u: () => legacyResolveScopedSlots,
5169
5193
  _g: () => legacyBindObjectListeners,
5170
5194
  _d: () => legacyBindDynamicKeys,
5171
5195
  _p: () => legacyPrependModifier
@@ -5841,7 +5865,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
5841
5865
  return vm;
5842
5866
  }
5843
5867
  }
5844
- Vue.version = `2.6.14-compat:${"3.5.19"}`;
5868
+ Vue.version = `2.6.14-compat:${"3.5.21"}`;
5845
5869
  Vue.config = singletonApp.config;
5846
5870
  Vue.use = (plugin, ...options) => {
5847
5871
  if (plugin && isFunction(plugin.install)) {
@@ -8388,8 +8412,9 @@ function emit(instance, event, ...rawArgs) {
8388
8412
  return emit$1(instance, event, args);
8389
8413
  }
8390
8414
  }
8415
+ const mixinEmitsCache = /* @__PURE__ */ new WeakMap();
8391
8416
  function normalizeEmitsOptions(comp, appContext, asMixin = false) {
8392
- const cache = appContext.emitsCache;
8417
+ const cache = asMixin ? mixinEmitsCache : appContext.emitsCache;
8393
8418
  const cached = cache.get(comp);
8394
8419
  if (cached !== void 0) {
8395
8420
  return cached;
@@ -8775,7 +8800,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
8775
8800
  const { activeBranch, pendingBranch, isInFallback, isHydrating } = suspense;
8776
8801
  if (pendingBranch) {
8777
8802
  suspense.pendingBranch = newBranch;
8778
- if (isSameVNodeType(newBranch, pendingBranch)) {
8803
+ if (isSameVNodeType(pendingBranch, newBranch)) {
8779
8804
  patch(
8780
8805
  pendingBranch,
8781
8806
  newBranch,
@@ -8846,7 +8871,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
8846
8871
  );
8847
8872
  setActiveBranch(suspense, newFallback);
8848
8873
  }
8849
- } else if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
8874
+ } else if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
8850
8875
  patch(
8851
8876
  activeBranch,
8852
8877
  newBranch,
@@ -8877,7 +8902,7 @@ function patchSuspense(n1, n2, container, anchor, parentComponent, namespace, sl
8877
8902
  }
8878
8903
  }
8879
8904
  } else {
8880
- if (activeBranch && isSameVNodeType(newBranch, activeBranch)) {
8905
+ if (activeBranch && isSameVNodeType(activeBranch, newBranch)) {
8881
8906
  patch(
8882
8907
  activeBranch,
8883
8908
  newBranch,
@@ -9940,15 +9965,23 @@ const computed = (getterOrOptions, debugOptions) => {
9940
9965
  };
9941
9966
 
9942
9967
  function h(type, propsOrChildren, children) {
9968
+ const doCreateVNode = (type2, props, children2) => {
9969
+ setBlockTracking(-1);
9970
+ try {
9971
+ return createVNode(type2, props, children2);
9972
+ } finally {
9973
+ setBlockTracking(1);
9974
+ }
9975
+ };
9943
9976
  const l = arguments.length;
9944
9977
  if (l === 2) {
9945
9978
  if (isObject(propsOrChildren) && !isArray(propsOrChildren)) {
9946
9979
  if (isVNode(propsOrChildren)) {
9947
- return createVNode(type, null, [propsOrChildren]);
9980
+ return doCreateVNode(type, null, [propsOrChildren]);
9948
9981
  }
9949
- return createVNode(type, propsOrChildren);
9982
+ return doCreateVNode(type, propsOrChildren);
9950
9983
  } else {
9951
- return createVNode(type, null, propsOrChildren);
9984
+ return doCreateVNode(type, null, propsOrChildren);
9952
9985
  }
9953
9986
  } else {
9954
9987
  if (l > 3) {
@@ -9956,7 +9989,7 @@ function h(type, propsOrChildren, children) {
9956
9989
  } else if (l === 3 && isVNode(children)) {
9957
9990
  children = [children];
9958
9991
  }
9959
- return createVNode(type, propsOrChildren, children);
9992
+ return doCreateVNode(type, propsOrChildren, children);
9960
9993
  }
9961
9994
  }
9962
9995
 
@@ -9992,7 +10025,7 @@ function isMemoSame(cached, memo) {
9992
10025
  return true;
9993
10026
  }
9994
10027
 
9995
- const version = "3.5.19";
10028
+ const version = "3.5.21";
9996
10029
  const warn$1 = NOOP;
9997
10030
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
9998
10031
  const devtools = void 0;
@@ -10391,7 +10424,7 @@ function getTransitionInfo(el, expectedType) {
10391
10424
  type = timeout > 0 ? transitionTimeout > animationTimeout ? TRANSITION$1 : ANIMATION : null;
10392
10425
  propCount = type ? type === TRANSITION$1 ? transitionDurations.length : animationDurations.length : 0;
10393
10426
  }
10394
- const hasTransform = type === TRANSITION$1 && /\b(transform|all)(,|$)/.test(
10427
+ const hasTransform = type === TRANSITION$1 && /\b(?:transform|all)(?:,|$)/.test(
10395
10428
  getStyleProperties(`${TRANSITION$1}Property`).toString()
10396
10429
  );
10397
10430
  return {
@@ -10432,6 +10465,8 @@ function patchClass(el, value, isSVG) {
10432
10465
  const vShowOriginalDisplay = Symbol("_vod");
10433
10466
  const vShowHidden = Symbol("_vsh");
10434
10467
  const vShow = {
10468
+ // used for prop mismatch check during hydration
10469
+ name: "show",
10435
10470
  beforeMount(el, { value }, { transition }) {
10436
10471
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
10437
10472
  if (transition && value) {
@@ -10482,7 +10517,7 @@ function useCssVars(getter) {
10482
10517
  return;
10483
10518
  }
10484
10519
 
10485
- const displayRE = /(^|;)\s*display\s*:/;
10520
+ const displayRE = /(?:^|;)\s*display\s*:/;
10486
10521
  function patchStyle(el, prev, next) {
10487
10522
  const style = el.style;
10488
10523
  const isCssString = isString(next);
@@ -10820,11 +10855,10 @@ function shouldSetAsProp(el, key, value, isSVG) {
10820
10855
  }
10821
10856
 
10822
10857
  const REMOVAL = {};
10823
- /*! #__NO_SIDE_EFFECTS__ */
10824
10858
  // @__NO_SIDE_EFFECTS__
10825
10859
  function defineCustomElement(options, extraOptions, _createApp) {
10826
- const Comp = defineComponent(options, extraOptions);
10827
- if (isPlainObject(Comp)) extend$1(Comp, extraOptions);
10860
+ let Comp = defineComponent(options, extraOptions);
10861
+ if (isPlainObject(Comp)) Comp = extend$1({}, Comp, extraOptions);
10828
10862
  class VueCustomElement extends VueElement {
10829
10863
  constructor(initialProps) {
10830
10864
  super(Comp, initialProps, _createApp);
@@ -10833,7 +10867,6 @@ function defineCustomElement(options, extraOptions, _createApp) {
10833
10867
  VueCustomElement.def = Comp;
10834
10868
  return VueCustomElement;
10835
10869
  }
10836
-
10837
10870
  const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
10838
10871
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
10839
10872
  });
@@ -11247,7 +11280,7 @@ const TransitionGroupImpl = /* @__PURE__ */ decorate({
11247
11280
  if (e && e.target !== el) {
11248
11281
  return;
11249
11282
  }
11250
- if (!e || /transform$/.test(e.propertyName)) {
11283
+ if (!e || e.propertyName.endsWith("transform")) {
11251
11284
  el.removeEventListener("transitionend", cb);
11252
11285
  el[moveCbKey] = null;
11253
11286
  removeTransitionClass(el, moveClass);
@@ -16129,7 +16162,7 @@ function isConst(type) {
16129
16162
  }
16130
16163
 
16131
16164
  const transformIf = createStructuralDirectiveTransform(
16132
- /^(if|else|else-if)$/,
16165
+ /^(?:if|else|else-if)$/,
16133
16166
  (node, dir, context) => {
16134
16167
  return processIf(node, dir, context, (ifNode, branch, isRoot) => {
16135
16168
  const siblings = context.parent.children;
@@ -16717,7 +16750,9 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16717
16750
  const dynamicSlots = [];
16718
16751
  let hasDynamicSlots = context.scopes.vSlot > 0 || context.scopes.vFor > 0;
16719
16752
  if (!context.ssr && context.prefixIdentifiers) {
16720
- hasDynamicSlots = hasScopeRef(node, context.identifiers);
16753
+ hasDynamicSlots = node.props.some(
16754
+ (prop) => isVSlot(prop) && (hasScopeRef(prop.arg, context.identifiers) || hasScopeRef(prop.exp, context.identifiers))
16755
+ ) || children.some((child) => hasScopeRef(child, context.identifiers));
16721
16756
  }
16722
16757
  const onComponentSlot = findDir(node, "slot", true);
16723
16758
  if (onComponentSlot) {
@@ -16780,7 +16815,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16780
16815
  );
16781
16816
  } else if (vElse = findDir(
16782
16817
  slotElement,
16783
- /^else(-if)?$/,
16818
+ /^else(?:-if)?$/,
16784
16819
  true
16785
16820
  /* allowEmpty */
16786
16821
  )) {
@@ -16792,7 +16827,7 @@ function buildSlots(node, context, buildSlotFn = buildClientSlotFn) {
16792
16827
  break;
16793
16828
  }
16794
16829
  }
16795
- if (prev && isTemplateNode(prev) && findDir(prev, /^(else-)?if$/)) {
16830
+ if (prev && isTemplateNode(prev) && findDir(prev, /^(?:else-)?if$/)) {
16796
16831
  let conditional = dynamicSlots[dynamicSlots.length - 1];
16797
16832
  while (conditional.alternate.type === 19) {
16798
16833
  conditional = conditional.alternate;
@@ -18554,7 +18589,7 @@ const getCachedNode = (node) => {
18554
18589
  return node.codegenNode;
18555
18590
  }
18556
18591
  };
18557
- const dataAriaRE = /^(data|aria)-/;
18592
+ const dataAriaRE = /^(?:data|aria)-/;
18558
18593
  const isStringifiableAttr = (name, ns) => {
18559
18594
  return (ns === 0 ? isKnownHtmlAttr(name) : ns === 1 ? isKnownSvgAttr(name) : ns === 2 ? isKnownMathMLAttr(name) : false) || dataAriaRE.test(name);
18560
18595
  };