@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(
@@ -1095,7 +1095,7 @@ const arrayInstrumentations = {
1095
1095
  join(separator) {
1096
1096
  return reactiveReadArray(this).join(separator);
1097
1097
  },
1098
- // keys() iterator only reads `length`, no optimisation required
1098
+ // keys() iterator only reads `length`, no optimization required
1099
1099
  lastIndexOf(...args) {
1100
1100
  return searchProxy(this, "lastIndexOf", args);
1101
1101
  },
@@ -1296,7 +1296,13 @@ class MutableReactiveHandler extends BaseReactiveHandler {
1296
1296
  }
1297
1297
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
1298
1298
  if (isOldValueReadonly) {
1299
- return false;
1299
+ if (!!(process.env.NODE_ENV !== "production")) {
1300
+ warn$2(
1301
+ `Set operation on key "${String(key)}" failed: target is readonly.`,
1302
+ target[key]
1303
+ );
1304
+ }
1305
+ return true;
1300
1306
  } else {
1301
1307
  oldValue.value = value;
1302
1308
  return true;
@@ -1441,7 +1447,7 @@ function createInstrumentations(readonly, shallow) {
1441
1447
  get size() {
1442
1448
  const target = this["__v_raw"];
1443
1449
  !readonly && track(toRaw(target), "iterate", ITERATE_KEY);
1444
- return Reflect.get(target, "size", target);
1450
+ return target.size;
1445
1451
  },
1446
1452
  has(key) {
1447
1453
  const target = this["__v_raw"];
@@ -2674,7 +2680,9 @@ function rerender(id, newRender) {
2674
2680
  }
2675
2681
  instance.renderCache = [];
2676
2682
  isHmrUpdating = true;
2677
- instance.update();
2683
+ if (!(instance.job.flags & 8)) {
2684
+ instance.update();
2685
+ }
2678
2686
  isHmrUpdating = false;
2679
2687
  });
2680
2688
  }
@@ -4270,7 +4278,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4270
4278
  const refs = owner.refs === EMPTY_OBJ ? owner.refs = {} : owner.refs;
4271
4279
  const setupState = owner.setupState;
4272
4280
  const rawSetupState = toRaw(setupState);
4273
- const canSetSetupRef = setupState === EMPTY_OBJ ? () => false : (key) => {
4281
+ const canSetSetupRef = setupState === EMPTY_OBJ ? NO : (key) => {
4274
4282
  if (!!(process.env.NODE_ENV !== "production")) {
4275
4283
  if (hasOwn(rawSetupState, key) && !isRef(rawSetupState[key])) {
4276
4284
  warn$1(
@@ -4283,6 +4291,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4283
4291
  }
4284
4292
  return hasOwn(rawSetupState, key);
4285
4293
  };
4294
+ const canSetRef = (ref2) => {
4295
+ return !!!(process.env.NODE_ENV !== "production") || !knownTemplateRefs.has(ref2);
4296
+ };
4286
4297
  if (oldRef != null && oldRef !== ref) {
4287
4298
  if (isString(oldRef)) {
4288
4299
  refs[oldRef] = null;
@@ -4290,7 +4301,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4290
4301
  setupState[oldRef] = null;
4291
4302
  }
4292
4303
  } else if (isRef(oldRef)) {
4293
- oldRef.value = null;
4304
+ if (canSetRef(oldRef)) {
4305
+ oldRef.value = null;
4306
+ }
4307
+ const oldRawRefAtom = oldRawRef;
4308
+ if (oldRawRefAtom.k) refs[oldRawRefAtom.k] = null;
4294
4309
  }
4295
4310
  }
4296
4311
  if (isFunction(ref)) {
@@ -4301,7 +4316,7 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4301
4316
  if (_isString || _isRef) {
4302
4317
  const doSet = () => {
4303
4318
  if (rawRef.f) {
4304
- const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : ref.value;
4319
+ const existing = _isString ? canSetSetupRef(ref) ? setupState[ref] : refs[ref] : canSetRef(ref) || !rawRef.k ? ref.value : refs[rawRef.k];
4305
4320
  if (isUnmount) {
4306
4321
  isArray(existing) && remove(existing, refValue);
4307
4322
  } else {
@@ -4312,8 +4327,11 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4312
4327
  setupState[ref] = refs[ref];
4313
4328
  }
4314
4329
  } else {
4315
- ref.value = [refValue];
4316
- if (rawRef.k) refs[rawRef.k] = ref.value;
4330
+ const newVal = [refValue];
4331
+ if (canSetRef(ref)) {
4332
+ ref.value = newVal;
4333
+ }
4334
+ if (rawRef.k) refs[rawRef.k] = newVal;
4317
4335
  }
4318
4336
  } else if (!existing.includes(refValue)) {
4319
4337
  existing.push(refValue);
@@ -4325,7 +4343,9 @@ function setRef(rawRef, oldRawRef, parentSuspense, vnode, isUnmount = false) {
4325
4343
  setupState[ref] = value;
4326
4344
  }
4327
4345
  } else if (_isRef) {
4328
- ref.value = value;
4346
+ if (canSetRef(ref)) {
4347
+ ref.value = value;
4348
+ }
4329
4349
  if (rawRef.k) refs[rawRef.k] = value;
4330
4350
  } else if (!!(process.env.NODE_ENV !== "production")) {
4331
4351
  warn$1("Invalid template ref type:", ref, `(${typeof ref})`);
@@ -6096,7 +6116,7 @@ function legacyRenderSlot(instance, name, fallback, props, bindObject) {
6096
6116
  }
6097
6117
  return renderSlot(instance.slots, name, props, fallback && (() => fallback));
6098
6118
  }
6099
- function legacyresolveScopedSlots(fns, raw, hasDynamicKeys) {
6119
+ function legacyResolveScopedSlots(fns, raw, hasDynamicKeys) {
6100
6120
  return createSlots(
6101
6121
  raw || { $stable: !hasDynamicKeys },
6102
6122
  mapKeyToName(fns)
@@ -6263,7 +6283,7 @@ function installCompatInstanceProperties(map) {
6263
6283
  _b: () => legacyBindObjectProps,
6264
6284
  _v: () => createTextVNode,
6265
6285
  _e: () => createCommentVNode,
6266
- _u: () => legacyresolveScopedSlots,
6286
+ _u: () => legacyResolveScopedSlots,
6267
6287
  _g: () => legacyBindObjectListeners,
6268
6288
  _d: () => legacyBindDynamicKeys,
6269
6289
  _p: () => legacyPrependModifier
@@ -6434,10 +6454,10 @@ const PublicInstanceProxyHandlers = {
6434
6454
  return true;
6435
6455
  },
6436
6456
  has({
6437
- _: { data, setupState, accessCache, ctx, appContext, propsOptions }
6457
+ _: { data, setupState, accessCache, ctx, appContext, propsOptions, type }
6438
6458
  }, key) {
6439
- let normalizedProps;
6440
- 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);
6459
+ let normalizedProps, cssModules;
6460
+ 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]);
6441
6461
  },
6442
6462
  defineProperty(target, key, descriptor) {
6443
6463
  if (descriptor.get != null) {
@@ -7184,7 +7204,7 @@ function createCompatVue$1(createApp, createSingletonApp) {
7184
7204
  return vm;
7185
7205
  }
7186
7206
  }
7187
- Vue.version = `2.6.14-compat:${"3.5.18"}`;
7207
+ Vue.version = `2.6.14-compat:${"3.5.20"}`;
7188
7208
  Vue.config = singletonApp.config;
7189
7209
  Vue.use = (plugin, ...options) => {
7190
7210
  if (plugin && isFunction(plugin.install)) {
@@ -7198,22 +7218,22 @@ function createCompatVue$1(createApp, createSingletonApp) {
7198
7218
  singletonApp.mixin(m);
7199
7219
  return Vue;
7200
7220
  };
7201
- Vue.component = (name, comp) => {
7221
+ Vue.component = ((name, comp) => {
7202
7222
  if (comp) {
7203
7223
  singletonApp.component(name, comp);
7204
7224
  return Vue;
7205
7225
  } else {
7206
7226
  return singletonApp.component(name);
7207
7227
  }
7208
- };
7209
- Vue.directive = (name, dir) => {
7228
+ });
7229
+ Vue.directive = ((name, dir) => {
7210
7230
  if (dir) {
7211
7231
  singletonApp.directive(name, dir);
7212
7232
  return Vue;
7213
7233
  } else {
7214
7234
  return singletonApp.directive(name);
7215
7235
  }
7216
- };
7236
+ });
7217
7237
  Vue.options = { _base: Vue };
7218
7238
  let cid = 1;
7219
7239
  Vue.cid = cid;
@@ -7276,14 +7296,14 @@ function createCompatVue$1(createApp, createSingletonApp) {
7276
7296
  assertCompatEnabled("GLOBAL_OBSERVABLE", null);
7277
7297
  return reactive(target);
7278
7298
  };
7279
- Vue.filter = (name, filter) => {
7299
+ Vue.filter = ((name, filter) => {
7280
7300
  if (filter) {
7281
7301
  singletonApp.filter(name, filter);
7282
7302
  return Vue;
7283
7303
  } else {
7284
7304
  return singletonApp.filter(name);
7285
7305
  }
7286
- };
7306
+ });
7287
7307
  const util = {
7288
7308
  warn: !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP,
7289
7309
  extend,
@@ -8279,7 +8299,7 @@ function isBoolean(...args) {
8279
8299
  return args.some((elem) => elem.toLowerCase() === "boolean");
8280
8300
  }
8281
8301
 
8282
- const isInternalKey = (key) => key === "_" || key === "__" || key === "_ctx" || key === "$stable";
8302
+ const isInternalKey = (key) => key === "_" || key === "_ctx" || key === "$stable";
8283
8303
  const normalizeSlotValue = (value) => isArray(value) ? value.map(normalizeVNode) : [normalizeVNode(value)];
8284
8304
  const normalizeSlot = (key, rawSlot, ctx) => {
8285
8305
  if (rawSlot._n) {
@@ -8333,8 +8353,6 @@ const assignSlots = (slots, children, optimized) => {
8333
8353
  const initSlots = (instance, children, optimized) => {
8334
8354
  const slots = instance.slots = createInternalObject();
8335
8355
  if (instance.vnode.shapeFlag & 32) {
8336
- const cacheIndexes = children.__;
8337
- if (cacheIndexes) def(slots, "__", cacheIndexes, true);
8338
8356
  const type = children._;
8339
8357
  if (type) {
8340
8358
  assignSlots(slots, children, optimized);
@@ -8395,12 +8413,10 @@ function endMeasure(instance, type) {
8395
8413
  if (instance.appContext.config.performance && isSupported()) {
8396
8414
  const startTag = `vue-${type}-${instance.uid}`;
8397
8415
  const endTag = startTag + `:end`;
8416
+ const measureName = `<${formatComponentName(instance, instance.type)}> ${type}`;
8398
8417
  perf.mark(endTag);
8399
- perf.measure(
8400
- `<${formatComponentName(instance, instance.type)}> ${type}`,
8401
- startTag,
8402
- endTag
8403
- );
8418
+ perf.measure(measureName, startTag, endTag);
8419
+ perf.clearMeasures(measureName);
8404
8420
  perf.clearMarks(startTag);
8405
8421
  perf.clearMarks(endTag);
8406
8422
  }
@@ -9655,6 +9671,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9655
9671
  }
9656
9672
  };
9657
9673
  const performLeave = () => {
9674
+ if (el._isLeaving) {
9675
+ el[leaveCbKey](
9676
+ true
9677
+ /* cancelled */
9678
+ );
9679
+ }
9658
9680
  leave(el, () => {
9659
9681
  remove2();
9660
9682
  afterLeave && afterLeave();
@@ -9800,27 +9822,12 @@ function baseCreateRenderer(options, createHydrationFns) {
9800
9822
  if (!!(process.env.NODE_ENV !== "production") && instance.type.__hmrId) {
9801
9823
  unregisterHMR(instance);
9802
9824
  }
9803
- const {
9804
- bum,
9805
- scope,
9806
- job,
9807
- subTree,
9808
- um,
9809
- m,
9810
- a,
9811
- parent,
9812
- slots: { __: slotCacheKeys }
9813
- } = instance;
9825
+ const { bum, scope, job, subTree, um, m, a } = instance;
9814
9826
  invalidateMount(m);
9815
9827
  invalidateMount(a);
9816
9828
  if (bum) {
9817
9829
  invokeArrayFns(bum);
9818
9830
  }
9819
- if (parent && isArray(slotCacheKeys)) {
9820
- slotCacheKeys.forEach((v) => {
9821
- parent.renderCache[v] = void 0;
9822
- });
9823
- }
9824
9831
  if (isCompatEnabled("INSTANCE_EVENT_HOOKS", instance)) {
9825
9832
  instance.emit("hook:beforeDestroy");
9826
9833
  }
@@ -9841,12 +9848,6 @@ function baseCreateRenderer(options, createHydrationFns) {
9841
9848
  queuePostRenderEffect(() => {
9842
9849
  instance.isUnmounted = true;
9843
9850
  }, parentSuspense);
9844
- if (parentSuspense && parentSuspense.pendingBranch && !parentSuspense.isUnmounted && instance.asyncDep && !instance.asyncResolved && instance.suspenseId === parentSuspense.pendingId) {
9845
- parentSuspense.deps--;
9846
- if (parentSuspense.deps === 0) {
9847
- parentSuspense.resolve();
9848
- }
9849
- }
9850
9851
  if (!!(process.env.NODE_ENV !== "production") || __VUE_PROD_DEVTOOLS__) {
9851
9852
  devtoolsComponentRemoved(instance);
9852
9853
  }
@@ -9947,7 +9948,8 @@ function traverseStaticChildren(n1, n2, shallow = false) {
9947
9948
  if (!shallow && c2.patchFlag !== -2)
9948
9949
  traverseStaticChildren(c1, c2);
9949
9950
  }
9950
- if (c2.type === Text) {
9951
+ if (c2.type === Text && // avoid cached text nodes retaining detached dom nodes
9952
+ c2.patchFlag !== -1) {
9951
9953
  c2.el = c1.el;
9952
9954
  }
9953
9955
  if (c2.type === Comment && !c2.el) {
@@ -12406,7 +12408,7 @@ function isMemoSame(cached, memo) {
12406
12408
  return true;
12407
12409
  }
12408
12410
 
12409
- const version = "3.5.18";
12411
+ const version = "3.5.20";
12410
12412
  const warn = !!(process.env.NODE_ENV !== "production") ? warn$1 : NOOP;
12411
12413
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12412
12414
  const devtools = !!(process.env.NODE_ENV !== "production") || true ? devtools$1 : void 0;
@@ -12850,6 +12852,8 @@ function patchClass(el, value, isSVG) {
12850
12852
  const vShowOriginalDisplay = Symbol("_vod");
12851
12853
  const vShowHidden = Symbol("_vsh");
12852
12854
  const vShow = {
12855
+ // used for prop mismatch check during hydration
12856
+ name: "show",
12853
12857
  beforeMount(el, { value }, { transition }) {
12854
12858
  el[vShowOriginalDisplay] = el.style.display === "none" ? "" : el.style.display;
12855
12859
  if (transition && value) {
@@ -12883,9 +12887,6 @@ const vShow = {
12883
12887
  setDisplay(el, value);
12884
12888
  }
12885
12889
  };
12886
- if (!!(process.env.NODE_ENV !== "production")) {
12887
- vShow.name = "show";
12888
- }
12889
12890
  function setDisplay(el, value) {
12890
12891
  el.style.display = value ? el[vShowOriginalDisplay] : "none";
12891
12892
  el[vShowHidden] = !value;
@@ -13351,10 +13352,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
13351
13352
  VueCustomElement.def = Comp;
13352
13353
  return VueCustomElement;
13353
13354
  }
13354
- /*! #__NO_SIDE_EFFECTS__ */
13355
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13355
+
13356
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13356
13357
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13357
- };
13358
+ });
13358
13359
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13359
13360
  };
13360
13361
  class VueElement extends BaseClass {
@@ -14224,13 +14225,13 @@ const modifierGuards = {
14224
14225
  const withModifiers = (fn, modifiers) => {
14225
14226
  const cache = fn._withMods || (fn._withMods = {});
14226
14227
  const cacheKey = modifiers.join(".");
14227
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14228
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14228
14229
  for (let i = 0; i < modifiers.length; i++) {
14229
14230
  const guard = modifierGuards[modifiers[i]];
14230
14231
  if (guard && guard(event, modifiers)) return;
14231
14232
  }
14232
14233
  return fn(event, ...args);
14233
- });
14234
+ }));
14234
14235
  };
14235
14236
  const keyNames = {
14236
14237
  esc: "escape",
@@ -14260,7 +14261,7 @@ const withKeys = (fn, modifiers) => {
14260
14261
  }
14261
14262
  const cache = fn._withKeys || (fn._withKeys = {});
14262
14263
  const cacheKey = modifiers.join(".");
14263
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
14264
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14264
14265
  if (!("key" in event)) {
14265
14266
  return;
14266
14267
  }
@@ -14290,7 +14291,7 @@ const withKeys = (fn, modifiers) => {
14290
14291
  }
14291
14292
  }
14292
14293
  }
14293
- });
14294
+ }));
14294
14295
  };
14295
14296
 
14296
14297
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14304,13 +14305,13 @@ function ensureHydrationRenderer() {
14304
14305
  enabledHydration = true;
14305
14306
  return renderer;
14306
14307
  }
14307
- const render = (...args) => {
14308
+ const render = ((...args) => {
14308
14309
  ensureRenderer().render(...args);
14309
- };
14310
- const hydrate = (...args) => {
14310
+ });
14311
+ const hydrate = ((...args) => {
14311
14312
  ensureHydrationRenderer().hydrate(...args);
14312
- };
14313
- const createApp = (...args) => {
14313
+ });
14314
+ const createApp = ((...args) => {
14314
14315
  const app = ensureRenderer().createApp(...args);
14315
14316
  if (!!(process.env.NODE_ENV !== "production")) {
14316
14317
  injectNativeTagCheck(app);
@@ -14347,8 +14348,8 @@ const createApp = (...args) => {
14347
14348
  return proxy;
14348
14349
  };
14349
14350
  return app;
14350
- };
14351
- const createSSRApp = (...args) => {
14351
+ });
14352
+ const createSSRApp = ((...args) => {
14352
14353
  const app = ensureHydrationRenderer().createApp(...args);
14353
14354
  if (!!(process.env.NODE_ENV !== "production")) {
14354
14355
  injectNativeTagCheck(app);
@@ -14362,7 +14363,7 @@ const createSSRApp = (...args) => {
14362
14363
  }
14363
14364
  };
14364
14365
  return app;
14365
- };
14366
+ });
14366
14367
  function resolveRootNamespace(container) {
14367
14368
  if (container instanceof SVGElement) {
14368
14369
  return "svg";
@@ -14631,13 +14632,13 @@ function createCompatVue() {
14631
14632
  }
14632
14633
 
14633
14634
  const Vue = createCompatVue();
14634
- Vue.compile = () => {
14635
+ Vue.compile = (() => {
14635
14636
  if (!!(process.env.NODE_ENV !== "production")) {
14636
14637
  warn(
14637
14638
  `Runtime compilation is not supported in this build of Vue.` + (` Configure your bundler to alias "vue" to "@vue/compat/dist/vue.esm-bundler.js".` )
14638
14639
  );
14639
14640
  }
14640
- };
14641
+ });
14641
14642
 
14642
14643
  const configureCompat = Vue.configureCompat;
14643
14644