@vue/compat 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/compat v3.5.18
2
+ * @vue/compat 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
  }
@@ -4251,7 +4259,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4251
4259
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4252
4260
  const setupState = owner.setupState;
4253
4261
  const rawSetupState = toRaw(setupState);
4254
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4262
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
4255
4263
  {
4256
4264
  if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4257
4265
  warn$1(
@@ -4264,6 +4272,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4264
4272
  }
4265
4273
  return hasOwn(rawSetupState, key);
4266
4274
  };
4275
+ const canSetRef = (ref2) => {
4276
+ return !knownTemplateRefs.has(ref2);
4277
+ };
4267
4278
  if (oldRef != null && oldRef !== ref) {
4268
4279
  if (isString(oldRef)) {
4269
4280
  refs[oldRef] = null;
@@ -4271,7 +4282,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4271
4282
  setupState[oldRef] = null;
4272
4283
  }
4273
4284
  } else if (isRef(oldRef)) {
4274
- oldRef.value = null;
4285
+ if (canSetRef(oldRef)) {
4286
+ oldRef.value = null;
4287
+ }
4288
+ const oldRawRefAtom = oldRawRef;
4289
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4275
4290
  }
4276
4291
  }
4277
4292
  if (isFunction(ref)) {
@@ -4282,7 +4297,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4282
4297
  if (_isString || _isRef) {
4283
4298
  const doSet = () => {
4284
4299
  if (rawRef.f) {
4285
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4300
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4286
4301
  if (isUnmount) {
4287
4302
  isArray(existing) && remove(existing, refValue);
4288
4303
  } else {
@@ -4293,8 +4308,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4293
4308
  setupState[ref] = refs[ref];
4294
4309
  }
4295
4310
  } else {
4296
- ref.value = [refValue];
4297
- if (rawRef.k) refs[rawRef.k] = ref.value;
4311
+ const newVal = [refValue];
4312
+ if (canSetRef(ref)) {
4313
+ ref.value = newVal;
4314
+ }
4315
+ if (rawRef.k) refs[rawRef.k] = newVal;
4298
4316
  }
4299
4317
  } else if (!existing.includes(refValue)) {
4300
4318
  existing.push(refValue);
@@ -4306,7 +4324,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4306
4324
  setupState[ref] = value;
4307
4325
  }
4308
4326
  } else if (_isRef) {
4309
- ref.value = value;
4327
+ if (canSetRef(ref)) {
4328
+ ref.value = value;
4329
+ }
4310
4330
  if (rawRef.k) refs[rawRef.k] = value;
4311
4331
  } else {
4312
4332
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -6066,7 +6086,7 @@ function legacyRenderSlot(instance, name, fallback, props, bindObject) {
6066
6086
  }
6067
6087
  return renderSlot(instance.slots, name, props, fallback && (() => fallback));
6068
6088
  }
6069
- function legacyresolveScopedSlots(fns, raw, hasDynamicKeys) {
6089
+ function legacyResolveScopedSlots(fns, raw, hasDynamicKeys) {
6070
6090
  return createSlots(
6071
6091
  raw || { $stable: !hasDynamicKeys },
6072
6092
  mapKeyToName(fns)
@@ -6233,7 +6253,7 @@ function installCompatInstanceProperties(map) {
6233
6253
  _b: () => legacyBindObjectProps,
6234
6254
  _v: () => createTextVNode,
6235
6255
  _e: () => createCommentVNode,
6236
- _u: () => legacyresolveScopedSlots,
6256
+ _u: () => legacyResolveScopedSlots,
6237
6257
  _g: () => legacyBindObjectListeners,
6238
6258
  _d: () => legacyBindDynamicKeys,
6239
6259
  _p: () => legacyPrependModifier
@@ -6404,10 +6424,10 @@ const PublicInstanceProxyHandlers = {
6404
6424
  return true;
6405
6425
  },
6406
6426
  has({
6407
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
6427
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6408
6428
  }, key) {
6409
- let normalizedProps;
6410
- 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);
6429
+ let normalizedProps, cssModules;
6430
+ 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]);
6411
6431
  },
6412
6432
  defineProperty(target, key, descriptor) {
6413
6433
  if (descriptor.get != null) {
@@ -7152,7 +7172,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7152
7172
  return vm;
7153
7173
  }
7154
7174
  }
7155
- Vue.version = `2.6.14-compat:${"3.5.18"}`;
7175
+ Vue.version = `2.6.14-compat:${"3.5.20"}`;
7156
7176
  Vue.config = singletonApp.config;
7157
7177
  Vue.use = (plugin, ...options) => {
7158
7178
  if (plugin && isFunction(plugin.install)) {
@@ -7166,22 +7186,22 @@ function createCompatVue$1(createApp, createSingletonApp) {
7166
7186
  singletonApp.mixin(m);
7167
7187
  return Vue;
7168
7188
  };
7169
- Vue.component = (name, comp) => {
7189
+ Vue.component = ((name, comp) => {
7170
7190
  if (comp) {
7171
7191
  singletonApp.component(name, comp);
7172
7192
  return Vue;
7173
7193
  } else {
7174
7194
  return singletonApp.component(name);
7175
7195
  }
7176
- };
7177
- Vue.directive = (name, dir) => {
7196
+ });
7197
+ Vue.directive = ((name, dir) => {
7178
7198
  if (dir) {
7179
7199
  singletonApp.directive(name, dir);
7180
7200
  return Vue;
7181
7201
  } else {
7182
7202
  return singletonApp.directive(name);
7183
7203
  }
7184
- };
7204
+ });
7185
7205
  Vue.options = { _base: Vue };
7186
7206
  let cid = 1;
7187
7207
  Vue.cid = cid;
@@ -7244,14 +7264,14 @@ function createCompatVue$1(createApp, createSingletonApp) {
7244
7264
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
7245
7265
  return reactive(target);
7246
7266
  };
7247
- Vue.filter = (name, filter) => {
7267
+ Vue.filter = ((name, filter) => {
7248
7268
  if (filter) {
7249
7269
  singletonApp.filter(name, filter);
7250
7270
  return Vue;
7251
7271
  } else {
7252
7272
  return singletonApp.filter(name);
7253
7273
  }
7254
- };
7274
+ });
7255
7275
  const util = {
7256
7276
  warn: warn$1 ,
7257
7277
  extend,
@@ -8245,7 +8265,7 @@ function isBoolean(...args) {
8245
8265
  return args.some((elem) => elem.toLowerCase() === "boolean");
8246
8266
  }
8247
8267
 
8248
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8268
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
8249
8269
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8250
8270
  const normalizeSlot = (key, rawSlot, ctx) => {
8251
8271
  if (rawSlot._n) {
@@ -8299,8 +8319,6 @@ const assignSlots = (slots, children, optimized) => {
8299
8319
  const initSlots = (instance, children, optimized) => {
8300
8320
  const slots = instance.slots = createInternalObject();
8301
8321
  if (instance.vnode.shapeFlag & 32) {
8302
- const cacheIndexes = children.__;
8303
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8304
8322
  const type = children._;
8305
8323
  if (type) {
8306
8324
  assignSlots(slots, children, optimized);
@@ -8361,12 +8379,10 @@ function endMeasure(instance, type) {
8361
8379
  if (instance.appContext.config.performance && isSupported()) {
8362
8380
  const startTag = `vue-${type}-${instance.uid}`;
8363
8381
  const endTag = startTag + `:end`;
8382
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
8364
8383
  perf.mark(endTag);
8365
- perf.measure(
8366
- `<${formatComponentName(instance, instance.type)}> ${type}`,
8367
- startTag,
8368
- endTag
8369
- );
8384
+ perf.measure(measureName, startTag, endTag);
8385
+ perf.clearMeasures(measureName);
8370
8386
  perf.clearMarks(startTag);
8371
8387
  perf.clearMarks(endTag);
8372
8388
  }
@@ -9583,6 +9599,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9583
9599
  }
9584
9600
  };
9585
9601
  const performLeave = () => {
9602
+ if (el._isLeaving) {
9603
+ el[leaveCbKey](
9604
+ true
9605
+ /* cancelled */
9606
+ );
9607
+ }
9586
9608
  leave(el, () => {
9587
9609
  remove2();
9588
9610
  afterLeave && afterLeave();
@@ -9728,27 +9750,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9728
9750
  if (instance.type.__hmrId) {
9729
9751
  unregisterHMR(instance);
9730
9752
  }
9731
- const {
9732
- bum,
9733
- scope,
9734
- job,
9735
- subTree,
9736
- um,
9737
- m,
9738
- a,
9739
- parent,
9740
- slots: { __: slotCacheKeys }
9741
- } = instance;
9753
+ const { bum, scope, job, subTree, um, m, a } = instance;
9742
9754
  invalidateMount(m);
9743
9755
  invalidateMount(a);
9744
9756
  if (bum) {
9745
9757
  invokeArrayFns(bum);
9746
9758
  }
9747
- if (parent && isArray(slotCacheKeys)) {
9748
- slotCacheKeys.forEach((v) => {
9749
- parent.renderCache[v] = void 0;
9750
- });
9751
- }
9752
9759
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
9753
9760
  instance.emit("hook:beforeDestroy");
9754
9761
  }
@@ -9769,12 +9776,6 @@ function baseCreateRenderer(options, createHydrationFns) {
9769
9776
  queuePostRenderEffect(() => {
9770
9777
  instance.isUnmounted = true;
9771
9778
  }, parentSuspense);
9772
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
9773
- parentSuspense.deps--;
9774
- if (parentSuspense.deps === 0) {
9775
- parentSuspense.resolve();
9776
- }
9777
- }
9778
9779
  {
9779
9780
  devtoolsComponentRemoved(instance);
9780
9781
  }
@@ -9875,7 +9876,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
9875
9876
  if (!shallow && c2.patchFlag !== -2)
9876
9877
  traverseStaticChildren(c1, c2);
9877
9878
  }
9878
- if (c2.type === Text) {
9879
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
9880
+ c2.patchFlag !== -1) {
9879
9881
  c2.el = c1.el;
9880
9882
  }
9881
9883
  if (c2.type === Comment && !c2.el) {
@@ -12320,7 +12322,7 @@ function isMemoSame(cached, memo) {
12320
12322
  return true;
12321
12323
  }
12322
12324
 
12323
- const version = "3.5.18";
12325
+ const version = "3.5.20";
12324
12326
  const warn = warn$1 ;
12325
12327
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12326
12328
  const devtools = devtools$1 ;
@@ -12764,6 +12766,8 @@ function patchClass(el, value, isSVG) {
12764
12766
  const vShowOriginalDisplay = Symbol("_vod");
12765
12767
  const vShowHidden = Symbol("_vsh");
12766
12768
  const vShow = {
12769
+ // used for prop mismatch check during hydration
12770
+ name: "show",
12767
12771
  beforeMount(el, { value }, { transition }) {
12768
12772
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
12769
12773
  if (transition && value) {
@@ -12797,9 +12801,6 @@ const vShow = {
12797
12801
  setDisplay(el, value);
12798
12802
  }
12799
12803
  };
12800
- {
12801
- vShow.name = "show";
12802
- }
12803
12804
  function setDisplay(el, value) {
12804
12805
  el.style.display = value ? el[vShowOriginalDisplay] : "none";
12805
12806
  el[vShowHidden] = !value;
@@ -13265,10 +13266,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
13265
13266
  VueCustomElement.def = Comp;
13266
13267
  return VueCustomElement;
13267
13268
  }
13268
- /*! #__NO_SIDE_EFFECTS__ */
13269
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13269
+
13270
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13270
13271
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13271
- };
13272
+ });
13272
13273
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13273
13274
  };
13274
13275
  class VueElement extends BaseClass {
@@ -14138,13 +14139,13 @@ const modifierGuards = {
14138
14139
  const withModifiers = (fn, modifiers) => {
14139
14140
  const cache = fn._withMods || (fn._withMods = {});
14140
14141
  const cacheKey = modifiers.join(".");
14141
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14142
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14142
14143
  for (let i = 0; i < modifiers.length; i++) {
14143
14144
  const guard = modifierGuards[modifiers[i]];
14144
14145
  if (guard && guard(event, modifiers)) return;
14145
14146
  }
14146
14147
  return fn(event, ...args);
14147
- });
14148
+ }));
14148
14149
  };
14149
14150
  const keyNames = {
14150
14151
  esc: "escape",
@@ -14174,7 +14175,7 @@ const withKeys = (fn, modifiers) => {
14174
14175
  }
14175
14176
  const cache = fn._withKeys || (fn._withKeys = {});
14176
14177
  const cacheKey = modifiers.join(".");
14177
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
14178
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14178
14179
  if (!("key" in event)) {
14179
14180
  return;
14180
14181
  }
@@ -14204,7 +14205,7 @@ const withKeys = (fn, modifiers) => {
14204
14205
  }
14205
14206
  }
14206
14207
  }
14207
- });
14208
+ }));
14208
14209
  };
14209
14210
 
14210
14211
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14218,13 +14219,13 @@ function ensureHydrationRenderer() {
14218
14219
  enabledHydration = true;
14219
14220
  return renderer;
14220
14221
  }
14221
- const render = (...args) => {
14222
+ const render = ((...args) => {
14222
14223
  ensureRenderer().render(...args);
14223
- };
14224
- const hydrate = (...args) => {
14224
+ });
14225
+ const hydrate = ((...args) => {
14225
14226
  ensureHydrationRenderer().hydrate(...args);
14226
- };
14227
- const createApp = (...args) => {
14227
+ });
14228
+ const createApp = ((...args) => {
14228
14229
  const app = ensureRenderer().createApp(...args);
14229
14230
  {
14230
14231
  injectNativeTagCheck(app);
@@ -14261,8 +14262,8 @@ const createApp = (...args) => {
14261
14262
  return proxy;
14262
14263
  };
14263
14264
  return app;
14264
- };
14265
- const createSSRApp = (...args) => {
14265
+ });
14266
+ const createSSRApp = ((...args) => {
14266
14267
  const app = ensureHydrationRenderer().createApp(...args);
14267
14268
  {
14268
14269
  injectNativeTagCheck(app);
@@ -14276,7 +14277,7 @@ const createSSRApp = (...args) => {
14276
14277
  }
14277
14278
  };
14278
14279
  return app;
14279
- };
14280
+ });
14280
14281
  function resolveRootNamespace(container) {
14281
14282
  if (container instanceof SVGElement) {
14282
14283
  return "svg";
@@ -14551,13 +14552,13 @@ function createCompatVue() {
14551
14552
  }
14552
14553
 
14553
14554
  const Vue = createCompatVue();
14554
- Vue.compile = () => {
14555
+ Vue.compile = (() => {
14555
14556
  {
14556
14557
  warn(
14557
14558
  `Runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
14558
14559
  );
14559
14560
  }
14560
- };
14561
+ });
14561
14562
 
14562
14563
  const configureCompat = Vue.configureCompat;
14563
14564