@vue/runtime-dom 3.2.27 → 3.2.28

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.
@@ -135,7 +135,15 @@ var VueRuntimeDOM = (function (exports) {
135
135
  'mesh,meshgradient,meshpatch,meshrow,metadata,mpath,path,pattern,' +
136
136
  'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
137
137
  'text,textPath,title,tspan,unknown,use,view';
138
+ /**
139
+ * Compiler only.
140
+ * Do NOT use in runtime code paths unless behind `true` flag.
141
+ */
138
142
  const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
143
+ /**
144
+ * Compiler only.
145
+ * Do NOT use in runtime code paths unless behind `true` flag.
146
+ */
139
147
  const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
140
148
 
141
149
  function looseCompareArrays(a, b) {
@@ -479,7 +487,7 @@ var VueRuntimeDOM = (function (exports) {
479
487
  if (!this.active) {
480
488
  return this.fn();
481
489
  }
482
- if (!effectStack.includes(this)) {
490
+ if (!effectStack.length || !effectStack.includes(this)) {
483
491
  try {
484
492
  effectStack.push((activeEffect = this));
485
493
  enableTracking();
@@ -735,6 +743,9 @@ var VueRuntimeDOM = (function (exports) {
735
743
  else if (key === "__v_isReadonly" /* IS_READONLY */) {
736
744
  return isReadonly;
737
745
  }
746
+ else if (key === "__v_isShallow" /* IS_SHALLOW */) {
747
+ return shallow;
748
+ }
738
749
  else if (key === "__v_raw" /* RAW */ &&
739
750
  receiver ===
740
751
  (isReadonly
@@ -779,9 +790,14 @@ var VueRuntimeDOM = (function (exports) {
779
790
  function createSetter(shallow = false) {
780
791
  return function set(target, key, value, receiver) {
781
792
  let oldValue = target[key];
793
+ if (isReadonly(oldValue) && isRef(oldValue)) {
794
+ return false;
795
+ }
782
796
  if (!shallow && !isReadonly(value)) {
783
- value = toRaw(value);
784
- oldValue = toRaw(oldValue);
797
+ if (!isShallow(value)) {
798
+ value = toRaw(value);
799
+ oldValue = toRaw(oldValue);
800
+ }
785
801
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
786
802
  oldValue.value = value;
787
803
  return true;
@@ -1168,7 +1184,7 @@ var VueRuntimeDOM = (function (exports) {
1168
1184
  }
1169
1185
  function reactive(target) {
1170
1186
  // if trying to observe a readonly proxy, return the readonly version.
1171
- if (target && target["__v_isReadonly" /* IS_READONLY */]) {
1187
+ if (isReadonly(target)) {
1172
1188
  return target;
1173
1189
  }
1174
1190
  return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
@@ -1233,6 +1249,9 @@ var VueRuntimeDOM = (function (exports) {
1233
1249
  function isReadonly(value) {
1234
1250
  return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
1235
1251
  }
1252
+ function isShallow(value) {
1253
+ return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
1254
+ }
1236
1255
  function isProxy(value) {
1237
1256
  return isReactive(value) || isReadonly(value);
1238
1257
  }
@@ -1291,22 +1310,22 @@ var VueRuntimeDOM = (function (exports) {
1291
1310
  return new RefImpl(rawValue, shallow);
1292
1311
  }
1293
1312
  class RefImpl {
1294
- constructor(value, _shallow) {
1295
- this._shallow = _shallow;
1313
+ constructor(value, __v_isShallow) {
1314
+ this.__v_isShallow = __v_isShallow;
1296
1315
  this.dep = undefined;
1297
1316
  this.__v_isRef = true;
1298
- this._rawValue = _shallow ? value : toRaw(value);
1299
- this._value = _shallow ? value : toReactive(value);
1317
+ this._rawValue = __v_isShallow ? value : toRaw(value);
1318
+ this._value = __v_isShallow ? value : toReactive(value);
1300
1319
  }
1301
1320
  get value() {
1302
1321
  trackRefValue(this);
1303
1322
  return this._value;
1304
1323
  }
1305
1324
  set value(newVal) {
1306
- newVal = this._shallow ? newVal : toRaw(newVal);
1325
+ newVal = this.__v_isShallow ? newVal : toRaw(newVal);
1307
1326
  if (hasChanged(newVal, this._rawValue)) {
1308
1327
  this._rawValue = newVal;
1309
- this._value = this._shallow ? newVal : toReactive(newVal);
1328
+ this._value = this.__v_isShallow ? newVal : toReactive(newVal);
1310
1329
  triggerRefValue(this, newVal);
1311
1330
  }
1312
1331
  }
@@ -1389,22 +1408,23 @@ var VueRuntimeDOM = (function (exports) {
1389
1408
  constructor(getter, _setter, isReadonly, isSSR) {
1390
1409
  this._setter = _setter;
1391
1410
  this.dep = undefined;
1392
- this._dirty = true;
1393
1411
  this.__v_isRef = true;
1412
+ this._dirty = true;
1394
1413
  this.effect = new ReactiveEffect(getter, () => {
1395
1414
  if (!this._dirty) {
1396
1415
  this._dirty = true;
1397
1416
  triggerRefValue(this);
1398
1417
  }
1399
1418
  });
1400
- this.effect.active = !isSSR;
1419
+ this.effect.computed = this;
1420
+ this.effect.active = this._cacheable = !isSSR;
1401
1421
  this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
1402
1422
  }
1403
1423
  get value() {
1404
1424
  // the computed ref may get wrapped by other proxies e.g. readonly() #3376
1405
1425
  const self = toRaw(this);
1406
1426
  trackRefValue(self);
1407
- if (self._dirty) {
1427
+ if (self._dirty || !self._cacheable) {
1408
1428
  self._dirty = false;
1409
1429
  self._value = self.effect.run();
1410
1430
  }
@@ -1581,7 +1601,7 @@ var VueRuntimeDOM = (function (exports) {
1581
1601
  [12 /* FUNCTION_REF */]: 'ref function',
1582
1602
  [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
1583
1603
  [14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
1584
- 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'
1604
+ 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
1585
1605
  };
1586
1606
  function callWithErrorHandling(fn, instance, type, args) {
1587
1607
  let res;
@@ -3042,7 +3062,7 @@ var VueRuntimeDOM = (function (exports) {
3042
3062
  if (instance) {
3043
3063
  // #2400
3044
3064
  // to support `app.use` plugins,
3045
- // fallback to appContext's `provides` if the intance is at root
3065
+ // fallback to appContext's `provides` if the instance is at root
3046
3066
  const provides = instance.parent == null
3047
3067
  ? instance.vnode.appContext && instance.vnode.appContext.provides
3048
3068
  : instance.parent.provides;
@@ -3108,7 +3128,7 @@ var VueRuntimeDOM = (function (exports) {
3108
3128
  let isMultiSource = false;
3109
3129
  if (isRef(source)) {
3110
3130
  getter = () => source.value;
3111
- forceTrigger = !!source._shallow;
3131
+ forceTrigger = isShallow(source);
3112
3132
  }
3113
3133
  else if (isReactive(source)) {
3114
3134
  getter = () => source;
@@ -3983,7 +4003,7 @@ var VueRuntimeDOM = (function (exports) {
3983
4003
  return pattern.some((p) => matches(p, name));
3984
4004
  }
3985
4005
  else if (isString(pattern)) {
3986
- return pattern.split(',').indexOf(name) > -1;
4006
+ return pattern.split(',').includes(name);
3987
4007
  }
3988
4008
  else if (pattern.test) {
3989
4009
  return pattern.test(name);
@@ -4236,7 +4256,7 @@ var VueRuntimeDOM = (function (exports) {
4236
4256
  warn$1(`Write operation failed: computed property "${key}" is readonly.`);
4237
4257
  }
4238
4258
  ;
4239
- const c = computed({
4259
+ const c = computed$1({
4240
4260
  get,
4241
4261
  set
4242
4262
  });
@@ -4635,7 +4655,9 @@ var VueRuntimeDOM = (function (exports) {
4635
4655
  // attrs point to the same object so it should already have been updated.
4636
4656
  if (attrs !== rawCurrentProps) {
4637
4657
  for (const key in attrs) {
4638
- if (!rawProps || !hasOwn(rawProps, key)) {
4658
+ if (!rawProps ||
4659
+ (!hasOwn(rawProps, key) &&
4660
+ (!false ))) {
4639
4661
  delete attrs[key];
4640
4662
  hasAttrsChanged = true;
4641
4663
  }
@@ -5731,6 +5753,7 @@ var VueRuntimeDOM = (function (exports) {
5731
5753
  return [hydrate, hydrateNode];
5732
5754
  }
5733
5755
 
5756
+ /* eslint-disable no-restricted-globals */
5734
5757
  let supported;
5735
5758
  let perf;
5736
5759
  function startMeasure(instance, type) {
@@ -5758,7 +5781,6 @@ var VueRuntimeDOM = (function (exports) {
5758
5781
  if (supported !== undefined) {
5759
5782
  return supported;
5760
5783
  }
5761
- /* eslint-disable no-restricted-globals */
5762
5784
  if (typeof window !== 'undefined' && window.performance) {
5763
5785
  supported = true;
5764
5786
  perf = window.performance;
@@ -5766,7 +5788,6 @@ var VueRuntimeDOM = (function (exports) {
5766
5788
  else {
5767
5789
  supported = false;
5768
5790
  }
5769
- /* eslint-enable no-restricted-globals */
5770
5791
  return supported;
5771
5792
  }
5772
5793
 
@@ -7643,7 +7664,7 @@ var VueRuntimeDOM = (function (exports) {
7643
7664
  shapeFlag: vnode.shapeFlag,
7644
7665
  // if the vnode is cloned with extra props, we can no longer assume its
7645
7666
  // existing patch flag to be reliable and need to add the FULL_PROPS flag.
7646
- // note: perserve flag for fragments since they use the flag for children
7667
+ // note: preserve flag for fragments since they use the flag for children
7647
7668
  // fast paths only.
7648
7669
  patchFlag: extraProps && vnode.type !== Fragment
7649
7670
  ? patchFlag === -1 // hoisted node
@@ -7805,7 +7826,8 @@ var VueRuntimeDOM = (function (exports) {
7805
7826
  else if (isOn(key)) {
7806
7827
  const existing = ret[key];
7807
7828
  const incoming = toMerge[key];
7808
- if (existing !== incoming &&
7829
+ if (incoming &&
7830
+ existing !== incoming &&
7809
7831
  !(isArray(existing) && existing.includes(incoming))) {
7810
7832
  ret[key] = existing
7811
7833
  ? [].concat(existing, incoming)
@@ -8625,7 +8647,7 @@ var VueRuntimeDOM = (function (exports) {
8625
8647
  * instance properties when it is accessed by a parent component via template
8626
8648
  * refs.
8627
8649
  *
8628
- * `<script setup>` components are closed by default - i.e. varaibles inside
8650
+ * `<script setup>` components are closed by default - i.e. variables inside
8629
8651
  * the `<script setup>` scope is not exposed to parent unless explicitly exposed
8630
8652
  * via `defineExpose`.
8631
8653
  *
@@ -8823,7 +8845,7 @@ var VueRuntimeDOM = (function (exports) {
8823
8845
  return [
8824
8846
  'div',
8825
8847
  {},
8826
- ['span', vueStyle, 'Reactive'],
8848
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReactive' : 'Reactive'],
8827
8849
  '<',
8828
8850
  formatValue(obj),
8829
8851
  `>${isReadonly(obj) ? ` (readonly)` : ``}`
@@ -8833,7 +8855,7 @@ var VueRuntimeDOM = (function (exports) {
8833
8855
  return [
8834
8856
  'div',
8835
8857
  {},
8836
- ['span', vueStyle, 'Readonly'],
8858
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReadonly' : 'Readonly'],
8837
8859
  '<',
8838
8860
  formatValue(obj),
8839
8861
  '>'
@@ -8962,7 +8984,7 @@ var VueRuntimeDOM = (function (exports) {
8962
8984
  }
8963
8985
  }
8964
8986
  function genRefFlag(v) {
8965
- if (v._shallow) {
8987
+ if (isShallow(v)) {
8966
8988
  return `ShallowRef`;
8967
8989
  }
8968
8990
  if (v.effect) {
@@ -9006,7 +9028,7 @@ var VueRuntimeDOM = (function (exports) {
9006
9028
  }
9007
9029
 
9008
9030
  // Core API ------------------------------------------------------------------
9009
- const version = "3.2.27";
9031
+ const version = "3.2.28";
9010
9032
  /**
9011
9033
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9012
9034
  * @internal
@@ -9393,7 +9415,7 @@ var VueRuntimeDOM = (function (exports) {
9393
9415
  originalStop.call(e);
9394
9416
  e._stopped = true;
9395
9417
  };
9396
- return value.map(fn => (e) => !e._stopped && fn(e));
9418
+ return value.map(fn => (e) => !e._stopped && fn && fn(e));
9397
9419
  }
9398
9420
  else {
9399
9421
  return value;
@@ -10696,6 +10718,7 @@ var VueRuntimeDOM = (function (exports) {
10696
10718
  exports.isReadonly = isReadonly;
10697
10719
  exports.isRef = isRef;
10698
10720
  exports.isRuntimeOnly = isRuntimeOnly;
10721
+ exports.isShallow = isShallow;
10699
10722
  exports.isVNode = isVNode;
10700
10723
  exports.markRaw = markRaw;
10701
10724
  exports.mergeDefaults = mergeDefaults;