@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.
@@ -536,10 +536,17 @@ var Vue = (function () {
536
536
  activeEffect = this.parent;
537
537
  shouldTrack = lastShouldTrack;
538
538
  this.parent = undefined;
539
+ if (this.deferStop) {
540
+ this.stop();
541
+ }
539
542
  }
540
543
  }
541
544
  stop() {
542
- if (this.active) {
545
+ // stopped while running itself - defer the cleanup
546
+ if (activeEffect === this) {
547
+ this.deferStop = true;
548
+ }
549
+ else if (this.active) {
543
550
  cleanupEffect(this);
544
551
  if (this.onStop) {
545
552
  this.onStop();
@@ -714,7 +721,9 @@ var Vue = (function () {
714
721
  }
715
722
 
716
723
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
717
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
724
+ const builtInSymbols = new Set(
725
+ /*#__PURE__*/
726
+ Object.getOwnPropertyNames(Symbol)
718
727
  .map(key => Symbol[key])
719
728
  .filter(isSymbol));
720
729
  const get = /*#__PURE__*/ createGetter();
@@ -866,13 +875,13 @@ var Vue = (function () {
866
875
  get: readonlyGet,
867
876
  set(target, key) {
868
877
  {
869
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
878
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
870
879
  }
871
880
  return true;
872
881
  },
873
882
  deleteProperty(target, key) {
874
883
  {
875
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
884
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
876
885
  }
877
886
  return true;
878
887
  }
@@ -1700,7 +1709,7 @@ var Vue = (function () {
1700
1709
  const pendingPostFlushCbs = [];
1701
1710
  let activePostFlushCbs = null;
1702
1711
  let postFlushIndex = 0;
1703
- const resolvedPromise = Promise.resolve();
1712
+ const resolvedPromise = /*#__PURE__*/ Promise.resolve();
1704
1713
  let currentFlushPromise = null;
1705
1714
  let currentPreFlushParentJob = null;
1706
1715
  const RECURSION_LIMIT = 100;
@@ -2634,6 +2643,8 @@ var Vue = (function () {
2634
2643
  }
2635
2644
 
2636
2645
  function emit$2(instance, event, ...rawArgs) {
2646
+ if (instance.isUnmounted)
2647
+ return;
2637
2648
  const props = instance.vnode.props || EMPTY_OBJ;
2638
2649
  {
2639
2650
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -3953,10 +3964,22 @@ var Vue = (function () {
3953
3964
  if (!children || !children.length) {
3954
3965
  return;
3955
3966
  }
3956
- // warn multiple elements
3967
+ let child = children[0];
3957
3968
  if (children.length > 1) {
3958
- warn$1('<transition> can only be used on a single element or component. Use ' +
3959
- '<transition-group> for lists.');
3969
+ let hasFound = false;
3970
+ // locate first non-comment child
3971
+ for (const c of children) {
3972
+ if (c.type !== Comment) {
3973
+ if (hasFound) {
3974
+ // warn more than one non-comment child
3975
+ warn$1('<transition> can only be used on a single element or component. ' +
3976
+ 'Use <transition-group> for lists.');
3977
+ break;
3978
+ }
3979
+ child = c;
3980
+ hasFound = true;
3981
+ }
3982
+ }
3960
3983
  }
3961
3984
  // there's no need to track reactivity for these props so use the raw
3962
3985
  // props for a bit better perf
@@ -3969,8 +3992,6 @@ var Vue = (function () {
3969
3992
  mode !== 'default') {
3970
3993
  warn$1(`invalid <transition> mode: ${mode}`);
3971
3994
  }
3972
- // at this point children has a guaranteed length of 1.
3973
- const child = children[0];
3974
3995
  if (state.isLeaving) {
3975
3996
  return emptyPlaceholder(child);
3976
3997
  }
@@ -5981,7 +6002,7 @@ var Vue = (function () {
5981
6002
  return vm;
5982
6003
  }
5983
6004
  }
5984
- Vue.version = `2.6.14-compat:${"3.2.32"}`;
6005
+ Vue.version = `2.6.14-compat:${"3.2.33"}`;
5985
6006
  Vue.config = singletonApp.config;
5986
6007
  Vue.use = (p, ...options) => {
5987
6008
  if (p && isFunction(p.install)) {
@@ -8145,7 +8166,22 @@ var Vue = (function () {
8145
8166
  const remove = vnode => {
8146
8167
  const { type, el, anchor, transition } = vnode;
8147
8168
  if (type === Fragment) {
8148
- removeFragment(el, anchor);
8169
+ if (vnode.patchFlag > 0 &&
8170
+ vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
8171
+ transition &&
8172
+ !transition.persisted) {
8173
+ vnode.children.forEach(child => {
8174
+ if (child.type === Comment) {
8175
+ hostRemove(child.el);
8176
+ }
8177
+ else {
8178
+ remove(child);
8179
+ }
8180
+ });
8181
+ }
8182
+ else {
8183
+ removeFragment(el, anchor);
8184
+ }
8149
8185
  return;
8150
8186
  }
8151
8187
  if (type === Static) {
@@ -9538,7 +9574,10 @@ var Vue = (function () {
9538
9574
  // this is not a user-facing function, so the fallback is always generated by
9539
9575
  // the compiler and guaranteed to be a function returning an array
9540
9576
  fallback, noSlotted) {
9541
- if (currentRenderingInstance.isCE) {
9577
+ if (currentRenderingInstance.isCE ||
9578
+ (currentRenderingInstance.parent &&
9579
+ isAsyncWrapper(currentRenderingInstance.parent) &&
9580
+ currentRenderingInstance.parent.isCE)) {
9542
9581
  return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
9543
9582
  }
9544
9583
  let slot = slots[name];
@@ -9828,7 +9867,10 @@ var Vue = (function () {
9828
9867
  return getExposeProxy(i) || i.proxy;
9829
9868
  return getPublicInstance(i.parent);
9830
9869
  };
9831
- const publicPropertiesMap = extend(Object.create(null), {
9870
+ const publicPropertiesMap =
9871
+ // Move PURE marker to new line to workaround compiler discarding it
9872
+ // due to type annotation
9873
+ /*#__PURE__*/ extend(Object.create(null), {
9832
9874
  $: i => i,
9833
9875
  $el: i => i.vnode.el,
9834
9876
  $data: i => i.data,
@@ -9941,7 +9983,9 @@ var Vue = (function () {
9941
9983
  }
9942
9984
  else {
9943
9985
  const val = globalProperties[key];
9944
- return isFunction(val) ? val.bind(instance.proxy) : val;
9986
+ return isFunction(val)
9987
+ ? Object.assign(val.bind(instance.proxy), val)
9988
+ : val;
9945
9989
  }
9946
9990
  }
9947
9991
  }
@@ -10008,7 +10052,7 @@ var Vue = (function () {
10008
10052
  defineProperty(target, key, descriptor) {
10009
10053
  if (descriptor.get != null) {
10010
10054
  // invalidate key cache of a getter based property #5417
10011
- target.$.accessCache[key] = 0;
10055
+ target._.accessCache[key] = 0;
10012
10056
  }
10013
10057
  else if (hasOwn(descriptor, 'value')) {
10014
10058
  this.set(target, key, descriptor.value, null);
@@ -10216,6 +10260,7 @@ var Vue = (function () {
10216
10260
  return setupResult;
10217
10261
  }
10218
10262
  function setupStatefulComponent(instance, isSSR) {
10263
+ var _a;
10219
10264
  const Component = instance.type;
10220
10265
  {
10221
10266
  if (Component.name) {
@@ -10273,6 +10318,13 @@ var Vue = (function () {
10273
10318
  // async setup returned Promise.
10274
10319
  // bail here and wait for re-entry.
10275
10320
  instance.asyncDep = setupResult;
10321
+ if (!instance.suspense) {
10322
+ const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
10323
+ warn$1(`Component <${name}>: setup function returned a promise, but no ` +
10324
+ `<Suspense> boundary was found in the parent component tree. ` +
10325
+ `A component with async setup() must be nested in a <Suspense> ` +
10326
+ `in order to be rendered.`);
10327
+ }
10276
10328
  }
10277
10329
  }
10278
10330
  else {
@@ -10899,7 +10951,7 @@ var Vue = (function () {
10899
10951
  }
10900
10952
 
10901
10953
  // Core API ------------------------------------------------------------------
10902
- const version = "3.2.32";
10954
+ const version = "3.2.33";
10903
10955
  /**
10904
10956
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
10905
10957
  * @internal
@@ -10923,7 +10975,7 @@ var Vue = (function () {
10923
10975
 
10924
10976
  const svgNS = 'http://www.w3.org/2000/svg';
10925
10977
  const doc = (typeof document !== 'undefined' ? document : null);
10926
- const templateContainer = doc && doc.createElement('template');
10978
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
10927
10979
  const nodeOps = {
10928
10980
  insert: (child, parent, anchor) => {
10929
10981
  parent.insertBefore(child, anchor || null);
@@ -11074,6 +11126,8 @@ var Vue = (function () {
11074
11126
  val.forEach(v => setStyle(style, name, v));
11075
11127
  }
11076
11128
  else {
11129
+ if (val == null)
11130
+ val = '';
11077
11131
  if (name.startsWith('--')) {
11078
11132
  // custom property definition
11079
11133
  style.setProperty(name, val);
@@ -11195,41 +11249,39 @@ var Vue = (function () {
11195
11249
  }
11196
11250
  return;
11197
11251
  }
11252
+ let needRemove = false;
11198
11253
  if (value === '' || value == null) {
11199
11254
  const type = typeof el[key];
11200
11255
  if (type === 'boolean') {
11201
11256
  // e.g. <select multiple> compiles to { multiple: '' }
11202
- el[key] = includeBooleanAttr(value);
11203
- return;
11257
+ value = includeBooleanAttr(value);
11204
11258
  }
11205
11259
  else if (value == null && type === 'string') {
11206
11260
  // e.g. <div :id="null">
11207
- el[key] = '';
11208
- el.removeAttribute(key);
11209
- return;
11261
+ value = '';
11262
+ needRemove = true;
11210
11263
  }
11211
11264
  else if (type === 'number') {
11212
11265
  // e.g. <img :width="null">
11213
11266
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
11214
- try {
11215
- el[key] = 0;
11216
- }
11217
- catch (_a) { }
11218
- el.removeAttribute(key);
11219
- return;
11267
+ value = 0;
11268
+ needRemove = true;
11220
11269
  }
11221
11270
  }
11222
- if (value === false &&
11223
- compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
11224
- const type = typeof el[key];
11225
- if (type === 'string' || type === 'number') {
11226
- compatUtils.warnDeprecation("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent, key);
11227
- el[key] = type === 'number' ? 0 : '';
11228
- el.removeAttribute(key);
11229
- return;
11271
+ else {
11272
+ if (value === false &&
11273
+ compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
11274
+ const type = typeof el[key];
11275
+ if (type === 'string' || type === 'number') {
11276
+ compatUtils.warnDeprecation("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent, key);
11277
+ value = type === 'number' ? 0 : '';
11278
+ needRemove = true;
11279
+ }
11230
11280
  }
11231
11281
  }
11232
- // some properties perform value validation and throw
11282
+ // some properties perform value validation and throw,
11283
+ // some properties has getter, no setter, will error in 'use strict'
11284
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
11233
11285
  try {
11234
11286
  el[key] = value;
11235
11287
  }
@@ -11239,31 +11291,35 @@ var Vue = (function () {
11239
11291
  `value ${value} is invalid.`, e);
11240
11292
  }
11241
11293
  }
11294
+ needRemove && el.removeAttribute(key);
11242
11295
  }
11243
11296
 
11244
11297
  // Async edge case fix requires storing an event listener's attach timestamp.
11245
- let _getNow = Date.now;
11246
- let skipTimestampCheck = false;
11247
- if (typeof window !== 'undefined') {
11248
- // Determine what event timestamp the browser is using. Annoyingly, the
11249
- // timestamp can either be hi-res (relative to page load) or low-res
11250
- // (relative to UNIX epoch), so in order to compare time we have to use the
11251
- // same timestamp type when saving the flush timestamp.
11252
- if (_getNow() > document.createEvent('Event').timeStamp) {
11253
- // if the low-res timestamp which is bigger than the event timestamp
11254
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
11255
- // and we need to use the hi-res version for event listeners as well.
11256
- _getNow = () => performance.now();
11257
- }
11258
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
11259
- // and does not fire microtasks in between event propagation, so safe to exclude.
11260
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
11261
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
11262
- }
11298
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
11299
+ let _getNow = Date.now;
11300
+ let skipTimestampCheck = false;
11301
+ if (typeof window !== 'undefined') {
11302
+ // Determine what event timestamp the browser is using. Annoyingly, the
11303
+ // timestamp can either be hi-res (relative to page load) or low-res
11304
+ // (relative to UNIX epoch), so in order to compare time we have to use the
11305
+ // same timestamp type when saving the flush timestamp.
11306
+ if (Date.now() > document.createEvent('Event').timeStamp) {
11307
+ // if the low-res timestamp which is bigger than the event timestamp
11308
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
11309
+ // and we need to use the hi-res version for event listeners as well.
11310
+ _getNow = () => performance.now();
11311
+ }
11312
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
11313
+ // and does not fire microtasks in between event propagation, so safe to exclude.
11314
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
11315
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
11316
+ }
11317
+ return [_getNow, skipTimestampCheck];
11318
+ })();
11263
11319
  // To avoid the overhead of repeatedly calling performance.now(), we cache
11264
11320
  // and use the same timestamp for all event listeners attached in the same tick.
11265
11321
  let cachedNow = 0;
11266
- const p = Promise.resolve();
11322
+ const p = /*#__PURE__*/ Promise.resolve();
11267
11323
  const reset = () => {
11268
11324
  cachedNow = 0;
11269
11325
  };
@@ -11388,13 +11444,13 @@ var Vue = (function () {
11388
11444
  }
11389
11445
  return false;
11390
11446
  }
11391
- // spellcheck and draggable are numerated attrs, however their
11392
- // corresponding DOM properties are actually booleans - this leads to
11393
- // setting it with a string "false" value leading it to be coerced to
11394
- // `true`, so we need to always treat them as attributes.
11447
+ // these are enumerated attrs, however their corresponding DOM properties
11448
+ // are actually booleans - this leads to setting it with a string "false"
11449
+ // value leading it to be coerced to `true`, so we need to always treat
11450
+ // them as attributes.
11395
11451
  // Note that `contentEditable` doesn't have this problem: its DOM
11396
11452
  // property is also enumerated string values.
11397
- if (key === 'spellcheck' || key === 'draggable') {
11453
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
11398
11454
  return false;
11399
11455
  }
11400
11456
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -12524,7 +12580,7 @@ var Vue = (function () {
12524
12580
  el.style.display = value ? el._vod : 'none';
12525
12581
  }
12526
12582
 
12527
- const rendererOptions = extend({ patchProp }, nodeOps);
12583
+ const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
12528
12584
  // lazy create the renderer - this makes core renderer logic tree-shakable
12529
12585
  // in case the user only imports reactivity utilities from Vue.
12530
12586
  let renderer;