vue 2.6.6 → 2.6.10

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 (37) hide show
  1. package/README.md +24 -19
  2. package/dist/README.md +1 -1
  3. package/dist/vue.common.dev.js +169 -80
  4. package/dist/vue.common.prod.js +2 -2
  5. package/dist/vue.esm.browser.js +167 -76
  6. package/dist/vue.esm.browser.min.js +2 -2
  7. package/dist/vue.esm.js +169 -80
  8. package/dist/vue.js +169 -80
  9. package/dist/vue.min.js +2 -2
  10. package/dist/vue.runtime.common.dev.js +121 -62
  11. package/dist/vue.runtime.common.prod.js +2 -2
  12. package/dist/vue.runtime.esm.js +121 -62
  13. package/dist/vue.runtime.js +121 -62
  14. package/dist/vue.runtime.min.js +2 -2
  15. package/package.json +2 -2
  16. package/src/compiler/codeframe.js +7 -5
  17. package/src/compiler/codegen/events.js +1 -1
  18. package/src/compiler/codegen/index.js +38 -9
  19. package/src/compiler/parser/html-parser.js +3 -3
  20. package/src/compiler/parser/index.js +4 -3
  21. package/src/core/instance/lifecycle.js +5 -2
  22. package/src/core/instance/render-helpers/bind-object-props.js +5 -3
  23. package/src/core/instance/render-helpers/resolve-scoped-slots.js +7 -2
  24. package/src/core/observer/scheduler.js +17 -6
  25. package/src/core/util/error.js +24 -13
  26. package/src/core/util/lang.js +2 -2
  27. package/src/core/util/options.js +2 -2
  28. package/src/core/vdom/helpers/normalize-scoped-slots.js +14 -5
  29. package/src/core/vdom/helpers/resolve-async-component.js +25 -8
  30. package/src/platforms/web/runtime/modules/dom-props.js +15 -12
  31. package/src/platforms/web/runtime/modules/events.js +4 -2
  32. package/src/platforms/web/runtime/modules/transition.js +1 -1
  33. package/src/server/template-renderer/create-async-file-mapper.js +2 -2
  34. package/src/server/write.js +1 -1
  35. package/types/options.d.ts +3 -3
  36. package/types/vnode.d.ts +6 -2
  37. package/types/vue.d.ts +3 -3
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vue.js v2.6.6
2
+ * Vue.js v2.6.10
3
3
  * (c) 2014-2019 Evan You
4
4
  * Released under the MIT License.
5
5
  */
