vue 2.6.9 → 2.6.13

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 (57) hide show
  1. package/README.md +133 -74
  2. package/dist/README.md +2 -4
  3. package/dist/vue.common.dev.js +195 -107
  4. package/dist/vue.common.prod.js +3 -3
  5. package/dist/vue.esm.browser.js +189 -107
  6. package/dist/vue.esm.browser.min.js +3 -3
  7. package/dist/vue.esm.js +195 -107
  8. package/dist/vue.js +195 -107
  9. package/dist/vue.min.js +3 -3
  10. package/dist/vue.runtime.common.dev.js +159 -91
  11. package/dist/vue.runtime.common.prod.js +3 -3
  12. package/dist/vue.runtime.esm.js +159 -91
  13. package/dist/vue.runtime.js +159 -91
  14. package/dist/vue.runtime.min.js +3 -3
  15. package/package.json +5 -5
  16. package/src/compiler/codegen/events.js +3 -3
  17. package/src/compiler/codegen/index.js +3 -2
  18. package/src/compiler/error-detector.js +18 -3
  19. package/src/compiler/parser/html-parser.js +3 -3
  20. package/src/compiler/parser/index.js +11 -7
  21. package/src/core/components/keep-alive.js +42 -14
  22. package/src/core/instance/lifecycle.js +2 -1
  23. package/src/core/instance/proxy.js +2 -2
  24. package/src/core/instance/render-helpers/bind-dynamic-keys.js +2 -2
  25. package/src/core/instance/render-helpers/check-keycodes.js +1 -0
  26. package/src/core/instance/render-helpers/render-slot.js +10 -8
  27. package/src/core/instance/render.js +1 -1
  28. package/src/core/instance/state.js +8 -6
  29. package/src/core/observer/scheduler.js +17 -11
  30. package/src/core/observer/watcher.js +3 -5
  31. package/src/core/util/env.js +1 -2
  32. package/src/core/util/next-tick.js +1 -1
  33. package/src/core/util/props.js +24 -15
  34. package/src/core/vdom/create-component.js +4 -2
  35. package/src/core/vdom/create-element.js +6 -0
  36. package/src/core/vdom/helpers/normalize-scoped-slots.js +5 -3
  37. package/src/core/vdom/helpers/resolve-async-component.js +14 -2
  38. package/src/core/vdom/patch.js +6 -6
  39. package/src/platforms/web/compiler/modules/model.js +1 -1
  40. package/src/platforms/web/runtime/modules/attrs.js +3 -3
  41. package/src/platforms/web/runtime/modules/dom-props.js +3 -2
  42. package/src/platforms/web/server/modules/attrs.js +4 -0
  43. package/src/platforms/web/server/modules/dom-props.js +2 -2
  44. package/src/platforms/web/server/util.js +4 -4
  45. package/src/platforms/web/util/attrs.js +1 -1
  46. package/src/platforms/web/util/element.js +1 -1
  47. package/src/server/template-renderer/create-async-file-mapper.js +5 -1
  48. package/types/index.d.ts +1 -2
  49. package/types/options.d.ts +3 -3
  50. package/types/umd.d.ts +48 -0
  51. package/types/vnode.d.ts +3 -3
  52. package/types/vue.d.ts +5 -1
  53. package/src/.DS_Store +0 -0
  54. package/src/compiler/.DS_Store +0 -0
  55. package/src/platforms/.DS_Store +0 -0
  56. package/src/platforms/weex/.DS_Store +0 -0
  57. package/src/platforms/weex/compiler/.DS_Store +0 -0
package/dist/vue.esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Vue.js v2.6.9
3
- * (c) 2014-2019 Evan You
2
+ * Vue.js v2.6.13
3
+ * (c) 2014-2021 Evan You
4
4
  * Released under the MIT License.
5
5
  */
6
6
  /* */
@@ -1704,13 +1704,14 @@ function assertProp (
1704
1704
  type = [type];
1705
1705
  }
1706
1706
  for (var i = 0; i < type.length && !valid; i++) {
1707
- var assertedType = assertType(value, type[i]);
1707
+ var assertedType = assertType(value, type[i], vm);
1708
1708
  expectedTypes.push(assertedType.expectedType || '');
1709
1709
  valid = assertedType.valid;
1710
1710
  }
1711
1711
  }
1712
1712
 
