vue 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 (exports) {
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 (exports) {
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 (exports) {
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 (exports) {
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;
@@ -2194,6 +2203,8 @@ var Vue = (function (exports) {
2194
2203
  }
2195
2204
 
2196
2205
  function emit$1(instance, event, ...rawArgs) {
2206
+ if (instance.isUnmounted)
2207
+ return;
2197
2208
  const props = instance.vnode.props || EMPTY_OBJ;
2198
2209
  {
2199
2210
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -3470,10 +3481,22 @@ var Vue = (function (exports) {
3470
3481
  if (!children || !children.length) {
3471
3482
  return;
3472
3483
  }
3473
- // warn multiple elements
3484
+ let child = children[0];
3474
3485
  if (children.length > 1) {
3475
- warn$1('<transition> can only be used on a single element or component. Use ' +
3476
- '<transition-group> for lists.');
3486
+ let hasFound = false;
3487
+ // locate first non-comment child
3488
+ for (const c of children) {
3489
+ if (c.type !== Comment) {
3490
+ if (hasFound) {
3491
+ // warn more than one non-comment child
3492
+ warn$1('<transition> can only be used on a single element or component. ' +
3493
+ 'Use <transition-group> for lists.');
3494
+ break;
3495
+ }
3496
+ child = c;
3497
+ hasFound = true;
3498
+ }
3499
+ }
3477
3500
  }
3478
3501
  // there's no need to track reactivity for these props so use the raw
3479
3502
  // props for a bit better perf
@@ -3486,8 +3509,6 @@ var Vue = (function (exports) {
3486
3509
  mode !== 'default') {
3487
3510
  warn$1(`invalid <transition> mode: ${mode}`);
3488
3511
  }
3489
- // at this point children has a guaranteed length of 1.
3490
- const child = children[0];
3491
3512
  if (state.isLeaving) {
3492
3513
  return emptyPlaceholder(child);
3493
3514
  }
@@ -7009,7 +7030,22 @@ var Vue = (function (exports) {
7009
7030
  const remove = vnode => {
7010
7031
  const { type, el, anchor, transition } = vnode;
7011
7032
  if (type === Fragment) {
7012
- removeFragment(el, anchor);
7033
+ if (vnode.patchFlag > 0 &&
7034
+ vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
7035
+ transition &&
7036
+ !transition.persisted) {
7037
+ vnode.children.forEach(child => {
7038
+ if (child.type === Comment) {
7039
+ hostRemove(child.el);
7040
+ }
7041
+ else {
7042
+ remove(child);
7043
+ }
7044
+ });
7045
+ }
7046
+ else {
7047
+ removeFragment(el, anchor);
7048
+ }
7013
7049
  return;
7014
7050
  }
7015
7051
  if (type === Static) {
@@ -8028,7 +8064,10 @@ var Vue = (function (exports) {
8028
8064
  // this is not a user-facing function, so the fallback is always generated by
8029
8065
  // the compiler and guaranteed to be a function returning an array
8030
8066
  fallback, noSlotted) {
8031
- if (currentRenderingInstance.isCE) {
8067
+ if (currentRenderingInstance.isCE ||
8068
+ (currentRenderingInstance.parent &&
8069
+ isAsyncWrapper(currentRenderingInstance.parent) &&
8070
+ currentRenderingInstance.parent.isCE)) {
8032
8071
  return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
8033
8072
  }
8034
8073
  let slot = slots[name];
@@ -8101,7 +8140,10 @@ var Vue = (function (exports) {
8101
8140
  return getExposeProxy(i) || i.proxy;
8102
8141
  return getPublicInstance(i.parent);
8103
8142
  };
8104
- const publicPropertiesMap = extend(Object.create(null), {
8143
+ const publicPropertiesMap =
8144
+ // Move PURE marker to new line to workaround compiler discarding it
8145
+ // due to type annotation
8146
+ /*#__PURE__*/ extend(Object.create(null), {
8105
8147
  $: i => i,
8106
8148
  $el: i => i.vnode.el,
8107
8149
  $data: i => i.data,
@@ -8271,7 +8313,7 @@ var Vue = (function (exports) {
8271
8313
  defineProperty(target, key, descriptor) {
8272
8314
  if (descriptor.get != null) {
8273
8315
  // invalidate key cache of a getter based property #5417
8274
- target.$.accessCache[key] = 0;
8316
+ target._.accessCache[key] = 0;
8275
8317
  }
8276
8318
  else if (hasOwn(descriptor, 'value')) {
8277
8319
  this.set(target, key, descriptor.value, null);
@@ -8479,6 +8521,7 @@ var Vue = (function (exports) {
8479
8521
  return setupResult;
8480
8522
  }
8481
8523
  function setupStatefulComponent(instance, isSSR) {
8524
+ var _a;
8482
8525
  const Component = instance.type;
8483
8526
  {
8484
8527
  if (Component.name) {
@@ -8536,6 +8579,13 @@ var Vue = (function (exports) {
8536
8579
  // async setup returned Promise.
8537
8580
  // bail here and wait for re-entry.
8538
8581
  instance.asyncDep = setupResult;
8582
+ if (!instance.suspense) {
8583
+ const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
8584
+ warn$1(`Component <${name}>: setup function returned a promise, but no ` +
8585
+ `<Suspense> boundary was found in the parent component tree. ` +
8586
+ `A component with async setup() must be nested in a <Suspense> ` +
8587
+ `in order to be rendered.`);
8588
+ }
8539
8589
  }
8540
8590
  }
8541
8591
  else {
@@ -9147,7 +9197,7 @@ var Vue = (function (exports) {
9147
9197
  }
9148
9198
 
9149
9199
  // Core API ------------------------------------------------------------------
9150
- const version = "3.2.32";
9200
+ const version = "3.2.33";
9151
9201
  /**
9152
9202
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9153
9203
  * @internal
@@ -9164,7 +9214,7 @@ var Vue = (function (exports) {
9164
9214
 
9165
9215
  const svgNS = 'http://www.w3.org/2000/svg';
9166
9216
  const doc = (typeof document !== 'undefined' ? document : null);
9167
- const templateContainer = doc && doc.createElement('template');
9217
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
9168
9218
  const nodeOps = {
9169
9219
  insert: (child, parent, anchor) => {
9170
9220
  parent.insertBefore(child, anchor || null);
@@ -9315,6 +9365,8 @@ var Vue = (function (exports) {
9315
9365
  val.forEach(v => setStyle(style, name, v));
9316
9366
  }
9317
9367
  else {
9368
+ if (val == null)
9369
+ val = '';
9318
9370
  if (name.startsWith('--')) {
9319
9371
  // custom property definition
9320
9372
  style.setProperty(name, val);
@@ -9409,31 +9461,28 @@ var Vue = (function (exports) {
9409
9461
  }
9410
9462
  return;
9411
9463
  }
9464
+ let needRemove = false;
9412
9465
  if (value === '' || value == null) {
9413
9466
  const type = typeof el[key];
9414
9467
  if (type === 'boolean') {
9415
9468
  // e.g. <select multiple> compiles to { multiple: '' }
9416
- el[key] = includeBooleanAttr(value);
9417
- return;
9469
+ value = includeBooleanAttr(value);
9418
9470
  }
9419
9471
  else if (value == null && type === 'string') {
9420
9472
  // e.g. <div :id="null">
9421
- el[key] = '';
9422
- el.removeAttribute(key);
9423
- return;
9473
+ value = '';
9474
+ needRemove = true;
9424
9475
  }
9425
9476
  else if (type === 'number') {
9426
9477
  // e.g. <img :width="null">
9427
9478
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
9428
- try {
9429
- el[key] = 0;
9430
- }
9431
- catch (_a) { }
9432
- el.removeAttribute(key);
9433
- return;
9479
+ value = 0;
9480
+ needRemove = true;
9434
9481
  }
9435
9482
  }
9436
- // some properties perform value validation and throw
9483
+ // some properties perform value validation and throw,
9484
+ // some properties has getter, no setter, will error in 'use strict'
9485
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
9437
9486
  try {
9438
9487
  el[key] = value;
9439
9488
  }
@@ -9443,31 +9492,35 @@ var Vue = (function (exports) {
9443
9492
  `value ${value} is invalid.`, e);
9444
9493
  }
9445
9494
  }
9495
+ needRemove && el.removeAttribute(key);
9446
9496
  }
9447
9497
 
9448
9498
  // Async edge case fix requires storing an event listener's attach timestamp.
9449
- let _getNow = Date.now;
9450
- let skipTimestampCheck = false;
9451
- if (typeof window !== 'undefined') {
9452
- // Determine what event timestamp the browser is using. Annoyingly, the
9453
- // timestamp can either be hi-res (relative to page load) or low-res
9454
- // (relative to UNIX epoch), so in order to compare time we have to use the
9455
- // same timestamp type when saving the flush timestamp.
9456
- if (_getNow() > document.createEvent('Event').timeStamp) {
9457
- // if the low-res timestamp which is bigger than the event timestamp
9458
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9459
- // and we need to use the hi-res version for event listeners as well.
9460
- _getNow = () => performance.now();
9461
- }
9462
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9463
- // and does not fire microtasks in between event propagation, so safe to exclude.
9464
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9465
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9466
- }
9499
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
9500
+ let _getNow = Date.now;
9501
+ let skipTimestampCheck = false;
9502
+ if (typeof window !== 'undefined') {
9503
+ // Determine what event timestamp the browser is using. Annoyingly, the
9504
+ // timestamp can either be hi-res (relative to page load) or low-res
9505
+ // (relative to UNIX epoch), so in order to compare time we have to use the
9506
+ // same timestamp type when saving the flush timestamp.
9507
+ if (Date.now() > document.createEvent('Event').timeStamp) {
9508
+ // if the low-res timestamp which is bigger than the event timestamp
9509
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9510
+ // and we need to use the hi-res version for event listeners as well.
9511
+ _getNow = () => performance.now();
9512
+ }
9513
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9514
+ // and does not fire microtasks in between event propagation, so safe to exclude.
9515
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9516
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9517
+ }
9518
+ return [_getNow, skipTimestampCheck];
9519
+ })();
9467
9520
  // To avoid the overhead of repeatedly calling performance.now(), we cache
9468
9521
  // and use the same timestamp for all event listeners attached in the same tick.
9469
9522
  let cachedNow = 0;
9470
- const p = Promise.resolve();
9523
+ const p = /*#__PURE__*/ Promise.resolve();
9471
9524
  const reset = () => {
9472
9525
  cachedNow = 0;
9473
9526
  };
@@ -9592,13 +9645,13 @@ var Vue = (function (exports) {
9592
9645
  }
9593
9646
  return false;
9594
9647
  }
9595
- // spellcheck and draggable are numerated attrs, however their
9596
- // corresponding DOM properties are actually booleans - this leads to
9597
- // setting it with a string "false" value leading it to be coerced to
9598
- // `true`, so we need to always treat them as attributes.
9648
+ // these are enumerated attrs, however their corresponding DOM properties
9649
+ // are actually booleans - this leads to setting it with a string "false"
9650
+ // value leading it to be coerced to `true`, so we need to always treat
9651
+ // them as attributes.
9599
9652
  // Note that `contentEditable` doesn't have this problem: its DOM
9600
9653
  // property is also enumerated string values.
9601
- if (key === 'spellcheck' || key === 'draggable') {
9654
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
9602
9655
  return false;
9603
9656
  }
9604
9657
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -10653,7 +10706,7 @@ var Vue = (function (exports) {
10653
10706
  el.style.display = value ? el._vod : 'none';
10654
10707
  }
10655
10708
 
10656
- const rendererOptions = extend({ patchProp }, nodeOps);
10709
+ const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
10657
10710
  // lazy create the renderer - this makes core renderer logic tree-shakable
10658
10711
  // in case the user only imports reactivity utilities from Vue.
10659
10712
  let renderer;