vue 2.6.7 → 2.6.11

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 (45) hide show
  1. package/README.md +72 -52
  2. package/dist/README.md +1 -1
  3. package/dist/vue.common.dev.js +109 -51
  4. package/dist/vue.common.prod.js +2 -2
  5. package/dist/vue.esm.browser.js +109 -51
  6. package/dist/vue.esm.browser.min.js +2 -2
  7. package/dist/vue.esm.js +109 -51
  8. package/dist/vue.js +109 -51
  9. package/dist/vue.min.js +2 -2
  10. package/dist/vue.runtime.common.dev.js +80 -38
  11. package/dist/vue.runtime.common.prod.js +2 -2
  12. package/dist/vue.runtime.esm.js +80 -38
  13. package/dist/vue.runtime.js +80 -38
  14. package/dist/vue.runtime.min.js +2 -2
  15. package/package.json +4 -4
  16. package/src/compiler/codegen/events.js +1 -1
  17. package/src/compiler/codegen/index.js +1 -1
  18. package/src/compiler/error-detector.js +18 -3
  19. package/src/compiler/parser/html-parser.js +5 -5
  20. package/src/compiler/parser/index.js +7 -6
  21. package/src/core/instance/proxy.js +1 -1
  22. package/src/core/instance/render-helpers/bind-dynamic-keys.js +1 -1
  23. package/src/core/instance/render-helpers/bind-object-props.js +5 -3
  24. package/src/core/instance/render.js +1 -1
  25. package/src/core/observer/scheduler.js +17 -6
  26. package/src/core/util/env.js +1 -2
  27. package/src/core/util/error.js +4 -3
  28. package/src/core/util/lang.js +2 -2
  29. package/src/core/util/next-tick.js +1 -1
  30. package/src/core/util/options.js +2 -2
  31. package/src/core/vdom/create-element.js +6 -0
  32. package/src/core/vdom/helpers/normalize-scoped-slots.js +9 -4
  33. package/src/core/vdom/helpers/resolve-async-component.js +25 -8
  34. package/src/core/vdom/patch.js +4 -4
  35. package/src/platforms/web/compiler/modules/model.js +1 -1
  36. package/src/platforms/web/runtime/modules/dom-props.js +2 -1
  37. package/src/platforms/web/runtime/modules/events.js +4 -2
  38. package/src/platforms/web/runtime/modules/transition.js +1 -1
  39. package/src/server/template-renderer/create-async-file-mapper.js +2 -2
  40. package/src/server/write.js +1 -1
  41. package/types/index.d.ts +1 -2
  42. package/types/options.d.ts +3 -3
  43. package/types/umd.d.ts +48 -0
  44. package/types/vnode.d.ts +6 -2
  45. package/types/vue.d.ts +3 -3
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.6.7
2
+ * Vue.js v2.6.11
3
3
  * (c) 2014-2019 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -468,7 +468,7 @@ var config = ({
468
468
  * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
469
469
  * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
470
470
  */
471
- var unicodeLetters = 'a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD';
471
+ var unicodeRegExp = /a-zA-Z\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD/;
472
472
 
473
473
  /**
474
474
  * Check if a string starts with $ or _
@@ -493,7 +493,7 @@ function def (obj, key, val, enumerable) {
493
493
  /**
494
494
  * Parse simple path.
495
495
  */
496
- var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
496
+ var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
497
497
  function parsePath (path) {
498
498
  if (bailRE.test(path)) {
499
499
  return
@@ -1397,7 +1397,7 @@ function checkComponents (options) {
1397
1397
  }
1398
1398
 
1399
1399
  function validateComponentName (name) {
1400
- if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
1400
+ if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
1401
1401
  warn(
1402
1402
  'Invalid component name: "' + name + '". Component names ' +
1403
1403
  'should conform to valid custom element name in html5 specification.'
@@ -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;
@@ -3601,17 +3614,23 @@ function resolveAsyncComponent (
3601
3614
  return factory.resolved
3602
3615
  }
3603
3616
 
3617
+ var owner = currentRenderingInstance;
3618
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3619
+ // already pending
3620
+ factory.owners.push(owner);
3621
+ }
3622
+
3604
3623
  if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3605
3624
  return factory.loadingComp
3606
3625
  }
3607
3626
 
3608
- var owner = currentRenderingInstance;
3609
- if (isDef(factory.owners)) {
3610
- // already pending
3611
- factory.owners.push(owner);
3612
- } else {
3627
+ if (owner && !isDef(factory.owners)) {
3613
3628
  var owners = factory.owners = [owner];
3614
3629
  var sync = true;
3630
+ var timerLoading = null;
3631
+ var timerTimeout = null
3632
+
3633
+ ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3615
3634
 
3616
3635
  var forceRender = function (renderCompleted) {
3617
3636
  for (var i = 0, l = owners.length; i < l; i++) {
@@ -3620,6 +3639,14 @@ function resolveAsyncComponent (
3620
3639
 
3621
3640
  if (renderCompleted) {
3622
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
+ }
3623
3650
  }
3624
3651
  };
3625
3652
 
@@ -3666,7 +3693,8 @@ function resolveAsyncComponent (
3666
3693
  if (res.delay === 0) {
3667
3694
  factory.loading = true;
3668
3695
  } else {
3669
- setTimeout(function () {
3696
+ timerLoading = setTimeout(function () {
3697
+ timerLoading = null;
3670
3698
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3671
3699
  factory.loading = true;
3672
3700
  forceRender(false);
@@ -3676,7 +3704,8 @@ function resolveAsyncComponent (
3676
3704
  }
3677
3705
 
3678
3706
  if (isDef(res.timeout)) {
3679
- setTimeout(function () {
3707
+ timerTimeout = setTimeout(function () {
3708
+ timerTimeout = null;
3680
3709
  if (isUndef(factory.resolved)) {
3681
3710
  reject(
3682
3711
  "timeout (" + (res.timeout) + "ms)"
@@ -4222,11 +4251,21 @@ var getNow = Date.now;
4222
4251
  // timestamp can either be hi-res (relative to page load) or low-res
4223
4252
  // (relative to UNIX epoch), so in order to compare time we have to use the
4224
4253
  // same timestamp type when saving the flush timestamp.
4225
- if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
4226
- // if the low-res timestamp which is bigger than the event timestamp
4227
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
4228
- // and we need to use the hi-res version for event listeners as well.
4229
- 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
+ }
4230
4269
  }
4231
4270
 
4232
4271
  /**
@@ -5391,7 +5430,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
5391
5430
  value: FunctionalRenderContext
5392
5431
  });
5393
5432
 
5394
- Vue.version = '2.6.7';
5433
+ Vue.version = '2.6.11';
5395
5434
 
5396
5435
  /* */
5397
5436
 
@@ -6062,7 +6101,7 @@ function createPatchFunction (backend) {
6062
6101
  }
6063
6102
  }
6064
6103
 
6065
- function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6104
+ function removeVnodes (vnodes, startIdx, endIdx) {
6066
6105
  for (; startIdx <= endIdx; ++startIdx) {
6067
6106
  var ch = vnodes[startIdx];
6068
6107
  if (isDef(ch)) {
@@ -6173,7 +6212,7 @@ function createPatchFunction (backend) {
6173
6212
  refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6174
6213
  addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6175
6214
  } else if (newStartIdx > newEndIdx) {
6176
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6215
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6177
6216
  }
6178
6217
  }
6179
6218
 
@@ -6265,7 +6304,7 @@ function createPatchFunction (backend) {
6265
6304
  if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6266
6305
  addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6267
6306
  } else if (isDef(oldCh)) {
6268
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6307
+ removeVnodes(oldCh, 0, oldCh.length - 1);
6269
6308
  } else if (isDef(oldVnode.text)) {
6270
6309
  nodeOps.setTextContent(elm, '');
6271
6310
  }
@@ -6494,7 +6533,7 @@ function createPatchFunction (backend) {
6494
6533
 
6495
6534
  // destroy old node
6496
6535
  if (isDef(parentElm)) {
6497
- removeVnodes(parentElm, [oldVnode], 0, 0);
6536
+ removeVnodes([oldVnode], 0, 0);
6498
6537
  } else if (isDef(oldVnode.tag)) {
6499
6538
  invokeDestroyHook(oldVnode);
6500
6539
  }
@@ -6844,8 +6883,10 @@ function add$1 (
6844
6883
  e.target === e.currentTarget ||
6845
6884
  // event is fired after handler attachment
6846
6885
  e.timeStamp >= attachedTimestamp ||
6847
- // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
6848
- 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 ||
6849
6890
  // #9448 bail if event is fired in another document in a multi-page
6850
6891
  // electron/nw.js app, since event.timeStamp will be using a different
6851
6892
  // starting reference
@@ -6912,10 +6953,11 @@ function updateDOMProps (oldVnode, vnode) {
6912
6953
  }
6913
6954
 
6914
6955
  for (key in oldProps) {
6915
- if (isUndef(props[key])) {
6956
+ if (!(key in props)) {
6916
6957
  elm[key] = '';
6917
6958
  }
6918
6959
  }
6960
+
6919
6961
  for (key in props) {
6920
6962
  cur = props[key];
6921
6963
  // ignore children if the node has textContent or innerHTML,
@@ -7463,8 +7505,8 @@ function enter (vnode, toggleDisplay) {
7463
7505
  var context = activeInstance;
7464
7506
  var transitionNode = activeInstance.$vnode;
7465
7507
  while (transitionNode && transitionNode.parent) {
7466
- transitionNode = transitionNode.parent;
7467
7508
  context = transitionNode.context;
7509
+ transitionNode = transitionNode.parent;
7468
7510
  }
7469
7511
 
7470
7512
  var isAppear = !context._isMounted || !vnode.isRootInsert;