vue 3.5.18 → 3.5.20

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 v3.5.18
2
+ * vue v3.5.20
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -56,10 +56,10 @@ const isBuiltInDirective = /* @__PURE__ */ makeMap(
56
56
  );
57
57
  const cacheStringFunction = (fn) => {
58
58
  const cache = /* @__PURE__ */ Object.create(null);
59
- return (str) => {
59
+ return ((str) => {
60
60
  const hit = cache[str];
61
61
  return hit || (cache[str] = fn(str));
62
- };
62
+ });
63
63
  };
64
64
  const camelizeRE = /-(\w)/g;
65
65
  const camelize = cacheStringFunction(
@@ -1091,7 +1091,7 @@ const arrayInstrumentations = {
1091
1091
  join(separator) {
1092
1092
  return reactiveReadArray(this).join(separator);
1093
1093
  },
1094
- // keys() iterator only reads `length`, no optimisation required
1094
+ // keys() iterator only reads `length`, no optimization required
1095
1095
  lastIndexOf(...args) {
1096
1096
  return searchProxy(this, "lastIndexOf", args);
1097
1097
  },
@@ -1292,7 +1292,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1292
1292
  }
1293
1293
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1294
1294
  if (isOldValueReadonly) {
1295
- return false;
1295
+ {
1296
+ warn$2(
1297
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1298
+ target[key]
1299
+ );
1300
+ }
1301
+ return true;
1296
1302
  } else {
1297
1303
  oldValue.value = value;
1298
1304
  return true;
@@ -1437,7 +1443,7 @@ function createInstrumentations(readonly, shallow) {
1437
1443
  get size() {
1438
1444
  const target = this["__v_raw"];
1439
1445
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1440
- return Reflect.get(target, "size", target);
1446
+ return target.size;
1441
1447
  },
1442
1448
  has(key) {
1443
1449
  const target = this["__v_raw"];
@@ -2659,7 +2665,9 @@ function rerender(id, newRender) {
2659
2665
  }
2660
2666
  instance.renderCache = [];
2661
2667
  isHmrUpdating = true;
2662
- instance.update();
2668
+ if (!(instance.job.flags & 8)) {
2669
+ instance.update();
2670
+ }
2663
2671
  isHmrUpdating = false;
2664
2672
  });
2665
2673
  }
@@ -3720,7 +3728,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3720
3728
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3721
3729
  const setupState = owner.setupState;
3722
3730
  const rawSetupState = toRaw(setupState);
3723
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3731
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
3724
3732
  {
3725
3733
  if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
3726
3734
  warn$1(
@@ -3733,6 +3741,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3733
3741
  }
3734
3742
  return hasOwn(rawSetupState, key);
3735
3743
  };
3744
+ const canSetRef = (ref2) => {
3745
+ return !knownTemplateRefs.has(ref2);
3746
+ };
3736
3747
  if (oldRef != null && oldRef !== ref) {
3737
3748
  if (isString(oldRef)) {
3738
3749
  refs[oldRef] = null;
@@ -3740,7 +3751,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3740
3751
  setupState[oldRef] = null;
3741
3752
  }
3742
3753
  } else if (isRef(oldRef)) {
3743
- oldRef.value = null;
3754
+ if (canSetRef(oldRef)) {
3755
+ oldRef.value = null;
3756
+ }
3757
+ const oldRawRefAtom = oldRawRef;
3758
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
3744
3759
  }
3745
3760
  }
3746
3761
  if (isFunction(ref)) {
@@ -3751,7 +3766,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3751
3766
  if (_isString || _isRef) {
3752
3767
  const doSet = () => {
3753
3768
  if (rawRef.f) {
3754
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3769
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
3755
3770
  if (isUnmount) {
3756
3771
  isArray(existing) && remove(existing, refValue);
3757
3772
  } else {
@@ -3762,8 +3777,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3762
3777
  setupState[ref] = refs[ref];
3763
3778
  }
3764
3779
  } else {
3765
- ref.value = [refValue];
3766
- if (rawRef.k) refs[rawRef.k] = ref.value;
3780
+ const newVal = [refValue];
3781
+ if (canSetRef(ref)) {
3782
+ ref.value = newVal;
3783
+ }
3784
+ if (rawRef.k) refs[rawRef.k] = newVal;
3767
3785
  }
3768
3786
  } else if (!existing.includes(refValue)) {
3769
3787
  existing.push(refValue);
@@ -3775,7 +3793,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3775
3793
  setupState[ref] = value;
3776
3794
  }
3777
3795
  } else if (_isRef) {
3778
- ref.value = value;
3796
+ if (canSetRef(ref)) {
3797
+ ref.value = value;
3798
+ }
3779
3799
  if (rawRef.k) refs[rawRef.k] = value;
3780
3800
  } else {
3781
3801
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -5344,10 +5364,10 @@ const PublicInstanceProxyHandlers = {
5344
5364
  return true;
5345
5365
  },
5346
5366
  has({
5347
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
5367
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
5348
5368
  }, key) {
5349
- let normalizedProps;
5350
- 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);
5369
+ let normalizedProps, cssModules;
5370
+ 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]);
5351
5371
  },
