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
  */
@@ -472,7 +472,7 @@
472
472
  * using https://www.w3.org/TR/html53/semantics-scripting.html#potentialcustomelementname
473
473
  * skipping \u10000-\uEFFFF due to it freezing up PhantomJS
474
474
  */
475
- 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';
475
+ 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/;
476
476
 
477
477
  /**
478
478
  * Check if a string starts with $ or _
@@ -497,7 +497,7 @@
497
497
  /**
498
498
  * Parse simple path.
499
499
  */
500
- var bailRE = new RegExp(("[^" + unicodeLetters + ".$_\\d]"));
500
+ var bailRE = new RegExp(("[^" + (unicodeRegExp.source) + ".$_\\d]"));
501
501
  function parsePath (path) {
502
502
  if (bailRE.test(path)) {
503
503
  return
@@ -1401,7 +1401,7 @@
1401
1401
  }
1402
1402
 
1403
1403
  function validateComponentName (name) {
1404
- if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + unicodeLetters + "]*$")).test(name)) {
1404
+ if (!new RegExp(("^[a-zA-Z][\\-\\.0-9_" + (unicodeRegExp.source) + "]*$")).test(name)) {
1405
1405
  warn(
1406
1406
  'Invalid component name: "' + name + '". Component names ' +
1407
1407
  'should conform to valid custom element name in html5 specification.'
@@ -1816,23 +1816,30 @@
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 @@
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);
@@ -2529,32 +2539,37 @@
2529
2539
  prevSlots
2530
2540
  ) {
2531
2541
  var res;
2542
+ var hasNormalSlots = Object.keys(normalSlots).length > 0;
2543
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2544
+ var key = slots && slots.$key;
2532
2545
  if (!slots) {
2533
2546
  res = {};
2534
2547
  } else if (slots._normalized) {
2535
2548
  // fast path 1: child component re-render only, parent did not change
2536
2549
  return slots._normalized
2537
2550
  } else if (
2538
- slots.$stable &&
2551
+ isStable &&
2539
2552
  prevSlots &&
2540
2553
  prevSlots !== emptyObject &&
2541
- Object.keys(normalSlots).length === 0
2554
+ key === prevSlots.$key &&
2555
+ !hasNormalSlots &&
2556
+ !prevSlots.$hasNormal
2542
2557
  ) {
2543
2558
  // fast path 2: stable scoped slots w/ no normal slots to proxy,
2544
2559
  // only need to normalize once
2545
2560
  return prevSlots
2546
2561
  } else {
2547
2562
  res = {};
2548
- for (var key in slots) {
2549
- if (slots[key] && key[0] !== '$') {
2550
- res[key] = normalizeScopedSlot(normalSlots, key, slots[key]);
2563
+ for (var key$1 in slots) {
2564
+ if (slots[key$1] && key$1[0] !== '$') {
2565
+ res[key$1] = normalizeScopedSlot(normalSlots, key$1, slots[key$1]);
2551
2566
  }
2552
2567
  }
2553
2568
  }
2554
2569
  // expose normal slots on scopedSlots
2555
- for (var key$1 in normalSlots) {
2556
- if (!(key$1 in res)) {
2557
- res[key$1] = proxyNormalSlot(normalSlots, key$1);
2570
+ for (var key$2 in normalSlots) {
2571
+ if (!(key$2 in res)) {
2572
+ res[key$2] = proxyNormalSlot(normalSlots, key$2);
2558
2573
  }
2559
2574
  }
2560
2575
  // avoriaz seems to mock a non-extensible $scopedSlots object
@@ -2562,7 +2577,9 @@
2562
2577
  if (slots && Object.isExtensible(slots)) {
2563
2578
  (slots)._normalized = res;
2564
2579
  }
2565
- def(res, '$stable', slots ? !!slots.$stable : true);
2580
+ def(res, '$stable', isStable);
2581
+ def(res, '$key', key);
2582
+ def(res, '$hasNormal', hasNormalSlots);
2566
2583
  return res
2567
2584
  }
2568
2585
 
@@ -2572,8 +2589,10 @@
2572
2589
  res = res && typeof res === 'object' && !Array.isArray(res)
2573
2590
  ? [res] // single vnode
2574
2591
  : normalizeChildren(res);
2575
- return res && res.length === 0
2576
- ? undefined
2592
+ return res && (
2593
+ res.length === 0 ||
2594
+ (res.length === 1 && res[0].isComment) // #9658
2595
+ ) ? undefined
2577
2596
  : res
2578
2597
  };
2579
2598
  // this is a slot using the new v-slot syntax without scope. although it is
@@ -2753,12 +2772,13 @@
2753
2772
  : data.attrs || (data.attrs = {});
2754
2773
  }
2755
2774
  var camelizedKey = camelize(key);
2756
- if (!(key in hash) && !(camelizedKey in hash)) {
2775
+ var hyphenatedKey = hyphenate(key);
2776
+ if (!(camelizedKey in hash) && !(hyphenatedKey in hash)) {
2757
2777
  hash[key] = value[key];
2758
2778
 
2759
2779
  if (isSync) {
2760
2780
  var on = data.on || (data.on = {});
2761
- on[("update:" + camelizedKey)] = function ($event) {
2781
+ on[("update:" + key)] = function ($event) {
2762
2782
  value[key] = $event;
2763
2783
  };
2764
2784
  }
@@ -2857,14 +2877,16 @@
2857
2877
 
2858
2878
  function resolveScopedSlots (
2859
2879
  fns, // see flow/vnode
2880
+ res,
2881
+ // the following are added in 2.6
2860
2882
  hasDynamicKeys,
2861
- res
2883
+ contentHashKey
2862
2884
  ) {
2863
2885
  res = res || { $stable: !hasDynamicKeys };
2864
2886
  for (var i = 0; i < fns.length; i++) {
2865
2887
  var slot = fns[i];
2866
2888
  if (Array.isArray(slot)) {
2867
- resolveScopedSlots(slot, hasDynamicKeys, res);
2889
+ resolveScopedSlots(slot, res, hasDynamicKeys);
2868
2890
  } else if (slot) {
2869
2891
  // marker for reverse proxying v-slot without scope on this.$slots
2870
2892
  if (slot.proxy) {
@@ -2873,6 +2895,9 @@
2873
2895
  res[slot.key] = slot.fn;
2874
2896
  }
2875
2897
  }
2898
+ if (contentHashKey) {
2899
+ (res).$key = contentHashKey;
2900
+ }
2876
2901
  return res
2877
2902
  }
2878
2903
 
@@ -3587,17 +3612,23 @@
3587
3612
  return factory.resolved
3588
3613
  }
3589
3614
 
3615
+ var owner = currentRenderingInstance;
3616
+ if (owner && isDef(factory.owners) && factory.owners.indexOf(owner) === -1) {
3617
+ // already pending
3618
+ factory.owners.push(owner);
3619
+ }
3620
+
3590
3621
  if (isTrue(factory.loading) && isDef(factory.loadingComp)) {
3591
3622
  return factory.loadingComp
3592
3623
  }
3593
3624
 
3594
- var owner = currentRenderingInstance;
3595
- if (isDef(factory.owners)) {
3596
- // already pending
3597
- factory.owners.push(owner);
3598
- } else {
3625
+ if (owner && !isDef(factory.owners)) {
3599
3626
  var owners = factory.owners = [owner];
3600
3627
  var sync = true;
3628
+ var timerLoading = null;
3629
+ var timerTimeout = null
3630
+
3631
+ ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3601
3632
 
3602
3633
  var forceRender = function (renderCompleted) {
3603
3634
  for (var i = 0, l = owners.length; i < l; i++) {
@@ -3606,6 +3637,14 @@
3606
3637
 
3607
3638
  if (renderCompleted) {
3608
3639
  owners.length = 0;
3640
+ if (timerLoading !== null) {
3641
+ clearTimeout(timerLoading);
3642
+ timerLoading = null;
3643
+ }
3644
+ if (timerTimeout !== null) {
3645
+ clearTimeout(timerTimeout);
3646
+ timerTimeout = null;
3647
+ }
3609
3648
  }
3610
3649
  };
3611
3650
 
@@ -3652,7 +3691,8 @@
3652
3691
  if (res.delay === 0) {
3653
3692
  factory.loading = true;
3654
3693
  } else {
3655
- setTimeout(function () {
3694
+ timerLoading = setTimeout(function () {
3695
+ timerLoading = null;
3656
3696
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3657
3697
  factory.loading = true;
3658
3698
  forceRender(false);
@@ -3662,7 +3702,8 @@
3662
3702
  }
3663
3703
 
3664
3704
  if (isDef(res.timeout)) {
3665
- setTimeout(function () {
3705
+ timerTimeout = setTimeout(function () {
3706
+ timerTimeout = null;
3666
3707
  if (isUndef(factory.resolved)) {
3667
3708
  reject(
3668
3709
  "timeout (" + (res.timeout) + "ms)"
@@ -4050,9 +4091,12 @@
4050
4091
  // check if there are dynamic scopedSlots (hand-written or compiled but with
4051
4092
  // dynamic slot names). Static scoped slots compiled from template has the
4052
4093
  // "$stable" marker.
4094
+ var newScopedSlots = parentVnode.data.scopedSlots;
4095
+ var oldScopedSlots = vm.$scopedSlots;
4053
4096
  var hasDynamicScopedSlot = !!(
4054
- (parentVnode.data.scopedSlots && !parentVnode.data.scopedSlots.$stable) ||
4055
- (vm.$scopedSlots !== emptyObject && !vm.$scopedSlots.$stable)
4097
+ (newScopedSlots && !newScopedSlots.$stable) ||
4098
+ (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4099
+ (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4056
4100
  );
4057
4101
 
4058
4102
  // Any static slot children from the parent may have changed during parent's
@@ -4205,11 +4249,21 @@
4205
4249
  // timestamp can either be hi-res (relative to page load) or low-res
4206
4250
  // (relative to UNIX epoch), so in order to compare time we have to use the
4207
4251
  // same timestamp type when saving the flush timestamp.
4208
- if (inBrowser && getNow() > document.createEvent('Event').timeStamp) {
4209
- // if the low-res timestamp which is bigger than the event timestamp
4210
- // (which is evaluated AFTER) it means the event is using a hi-res timestamp,
4211
- // and we need to use the hi-res version for event listeners as well.
4212
- getNow = function () { return performance.now(); };
4252
+ // All IE versions use low-res event timestamps, and have problematic clock
4253
+ // implementations (#9632)
4254
+ if (inBrowser && !isIE) {
4255
+ var performance = window.performance;
4256
+ if (
4257
+ performance &&
4258
+ typeof performance.now === 'function' &&
4259
+ getNow() > document.createEvent('Event').timeStamp
4260
+ ) {
4261
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4262
+ // smaller than it, it means the event is using a hi-res timestamp,
4263
+ // and we need to use the hi-res version for event listener timestamps as
4264
+ // well.
4265
+ getNow = function () { return performance.now(); };
4266
+ }
4213
4267
  }
4214
4268
 
4215
4269
  /**
@@ -5374,7 +5428,7 @@
5374
5428
  value: FunctionalRenderContext
5375
5429
  });
5376
5430
 
5377
- Vue.version = '2.6.6';
5431
+ Vue.version = '2.6.10';
5378
5432
 
5379
5433
  /* */
5380
5434
 
@@ -6827,8 +6881,10 @@
6827
6881
  e.target === e.currentTarget ||
6828
6882
  // event is fired after handler attachment
6829
6883
  e.timeStamp >= attachedTimestamp ||
6830
- // #9462 bail for iOS 9 bug: event.timeStamp is 0 after history.pushState
6831
- e.timeStamp === 0 ||
6884
+ // bail for environments that have buggy event.timeStamp implementations
6885
+ // #9462 iOS 9 bug: event.timeStamp is 0 after history.pushState
6886
+ // #9681 QtWebEngine event.timeStamp is negative value
6887
+ e.timeStamp <= 0 ||
6832
6888
  // #9448 bail if event is fired in another document in a multi-page
6833
6889
  // electron/nw.js app, since event.timeStamp will be using a different
6834
6890
  // starting reference
@@ -6895,10 +6951,11 @@
6895
6951
  }
6896
6952
 
6897
6953
  for (key in oldProps) {
6898
- if (isUndef(props[key])) {
6954
+ if (!(key in props)) {
6899
6955
  elm[key] = '';
6900
6956
  }
6901
6957
  }
6958
+
6902
6959
  for (key in props) {
6903
6960
  cur = props[key];
6904
6961
  // ignore children if the node has textContent or innerHTML,
@@ -6914,15 +6971,7 @@
6914
6971
  }
6915
6972
  }
6916
6973
 
6917
- // skip the update if old and new VDOM state is the same.
6918
- // the only exception is `value` where the DOM value may be temporarily
6919
- // out of sync with VDOM state due to focus, composition and modifiers.
6920
- // This also covers #4521 by skipping the unnecesarry `checked` update.
6921
- if (key !== 'value' && cur === oldProps[key]) {
6922
- continue
6923
- }
6924
-
6925
- if (key === 'value') {
6974
+ if (key === 'value' && elm.tagName !== 'PROGRESS') {
6926
6975
  // store value as _value as well since
6927
6976
  // non-string values will be stringified
6928
6977
  elm._value = cur;
@@ -6942,8 +6991,18 @@
6942
6991
  while (svg.firstChild) {
6943
6992
  elm.appendChild(svg.firstChild);
6944
6993
  }
6945
- } else {
6946
- elm[key] = cur;
6994
+ } else if (
6995
+ // skip the update if old and new VDOM state is the same.
6996
+ // `value` is handled separately because the DOM value may be temporarily
6997
+ // out of sync with VDOM state due to focus, composition and modifiers.
6998
+ // This #4521 by skipping the unnecesarry `checked` update.
6999
+ cur !== oldProps[key]
7000
+ ) {
7001
+ // some property updates can throw
7002
+ // e.g. `value` on <progress> w/ non-finite value
7003
+ try {
7004
+ elm[key] = cur;
7005
+ } catch (e) {}
6947
7006
  }
6948
7007
  }
6949
7008
  }
@@ -7444,8 +7503,8 @@
7444
7503
  var context = activeInstance;
7445
7504
  var transitionNode = activeInstance.$vnode;
7446
7505
  while (transitionNode && transitionNode.parent) {
7447
- transitionNode = transitionNode.parent;
7448
7506
  context = transitionNode.context;
7507
+ transitionNode = transitionNode.parent;
7449
7508
  }
7450
7509
 
7451
7510
  var isAppear = !context._isMounted || !vnode.isRootInsert;