vue 2.6.8 → 2.6.12

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.
Files changed (42) hide show
  1. package/README.md +61 -81
  2. package/dist/README.md +3 -5
  3. package/dist/vue.common.dev.js +97 -44
  4. package/dist/vue.common.prod.js +3 -3
  5. package/dist/vue.esm.browser.js +97 -44
  6. package/dist/vue.esm.browser.min.js +3 -3
  7. package/dist/vue.esm.js +97 -44
  8. package/dist/vue.js +97 -44
  9. package/dist/vue.min.js +3 -3
  10. package/dist/vue.runtime.common.dev.js +73 -35
  11. package/dist/vue.runtime.common.prod.js +3 -3
  12. package/dist/vue.runtime.esm.js +73 -35
  13. package/dist/vue.runtime.js +73 -35
  14. package/dist/vue.runtime.min.js +3 -3
  15. package/package.json +4 -4
  16. package/src/compiler/codegen/events.js +1 -1
  17. package/src/compiler/error-detector.js +18 -3
  18. package/src/compiler/parser/html-parser.js +2 -2
  19. package/src/compiler/parser/index.js +5 -5
  20. package/src/core/instance/proxy.js +1 -1
  21. package/src/core/instance/render-helpers/bind-dynamic-keys.js +2 -2
  22. package/src/core/instance/render-helpers/bind-object-props.js +5 -3
  23. package/src/core/instance/render.js +1 -1
  24. package/src/core/observer/scheduler.js +17 -6
  25. package/src/core/util/env.js +1 -2
  26. package/src/core/util/error.js +4 -3
  27. package/src/core/util/next-tick.js +1 -1
  28. package/src/core/vdom/create-element.js +6 -0
  29. package/src/core/vdom/helpers/normalize-scoped-slots.js +9 -4
  30. package/src/core/vdom/helpers/resolve-async-component.js +16 -4
  31. package/src/core/vdom/patch.js +4 -4
  32. package/src/platforms/web/compiler/modules/model.js +1 -1
  33. package/src/platforms/web/runtime/modules/dom-props.js +3 -2
  34. package/src/platforms/web/runtime/modules/events.js +4 -2
  35. package/src/platforms/web/runtime/modules/transition.js +1 -1
  36. package/src/platforms/web/server/util.js +4 -4
  37. package/src/server/template-renderer/create-async-file-mapper.js +2 -2
  38. package/types/index.d.ts +1 -2
  39. package/types/options.d.ts +3 -3
  40. package/types/umd.d.ts +48 -0
  41. package/types/vnode.d.ts +1 -1
  42. package/types/vue.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Vue.js v2.6.8
3
- * (c) 2014-2019 Evan You
2
+ * Vue.js v2.6.12
3
+ * (c) 2014-2020 Evan You
4
4
  * Released under the MIT License.
5
5
  */
6
6
  'use strict';
