@vue/compat 3.2.32 → 3.2.33

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.
@@ -615,10 +615,17 @@ var Vue = (function () {
615
615
  activeEffect = this.parent;
616
616
  shouldTrack = lastShouldTrack;
617
617
  this.parent = undefined;
618
+ if (this.deferStop) {
619
+ this.stop();
620
+ }
618
621
  }
619
622
  }
620
623
  stop() {
621
- if (this.active) {
624
+ // stopped while running itself - defer the cleanup
625
+ if (activeEffect === this) {
626
+ this.deferStop = true;
627
+ }
628
+ else if (this.active) {
622
629
  cleanupEffect(this);
623
630
  if (this.onStop) {
624
631
  this.onStop();
@@ -793,7 +800,9 @@ var Vue = (function () {
793
800
  }
794
801
 
795
802
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
796
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
803
+ const builtInSymbols = new Set(
804
+ /*#__PURE__*/
805
+ Object.getOwnPropertyNames(Symbol)
797
806
  .map(key => Symbol[key])
798
807
  .filter(isSymbol));
799
808
  const get = /*#__PURE__*/ createGetter();
@@ -945,13 +954,13 @@ var Vue = (function () {
945
954
  get: readonlyGet,
946
955
  set(target, key) {
947
956
  {
948
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
957
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
949
958
  }
950
959
  return true;
951
960
  },
952
961
  deleteProperty(target, key) {
953
962
  {
954
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
963
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
955
964
  }
956
965
  return true;
957
966
  }
@@ -1779,7 +1788,7 @@ var Vue = (function () {
1779
1788
  const pendingPostFlushCbs = [];
1780
1789
  let activePostFlushCbs = null;
1781
1790
  let postFlushIndex = 0;
1782
- const resolvedPromise = Promise.resolve();
1791
+ const resolvedPromise = /*#__PURE__*/ Promise.resolve();
1783
1792
  let currentFlushPromise = null;
1784
1793
  let currentPreFlushParentJob = null;
1785
1794
  const RECURSION_LIMIT = 100;
@@ -2713,6 +2722,8 @@ var Vue = (function () {
2713
2722
  }
2714
2723
 
2715
2724
  function emit$2(instance, event, ...rawArgs) {
2725
+ if (instance.isUnmounted)
2726
+ return;
2716
2727
  const props = instance.vnode.props || EMPTY_OBJ;
2717
2728
  {
2718
2729
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -4032,10 +4043,22 @@ var Vue = (function () {
4032
4043
  if (!children || !children.length) {
4033
4044
  return;
4034
4045
  }
4035
- // warn multiple elements
4046
+ let child = children[0];
4036
4047
  if (children.length > 1) {
4037
- warn$1('<transition> can only be used on a single element or component. Use ' +
4038
- '<transition-group> for lists.');
4048
+ let hasFound = false;
4049
+ // locate first non-comment child
4050
+ for (const c of children) {
4051
+ if (c.type !== Comment) {
4052
+ if (hasFound) {
4053
+ // warn more than one non-comment child
4054
+ warn$1('<transition> can only be used on a single element or component. ' +
4055
+ 'Use <transition-group> for lists.');
4056
+ break;
4057
+ }
4058
+ child = c;
4059
+ hasFound = true;
4060
+ }
4061
+ }
4039
4062
  }
4040
4063
  // there's no need to track reactivity for these props so use the raw
4041
4064
  // props for a bit better perf
@@ -4048,8 +4071,6 @@ var Vue = (function () {
4048
4071
  mode !== 'default') {
4049
4072
  warn$1(`invalid <transition> mode: ${mode}`);
4050
4073
  }
4051
- // at this point children has a guaranteed length of 1.
4052
- const child = children[0];
4053
4074
  if (state.isLeaving) {
4054
4075
  return emptyPlaceholder(child);
4055
4076
  }
@@ -6060,7 +6081,7 @@ var Vue = (function () {
6060
6081
  return vm;
6061
6082
  }
6062
6083
  }
6063
- Vue.version = `2.6.14-compat:${"3.2.32"}`;
6084
+ Vue.version = `2.6.14-compat:${"3.2.33"}`;
6064
6085
  Vue.config = singletonApp.config;
6065
6086
  Vue.use = (p, ...options) => {
6066
6087
  if (p && isFunction(p.install)) {
@@ -8224,7 +8245,22 @@ var Vue = (function () {
8224
8245
  const remove = vnode => {
8225
8246
  const { type, el, anchor, transition } = vnode;
8226
8247
  if (type === Fragment) {
8227
- removeFragment(el, anchor);
8248
+ if (vnode.patchFlag > 0 &&
8249
+ vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
8250
+ transition &&
8251
+ !transition.persisted) {
8252
+ vnode.children.forEach(child => {
8253
+ if (child.type === Comment) {
8254
+ hostRemove(child.el);
8255
+ }
8256
+ else {
8257
+ remove(child);
8258
+ }
8259
+ });
8260
+ }
8261
+ else {
8262
+ removeFragment(el, anchor);
8263
+ }
8228
8264
  return;
8229
8265
  }
8230
8266
  if (type === Static) {
@@ -9617,7 +9653,10 @@ var Vue = (function () {
9617
9653
  // this is not a user-facing function, so the fallback is always generated by
9618
9654
  // the compiler and guaranteed to be a function returning an array
9619
9655
  fallback, noSlotted) {
9620
- if (currentRenderingInstance.isCE) {
9656
+ if (currentRenderingInstance.isCE ||
9657
+ (currentRenderingInstance.parent &&
9658
+ isAsyncWrapper(currentRenderingInstance.parent) &&
9659
+ currentRenderingInstance.parent.isCE)) {
9621
9660
  return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
9622
9661
  }
9623
9662
  let slot = slots[name];
@@ -9907,7 +9946,10 @@ var Vue = (function () {
9907
9946
  return getExposeProxy(i) || i.proxy;
9908
9947
  return getPublicInstance(i.parent);
9909
9948
  };
9910
- const publicPropertiesMap = extend(Object.create(null), {
9949
+ const publicPropertiesMap =
9950
+ // Move PURE marker to new line to workaround compiler discarding it
9951
+ // due to type annotation
9952
+ /*#__PURE__*/ extend(Object.create(null), {
9911
9953
  $: i => i,
9912
9954
  $el: i => i.vnode.el,
9913
9955
  $data: i => i.data,
@@ -10020,7 +10062,9 @@ var Vue = (function () {
10020
10062
  }
10021
10063
  else {
10022
10064
  const val = globalProperties[key];
10023
- return isFunction(val) ? val.bind(instance.proxy) : val;
10065
+ return isFunction(val)
10066
+ ? Object.assign(val.bind(instance.proxy), val)
10067
+ : val;
10024
10068
  }
10025
10069
  }
10026
10070
  }
@@ -10087,7 +10131,7 @@ var Vue = (function () {
10087
10131
  defineProperty(target, key, descriptor) {
10088
10132
  if (descriptor.get != null) {
10089
10133
  // invalidate key cache of a getter based property #5417
10090
- target.$.accessCache[key] = 0;
10134
+ target._.accessCache[key] = 0;
10091
10135
  }
10092
10136
  else if (hasOwn(descriptor, 'value')) {
10093
10137
  this.set(target, key, descriptor.value, null);
@@ -10295,6 +10339,7 @@ var Vue = (function () {
10295
10339
  return setupResult;
10296
10340
  }
10297
10341
  function setupStatefulComponent(instance, isSSR) {
10342
+ var _a;
10298
10343
  const Component = instance.type;
10299
10344
  {
10300
10345
  if (Component.name) {
@@ -10352,6 +10397,13 @@ var Vue = (function () {
10352
10397
  // async setup returned Promise.
10353
10398
  // bail here and wait for re-entry.
10354
10399
  instance.asyncDep = setupResult;
10400
+ if (!instance.suspense) {
10401
+ const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
10402
+ warn$1(`Component <${name}>: setup function returned a promise, but no ` +
10403
+ `<Suspense> boundary was found in the parent component tree. ` +
10404
+ `A component with async setup() must be nested in a <Suspense> ` +
10405
+ `in order to be rendered.`);
10406
+ }
10355
10407
  }
10356
10408
  }
10357
10409
  else {
@@ -10978,7 +11030,7 @@ var Vue = (function () {
10978
11030
  }
10979
11031
 
10980
11032
  // Core API ------------------------------------------------------------------
10981
- const version = "3.2.32";
11033
+ const version = "3.2.33";
10982
11034
  /**
10983
11035
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10984
11036
  * @internal
@@ -11002,7 +11054,7 @@ var Vue = (function () {
11002
11054
 
11003
11055
  const svgNS = 'http://www.w3.org/2000/svg';
11004
11056
  const doc = (typeof document !== 'undefined' ? document : null);
11005
- const templateContainer = doc && doc.createElement('template');
11057
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
11006
11058
  const nodeOps = {
11007
11059
  insert: (child, parent, anchor) => {
11008
11060
  parent.insertBefore(child, anchor || null);
@@ -11153,6 +11205,8 @@ var Vue = (function () {
11153
11205
  val.forEach(v => setStyle(style, name, v));
11154
11206
  }
11155
11207
  else {
11208
+ if (val == null)
11209
+ val = '';
11156
11210
  if (name.startsWith('--')) {
11157
11211
  // custom property definition
11158
11212
  style.setProperty(name, val);
@@ -11274,41 +11328,39 @@ var Vue = (function () {
11274
11328
  }
11275
11329
  return;
11276
11330
  }
11331
+ let needRemove = false;
11277
11332
  if (value === '' || value == null) {
11278
11333
  const type = typeof el[key];
11279
11334
  if (type === 'boolean') {
11280
11335
  // e.g. <select multiple> compiles to { multiple: '' }
11281
- el[key] = includeBooleanAttr(value);
11282
- return;
11336
+ value = includeBooleanAttr(value);
11283
11337
  }
11284
11338
  else if (value == null && type === 'string') {
11285
11339
  // e.g. <div :id="null">
11286
- el[key] = '';
11287
- el.removeAttribute(key);
11288
- return;
11340
+ value = '';
11341
+ needRemove = true;
11289
11342
  }
11290
11343
  else if (type === 'number') {
11291
11344
  // e.g. <img :width="null">
11292
11345
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
11293
- try {
11294
- el[key] = 0;
11295
- }
11296
- catch (_a) { }
11297
- el.removeAttribute(key);
11298
- return;
11346
+ value = 0;
11347
+ needRemove = true;
11299
11348
  }
11300
11349
  }
11301
- if (value === false &&
11302
- compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
11303
- const type = typeof el[key];
11304
- if (type === 'string' || type === 'number') {
11305
- compatUtils.warnDeprecation("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent, key);
11306
- el[key] = type === 'number' ? 0 : '';
11307
- el.removeAttribute(key);
11308
- return;
11350
+ else {
11351
+ if (value === false &&
11352
+ compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
11353
+ const type = typeof el[key];
11354
+ if (type === 'string' || type === 'number') {
11355
+ compatUtils.warnDeprecation("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent, key);
11356
+ value = type === 'number' ? 0 : '';
11357
+ needRemove = true;
11358
+ }
11309
11359
  }
11310
11360
  }
11311
- // some properties perform value validation and throw
11361
+ // some properties perform value validation and throw,
11362
+ // some properties has getter, no setter, will error in 'use strict'
11363
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
11312
11364
  try {
11313
11365
  el[key] = value;
11314
11366
  }
@@ -11318,31 +11370,35 @@ var Vue = (function () {
11318
11370
  `value ${value} is invalid.`, e);
11319
11371
  }
11320
11372
  }
11373
+ needRemove && el.removeAttribute(key);
11321
11374
  }
11322
11375
 
11323
11376
  // Async edge case fix requires storing an event listener's attach timestamp.
11324
- let _getNow = Date.now;
11325
- let skipTimestampCheck = false;
11326
- if (typeof window !== 'undefined') {
11327
- // Determine what event timestamp the browser is using. Annoyingly, the
11328
- // timestamp can either be hi-res (relative to page load) or low-res
11329
- // (relative to UNIX epoch), so in order to compare time we have to use the
11330
- // same timestamp type when saving the flush timestamp.
11331
- if (_getNow() > document.createEvent('Event').timeStamp) {
11332
- // if the low-res timestamp which is bigger than the event timestamp
11333
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
11334
- // and we need to use the hi-res version for event listeners as well.
11335
- _getNow = () => performance.now();
11336
- }
11337
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
11338
- // and does not fire microtasks in between event propagation, so safe to exclude.
11339
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
11340
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
11341
- }
11377
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
11378
+ let _getNow = Date.now;
11379
+ let skipTimestampCheck = false;
11380
+ if (typeof window !== 'undefined') {
11381
+ // Determine what event timestamp the browser is using. Annoyingly, the
11382
+ // timestamp can either be hi-res (relative to page load) or low-res
11383
+ // (relative to UNIX epoch), so in order to compare time we have to use the
11384
+ // same timestamp type when saving the flush timestamp.
11385
+ if (Date.now() > document.createEvent('Event').timeStamp) {
11386
+ // if the low-res timestamp which is bigger than the event timestamp
11387
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
11388
+ // and we need to use the hi-res version for event listeners as well.
11389
+ _getNow = () => performance.now();
11390
+ }
11391
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
11392
+ // and does not fire microtasks in between event propagation, so safe to exclude.
11393
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
11394
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
11395
+ }
11396
+ return [_getNow, skipTimestampCheck];
11397
+ })();
11342
11398
  // To avoid the overhead of repeatedly calling performance.now(), we cache
11343
11399
  // and use the same timestamp for all event listeners attached in the same tick.
11344
11400
  let cachedNow = 0;
11345
- const p = Promise.resolve();
11401
+ const p = /*#__PURE__*/ Promise.resolve();
11346
11402
  const reset = () => {
11347
11403
  cachedNow = 0;
11348
11404
  };
@@ -11467,13 +11523,13 @@ var Vue = (function () {
11467
11523
  }
11468
11524
  return false;
11469
11525
  }
11470
- // spellcheck and draggable are numerated attrs, however their
11471
- // corresponding DOM properties are actually booleans - this leads to
11472
- // setting it with a string "false" value leading it to be coerced to
11473
- // `true`, so we need to always treat them as attributes.
11526
+ // these are enumerated attrs, however their corresponding DOM properties
11527
+ // are actually booleans - this leads to setting it with a string "false"
11528
+ // value leading it to be coerced to `true`, so we need to always treat
11529
+ // them as attributes.
11474
11530
  // Note that `contentEditable` doesn't have this problem: its DOM
11475
11531
  // property is also enumerated string values.
11476
- if (key === 'spellcheck' || key === 'draggable') {
11532
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
11477
11533
  return false;
11478
11534
  }
11479
11535
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -12603,7 +12659,7 @@ var Vue = (function () {
12603
12659
  el.style.display = value ? el._vod : 'none';
12604
12660
  }
12605
12661
 
12606
- const rendererOptions = extend({ patchProp }, nodeOps);
12662
+ const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
12607
12663
  // lazy create the renderer - this makes core renderer logic tree-shakable
12608
12664
  // in case the user only imports reactivity utilities from Vue.
12609
12665
  let renderer;