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.
package/dist/vue.cjs.js CHANGED
@@ -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
  **/
@@ -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
  **/
@@ -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(
@@ -1164,7 +1164,7 @@ const arrayInstrumentations = {
1164
1164
  join(separator) {
1165
1165
  return reactiveReadArray(this).join(separator);
1166
1166
  },
1167
- // keys() iterator only reads `length`, no optimisation required
1167
+ // keys() iterator only reads `length`, no optimization required
1168
1168
  lastIndexOf(...args) {
1169
1169
  return searchProxy(this, "lastIndexOf", args);
1170
1170
  },
@@ -1365,7 +1365,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1365
1365
  }
1366
1366
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1367
1367
  if (isOldValueReadonly) {
1368
- return false;
1368
+ {
1369
+ warn$2(
1370
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1371
+ target[key]
1372
+ );
1373
+ }
1374
+ return true;
1369
1375
  } else {
1370
1376
  oldValue.value = value;
1371
1377
  return true;
@@ -1510,7 +1516,7 @@ function createInstrumentations(readonly, shallow) {
1510
1516
  get size() {
1511
1517
  const target = this["__v_raw"];
1512
1518
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1513
- return Reflect.get(target, "size", target);
1519
+ return target.size;
1514
1520
  },
1515
1521
  has(key) {
1516
1522
  const target = this["__v_raw"];
@@ -2732,7 +2738,9 @@ function rerender(id, newRender) {
2732
2738
  }
2733
2739
  instance.renderCache = [];
2734
2740
  isHmrUpdating = true;
2735
- instance.update();
2741
+ if (!(instance.job.flags & 8)) {
2742
+ instance.update();
2743
+ }
2736
2744
  isHmrUpdating = false;
2737
2745
  });
2738
2746
  }
@@ -3793,7 +3801,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3793
3801
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
3794
3802
  const setupState = owner.setupState;
3795
3803
  const rawSetupState = toRaw(setupState);
3796
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
3804
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
3797
3805
  {
3798
3806
  if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
3799
3807
  warn$1(
@@ -3806,6 +3814,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3806
3814
  }
3807
3815
  return hasOwn(rawSetupState, key);
3808
3816
  };
3817
+ const canSetRef = (ref2) => {
3818
+ return !knownTemplateRefs.has(ref2);
3819
+ };
3809
3820
  if (oldRef != null && oldRef !== ref) {
3810
3821
  if (isString(oldRef)) {
3811
3822
  refs[oldRef] = null;
@@ -3813,7 +3824,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3813
3824
  setupState[oldRef] = null;
3814
3825
  }
3815
3826
  } else if (isRef(oldRef)) {
3816
- oldRef.value = null;
3827
+ if (canSetRef(oldRef)) {
3828
+ oldRef.value = null;
3829
+ }
3830
+ const oldRawRefAtom = oldRawRef;
3831
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
3817
3832
  }
3818
3833
  }
3819
3834
  if (isFunction(ref)) {
@@ -3824,7 +3839,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3824
3839
  if (_isString || _isRef) {
3825
3840
  const doSet = () => {
3826
3841
  if (rawRef.f) {
3827
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
3842
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
3828
3843
  if (isUnmount) {
3829
3844
  isArray(existing) && remove(existing, refValue);
3830
3845
  } else {
@@ -3835,8 +3850,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3835
3850
  setupState[ref] = refs[ref];
3836
3851
  }
3837
3852
  } else {
3838
- ref.value = [refValue];
3839
- if (rawRef.k) refs[rawRef.k] = ref.value;
3853
+ const newVal = [refValue];
3854
+ if (canSetRef(ref)) {
3855
+ ref.value = newVal;
3856
+ }
3857
+ if (rawRef.k) refs[rawRef.k] = newVal;
3840
3858
  }
3841
3859
  } else if (!existing.includes(refValue)) {
3842
3860
  existing.push(refValue);
@@ -3848,7 +3866,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
3848
3866
  setupState[ref] = value;
3849
3867
  }
3850
3868
  } else if (_isRef) {
3851
- ref.value = value;
3869
+ if (canSetRef(ref)) {
3870
+ ref.value = value;
3871
+ }
3852
3872
  if (rawRef.k) refs[rawRef.k] = value;
3853
3873
  } else {
3854
3874
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -5417,10 +5437,10 @@ const PublicInstanceProxyHandlers = {
5417
5437
  return true;
5418
5438
  },
5419
5439
  has({
5420
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
5440
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
5421
5441
  }, key) {
5422
- let normalizedProps;
5423
- 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);
5442
+ let normalizedProps, cssModules;
5443
+ 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]);
5424
5444
  },