1713
- if (!valid) {
1713
+ var haveExpectedTypes = expectedTypes.some(function (t) { return t; });
1714
+ if (!valid && haveExpectedTypes) {
1714
1715
  warn(
1715
1716
  getInvalidTypeMessage(name, value, expectedTypes),
1716
1717
  vm
@@ -1728,9 +1729,9 @@ function assertProp (
1728
1729
  }
1729
1730
  }
1730
1731
 
1731
- var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol)$/;
1732
+ var simpleCheckRE = /^(String|Number|Boolean|Function|Symbol|BigInt)$/;
1732
1733
 
1733
- function assertType (value, type) {
1734
+ function assertType (value, type, vm) {
1734
1735
  var valid;
1735
1736
  var expectedType = getType(type);
1736
1737
  if (simpleCheckRE.test(expectedType)) {
@@ -1745,7 +1746,12 @@ function assertType (value, type) {
1745
1746
  } else if (expectedType === 'Array') {
1746
1747
  valid = Array.isArray(value);
1747
1748
  } else {
1748
- valid = value instanceof type;
1749
+ try {
1750
+ valid = value instanceof type;
1751
+ } catch (e) {
1752
+ warn('Invalid prop type: "' + String(type) + '" is not a constructor', vm);
1753
+ valid = false;
1754
+ }
1749
1755
  }
1750
1756
  return {
1751
1757
  valid: valid,
@@ -1753,13 +1759,15 @@ function assertType (value, type) {
1753
1759
  }
1754
1760
  }
1755
1761
 
1762
+ var functionTypeCheckRE = /^\s*function (\w+)/;
1763
+
1756
1764
  /**
1757
1765
  * Use function string name to check built-in types,
1758
1766
  * because a simple equality check will fail when running
1759
1767
  * across different vms / iframes.
1760
1768
  */
1761
1769
  function getType (fn) {
1762
- var match = fn && fn.toString().match(/^\s*function (\w+)/);
1770
+ var match = fn && fn.toString().match(functionTypeCheckRE);
1763
1771
  return match ? match[1] : ''
1764
1772
  }
1765
1773
 
@@ -1784,18 +1792,19 @@ function getInvalidTypeMessage (name, value, expectedTypes) {
1784
1792
  " Expected " + (expectedTypes.map(capitalize).join(', '));
1785
1793
  var expectedType = expectedTypes[0];
1786
1794
  var receivedType = toRawType(value);
1787
- var expectedValue = styleValue(value, expectedType);
1788
- var receivedValue = styleValue(value, receivedType);
1789
1795
  // check if we need to specify expected value
1790
- if (expectedTypes.length === 1 &&
1791
- isExplicable(expectedType) &&
1792
- !isBoolean(expectedType, receivedType)) {
1793
- message += " with value " + expectedValue;
1796
+ if (
1797
+ expectedTypes.length === 1 &&
1798
+ isExplicable(expectedType) &&
1799
+ isExplicable(typeof value) &&
1800
+ !isBoolean(expectedType, receivedType)
1801
+ ) {
1802
+ message += " with value " + (styleValue(value, expectedType));
1794
1803
  }
1795
1804
  message += ", got " + receivedType + " ";
1796
1805
  // check if we need to specify received value
1797
1806
  if (isExplicable(receivedType)) {
1798
- message += "with value " + receivedValue + ".";
1807
+ message += "with value " + (styleValue(value, receivedType)) + ".";
1799
1808
  }
1800
1809
  return message
1801
1810
  }
@@ -1810,9 +1819,9 @@ function styleValue (value, type) {
1810
1819
  }
1811
1820
  }
1812
1821
 
1822
+ var EXPLICABLE_TYPES = ['string', 'number', 'boolean'];
1813
1823
  function isExplicable (value) {
1814
- var explicitTypes = ['string', 'number', 'boolean'];
1815
- return explicitTypes.some(function (elem) { return value.toLowerCase() === elem; })
1824
+ return EXPLICABLE_TYPES.some(function (elem) { return value.toLowerCase() === elem; })
1816
1825
  }
1817
1826
 
1818
1827
  function isBoolean () {
@@ -1969,7 +1978,7 @@ if (typeof Promise !== 'undefined' && isNative(Promise)) {
1969
1978
  isUsingMicroTask = true;
1970
1979
  } else if (typeof setImmediate !== 'undefined' && isNative(setImmediate)) {
1971
1980
  // Fallback to setImmediate.
1972
- // Techinically it leverages the (macro) task queue,
1981
+ // Technically it leverages the (macro) task queue,
1973
1982
  // but it is still a better choice than setTimeout.
1974
1983
  timerFunc = function () {
1975
1984
  setImmediate(flushCallbacks);
@@ -2039,7 +2048,7 @@ if (process.env.NODE_ENV !== 'production') {
2039
2048
  var allowedGlobals = makeMap(
2040
2049
  'Infinity,undefined,NaN,isFinite,isNaN,' +
2041
2050
  'parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,' +
2042
- 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,' +
2051
+ 'Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,' +
2043
2052
  'require' // for Webpack/Browserify
2044
2053
  );
2045
2054
 
@@ -2058,7 +2067,7 @@ if (process.env.NODE_ENV !== 'production') {
2058
2067
  warn(
2059
2068
  "Property \"" + key + "\" must be accessed with \"$data." + key + "\" because " +
2060
2069
  'properties starting with "$" or "_" are not proxied in the Vue instance to ' +
2061
- 'prevent conflicts with Vue internals' +
2070
+ 'prevent conflicts with Vue internals. ' +
2062
2071
  'See: https://vuejs.org/v2/api/#data',
2063
2072
  target
2064
2073
  );
@@ -2544,14 +2553,20 @@ function isWhitespace (node) {
2544
2553
 
2545
2554
  /* */
2546
2555
 
2556
+ function isAsyncPlaceholder (node) {
2557
+ return node.isComment && node.asyncFactory
2558
+ }
2559
+
2560
+ /* */
2561
+
2547
2562
  function normalizeScopedSlots (
2548
2563
  slots,
2549
2564
  normalSlots,
2550
2565
  prevSlots
2551
2566
  ) {
2552
2567
  var res;
2553
- var isStable = slots ? !!slots.$stable : true;
2554
2568
  var hasNormalSlots = Object.keys(normalSlots).length > 0;
2569
+ var isStable = slots ? !!slots.$stable : !hasNormalSlots;
2555
2570
  var key = slots && slots.$key;
2556
2571
  if (!slots) {
2557
2572
  res = {};
@@ -2600,9 +2615,10 @@ function normalizeScopedSlot(normalSlots, key, fn) {
2600
2615
  res = res && typeof res === 'object' && !Array.isArray(res)
2601
2616
  ? [res] // single vnode
2602
2617
  : normalizeChildren(res);
2618
+ var vnode = res && res[0];
2603
2619
  return res && (
2604
- res.length === 0 ||
2605
- (res.length === 1 && res[0].isComment) // #9658
2620
+ !vnode ||
2621
+ (vnode.isComment && !isAsyncPlaceholder(vnode)) // #9658, #10391
2606
2622
  ) ? undefined
2607
2623
  : res
2608
2624
  };
@@ -2675,26 +2691,28 @@ function renderList (
2675
2691
  */
2676
2692
  function renderSlot (
2677
2693
  name,
2678
- fallback,
2694
+ fallbackRender,
2679
2695
  props,
2680
2696
  bindObject
2681
2697
  ) {
2682
2698
  var scopedSlotFn = this.$scopedSlots[name];
2683
2699
  var nodes;
2684
- if (scopedSlotFn) { // scoped slot
2700
+ if (scopedSlotFn) {
2701
+ // scoped slot
2685
2702
  props = props || {};
2686
2703
  if (bindObject) {
2687
2704
  if (process.env.NODE_ENV !== 'production' && !isObject(bindObject)) {
2688
- warn(
2689
- 'slot v-bind without argument expects an Object',
2690
- this
2691
- );
2705
+ warn('slot v-bind without argument expects an Object', this);
2692
2706
  }
2693
2707
  props = extend(extend({}, bindObject), props);
2694
2708
  }
2695
- nodes = scopedSlotFn(props) || fallback;
2709
+ nodes =
2710
+ scopedSlotFn(props) ||
2711
+ (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
2696
2712
  } else {
2697
- nodes = this.$slots[name] || fallback;
2713
+ nodes =
2714
+ this.$slots[name] ||
2715
+ (typeof fallbackRender === 'function' ? fallbackRender() : fallbackRender);
2698
2716
  }
2699
2717
 
2700
2718
  var target = props && props.slot;
@@ -2744,6 +2762,7 @@ function checkKeyCodes (
2744
2762
  } else if (eventKeyName) {
2745
2763
  return hyphenate(eventKeyName) !== key
2746
2764
  }
2765
+ return eventKeyCode === undefined
2747
2766
  }
2748
2767
 
2749
2768
  /* */
@@ -2920,7 +2939,7 @@ function bindDynamicKeys (baseObj, values) {
2920
2939
  if (typeof key === 'string' && key) {
2921
2940
  baseObj[values[i]] = values[i + 1];
2922
2941
  } else if (process.env.NODE_ENV !== 'production' && key !== '' && key !== null) {
2923
- // null is a speical value for explicitly removing a binding
2942
+ // null is a special value for explicitly removing a binding
2924
2943
  warn(
2925
2944
  ("Invalid value for dynamic directive argument (expected string or null): " + key),
2926
2945
  this
@@ -3275,8 +3294,10 @@ function createComponent (
3275
3294
  }
3276
3295
 
3277
3296
  function createComponentInstanceForVnode (
3278
- vnode, // we know it's MountedComponentVNode but flow doesn't
3279
- parent // activeInstance in lifecycle state
3297
+ // we know it's MountedComponentVNode but flow doesn't
3298
+ vnode,
3299
+ // activeInstance in lifecycle state
3300
+ parent
3280
3301
  ) {
3281
3302
  var options = {
3282
3303
  _isComponent: true,
@@ -3416,6 +3437,12 @@ function _createElement (
3416
3437
  ns = (context.$vnode && context.$vnode.ns) || config.getTagNamespace(tag);
3417
3438
  if (config.isReservedTag(tag)) {
3418
3439
  // platform built-in elements
3440
+ if (process.env.NODE_ENV !== 'production' && isDef(data) && isDef(data.nativeOn) && data.tag !== 'component') {
3441
+ warn(
3442
+ ("The .native modifier for v-on is only valid on components but it was used on <" + tag + ">."),
3443
+ context
3444
+ );
3445
+ }
3419
3446
  vnode = new VNode(
3420
3447
  config.parsePlatformTagName(tag), data, children,
3421
3448
  undefined, undefined, context
@@ -3544,7 +3571,7 @@ function renderMixin (Vue) {
3544
3571
  // render self
3545
3572
  var vnode;
3546
3573
  try {
3547
- // There's no need to maintain a stack becaues all render fns are called
3574
+ // There's no need to maintain a stack because all render fns are called
3548
3575
  // separately from one another. Nested component's render fns are called
3549
3576
  // when parent component is patched.
3550
3577
  currentRenderingInstance = vm;
@@ -3639,7 +3666,9 @@ function resolveAsyncComponent (
3639
3666
 
3640
3667
  if (owner && !isDef(factory.owners)) {
3641
3668
  var owners = factory.owners = [owner];
3642
- var sync = true
3669
+ var sync = true;
3670
+ var timerLoading = null;
3671
+ var timerTimeout = null
3643
3672
 
3644
3673
  ;(owner).$on('hook:destroyed', function () { return remove(owners, owner); });
3645
3674
 
@@ -3650,6 +3679,14 @@ function resolveAsyncComponent (
3650
3679
 
3651
3680
  if (renderCompleted) {
3652
3681
  owners.length = 0;
3682
+ if (timerLoading !== null) {
3683
+ clearTimeout(timerLoading);
3684
+ timerLoading = null;
3685
+ }
3686
+ if (timerTimeout !== null) {
3687
+ clearTimeout(timerTimeout);
3688
+ timerTimeout = null;
3689
+ }
3653
3690
  }
3654
3691
  };
3655
3692
 
@@ -3696,7 +3733,8 @@ function resolveAsyncComponent (
3696
3733
  if (res.delay === 0) {
3697
3734
  factory.loading = true;
3698
3735
  } else {
3699
- setTimeout(function () {
3736
+ timerLoading = setTimeout(function () {
3737
+ timerLoading = null;
3700
3738
  if (isUndef(factory.resolved) && isUndef(factory.error)) {
3701
3739
  factory.loading = true;
3702
3740
  forceRender(false);
@@ -3706,7 +3744,8 @@ function resolveAsyncComponent (
3706
3744
  }
3707
3745
 
3708
3746
  if (isDef(res.timeout)) {
3709
- setTimeout(function () {
3747
+ timerTimeout = setTimeout(function () {
3748
+ timerTimeout = null;
3710
3749
  if (isUndef(factory.resolved)) {
3711
3750
  reject(
3712
3751
  process.env.NODE_ENV !== 'production'
@@ -3729,12 +3768,6 @@ function resolveAsyncComponent (
3729
3768
 
3730
3769
  /* */
3731
3770
 
3732
- function isAsyncPlaceholder (node) {
3733
- return node.isComment && node.asyncFactory
3734
- }
3735
-
3736
- /* */
3737
-
3738
3771
  function getFirstComponentChild (children) {
3739
3772
  if (Array.isArray(children)) {
3740
3773
  for (var i = 0; i < children.length; i++) {
@@ -4101,7 +4134,8 @@ function updateChildComponent (
4101
4134
  var hasDynamicScopedSlot = !!(
4102
4135
  (newScopedSlots && !newScopedSlots.$stable) ||
4103
4136
  (oldScopedSlots !== emptyObject && !oldScopedSlots.$stable) ||
4104
- (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key)
4137
+ (newScopedSlots && vm.$scopedSlots.$key !== newScopedSlots.$key) ||
4138
+ (!newScopedSlots && vm.$scopedSlots.$key)
4105
4139
  );
4106
4140
 
4107
4141
  // Any static slot children from the parent may have changed during parent's
@@ -4254,16 +4288,21 @@ var getNow = Date.now;
4254
4288
  // timestamp can either be hi-res (relative to page load) or low-res
4255
4289
  // (relative to UNIX epoch), so in order to compare time we have to use the
4256
4290
  // same timestamp type when saving the flush timestamp.
4257
- if (
4258
- inBrowser &&
4259
- window.performance &&
4260
- typeof performance.now === 'function' &&
4261
- document.createEvent('Event').timeStamp <= performance.now()
4262
- ) {
4263
- // if the event timestamp is bigger than the hi-res timestamp
4264
- // (which is evaluated AFTER) it means the event is using a lo-res timestamp,
4265
- // and we need to use the lo-res version for event listeners as well.
4266
- getNow = function () { return performance.now(); };
4291
+ // All IE versions use low-res event timestamps, and have problematic clock
4292
+ // implementations (#9632)
4293
+ if (inBrowser && !isIE) {
4294
+ var performance = window.performance;
4295
+ if (
4296
+ performance &&
4297
+ typeof performance.now === 'function' &&
4298
+ getNow() > document.createEvent('Event').timeStamp
4299
+ ) {
4300
+ // if the event timestamp, although evaluated AFTER the Date.now(), is
4301
+ // smaller than it, it means the event is using a hi-res timestamp,
4302
+ // and we need to use the hi-res version for event listener timestamps as
4303
+ // well.
4304
+ getNow = function () { return performance.now(); };
4305
+ }
4267
4306
  }
4268
4307
 
4269
4308
  /**
@@ -4550,11 +4589,8 @@ Watcher.prototype.run = function run () {
4550
4589
  var oldValue = this.value;
4551
4590
  this.value = value;
4552
4591
  if (this.user) {
4553
- try {
4554
- this.cb.call(this.vm, value, oldValue);
4555
- } catch (e) {
4556
- handleError(e, this.vm, ("callback for watcher \"" + (this.expression) + "\""));
4557
- }
4592
+ var info = "callback for watcher \"" + (this.expression) + "\"";
4593
+ invokeWithErrorHandling(this.cb, this.vm, [value, oldValue], this.vm, info);
4558
4594
  } else {
4559
4595
  this.cb.call(this.vm, value, oldValue);
4560
4596
  }
@@ -4778,6 +4814,8 @@ function initComputed (vm, computed) {
4778
4814
  warn(("The computed property \"" + key + "\" is already defined in data."), vm);
4779
4815
  } else if (vm.$options.props && key in vm.$options.props) {
4780
4816
  warn(("The computed property \"" + key + "\" is already defined as a prop."), vm);
4817
+ } else if (vm.$options.methods && key in vm.$options.methods) {
4818
+ warn(("The computed property \"" + key + "\" is already defined as a method."), vm);
4781
4819
  }
4782
4820
  }
4783
4821
  }
@@ -4931,11 +4969,10 @@ function stateMixin (Vue) {
4931
4969
  options.user = true;
4932
4970
  var watcher = new Watcher(vm, expOrFn, cb, options);
4933
4971
  if (options.immediate) {
4934
- try {
4935
- cb.call(vm, watcher.value);
4936
- } catch (error) {
4937
- handleError(error, vm, ("callback for immediate watcher \"" + (watcher.expression) + "\""));
4938
- }
4972
+ var info = "callback for immediate watcher \"" + (watcher.expression) + "\"";
4973
+ pushTarget();
4974
+ invokeWithErrorHandling(cb, vm, [watcher.value], vm, info);
4975
+ popTarget();
4939
4976
  }
4940
4977
  return function unwatchFn () {
4941
4978
  watcher.teardown();
@@ -5236,6 +5273,8 @@ function initAssetRegisters (Vue) {
5236
5273
 
5237
5274
 
5238
5275
 
5276
+
5277
+
5239
5278
  function getComponentName (opts) {
5240
5279
  return opts && (opts.Ctor.options.name || opts.tag)
5241
5280
  }
@@ -5257,9 +5296,9 @@ function pruneCache (keepAliveInstance, filter) {
5257
5296
  var keys = keepAliveInstance.keys;
5258
5297
  var _vnode = keepAliveInstance._vnode;
5259
5298
  for (var key in cache) {
5260
- var cachedNode = cache[key];
5261
- if (cachedNode) {
5262
- var name = getComponentName(cachedNode.componentOptions);
5299
+ var entry = cache[key];
5300
+ if (entry) {
5301
+ var name = entry.name;
5263
5302
  if (name && !filter(name)) {
5264
5303
  pruneCacheEntry(cache, key, keys, _vnode);
5265
5304
  }
@@ -5273,9 +5312,9 @@ function pruneCacheEntry (
5273
5312
  keys,
5274
5313
  current
5275
5314
  ) {
5276
- var cached$$1 = cache[key];
5277
- if (cached$$1 && (!current || cached$$1.tag !== current.tag)) {
5278
- cached$$1.componentInstance.$destroy();
5315
+ var entry = cache[key];
5316
+ if (entry && (!current || entry.tag !== current.tag)) {
5317
+ entry.componentInstance.$destroy();
5279
5318
  }
5280
5319
  cache[key] = null;
5281
5320
  remove(keys, key);
@@ -5293,6 +5332,32 @@ var KeepAlive = {
5293
5332
  max: [String, Number]
5294
5333
  },
5295
5334
 
5335
+ methods: {
5336
+ cacheVNode: function cacheVNode() {
5337
+ var ref = this;
5338
+ var cache = ref.cache;
5339
+ var keys = ref.keys;
5340
+ var vnodeToCache = ref.vnodeToCache;
5341
+ var keyToCache = ref.keyToCache;
5342
+ if (vnodeToCache) {
5343
+ var tag = vnodeToCache.tag;
5344
+ var componentInstance = vnodeToCache.componentInstance;
5345
+ var componentOptions = vnodeToCache.componentOptions;
5346
+ cache[keyToCache] = {
5347
+ name: getComponentName(componentOptions),
5348
+ tag: tag,
5349
+ componentInstance: componentInstance,
5350
+ };
5351
+ keys.push(keyToCache);
5352
+ // prune oldest entry
5353
+ if (this.max && keys.length > parseInt(this.max)) {
5354
+ pruneCacheEntry(cache, keys[0], keys, this._vnode);
5355
+ }
5356
+ this.vnodeToCache = null;
5357
+ }
5358
+ }
5359
+ },
5360
+
5296
5361
  created: function created () {
5297
5362
  this.cache = Object.create(null);
5298
5363
  this.keys = [];
@@ -5307,6 +5372,7 @@ var KeepAlive = {
5307
5372
  mounted: function mounted () {
5308
5373
  var this$1 = this;
5309
5374
 
5375
+ this.cacheVNode();
5310
5376
  this.$watch('include', function (val) {
5311
5377
  pruneCache(this$1, function (name) { return matches(val, name); });
5312
5378
  });
@@ -5315,6 +5381,10 @@ var KeepAlive = {
5315
5381
  });
5316
5382
  },
5317
5383
 
5384
+ updated: function updated () {
5385
+ this.cacheVNode();
5386
+ },
5387
+
5318
5388
  render: function render () {
5319
5389
  var slot = this.$slots.default;
5320
5390
  var vnode = getFirstComponentChild(slot);
@@ -5348,12 +5418,9 @@ var KeepAlive = {
5348
5418
  remove(keys, key);
5349
5419
  keys.push(key);
5350
5420
  } else {
5351
- cache[key] = vnode;
5352
- keys.push(key);
5353
- // prune oldest entry
5354
- if (this.max && keys.length > parseInt(this.max)) {
5355
- pruneCacheEntry(cache, keys[0], keys, this._vnode);
5356
- }
5421
+ // delay setting the cache until update
5422
+ this.vnodeToCache = vnode;
5423
+ this.keyToCache = key;
5357
5424
  }
5358
5425
 
5359
5426
  vnode.data.keepAlive = true;
@@ -5436,7 +5503,7 @@ Object.defineProperty(Vue, 'FunctionalRenderContext', {
5436
5503
  value: FunctionalRenderContext
5437
5504
  });
5438
5505
 
5439
- Vue.version = '2.6.9';
5506
+ Vue.version = '2.6.13';
5440
5507
 
5441
5508
  /* */
5442
5509
 
@@ -5473,7 +5540,7 @@ var isBooleanAttr = makeMap(
5473
5540
  'default,defaultchecked,defaultmuted,defaultselected,defer,disabled,' +
5474
5541
  'enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,' +
5475
5542
  'muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,' +
5476
- 'required,reversed,scoped,seamless,selected,sortable,translate,' +
5543
+ 'required,reversed,scoped,seamless,selected,sortable,' +
5477
5544
  'truespeed,typemustmatch,visible'
5478
5545
  );
5479
5546
 
@@ -5597,7 +5664,7 @@ var isHTMLTag = makeMap(
5597
5664
  // contain child elements.
5598
5665
  var isSVG = makeMap(
5599
5666
  'svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,' +
5600
- 'foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5667
+ 'foreignobject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,' +
5601
5668
  'polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view',
5602
5669
  true
5603
5670
  );
@@ -5802,7 +5869,8 @@ var hooks = ['create', 'activate', 'update', 'remove', 'destroy'];
5802
5869
 
5803
5870
  function sameVnode (a, b) {
5804
5871
  return (
5805
- a.key === b.key && (
5872
+ a.key === b.key &&
5873
+ a.asyncFactory === b.asyncFactory && (
5806
5874
  (
5807
5875
  a.tag === b.tag &&
5808
5876
  a.isComment === b.isComment &&
@@ -5810,7 +5878,6 @@ function sameVnode (a, b) {
5810
5878
  sameInputType(a, b)
5811
5879
  ) || (
5812
5880
  isTrue(a.isAsyncPlaceholder) &&
5813
- a.asyncFactory === b.asyncFactory &&
5814
5881
  isUndef(b.asyncFactory.error)
5815
5882
  )
5816
5883
  )
@@ -6109,7 +6176,7 @@ function createPatchFunction (backend) {
6109
6176
  }
6110
6177
  }
6111
6178
 
6112
- function removeVnodes (parentElm, vnodes, startIdx, endIdx) {
6179
+ function removeVnodes (vnodes, startIdx, endIdx) {
6113
6180
  for (; startIdx <= endIdx; ++startIdx) {
6114
6181
  var ch = vnodes[startIdx];
6115
6182
  if (isDef(ch)) {
@@ -6220,7 +6287,7 @@ function createPatchFunction (backend) {
6220
6287
  refElm = isUndef(newCh[newEndIdx + 1]) ? null : newCh[newEndIdx + 1].elm;
6221
6288
  addVnodes(parentElm, refElm, newCh, newStartIdx, newEndIdx, insertedVnodeQueue);
6222
6289
  } else if (newStartIdx > newEndIdx) {
6223
- removeVnodes(parentElm, oldCh, oldStartIdx, oldEndIdx);
6290
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
6224
6291
  }
6225
6292
  }
6226
6293
 
@@ -6312,7 +6379,7 @@ function createPatchFunction (backend) {
6312
6379
  if (isDef(oldVnode.text)) { nodeOps.setTextContent(elm, ''); }
6313
6380
  addVnodes(elm, null, ch, 0, ch.length - 1, insertedVnodeQueue);
6314
6381
  } else if (isDef(oldCh)) {
6315
- removeVnodes(elm, oldCh, 0, oldCh.length - 1);
6382
+ removeVnodes(oldCh, 0, oldCh.length - 1);
6316
6383
  } else if (isDef(oldVnode.text)) {
6317
6384
  nodeOps.setTextContent(elm, '');
6318
6385
  }
@@ -6543,7 +6610,7 @@ function createPatchFunction (backend) {
6543
6610
 
6544
6611
  // destroy old node
6545
6612
  if (isDef(parentElm)) {
6546
- removeVnodes(parentElm, [oldVnode], 0, 0);
6613
+ removeVnodes([oldVnode], 0, 0);
6547
6614
  } else if (isDef(oldVnode.tag)) {
6548
6615
  invokeDestroyHook(oldVnode);
6549
6616
  }
@@ -6700,7 +6767,7 @@ function updateAttrs (oldVnode, vnode) {
6700
6767
  cur = attrs[key];
6701
6768
  old = oldAttrs[key];
6702
6769
  if (old !== cur) {
6703
- setAttr(elm, key, cur);
6770
+ setAttr(elm, key, cur, vnode.data.pre);
6704
6771
  }
6705
6772
  }
6706
6773
  // #4391: in IE9, setting type can reset value for input[type=radio]
@@ -6720,8 +6787,8 @@ function updateAttrs (oldVnode, vnode) {
6720
6787
  }
6721
6788
  }
6722
6789
 
6723
- function setAttr (el, key, value) {
6724
- if (el.tagName.indexOf('-') > -1) {
6790
+ function setAttr (el, key, value, isInPre) {
6791
+ if (isInPre || el.tagName.indexOf('-') > -1) {
6725
6792
  baseSetAttr(el, key, value);
6726
6793
  } else if (isBooleanAttr(key)) {
6727
6794
  // set attribute for blank value
@@ -7600,10 +7667,11 @@ function updateDOMProps (oldVnode, vnode) {
7600
7667
  }
7601
7668
 
7602
7669
  for (key in oldProps) {
7603
- if (isUndef(props[key])) {
7670
+ if (!(key in props)) {
7604
7671
  elm[key] = '';
7605
7672
  }
7606
7673
  }
7674
+
7607
7675
  for (key in props) {
7608
7676
  cur = props[key];
7609
7677
  // ignore children if the node has textContent or innerHTML,
@@ -7643,7 +7711,7 @@ function updateDOMProps (oldVnode, vnode) {
7643
7711
  // skip the update if old and new VDOM state is the same.
7644
7712
  // `value` is handled separately because the DOM value may be temporarily
7645
7713
  // out of sync with VDOM state due to focus, composition and modifiers.
7646
- // This #4521 by skipping the unnecesarry `checked` update.
7714
+ // This #4521 by skipping the unnecessary `checked` update.
7647
7715
  cur !== oldProps[key]
7648
7716
  ) {
7649
7717
  // some property updates can throw
@@ -9247,14 +9315,14 @@ var isNonPhrasingTag = makeMap(
9247
9315
 
9248
9316
  // Regular Expressions for parsing tags and attributes
9249
9317
  var attribute = /^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9250
- var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9318
+ var dynamicArgAttribute = /^\s*((?:v-[\w-]+:|@|:|#)\[[^=]+?\][^\s"'<>\/=]*)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/;
9251
9319
  var ncname = "[a-zA-Z_][\\-\\.0-9_a-zA-Z" + (unicodeRegExp.source) + "]*";
9252
9320
  var qnameCapture = "((?:" + ncname + "\\:)?" + ncname + ")";
9253
9321
  var startTagOpen = new RegExp(("^<" + qnameCapture));
9254
9322
  var startTagClose = /^\s*(\/?)>/;
9255
9323
  var endTag = new RegExp(("^<\\/" + qnameCapture + "[^>]*>"));
9256
9324
  var doctype = /^<!DOCTYPE [^>]+>/i;
9257
- // #7298: escape - to avoid being pased as HTML comment when inlined in page
9325
+ // #7298: escape - to avoid being passed as HTML comment when inlined in page
9258
9326
  var comment = /^<!\--/;
9259
9327
  var conditionalComment = /^<!\[/;
9260
9328
 
@@ -9540,7 +9608,7 @@ function parseHTML (html, options) {
9540
9608
  /* */
9541
9609
 
9542
9610
  var onRE = /^@|^v-on:/;
9543
- var dirRE = /^v-|^@|^:/;
9611
+ var dirRE = /^v-|^@|^:|^#/;
9544
9612
  var forAliasRE = /([\s\S]*?)\s+(?:in|of)\s+([\s\S]*)/;
9545
9613
  var forIteratorRE = /,([^,\}\]]*)(?:,([^,\}\]]*))?$/;
9546
9614
  var stripParensRE = /^\(|\)$/g;
@@ -9553,7 +9621,7 @@ var modifierRE = /\.[^.\]]+(?=[^\]]*$)/g;
9553
9621
  var slotRE = /^v-slot(:|$)|^#/;
9554
9622
 
9555
9623
  var lineBreakRE = /[\r\n]/;
9556
- var whitespaceRE$1 = /\s+/g;
9624
+ var whitespaceRE$1 = /[ \f\t\r\n]+/g;
9557
9625
 
9558
9626
  var invalidAttributeRE = /[\s"'<>\/=]/;
9559
9627
 
@@ -9601,8 +9669,12 @@ function parse (
9601
9669
  platformMustUseProp = options.mustUseProp || no;
9602
9670
  platformGetTagNamespace = options.getTagNamespace || no;
9603
9671
  var isReservedTag = options.isReservedTag || no;
9604
- maybeComponent = function (el) { return !!el.component || !isReservedTag(el.tag); };
9605
-
9672
+ maybeComponent = function (el) { return !!(
9673
+ el.component ||
9674
+ el.attrsMap[':is'] ||
9675
+ el.attrsMap['v-bind:is'] ||
9676
+ !(el.attrsMap.is ? isReservedTag(el.attrsMap.is) : isReservedTag(el.tag))
9677
+ ); };
9606
9678
  transforms = pluckModuleFunction(options.modules, 'transformNode');
9607
9679
  preTransforms = pluckModuleFunction(options.modules, 'preTransformNode');
9608
9680
  postTransforms = pluckModuleFunction(options.modules, 'postTransformNode');
@@ -9895,7 +9967,7 @@ function parse (
9895
9967
  }
9896
9968
  },
9897
9969
  comment: function comment (text, start, end) {
9898
- // adding anyting as a sibling to the root node is forbidden
9970
+ // adding anything as a sibling to the root node is forbidden
9899
9971
  // comments should still be allowed, but ignored
9900
9972
  if (currentParent) {
9901
9973
  var child = {
@@ -10164,7 +10236,7 @@ function processSlotContent (el) {
10164
10236
  if (el.parent && !maybeComponent(el.parent)) {
10165
10237
  warn$2(
10166
10238
  "<template v-slot> can only appear at the root level inside " +
10167
- "the receiving the component",
10239
+ "the receiving component",
10168
10240
  el
10169
10241
  );
10170
10242
  }
@@ -10729,7 +10801,7 @@ function isDirectChildOfTemplateFor (node) {
10729
10801
 
10730
10802
  /* */
10731
10803
 
10732
- var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/;
10804
+ var fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function(?:\s+[\w$]+)?\s*\(/;
10733
10805
  var fnInvokeRE = /\([^)]*?\);*$/;
10734
10806
  var simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/;
10735
10807
 
@@ -10853,9 +10925,9 @@ function genHandler (handler) {
10853
10925
  code += genModifierCode;
10854
10926
  }
10855
10927
  var handlerCode = isMethodPath
10856
- ? ("return " + (handler.value) + "($event)")
10928
+ ? ("return " + (handler.value) + ".apply(null, arguments)")
10857
10929
  : isFunctionExpression
10858
- ? ("return (" + (handler.value) + ")($event)")
10930
+ ? ("return (" + (handler.value) + ").apply(null, arguments)")
10859
10931
  : isFunctionInvocation
10860
10932
  ? ("return " + (handler.value))
10861
10933
  : handler.value;
@@ -10941,7 +11013,8 @@ function generate (
10941
11013
  options
10942
11014
  ) {
10943
11015
  var state = new CodegenState(options);
10944
- var code = ast ? genElement(ast, state) : '_c("div")';
11016
+ // fix #11483, Root level <script> tags should not be rendered.
11017
+ var code = ast ? (ast.tag === 'script' ? 'null' : genElement(ast, state)) : '_c("div")';
10945
11018
  return {
10946
11019
  render: ("with(this){return " + code + "}"),
10947
11020
  staticRenderFns: state.staticRenderFns
@@ -11406,7 +11479,7 @@ function genComment (comment) {
11406
11479
  function genSlot (el, state) {
11407
11480
  var slotName = el.slotName || '"default"';
11408
11481
  var children = genChildren(el, state);
11409
- var res = "_t(" + slotName + (children ? ("," + children) : '');
11482
+ var res = "_t(" + slotName + (children ? (",function(){return " + children + "}") : '');
11410
11483
  var attrs = el.attrs || el.dynamicAttrs
11411
11484
  ? genProps((el.attrs || []).concat(el.dynamicAttrs || []).map(function (attr) { return ({
11412
11485
  // slot props are camelized
@@ -11501,6 +11574,8 @@ function checkNode (node, warn) {
11501
11574
  var range = node.rawAttrsMap[name];
11502
11575
  if (name === 'v-for') {
11503
11576
  checkFor(node, ("v-for=\"" + value + "\""), warn, range);
11577
+ } else if (name === 'v-slot' || name[0] === '#') {
11578
+ checkFunctionParameterExpression(value, (name + "=\"" + value + "\""), warn, range);
11504
11579
  } else if (onRE.test(name)) {
11505
11580
  checkEvent(value, (name + "=\"" + value + "\""), warn, range);
11506
11581
  } else {
@@ -11520,9 +11595,9 @@ function checkNode (node, warn) {
11520
11595
  }
11521
11596
 
11522
11597
  function checkEvent (exp, text, warn, range) {
11523
- var stipped = exp.replace(stripStringRE, '');
11524
- var keywordMatch = stipped.match(unaryOperatorsRE);
11525
- if (keywordMatch && stipped.charAt(keywordMatch.index - 1) !== '$') {
11598
+ var stripped = exp.replace(stripStringRE, '');
11599
+ var keywordMatch = stripped.match(unaryOperatorsRE);
11600
+ if (keywordMatch && stripped.charAt(keywordMatch.index - 1) !== '$') {
11526
11601
  warn(
11527
11602
  "avoid using JavaScript unary operator as property name: " +
11528
11603
  "\"" + (keywordMatch[0]) + "\" in expression " + (text.trim()),
@@ -11577,6 +11652,19 @@ function checkExpression (exp, text, warn, range) {
11577
11652
  }
11578
11653
  }
11579
11654
 
11655
+ function checkFunctionParameterExpression (exp, text, warn, range) {
11656
+ try {
11657
+ new Function(exp, '');
11658
+ } catch (e) {
11659
+ warn(
11660
+ "invalid function parameter expression: " + (e.message) + " in\n\n" +
11661
+ " " + exp + "\n\n" +
11662
+ " Raw expression: " + (text.trim()) + "\n",
11663
+ range
11664
+ );
11665
+ }
11666
+ }
11667
+
11580
11668
  /* */
11581
11669
 
11582
11670
  var range = 2;