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
  **/
@@ -59,10 +59,10 @@ var Vue = (function (exports) {
59
59
  );
60
60
  const cacheStringFunction = (fn) => {
61
61
  const cache = /* @__PURE__ */ Object.create(null);
62
- return (str) => {
62
+ return ((str) => {
63
63
  const hit = cache[str];
64
64
  return hit || (cache[str] = fn(str));
65
- };
65
+ });
66
66
  };
67
67
  const camelizeRE = /-(\w)/g;
68
68
  const camelize = cacheStringFunction(
@@ -1094,7 +1094,7 @@ var Vue = (function (exports) {
1094
1094
  join(separator) {
1095
1095
  return reactiveReadArray(this).join(separator);
1096
1096
  },
1097
- // keys() iterator only reads `length`, no optimisation required
1097
+ // keys() iterator only reads `length`, no optimization required
1098
1098
  lastIndexOf(...args) {
1099
1099
  return searchProxy(this, "lastIndexOf", args);
1100
1100
  },
@@ -1295,7 +1295,13 @@ var Vue = (function (exports) {
1295
1295
  }
1296
1296
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1297
1297
  if (isOldValueReadonly) {
1298
- return false;
1298
+ {
1299
+ warn$2(
1300
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1301
+ target[key]
1302
+ );
1303
+ }
1304
+ return true;
1299
1305
  } else {
1300
1306
  oldValue.value = value;
1301
1307
  return true;
@@ -1440,7 +1446,7 @@ var Vue = (function (exports) {
1440
1446
  get size() {
1441
1447
  const target = this["__v_raw"];
1442
1448
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1443
- return Reflect.get(target, "size", target);
1449
+ return target.size;
1444
1450
  },
1445
1451
  has(key) {
1446
1452
  const target = this["__v_raw"];
@@ -2662,7 +2668,9 @@ var Vue = (function (exports) {
2662
2668
  }
2663
2669
  instance.renderCache = [];
2664
2670
  isHmrUpdating = true;
2665
- instance.update();
2671
+ if (!(instance.job.flags & 8)) {
2672
+ instance.update();
2673
+ }
2666
2674
  isHmrUpdating = false;
2667
2675
  });
2668
2676
  }
@@ -3723,7 +3731,7 @@ var Vue = (function (exports) {
3723
3731
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3724
3732
  const setupState = owner.setupState;
3725
3733
  const rawSetupState = toRaw(setupState);
3726
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3734
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
3727
3735
  {
3728
3736
  if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
3729
3737
  warn$1(
@@ -3736,6 +3744,9 @@ var Vue = (function (exports) {
3736
3744
  }
3737
3745
  return hasOwn(rawSetupState, key);
3738
3746
  };
3747
+ const canSetRef = (ref2) => {
3748
+ return !knownTemplateRefs.has(ref2);
3749
+ };
3739
3750
  if (oldRef != null && oldRef !== ref) {
3740
3751
  if (isString(oldRef)) {
3741
3752
  refs[oldRef] = null;
@@ -3743,7 +3754,11 @@ var Vue = (function (exports) {
3743
3754
  setupState[oldRef] = null;
3744
3755
  }
3745
3756
  } else if (isRef(oldRef)) {
3746
- oldRef.value = null;
3757
+ if (canSetRef(oldRef)) {
3758
+ oldRef.value = null;
3759
+ }
3760
+ const oldRawRefAtom = oldRawRef;
3761
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
3747
3762
  }
3748
3763
  }
3749
3764
  if (isFunction(ref)) {
@@ -3754,7 +3769,7 @@ var Vue = (function (exports) {
3754
3769
  if (_isString || _isRef) {
3755
3770
  const doSet = () => {
3756
3771
  if (rawRef.f) {
3757
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3772
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
3758
3773
  if (isUnmount) {
3759
3774
  isArray(existing) && remove(existing, refValue);
3760
3775
  } else {
@@ -3765,8 +3780,11 @@ var Vue = (function (exports) {
3765
3780
  setupState[ref] = refs[ref];
3766
3781
  }
3767
3782
  } else {
3768
- ref.value = [refValue];
3769
- if (rawRef.k) refs[rawRef.k] = ref.value;
3783
+ const newVal = [refValue];
3784
+ if (canSetRef(ref)) {
3785
+ ref.value = newVal;
3786
+ }
3787
+ if (rawRef.k) refs[rawRef.k] = newVal;
3770
3788
  }
3771
3789
  } else if (!existing.includes(refValue)) {
3772
3790
  existing.push(refValue);
@@ -3778,7 +3796,9 @@ var Vue = (function (exports) {
3778
3796
  setupState[ref] = value;
3779
3797
  }
3780
3798
  } else if (_isRef) {
3781
- ref.value = value;
3799
+ if (canSetRef(ref)) {
3800
+ ref.value = value;
3801
+ }
3782
3802
  if (rawRef.k) refs[rawRef.k] = value;
3783
3803
  } else {
3784
3804
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -5341,10 +5361,10 @@ If this is a native custom element, make sure to exclude it from component resol
5341
5361
  return true;
5342
5362
  },
5343
5363
  has({
5344
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
5364
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
5345
5365
  }, key) {
5346
- let normalizedProps;
5347
- 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);
5366
+ let normalizedProps, cssModules;
5367
+ 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]);
5348
5368
  },
5349
5369
  defineProperty(target, key, descriptor) {
5350
5370
  if (descriptor.get != null) {
@@ -6618,7 +6638,7 @@ If you want to remount the same app, move your app creation logic into a factory
6618
6638
  return args.some((elem) => elem.toLowerCase() === "boolean");
6619
6639
  }
6620
6640
 
6621
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
6641
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
6622
6642
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6623
6643
  const normalizeSlot = (key, rawSlot, ctx) => {
6624
6644
  if (rawSlot._n) {
@@ -6672,8 +6692,6 @@ If you want to remount the same app, move your app creation logic into a factory
6672
6692
  const initSlots = (instance, children, optimized) => {
6673
6693
  const slots = instance.slots = createInternalObject();
6674
6694
  if (instance.vnode.shapeFlag & 32) {
6675
- const cacheIndexes = children.__;
6676
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6677
6695
  const type = children._;
6678
6696
  if (type) {
6679
6697
  assignSlots(slots, children, optimized);
@@ -6734,12 +6752,10 @@ If you want to remount the same app, move your app creation logic into a factory
6734
6752
  if (instance.appContext.config.performance && isSupported()) {
6735
6753
  const startTag = `vue-${type}-${instance.uid}`;
6736
6754
  const endTag = startTag + `:end`;
6755
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
6737
6756
  perf.mark(endTag);
6738
- perf.measure(
6739
- `<${formatComponentName(instance, instance.type)}> ${type}`,
6740
- startTag,
6741
- endTag
6742
- );
6757
+ perf.measure(measureName, startTag, endTag);
6758
+ perf.clearMeasures(measureName);
6743
6759
  perf.clearMarks(startTag);
6744
6760
  perf.clearMarks(endTag);
6745
6761
  }
@@ -7931,6 +7947,12 @@ If you want to remount the same app, move your app creation logic into a factory
7931
7947
  }
7932
7948
  };
7933
7949
  const performLeave = () => {
7950
+ if (el._isLeaving) {
7951
+ el[leaveCbKey](
7952
+ true
7953
+ /* cancelled */
7954
+ );
7955
+ }
7934
7956
  leave(el, () => {
7935
7957
  remove2();
7936
7958
  afterLeave && afterLeave();
@@ -8076,27 +8098,12 @@ If you want to remount the same app, move your app creation logic into a factory
8076
8098
  if (instance.type.__hmrId) {
8077
8099
  unregisterHMR(instance);
8078
8100
  }
8079
- const {
8080
- bum,
8081
- scope,
8082
- job,
8083
- subTree,
8084
- um,
8085
- m,
8086
- a,
8087
- parent,
8088
- slots: { __: slotCacheKeys }
8089
- } = instance;
8101
+ const { bum, scope, job, subTree, um, m, a } = instance;
8090
8102
  invalidateMount(m);
8091
8103
  invalidateMount(a);
8092
8104
  if (bum) {
8093
8105
  invokeArrayFns(bum);
8094
8106
  }
8095
- if (parent && isArray(slotCacheKeys)) {
8096
- slotCacheKeys.forEach((v) => {
8097
- parent.renderCache[v] = void 0;
8098
- });
8099
- }
8100
8107
  scope.stop();
8101
8108
  if (job) {
8102
8109
  job.flags |= 8;
@@ -8108,12 +8115,6 @@ If you want to remount the same app, move your app creation logic into a factory
8108
8115
  queuePostRenderEffect(() => {
8109
8116
  instance.isUnmounted = true;
8110
8117
  }, parentSuspense);
8111
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8112
- parentSuspense.deps--;
8113
- if (parentSuspense.deps === 0) {
8114
- parentSuspense.resolve();
8115
- }
8116
- }
8117
8118
  {
8118
8119
  devtoolsComponentRemoved(instance);
8119
8120
  }
@@ -8214,7 +8215,8 @@ If you want to remount the same app, move your app creation logic into a factory
8214
8215
  if (!shallow && c2.patchFlag !== -2)
8215
8216
  traverseStaticChildren(c1, c2);
8216
8217
  }
8217
- if (c2.type === Text) {
8218
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
8219
+ c2.patchFlag !== -1) {
8218
8220
  c2.el = c1.el;
8219
8221
  }
8220
8222
  if (c2.type === Comment && !c2.el) {
@@ -10509,7 +10511,7 @@ Component that was made reactive: `,
10509
10511
  return true;
10510
10512
  }
10511
10513
 
10512
- const version = "3.5.18";
10514
+ const version = "3.5.20";
10513
10515
  const warn = warn$1 ;
10514
10516
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10515
10517
  const devtools = devtools$1 ;
@@ -10897,6 +10899,8 @@ Component that was made reactive: `,
10897
10899
  const vShowOriginalDisplay = Symbol("_vod");
10898
10900
  const vShowHidden = Symbol("_vsh");
10899
10901
  const vShow = {
10902
+ // used for prop mismatch check during hydration
10903
+ name: "show",
10900
10904
  beforeMount(el, { value }, { transition }) {
10901
10905
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
10902
10906
  if (transition && value) {
@@ -10930,9 +10934,6 @@ Component that was made reactive: `,
10930
10934
  setDisplay(el, value);
10931
10935
  }
10932
10936
  };
10933
- {
10934
- vShow.name = "show";
10935
- }
10936
10937
  function setDisplay(el, value) {
10937
10938
  el.style.display = value ? el[vShowOriginalDisplay] : "none";
10938
10939
  el[vShowHidden] = !value;
@@ -11347,10 +11348,10 @@ Expected function or array of functions, received type ${typeof value}.`
11347
11348
  VueCustomElement.def = Comp;
11348
11349
  return VueCustomElement;
11349
11350
  }
11350
- /*! #__NO_SIDE_EFFECTS__ */
11351
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11351
+
11352
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11352
11353
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
11353
- };
11354
+ });
11354
11355
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
11355
11356
  };
11356
11357
  class VueElement extends BaseClass {
@@ -12165,13 +12166,13 @@ Expected function or array of functions, received type ${typeof value}.`
12165
12166
  const withModifiers = (fn, modifiers) => {
12166
12167
  const cache = fn._withMods || (fn._withMods = {});
12167
12168
  const cacheKey = modifiers.join(".");
12168
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12169
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
12169
12170
  for (let i = 0; i < modifiers.length; i++) {
12170
12171
  const guard = modifierGuards[modifiers[i]];
12171
12172
  if (guard && guard(event, modifiers)) return;
12172
12173
  }
12173
12174
  return fn(event, ...args);
12174
- });
12175
+ }));
12175
12176
  };
12176
12177
  const keyNames = {
12177
12178
  esc: "escape",
@@ -12185,7 +12186,7 @@ Expected function or array of functions, received type ${typeof value}.`
12185
12186
  const withKeys = (fn, modifiers) => {
12186
12187
  const cache = fn._withKeys || (fn._withKeys = {});
12187
12188
  const cacheKey = modifiers.join(".");
12188
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
12189
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
12189
12190
  if (!("key" in event)) {
12190
12191
  return;
12191
12192
  }
@@ -12195,7 +12196,7 @@ Expected function or array of functions, received type ${typeof value}.`
12195
12196
  )) {
12196
12197
  return fn(event);
12197
12198
  }
12198
- });
12199
+ }));
12199
12200
  };
12200
12201
 
12201
12202
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -12209,13 +12210,13 @@ Expected function or array of functions, received type ${typeof value}.`
12209
12210
  enabledHydration = true;
12210
12211
  return renderer;
12211
12212
  }
12212
- const render = (...args) => {
12213
+ const render = ((...args) => {
12213
12214
  ensureRenderer().render(...args);
12214
- };
12215
- const hydrate = (...args) => {
12215
+ });
12216
+ const hydrate = ((...args) => {
12216
12217
  ensureHydrationRenderer().hydrate(...args);
12217
- };
12218
- const createApp = (...args) => {
12218
+ });
12219
+ const createApp = ((...args) => {
12219
12220
  const app = ensureRenderer().createApp(...args);
12220
12221
  {
12221
12222
  injectNativeTagCheck(app);
@@ -12240,8 +12241,8 @@ Expected function or array of functions, received type ${typeof value}.`
12240
12241
  return proxy;
12241
12242
  };
12242
12243
  return app;
12243
- };
12244
- const createSSRApp = (...args) => {
12244
+ });
12245
+ const createSSRApp = ((...args) => {
12245
12246
  const app = ensureHydrationRenderer().createApp(...args);
12246
12247
  {
12247
12248
  injectNativeTagCheck(app);
@@ -12255,7 +12256,7 @@ Expected function or array of functions, received type ${typeof value}.`
12255
12256
  }
12256
12257
  };
12257
12258
  return app;
12258
- };
12259
+ });
12259
12260
  function resolveRootNamespace(container) {
12260
12261
  if (container instanceof SVGElement) {
12261
12262
  return "svg";