@vue/compat 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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/compat v3.5.18
2
+ * @vue/compat 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(
@@ -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;
@@ -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})`);
@@ -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.19"}`;
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.19";
12324
12326
  const warn = warn$1 ;
12325
12327
  const ErrorTypeStrings = ErrorTypeStrings$1 ;
12326
12328
  const devtools = devtools$1 ;
@@ -13265,10 +13267,10 @@ function defineCustomElement(options, extraOptions, _createApp) {
13265
13267
  VueCustomElement.def = Comp;
13266
13268
  return VueCustomElement;
13267
13269
  }
13268
- /*! #__NO_SIDE_EFFECTS__ */
13269
- const defineSSRCustomElement = /* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13270
+
13271
+ const defineSSRCustomElement = (/* @__NO_SIDE_EFFECTS__ */ (options, extraOptions) => {
13270
13272
  return /* @__PURE__ */ defineCustomElement(options, extraOptions, createSSRApp);
13271
- };
13273
+ });
13272
13274
  const BaseClass = typeof HTMLElement !== "undefined" ? HTMLElement : class {
13273
13275
  };
13274
13276
  class VueElement extends BaseClass {
@@ -14138,13 +14140,13 @@ const modifierGuards = {
14138
14140
  const withModifiers = (fn, modifiers) => {
14139
14141
  const cache = fn._withMods || (fn._withMods = {});
14140
14142
  const cacheKey = modifiers.join(".");
14141
- return cache[cacheKey] || (cache[cacheKey] = (event, ...args) => {
14143
+ return cache[cacheKey] || (cache[cacheKey] = ((event, ...args) => {
14142
14144
  for (let i = 0; i < modifiers.length; i++) {
14143
14145
  const guard = modifierGuards[modifiers[i]];
14144
14146
  if (guard && guard(event, modifiers)) return;
14145
14147
  }
14146
14148
  return fn(event, ...args);
14147
- });
14149
+ }));
14148
14150
  };
14149
14151
  const keyNames = {
14150
14152
  esc: "escape",
@@ -14174,7 +14176,7 @@ const withKeys = (fn, modifiers) => {
14174
14176
  }
14175
14177
  const cache = fn._withKeys || (fn._withKeys = {});
14176
14178
  const cacheKey = modifiers.join(".");
14177
- return cache[cacheKey] || (cache[cacheKey] = (event) => {
14179
+ return cache[cacheKey] || (cache[cacheKey] = ((event) => {
14178
14180
  if (!("key" in event)) {
14179
14181
  return;
14180
14182
  }
@@ -14204,7 +14206,7 @@ const withKeys = (fn, modifiers) => {
14204
14206
  }
14205
14207
  }
14206
14208
  }
14207
- });
14209
+ }));
14208
14210
  };
14209
14211
 
14210
14212
  const rendererOptions = /* @__PURE__ */ extend({ patchProp }, nodeOps);
@@ -14218,13 +14220,13 @@ function ensureHydrationRenderer() {
14218
14220
  enabledHydration = true;
14219
14221
  return renderer;
14220
14222
  }
14221
- const render = (...args) => {
14223
+ const render = ((...args) => {
14222
14224
  ensureRenderer().render(...args);
14223
- };
14224
- const hydrate = (...args) => {
14225
+ });
14226
+ const hydrate = ((...args) => {
14225
14227
  ensureHydrationRenderer().hydrate(...args);
14226
- };
14227
- const createApp = (...args) => {
14228
+ });
14229
+ const createApp = ((...args) => {
14228
14230
  const app = ensureRenderer().createApp(...args);
14229
14231
  {
14230
14232
  injectNativeTagCheck(app);
@@ -14261,8 +14263,8 @@ const createApp = (...args) => {
14261
14263
  return proxy;
14262
14264
  };
14263
14265
  return app;
14264
- };
14265
- const createSSRApp = (...args) => {
14266
+ });
14267
+ const createSSRApp = ((...args) => {
14266
14268
  const app = ensureHydrationRenderer().createApp(...args);
14267
14269
  {
14268
14270
  injectNativeTagCheck(app);
@@ -14276,7 +14278,7 @@ const createSSRApp = (...args) => {
14276
14278
  }
14277
14279
  };
14278
14280
  return app;
14279
- };
14281
+ });
14280
14282
  function resolveRootNamespace(container) {
14281
14283
  if (container instanceof SVGElement) {
14282
14284
  return "svg";
@@ -14551,13 +14553,13 @@ function createCompatVue() {
14551
14553
  }
14552
14554
 
14553
14555
  const Vue = createCompatVue();
14554
- Vue.compile = () => {
14556
+ Vue.compile = (() => {
14555
14557
  {
14556
14558
  warn(
14557
14559
  `Runtime compilation is not supported in this build of Vue.` + (` Use "vue.esm-browser.js" instead.` )
14558
14560
  );
14559
14561
  }
14560
- };
14562
+ });
14561
14563
 
14562
14564
  const configureCompat = Vue.configureCompat;
14563
14565