@vue/compat 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 () {
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 () {
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 () {
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 () {
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 () {
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 () {
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 () {
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 () {
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 () {
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;
@@ -2204,7 +2228,7 @@ var Vue = (function () {
2204
2228
  ["CONFIG_DEVTOOLS" /* CONFIG_DEVTOOLS */]: {
2205
2229
  message: `config.devtools has been removed. To enable devtools for ` +
2206
2230
  `production, configure the __VUE_PROD_DEVTOOLS__ compile-time flag.`,
2207
- link: `https://github.com/vuejs/vue-next/tree/master/packages/vue#bundler-build-feature-flags`
2231
+ link: `https://github.com/vuejs/core/tree/main/packages/vue#bundler-build-feature-flags`
2208
2232
  },
2209
2233
  ["CONFIG_KEY_CODES" /* CONFIG_KEY_CODES */]: {
2210
2234
  message: `config.keyCodes has been removed. ` +
@@ -2391,7 +2415,7 @@ var Vue = (function () {
2391
2415
  (isArray(comp.props)
2392
2416
  ? comp.props.includes('modelValue')
2393
2417
  : hasOwn(comp.props, 'modelValue'))) {
2394
- return (`Component delcares "modelValue" prop, which is Vue 3 usage, but ` +
2418
+ return (`Component declares "modelValue" prop, which is Vue 3 usage, but ` +
2395
2419
  `is running under Vue 2 compat v-model behavior. You can ${configMsg}`);
2396
2420
  }
2397
2421
  return (`v-model usage on component has changed in Vue 3. Component that expects ` +
@@ -2621,6 +2645,7 @@ var Vue = (function () {
2621
2645
  const warnedTypes = new WeakSet();
2622
2646
  function convertLegacyVModelProps(vnode) {
2623
2647
  const { type, shapeFlag, props, dynamicProps } = vnode;
2648
+ const comp = type;
2624
2649
  if (shapeFlag & 6 /* COMPONENT */ && props && 'modelValue' in props) {
2625
2650
  if (!isCompatEnabled("COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */,
2626
2651
  // this is a special case where we want to use the vnode component's
@@ -2629,16 +2654,18 @@ var Vue = (function () {
2629
2654
  { type })) {
2630
2655
  return;
2631
2656
  }
2632
- if (!warnedTypes.has(type)) {
2657
+ if (!warnedTypes.has(comp)) {
2633
2658
  pushWarningContext(vnode);
2634
- warnDeprecation("COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */, { type }, type);
2659
+ warnDeprecation("COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */, { type }, comp);
2635
2660
  popWarningContext();
2636
- warnedTypes.add(type);
2661
+ warnedTypes.add(comp);
2637
2662
  }
2638
2663
  // v3 compiled model code -> v2 compat props
2639
2664
  // modelValue -> value
2640
2665
  // onUpdate:modelValue -> onModelCompat:input
2641
- const { prop = 'value', event = 'input' } = type.model || {};
2666
+ const model = comp.model || {};
2667
+ applyModelFromMixins(model, comp.mixins);
2668
+ const { prop = 'value', event = 'input' } = model;
2642
2669
  if (prop !== 'modelValue') {
2643
2670
  props[prop] = props.modelValue;
2644
2671
  delete props.modelValue;
@@ -2651,6 +2678,16 @@ var Vue = (function () {
2651
2678
  delete props['onUpdate:modelValue'];
2652
2679
  }
2653
2680
  }
2681
+ function applyModelFromMixins(model, mixins) {
2682
+ if (mixins) {
2683
+ mixins.forEach(m => {
2684
+ if (m.model)
2685
+ extend(model, m.model);
2686
+ if (m.mixins)
2687
+ applyModelFromMixins(model, m.mixins);
2688
+ });
2689
+ }
2690
+ }
2654
2691
  function compatModelEmit(instance, event, args) {
2655
2692
  if (!isCompatEnabled("COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */, instance)) {
2656
2693
  return;
@@ -3653,7 +3690,7 @@ var Vue = (function () {
3653
3690
  if (instance) {
3654
3691
  // #2400
3655
3692
  // to support `app.use` plugins,
3656
- // fallback to appContext's `provides` if the intance is at root
3693
+ // fallback to appContext's `provides` if the instance is at root
3657
3694
  const provides = instance.parent == null
3658
3695
  ? instance.vnode.appContext && instance.vnode.appContext.provides
3659
3696
  : instance.parent.provides;
@@ -3719,7 +3756,7 @@ var Vue = (function () {
3719
3756
  let isMultiSource = false;
3720
3757
  if (isRef(source)) {
3721
3758
  getter = () => source.value;
3722
- forceTrigger = !!source._shallow;
3759
+ forceTrigger = isShallow(source);
3723
3760
  }
3724
3761
  else if (isReactive(source)) {
3725
3762
  getter = () => source;
@@ -4613,7 +4650,7 @@ var Vue = (function () {
4613
4650
  return pattern.some((p) => matches(p, name));
4614
4651
  }
4615
4652
  else if (isString(pattern)) {
4616
- return pattern.split(',').indexOf(name) > -1;
4653
+ return pattern.split(',').includes(name);
4617
4654
  }
4618
4655
  else if (pattern.test) {
4619
4656
  return pattern.test(name);
@@ -4881,7 +4918,7 @@ var Vue = (function () {
4881
4918
  warn$1(`Write operation failed: computed property "${key}" is readonly.`);
4882
4919
  }
4883
4920
  ;
4884
- const c = computed({
4921
+ const c = computed$1({
4885
4922
  get,
4886
4923
  set
4887
4924
  });
@@ -5362,7 +5399,9 @@ var Vue = (function () {
5362
5399
  // attrs point to the same object so it should already have been updated.
5363
5400
  if (attrs !== rawCurrentProps) {
5364
5401
  for (const key in attrs) {
5365
- if (!rawProps || !hasOwn(rawProps, key)) {
5402
+ if (!rawProps ||
5403
+ (!hasOwn(rawProps, key) &&
5404
+ (!hasOwn(rawProps, key + 'Native')))) {
5366
5405
  delete attrs[key];
5367
5406
  hasAttrsChanged = true;
5368
5407
  }
@@ -6000,7 +6039,7 @@ var Vue = (function () {
6000
6039
  return vm;
6001
6040
  }
6002
6041
  }
6003
- Vue.version = "3.2.27";
6042
+ Vue.version = `2.6.14-compat:${"3.2.28"}`;
6004
6043
  Vue.config = singletonApp.config;
6005
6044
  Vue.use = (p, ...options) => {
6006
6045
  if (p && isFunction(p.install)) {
@@ -6989,6 +7028,7 @@ var Vue = (function () {
6989
7028
  return [hydrate, hydrateNode];
6990
7029
  }
6991
7030
 
7031
+ /* eslint-disable no-restricted-globals */
6992
7032
  let supported;
6993
7033
  let perf;
6994
7034
  function startMeasure(instance, type) {
@@ -7016,7 +7056,6 @@ var Vue = (function () {
7016
7056
  if (supported !== undefined) {
7017
7057
  return supported;
7018
7058
  }
7019
- /* eslint-disable no-restricted-globals */
7020
7059
  if (typeof window !== 'undefined' && window.performance) {
7021
7060
  supported = true;
7022
7061
  perf = window.performance;
@@ -7024,7 +7063,6 @@ var Vue = (function () {
7024
7063
  else {
7025
7064
  supported = false;
7026
7065
  }
7027
- /* eslint-enable no-restricted-globals */
7028
7066
  return supported;
7029
7067
  }
7030
7068
 
@@ -9270,7 +9308,7 @@ var Vue = (function () {
9270
9308
  shapeFlag: vnode.shapeFlag,
9271
9309
  // if the vnode is cloned with extra props, we can no longer assume its
9272
9310
  // existing patch flag to be reliable and need to add the FULL_PROPS flag.
9273
- // note: perserve flag for fragments since they use the flag for children
9311
+ // note: preserve flag for fragments since they use the flag for children
9274
9312
  // fast paths only.
9275
9313
  patchFlag: extraProps && vnode.type !== Fragment
9276
9314
  ? patchFlag === -1 // hoisted node
@@ -9435,7 +9473,8 @@ var Vue = (function () {
9435
9473
  else if (isOn(key)) {
9436
9474
  const existing = ret[key];
9437
9475
  const incoming = toMerge[key];
9438
- if (existing !== incoming &&
9476
+ if (incoming &&
9477
+ existing !== incoming &&
9439
9478
  !(isArray(existing) && existing.includes(incoming))) {
9440
9479
  ret[key] = existing
9441
9480
  ? [].concat(existing, incoming)
@@ -9711,7 +9750,7 @@ var Vue = (function () {
9711
9750
  }
9712
9751
  function isKeyNotMatch(expect, actual) {
9713
9752
  if (isArray(expect)) {
9714
- return expect.indexOf(actual) === -1;
9753
+ return !expect.includes(actual);
9715
9754
  }
9716
9755
  else {
9717
9756
  return expect !== actual;
@@ -9790,7 +9829,7 @@ var Vue = (function () {
9790
9829
  extend(map, {
9791
9830
  // needed by many libs / render fns
9792
9831
  $vnode: i => i.vnode,
9793
- // inject addtional properties into $options for compat
9832
+ // inject additional properties into $options for compat
9794
9833
  // e.g. vuex needs this.$options.parent
9795
9834
  $options: i => {
9796
9835
  const res = extend({}, resolveMergedOptions(i));
@@ -10518,7 +10557,7 @@ var Vue = (function () {
10518
10557
  * instance properties when it is accessed by a parent component via template
10519
10558
  * refs.
10520
10559
  *
10521
- * `<script setup>` components are closed by default - i.e. varaibles inside
10560
+ * `<script setup>` components are closed by default - i.e. variables inside
10522
10561
  * the `<script setup>` scope is not exposed to parent unless explicitly exposed
10523
10562
  * via `defineExpose`.
10524
10563
  *
@@ -10716,7 +10755,7 @@ var Vue = (function () {
10716
10755
  return [
10717
10756
  'div',
10718
10757
  {},
10719
- ['span', vueStyle, 'Reactive'],
10758
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReactive' : 'Reactive'],
10720
10759
  '<',
10721
10760
  formatValue(obj),
10722
10761
  `>${isReadonly(obj) ? ` (readonly)` : ``}`
@@ -10726,7 +10765,7 @@ var Vue = (function () {
10726
10765
  return [
10727
10766
  'div',
10728
10767
  {},
10729
- ['span', vueStyle, 'Readonly'],
10768
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReadonly' : 'Readonly'],
10730
10769
  '<',
10731
10770
  formatValue(obj),
10732
10771
  '>'
@@ -10855,7 +10894,7 @@ var Vue = (function () {
10855
10894
  }
10856
10895
  }
10857
10896
  function genRefFlag(v) {
10858
- if (v._shallow) {
10897
+ if (isShallow(v)) {
10859
10898
  return `ShallowRef`;
10860
10899
  }
10861
10900
  if (v.effect) {
@@ -10899,7 +10938,7 @@ var Vue = (function () {
10899
10938
  }
10900
10939
 
10901
10940
  // Core API ------------------------------------------------------------------
10902
- const version = "3.2.27";
10941
+ const version = "3.2.28";
10903
10942
  /**
10904
10943
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10905
10944
  * @internal
@@ -11330,7 +11369,7 @@ var Vue = (function () {
11330
11369
  originalStop.call(e);
11331
11370
  e._stopped = true;
11332
11371
  };
11333
- return value.map(fn => (e) => !e._stopped && fn(e));
11372
+ return value.map(fn => (e) => !e._stopped && fn && fn(e));
11334
11373
  }
11335
11374
  else {
11336
11375
  return value;
@@ -12692,6 +12731,7 @@ var Vue = (function () {
12692
12731
  isProxy: isProxy,
12693
12732
  isReactive: isReactive,
12694
12733
  isReadonly: isReadonly,
12734
+ isShallow: isShallow,
12695
12735
  customRef: customRef,
12696
12736
  triggerRef: triggerRef,
12697
12737
  shallowRef: shallowRef,
@@ -14041,7 +14081,7 @@ var Vue = (function () {
14041
14081
  }
14042
14082
  const attr = parseAttribute(context, attributeNames);
14043
14083
  // Trim whitespace between class
14044
- // https://github.com/vuejs/vue-next/issues/4251
14084
+ // https://github.com/vuejs/core/issues/4251
14045
14085
  if (attr.type === 6 /* ATTRIBUTE */ &&
14046
14086
  attr.value &&
14047
14087
  attr.name === 'class') {
@@ -14277,7 +14317,7 @@ var Vue = (function () {
14277
14317
  advanceBy(context, length);
14278
14318
  if (mode === 2 /* RAWTEXT */ ||
14279
14319
  mode === 3 /* CDATA */ ||
14280
- rawText.indexOf('&') === -1) {
14320
+ !rawText.includes('&')) {
14281
14321
  return rawText;
14282
14322
  }
14283
14323
  else {
@@ -15798,6 +15838,7 @@ var Vue = (function () {
15798
15838
  const renderExp = createCallExpression(helper(RENDER_LIST), [
15799
15839
  forNode.source
15800
15840
  ]);
15841
+ const isTemplate = isTemplateNode(node);
15801
15842
  const memo = findDir(node, 'memo');
15802
15843
  const keyProp = findProp(node, `key`);
15803
15844
  const keyExp = keyProp &&
@@ -15817,7 +15858,6 @@ var Vue = (function () {
15817
15858
  return () => {
15818
15859
  // finish the codegen now that all children have been traversed
15819
15860
  let childBlock;
15820
- const isTemplate = isTemplateNode(node);
15821
15861
  const { children } = forNode;
15822
15862
  // check <template v-for> key placement
15823
15863
  if (isTemplate) {