vue 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.
@@ -209,8 +209,20 @@ var Vue = (function (exports) {
209
209
  'polygon,polyline,radialGradient,rect,set,solidcolor,stop,switch,symbol,' +
210
210
  'text,textPath,title,tspan,unknown,use,view';
211
211
  const VOID_TAGS = 'area,base,br,col,embed,hr,img,input,link,meta,param,source,track,wbr';
212
+ /**
213
+ * Compiler only.
214
+ * Do NOT use in runtime code paths unless behind `true` flag.
215
+ */
212
216
  const isHTMLTag = /*#__PURE__*/ makeMap(HTML_TAGS);
217
+ /**
218
+ * Compiler only.
219
+ * Do NOT use in runtime code paths unless behind `true` flag.
220
+ */
213
221
  const isSVGTag = /*#__PURE__*/ makeMap(SVG_TAGS);
222
+ /**
223
+ * Compiler only.
224
+ * Do NOT use in runtime code paths unless behind `true` flag.
225
+ */
214
226
  const isVoidTag = /*#__PURE__*/ makeMap(VOID_TAGS);
215
227
 
216
228
  function looseCompareArrays(a, b) {
@@ -554,7 +566,7 @@ var Vue = (function (exports) {
554
566
  if (!this.active) {
555
567
  return this.fn();
556
568
  }
557
- if (!effectStack.includes(this)) {
569
+ if (!effectStack.length || !effectStack.includes(this)) {
558
570
  try {
559
571
  effectStack.push((activeEffect = this));
560
572
  enableTracking();
@@ -810,6 +822,9 @@ var Vue = (function (exports) {
810
822
  else if (key === "__v_isReadonly" /* IS_READONLY */) {
811
823
  return isReadonly;
812
824
  }
825
+ else if (key === "__v_isShallow" /* IS_SHALLOW */) {
826
+ return shallow;
827
+ }
813
828
  else if (key === "__v_raw" /* RAW */ &&
814
829
  receiver ===
815
830
  (isReadonly
@@ -854,9 +869,14 @@ var Vue = (function (exports) {
854
869
  function createSetter(shallow = false) {
855
870
  return function set(target, key, value, receiver) {
856
871
  let oldValue = target[key];
872
+ if (isReadonly(oldValue) && isRef(oldValue)) {
873
+ return false;
874
+ }
857
875
  if (!shallow && !isReadonly(value)) {
858
- value = toRaw(value);
859
- oldValue = toRaw(oldValue);
876
+ if (!isShallow(value)) {
877
+ value = toRaw(value);
878
+ oldValue = toRaw(oldValue);
879
+ }
860
880
  if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
861
881
  oldValue.value = value;
862
882
  return true;
@@ -1243,7 +1263,7 @@ var Vue = (function (exports) {
1243
1263
  }
1244
1264
  function reactive(target) {
1245
1265
  // if trying to observe a readonly proxy, return the readonly version.
1246
- if (target && target["__v_isReadonly" /* IS_READONLY */]) {
1266
+ if (isReadonly(target)) {
1247
1267
  return target;
1248
1268
  }
1249
1269
  return createReactiveObject(target, false, mutableHandlers, mutableCollectionHandlers, reactiveMap);
@@ -1308,6 +1328,9 @@ var Vue = (function (exports) {
1308
1328
  function isReadonly(value) {
1309
1329
  return !!(value && value["__v_isReadonly" /* IS_READONLY */]);
1310
1330
  }
1331
+ function isShallow(value) {
1332
+ return !!(value && value["__v_isShallow" /* IS_SHALLOW */]);
1333
+ }
1311
1334
  function isProxy(value) {
1312
1335
  return isReactive(value) || isReadonly(value);
1313
1336
  }
@@ -1366,22 +1389,22 @@ var Vue = (function (exports) {
1366
1389
  return new RefImpl(rawValue, shallow);
1367
1390
  }
1368
1391
  class RefImpl {
1369
- constructor(value, _shallow) {
1370
- this._shallow = _shallow;
1392
+ constructor(value, __v_isShallow) {
1393
+ this.__v_isShallow = __v_isShallow;
1371
1394
  this.dep = undefined;
1372
1395
  this.__v_isRef = true;
1373
- this._rawValue = _shallow ? value : toRaw(value);
1374
- this._value = _shallow ? value : toReactive(value);
1396
+ this._rawValue = __v_isShallow ? value : toRaw(value);
1397
+ this._value = __v_isShallow ? value : toReactive(value);
1375
1398
  }
1376
1399
  get value() {
1377
1400
  trackRefValue(this);
1378
1401
  return this._value;
1379
1402
  }
1380
1403
  set value(newVal) {
1381
- newVal = this._shallow ? newVal : toRaw(newVal);
1404
+ newVal = this.__v_isShallow ? newVal : toRaw(newVal);
1382
1405
  if (hasChanged(newVal, this._rawValue)) {
1383
1406
  this._rawValue = newVal;
1384
- this._value = this._shallow ? newVal : toReactive(newVal);
1407
+ this._value = this.__v_isShallow ? newVal : toReactive(newVal);
1385
1408
  triggerRefValue(this, newVal);
1386
1409
  }
1387
1410
  }
@@ -1464,22 +1487,23 @@ var Vue = (function (exports) {
1464
1487
  constructor(getter, _setter, isReadonly, isSSR) {
1465
1488
  this._setter = _setter;
1466
1489
  this.dep = undefined;
1467
- this._dirty = true;
1468
1490
  this.__v_isRef = true;
1491
+ this._dirty = true;
1469
1492
  this.effect = new ReactiveEffect(getter, () => {
1470
1493
  if (!this._dirty) {
1471
1494
  this._dirty = true;
1472
1495
  triggerRefValue(this);
1473
1496
  }
1474
1497
  });
1475
- this.effect.active = !isSSR;
1498
+ this.effect.computed = this;
1499
+ this.effect.active = this._cacheable = !isSSR;
1476
1500
  this["__v_isReadonly" /* IS_READONLY */] = isReadonly;
1477
1501
  }
1478
1502
  get value() {
1479
1503
  // the computed ref may get wrapped by other proxies e.g. readonly() #3376
1480
1504
  const self = toRaw(this);
1481
1505
  trackRefValue(self);
1482
- if (self._dirty) {
1506
+ if (self._dirty || !self._cacheable) {
1483
1507
  self._dirty = false;
1484
1508
  self._value = self.effect.run();
1485
1509
  }
@@ -1656,7 +1680,7 @@ var Vue = (function (exports) {
1656
1680
  [12 /* FUNCTION_REF */]: 'ref function',
1657
1681
  [13 /* ASYNC_COMPONENT_LOADER */]: 'async component loader',
1658
1682
  [14 /* SCHEDULER */]: 'scheduler flush. This is likely a Vue internals bug. ' +
1659
- 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next'
1683
+ 'Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/core'
1660
1684
  };
1661
1685
  function callWithErrorHandling(fn, instance, type, args) {
1662
1686
  let res;
@@ -3117,7 +3141,7 @@ var Vue = (function (exports) {
3117
3141
  if (instance) {
3118
3142
  // #2400
3119
3143
  // to support `app.use` plugins,
3120
- // fallback to appContext's `provides` if the intance is at root
3144
+ // fallback to appContext's `provides` if the instance is at root
3121
3145
  const provides = instance.parent == null
3122
3146
  ? instance.vnode.appContext && instance.vnode.appContext.provides
3123
3147
  : instance.parent.provides;
@@ -3183,7 +3207,7 @@ var Vue = (function (exports) {
3183
3207
  let isMultiSource = false;
3184
3208
  if (isRef(source)) {
3185
3209
  getter = () => source.value;
3186
- forceTrigger = !!source._shallow;
3210
+ forceTrigger = isShallow(source);
3187
3211
  }
3188
3212
  else if (isReactive(source)) {
3189
3213
  getter = () => source;
@@ -4058,7 +4082,7 @@ var Vue = (function (exports) {
4058
4082
  return pattern.some((p) => matches(p, name));
4059
4083
  }
4060
4084
  else if (isString(pattern)) {
4061
- return pattern.split(',').indexOf(name) > -1;
4085
+ return pattern.split(',').includes(name);
4062
4086
  }
4063
4087
  else if (pattern.test) {
4064
4088
  return pattern.test(name);
@@ -4311,7 +4335,7 @@ var Vue = (function (exports) {
4311
4335
  warn$1(`Write operation failed: computed property "${key}" is readonly.`);
4312
4336
  }
4313
4337
  ;
4314
- const c = computed({
4338
+ const c = computed$1({
4315
4339
  get,
4316
4340
  set
4317
4341
  });
@@ -4710,7 +4734,9 @@ var Vue = (function (exports) {
4710
4734
  // attrs point to the same object so it should already have been updated.
4711
4735
  if (attrs !== rawCurrentProps) {
4712
4736
  for (const key in attrs) {
4713
- if (!rawProps || !hasOwn(rawProps, key)) {
4737
+ if (!rawProps ||
4738
+ (!hasOwn(rawProps, key) &&
4739
+ (!false ))) {
4714
4740
  delete attrs[key];
4715
4741
  hasAttrsChanged = true;
4716
4742
  }
@@ -5806,6 +5832,7 @@ var Vue = (function (exports) {
5806
5832
  return [hydrate, hydrateNode];
5807
5833
  }
5808
5834
 
5835
+ /* eslint-disable no-restricted-globals */
5809
5836
  let supported;
5810
5837
  let perf;
5811
5838
  function startMeasure(instance, type) {
@@ -5833,7 +5860,6 @@ var Vue = (function (exports) {
5833
5860
  if (supported !== undefined) {
5834
5861
  return supported;
5835
5862
  }
5836
- /* eslint-disable no-restricted-globals */
5837
5863
  if (typeof window !== 'undefined' && window.performance) {
5838
5864
  supported = true;
5839
5865
  perf = window.performance;
@@ -5841,7 +5867,6 @@ var Vue = (function (exports) {
5841
5867
  else {
5842
5868
  supported = false;
5843
5869
  }
5844
- /* eslint-enable no-restricted-globals */
5845
5870
  return supported;
5846
5871
  }
5847
5872
 
@@ -7718,7 +7743,7 @@ var Vue = (function (exports) {
7718
7743
  shapeFlag: vnode.shapeFlag,
7719
7744
  // if the vnode is cloned with extra props, we can no longer assume its
7720
7745
  // existing patch flag to be reliable and need to add the FULL_PROPS flag.
7721
- // note: perserve flag for fragments since they use the flag for children
7746
+ // note: preserve flag for fragments since they use the flag for children
7722
7747
  // fast paths only.
7723
7748
  patchFlag: extraProps && vnode.type !== Fragment
7724
7749
  ? patchFlag === -1 // hoisted node
@@ -7880,7 +7905,8 @@ var Vue = (function (exports) {
7880
7905
  else if (isOn(key)) {
7881
7906
  const existing = ret[key];
7882
7907
  const incoming = toMerge[key];
7883
- if (existing !== incoming &&
7908
+ if (incoming &&
7909
+ existing !== incoming &&
7884
7910
  !(isArray(existing) && existing.includes(incoming))) {
7885
7911
  ret[key] = existing
7886
7912
  ? [].concat(existing, incoming)
@@ -8700,7 +8726,7 @@ var Vue = (function (exports) {
8700
8726
  * instance properties when it is accessed by a parent component via template
8701
8727
  * refs.
8702
8728
  *
8703
- * `<script setup>` components are closed by default - i.e. varaibles inside
8729
+ * `<script setup>` components are closed by default - i.e. variables inside
8704
8730
  * the `<script setup>` scope is not exposed to parent unless explicitly exposed
8705
8731
  * via `defineExpose`.
8706
8732
  *
@@ -8898,7 +8924,7 @@ var Vue = (function (exports) {
8898
8924
  return [
8899
8925
  'div',
8900
8926
  {},
8901
- ['span', vueStyle, 'Reactive'],
8927
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReactive' : 'Reactive'],
8902
8928
  '<',
8903
8929
  formatValue(obj),
8904
8930
  `>${isReadonly(obj) ? ` (readonly)` : ``}`
@@ -8908,7 +8934,7 @@ var Vue = (function (exports) {
8908
8934
  return [
8909
8935
  'div',
8910
8936
  {},
8911
- ['span', vueStyle, 'Readonly'],
8937
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReadonly' : 'Readonly'],
8912
8938
  '<',
8913
8939
  formatValue(obj),
8914
8940
  '>'
@@ -9037,7 +9063,7 @@ var Vue = (function (exports) {
9037
9063
  }
9038
9064
  }
9039
9065
  function genRefFlag(v) {
9040
- if (v._shallow) {
9066
+ if (isShallow(v)) {
9041
9067
  return `ShallowRef`;
9042
9068
  }
9043
9069
  if (v.effect) {
@@ -9081,7 +9107,7 @@ var Vue = (function (exports) {
9081
9107
  }
9082
9108
 
9083
9109
  // Core API ------------------------------------------------------------------
9084
- const version = "3.2.27";
9110
+ const version = "3.2.28";
9085
9111
  /**
9086
9112
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9087
9113
  * @internal
@@ -9468,7 +9494,7 @@ var Vue = (function (exports) {
9468
9494
  originalStop.call(e);
9469
9495
  e._stopped = true;
9470
9496
  };
9471
- return value.map(fn => (e) => !e._stopped && fn(e));
9497
+ return value.map(fn => (e) => !e._stopped && fn && fn(e));
9472
9498
  }
9473
9499
  else {
9474
9500
  return value;
@@ -11875,7 +11901,7 @@ var Vue = (function (exports) {
11875
11901
  }
11876
11902
  const attr = parseAttribute(context, attributeNames);
11877
11903
  // Trim whitespace between class
11878
- // https://github.com/vuejs/vue-next/issues/4251
11904
+ // https://github.com/vuejs/core/issues/4251
11879
11905
  if (attr.type === 6 /* ATTRIBUTE */ &&
11880
11906
  attr.value &&
11881
11907
  attr.name === 'class') {
@@ -12100,7 +12126,7 @@ var Vue = (function (exports) {
12100
12126
  advanceBy(context, length);
12101
12127
  if (mode === 2 /* RAWTEXT */ ||
12102
12128
  mode === 3 /* CDATA */ ||
12103
- rawText.indexOf('&') === -1) {
12129
+ !rawText.includes('&')) {
12104
12130
  return rawText;
12105
12131
  }
12106
12132
  else {
@@ -13605,6 +13631,7 @@ var Vue = (function (exports) {
13605
13631
  const renderExp = createCallExpression(helper(RENDER_LIST), [
13606
13632
  forNode.source
13607
13633
  ]);
13634
+ const isTemplate = isTemplateNode(node);
13608
13635
  const memo = findDir(node, 'memo');
13609
13636
  const keyProp = findProp(node, `key`);
13610
13637
  const keyExp = keyProp &&
@@ -13624,7 +13651,6 @@ var Vue = (function (exports) {
13624
13651
  return () => {
13625
13652
  // finish the codegen now that all children have been traversed
13626
13653
  let childBlock;
13627
- const isTemplate = isTemplateNode(node);
13628
13654
  const { children } = forNode;
13629
13655
  // check <template v-for> key placement
13630
13656
  if (isTemplate) {
@@ -15625,6 +15651,7 @@ var Vue = (function (exports) {
15625
15651
  exports.isReadonly = isReadonly;
15626
15652
  exports.isRef = isRef;
15627
15653
  exports.isRuntimeOnly = isRuntimeOnly;
15654
+ exports.isShallow = isShallow;
15628
15655
  exports.isVNode = isVNode;
15629
15656
  exports.markRaw = markRaw;
15630
15657
  exports.mergeDefaults = mergeDefaults;