@@ -466,7 +466,7 @@ var config = ({
466
466
  * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
467
467
  * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
468
468
  */
469
- 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';
469
+ 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/;
470
470
 
471
471
  /**
472
472
  * Check if a string starts with $ or _
@@ -491,7 +491,7 @@ function def (obj, key, val, enumerable) {
491
491
  /**
492
492
  * Parse simple path.
493
493
  */
494
- var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
494
+ var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
495
495
  function parsePath (path) {
496
496
  if (bailRE.test(path)) {
497
497
  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.'
@@ -1816,23 +1816,30 @@ function isBoolean () {
1816
1816
  /* */
1817
1817
 
1818
1818
  function handleError (err, vm, info) {
1819
- if (vm) {
1820
- var cur = vm;
1821
- while ((cur = cur.$parent)) {
1822
- var hooks = cur.$options.errorCaptured;
1823
- if (hooks) {
1824
- for (var i = 0; i < hooks.length; i++) {
1825
- try {
1826
- var capture = hooks[i].call(cur, err, vm, info) === false;
1827
- if (capture) { return }
1828
- } catch (e) {
1829
- globalHandleError(e, cur, 'errorCaptured hook');
1819
+ // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1820
+ // See: https://github.com/vuejs/vuex/issues/1505
1821
+ pushTarget();
1822
+ try {
1823
+ if (vm) {
1824
+ var cur = vm;
1825
+ while ((cur = cur.$parent)) {
1826
+ var hooks = cur.$options.errorCaptured;
1827
+ if (hooks) {
1828
+ for (var i = 0; i < hooks.length; i++) {
1829
+ try {
1830
+ var capture = hooks[i].call(cur, err, vm, info) === false;
1831
+ if (capture) { return }
1832
+ } catch (e) {
1833
+ globalHandleError(e, cur, 'errorCaptured hook');
1834
+ }
1830
1835
  }
1831
1836
  }
1832
1837
  }
1833
1838
  }
1839
+ globalHandleError(err, vm, info);
1840
+ } finally {
1841
+ popTarget();
1834
1842
  }
1835
- globalHandleError(err, vm, info);
1836
1843
  }
1837
1844
 
1838
1845
  function invokeWithErrorHandling (
@@ -1845,8 +1852,11 @@ function invokeWithErrorHandling (
1845
1852
  var res;
1846
1853
  try {
1847
1854
  res = args ? handler.apply(context, args) : handler.call(context);
1848
- if (res && !res._isVue && isPromise(res)) {
1855
+ if (res && !res._isVue && isPromise(res) && !res._handled) {
1849
1856
  res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1857
+ // issue #9511
1858
+ // avoid catch triggering multiple times when nested calls
1859
+ res._handled = true;
1850
1860
  }
1851
1861
  } catch (e) {
1852
1862
  handleError(e, vm, info);
@@ -2531,32 +2541,37 @@ function normalizeScopedSlots (
2531
2541
  prevSlots
2532
2542
  ) {
2533
2543
  var res;
2544
+ var hasNormalSlots = Object.keys(normalSlots).length > 0;
2545
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2546
+ var key = slots && slots.$key;
2534
2547
  if (!slots) {
2535
2548
  res = {};
2536
2549
  } else if (slots._normalized) {
2537
2550
  // fast path 1: child component re-render only, parent did not change
2538
2551
  return slots._normalized
2539
2552
  } else if (
2540
- slots.$stable &&
2553
+ isStable &&
2541
2554
  prevSlots &&
2542
2555
  prevSlots !== emptyObject &&
2543
- Object.keys(normalSlots).length === 0
2556
+ key === prevSlots.$key &&
2557
+ !hasNormalSlots &&
2558
+ !prevSlots.$hasNormal
2544
2559
  ) {
2545
2560
  // fast path 2: stable scoped slots w/ no normal slots to proxy,
2546
2561
  // only need to normalize once
2547
2562
  return prevSlots
2548
2563
  } else {
2549
2564
  res = {};
2550
- for (var key in slots) {
2551
- if (slots[key] && key[0] !== '$') {
2552
- res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
2565
+ for (var key$1 in slots) {
2566
+ if (slots[key$1] && key$1[0] !== '$') {
2567
+ res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2553
2568
  }
2554
2569
  }
2555
2570
  }
2556
2571
  // expose normal slots on scopedSlots
2557
- for (var key$1 in normalSlots) {
2558
- if (!(key$1 in res)) {
2559
- res[key$1] = proxyNormalSlot(normalSlots, key$1);
2572
+ for (var key$2 in normalSlots) {
2573
+ if (!(key$2 in res)) {
2574
+ res[key$2] = proxyNormalSlot(normalSlots, key$2);
2560
2575
  }
2561
2576
  }
2562
2577
  // avoriaz seems to mock a non-extensible $scopedSlots object
@@ -2564,7 +2579,9 @@ function normalizeScopedSlots (
2564
2579
  if (slots && Object.isExtensible(slots)) {
2565
2580
  (slots)._normalized = res;
2566
2581
  }
2567
- def(res, '$stable', slots ? !!slots.$stable : true);
2582
+ def(res, '$stable', isStable);
2583
+ def(res, '$key', key);
2584
+ def(res, '$hasNormal', hasNormalSlots);
2568
2585
  return res
2569
2586
  }
2570
2587
 
@@ -2574,8 +2591,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
2574
2591
  res = res && typeof res === 'object' && !Array.isArray(res)
2575
2592
  ? [res] // single vnode
2576
2593
  : normalizeChildren(res);
2577
- return res && res.length === 0
2578
- ? undefined
2594
+ return res && (
2595
+ res.length === 0 ||
2596
+ (res.length === 1 && res[0].isComment) // #9658
2597
+ ) ? undefined
2579
2598
  : res
2580
2599
  };
2581
2600
  // this is a slot using the new v-slot syntax without scope. although it is
@@ -2755,12 +2774,13 @@ function bindObjectProps (
2755
2774
  : data.attrs || (data.attrs = {});
2756
2775
  }
2757
2776
  var camelizedKey = camelize(key);
2758
- if (!(key in hash) && !(camelizedKey in hash)) {
2777
+ var hyphenatedKey = hyphenate(key);
2778
+ if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2759
2779
  hash[key] = value[key];
2760
2780
 
2761
2781
  if (isSync) {
2762
2782
  var on = data.on || (data.on = {});
2763
- on[("update:" + camelizedKey)] = function ($event) {
2783
+ on[("update:" + key)] = function ($event) {
2764
2784
  value[key] = $event;
2765
2785
  };
2766
2786
  }
@@ -2859,14 +2879,16 @@ function bindObjectListeners (data, value) {
2859
2879
 
2860
2880
  function resolveScopedSlots (
2861
2881
  fns, // see flow/vnode
2882
+ res,
2883
+ // the following are added in 2.6
2862
2884
  hasDynamicKeys,
2863
- res
2885
+ contentHashKey
2864
2886
  ) {
2865
2887
  res = res || { $stable: !hasDynamicKeys };
2866
2888
  for (var i = 0; i < fns.length; i++) {
2867
2889
  var slot = fns[i];
2868
2890
  if (Array.isArray(slot)) {
2869
- resolveScopedSlots(slot, hasDynamicKeys, res);
2891
+ resolveScopedSlots(slot, res, hasDynamicKeys);
2870
2892
  } else if (slot) {
2871
2893
  // marker for reverse proxying v-slot without scope on this.$slots
2872
2894
  if (slot.proxy) {
@@ -2875,6 +2897,9 @@ function resolveScopedSlots (
2875
2897
  res[slot.key] = slot.fn;
2876
2898
  }
2877
2899
  }
2900
+ if (contentHashKey) {
2901
+ (res).$key = contentHashKey;
2902
+ }
2878
2903
  return res
2879
2904
  }
2880
2905
 
@@ -3593,17 +3618,23 @@ function resolveAsyncComponent (
3593
3618
  return factory.resolved
3594
3619
  }
3595
3620
 
3621
+ var owner = currentRenderingInstance;
3622
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3623
+ // already pending
3624
+ factory.owners.push(owner);
3625
+ }
3626
+
3596
3627
  if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3597
3628
  return factory.loadingComp
3598
3629
  }
3599
3630
 
3600
- var owner = currentRenderingInstance;
3601
- if (isDef(factory.owners)) {
3602
- // already pending
3603
- factory.owners.push(owner);
3604
- } else {
3631
+ if (owner && !isDef(factory.owners)) {
3605
3632
  var owners = factory.owners = [owner];
3606
3633
  var sync = true;
3634
+ var timerLoading = null;
3635
+ var timerTimeout = null
3636
+
3637
+ ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3607
3638
 
3608
3639
  var forceRender = function (renderCompleted) {
3609
3640
  for (var i = 0, l = owners.length; i < l; i++) {
@@ -3612,6 +3643,14 @@ function resolveAsyncComponent (
3612
3643
 
3613
3644
  if (renderCompleted) {
3614
3645
  owners.length = 0;
3646
+ if (timerLoading !== null) {
3647
+ clearTimeout(timerLoading);
3648
+ timerLoading = null;
3649
+ }
3650
+ if (timerTimeout !== null) {
3651
+ clearTimeout(timerTimeout);
3652
+ timerTimeout = null;
3653
+ }
3615
3654
  }
3616
3655
  };
3617
3656
 
@@ -3658,7 +3697,8 @@ function resolveAsyncComponent (
3658
3697
  if (res.delay === 0) {
3659
3698
  factory.loading = true;
3660
3699
  } else {
3661
- setTimeout(function () {
3700
+ timerLoading = setTimeout(function () {
3701
+ timerLoading = null;
3662
3702
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3663
3703
  factory.loading = true;
3664
3704
  forceRender(false);
@@ -3668,7 +3708,8 @@ function resolveAsyncComponent (
3668
3708
  }
3669
3709
 
3670
3710
  if (isDef(res.timeout)) {
3671
- setTimeout(function () {
3711
+ timerTimeout = setTimeout(function () {
3712
+ timerTimeout = null;
3672
3713
  if (isUndef(factory.resolved)) {
3673
3714
  reject(
3674
3715
  process.env.NODE_ENV !== 'production'
@@ -4058,9 +4099,12 @@ function updateChildComponent (
4058
4099
  // check if there are dynamic scopedSlots (hand-written or compiled but with
4059
4100
  // dynamic slot names). Static scoped slots compiled from template has the
4060
4101
  // "$stable" marker.
4102
+ var newScopedSlots = parentVnode.data.scopedSlots;
4103
+ var oldScopedSlots = vm.$scopedSlots;
4061
4104
  var hasDynamicScopedSlot = !!(
4062
- (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
4063
- (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
4105
+ (newScopedSlots && !newScopedSlots.$stable) ||
4106
+ (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4107
+ (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4064
4108
  );
4065
4109
 
4066
4110
  // Any static slot children from the parent may have changed during parent's
@@ -4213,11 +4257,21 @@ var getNow = Date.now;
4213
4257
  // timestamp can either be hi-res (relative to page load) or low-res
4214
4258
  // (relative to UNIX epoch), so in order to compare time we have to use the
4215
4259
  // same timestamp type when saving the flush timestamp.
4216
- if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
4217
- // if the low-res timestamp which is bigger than the event timestamp
4218
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
4219
- // and we need to use the hi-res version for event listeners as well.
4220
- getNow = function () { return performance.now(); };
4260
+ // All IE versions use low-res event timestamps, and have problematic clock
4261
+ // implementations (#9632)
4262
+ if (inBrowser && !isIE) {
4263
+ var performance = window.performance;
4264
+ if (
4265
+ performance &&
4266
+ typeof performance.now === 'function' &&
4267
+ getNow() > document.createEvent('Event').timeStamp
4268
+ ) {
4269
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4270
+ // smaller than it, it means the event is using a hi-res timestamp,
4271
+ // and we need to use the hi-res version for event listener timestamps as
4272
+ // well.
4273
+ getNow = function () { return performance.now(); };
4274
+ }
4221
4275
  }
4222
4276
 
4223
4277
  /**
@@ -5390,7 +5444,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
5390
5444
  value: FunctionalRenderContext
5391
5445
  });
5392
5446
 
5393
- Vue.version = '2.6.6';
5447
+ Vue.version = '2.6.10';
5394
5448
 
5395
5449
  /* */
5396
5450
 
@@ -6845,8 +6899,10 @@ function add$1 (
6845
6899
  e.target === e.currentTarget ||
6846
6900
  // event is fired after handler attachment
6847
6901
  e.timeStamp >= attachedTimestamp ||
6848
- // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
6849
- e.timeStamp === 0 ||
6902
+ // bail for environments that have buggy event.timeStamp implementations
6903
+ // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
6904
+ // #9681 QtWebEngine event.timeStamp is negative value
6905
+ e.timeStamp <= 0 ||
6850
6906
  // #9448 bail if event is fired in another document in a multi-page
6851
6907
  // electron/nw.js app, since event.timeStamp will be using a different
6852
6908
  // starting reference
@@ -6913,10 +6969,11 @@ function updateDOMProps (oldVnode, vnode) {
6913
6969
  }
6914
6970
 
6915
6971
  for (key in oldProps) {
6916
- if (isUndef(props[key])) {
6972
+ if (!(key in props)) {
6917
6973
  elm[key] = '';
6918
6974
  }
6919
6975
  }
6976
+
6920
6977
  for (key in props) {
6921
6978
  cur = props[key];
6922
6979
  // ignore children if the node has textContent or innerHTML,
@@ -6932,15 +6989,7 @@ function updateDOMProps (oldVnode, vnode) {
6932
6989
  }
6933
6990
  }
6934
6991
 
6935
- // skip the update if old and new VDOM state is the same.
6936
- // the only exception is `value` where the DOM value may be temporarily
6937
- // out of sync with VDOM state due to focus, composition and modifiers.
6938
- // This also covers #4521 by skipping the unnecesarry `checked` update.
6939
- if (key !== 'value' && cur === oldProps[key]) {
6940
- continue
6941
- }
6942
-
6943
- if (key === 'value') {
6992
+ if (key === 'value' && elm.tagName !== 'PROGRESS') {
6944
6993
  // store value as _value as well since
6945
6994
  // non-string values will be stringified
6946
6995
  elm._value = cur;
@@ -6960,8 +7009,18 @@ function updateDOMProps (oldVnode, vnode) {
6960
7009
  while (svg.firstChild) {
6961
7010
  elm.appendChild(svg.firstChild);
6962
7011
  }
6963
- } else {
6964
- elm[key] = cur;
7012
+ } else if (
7013
+ // skip the update if old and new VDOM state is the same.
7014
+ // `value` is handled separately because the DOM value may be temporarily
7015
+ // out of sync with VDOM state due to focus, composition and modifiers.
7016
+ // This #4521 by skipping the unnecesarry `checked` update.
7017
+ cur !== oldProps[key]
7018
+ ) {
7019
+ // some property updates can throw
7020
+ // e.g. `value` on <progress> w/ non-finite value
7021
+ try {
7022
+ elm[key] = cur;
7023
+ } catch (e) {}
6965
7024
  }
6966
7025
  }
6967
7026
  }
@@ -7462,8 +7521,8 @@ function enter (vnode, toggleDisplay) {
7462
7521
  var context = activeInstance;
7463
7522
  var transitionNode = activeInstance.$vnode;
7464
7523
  while (transitionNode && transitionNode.parent) {
7465
- transitionNode = transitionNode.parent;
7466
7524
  context = transitionNode.context;
7525
+ transitionNode = transitionNode.parent;
7467
7526
  }
7468
7527
 
7469
7528
  var isAppear = !context._isMounted || !vnode.isRootInsert;