5425
5445
  defineProperty(target, key, descriptor) {
5426
5446
  if (descriptor.get != null) {
@@ -6697,7 +6717,7 @@ function isBoolean(...args) {
6697
6717
  return args.some((elem) => elem.toLowerCase() === "boolean");
6698
6718
  }
6699
6719
 
6700
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
6720
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
6701
6721
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
6702
6722
  const normalizeSlot = (key, rawSlot, ctx) => {
6703
6723
  if (rawSlot._n) {
@@ -6751,8 +6771,6 @@ const assignSlots = (slots, children, optimized) => {
6751
6771
  const initSlots = (instance, children, optimized) => {
6752
6772
  const slots = instance.slots = createInternalObject();
6753
6773
  if (instance.vnode.shapeFlag & 32) {
6754
- const cacheIndexes = children.__;
6755
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
6756
6774
  const type = children._;
6757
6775
  if (type) {
6758
6776
  assignSlots(slots, children, optimized);
@@ -6813,12 +6831,10 @@ function endMeasure(instance, type) {
6813
6831
  if (instance.appContext.config.performance && isSupported()) {
6814
6832
  const startTag = `vue-${type}-${instance.uid}`;
6815
6833
  const endTag = startTag + `:end`;
6834
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
6816
6835
  perf.mark(endTag);
6817
- perf.measure(
6818
- `<${formatComponentName(instance, instance.type)}> ${type}`,
6819
- startTag,
6820
- endTag
6821
- );
6836
+ perf.measure(measureName, startTag, endTag);
6837
+ perf.clearMeasures(measureName);
6822
6838
  perf.clearMarks(startTag);
6823
6839
  perf.clearMarks(endTag);
6824
6840
  }
@@ -8010,6 +8026,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8010
8026
  }
8011
8027
  };
8012
8028
  const performLeave = () => {
8029
+ if (el._isLeaving) {
8030
+ el[leaveCbKey](
8031
+ true
8032
+ /* cancelled */
8033
+ );
8034
+ }
8013
8035
  leave(el, () => {
8014
8036
  remove2();
8015
8037
  afterLeave && afterLeave();
@@ -8155,27 +8177,12 @@ function baseCreateRenderer(options, createHydrationFns) {
8155
8177
  if (instance.type.__hmrId) {
8156
8178
  unregisterHMR(instance);
8157
8179
  }
8158
- const {
8159
- bum,
8160
- scope,
8161
- job,
8162
- subTree,
8163
- um,
8164
- m,
8165
- a,
8166
- parent,
8167
- slots: { __: slotCacheKeys }
8168
- } = instance;
8180
+ const { bum, scope, job, subTree, um, m, a } = instance;
8169
8181
  invalidateMount(m);
8170
8182
  invalidateMount(a);
8171
8183
  if (bum) {
8172
8184
  invokeArrayFns(bum);
8173
8185
  }
8174
- if (parent && isArray(slotCacheKeys)) {
8175
- slotCacheKeys.forEach((v) => {
8176
- parent.renderCache[v] = void 0;
8177
- });
8178
- }
8179
8186
  scope.stop();
8180
8187
  if (job) {
8181
8188
  job.flags |= 8;
@@ -8187,12 +8194,6 @@ function baseCreateRenderer(options, createHydrationFns) {
8187
8194
  queuePostRenderEffect(() => {
8188
8195
  instance.isUnmounted = true;
8189
8196
  }, parentSuspense);
8190
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
8191
- parentSuspense.deps--;
8192
- if (parentSuspense.deps === 0) {
8193
- parentSuspense.resolve();
8194
- }
8195
- }
8196
8197
  {
8197
8198
  devtoolsComponentRemoved(instance);
8198
8199
  }
@@ -8293,7 +8294,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
8293
8294
  if (!shallow && c2.patchFlag !== -2)
8294
8295
  traverseStaticChildren(c1, c2);
8295
8296
  }
8296
- if (c2.type === Text) {
8297
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
8298
+ c2.patchFlag !== -1) {
8297
8299
  c2.el = c1.el;
8298
8300
  }
8299
8301
  if (c2.type === Comment && !c2.el) {
@@ -10630,7 +10632,7 @@ function isMemoSame(cached, memo) {
10630
10632
  return true;
10631
10633
  }
10632
10634
 
10633
- const version = "3.5.18";
10635
+ const version = "3.5.20";
10634
10636
  const warn = warn$1 ;
10635
10637
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10636
10638
  const devtools = devtools$1 ;
@@ -11030,6 +11032,8 @@ function patchClass(el, value, isSVG) {
11030
11032
  const vShowOriginalDisplay = Symbol("_vod");
11031
11033
  const vShowHidden = Symbol("_vsh");
11032
11034
  const vShow = {
11035
+ // used for prop mismatch check during hydration
11036
+ name: "show",
11033
11037
  beforeMount(el, { value }, { transition }) {
11034
11038
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
11035
11039
  if (transition && value) {
@@ -11063,9 +11067,6 @@ const vShow = {
11063
11067
  setDisplay(el, value);
11064
11068
  }
11065
11069
  };
11066
- {
11067
- vShow.name = "show";
11068
- }
11069
11070
  function setDisplay(el, value) {
11070
11071
  el.style.display = value ? el[vShowOriginalDisplay] : "none";
11071
11072
  el[vShowHidden] = !value;
@@ -11487,10 +11488,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
11487
11488
  VueCustomElement.def = Comp;
11488
11489
  return VueCustomElement;
11489
11490
  }
11490
- /*! #__NO_SIDE_EFFECTS__ */
11491
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11491
+
11492
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11492
11493
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
11493
- };
11494
+ });
11494
11495
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
11495
11496
  };
11496
11497
  class VueElement extends BaseClass {
@@ -12351,13 +12352,13 @@ const modifierGuards = {
12351
12352
  const withModifiers = (fn, modifiers) => {
12352
12353
  const cache = fn._withMods || (fn._withMods = {});
12353
12354
  const cacheKey = modifiers.join(".");
12354
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12355
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
12355
12356
  for (let i = 0; i < modifiers.length; i++) {
12356
12357
  const guard = modifierGuards[modifiers[i]];
12357
12358
  if (guard && guard(event, modifiers)) return;
12358
12359
  }
12359
12360
  return fn(event, ...args);
12360
- });
12361
+ }));
12361
12362
  };
12362
12363
  const keyNames = {
12363
12364
  esc: "escape",
@@ -12371,7 +12372,7 @@ const keyNames = {
12371
12372
  const withKeys = (fn, modifiers) => {
12372
12373
  const cache = fn._withKeys || (fn._withKeys = {});
12373
12374
  const cacheKey = modifiers.join(".");
12374
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
12375
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
12375
12376
  if (!("key" in event)) {
12376
12377
  return;
12377
12378
  }
@@ -12381,7 +12382,7 @@ const withKeys = (fn, modifiers) => {
12381
12382
  )) {
12382
12383
  return fn(event);
12383
12384
  }
12384
- });
12385
+ }));
12385
12386
  };
12386
12387
 
12387
12388
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -12395,13 +12396,13 @@ function ensureHydrationRenderer() {
12395
12396
  enabledHydration = true;
12396
12397
  return renderer;
12397
12398
  }
12398
- const render = (...args) => {
12399
+ const render = ((...args) => {
12399
12400
  ensureRenderer().render(...args);
12400
- };
12401
- const hydrate = (...args) => {
12401
+ });
12402
+ const hydrate = ((...args) => {
12402
12403
  ensureHydrationRenderer().hydrate(...args);
12403
- };
12404
- const createApp = (...args) => {
12404
+ });
12405
+ const createApp = ((...args) => {
12405
12406
  const app = ensureRenderer().createApp(...args);
12406
12407
  {
12407
12408
  injectNativeTagCheck(app);
@@ -12426,8 +12427,8 @@ const createApp = (...args) => {
12426
12427
  return proxy;
12427
12428
  };
12428
12429
  return app;
12429
- };
12430
- const createSSRApp = (...args) => {
12430
+ });
12431
+ const createSSRApp = ((...args) => {
12431
12432
  const app = ensureHydrationRenderer().createApp(...args);
12432
12433
  {
12433
12434
  injectNativeTagCheck(app);
@@ -12441,7 +12442,7 @@ const createSSRApp = (...args) => {
12441
12442
  }
12442
12443
  };
12443
12444
  return app;
12444
- };
12445
+ });
12445
12446
  function resolveRootNamespace(container) {
12446
12447
  if (container instanceof SVGElement) {
12447
12448
  return "svg";
@@ -14826,7 +14827,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14826
14827
  }
14827
14828
  }
14828
14829
  let cachedAsArray = false;
14829
- const slotCacheKeys = [];
14830
14830
  if (toCache.length === children.length && node.type === 1) {
14831
14831
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14832
14832
  node.codegenNode.children = getCacheExpression(
@@ -14836,7 +14836,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14836
14836
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
14837
14837
  const slot = getSlotNode(node.codegenNode, "default");
14838
14838
  if (slot) {
14839
- slotCacheKeys.push(context.cached.length);
14840
14839
  slot.returns = getCacheExpression(
14841
14840
  createArrayExpression(slot.returns)
14842
14841
  );
@@ -14846,7 +14845,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14846
14845
  const slotName = findDir(node, "slot", true);
14847
14846
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
14848
14847
  if (slot) {
14849
- slotCacheKeys.push(context.cached.length);
14850
14848
  slot.returns = getCacheExpression(
14851
14849
  createArrayExpression(slot.returns)
14852
14850
  );
@@ -14856,23 +14854,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14856
14854
  }
14857
14855
  if (!cachedAsArray) {
14858
14856
  for (const child of toCache) {
14859
- slotCacheKeys.push(context.cached.length);
14860
14857
  child.codegenNode = context.cache(child.codegenNode);
14861
14858
  }
14862
14859
  }
14863
- 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) {
14864
- node.codegenNode.children.properties.push(
14865
- createObjectProperty(
14866
- `__`,
14867
- createSimpleExpression(JSON.stringify(slotCacheKeys), false)
14868
- )
14869
- );
14870
- }
14871
14860
  function getCacheExpression(value) {
14872
14861
  const exp = context.cache(value);
14873
- if (inFor && context.hmr) {
14874
- exp.needArraySpread = true;
14875
- }
14862
+ exp.needArraySpread = true;
14876
14863
  return exp;
14877
14864
  }
14878
14865
  function getSlotNode(node2, name) {
@@ -16054,7 +16041,7 @@ function processIf(node, dir, context, processCodegen) {
16054
16041
  continue;
16055
16042
  }
16056
16043
  if (sibling && sibling.type === 9) {
16057
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16044
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16058
16045
  context.onError(
16059
16046
  createCompilerError(30, node.loc)
16060
16047
  );
@@ -17560,7 +17547,7 @@ const seen = /* @__PURE__ */ new WeakSet();
17560
17547
  const transformMemo = (node, context) => {
17561
17548
  if (node.type === 1) {
17562
17549
  const dir = findDir(node, "memo");
17563
- if (!dir || seen.has(node)) {
17550
+ if (!dir || seen.has(node) || context.inSSR) {
17564
17551
  return;
17565
17552
  }
17566
17553
  seen.add(node);