@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.
@@ -135,7 +135,15 @@ var Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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 Vue = (function () {
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;
@@ -2129,7 +2149,7 @@ var Vue = (function () {
2129
2149
  ["CONFIG_DEVTOOLS" /* CONFIG_DEVTOOLS */]: {
2130
2150
  message: `config.devtools has been removed. To enable devtools for ` +
2131
2151
  `production, configure the __VUE_PROD_DEVTOOLS__ compile-time flag.`,
2132
- link: `https://github.com/vuejs/vue-next/tree/master/packages/vue#bundler-build-feature-flags`
2152
+ link: `https://github.com/vuejs/core/tree/main/packages/vue#bundler-build-feature-flags`
2133
2153
  },
2134
2154
  ["CONFIG_KEY_CODES" /* CONFIG_KEY_CODES */]: {
2135
2155
  message: `config.keyCodes has been removed. ` +
@@ -2316,7 +2336,7 @@ var Vue = (function () {
2316
2336
  (isArray(comp.props)
2317
2337
  ? comp.props.includes('modelValue')
2318
2338
  : hasOwn(comp.props, 'modelValue'))) {
2319
- return (`Component delcares "modelValue" prop, which is Vue 3 usage, but ` +
2339
+ return (`Component declares "modelValue" prop, which is Vue 3 usage, but ` +
2320
2340
  `is running under Vue 2 compat v-model behavior. You can ${configMsg}`);
2321
2341
  }
2322
2342
  return (`v-model usage on component has changed in Vue 3. Component that expects ` +
@@ -2546,6 +2566,7 @@ var Vue = (function () {
2546
2566
  const warnedTypes = new WeakSet();
2547
2567
  function convertLegacyVModelProps(vnode) {
2548
2568
  const { type, shapeFlag, props, dynamicProps } = vnode;
2569
+ const comp = type;
2549
2570
  if (shapeFlag & 6 /* COMPONENT */ && props && 'modelValue' in props) {
2550
2571
  if (!isCompatEnabled("COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */,
2551
2572
  // this is a special case where we want to use the vnode component's
@@ -2554,16 +2575,18 @@ var Vue = (function () {
2554
2575
  { type })) {
2555
2576
  return;
2556
2577
  }
2557
- if (!warnedTypes.has(type)) {
2578
+ if (!warnedTypes.has(comp)) {
2558
2579
  pushWarningContext(vnode);
2559
- warnDeprecation("COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */, { type }, type);
2580
+ warnDeprecation("COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */, { type }, comp);
2560
2581
  popWarningContext();
2561
- warnedTypes.add(type);
2582
+ warnedTypes.add(comp);
2562
2583
  }
2563
2584
  // v3 compiled model code -> v2 compat props
2564
2585
  // modelValue -> value
2565
2586
  // onUpdate:modelValue -> onModelCompat:input
2566
- const { prop = 'value', event = 'input' } = type.model || {};
2587
+ const model = comp.model || {};
2588
+ applyModelFromMixins(model, comp.mixins);
2589
+ const { prop = 'value', event = 'input' } = model;
2567
2590
  if (prop !== 'modelValue') {
2568
2591
  props[prop] = props.modelValue;
2569
2592
  delete props.modelValue;
@@ -2576,6 +2599,16 @@ var Vue = (function () {
2576
2599
  delete props['onUpdate:modelValue'];
2577
2600
  }
2578
2601
  }
2602
+ function applyModelFromMixins(model, mixins) {
2603
+ if (mixins) {
2604
+ mixins.forEach(m => {
2605
+ if (m.model)
2606
+ extend(model, m.model);
2607
+ if (m.mixins)
2608
+ applyModelFromMixins(model, m.mixins);
2609
+ });
2610
+ }
2611
+ }
2579
2612
  function compatModelEmit(instance, event, args) {
2580
2613
  if (!isCompatEnabled("COMPONENT_V_MODEL" /* COMPONENT_V_MODEL */, instance)) {
2581
2614
  return;
@@ -3578,7 +3611,7 @@ var Vue = (function () {
3578
3611
  if (instance) {
3579
3612
  // #2400
3580
3613
  // to support `app.use` plugins,
3581
- // fallback to appContext's `provides` if the intance is at root
3614
+ // fallback to appContext's `provides` if the instance is at root
3582
3615
  const provides = instance.parent == null
3583
3616
  ? instance.vnode.appContext && instance.vnode.appContext.provides
3584
3617
  : instance.parent.provides;
@@ -3644,7 +3677,7 @@ var Vue = (function () {
3644
3677
  let isMultiSource = false;
3645
3678
  if (isRef(source)) {
3646
3679
  getter = () => source.value;
3647
- forceTrigger = !!source._shallow;
3680
+ forceTrigger = isShallow(source);
3648
3681
  }
3649
3682
  else if (isReactive(source)) {
3650
3683
  getter = () => source;
@@ -4538,7 +4571,7 @@ var Vue = (function () {
4538
4571
  return pattern.some((p) => matches(p, name));
4539
4572
  }
4540
4573
  else if (isString(pattern)) {
4541
- return pattern.split(',').indexOf(name) > -1;
4574
+ return pattern.split(',').includes(name);
4542
4575
  }
4543
4576
  else if (pattern.test) {
4544
4577
  return pattern.test(name);
@@ -4806,7 +4839,7 @@ var Vue = (function () {
4806
4839
  warn$1(`Write operation failed: computed property "${key}" is readonly.`);
4807
4840
  }
4808
4841
  ;
4809
- const c = computed({
4842
+ const c = computed$1({
4810
4843
  get,
4811
4844
  set
4812
4845
  });
@@ -5287,7 +5320,9 @@ var Vue = (function () {
5287
5320
  // attrs point to the same object so it should already have been updated.
5288
5321
  if (attrs !== rawCurrentProps) {
5289
5322
  for (const key in attrs) {
5290
- if (!rawProps || !hasOwn(rawProps, key)) {
5323
+ if (!rawProps ||
5324
+ (!hasOwn(rawProps, key) &&
5325
+ (!hasOwn(rawProps, key + 'Native')))) {
5291
5326
  delete attrs[key];
5292
5327
  hasAttrsChanged = true;
5293
5328
  }
@@ -5925,7 +5960,7 @@ var Vue = (function () {
5925
5960
  return vm;
5926
5961
  }
5927
5962
  }
5928
- Vue.version = "3.2.27";
5963
+ Vue.version = `2.6.14-compat:${"3.2.28"}`;
5929
5964
  Vue.config = singletonApp.config;
5930
5965
  Vue.use = (p, ...options) => {
5931
5966
  if (p && isFunction(p.install)) {
@@ -6914,6 +6949,7 @@ var Vue = (function () {
6914
6949
  return [hydrate, hydrateNode];
6915
6950
  }
6916
6951
 
6952
+ /* eslint-disable no-restricted-globals */
6917
6953
  let supported;
6918
6954
  let perf;
6919
6955
  function startMeasure(instance, type) {
@@ -6941,7 +6977,6 @@ var Vue = (function () {
6941
6977
  if (supported !== undefined) {
6942
6978
  return supported;
6943
6979
  }
6944
- /* eslint-disable no-restricted-globals */
6945
6980
  if (typeof window !== 'undefined' && window.performance) {
6946
6981
  supported = true;
6947
6982
  perf = window.performance;
@@ -6949,7 +6984,6 @@ var Vue = (function () {
6949
6984
  else {
6950
6985
  supported = false;
6951
6986
  }
6952
- /* eslint-enable no-restricted-globals */
6953
6987
  return supported;
6954
6988
  }
6955
6989
 
@@ -9195,7 +9229,7 @@ var Vue = (function () {
9195
9229
  shapeFlag: vnode.shapeFlag,
9196
9230
  // if the vnode is cloned with extra props, we can no longer assume its
9197
9231
  // existing patch flag to be reliable and need to add the FULL_PROPS flag.
9198
- // note: perserve flag for fragments since they use the flag for children
9232
+ // note: preserve flag for fragments since they use the flag for children
9199
9233
  // fast paths only.
9200
9234
  patchFlag: extraProps && vnode.type !== Fragment
9201
9235
  ? patchFlag === -1 // hoisted node
@@ -9360,7 +9394,8 @@ var Vue = (function () {
9360
9394
  else if (isOn(key)) {
9361
9395
  const existing = ret[key];
9362
9396
  const incoming = toMerge[key];
9363
- if (existing !== incoming &&
9397
+ if (incoming &&
9398
+ existing !== incoming &&
9364
9399
  !(isArray(existing) && existing.includes(incoming))) {
9365
9400
  ret[key] = existing
9366
9401
  ? [].concat(existing, incoming)
@@ -9636,7 +9671,7 @@ var Vue = (function () {
9636
9671
  }
9637
9672
  function isKeyNotMatch(expect, actual) {
9638
9673
  if (isArray(expect)) {
9639
- return expect.indexOf(actual) === -1;
9674
+ return !expect.includes(actual);
9640
9675
  }
9641
9676
  else {
9642
9677
  return expect !== actual;
@@ -9715,7 +9750,7 @@ var Vue = (function () {
9715
9750
  extend(map, {
9716
9751
  // needed by many libs / render fns
9717
9752
  $vnode: i => i.vnode,
9718
- // inject addtional properties into $options for compat
9753
+ // inject additional properties into $options for compat
9719
9754
  // e.g. vuex needs this.$options.parent
9720
9755
  $options: i => {
9721
9756
  const res = extend({}, resolveMergedOptions(i));
@@ -10443,7 +10478,7 @@ var Vue = (function () {
10443
10478
  * instance properties when it is accessed by a parent component via template
10444
10479
  * refs.
10445
10480
  *
10446
- * `<script setup>` components are closed by default - i.e. varaibles inside
10481
+ * `<script setup>` components are closed by default - i.e. variables inside
10447
10482
  * the `<script setup>` scope is not exposed to parent unless explicitly exposed
10448
10483
  * via `defineExpose`.
10449
10484
  *
@@ -10641,7 +10676,7 @@ var Vue = (function () {
10641
10676
  return [
10642
10677
  'div',
10643
10678
  {},
10644
- ['span', vueStyle, 'Reactive'],
10679
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReactive' : 'Reactive'],
10645
10680
  '<',
10646
10681
  formatValue(obj),
10647
10682
  `>${isReadonly(obj) ? ` (readonly)` : ``}`
@@ -10651,7 +10686,7 @@ var Vue = (function () {
10651
10686
  return [
10652
10687
  'div',
10653
10688
  {},
10654
- ['span', vueStyle, 'Readonly'],
10689
+ ['span', vueStyle, isShallow(obj) ? 'ShallowReadonly' : 'Readonly'],
10655
10690
  '<',
10656
10691
  formatValue(obj),
10657
10692
  '>'
@@ -10780,7 +10815,7 @@ var Vue = (function () {
10780
10815
  }
10781
10816
  }
10782
10817
  function genRefFlag(v) {
10783
- if (v._shallow) {
10818
+ if (isShallow(v)) {
10784
10819
  return `ShallowRef`;
10785
10820
  }
10786
10821
  if (v.effect) {
@@ -10824,7 +10859,7 @@ var Vue = (function () {
10824
10859
  }
10825
10860
 
10826
10861
  // Core API ------------------------------------------------------------------
10827
- const version = "3.2.27";
10862
+ const version = "3.2.28";
10828
10863
  /**
10829
10864
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10830
10865
  * @internal
@@ -11255,7 +11290,7 @@ var Vue = (function () {
11255
11290
  originalStop.call(e);
11256
11291
  e._stopped = true;
11257
11292
  };
11258
- return value.map(fn => (e) => !e._stopped && fn(e));
11293
+ return value.map(fn => (e) => !e._stopped && fn && fn(e));
11259
11294
  }
11260
11295
  else {
11261
11296
  return value;
@@ -12617,6 +12652,7 @@ var Vue = (function () {
12617
12652
  isProxy: isProxy,
12618
12653
  isReactive: isReactive,
12619
12654
  isReadonly: isReadonly,
12655
+ isShallow: isShallow,
12620
12656
  customRef: customRef,
12621
12657
  triggerRef: triggerRef,
12622
12658
  shallowRef: shallowRef,