@@ -1848,10 +1848,11 @@ function invokeWithErrorHandling (
1848
1848
  var res;
1849
1849
  try {
1850
1850
  res = args ? handler.apply(context, args) : handler.call(context);
1851
- if (res && !res._isVue && isPromise(res)) {
1851
+ if (res && !res._isVue && isPromise(res) && !res._handled) {
1852
+ res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1852
1853
  // issue #9511
1853
- // reassign to res to avoid catch triggering multiple times when nested calls
1854
- res = res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1854
+ // avoid catch triggering multiple times when nested calls
1855
+ res._handled = true;
1855
1856
  }
1856
1857
  } catch (e) {
1857
1858
  handleError(e, vm, info);
@@ -1955,7 +1956,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
1955
1956
  isUsingMicroTask = true;
1956
1957
  } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1957
1958
  // Fallback to setImmediate.
1958
- // Techinically it leverages the (macro) task queue,
1959
+ // Technically it leverages the (macro) task queue,
1959
1960
  // but it is still a better choice than setTimeout.
1960
1961
  timerFunc = function () {
1961
1962
  setImmediate(flushCallbacks);
@@ -2021,7 +2022,7 @@ var initProxy;
2021
2022
  warn(
2022
2023
  "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2023
2024
  'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
2024
- 'prevent conflicts with Vue internals' +
2025
+ 'prevent conflicts with Vue internals. ' +
2025
2026
  'See: https://vuejs.org/v2/api/#data',
2026
2027
  target
2027
2028
  );
@@ -2534,7 +2535,8 @@ function normalizeScopedSlots (
2534
2535
  prevSlots
2535
2536
  ) {
2536
2537
  var res;
2537
- var isStable = slots ? !!slots.$stable : true;
2538
+ var hasNormalSlots = Object.keys(normalSlots).length > 0;
2539
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2538
2540
  var key = slots && slots.$key;
2539
2541
  if (!slots) {
2540
2542
  res = {};
@@ -2546,7 +2548,8 @@ function normalizeScopedSlots (
2546
2548
  prevSlots &&
2547
2549
  prevSlots !== emptyObject &&
2548
2550
  key === prevSlots.$key &&
2549
- Object.keys(normalSlots).length === 0
2551
+ !hasNormalSlots &&
2552
+ !prevSlots.$hasNormal
2550
2553
  ) {
2551
2554
  // fast path 2: stable scoped slots w/ no normal slots to proxy,
2552
2555
  // only need to normalize once
@@ -2572,6 +2575,7 @@ function normalizeScopedSlots (
2572
2575
  }
2573
2576
  def(res, '$stable', isStable);
2574
2577
  def(res, '$key', key);
2578
+ def(res, '$hasNormal', hasNormalSlots);
2575
2579
  return res
2576
2580
  }
2577
2581
 
@@ -2581,8 +2585,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
2581
2585
  res = res && typeof res === 'object' && !Array.isArray(res)
2582
2586
  ? [res] // single vnode
2583
2587
  : normalizeChildren(res);
2584
- return res && res.length === 0
2585
- ? undefined
2588
+ return res && (
2589
+ res.length === 0 ||
2590
+ (res.length === 1 && res[0].isComment) // #9658
2591
+ ) ? undefined
2586
2592
  : res
2587
2593
  };
2588
2594
  // this is a slot using the new v-slot syntax without scope. although it is
@@ -2762,12 +2768,13 @@ function bindObjectProps (
2762
2768
  : data.attrs || (data.attrs = {});
2763
2769
  }
2764
2770
  var camelizedKey = camelize(key);
2765
- if (!(key in hash) && !(camelizedKey in hash)) {
2771
+ var hyphenatedKey = hyphenate(key);
2772
+ if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2766
2773
  hash[key] = value[key];
2767
2774
 
2768
2775
  if (isSync) {
2769
2776
  var on = data.on || (data.on = {});
2770
- on[("update:" + camelizedKey)] = function ($event) {
2777
+ on[("update:" + key)] = function ($event) {
2771
2778
  value[key] = $event;
2772
2779
  };
2773
2780
  }
@@ -2898,7 +2905,7 @@ function bindDynamicKeys (baseObj, values) {
2898
2905
  if (typeof key === 'string' && key) {
2899
2906
  baseObj[values[i]] = values[i + 1];
2900
2907
  } else if (key !== '' && key !== null) {
2901
- // null is a speical value for explicitly removing a binding
2908
+ // null is a special value for explicitly removing a binding
2902
2909
  warn(
2903
2910
  ("Invalid value for dynamic directive argument (expected string or null): " + key),
2904
2911
  this
@@ -3393,6 +3400,12 @@ function _createElement (
3393
3400
  ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
3394
3401
  if (config.isReservedTag(tag)) {
3395
3402
  // platform built-in elements
3403
+ if (isDef(data) && isDef(data.nativeOn)) {
3404
+ warn(
3405
+ ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
3406
+ context
3407
+ );
3408
+ }
3396
3409
  vnode = new VNode(
3397
3410
  config.parsePlatformTagName(tag), data, children,
3398
3411
  undefined, undefined, context
@@ -3518,7 +3531,7 @@ function renderMixin (Vue) {
3518
3531
  // render self
3519
3532
  var vnode;
3520
3533
  try {
3521
- // There's no need to maintain a stack becaues all render fns are called
3534
+ // There's no need to maintain a stack because all render fns are called
3522
3535
  // separately from one another. Nested component's render fns are called
3523
3536
  // when parent component is patched.
3524
3537
  currentRenderingInstance = vm;
@@ -3602,7 +3615,7 @@ function resolveAsyncComponent (
3602
3615
  }
3603
3616
 
3604
3617
  var owner = currentRenderingInstance;
3605
- if (isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3618
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3606
3619
  // already pending
3607
3620
  factory.owners.push(owner);
3608
3621
  }
@@ -3611,9 +3624,11 @@ function resolveAsyncComponent (
3611
3624
  return factory.loadingComp
3612
3625
  }
3613
3626
 
3614
- if (!isDef(factory.owners)) {
3627
+ if (owner && !isDef(factory.owners)) {
3615
3628
  var owners = factory.owners = [owner];
3616
- var sync = true
3629
+ var sync = true;
3630
+ var timerLoading = null;
3631
+ var timerTimeout = null
3617
3632
 
3618
3633
  ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3619
3634
 
@@ -3624,6 +3639,14 @@ function resolveAsyncComponent (
3624
3639
 
3625
3640
  if (renderCompleted) {
3626
3641
  owners.length = 0;
3642
+ if (timerLoading !== null) {
3643
+ clearTimeout(timerLoading);
3644
+ timerLoading = null;
3645
+ }
3646
+ if (timerTimeout !== null) {
3647
+ clearTimeout(timerTimeout);
3648
+ timerTimeout = null;
3649
+ }
3627
3650
  }
3628
3651
  };
3629
3652
 
@@ -3670,7 +3693,8 @@ function resolveAsyncComponent (
3670
3693
  if (res.delay === 0) {
3671
3694
  factory.loading = true;
3672
3695
  } else {
3673
- setTimeout(function () {
3696
+ timerLoading = setTimeout(function () {
3697
+ timerLoading = null;
3674
3698
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3675
3699
  factory.loading = true;
3676
3700
  forceRender(false);
@@ -3680,7 +3704,8 @@ function resolveAsyncComponent (
3680
3704
  }
3681
3705
 
3682
3706
  if (isDef(res.timeout)) {
3683
- setTimeout(function () {
3707
+ timerTimeout = setTimeout(function () {
3708
+ timerTimeout = null;
3684
3709
  if (isUndef(factory.resolved)) {
3685
3710
  reject(
3686
3711
  "timeout (" + (res.timeout) + "ms)"
@@ -4226,11 +4251,21 @@ var getNow = Date.now;
4226
4251
  // timestamp can either be hi-res (relative to page load) or low-res
4227
4252
  // (relative to UNIX epoch), so in order to compare time we have to use the
4228
4253
  // same timestamp type when saving the flush timestamp.
4229
- if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
4230
- // if the low-res timestamp which is bigger than the event timestamp
4231
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
4232
- // and we need to use the hi-res version for event listeners as well.
4233
- getNow = function () { return performance.now(); };
4254
+ // All IE versions use low-res event timestamps, and have problematic clock
4255
+ // implementations (#9632)
4256
+ if (inBrowser && !isIE) {
4257
+ var performance = window.performance;
4258
+ if (
4259
+ performance &&
4260
+ typeof performance.now === 'function' &&
4261
+ getNow() > document.createEvent('Event').timeStamp
4262
+ ) {
4263
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4264
+ // smaller than it, it means the event is using a hi-res timestamp,
4265
+ // and we need to use the hi-res version for event listener timestamps as
4266
+ // well.
4267
+ getNow = function () { return performance.now(); };
4268
+ }
4234
4269
  }
4235
4270
 
4236
4271
  /**
@@ -5395,7 +5430,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
5395
5430
  value: FunctionalRenderContext
5396
5431
  });
5397
5432
 
5398
- Vue.version = '2.6.8';
5433
+ Vue.version = '2.6.12';
5399
5434
 
5400
5435
  /* */
5401
5436
 
@@ -6066,7 +6101,7 @@ function createPatchFunction (backend) {
6066
6101
  }
6067
6102
  }
6068
6103
 
6069
- function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6104
+ function removeVnodes (vnodes, startIdx, endIdx) {
6070
6105
  for (; startIdx <= endIdx; ++startIdx) {
6071
6106
  var ch = vnodes[startIdx];
6072
6107
  if (isDef(ch)) {
@@ -6177,7 +6212,7 @@ function createPatchFunction (backend) {
6177
6212
  refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6178
6213
  addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6179
6214
  } else if (newStartIdx > newEndIdx) {
6180
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6215
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6181
6216
  }
6182
6217
  }
6183
6218
 
@@ -6269,7 +6304,7 @@ function createPatchFunction (backend) {
6269
6304
  if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6270
6305
  addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6271
6306
  } else if (isDef(oldCh)) {
6272
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6307
+ removeVnodes(oldCh, 0, oldCh.length - 1);
6273
6308
  } else if (isDef(oldVnode.text)) {
6274
6309
  nodeOps.setTextContent(elm, '');
6275
6310
  }
@@ -6498,7 +6533,7 @@ function createPatchFunction (backend) {
6498
6533
 
6499
6534
  // destroy old node
6500
6535
  if (isDef(parentElm)) {
6501
- removeVnodes(parentElm, [oldVnode], 0, 0);
6536
+ removeVnodes([oldVnode], 0, 0);
6502
6537
  } else if (isDef(oldVnode.tag)) {
6503
6538
  invokeDestroyHook(oldVnode);
6504
6539
  }
@@ -6848,8 +6883,10 @@ function add$1 (
6848
6883
  e.target === e.currentTarget ||
6849
6884
  // event is fired after handler attachment
6850
6885
  e.timeStamp >= attachedTimestamp ||
6851
- // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
6852
- e.timeStamp === 0 ||
6886
+ // bail for environments that have buggy event.timeStamp implementations
6887
+ // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
6888
+ // #9681 QtWebEngine event.timeStamp is negative value
6889
+ e.timeStamp <= 0 ||
6853
6890
  // #9448 bail if event is fired in another document in a multi-page
6854
6891
  // electron/nw.js app, since event.timeStamp will be using a different
6855
6892
  // starting reference
@@ -6916,10 +6953,11 @@ function updateDOMProps (oldVnode, vnode) {
6916
6953
  }
6917
6954
 
6918
6955
  for (key in oldProps) {
6919
- if (isUndef(props[key])) {
6956
+ if (!(key in props)) {
6920
6957
  elm[key] = '';
6921
6958
  }
6922
6959
  }
6960
+
6923
6961
  for (key in props) {
6924
6962
  cur = props[key];
6925
6963
  // ignore children if the node has textContent or innerHTML,
@@ -6959,7 +6997,7 @@ function updateDOMProps (oldVnode, vnode) {
6959
6997
  // skip the update if old and new VDOM state is the same.
6960
6998
  // `value` is handled separately because the DOM value may be temporarily
6961
6999
  // out of sync with VDOM state due to focus, composition and modifiers.
6962
- // This #4521 by skipping the unnecesarry `checked` update.
7000
+ // This #4521 by skipping the unnecessary `checked` update.
6963
7001
  cur !== oldProps[key]
6964
7002
  ) {
6965
7003
  // some property updates can throw
@@ -7467,8 +7505,8 @@ function enter (vnode, toggleDisplay) {
7467
7505
  var context = activeInstance;
7468
7506
  var transitionNode = activeInstance.$vnode;
7469
7507
  while (transitionNode && transitionNode.parent) {
7470
- transitionNode = transitionNode.parent;
7471
7508
  context = transitionNode.context;
7509
+ transitionNode = transitionNode.parent;
7472
7510
  }
7473
7511
 
7474
7512
  var isAppear = !context._isMounted || !vnode.isRootInsert;