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.
@@ -533,10 +533,17 @@ class ReactiveEffect {
533
533
  activeEffect = this.parent;
534
534
  shouldTrack = lastShouldTrack;
535
535
  this.parent = undefined;
536
+ if (this.deferStop) {
537
+ this.stop();
538
+ }
536
539
  }
537
540
  }
538
541
  stop() {
539
- if (this.active) {
542
+ // stopped while running itself - defer the cleanup
543
+ if (activeEffect === this) {
544
+ this.deferStop = true;
545
+ }
546
+ else if (this.active) {
540
547
  cleanupEffect(this);
541
548
  if (this.onStop) {
542
549
  this.onStop();
@@ -711,7 +718,9 @@ function triggerEffects(dep, debuggerEventExtraInfo) {
711
718
  }
712
719
 
713
720
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
714
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
721
+ const builtInSymbols = new Set(
722
+ /*#__PURE__*/
723
+ Object.getOwnPropertyNames(Symbol)
715
724
  .map(key => Symbol[key])
716
725
  .filter(isSymbol));
717
726
  const get = /*#__PURE__*/ createGetter();
@@ -863,13 +872,13 @@ const readonlyHandlers = {
863
872
  get: readonlyGet,
864
873
  set(target, key) {
865
874
  {
866
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
875
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
867
876
  }
868
877
  return true;
869
878
  },
870
879
  deleteProperty(target, key) {
871
880
  {
872
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
881
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
873
882
  }
874
883
  return true;
875
884
  }
@@ -1697,7 +1706,7 @@ let preFlushIndex = 0;
1697
1706
  const pendingPostFlushCbs = [];
1698
1707
  let activePostFlushCbs = null;
1699
1708
  let postFlushIndex = 0;
1700
- const resolvedPromise = Promise.resolve();
1709
+ const resolvedPromise = /*#__PURE__*/ Promise.resolve();
1701
1710
  let currentFlushPromise = null;
1702
1711
  let currentPreFlushParentJob = null;
1703
1712
  const RECURSION_LIMIT = 100;
@@ -2113,6 +2122,8 @@ function devtoolsComponentEmit(component, event, params) {
2113
2122
  }
2114
2123
 
2115
2124
  function emit$1(instance, event, ...rawArgs) {
2125
+ if (instance.isUnmounted)
2126
+ return;
2116
2127
  const props = instance.vnode.props || EMPTY_OBJ;
2117
2128
  {
2118
2129
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -3389,10 +3400,22 @@ const BaseTransitionImpl = {
3389
3400
  if (!children || !children.length) {
3390
3401
  return;
3391
3402
  }
3392
- // warn multiple elements
3403
+ let child = children[0];
3393
3404
  if (children.length > 1) {
3394
- warn$1('<transition> can only be used on a single element or component. Use ' +
3395
- '<transition-group> for lists.');
3405
+ let hasFound = false;
3406
+ // locate first non-comment child
3407
+ for (const c of children) {
3408
+ if (c.type !== Comment) {
3409
+ if (hasFound) {
3410
+ // warn more than one non-comment child
3411
+ warn$1('<transition> can only be used on a single element or component. ' +
3412
+ 'Use <transition-group> for lists.');
3413
+ break;
3414
+ }
3415
+ child = c;
3416
+ hasFound = true;
3417
+ }
3418
+ }
3396
3419
  }
3397
3420
  // there's no need to track reactivity for these props so use the raw
3398
3421
  // props for a bit better perf
@@ -3405,8 +3428,6 @@ const BaseTransitionImpl = {
3405
3428
  mode !== 'default') {
3406
3429
  warn$1(`invalid <transition> mode: ${mode}`);
3407
3430
  }
3408
- // at this point children has a guaranteed length of 1.
3409
- const child = children[0];
3410
3431
  if (state.isLeaving) {
3411
3432
  return emptyPlaceholder(child);
3412
3433
  }
@@ -6928,7 +6949,22 @@ function baseCreateRenderer(options, createHydrationFns) {
6928
6949
  const remove = vnode => {
6929
6950
  const { type, el, anchor, transition } = vnode;
6930
6951
  if (type === Fragment) {
6931
- removeFragment(el, anchor);
6952
+ if (vnode.patchFlag > 0 &&
6953
+ vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
6954
+ transition &&
6955
+ !transition.persisted) {
6956
+ vnode.children.forEach(child => {
6957
+ if (child.type === Comment) {
6958
+ hostRemove(child.el);
6959
+ }
6960
+ else {
6961
+ remove(child);
6962
+ }
6963
+ });
6964
+ }
6965
+ else {
6966
+ removeFragment(el, anchor);
6967
+ }
6932
6968
  return;
6933
6969
  }
6934
6970
  if (type === Static) {
@@ -7947,7 +7983,10 @@ function renderSlot(slots, name, props = {},
7947
7983
  // this is not a user-facing function, so the fallback is always generated by
7948
7984
  // the compiler and guaranteed to be a function returning an array
7949
7985
  fallback, noSlotted) {
7950
- if (currentRenderingInstance.isCE) {
7986
+ if (currentRenderingInstance.isCE ||
7987
+ (currentRenderingInstance.parent &&
7988
+ isAsyncWrapper(currentRenderingInstance.parent) &&
7989
+ currentRenderingInstance.parent.isCE)) {
7951
7990
  return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
7952
7991
  }
7953
7992
  let slot = slots[name];
@@ -8020,7 +8059,10 @@ const getPublicInstance = (i) => {
8020
8059
  return getExposeProxy(i) || i.proxy;
8021
8060
  return getPublicInstance(i.parent);
8022
8061
  };
8023
- const publicPropertiesMap = extend(Object.create(null), {
8062
+ const publicPropertiesMap =
8063
+ // Move PURE marker to new line to workaround compiler discarding it
8064
+ // due to type annotation
8065
+ /*#__PURE__*/ extend(Object.create(null), {
8024
8066
  $: i => i,
8025
8067
  $el: i => i.vnode.el,
8026
8068
  $data: i => i.data,
@@ -8190,7 +8232,7 @@ const PublicInstanceProxyHandlers = {
8190
8232
  defineProperty(target, key, descriptor) {
8191
8233
  if (descriptor.get != null) {
8192
8234
  // invalidate key cache of a getter based property #5417
8193
- target.$.accessCache[key] = 0;
8235
+ target._.accessCache[key] = 0;
8194
8236
  }
8195
8237
  else if (hasOwn(descriptor, 'value')) {
8196
8238
  this.set(target, key, descriptor.value, null);
@@ -8398,6 +8440,7 @@ function setupComponent(instance, isSSR = false) {
8398
8440
  return setupResult;
8399
8441
  }
8400
8442
  function setupStatefulComponent(instance, isSSR) {
8443
+ var _a;
8401
8444
  const Component = instance.type;
8402
8445
  {
8403
8446
  if (Component.name) {
@@ -8455,6 +8498,13 @@ function setupStatefulComponent(instance, isSSR) {
8455
8498
  // async setup returned Promise.
8456
8499
  // bail here and wait for re-entry.
8457
8500
  instance.asyncDep = setupResult;
8501
+ if (!instance.suspense) {
8502
+ const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
8503
+ warn$1(`Component <${name}>: setup function returned a promise, but no ` +
8504
+ `<Suspense> boundary was found in the parent component tree. ` +
8505
+ `A component with async setup() must be nested in a <Suspense> ` +
8506
+ `in order to be rendered.`);
8507
+ }
8458
8508
  }
8459
8509
  }
8460
8510
  else {
@@ -9071,7 +9121,7 @@ function isMemoSame(cached, memo) {
9071
9121
  }
9072
9122
 
9073
9123
  // Core API ------------------------------------------------------------------
9074
- const version = "3.2.32";
9124
+ const version = "3.2.33";
9075
9125
  /**
9076
9126
  * SSR utils for \@vue/server-renderer. Only exposed in cjs builds.
9077
9127
  * @internal
@@ -9088,7 +9138,7 @@ const compatUtils = (null);
9088
9138
 
9089
9139
  const svgNS = 'http://www.w3.org/2000/svg';
9090
9140
  const doc = (typeof document !== 'undefined' ? document : null);
9091
- const templateContainer = doc && doc.createElement('template');
9141
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
9092
9142
  const nodeOps = {
9093
9143
  insert: (child, parent, anchor) => {
9094
9144
  parent.insertBefore(child, anchor || null);
@@ -9239,6 +9289,8 @@ function setStyle(style, name, val) {
9239
9289
  val.forEach(v => setStyle(style, name, v));
9240
9290
  }
9241
9291
  else {
9292
+ if (val == null)
9293
+ val = '';
9242
9294
  if (name.startsWith('--')) {
9243
9295
  // custom property definition
9244
9296
  style.setProperty(name, val);
@@ -9333,31 +9385,28 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
9333
9385
  }
9334
9386
  return;
9335
9387
  }
9388
+ let needRemove = false;
9336
9389
  if (value === '' || value == null) {
9337
9390
  const type = typeof el[key];
9338
9391
  if (type === 'boolean') {
9339
9392
  // e.g. <select multiple> compiles to { multiple: '' }
9340
- el[key] = includeBooleanAttr(value);
9341
- return;
9393
+ value = includeBooleanAttr(value);
9342
9394
  }
9343
9395
  else if (value == null && type === 'string') {
9344
9396
  // e.g. <div :id="null">
9345
- el[key] = '';
9346
- el.removeAttribute(key);
9347
- return;
9397
+ value = '';
9398
+ needRemove = true;
9348
9399
  }
9349
9400
  else if (type === 'number') {
9350
9401
  // e.g. <img :width="null">
9351
9402
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
9352
- try {
9353
- el[key] = 0;
9354
- }
9355
- catch (_a) { }
9356
- el.removeAttribute(key);
9357
- return;
9403
+ value = 0;
9404
+ needRemove = true;
9358
9405
  }
9359
9406
  }
9360
- // some properties perform value validation and throw
9407
+ // some properties perform value validation and throw,
9408
+ // some properties has getter, no setter, will error in 'use strict'
9409
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
9361
9410
  try {
9362
9411
  el[key] = value;
9363
9412
  }
@@ -9367,31 +9416,35 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
9367
9416
  `value ${value} is invalid.`, e);
9368
9417
  }
9369
9418
  }
9419
+ needRemove && el.removeAttribute(key);
9370
9420
  }
9371
9421
 
9372
9422
  // Async edge case fix requires storing an event listener's attach timestamp.
9373
- let _getNow = Date.now;
9374
- let skipTimestampCheck = false;
9375
- if (typeof window !== 'undefined') {
9376
- // Determine what event timestamp the browser is using. Annoyingly, the
9377
- // timestamp can either be hi-res (relative to page load) or low-res
9378
- // (relative to UNIX epoch), so in order to compare time we have to use the
9379
- // same timestamp type when saving the flush timestamp.
9380
- if (_getNow() > document.createEvent('Event').timeStamp) {
9381
- // if the low-res timestamp which is bigger than the event timestamp
9382
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9383
- // and we need to use the hi-res version for event listeners as well.
9384
- _getNow = () => performance.now();
9385
- }
9386
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9387
- // and does not fire microtasks in between event propagation, so safe to exclude.
9388
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9389
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9390
- }
9423
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
9424
+ let _getNow = Date.now;
9425
+ let skipTimestampCheck = false;
9426
+ if (typeof window !== 'undefined') {
9427
+ // Determine what event timestamp the browser is using. Annoyingly, the
9428
+ // timestamp can either be hi-res (relative to page load) or low-res
9429
+ // (relative to UNIX epoch), so in order to compare time we have to use the
9430
+ // same timestamp type when saving the flush timestamp.
9431
+ if (Date.now() > document.createEvent('Event').timeStamp) {
9432
+ // if the low-res timestamp which is bigger than the event timestamp
9433
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
9434
+ // and we need to use the hi-res version for event listeners as well.
9435
+ _getNow = () => performance.now();
9436
+ }
9437
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
9438
+ // and does not fire microtasks in between event propagation, so safe to exclude.
9439
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
9440
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
9441
+ }
9442
+ return [_getNow, skipTimestampCheck];
9443
+ })();
9391
9444
  // To avoid the overhead of repeatedly calling performance.now(), we cache
9392
9445
  // and use the same timestamp for all event listeners attached in the same tick.
9393
9446
  let cachedNow = 0;
9394
- const p = Promise.resolve();
9447
+ const p = /*#__PURE__*/ Promise.resolve();
9395
9448
  const reset = () => {
9396
9449
  cachedNow = 0;
9397
9450
  };
@@ -9516,13 +9569,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
9516
9569
  }
9517
9570
  return false;
9518
9571
  }
9519
- // spellcheck and draggable are numerated attrs, however their
9520
- // corresponding DOM properties are actually booleans - this leads to
9521
- // setting it with a string "false" value leading it to be coerced to
9522
- // `true`, so we need to always treat them as attributes.
9572
+ // these are enumerated attrs, however their corresponding DOM properties
9573
+ // are actually booleans - this leads to setting it with a string "false"
9574
+ // value leading it to be coerced to `true`, so we need to always treat
9575
+ // them as attributes.
9523
9576
  // Note that `contentEditable` doesn't have this problem: its DOM
9524
9577
  // property is also enumerated string values.
9525
- if (key === 'spellcheck' || key === 'draggable') {
9578
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
9526
9579
  return false;
9527
9580
  }
9528
9581
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -10589,7 +10642,7 @@ function setDisplay(el, value) {
10589
10642
  el.style.display = value ? el._vod : 'none';
10590
10643
  }
10591
10644
 
10592
- const rendererOptions = extend({ patchProp }, nodeOps);
10645
+ const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
10593
10646
  // lazy create the renderer - this makes core renderer logic tree-shakable
10594
10647
  // in case the user only imports reactivity utilities from Vue.
10595
10648
  let renderer;