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.
@@ -612,10 +612,17 @@ class ReactiveEffect {
612
612
  activeEffect = this.parent;
613
613
  shouldTrack = lastShouldTrack;
614
614
  this.parent = undefined;
615
+ if (this.deferStop) {
616
+ this.stop();
617
+ }
615
618
  }
616
619
  }
617
620
  stop() {
618
- if (this.active) {
621
+ // stopped while running itself - defer the cleanup
622
+ if (activeEffect === this) {
623
+ this.deferStop = true;
624
+ }
625
+ else if (this.active) {
619
626
  cleanupEffect(this);
620
627
  if (this.onStop) {
621
628
  this.onStop();
@@ -790,7 +797,9 @@ function triggerEffects(dep, debuggerEventExtraInfo) {
790
797
  }
791
798
 
792
799
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
793
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
800
+ const builtInSymbols = new Set(
801
+ /*#__PURE__*/
802
+ Object.getOwnPropertyNames(Symbol)
794
803
  .map(key => Symbol[key])
795
804
  .filter(isSymbol));
796
805
  const get = /*#__PURE__*/ createGetter();
@@ -942,13 +951,13 @@ const readonlyHandlers = {
942
951
  get: readonlyGet,
943
952
  set(target, key) {
944
953
  {
945
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
954
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
946
955
  }
947
956
  return true;
948
957
  },
949
958
  deleteProperty(target, key) {
950
959
  {
951
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
960
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
952
961
  }
953
962
  return true;
954
963
  }
@@ -1776,7 +1785,7 @@ let preFlushIndex = 0;
1776
1785
  const pendingPostFlushCbs = [];
1777
1786
  let activePostFlushCbs = null;
1778
1787
  let postFlushIndex = 0;
1779
- const resolvedPromise = Promise.resolve();
1788
+ const resolvedPromise = /*#__PURE__*/ Promise.resolve();
1780
1789
  let currentFlushPromise = null;
1781
1790
  let currentPreFlushParentJob = null;
1782
1791
  const RECURSION_LIMIT = 100;
@@ -2192,6 +2201,8 @@ function devtoolsComponentEmit(component, event, params) {
2192
2201
  }
2193
2202
 
2194
2203
  function emit$1(instance, event, ...rawArgs) {
2204
+ if (instance.isUnmounted)
2205
+ return;
2195
2206
  const props = instance.vnode.props || EMPTY_OBJ;
2196
2207
  {
2197
2208
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -3468,10 +3479,22 @@ const BaseTransitionImpl = {
3468
3479
  if (!children || !children.length) {
3469
3480
  return;
3470
3481
  }
3471
- // warn multiple elements
3482
+ let child = children[0];
3472
3483
  if (children.length > 1) {
3473
- warn$1('<transition> can only be used on a single element or component. Use ' +
3474
- '<transition-group> for lists.');
3484
+ let hasFound = false;
3485
+ // locate first non-comment child
3486
+ for (const c of children) {
3487
+ if (c.type !== Comment) {
3488
+ if (hasFound) {
3489
+ // warn more than one non-comment child
3490
+ warn$1('<transition> can only be used on a single element or component. ' +
3491
+ 'Use <transition-group> for lists.');
3492
+ break;
3493
+ }
3494
+ child = c;
3495
+ hasFound = true;
3496
+ }
3497
+ }
3475
3498
  }
3476
3499
  // there's no need to track reactivity for these props so use the raw
3477
3500
  // props for a bit better perf
@@ -3484,8 +3507,6 @@ const BaseTransitionImpl = {
3484
3507
  mode !== 'default') {
3485
3508
  warn$1(`invalid <transition> mode: ${mode}`);
3486
3509
  }
3487
- // at this point children has a guaranteed length of 1.
3488
- const child = children[0];
3489
3510
  if (state.isLeaving) {
3490
3511
  return emptyPlaceholder(child);
3491
3512
  }
@@ -7007,7 +7028,22 @@ function baseCreateRenderer(options, createHydrationFns) {
7007
7028
  const remove = vnode => {
7008
7029
  const { type, el, anchor, transition } = vnode;
7009
7030
  if (type === Fragment) {
7010
- removeFragment(el, anchor);
7031
+ if (vnode.patchFlag > 0 &&
7032
+ vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
7033
+ transition &&
7034
+ !transition.persisted) {
7035
+ vnode.children.forEach(child => {
7036
+ if (child.type === Comment) {
7037
+ hostRemove(child.el);
7038
+ }
7039
+ else {
7040
+ remove(child);
7041
+ }
7042
+ });
7043
+ }
7044
+ else {
7045
+ removeFragment(el, anchor);
7046
+ }
7011
7047
  return;
7012
7048
  }
7013
7049
  if (type === Static) {
@@ -8026,7 +8062,10 @@ function renderSlot(slots, name, props = {},
8026
8062
  // this is not a user-facing function, so the fallback is always generated by
8027
8063
  // the compiler and guaranteed to be a function returning an array
8028
8064
  fallback, noSlotted) {
8029
- if (currentRenderingInstance.isCE) {
8065
+ if (currentRenderingInstance.isCE ||
8066
+ (currentRenderingInstance.parent &&
8067
+ isAsyncWrapper(currentRenderingInstance.parent) &&
8068
+ currentRenderingInstance.parent.isCE)) {
8030
8069
  return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
8031
8070
  }
8032
8071
  let slot = slots[name];
@@ -8099,7 +8138,10 @@ const getPublicInstance = (i) => {
8099
8138
  return getExposeProxy(i) || i.proxy;
8100
8139
  return getPublicInstance(i.parent);
8101
8140
  };
8102
- const publicPropertiesMap = extend(Object.create(null), {
8141
+ const publicPropertiesMap =
8142
+ // Move PURE marker to new line to workaround compiler discarding it
8143
+ // due to type annotation
8144
+ /*#__PURE__*/ extend(Object.create(null), {
8103
8145
  $: i => i,
8104
8146
  $el: i => i.vnode.el,
8105
8147
  $data: i => i.data,
@@ -8269,7 +8311,7 @@ const PublicInstanceProxyHandlers = {
8269
8311
  defineProperty(target, key, descriptor) {
8270
8312
  if (descriptor.get != null) {
8271
8313
  // invalidate key cache of a getter based property #5417
8272
- target.$.accessCache[key] = 0;
8314
+ target._.accessCache[key] = 0;
8273
8315
  }
8274
8316
  else if (hasOwn(descriptor, 'value')) {
8275
8317
  this.set(target, key, descriptor.value, null);
@@ -8477,6 +8519,7 @@ function setupComponent(instance, isSSR = false) {
8477
8519
  return setupResult;
8478
8520
  }
8479
8521
  function setupStatefulComponent(instance, isSSR) {
8522
+ var _a;
8480
8523
  const Component = instance.type;
8481
8524
  {
8482
8525
  if (Component.name) {
@@ -8534,6 +8577,13 @@ function setupStatefulComponent(instance, isSSR) {
8534
8577
  // async setup returned Promise.
8535
8578
  // bail here and wait for re-entry.
8536
8579
  instance.asyncDep = setupResult;
8580
+ if (!instance.suspense) {
8581
+ const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
8582
+ warn$1(`Component <${name}>: setup function returned a promise, but no ` +
8583
+ `<Suspense> boundary was found in the parent component tree. ` +
8584
+ `A component with async setup() must be nested in a <Suspense> ` +
8585
+ `in order to be rendered.`);
8586
+ }
8537
8587
  }
8538
8588
  }
8539
8589
  else {
@@ -9150,7 +9200,7 @@ function isMemoSame(cached, memo) {
9150
9200
  }
9151
9201
 
9152
9202
  // Core API ------------------------------------------------------------------
9153
- const version = "3.2.32";
9203
+ const version = "3.2.33";
9154
9204
  /**
9155
9205
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9156
9206
  * @internal
@@ -9167,7 +9217,7 @@ const compatUtils = (null);
9167
9217
 
9168
9218
  const svgNS = 'http://www.w3.org/2000/svg';
9169
9219
  const doc = (typeof document !== 'undefined' ? document : null);
9170
- const templateContainer = doc && doc.createElement('template');
9220
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
9171
9221
  const nodeOps = {
9172
9222
  insert: (child, parent, anchor) => {
9173
9223
  parent.insertBefore(child, anchor || null);
@@ -9318,6 +9368,8 @@ function setStyle(style, name, val) {
9318
9368
  val.forEach(v => setStyle(style, name, v));
9319
9369
  }
9320
9370
  else {
9371
+ if (val == null)
9372
+ val = '';
9321
9373
  if (name.startsWith('--')) {
9322
9374
  // custom property definition
9323
9375
  style.setProperty(name, val);
@@ -9412,31 +9464,28 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
9412
9464
  }
9413
9465
  return;
9414
9466
  }
9467
+ let needRemove = false;
9415
9468
  if (value === '' || value == null) {
9416
9469
  const type = typeof el[key];
9417
9470
  if (type === 'boolean') {
9418
9471
  // e.g. <select multiple> compiles to { multiple: '' }
9419
- el[key] = includeBooleanAttr(value);
9420
- return;
9472
+ value = includeBooleanAttr(value);
9421
9473
  }
9422
9474
  else if (value == null && type === 'string') {
9423
9475
  // e.g. <div :id="null">
9424
- el[key] = '';
9425
- el.removeAttribute(key);
9426
- return;
9476
+ value = '';
9477
+ needRemove = true;
9427
9478
  }
9428
9479
  else if (type === 'number') {
9429
9480
  // e.g. <img :width="null">
9430
9481
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
9431
- try {
9432
- el[key] = 0;
9433
- }
9434
- catch (_a) { }
9435
- el.removeAttribute(key);
9436
- return;
9482
+ value = 0;
9483
+ needRemove = true;
9437
9484
  }
9438
9485
  }
9439
- // some properties perform value validation and throw
9486
+ // some properties perform value validation and throw,
9487
+ // some properties has getter, no setter, will error in 'use strict'
9488
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
9440
9489
  try {
9441
9490
  el[key] = value;
9442
9491
  }
@@ -9446,31 +9495,35 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
9446
9495
  `value ${value} is invalid.`, e);
9447
9496
  }
9448
9497
  }
9498
+ needRemove && el.removeAttribute(key);
9449
9499
  }
9450
9500
 
9451
9501
  // Async edge case fix requires storing an event listener's attach timestamp.
9452
- let _getNow = Date.now;
9453
- let skipTimestampCheck = false;
9454
- if (typeof window !== 'undefined') {
9455
- // Determine what event timestamp the browser is using. Annoyingly, the
9456
- // timestamp can either be hi-res (relative to page load) or low-res
9457
- // (relative to UNIX epoch), so in order to compare time we have to use the
9458
- // same timestamp type when saving the flush timestamp.
9459
- if (_getNow() > document.createEvent('Event').timeStamp) {
9460
- // if the low-res timestamp which is bigger than the event timestamp
9461
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9462
- // and we need to use the hi-res version for event listeners as well.
9463
- _getNow = () => performance.now();
9464
- }
9465
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9466
- // and does not fire microtasks in between event propagation, so safe to exclude.
9467
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9468
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9469
- }
9502
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
9503
+ let _getNow = Date.now;
9504
+ let skipTimestampCheck = false;
9505
+ if (typeof window !== 'undefined') {
9506
+ // Determine what event timestamp the browser is using. Annoyingly, the
9507
+ // timestamp can either be hi-res (relative to page load) or low-res
9508
+ // (relative to UNIX epoch), so in order to compare time we have to use the
9509
+ // same timestamp type when saving the flush timestamp.
9510
+ if (Date.now() > document.createEvent('Event').timeStamp) {
9511
+ // if the low-res timestamp which is bigger than the event timestamp
9512
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9513
+ // and we need to use the hi-res version for event listeners as well.
9514
+ _getNow = () => performance.now();
9515
+ }
9516
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9517
+ // and does not fire microtasks in between event propagation, so safe to exclude.
9518
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9519
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9520
+ }
9521
+ return [_getNow, skipTimestampCheck];
9522
+ })();
9470
9523
  // To avoid the overhead of repeatedly calling performance.now(), we cache
9471
9524
  // and use the same timestamp for all event listeners attached in the same tick.
9472
9525
  let cachedNow = 0;
9473
- const p = Promise.resolve();
9526
+ const p = /*#__PURE__*/ Promise.resolve();
9474
9527
  const reset = () => {
9475
9528
  cachedNow = 0;
9476
9529
  };
@@ -9595,13 +9648,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
9595
9648
  }
9596
9649
  return false;
9597
9650
  }
9598
- // spellcheck and draggable are numerated attrs, however their
9599
- // corresponding DOM properties are actually booleans - this leads to
9600
- // setting it with a string "false" value leading it to be coerced to
9601
- // `true`, so we need to always treat them as attributes.
9651
+ // these are enumerated attrs, however their corresponding DOM properties
9652
+ // are actually booleans - this leads to setting it with a string "false"
9653
+ // value leading it to be coerced to `true`, so we need to always treat
9654
+ // them as attributes.
9602
9655
  // Note that `contentEditable` doesn't have this problem: its DOM
9603
9656
  // property is also enumerated string values.
9604
- if (key === 'spellcheck' || key === 'draggable') {
9657
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
9605
9658
  return false;
9606
9659
  }
9607
9660
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -10668,7 +10721,7 @@ function setDisplay(el, value) {
10668
10721
  el.style.display = value ? el._vod : 'none';
10669
10722
  }
10670
10723
 
10671
- const rendererOptions = extend({ patchProp }, nodeOps);
10724
+ const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
10672
10725
  // lazy create the renderer - this makes core renderer logic tree-shakable
10673
10726
  // in case the user only imports reactivity utilities from Vue.
10674
10727
  let renderer;