5352
5372
  defineProperty(target, key, descriptor) {
5353
5373
  if (descriptor.get != null) {
@@ -6624,7 +6644,7 @@ function isBoolean(...args) {
6624
6644
  return args.some((elem) => elem.toLowerCase() === "boolean");
6625
6645
  }
6626
6646
 
6627
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
6647
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
6628
6648
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6629
6649
  const normalizeSlot = (key, rawSlot, ctx) => {
6630
6650
  if (rawSlot._n) {
@@ -6678,8 +6698,6 @@ const assignSlots = (slots, children, optimized) => {
6678
6698
  const initSlots = (instance, children, optimized) => {
6679
6699
  const slots = instance.slots = createInternalObject();
6680
6700
  if (instance.vnode.shapeFlag & 32) {
6681
- const cacheIndexes = children.__;
6682
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6683
6701
  const type = children._;
6684
6702
  if (type) {
6685
6703
  assignSlots(slots, children, optimized);
@@ -6740,12 +6758,10 @@ function endMeasure(instance, type) {
6740
6758
  if (instance.appContext.config.performance && isSupported()) {
6741
6759
  const startTag = `vue-${type}-${instance.uid}`;
6742
6760
  const endTag = startTag + `:end`;
6761
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
6743
6762
  perf.mark(endTag);
6744
- perf.measure(
6745
- `<${formatComponentName(instance, instance.type)}> ${type}`,
6746
- startTag,
6747
- endTag
6748
- );
6763
+ perf.measure(measureName, startTag, endTag);
6764
+ perf.clearMeasures(measureName);
6749
6765
  perf.clearMarks(startTag);
6750
6766
  perf.clearMarks(endTag);
6751
6767
  }
@@ -7937,6 +7953,12 @@ function baseCreateRenderer(options, createHydrationFns) {
7937
7953
  }
7938
7954
  };
7939
7955
  const performLeave = () => {
7956
+ if (el._isLeaving) {
7957
+ el[leaveCbKey](
7958
+ true
7959
+ /* cancelled */
7960
+ );
7961
+ }
7940
7962
  leave(el, () => {
7941
7963
  remove2();
7942
7964
  afterLeave && afterLeave();
@@ -8082,27 +8104,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8082
8104
  if (instance.type.__hmrId) {
8083
8105
  unregisterHMR(instance);
8084
8106
  }
8085
- const {
8086
- bum,
8087
- scope,
8088
- job,
8089
- subTree,
8090
- um,
8091
- m,
8092
- a,
8093
- parent,
8094
- slots: { __: slotCacheKeys }
8095
- } = instance;
8107
+ const { bum, scope, job, subTree, um, m, a } = instance;
8096
8108
  invalidateMount(m);
8097
8109
  invalidateMount(a);
8098
8110
  if (bum) {
8099
8111
  invokeArrayFns(bum);
8100
8112
  }
8101
- if (parent && isArray(slotCacheKeys)) {
8102
- slotCacheKeys.forEach((v) => {
8103
- parent.renderCache[v] = void 0;
8104
- });
8105
- }
8106
8113
  scope.stop();
8107
8114
  if (job) {
8108
8115
  job.flags |= 8;
@@ -8114,12 +8121,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8114
8121
  queuePostRenderEffect(() => {
8115
8122
  instance.isUnmounted = true;
8116
8123
  }, parentSuspense);
8117
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8118
- parentSuspense.deps--;
8119
- if (parentSuspense.deps === 0) {
8120
- parentSuspense.resolve();
8121
- }
8122
- }
8123
8124
  {
8124
8125
  devtoolsComponentRemoved(instance);
8125
8126
  }
@@ -8220,7 +8221,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
8220
8221
  if (!shallow && c2.patchFlag !== -2)
8221
8222
  traverseStaticChildren(c1, c2);
8222
8223
  }
8223
- if (c2.type === Text) {
8224
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
8225
+ c2.patchFlag !== -1) {
8224
8226
  c2.el = c1.el;
8225
8227
  }
8226
8228
  if (c2.type === Comment && !c2.el) {
@@ -10557,7 +10559,7 @@ function isMemoSame(cached, memo) {
10557
10559
  return true;
10558
10560
  }
10559
10561
 
10560
- const version = "3.5.18";
10562
+ const version = "3.5.20";
10561
10563
  const warn = warn$1 ;
10562
10564
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10563
10565
  const devtools = devtools$1 ;
@@ -10957,6 +10959,8 @@ function patchClass(el, value, isSVG) {
10957
10959
  const vShowOriginalDisplay = Symbol("_vod");
10958
10960
  const vShowHidden = Symbol("_vsh");
10959
10961
  const vShow = {
10962
+ // used for prop mismatch check during hydration
10963
+ name: "show",
10960
10964
  beforeMount(el, { value }, { transition }) {
10961
10965
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
10962
10966
  if (transition && value) {
@@ -10990,9 +10994,6 @@ const vShow = {
10990
10994
  setDisplay(el, value);
10991
10995
  }
10992
10996
  };
10993
- {
10994
- vShow.name = "show";
10995
- }
10996
10997
  function setDisplay(el, value) {
10997
10998
  el.style.display = value ? el[vShowOriginalDisplay] : "none";
10998
10999
  el[vShowHidden] = !value;
@@ -11414,10 +11415,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
11414
11415
  VueCustomElement.def = Comp;
11415
11416
  return VueCustomElement;
11416
11417
  }
11417
- /*! #__NO_SIDE_EFFECTS__ */
11418
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11418
+
11419
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11419
11420
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
11420
- };
11421
+ });
11421
11422
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
11422
11423
  };
11423
11424
  class VueElement extends BaseClass {
@@ -12278,13 +12279,13 @@ const modifierGuards = {
12278
12279
  const withModifiers = (fn, modifiers) => {
12279
12280
  const cache = fn._withMods || (fn._withMods = {});
12280
12281
  const cacheKey = modifiers.join(".");
12281
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12282
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
12282
12283
  for (let i = 0; i < modifiers.length; i++) {
12283
12284
  const guard = modifierGuards[modifiers[i]];
12284
12285
  if (guard && guard(event, modifiers)) return;
12285
12286
  }
12286
12287
  return fn(event, ...args);
12287
- });
12288
+ }));
12288
12289
  };
12289
12290
  const keyNames = {
12290
12291
  esc: "escape",
@@ -12298,7 +12299,7 @@ const keyNames = {
12298
12299
  const withKeys = (fn, modifiers) => {
12299
12300
  const cache = fn._withKeys || (fn._withKeys = {});
12300
12301
  const cacheKey = modifiers.join(".");
12301
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
12302
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
12302
12303
  if (!("key" in event)) {
12303
12304
  return;
12304
12305
  }
@@ -12308,7 +12309,7 @@ const withKeys = (fn, modifiers) => {
12308
12309
  )) {
12309
12310
  return fn(event);
12310
12311
  }
12311
- });
12312
+ }));
12312
12313
  };
12313
12314
 
12314
12315
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -12322,13 +12323,13 @@ function ensureHydrationRenderer() {
12322
12323
  enabledHydration = true;
12323
12324
  return renderer;
12324
12325
  }
12325
- const render = (...args) => {
12326
+ const render = ((...args) => {
12326
12327
  ensureRenderer().render(...args);
12327
- };
12328
- const hydrate = (...args) => {
12328
+ });
12329
+ const hydrate = ((...args) => {
12329
12330
  ensureHydrationRenderer().hydrate(...args);
12330
- };
12331
- const createApp = (...args) => {
12331
+ });
12332
+ const createApp = ((...args) => {
12332
12333
  const app = ensureRenderer().createApp(...args);
12333
12334
  {
12334
12335
  injectNativeTagCheck(app);
@@ -12353,8 +12354,8 @@ const createApp = (...args) => {
12353
12354
  return proxy;
12354
12355
  };
12355
12356
  return app;
12356
- };
12357
- const createSSRApp = (...args) => {
12357
+ });
12358
+ const createSSRApp = ((...args) => {
12358
12359
  const app = ensureHydrationRenderer().createApp(...args);
12359
12360
  {
12360
12361
  injectNativeTagCheck(app);
@@ -12368,7 +12369,7 @@ const createSSRApp = (...args) => {
12368
12369
  }
12369
12370
  };
12370
12371
  return app;
12371
- };
12372
+ });
12372
12373
  function resolveRootNamespace(container) {
12373
12374
  if (container instanceof SVGElement) {
12374
12375
  return "svg";