@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.
@@ -613,10 +613,17 @@ class ReactiveEffect {
613
613
  activeEffect = this.parent;
614
614
  shouldTrack = lastShouldTrack;
615
615
  this.parent = undefined;
616
+ if (this.deferStop) {
617
+ this.stop();
618
+ }
616
619
  }
617
620
  }
618
621
  stop() {
619
- if (this.active) {
622
+ // stopped while running itself - defer the cleanup
623
+ if (activeEffect === this) {
624
+ this.deferStop = true;
625
+ }
626
+ else if (this.active) {
620
627
  cleanupEffect(this);
621
628
  if (this.onStop) {
622
629
  this.onStop();
@@ -799,7 +806,9 @@ function triggerEffects(dep, debuggerEventExtraInfo) {
799
806
  }
800
807
 
801
808
  const isNonTrackableKeys = /*#__PURE__*/ makeMap(`__proto__,__v_isRef,__isVue`);
802
- const builtInSymbols = new Set(Object.getOwnPropertyNames(Symbol)
809
+ const builtInSymbols = new Set(
810
+ /*#__PURE__*/
811
+ Object.getOwnPropertyNames(Symbol)
803
812
  .map(key => Symbol[key])
804
813
  .filter(isSymbol));
805
814
  const get = /*#__PURE__*/ createGetter();
@@ -951,13 +960,13 @@ const readonlyHandlers = {
951
960
  get: readonlyGet,
952
961
  set(target, key) {
953
962
  if ((process.env.NODE_ENV !== 'production')) {
954
- console.warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
963
+ warn(`Set operation on key "${String(key)}" failed: target is readonly.`, target);
955
964
  }
956
965
  return true;
957
966
  },
958
967
  deleteProperty(target, key) {
959
968
  if ((process.env.NODE_ENV !== 'production')) {
960
- console.warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
969
+ warn(`Delete operation on key "${String(key)}" failed: target is readonly.`, target);
961
970
  }
962
971
  return true;
963
972
  }
@@ -1797,7 +1806,7 @@ let preFlushIndex = 0;
1797
1806
  const pendingPostFlushCbs = [];
1798
1807
  let activePostFlushCbs = null;
1799
1808
  let postFlushIndex = 0;
1800
- const resolvedPromise = Promise.resolve();
1809
+ const resolvedPromise = /*#__PURE__*/ Promise.resolve();
1801
1810
  let currentFlushPromise = null;
1802
1811
  let currentPreFlushParentJob = null;
1803
1812
  const RECURSION_LIMIT = 100;
@@ -2737,6 +2746,8 @@ function compatModelEmit(instance, event, args) {
2737
2746
  }
2738
2747
 
2739
2748
  function emit$2(instance, event, ...rawArgs) {
2749
+ if (instance.isUnmounted)
2750
+ return;
2740
2751
  const props = instance.vnode.props || EMPTY_OBJ;
2741
2752
  if ((process.env.NODE_ENV !== 'production')) {
2742
2753
  const { emitsOptions, propsOptions: [propsOptions] } = instance;
@@ -4076,10 +4087,24 @@ const BaseTransitionImpl = {
4076
4087
  if (!children || !children.length) {
4077
4088
  return;
4078
4089
  }
4079
- // warn multiple elements
4080
- if ((process.env.NODE_ENV !== 'production') && children.length > 1) {
4081
- warn$1('<transition> can only be used on a single element or component. Use ' +
4082
- '<transition-group> for lists.');
4090
+ let child = children[0];
4091
+ if (children.length > 1) {
4092
+ let hasFound = false;
4093
+ // locate first non-comment child
4094
+ for (const c of children) {
4095
+ if (c.type !== Comment) {
4096
+ if ((process.env.NODE_ENV !== 'production') && hasFound) {
4097
+ // warn more than one non-comment child
4098
+ warn$1('<transition> can only be used on a single element or component. ' +
4099
+ 'Use <transition-group> for lists.');
4100
+ break;
4101
+ }
4102
+ child = c;
4103
+ hasFound = true;
4104
+ if (!(process.env.NODE_ENV !== 'production'))
4105
+ break;
4106
+ }
4107
+ }
4083
4108
  }
4084
4109
  // there's no need to track reactivity for these props so use the raw
4085
4110
  // props for a bit better perf
@@ -4093,8 +4118,6 @@ const BaseTransitionImpl = {
4093
4118
  mode !== 'default') {
4094
4119
  warn$1(`invalid <transition> mode: ${mode}`);
4095
4120
  }
4096
- // at this point children has a guaranteed length of 1.
4097
- const child = children[0];
4098
4121
  if (state.isLeaving) {
4099
4122
  return emptyPlaceholder(child);
4100
4123
  }
@@ -6114,7 +6137,7 @@ function createCompatVue(createApp, createSingletonApp) {
6114
6137
  return vm;
6115
6138
  }
6116
6139
  }
6117
- Vue.version = `2.6.14-compat:${"3.2.32"}`;
6140
+ Vue.version = `2.6.14-compat:${"3.2.33"}`;
6118
6141
  Vue.config = singletonApp.config;
6119
6142
  Vue.use = (p, ...options) => {
6120
6143
  if (p && isFunction(p.install)) {
@@ -8329,7 +8352,23 @@ function baseCreateRenderer(options, createHydrationFns) {
8329
8352
  const remove = vnode => {
8330
8353
  const { type, el, anchor, transition } = vnode;
8331
8354
  if (type === Fragment) {
8332
- removeFragment(el, anchor);
8355
+ if ((process.env.NODE_ENV !== 'production') &&
8356
+ vnode.patchFlag > 0 &&
8357
+ vnode.patchFlag & 2048 /* DEV_ROOT_FRAGMENT */ &&
8358
+ transition &&
8359
+ !transition.persisted) {
8360
+ vnode.children.forEach(child => {
8361
+ if (child.type === Comment) {
8362
+ hostRemove(child.el);
8363
+ }
8364
+ else {
8365
+ remove(child);
8366
+ }
8367
+ });
8368
+ }
8369
+ else {
8370
+ removeFragment(el, anchor);
8371
+ }
8333
8372
  return;
8334
8373
  }
8335
8374
  if (type === Static) {
@@ -9727,7 +9766,10 @@ function renderSlot(slots, name, props = {},
9727
9766
  // this is not a user-facing function, so the fallback is always generated by
9728
9767
  // the compiler and guaranteed to be a function returning an array
9729
9768
  fallback, noSlotted) {
9730
- if (currentRenderingInstance.isCE) {
9769
+ if (currentRenderingInstance.isCE ||
9770
+ (currentRenderingInstance.parent &&
9771
+ isAsyncWrapper(currentRenderingInstance.parent) &&
9772
+ currentRenderingInstance.parent.isCE)) {
9731
9773
  return createVNode('slot', name === 'default' ? null : { name }, fallback && fallback());
9732
9774
  }
9733
9775
  let slot = slots[name];
@@ -10017,7 +10059,10 @@ const getPublicInstance = (i) => {
10017
10059
  return getExposeProxy(i) || i.proxy;
10018
10060
  return getPublicInstance(i.parent);
10019
10061
  };
10020
- const publicPropertiesMap = extend(Object.create(null), {
10062
+ const publicPropertiesMap =
10063
+ // Move PURE marker to new line to workaround compiler discarding it
10064
+ // due to type annotation
10065
+ /*#__PURE__*/ extend(Object.create(null), {
10021
10066
  $: i => i,
10022
10067
  $el: i => i.vnode.el,
10023
10068
  $data: i => i.data,
@@ -10131,7 +10176,9 @@ const PublicInstanceProxyHandlers = {
10131
10176
  }
10132
10177
  else {
10133
10178
  const val = globalProperties[key];
10134
- return isFunction(val) ? val.bind(instance.proxy) : val;
10179
+ return isFunction(val)
10180
+ ? Object.assign(val.bind(instance.proxy), val)
10181
+ : val;
10135
10182
  }
10136
10183
  }
10137
10184
  }
@@ -10201,7 +10248,7 @@ const PublicInstanceProxyHandlers = {
10201
10248
  defineProperty(target, key, descriptor) {
10202
10249
  if (descriptor.get != null) {
10203
10250
  // invalidate key cache of a getter based property #5417
10204
- target.$.accessCache[key] = 0;
10251
+ target._.accessCache[key] = 0;
10205
10252
  }
10206
10253
  else if (hasOwn(descriptor, 'value')) {
10207
10254
  this.set(target, key, descriptor.value, null);
@@ -10412,6 +10459,7 @@ function setupComponent(instance, isSSR = false) {
10412
10459
  return setupResult;
10413
10460
  }
10414
10461
  function setupStatefulComponent(instance, isSSR) {
10462
+ var _a;
10415
10463
  const Component = instance.type;
10416
10464
  if ((process.env.NODE_ENV !== 'production')) {
10417
10465
  if (Component.name) {
@@ -10469,6 +10517,13 @@ function setupStatefulComponent(instance, isSSR) {
10469
10517
  // async setup returned Promise.
10470
10518
  // bail here and wait for re-entry.
10471
10519
  instance.asyncDep = setupResult;
10520
+ if ((process.env.NODE_ENV !== 'production') && !instance.suspense) {
10521
+ const name = (_a = Component.name) !== null && _a !== void 0 ? _a : 'Anonymous';
10522
+ warn$1(`Component <${name}>: setup function returned a promise, but no ` +
10523
+ `<Suspense> boundary was found in the parent component tree. ` +
10524
+ `A component with async setup() must be nested in a <Suspense> ` +
10525
+ `in order to be rendered.`);
10526
+ }
10472
10527
  }
10473
10528
  }
10474
10529
  else {
@@ -11121,7 +11176,7 @@ function isMemoSame(cached, memo) {
11121
11176
  }
11122
11177
 
11123
11178
  // Core API ------------------------------------------------------------------
11124
- const version = "3.2.32";
11179
+ const version = "3.2.33";
11125
11180
  const _ssrUtils = {
11126
11181
  createComponentInstance,
11127
11182
  setupComponent,
@@ -11153,7 +11208,7 @@ const compatUtils = (_compatUtils );
11153
11208
 
11154
11209
  const svgNS = 'http://www.w3.org/2000/svg';
11155
11210
  const doc = (typeof document !== 'undefined' ? document : null);
11156
- const templateContainer = doc && doc.createElement('template');
11211
+ const templateContainer = doc && /*#__PURE__*/ doc.createElement('template');
11157
11212
  const nodeOps = {
11158
11213
  insert: (child, parent, anchor) => {
11159
11214
  parent.insertBefore(child, anchor || null);
@@ -11304,6 +11359,8 @@ function setStyle(style, name, val) {
11304
11359
  val.forEach(v => setStyle(style, name, v));
11305
11360
  }
11306
11361
  else {
11362
+ if (val == null)
11363
+ val = '';
11307
11364
  if (name.startsWith('--')) {
11308
11365
  // custom property definition
11309
11366
  style.setProperty(name, val);
@@ -11425,42 +11482,40 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
11425
11482
  }
11426
11483
  return;
11427
11484
  }
11485
+ let needRemove = false;
11428
11486
  if (value === '' || value == null) {
11429
11487
  const type = typeof el[key];
11430
11488
  if (type === 'boolean') {
11431
11489
  // e.g. <select multiple> compiles to { multiple: '' }
11432
- el[key] = includeBooleanAttr(value);
11433
- return;
11490
+ value = includeBooleanAttr(value);
11434
11491
  }
11435
11492
  else if (value == null && type === 'string') {
11436
11493
  // e.g. <div :id="null">
11437
- el[key] = '';
11438
- el.removeAttribute(key);
11439
- return;
11494
+ value = '';
11495
+ needRemove = true;
11440
11496
  }
11441
11497
  else if (type === 'number') {
11442
11498
  // e.g. <img :width="null">
11443
11499
  // the value of some IDL attr must be greater than 0, e.g. input.size = 0 -> error
11444
- try {
11445
- el[key] = 0;
11446
- }
11447
- catch (_a) { }
11448
- el.removeAttribute(key);
11449
- return;
11500
+ value = 0;
11501
+ needRemove = true;
11450
11502
  }
11451
11503
  }
11452
- if (value === false &&
11453
- compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
11454
- const type = typeof el[key];
11455
- if (type === 'string' || type === 'number') {
11456
- (process.env.NODE_ENV !== 'production') &&
11457
- compatUtils.warnDeprecation("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent, key);
11458
- el[key] = type === 'number' ? 0 : '';
11459
- el.removeAttribute(key);
11460
- return;
11504
+ else {
11505
+ if (value === false &&
11506
+ compatUtils.isCompatEnabled("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent)) {
11507
+ const type = typeof el[key];
11508
+ if (type === 'string' || type === 'number') {
11509
+ (process.env.NODE_ENV !== 'production') &&
11510
+ compatUtils.warnDeprecation("ATTR_FALSE_VALUE" /* ATTR_FALSE_VALUE */, parentComponent, key);
11511
+ value = type === 'number' ? 0 : '';
11512
+ needRemove = true;
11513
+ }
11461
11514
  }
11462
11515
  }
11463
- // some properties perform value validation and throw
11516
+ // some properties perform value validation and throw,
11517
+ // some properties has getter, no setter, will error in 'use strict'
11518
+ // eg. <select :type="null"></select> <select :willValidate="null"></select>
11464
11519
  try {
11465
11520
  el[key] = value;
11466
11521
  }
@@ -11470,31 +11525,35 @@ prevChildren, parentComponent, parentSuspense, unmountChildren) {
11470
11525
  `value ${value} is invalid.`, e);
11471
11526
  }
11472
11527
  }
11528
+ needRemove && el.removeAttribute(key);
11473
11529
  }
11474
11530
 
11475
11531
  // Async edge case fix requires storing an event listener's attach timestamp.
11476
- let _getNow = Date.now;
11477
- let skipTimestampCheck = false;
11478
- if (typeof window !== 'undefined') {
11479
- // Determine what event timestamp the browser is using. Annoyingly, the
11480
- // timestamp can either be hi-res (relative to page load) or low-res
11481
- // (relative to UNIX epoch), so in order to compare time we have to use the
11482
- // same timestamp type when saving the flush timestamp.
11483
- if (_getNow() > document.createEvent('Event').timeStamp) {
11484
- // if the low-res timestamp which is bigger than the event timestamp
11485
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
11486
- // and we need to use the hi-res version for event listeners as well.
11487
- _getNow = () => performance.now();
11488
- }
11489
- // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
11490
- // and does not fire microtasks in between event propagation, so safe to exclude.
11491
- const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
11492
- skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
11493
- }
11532
+ const [_getNow, skipTimestampCheck] = /*#__PURE__*/ (() => {
11533
+ let _getNow = Date.now;
11534
+ let skipTimestampCheck = false;
11535
+ if (typeof window !== 'undefined') {
11536
+ // Determine what event timestamp the browser is using. Annoyingly, the
11537
+ // timestamp can either be hi-res (relative to page load) or low-res
11538
+ // (relative to UNIX epoch), so in order to compare time we have to use the
11539
+ // same timestamp type when saving the flush timestamp.
11540
+ if (Date.now() > document.createEvent('Event').timeStamp) {
11541
+ // if the low-res timestamp which is bigger than the event timestamp
11542
+ // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
11543
+ // and we need to use the hi-res version for event listeners as well.
11544
+ _getNow = () => performance.now();
11545
+ }
11546
+ // #3485: Firefox <= 53 has incorrect Event.timeStamp implementation
11547
+ // and does not fire microtasks in between event propagation, so safe to exclude.
11548
+ const ffMatch = navigator.userAgent.match(/firefox\/(\d+)/i);
11549
+ skipTimestampCheck = !!(ffMatch && Number(ffMatch[1]) <= 53);
11550
+ }
11551
+ return [_getNow, skipTimestampCheck];
11552
+ })();
11494
11553
  // To avoid the overhead of repeatedly calling performance.now(), we cache
11495
11554
  // and use the same timestamp for all event listeners attached in the same tick.
11496
11555
  let cachedNow = 0;
11497
- const p = Promise.resolve();
11556
+ const p = /*#__PURE__*/ Promise.resolve();
11498
11557
  const reset = () => {
11499
11558
  cachedNow = 0;
11500
11559
  };
@@ -11619,13 +11678,13 @@ function shouldSetAsProp(el, key, value, isSVG) {
11619
11678
  }
11620
11679
  return false;
11621
11680
  }
11622
- // spellcheck and draggable are numerated attrs, however their
11623
- // corresponding DOM properties are actually booleans - this leads to
11624
- // setting it with a string "false" value leading it to be coerced to
11625
- // `true`, so we need to always treat them as attributes.
11681
+ // these are enumerated attrs, however their corresponding DOM properties
11682
+ // are actually booleans - this leads to setting it with a string "false"
11683
+ // value leading it to be coerced to `true`, so we need to always treat
11684
+ // them as attributes.
11626
11685
  // Note that `contentEditable` doesn't have this problem: its DOM
11627
11686
  // property is also enumerated string values.
11628
- if (key === 'spellcheck' || key === 'draggable') {
11687
+ if (key === 'spellcheck' || key === 'draggable' || key === 'translate') {
11629
11688
  return false;
11630
11689
  }
11631
11690
  // #1787, #2840 form property on form elements is readonly and must be set as
@@ -12805,7 +12864,7 @@ function initVShowForSSR() {
12805
12864
  };
12806
12865
  }
12807
12866
 
12808
- const rendererOptions = extend({ patchProp }, nodeOps);
12867
+ const rendererOptions = /*#__PURE__*/ extend({ patchProp }, nodeOps);
12809
12868
  // lazy create the renderer - this makes core renderer logic tree-shakable
12810
12869
  // in case the user only imports reactivity utilities from Vue.
12811
12870
  let renderer;