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
  */
@@ -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.'
@@ -1812,23 +1812,30 @@ function isBoolean () {
1812
1812
  /* */
1813
1813
 
1814
1814
  function handleError (err, vm, info) {
1815
- if (vm) {
1816
- var cur = vm;
1817
- while ((cur = cur.$parent)) {
1818
- var hooks = cur.$options.errorCaptured;
1819
- if (hooks) {
1820
- for (var i = 0; i < hooks.length; i++) {
1821
- try {
1822
- var capture = hooks[i].call(cur, err, vm, info) === false;
1823
- if (capture) { return }
1824
- } catch (e) {
1825
- globalHandleError(e, cur, 'errorCaptured hook');
1815
+ // Deactivate deps tracking while processing error handler to avoid possible infinite rendering.
1816
+ // See: https://github.com/vuejs/vuex/issues/1505
1817
+ pushTarget();
1818
+ try {
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');
1830
+ }
1826
1831
  }
1827
1832
  }
1828
1833
  }
1829
1834
  }
1835
+ globalHandleError(err, vm, info);
1836
+ } finally {
1837
+ popTarget();
1830
1838
  }
1831
- globalHandleError(err, vm, info);
1832
1839
  }
1833
1840
 
1834
1841
  function invokeWithErrorHandling (
@@ -1841,8 +1848,11 @@ function invokeWithErrorHandling (
1841
1848
  var res;
1842
1849
  try {
1843
1850
  res = args ? handler.apply(context, args) : handler.call(context);
1844
- if (res && !res._isVue && isPromise(res)) {
1851
+ if (res && !res._isVue && isPromise(res) && !res._handled) {
1845
1852
  res.catch(function (e) { return handleError(e, vm, info + " (Promise/async)"); });
1853
+ // issue #9511
1854
+ // avoid catch triggering multiple times when nested calls
1855
+ res._handled = true;
1846
1856
  }
1847
1857
  } catch (e) {
1848
1858
  handleError(e, vm, info);
@@ -2525,32 +2535,37 @@ function normalizeScopedSlots (
2525
2535
  prevSlots
2526
2536
  ) {
2527
2537
  var res;
2538
+ var hasNormalSlots = Object.keys(normalSlots).length > 0;
2539
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2540
+ var key = slots && slots.$key;
2528
2541
  if (!slots) {
2529
2542
  res = {};
2530
2543
  } else if (slots._normalized) {
2531
2544
  // fast path 1: child component re-render only, parent did not change
2532
2545
  return slots._normalized
2533
2546
  } else if (
2534
- slots.$stable &&
2547
+ isStable &&
2535
2548
  prevSlots &&
2536
2549
  prevSlots !== emptyObject &&
2537
- Object.keys(normalSlots).length === 0
2550
+ key === prevSlots.$key &&
2551
+ !hasNormalSlots &&
2552
+ !prevSlots.$hasNormal
2538
2553
  ) {
2539
2554
  // fast path 2: stable scoped slots w/ no normal slots to proxy,
2540
2555
  // only need to normalize once
2541
2556
  return prevSlots
2542
2557
  } else {
2543
2558
  res = {};
2544
- for (var key in slots) {
2545
- if (slots[key] && key[0] !== '$') {
2546
- res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
2559
+ for (var key$1 in slots) {
2560
+ if (slots[key$1] && key$1[0] !== '$') {
2561
+ res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2547
2562
  }
2548
2563
  }
2549
2564
  }
2550
2565
  // expose normal slots on scopedSlots
2551
- for (var key$1 in normalSlots) {
2552
- if (!(key$1 in res)) {
2553
- res[key$1] = proxyNormalSlot(normalSlots, key$1);
2566
+ for (var key$2 in normalSlots) {
2567
+ if (!(key$2 in res)) {
2568
+ res[key$2] = proxyNormalSlot(normalSlots, key$2);
2554
2569
  }
2555
2570
  }
2556
2571
  // avoriaz seems to mock a non-extensible $scopedSlots object
@@ -2558,7 +2573,9 @@ function normalizeScopedSlots (
2558
2573
  if (slots && Object.isExtensible(slots)) {
2559
2574
  (slots)._normalized = res;
2560
2575
  }
2561
- def(res, '$stable', slots ? !!slots.$stable : true);
2576
+ def(res, '$stable', isStable);
2577
+ def(res, '$key', key);
2578
+ def(res, '$hasNormal', hasNormalSlots);
2562
2579
  return res
2563
2580
  }
2564
2581
 
@@ -2568,8 +2585,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
2568
2585
  res = res && typeof res === 'object' && !Array.isArray(res)
2569
2586
  ? [res] // single vnode
2570
2587
  : normalizeChildren(res);
2571
- return res && res.length === 0
2572
- ? undefined
2588
+ return res && (
2589
+ res.length === 0 ||
2590
+ (res.length === 1 && res[0].isComment) // #9658
2591
+ ) ? undefined
2573
2592
  : res
2574
2593
  };
2575
2594
  // this is a slot using the new v-slot syntax without scope. although it is
@@ -2749,12 +2768,13 @@ function bindObjectProps (
2749
2768
  : data.attrs || (data.attrs = {});
2750
2769
  }
2751
2770
  var camelizedKey = camelize(key);
2752
- if (!(key in hash) && !(camelizedKey in hash)) {
2771
+ var hyphenatedKey = hyphenate(key);
2772
+ if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2753
2773
  hash[key] = value[key];
2754
2774
 
2755
2775
  if (isSync) {
2756
2776
  var on = data.on || (data.on = {});
2757
- on[("update:" + camelizedKey)] = function ($event) {
2777
+ on[("update:" + key)] = function ($event) {
2758
2778
  value[key] = $event;
2759
2779
  };
2760
2780
  }
@@ -2853,14 +2873,16 @@ function bindObjectListeners (data, value) {
2853
2873
 
2854
2874
  function resolveScopedSlots (
2855
2875
  fns, // see flow/vnode
2876
+ res,
2877
+ // the following are added in 2.6
2856
2878
  hasDynamicKeys,
2857
- res
2879
+ contentHashKey
2858
2880
  ) {
2859
2881
  res = res || { $stable: !hasDynamicKeys };
2860
2882
  for (var i = 0; i < fns.length; i++) {
2861
2883
  var slot = fns[i];
2862
2884
  if (Array.isArray(slot)) {
2863
- resolveScopedSlots(slot, hasDynamicKeys, res);
2885
+ resolveScopedSlots(slot, res, hasDynamicKeys);
2864
2886
  } else if (slot) {
2865
2887
  // marker for reverse proxying v-slot without scope on this.$slots
2866
2888
  if (slot.proxy) {
@@ -2869,6 +2891,9 @@ function resolveScopedSlots (
2869
2891
  res[slot.key] = slot.fn;
2870
2892
  }
2871
2893
  }
2894
+ if (contentHashKey) {
2895
+ (res).$key = contentHashKey;
2896
+ }
2872
2897
  return res
2873
2898
  }
2874
2899
 
@@ -3583,17 +3608,23 @@ function resolveAsyncComponent (
3583
3608
  return factory.resolved
3584
3609
  }
3585
3610
 
3611
+ var owner = currentRenderingInstance;
3612
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3613
+ // already pending
3614
+ factory.owners.push(owner);
3615
+ }
3616
+
3586
3617
  if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3587
3618
  return factory.loadingComp
3588
3619
  }
3589
3620
 
3590
- var owner = currentRenderingInstance;
3591
- if (isDef(factory.owners)) {
3592
- // already pending
3593
- factory.owners.push(owner);
3594
- } else {
3621
+ if (owner && !isDef(factory.owners)) {
3595
3622
  var owners = factory.owners = [owner];
3596
3623
  var sync = true;
3624
+ var timerLoading = null;
3625
+ var timerTimeout = null
3626
+
3627
+ ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3597
3628
 
3598
3629
  var forceRender = function (renderCompleted) {
3599
3630
  for (var i = 0, l = owners.length; i < l; i++) {
@@ -3602,6 +3633,14 @@ function resolveAsyncComponent (
3602
3633
 
3603
3634
  if (renderCompleted) {
3604
3635
  owners.length = 0;
3636
+ if (timerLoading !== null) {
3637
+ clearTimeout(timerLoading);
3638
+ timerLoading = null;
3639
+ }
3640
+ if (timerTimeout !== null) {
3641
+ clearTimeout(timerTimeout);
3642
+ timerTimeout = null;
3643
+ }
3605
3644
  }
3606
3645
  };
3607
3646
 
@@ -3648,7 +3687,8 @@ function resolveAsyncComponent (
3648
3687
  if (res.delay === 0) {
3649
3688
  factory.loading = true;
3650
3689
  } else {
3651
- setTimeout(function () {
3690
+ timerLoading = setTimeout(function () {
3691
+ timerLoading = null;
3652
3692
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3653
3693
  factory.loading = true;
3654
3694
  forceRender(false);
@@ -3658,7 +3698,8 @@ function resolveAsyncComponent (
3658
3698
  }
3659
3699
 
3660
3700
  if (isDef(res.timeout)) {
3661
- setTimeout(function () {
3701
+ timerTimeout = setTimeout(function () {
3702
+ timerTimeout = null;
3662
3703
  if (isUndef(factory.resolved)) {
3663
3704
  reject(
3664
3705
  "timeout (" + (res.timeout) + "ms)"
@@ -4046,9 +4087,12 @@ function updateChildComponent (
4046
4087
  // check if there are dynamic scopedSlots (hand-written or compiled but with
4047
4088
  // dynamic slot names). Static scoped slots compiled from template has the
4048
4089
  // "$stable" marker.
4090
+ var newScopedSlots = parentVnode.data.scopedSlots;
4091
+ var oldScopedSlots = vm.$scopedSlots;
4049
4092
  var hasDynamicScopedSlot = !!(
4050
- (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
4051
- (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
4093
+ (newScopedSlots && !newScopedSlots.$stable) ||
4094
+ (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4095
+ (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4052
4096
  );
4053
4097
 
4054
4098
  // Any static slot children from the parent may have changed during parent's
@@ -4201,11 +4245,21 @@ var getNow = Date.now;
4201
4245
  // timestamp can either be hi-res (relative to page load) or low-res
4202
4246
  // (relative to UNIX epoch), so in order to compare time we have to use the
4203
4247
  // same timestamp type when saving the flush timestamp.
4204
- if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
4205
- // if the low-res timestamp which is bigger than the event timestamp
4206
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
4207
- // and we need to use the hi-res version for event listeners as well.
4208
- getNow = function () { return performance.now(); };
4248
+ // All IE versions use low-res event timestamps, and have problematic clock
4249
+ // implementations (#9632)
4250
+ if (inBrowser && !isIE) {
4251
+ var performance = window.performance;
4252
+ if (
4253
+ performance &&
4254
+ typeof performance.now === 'function' &&
4255
+ getNow() > document.createEvent('Event').timeStamp
4256
+ ) {
4257
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4258
+ // smaller than it, it means the event is using a hi-res timestamp,
4259
+ // and we need to use the hi-res version for event listener timestamps as
4260
+ // well.
4261
+ getNow = function () { return performance.now(); };
4262
+ }
4209
4263
  }
4210
4264
 
4211
4265
  /**
@@ -5370,7 +5424,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
5370
5424
  value: FunctionalRenderContext
5371
5425
  });
5372
5426
 
5373
- Vue.version = '2.6.6';
5427
+ Vue.version = '2.6.10';
5374
5428
 
5375
5429
  /* */
5376
5430
 
@@ -6823,8 +6877,10 @@ function add$1 (
6823
6877
  e.target === e.currentTarget ||
6824
6878
  // event is fired after handler attachment
6825
6879
  e.timeStamp >= attachedTimestamp ||
6826
- // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
6827
- e.timeStamp === 0 ||
6880
+ // bail for environments that have buggy event.timeStamp implementations
6881
+ // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
6882
+ // #9681 QtWebEngine event.timeStamp is negative value
6883
+ e.timeStamp <= 0 ||
6828
6884
  // #9448 bail if event is fired in another document in a multi-page
6829
6885
  // electron/nw.js app, since event.timeStamp will be using a different
6830
6886
  // starting reference
@@ -6891,10 +6947,11 @@ function updateDOMProps (oldVnode, vnode) {
6891
6947
  }
6892
6948
 
6893
6949
  for (key in oldProps) {
6894
- if (isUndef(props[key])) {
6950
+ if (!(key in props)) {
6895
6951
  elm[key] = '';
6896
6952
  }
6897
6953
  }
6954
+
6898
6955
  for (key in props) {
6899
6956
  cur = props[key];
6900
6957
  // ignore children if the node has textContent or innerHTML,
@@ -6910,15 +6967,7 @@ function updateDOMProps (oldVnode, vnode) {
6910
6967
  }
6911
6968
  }
6912
6969
 
6913
- // skip the update if old and new VDOM state is the same.
6914
- // the only exception is `value` where the DOM value may be temporarily
6915
- // out of sync with VDOM state due to focus, composition and modifiers.
6916
- // This also covers #4521 by skipping the unnecesarry `checked` update.
6917
- if (key !== 'value' && cur === oldProps[key]) {
6918
- continue
6919
- }
6920
-
6921
- if (key === 'value') {
6970
+ if (key === 'value' && elm.tagName !== 'PROGRESS') {
6922
6971
  // store value as _value as well since
6923
6972
  // non-string values will be stringified
6924
6973
  elm._value = cur;
@@ -6938,8 +6987,18 @@ function updateDOMProps (oldVnode, vnode) {
6938
6987
  while (svg.firstChild) {
6939
6988
  elm.appendChild(svg.firstChild);
6940
6989
  }
6941
- } else {
6942
- elm[key] = cur;
6990
+ } else if (
6991
+ // skip the update if old and new VDOM state is the same.
6992
+ // `value` is handled separately because the DOM value may be temporarily
6993
+ // out of sync with VDOM state due to focus, composition and modifiers.
6994
+ // This #4521 by skipping the unnecesarry `checked` update.
6995
+ cur !== oldProps[key]
6996
+ ) {
6997
+ // some property updates can throw
6998
+ // e.g. `value` on <progress> w/ non-finite value
6999
+ try {
7000
+ elm[key] = cur;
7001
+ } catch (e) {}
6943
7002
  }
6944
7003
  }
6945
7004
  }
@@ -7440,8 +7499,8 @@ function enter (vnode, toggleDisplay) {
7440
7499
  var context = activeInstance;
7441
7500
  var transitionNode = activeInstance.$vnode;
7442
7501
  while (transitionNode && transitionNode.parent) {
7443
- transitionNode = transitionNode.parent;
7444
7502
  context = transitionNode.context;
7503
+ transitionNode = transitionNode.parent;
7445
7504
  }
7446
7505
 
7447
7506
  var isAppear = !context._isMounted || !vnode.isRootInsert;