vue 3.5.18 → 3.5.19

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.19
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.19
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.19
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(
@@ -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;
@@ -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.19";
10634
10636
  const warn = warn$1 ;
10635
10637
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
10636
10638
  const devtools = devtools$1 ;
@@ -11487,10 +11489,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
11487
11489
  VueCustomElement.def = Comp;
11488
11490
  return VueCustomElement;
11489
11491
  }
11490
- /*! #__NO_SIDE_EFFECTS__ */
11491
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11492
+
11493
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
11492
11494
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
11493
- };
11495
+ });
11494
11496
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
11495
11497
  };
11496
11498
  class VueElement extends BaseClass {
@@ -12351,13 +12353,13 @@ const modifierGuards = {
12351
12353
  const withModifiers = (fn, modifiers) => {
12352
12354
  const cache = fn._withMods || (fn._withMods = {});
12353
12355
  const cacheKey = modifiers.join(".");
12354
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
12356
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
12355
12357
  for (let i = 0; i < modifiers.length; i++) {
12356
12358
  const guard = modifierGuards[modifiers[i]];
12357
12359
  if (guard && guard(event, modifiers)) return;
12358
12360
  }
12359
12361
  return fn(event, ...args);
12360
- });
12362
+ }));
12361
12363
  };
12362
12364
  const keyNames = {
12363
12365
  esc: "escape",
@@ -12371,7 +12373,7 @@ const keyNames = {
12371
12373
  const withKeys = (fn, modifiers) => {
12372
12374
  const cache = fn._withKeys || (fn._withKeys = {});
12373
12375
  const cacheKey = modifiers.join(".");
12374
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
12376
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
12375
12377
  if (!("key" in event)) {
12376
12378
  return;
12377
12379
  }
@@ -12381,7 +12383,7 @@ const withKeys = (fn, modifiers) => {
12381
12383
  )) {
12382
12384
  return fn(event);
12383
12385
  }
12384
- });
12386
+ }));
12385
12387
  };
12386
12388
 
12387
12389
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -12395,13 +12397,13 @@ function ensureHydrationRenderer() {
12395
12397
  enabledHydration = true;
12396
12398
  return renderer;
12397
12399
  }
12398
- const render = (...args) => {
12400
+ const render = ((...args) => {
12399
12401
  ensureRenderer().render(...args);
12400
- };
12401
- const hydrate = (...args) => {
12402
+ });
12403
+ const hydrate = ((...args) => {
12402
12404
  ensureHydrationRenderer().hydrate(...args);
12403
- };
12404
- const createApp = (...args) => {
12405
+ });
12406
+ const createApp = ((...args) => {
12405
12407
  const app = ensureRenderer().createApp(...args);
12406
12408
  {
12407
12409
  injectNativeTagCheck(app);
@@ -12426,8 +12428,8 @@ const createApp = (...args) => {
12426
12428
  return proxy;
12427
12429
  };
12428
12430
  return app;
12429
- };
12430
- const createSSRApp = (...args) => {
12431
+ });
12432
+ const createSSRApp = ((...args) => {
12431
12433
  const app = ensureHydrationRenderer().createApp(...args);
12432
12434
  {
12433
12435
  injectNativeTagCheck(app);
@@ -12441,7 +12443,7 @@ const createSSRApp = (...args) => {
12441
12443
  }
12442
12444
  };
12443
12445
  return app;
12444
- };
12446
+ });
12445
12447
  function resolveRootNamespace(container) {
12446
12448
  if (container instanceof SVGElement) {
12447
12449
  return "svg";
@@ -14826,7 +14828,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14826
14828
  }
14827
14829
  }
14828
14830
  let cachedAsArray = false;
14829
- const slotCacheKeys = [];
14830
14831
  if (toCache.length === children.length && node.type === 1) {
14831
14832
  if (node.tagType === 0 && node.codegenNode && node.codegenNode.type === 13 && isArray(node.codegenNode.children)) {
14832
14833
  node.codegenNode.children = getCacheExpression(
@@ -14836,7 +14837,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14836
14837
  } else if (node.tagType === 1 && node.codegenNode && node.codegenNode.type === 13 && node.codegenNode.children && !isArray(node.codegenNode.children) && node.codegenNode.children.type === 15) {
14837
14838
  const slot = getSlotNode(node.codegenNode, "default");
14838
14839
  if (slot) {
14839
- slotCacheKeys.push(context.cached.length);
14840
14840
  slot.returns = getCacheExpression(
14841
14841
  createArrayExpression(slot.returns)
14842
14842
  );
@@ -14846,7 +14846,6 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14846
14846
  const slotName = findDir(node, "slot", true);
14847
14847
  const slot = slotName && slotName.arg && getSlotNode(parent.codegenNode, slotName.arg);
14848
14848
  if (slot) {
14849
- slotCacheKeys.push(context.cached.length);
14850
14849
  slot.returns = getCacheExpression(
14851
14850
  createArrayExpression(slot.returns)
14852
14851
  );
@@ -14856,23 +14855,12 @@ function walk(node, parent, context, doNotHoistNode = false, inFor = false) {
14856
14855
  }
14857
14856
  if (!cachedAsArray) {
14858
14857
  for (const child of toCache) {
14859
- slotCacheKeys.push(context.cached.length);
14860
14858
  child.codegenNode = context.cache(child.codegenNode);
14861
14859
  }
14862
14860
  }
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
14861
  function getCacheExpression(value) {
14872
14862
  const exp = context.cache(value);
14873
- if (inFor && context.hmr) {
14874
- exp.needArraySpread = true;
14875
- }
14863
+ exp.needArraySpread = true;
14876
14864
  return exp;
14877
14865
  }
14878
14866
  function getSlotNode(node2, name) {
@@ -16054,7 +16042,7 @@ function processIf(node, dir, context, processCodegen) {
16054
16042
  continue;
16055
16043
  }
16056
16044
  if (sibling && sibling.type === 9) {
16057
- if (dir.name === "else-if" && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16045
+ if ((dir.name === "else-if" || dir.name === "else") && sibling.branches[sibling.branches.length - 1].condition === void 0) {
16058
16046
  context.onError(
16059
16047
  createCompilerError(30, node.loc)
16060
16048
  );
@@ -17560,7 +17548,7 @@ const seen = /* @__PURE__ */ new WeakSet();
17560
17548
  const transformMemo = (node, context) => {
17561
17549
  if (node.type === 1) {
17562
17550
  const dir = findDir(node, "memo");
17563
- if (!dir || seen.has(node)) {
17551
+ if (!dir || seen.has(node) || context.inSSR) {
17564
17552
  return;
17565
17553
  }
17566
17554
  seen.add(node);